@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | define( 'PPP_STORE_URL', 'https://postpromoterpro.com' ); |
18 | 18 | define( 'PPP_PLUGIN_NAME', 'Post Promoter Pro' ); |
19 | -if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
19 | +if ( ! class_exists( 'EDD_SL_Plugin_Updater' )) { |
|
20 | 20 | // load our custom updater |
21 | - include( PPP_PATH . '/includes/EDD_SL_Plugin_Updater.php' ); |
|
21 | + include(PPP_PATH.'/includes/EDD_SL_Plugin_Updater.php'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | class PostPromoterPro { |
@@ -27,30 +27,30 @@ discard block |
||
27 | 27 | private function __construct() { |
28 | 28 | add_action( 'init', array( $this, 'ppp_loaddomain' ), 1 ); |
29 | 29 | |
30 | - if ( ! is_callable( 'curl_init' ) ) { |
|
30 | + if ( ! is_callable( 'curl_init' )) { |
|
31 | 31 | add_action( 'admin_notices', array( $this, 'no_curl' ) ); |
32 | 32 | } else { |
33 | 33 | global $ppp_options, $ppp_social_settings, $ppp_share_settings; |
34 | 34 | |
35 | - include PPP_PATH . '/includes/general-functions.php'; |
|
36 | - include PPP_PATH . '/includes/share-functions.php'; |
|
37 | - include PPP_PATH . '/includes/cron-functions.php'; |
|
38 | - include PPP_PATH . '/includes/filters.php'; |
|
39 | - include PPP_PATH . '/includes/libs/social-loader.php'; |
|
35 | + include PPP_PATH.'/includes/general-functions.php'; |
|
36 | + include PPP_PATH.'/includes/share-functions.php'; |
|
37 | + include PPP_PATH.'/includes/cron-functions.php'; |
|
38 | + include PPP_PATH.'/includes/filters.php'; |
|
39 | + include PPP_PATH.'/includes/libs/social-loader.php'; |
|
40 | 40 | |
41 | - if( ! class_exists( 'WP_Logging' ) ) { |
|
42 | - include PPP_PATH . '/includes/libs/class-wp-logging.php'; |
|
41 | + if ( ! class_exists( 'WP_Logging' )) { |
|
42 | + include PPP_PATH.'/includes/libs/class-wp-logging.php'; |
|
43 | 43 | } |
44 | 44 | |
45 | - if ( is_admin() ) { |
|
46 | - include PPP_PATH . '/includes/admin/upgrades.php'; |
|
47 | - include PPP_PATH . '/includes/admin/do-upgrades.php'; |
|
48 | - include PPP_PATH . '/includes/admin/actions.php'; |
|
49 | - include PPP_PATH . '/includes/admin/admin-pages.php'; |
|
50 | - include PPP_PATH . '/includes/admin/admin-ajax.php'; |
|
51 | - include PPP_PATH . '/includes/admin/meta-boxes.php'; |
|
52 | - include PPP_PATH . '/includes/admin/welcome.php'; |
|
53 | - include PPP_PATH . '/includes/admin/dashboard.php'; |
|
45 | + if (is_admin()) { |
|
46 | + include PPP_PATH.'/includes/admin/upgrades.php'; |
|
47 | + include PPP_PATH.'/includes/admin/do-upgrades.php'; |
|
48 | + include PPP_PATH.'/includes/admin/actions.php'; |
|
49 | + include PPP_PATH.'/includes/admin/admin-pages.php'; |
|
50 | + include PPP_PATH.'/includes/admin/admin-ajax.php'; |
|
51 | + include PPP_PATH.'/includes/admin/meta-boxes.php'; |
|
52 | + include PPP_PATH.'/includes/admin/welcome.php'; |
|
53 | + include PPP_PATH.'/includes/admin/dashboard.php'; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $ppp_options = get_option( 'ppp_options' ); |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | $ppp_share_settings = get_option( 'ppp_share_settings' ); |
59 | 59 | |
60 | 60 | // Do some leg work on the social settings for Issue #257 |
61 | - if ( is_array( $ppp_share_settings ) && ! array_key_exists( 'share_on_publish', $ppp_share_settings ) ) { |
|
62 | - $tw_share_on_publish = ! empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? true : false; |
|
63 | - $fb_share_on_publish = ! empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? true : false; |
|
64 | - $li_share_on_publish = ! empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? true : false; |
|
61 | + if (is_array( $ppp_share_settings ) && ! array_key_exists( 'share_on_publish', $ppp_share_settings )) { |
|
62 | + $tw_share_on_publish = ! empty($ppp_share_settings['twitter']['share_on_publish']) ? true : false; |
|
63 | + $fb_share_on_publish = ! empty($ppp_share_settings['facebook']['share_on_publish']) ? true : false; |
|
64 | + $li_share_on_publish = ! empty($ppp_share_settings['linkedin']['share_on_publish']) ? true : false; |
|
65 | 65 | |
66 | 66 | unset( |
67 | 67 | $ppp_share_settings['twitter']['share_on_publish'], |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | $post_types = ppp_supported_post_types(); |
73 | - foreach ( $post_types as $key => $post_type ) { |
|
74 | - $ppp_share_settings['share_on_publish'][ $key ]['twitter'] = $tw_share_on_publish; |
|
75 | - $ppp_share_settings['share_on_publish'][ $key ]['facebook'] = $fb_share_on_publish; |
|
76 | - $ppp_share_settings['share_on_publish'][ $key ]['linkedin'] = $li_share_on_publish; |
|
73 | + foreach ($post_types as $key => $post_type) { |
|
74 | + $ppp_share_settings['share_on_publish'][$key]['twitter'] = $tw_share_on_publish; |
|
75 | + $ppp_share_settings['share_on_publish'][$key]['facebook'] = $fb_share_on_publish; |
|
76 | + $ppp_share_settings['share_on_publish'][$key]['linkedin'] = $li_share_on_publish; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | update_option( 'ppp_share_settings', $ppp_share_settings ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @access public |
91 | 91 | */ |
92 | 92 | public static function getInstance() { |
93 | - if ( !self::$ppp_instance ) { |
|
93 | + if ( ! self::$ppp_instance) { |
|
94 | 94 | self::$ppp_instance = new PostPromoterPro(); |
95 | 95 | } |
96 | 96 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | private function hooks() { |
113 | - if ( is_admin() ) { |
|
113 | + if (is_admin()) { |
|
114 | 114 | add_action( 'admin_init', array( $this, 'ppp_register_settings' ) ); |
115 | 115 | add_action( 'admin_init', 'ppp_upgrade_plugin', 1 ); |
116 | 116 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | add_action( 'admin_enqueue_scripts', array( $this, 'load_styles' ), 99999 ); |
126 | 126 | add_action( 'wp_trash_post', 'ppp_remove_scheduled_shares', 10, 1 ); |
127 | 127 | |
128 | - if ( ppp_is_dev_or_staging() ) { |
|
128 | + if (ppp_is_dev_or_staging()) { |
|
129 | 129 | add_action( 'admin_notices', array( $this, 'local_site_nag' ) ); |
130 | 130 | } |
131 | 131 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | add_action( 'init', array( $this, 'get_actions' ) ); |
136 | - add_action( 'save_post', 'ppp_schedule_share', 99, 2); |
|
137 | - add_action( 'wp_insert_post', 'ppp_schedule_share', 99, 2); |
|
138 | - add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3); |
|
136 | + add_action( 'save_post', 'ppp_schedule_share', 99, 2 ); |
|
137 | + add_action( 'wp_insert_post', 'ppp_schedule_share', 99, 2 ); |
|
138 | + add_action( 'transition_post_status', 'ppp_share_on_publish', 99, 3 ); |
|
139 | 139 | add_action( 'init', 'ppp_add_image_sizes' ); |
140 | 140 | add_filter( 'wp_log_types', array( $this, 'register_log_type' ), 10, 1 ); |
141 | 141 | } |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | |
161 | 161 | $allowed_pages = apply_filters( 'ppp_admin_scripts_pages', $allowed_pages, $hook ); |
162 | 162 | |
163 | - if ( ! in_array( $hook, $allowed_pages ) ) { |
|
163 | + if ( ! in_array( $hook, $allowed_pages )) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | 167 | wp_enqueue_script( 'jquery-ui-core' ); |
168 | 168 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
169 | 169 | |
170 | - $jquery_ui_timepicker_path = PPP_URL . 'includes/scripts/libs/jquery-ui-timepicker-addon.js'; |
|
171 | - wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path , array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); |
|
170 | + $jquery_ui_timepicker_path = PPP_URL.'includes/scripts/libs/jquery-ui-timepicker-addon.js'; |
|
171 | + wp_enqueue_script( 'ppp_timepicker_js', $jquery_ui_timepicker_path, array( 'jquery', 'jquery-ui-core' ), PPP_VERSION, true ); |
|
172 | 172 | wp_enqueue_script( 'ppp_core_custom_js', PPP_URL.'includes/scripts/js/ppp_custom.js', 'jquery', PPP_VERSION, true ); |
173 | 173 | |
174 | 174 | } |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | |
180 | 180 | // List of people who make it impossible to override their jQuery UI as it's in their core CSS...so only |
181 | 181 | // load ours if they don't exist |
182 | - if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' ) ) { |
|
182 | + if ( ! wp_style_is( 'ot-admin-css' ) && ! wp_style_is( 'jquery-ui-css' )) { |
|
183 | 183 | wp_enqueue_style( 'jquery-ui-css', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css' ); |
184 | 184 | } |
185 | 185 | |
186 | - wp_register_style( 'ppp_admin_css', PPP_URL . 'includes/scripts/css/admin-style.css', false, PPP_VERSION ); |
|
186 | + wp_register_style( 'ppp_admin_css', PPP_URL.'includes/scripts/css/admin-style.css', false, PPP_VERSION ); |
|
187 | 187 | wp_enqueue_style( 'ppp_admin_css' ); |
188 | 188 | |
189 | 189 | $sources = array_map( 'basename', (array) wp_list_pluck( $wp_styles->registered, 'src' ) ); |
190 | - if ( ! in_array( 'font-awesome.css', $sources ) || in_array( 'font-awesome.min.css', $sources ) ) { |
|
190 | + if ( ! in_array( 'font-awesome.css', $sources ) || in_array( 'font-awesome.min.css', $sources )) { |
|
191 | 191 | wp_register_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', false, null ); |
192 | 192 | wp_enqueue_style( 'font-awesome' ); |
193 | 193 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @access public |
203 | 203 | */ |
204 | 204 | public function plugin_settings_links( $links, $file ) { |
205 | - if ( $file != PPP_FILE ) { |
|
205 | + if ($file != PPP_FILE) { |
|
206 | 206 | return $links; |
207 | 207 | } |
208 | 208 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @access public |
297 | 297 | */ |
298 | 298 | public function ppp_loaddomain() { |
299 | - load_plugin_textdomain( 'ppp-txt', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
299 | + load_plugin_textdomain( 'ppp-txt', false, dirname( plugin_basename( __FILE__ ) ).'/languages/' ); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -305,24 +305,24 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function plugin_updater() { |
307 | 307 | global $ppp_options; |
308 | - if ( defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE ) { |
|
308 | + if (defined( 'NO_AUTO_UPDATE' ) && true === NO_AUTO_UPDATE) { |
|
309 | 309 | return; |
310 | 310 | } |
311 | 311 | |
312 | 312 | $license_key = trim( get_option( '_ppp_license_key' ) ); |
313 | 313 | |
314 | - if ( empty( $license_key ) ) { |
|
314 | + if (empty($license_key)) { |
|
315 | 315 | add_action( 'admin_notices', array( $this, 'no_license_nag' ) ); |
316 | 316 | return; |
317 | 317 | } |
318 | 318 | |
319 | 319 | // setup the updater |
320 | 320 | $edd_updater = new EDD_SL_Plugin_Updater( PPP_STORE_URL, __FILE__, array( |
321 | - 'version' => PPP_VERSION, // current version number |
|
322 | - 'license' => $license_key, // license key (used get_option above to retrieve from DB) |
|
323 | - 'item_name' => PPP_PLUGIN_NAME, // name of this plugin |
|
324 | - 'author' => 'Post Promoter Pro', // author of this plugin |
|
325 | - 'beta' => ! empty( $ppp_options['enable_betas'] ) ? true : false, // If we should install beta versions |
|
321 | + 'version' => PPP_VERSION, // current version number |
|
322 | + 'license' => $license_key, // license key (used get_option above to retrieve from DB) |
|
323 | + 'item_name' => PPP_PLUGIN_NAME, // name of this plugin |
|
324 | + 'author' => 'Post Promoter Pro', // author of this plugin |
|
325 | + 'beta' => ! empty($ppp_options['enable_betas']) ? true : false, // If we should install beta versions |
|
326 | 326 | ) |
327 | 327 | ); |
328 | 328 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function local_site_nag() { |
353 | 353 | $dismissed = get_option( 'ppp_local_url_notice_dismissed' ); |
354 | - if ( ! empty( $dismissed ) ) { |
|
354 | + if ( ! empty($dismissed)) { |
|
355 | 355 | return; |
356 | 356 | } |
357 | 357 | ?> |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | |
385 | 385 | public function general_notices() { |
386 | 386 | global $ppp_social_settings; |
387 | - if ( ! empty( $ppp_social_settings['linkedin'] ) && empty( $ppp_social_settings['linkedin']->id ) ) { |
|
387 | + if ( ! empty($ppp_social_settings['linkedin']) && empty($ppp_social_settings['linkedin']->id)) { |
|
388 | 388 | ?> |
389 | 389 | <div id="ppp-linked-update-notice" class="notice notice-error"> |
390 | 390 | <p> |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function deactivate_license() { |
405 | 405 | // listen for our activate button to be clicked |
406 | - if( isset( $_POST['ppp_license_deactivate'] ) ) { |
|
406 | + if (isset($_POST['ppp_license_deactivate'])) { |
|
407 | 407 | |
408 | 408 | // run a quick security check |
409 | - if( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ) ) { |
|
409 | + if ( ! check_admin_referer( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' )) { |
|
410 | 410 | return; |
411 | 411 | } |
412 | 412 | // get out if we didn't click the Activate button |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); |
427 | 427 | |
428 | 428 | // make sure the response came back okay |
429 | - if ( is_wp_error( $response ) ) { |
|
429 | + if (is_wp_error( $response )) { |
|
430 | 430 | return false; |
431 | 431 | } |
432 | 432 | |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
435 | 435 | |
436 | 436 | // $license_data->license will be either "deactivated" or "failed" |
437 | - if( $license_data->license == 'deactivated' ) { |
|
437 | + if ($license_data->license == 'deactivated') { |
|
438 | 438 | delete_option( '_ppp_license_key_status' ); |
439 | 439 | } |
440 | 440 | |
@@ -447,10 +447,10 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public function activate_license() { |
449 | 449 | // listen for our activate button to be clicked |
450 | - if( isset( $_POST['ppp_license_activate'] ) ) { |
|
450 | + if (isset($_POST['ppp_license_activate'])) { |
|
451 | 451 | |
452 | 452 | // run a quick security check |
453 | - if( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' ) ) { |
|
453 | + if ( ! check_admin_referer( 'ppp_activate_nonce', 'ppp_activate_nonce' )) { |
|
454 | 454 | return; |
455 | 455 | } |
456 | 456 | // get out if we didn't click the Activate button |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $response = wp_remote_get( add_query_arg( $api_params, PPP_STORE_URL ), array( 'timeout' => 15, 'sslverify' => false ) ); |
471 | 471 | |
472 | 472 | // make sure the response came back okay |
473 | - if ( is_wp_error( $response ) ) { |
|
473 | + if (is_wp_error( $response )) { |
|
474 | 474 | return false; |
475 | 475 | } |
476 | 476 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | */ |
492 | 492 | public function ppp_sanitize_license( $new ) { |
493 | 493 | $old = get_option( '_ppp_license_key' ); |
494 | - if( $old && $old != $new ) { |
|
494 | + if ($old && $old != $new) { |
|
495 | 495 | delete_option( '_ppp_license_key_status' ); // new license has been entered, so must reactivate |
496 | 496 | } |
497 | 497 | return $new; |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | * @return void |
504 | 504 | */ |
505 | 505 | public function get_actions() { |
506 | - if ( isset( $_GET['ppp_action'] ) ) { |
|
507 | - do_action( 'ppp_' . $_GET['ppp_action'], $_GET ); |
|
506 | + if (isset($_GET['ppp_action'])) { |
|
507 | + do_action( 'ppp_'.$_GET['ppp_action'], $_GET ); |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | */ |
539 | 539 | function post_promoter_pro_activation_setup() { |
540 | 540 | // If the settings already exist, don't do this |
541 | - if ( get_option( 'ppp_options' ) ) { |
|
541 | + if (get_option( 'ppp_options' )) { |
|
542 | 542 | return; |
543 | 543 | } |
544 | 544 |