Skip to content

Commit 23015e2

Browse files
committed
some suggestion added
1 parent e7f9f69 commit 23015e2

File tree

533 files changed

+175289
-49205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

533 files changed

+175289
-49205
lines changed

cbxcareertoolkit.php

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
<?php
22

3-
43
/**
54
*
65
* @link https://codeboxr.com
76
* @since 1.0.0
87
* @package CBXcareertoolkit
98
*
109
* @wordpress-plugin
11-
* Plugin Name: CBX career Toolkit
10+
* Plugin Name: CBX Career Toolkit
1211
* Plugin URI: https://github.com/codeboxrcodehub/cbxcareertoolkit/
13-
* Description: Making Test Case For Development!
12+
* Description: Helper plugin for CBX Career plugins
1413
* Version: 1.0.0
1514
* Author: Codeboxr
1615
* Author URI: https://codeboxr.com
@@ -21,41 +20,29 @@
2120
*/
2221

2322
// If this file is called directly, abort.
24-
if (!defined('WPINC')) {
23+
if ( ! defined( 'WPINC' ) ) {
2524
die;
2625
}
2726

28-
defined('CBXCAREER_TOOLKIT_PLUGIN_NAME') or define('CBXCAREER_TOOLKIT_PLUGIN_NAME', 'cbxcareertoolkit');
29-
defined('CBXCAREER_TOOLKIT_PLUGIN_VERSION') or define('CBXCAREER_TOOLKIT_PLUGIN_VERSION', '1.0.0');
30-
defined('CBXCAREER_TOOLKIT_BASE_NAME') or define('CBXCAREER_TOOLKIT_BASE_NAME', plugin_basename(__FILE__));
31-
defined('CBXCAREER_TOOLKIT_ROOT_PATH') or define('CBXCAREER_TOOLKIT_ROOT_PATH', plugin_dir_path(__FILE__));
32-
defined('CBXCAREER_TOOLKIT_ROOT_URL') or define('CBXCAREER_TOOLKIT_ROOT_URL', plugin_dir_url(__FILE__));
27+
defined( 'CBXCAREER_TOOLKIT_PLUGIN_NAME' ) or define( 'CBXCAREER_TOOLKIT_PLUGIN_NAME', 'cbxcareertoolkit' );
28+
defined( 'CBXCAREER_TOOLKIT_PLUGIN_VERSION' ) or define( 'CBXCAREER_TOOLKIT_PLUGIN_VERSION', '1.0.0' );
29+
defined( 'CBXCAREER_TOOLKIT_BASE_NAME' ) or define( 'CBXCAREER_TOOLKIT_BASE_NAME', plugin_basename( __FILE__ ) );
30+
defined( 'CBXCAREER_TOOLKIT_ROOT_PATH' ) or define( 'CBXCAREER_TOOLKIT_ROOT_PATH', plugin_dir_path( __FILE__ ) );
31+
defined( 'CBXCAREER_TOOLKIT_ROOT_URL' ) or define( 'CBXCAREER_TOOLKIT_ROOT_URL', plugin_dir_url( __FILE__ ) );
3332

34-
defined('CBX_DEBUG') or define('CBX_DEBUG', false);
35-
defined('CBXCAREER_TOOLKIT_DEV_MODE') or define('CBXCAREER_TOOLKIT_DEV_MODE', CBX_DEBUG);
33+
defined( 'CBX_DEBUG' ) or define( 'CBX_DEBUG', false );
34+
defined( 'CBXCAREER_TOOLKIT_DEV_MODE' ) or define( 'CBXCAREER_TOOLKIT_DEV_MODE', CBX_DEBUG );
3635

3736

3837
require_once CBXCAREER_TOOLKIT_ROOT_PATH . "lib/autoload.php";
3938

4039

4140
/**
4241
* The code that runs during plugin activation.
43-
* This action is documented in includes/class-cbxcareer_toolkit-activator.php
4442
*/
45-
function activate_cbx_career_toolkit()
46-
{
47-
// if ( ! cbxcareer_toolkit_compatible_wp_version() ) {
48-
// deactivate_plugins( plugin_basename( __FILE__ ) );
49-
// wp_die( __( 'CBX Dev toolkit plugin requires WordPress 3.5 or higher!', 'cbxcareertoolkit' ) );
50-
// }
51-
//
52-
// if ( ! cbxcareer_toolkit_compatible_php_version() ) {
53-
// deactivate_plugins( plugin_basename( __FILE__ ) );
54-
// wp_die( __( 'CBX Dev toolkit plugin requires PHP 7.4 or higher!', 'cbxcareertoolkit' ) );
55-
// }
56-
43+
function activate_cbx_career_toolkit() {
5744
\Cbx\Careertoolkit\CBXCareertoolkit::activate();
58-
}
45+
}//end function activate_cbx_career_toolkit
5946

6047
/**
6148
* Begins execution of the plugin.
@@ -66,11 +53,10 @@ function activate_cbx_career_toolkit()
6653
*
6754
* @since 1.0.0
6855
*/
69-
function run_cbxcareer_toolkit()
70-
{ // phpcs:ignore WordPress.NamingConventions.ValidFunctionName
56+
function run_cbxcareer_toolkit() {
57+
// phpcs:ignore WordPress.NamingConventions.ValidFunctionName
7158
return \Cbx\Careertoolkit\CBXCareertoolkit::instance();
72-
}
73-
59+
}//end function run_cbxcareer_toolkit
7460

75-
add_action("plugin_loaded", "run_cbxcareer_toolkit");
7661

62+
add_action( "plugin_loaded", "run_cbxcareer_toolkit" );

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cbx/career-toolkit",
3-
"description": "cbx career toolkit for development test plugin",
3+
"description": "Helper plugin for CBX Career plugins",
44
"type": "library",
55
"license": "MIT",
66
"config": {

includes/CBXCareertoolkit.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
namespace Cbx\Careertoolkit;
44

5-
class CBXCareertoolkit
6-
{
5+
class CBXCareertoolkit {
76

87
/**
98
* The single instance of the class.
@@ -38,11 +37,10 @@ class CBXCareertoolkit
3837
*/
3938
protected $hooks;
4039

41-
public function __construct()
42-
{
40+
public function __construct() {
4341
$this->plugin_name = CBXCAREER_TOOLKIT_PLUGIN_NAME;
44-
$this->version = CBXCAREER_TOOLKIT_PLUGIN_VERSION;
45-
$this->hooks = new Hooks();
42+
$this->version = CBXCAREER_TOOLKIT_PLUGIN_VERSION;
43+
$this->hooks = new Hooks();
4644
}
4745

4846
/**
@@ -54,21 +52,18 @@ public function __construct()
5452
* @since 1.0.0
5553
* @static
5654
*/
57-
public static function instance()
58-
{
59-
if (is_null(self::$instance)) {
55+
public static function instance() {
56+
if ( is_null( self::$instance ) ) {
6057
self::$instance = new self();
6158
}
6259

6360
return self::$instance;
6461
}
6562

66-
public static function activate()
67-
{
63+
public static function activate() {
6864
}//end method activate
6965

70-
public static function deactivate()
71-
{
66+
public static function deactivate() {
7267
}//end method activate
7368

74-
}
69+
}//end method CBXCareertoolkit

includes/Factories/Factory.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
* Class Factory
1010
* @since 1.0.0
1111
*/
12-
abstract class Factory
13-
{
12+
abstract class Factory {
1413

15-
public function __construct()
16-
{
14+
public function __construct() {
1715
//$this->faker = FakerFactory::create();
1816
$this->init_commands();
1917
}
@@ -22,16 +20,15 @@ public function __construct()
2220
* Initialize commands
2321
* @since 1.0.0
2422
*/
25-
private function init_commands()
26-
{
23+
private function init_commands() {
2724

28-
if (class_exists("WP_CLI")) {
29-
add_action('cli_init', [$this, 'wp_cli_register_commands']);
25+
if ( class_exists( "WP_CLI" ) ) {
26+
add_action( 'cli_init', [ $this, 'wp_cli_register_commands' ] );
3027
}
3128
}//end method init_commands
3229

3330
abstract public function wp_cli_register_commands();
3431

35-
abstract public function run($args, $assoc_args);
32+
abstract public function run( $args, $assoc_args );
3633

3734
}//end class Factory

includes/Factories/Job/DummyJobGenerate.php

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,14 @@
1010
* Class DummyJobGenerate
1111
* @since 1.0.0
1212
*/
13-
class DummyJobGenerate extends Factory
14-
{
13+
class DummyJobGenerate extends Factory {
1514

1615
/**
1716
* Register CLI command
1817
* @since 1.0.0
1918
*/
20-
public function wp_cli_register_commands()
21-
{
22-
\WP_CLI::add_command('cbxjob-generate', [$this, "run"]);
19+
public function wp_cli_register_commands() {
20+
\WP_CLI::add_command( 'cbxjob-generate', [ $this, "run" ] );
2321
} //end method wp_cli_register_commands
2422

2523
/**
@@ -30,68 +28,66 @@ public function wp_cli_register_commands()
3028
*
3129
* @since 1.0.0
3230
*/
33-
public function run($args, $assoc_args)
34-
{
35-
$start = microtime(true);
31+
public function run( $args, $assoc_args ) {
32+
$start = microtime( true );
3633

37-
$total = isset($assoc_args['total']) && intval($assoc_args['total']) ? intval($assoc_args['total']) : 100;
38-
$status = isset($assoc_args['status']) ? sanitize_text_field($assoc_args['status']) : 'publish';
39-
$is_remote = isset($assoc_args['is-remote']) && intval($assoc_args['is-remote']) ? intval($assoc_args['is-remote']) : 0;
40-
$is_featured = isset($assoc_args['is-featured']) && intval($assoc_args['is-featured']) ? intval($assoc_args['is-featured']) : 1;
41-
$is_filled = isset($assoc_args['is-filled']) && intval($assoc_args['is-filled']) ? intval($assoc_args['is-filled']) : 0;
34+
$total = isset( $assoc_args['total'] ) && intval( $assoc_args['total'] ) ? intval( $assoc_args['total'] ) : 100;
35+
$status = isset( $assoc_args['status'] ) ? sanitize_text_field( $assoc_args['status'] ) : 'publish';
36+
$is_remote = isset( $assoc_args['is-remote'] ) && intval( $assoc_args['is-remote'] ) ? intval( $assoc_args['is-remote'] ) : 0;
37+
$is_featured = isset( $assoc_args['is-featured'] ) && intval( $assoc_args['is-featured'] ) ? intval( $assoc_args['is-featured'] ) : 1;
38+
$is_filled = isset( $assoc_args['is-filled'] ) && intval( $assoc_args['is-filled'] ) ? intval( $assoc_args['is-filled'] ) : 0;
4239

43-
$salary_currency = isset($assoc_args['currency']) ? sanitize_text_field($assoc_args['currency']) : 'USD';
44-
$salary_unit = isset($assoc_args['salary-unit']) ? sanitize_text_field($assoc_args['salary-unit']) : 'monthly';
40+
$salary_currency = isset( $assoc_args['currency'] ) ? sanitize_text_field( $assoc_args['currency'] ) : 'USD';
41+
$salary_unit = isset( $assoc_args['salary-unit'] ) ? sanitize_text_field( $assoc_args['salary-unit'] ) : 'monthly';
4542

46-
$user_id = isset($assoc_args['user-id']) && intval($assoc_args['user-id']) ? intval($assoc_args['user-id']) : 1;
43+
$user_id = isset( $assoc_args['user-id'] ) && intval( $assoc_args['user-id'] ) ? intval( $assoc_args['user-id'] ) : 1;
4744

48-
for ($i = 0; $i < $total; $i++) {
45+
for ( $i = 0; $i < $total; $i ++ ) {
4946

50-
$user_data = get_userdata($user_id);
47+
$user_data = get_userdata( $user_id );
5148

52-
$cbxjob['add_by'] = $user_id; //user id = X
53-
$cbxjob['add_date'] = date('Y-m-d H:i:s');
49+
$cbxjob['add_by'] = $user_id; //user id = X
50+
$cbxjob['add_date'] = date( 'Y-m-d H:i:s' );
5451
//$cbxjob['email'] = FakerFactory::create()->email();
55-
$cbxjob['email'] = $user_data->user_email;
56-
$cbxjob['title'] = FakerFactory::create()->jobTitle();
57-
$cbxjob['status'] = $status;
58-
$cbxjob['job_location'] = FakerFactory::create()->address();
59-
$cbxjob['is_featured'] = $is_featured;
60-
$cbxjob['is_filled'] = $is_filled;
61-
$cbxjob['salary_amount'] = FakerFactory::create()->randomNumber(3);
62-
$cbxjob['is_remote'] = $is_remote;
52+
$cbxjob['email'] = $user_data->user_email;
53+
$cbxjob['title'] = FakerFactory::create()->jobTitle();
54+
$cbxjob['status'] = $status;
55+
$cbxjob['job_location'] = FakerFactory::create()->address();
56+
$cbxjob['is_featured'] = $is_featured;
57+
$cbxjob['is_filled'] = $is_filled;
58+
$cbxjob['salary_amount'] = FakerFactory::create()->randomNumber( 3 );
59+
$cbxjob['is_remote'] = $is_remote;
6360
$cbxjob['application_url'] = FakerFactory::create()->url();
64-
$cbxjob['description'] = FakerFactory::create()->text();
65-
$cbxjob['open_positions'] = FakerFactory::create()->randomNumber(1);
61+
$cbxjob['description'] = FakerFactory::create()->text();
62+
$cbxjob['open_positions'] = FakerFactory::create()->randomNumber( 1 );
6663

6764
$cbxjob['misc'] = [
68-
'salary_currency' => $salary_currency,
69-
'job_location' => FakerFactory::create()->address(),
70-
'company_name' => FakerFactory::create()->company(),
71-
'salary_unit' => $salary_unit,
72-
'company_website' => FakerFactory::create()->url(),
73-
'company_logo' => '',
65+
'salary_currency' => $salary_currency,
66+
'job_location' => FakerFactory::create()->address(),
67+
'company_name' => FakerFactory::create()->company(),
68+
'salary_unit' => $salary_unit,
69+
'company_website' => FakerFactory::create()->url(),
70+
'company_logo' => '',
7471
'company_logo_source' => 'job',
75-
'company_logo_url' => FakerFactory::create()->imageUrl(360, 360, 'company', true),
72+
'company_logo_url' => FakerFactory::create()->imageUrl( 360, 360, 'company', true ),
7673
];
7774

7875

7976
//$cbxjob['mod_by'] = $job->post_author;
80-
$cbxjob['mod_date'] = date('Y-m-d H:i:s');
77+
$cbxjob['mod_date'] = date( 'Y-m-d H:i:s' );
8178

82-
$cbxjob['closing_date'] = date('Y-m-d H:i:s', strtotime('+7 days'));
79+
$cbxjob['closing_date'] = date( 'Y-m-d H:i:s', strtotime( '+7 days' ) );
8380

84-
$cbxjob['expiry_date'] = date('Y-m-d H:i:s', strtotime('+7 days'));
81+
$cbxjob['expiry_date'] = date( 'Y-m-d H:i:s', strtotime( '+7 days' ) );
8582

8683

87-
88-
\Cbx\Job\Models\CBXJob::query()->create($cbxjob);
84+
\Cbx\Job\Models\CBXJob::query()->create( $cbxjob );
8985
}
90-
$end = microtime(true);
86+
$end = microtime( true );
9187

9288
$elapsed = $end - $start;
9389

94-
\WP_CLI::success("Successfully $total dummy job added. Execution time $elapsed seconds");
90+
\WP_CLI::success( "Successfully $total dummy job added. Execution time $elapsed seconds" );
9591

9692
} //end method run
9793
} //end class DummyJobGenerate

0 commit comments

Comments
 (0)