@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 4 | +if ( ! defined( 'ABSPATH' )) exit; |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * Allows plugins to use their own update API. |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $this->name = plugin_basename( $_plugin_file ); |
| 39 | 39 | $this->slug = basename( $_plugin_file, '.php' ); |
| 40 | 40 | $this->version = $_api_data['version']; |
| 41 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
| 42 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
| 43 | - $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
| 41 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
| 42 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
| 43 | + $this->cache_key = md5( serialize( $this->slug.$this->api_data['license'].$this->beta ) ); |
|
| 44 | 44 | |
| 45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
| 45 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
| 46 | 46 | |
| 47 | 47 | // Set up hooks. |
| 48 | 48 | $this->init(); |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
| 62 | 62 | add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
| 63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
| 64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
| 63 | + remove_action( 'after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10 ); |
|
| 64 | + add_action( 'after_plugin_row_'.$this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
| 65 | 65 | add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
| 66 | 66 | |
| 67 | 67 | } |
@@ -83,37 +83,37 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | global $pagenow; |
| 85 | 85 | |
| 86 | - if ( ! is_object( $_transient_data ) ) { |
|
| 86 | + if ( ! is_object( $_transient_data )) { |
|
| 87 | 87 | $_transient_data = new stdClass; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
| 90 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
| 91 | 91 | return $_transient_data; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
| 94 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
| 95 | 95 | return $_transient_data; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $version_info = $this->get_cached_version_info(); |
| 99 | 99 | |
| 100 | - if ( false === $version_info ) { |
|
| 100 | + if (false === $version_info) { |
|
| 101 | 101 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
| 102 | 102 | |
| 103 | 103 | $this->set_version_info_cache( $version_info ); |
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
| 107 | + if (false !== $version_info && is_object( $version_info ) && isset($version_info->new_version)) { |
|
| 108 | 108 | |
| 109 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 109 | + if (version_compare( $this->version, $version_info->new_version, '<' )) { |
|
| 110 | 110 | |
| 111 | - $_transient_data->response[ $this->name ] = $version_info; |
|
| 111 | + $_transient_data->response[$this->name] = $version_info; |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $_transient_data->last_checked = current_time( 'timestamp' ); |
| 116 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
| 116 | + $_transient_data->checked[$this->name] = $this->version; |
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function show_update_notification( $file, $plugin ) { |
| 130 | 130 | |
| 131 | - if ( is_network_admin() ) { |
|
| 131 | + if (is_network_admin()) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
| 135 | + if ( ! current_user_can( 'update_plugins' )) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if( ! is_multisite() ) { |
|
| 139 | + if ( ! is_multisite()) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( $this->name != $file ) { |
|
| 143 | + if ($this->name != $file) { |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -151,56 +151,56 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
| 153 | 153 | |
| 154 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
| 154 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
| 155 | 155 | |
| 156 | 156 | $version_info = $this->get_cached_version_info(); |
| 157 | 157 | |
| 158 | - if ( false === $version_info ) { |
|
| 158 | + if (false === $version_info) { |
|
| 159 | 159 | $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
| 160 | 160 | |
| 161 | 161 | $this->set_version_info_cache( $version_info ); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if ( ! is_object( $version_info ) ) { |
|
| 164 | + if ( ! is_object( $version_info )) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 168 | + if (version_compare( $this->version, $version_info->new_version, '<' )) { |
|
| 169 | 169 | |
| 170 | - $update_cache->response[ $this->name ] = $version_info; |
|
| 170 | + $update_cache->response[$this->name] = $version_info; |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | $update_cache->last_checked = current_time( 'timestamp' ); |
| 175 | - $update_cache->checked[ $this->name ] = $this->version; |
|
| 175 | + $update_cache->checked[$this->name] = $this->version; |
|
| 176 | 176 | |
| 177 | 177 | set_site_transient( 'update_plugins', $update_cache ); |
| 178 | 178 | |
| 179 | 179 | } else { |
| 180 | 180 | |
| 181 | - $version_info = $update_cache->response[ $this->name ]; |
|
| 181 | + $version_info = $update_cache->response[$this->name]; |
|
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // Restore our filter |
| 186 | 186 | add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
| 187 | 187 | |
| 188 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 188 | + if ( ! empty($update_cache->response[$this->name]) && version_compare( $this->version, $version_info->new_version, '<' )) { |
|
| 189 | 189 | |
| 190 | 190 | // build a plugin list row, with update notification |
| 191 | 191 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
| 192 | 192 | # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
| 193 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
| 193 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
| 194 | 194 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
| 195 | 195 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
| 196 | 196 | |
| 197 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
| 197 | + $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911' ); |
|
| 198 | 198 | |
| 199 | - if ( empty( $version_info->download_link ) ) { |
|
| 199 | + if (empty($version_info->download_link)) { |
|
| 200 | 200 | printf( |
| 201 | 201 | __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ), |
| 202 | 202 | esc_html( $version_info->name ), |
| 203 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
| 203 | + '<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">', |
|
| 204 | 204 | esc_html( $version_info->new_version ), |
| 205 | 205 | '</a>' |
| 206 | 206 | ); |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | printf( |
| 209 | 209 | __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ), |
| 210 | 210 | esc_html( $version_info->name ), |
| 211 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
| 211 | + '<a target="_blank" class="thickbox" href="'.esc_url( $changelog_link ).'">', |
|
| 212 | 212 | esc_html( $version_info->new_version ), |
| 213 | 213 | '</a>', |
| 214 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
| 214 | + '<a href="'.esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ).$this->name, 'upgrade-plugin_'.$this->name ) ).'">', |
|
| 215 | 215 | '</a>' |
| 216 | 216 | ); |
| 217 | 217 | } |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
| 236 | 236 | |
| 237 | - if ( $_action != 'plugin_information' ) { |
|
| 237 | + if ($_action != 'plugin_information') { |
|
| 238 | 238 | |
| 239 | 239 | return $_data; |
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
| 243 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
| 244 | 244 | |
| 245 | 245 | return $_data; |
| 246 | 246 | |
@@ -255,20 +255,20 @@ discard block |
||
| 255 | 255 | ) |
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
| 258 | + $cache_key = 'edd_api_request_'.md5( serialize( $this->slug.$this->api_data['license'].$this->beta ) ); |
|
| 259 | 259 | |
| 260 | 260 | // Get the transient where we store the api request for this plugin for 24 hours |
| 261 | 261 | $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
| 262 | 262 | |
| 263 | 263 | //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
| 264 | - if ( empty( $edd_api_request_transient ) ) { |
|
| 264 | + if (empty($edd_api_request_transient)) { |
|
| 265 | 265 | |
| 266 | 266 | $api_response = $this->api_request( 'plugin_information', $to_send ); |
| 267 | 267 | |
| 268 | 268 | // Expires in 3 hours |
| 269 | 269 | $this->set_version_info_cache( $api_response, $cache_key ); |
| 270 | 270 | |
| 271 | - if ( false !== $api_response ) { |
|
| 271 | + if (false !== $api_response) { |
|
| 272 | 272 | $_data = $api_response; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -277,20 +277,20 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
| 280 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
| 280 | + if (isset($_data->sections) && ! is_array( $_data->sections )) { |
|
| 281 | 281 | $new_sections = array(); |
| 282 | - foreach ( $_data->sections as $key => $key ) { |
|
| 283 | - $new_sections[ $key ] = $key; |
|
| 282 | + foreach ($_data->sections as $key => $key) { |
|
| 283 | + $new_sections[$key] = $key; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $_data->sections = $new_sections; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
| 290 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
| 290 | + if (isset($_data->banners) && ! is_array( $_data->banners )) { |
|
| 291 | 291 | $new_banners = array(); |
| 292 | - foreach ( $_data->banners as $key => $key ) { |
|
| 293 | - $new_banners[ $key ] = $key; |
|
| 292 | + foreach ($_data->banners as $key => $key) { |
|
| 293 | + $new_banners[$key] = $key; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $_data->banners = $new_banners; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function http_request_args( $args, $url ) { |
| 310 | 310 | // If it is an https request and we are performing a package download, disable ssl verification |
| 311 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
| 311 | + if (strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' )) { |
|
| 312 | 312 | $args['sslverify'] = false; |
| 313 | 313 | } |
| 314 | 314 | return $args; |
@@ -331,44 +331,44 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | $data = array_merge( $this->api_data, $_data ); |
| 333 | 333 | |
| 334 | - if ( $data['slug'] != $this->slug ) { |
|
| 334 | + if ($data['slug'] != $this->slug) { |
|
| 335 | 335 | return; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if( $this->api_url == trailingslashit (home_url() ) ) { |
|
| 338 | + if ($this->api_url == trailingslashit( home_url() )) { |
|
| 339 | 339 | return false; // Don't allow a plugin to ping itself |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $api_params = array( |
| 343 | 343 | 'edd_action' => 'get_version', |
| 344 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
| 345 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 346 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 347 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
| 344 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
| 345 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 346 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 347 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
| 348 | 348 | 'slug' => $data['slug'], |
| 349 | 349 | 'author' => $data['author'], |
| 350 | 350 | 'url' => home_url(), |
| 351 | - 'beta' => ! empty( $data['beta'] ), |
|
| 351 | + 'beta' => ! empty($data['beta']), |
|
| 352 | 352 | ); |
| 353 | 353 | |
| 354 | 354 | $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
| 355 | 355 | |
| 356 | - if ( ! is_wp_error( $request ) ) { |
|
| 356 | + if ( ! is_wp_error( $request )) { |
|
| 357 | 357 | $request = json_decode( wp_remote_retrieve_body( $request ) ); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if ( $request && isset( $request->sections ) ) { |
|
| 360 | + if ($request && isset($request->sections)) { |
|
| 361 | 361 | $request->sections = maybe_unserialize( $request->sections ); |
| 362 | 362 | } else { |
| 363 | 363 | $request = false; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if ( $request && isset( $request->banners ) ) { |
|
| 366 | + if ($request && isset($request->banners)) { |
|
| 367 | 367 | $request->banners = maybe_unserialize( $request->banners ); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if( ! empty( $request->sections ) ) { |
|
| 371 | - foreach( $request->sections as $key => $section ) { |
|
| 370 | + if ( ! empty($request->sections)) { |
|
| 371 | + foreach ($request->sections as $key => $section) { |
|
| 372 | 372 | $request->$key = (array) $section; |
| 373 | 373 | } |
| 374 | 374 | } |
@@ -380,54 +380,54 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | global $edd_plugin_data; |
| 382 | 382 | |
| 383 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
| 383 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
| 384 | 384 | return; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
| 387 | + if (empty($_REQUEST['plugin'])) { |
|
| 388 | 388 | return; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - if( empty( $_REQUEST['slug'] ) ) { |
|
| 391 | + if (empty($_REQUEST['slug'])) { |
|
| 392 | 392 | return; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
| 395 | + if ( ! current_user_can( 'update_plugins' )) { |
|
| 396 | 396 | wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) ); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
| 400 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
| 401 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
| 399 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
| 400 | + $beta = ! empty($data['beta']) ? true : false; |
|
| 401 | + $cache_key = md5( 'edd_plugin_'.sanitize_key( $_REQUEST['plugin'] ).'_'.$beta.'_version_info' ); |
|
| 402 | 402 | $version_info = $this->get_cached_version_info( $cache_key ); |
| 403 | 403 | |
| 404 | - if( false === $version_info ) { |
|
| 404 | + if (false === $version_info) { |
|
| 405 | 405 | |
| 406 | 406 | $api_params = array( |
| 407 | 407 | 'edd_action' => 'get_version', |
| 408 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 409 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 408 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 409 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 410 | 410 | 'slug' => $_REQUEST['slug'], |
| 411 | 411 | 'author' => $data['author'], |
| 412 | 412 | 'url' => home_url(), |
| 413 | - 'beta' => ! empty( $data['beta'] ) |
|
| 413 | + 'beta' => ! empty($data['beta']) |
|
| 414 | 414 | ); |
| 415 | 415 | |
| 416 | 416 | $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
| 417 | 417 | |
| 418 | - if ( ! is_wp_error( $request ) ) { |
|
| 418 | + if ( ! is_wp_error( $request )) { |
|
| 419 | 419 | $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
| 423 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
| 423 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
| 424 | 424 | $version_info->sections = maybe_unserialize( $version_info->sections ); |
| 425 | 425 | } else { |
| 426 | 426 | $version_info = false; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if( ! empty( $version_info ) ) { |
|
| 430 | - foreach( $version_info->sections as $key => $section ) { |
|
| 429 | + if ( ! empty($version_info)) { |
|
| 430 | + foreach ($version_info->sections as $key => $section) { |
|
| 431 | 431 | $version_info->$key = (array) $section; |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -436,8 +436,8 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
| 440 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
| 439 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
| 440 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | exit; |
@@ -445,13 +445,13 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | public function get_cached_version_info( $cache_key = '' ) { |
| 447 | 447 | |
| 448 | - if( empty( $cache_key ) ) { |
|
| 448 | + if (empty($cache_key)) { |
|
| 449 | 449 | $cache_key = $this->cache_key; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | $cache = get_option( $cache_key ); |
| 453 | 453 | |
| 454 | - if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) { |
|
| 454 | + if (empty($cache['timeout']) || current_time( 'timestamp' ) > $cache['timeout']) { |
|
| 455 | 455 | return false; // Cache is expired |
| 456 | 456 | } |
| 457 | 457 | |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | public function set_version_info_cache( $value = '', $cache_key = '' ) { |
| 463 | 463 | |
| 464 | - if( empty( $cache_key ) ) { |
|
| 464 | + if (empty($cache_key)) { |
|
| 465 | 465 | $cache_key = $this->cache_key; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @since 2.2.3 |
| 18 | 18 | */ |
| 19 | 19 | public static function init() { |
| 20 | - if ( ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
| 20 | + if ( ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -38,34 +38,34 @@ discard block |
||
| 38 | 38 | $number = self::get_count(); |
| 39 | 39 | $shares = ppp_get_shceduled_crons(); |
| 40 | 40 | |
| 41 | - if ( ! empty( $shares ) ) { |
|
| 41 | + if ( ! empty($shares)) { |
|
| 42 | 42 | $limited_shares = array_slice( $shares, 0, $number, true ); |
| 43 | 43 | ?> |
| 44 | 44 | <div id="future-tweets" class="activity-block"> |
| 45 | 45 | <h4><?php _e( 'Post-Related shares', 'ppp-tweets' ); ?></h4> |
| 46 | 46 | <ul> |
| 47 | 47 | <?php |
| 48 | - foreach ( $limited_shares as $key => $share ) { |
|
| 48 | + foreach ($limited_shares as $key => $share) { |
|
| 49 | 49 | $ppp_data = $share; |
| 50 | 50 | $timestamp = $ppp_data['timestamp']; |
| 51 | 51 | |
| 52 | 52 | $name_parts = explode( '_', $ppp_data['args'][1] ); |
| 53 | - $service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw'; |
|
| 54 | - $builder = 'ppp_' . $service . '_build_share_message'; |
|
| 53 | + $service = isset($name_parts[3]) ? $name_parts[3] : 'tw'; |
|
| 54 | + $builder = 'ppp_'.$service.'_build_share_message'; |
|
| 55 | 55 | |
| 56 | 56 | $post_id = $ppp_data['args'][0]; |
| 57 | - $date = $timestamp + ( get_option( 'gmt_offset' ) * 3600 ); |
|
| 57 | + $date = $timestamp + (get_option( 'gmt_offset' ) * 3600); |
|
| 58 | 58 | $content = ''; |
| 59 | - if ( function_exists( $builder ) ) { |
|
| 60 | - $content = $builder( $ppp_data['args'][0], $ppp_data['args'][1], false ); |
|
| 59 | + if (function_exists( $builder )) { |
|
| 60 | + $content = $builder( $ppp_data['args'][0], $ppp_data['args'][1], false ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $regex = "@(https?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@"; |
| 64 | 64 | $content = preg_replace( $regex, '', $content ); |
| 65 | 65 | ?> |
| 66 | 66 | <li> |
| 67 | - <span class="meta"><i class="dashicons icon-ppp-<?php echo $service; ?>"></i> <?php echo date_i18n( 'M jS, ' . get_option( 'time_format' ), $date ); ?></span> |
|
| 68 | - <a href="<?php echo admin_url( 'post.php?post=' . $post_id . '&action=edit' ); ?>"><?php echo $content; ?></a> |
|
| 67 | + <span class="meta"><i class="dashicons icon-ppp-<?php echo $service; ?>"></i> <?php echo date_i18n( 'M jS, '.get_option( 'time_format' ), $date ); ?></span> |
|
| 68 | + <a href="<?php echo admin_url( 'post.php?post='.$post_id.'&action=edit' ); ?>"><?php echo $content; ?></a> |
|
| 69 | 69 | </li> |
| 70 | 70 | <?php } ?> |
| 71 | 71 | </ul> |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | $recent_post = $recent_posts[0]; |
| 88 | 88 | $post_type = get_post_type_object( $recent_post['post_type'] ); |
| 89 | 89 | $post_type_name = $post_type->labels->singular_name; |
| 90 | - $edit_url = admin_url( 'post.php?post=' . $recent_post['ID'] . '&action=edit' ); |
|
| 90 | + $edit_url = admin_url( 'post.php?post='.$recent_post['ID'].'&action=edit' ); |
|
| 91 | 91 | |
| 92 | - switch( $recent_post['post_status'] ) { |
|
| 92 | + switch ($recent_post['post_status']) { |
|
| 93 | 93 | case 'draft': |
| 94 | - $relative_time = __( '<a href="%s">Configure them</a> for your draft ' . $post_type_name, 'ppp-txt' ); |
|
| 94 | + $relative_time = __( '<a href="%s">Configure them</a> for your draft '.$post_type_name, 'ppp-txt' ); |
|
| 95 | 95 | break; |
| 96 | 96 | case 'future': |
| 97 | - $relative_time = __( '<a href="%s">Schedule one</a> for your upcoming ' . $post_type_name, 'ppp-txt' ); |
|
| 97 | + $relative_time = __( '<a href="%s">Schedule one</a> for your upcoming '.$post_type_name, 'ppp-txt' ); |
|
| 98 | 98 | break; |
| 99 | 99 | case 'publish': |
| 100 | 100 | default: |
| 101 | - $relative_time = __( '<a href="%s">Schedule one</a> for your most recent ' . $post_type_name, 'ppp-txt' ); |
|
| 101 | + $relative_time = __( '<a href="%s">Schedule one</a> for your most recent '.$post_type_name, 'ppp-txt' ); |
|
| 102 | 102 | break; |
| 103 | 103 | |
| 104 | 104 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @since 2.2.3 |
| 120 | 120 | */ |
| 121 | 121 | public static function config() { |
| 122 | - if ( ! empty( $_POST['number_of_tweets'] ) ) { |
|
| 122 | + if ( ! empty($_POST['number_of_tweets'])) { |
|
| 123 | 123 | update_option( 'ppp_dashboard_twitter_count', absint( $_POST['number_of_tweets'] ) ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | private static function get_count() { |
| 140 | 140 | $stored_count = get_option( 'ppp_dashboard_shares_count' ); |
| 141 | 141 | |
| 142 | - $stored_count = empty( $stored_count ) || ! is_numeric( $stored_count ) ? 5 : absint( $stored_count ); |
|
| 142 | + $stored_count = empty($stored_count) || ! is_numeric( $stored_count ) ? 5 : absint( $stored_count ); |
|
| 143 | 143 | |
| 144 | - return ! empty( $stored_count ) ? $stored_count : 5; |
|
| 144 | + return ! empty($stored_count) ? $stored_count : 5; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | } |
| 148 | -add_action('wp_dashboard_setup', array('PPP_Dashboard_Shares','init') ); |
|
| 148 | +add_action( 'wp_dashboard_setup', array( 'PPP_Dashboard_Shares', 'init' ) ); |
|
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined( 'ABSPATH' )) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | function ppp_disconnect_social() { |
| 16 | 16 | |
| 17 | - if ( isset( $_GET['ppp_social_disconnect'] ) && isset( $_GET['ppp_network'] ) ) { |
|
| 17 | + if (isset($_GET['ppp_social_disconnect']) && isset($_GET['ppp_network'])) { |
|
| 18 | 18 | |
| 19 | - if ( ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
| 19 | + if ( ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
| 20 | 20 | wp_die( __( 'You do not have permission to view this page', 'ppp-txt' ) ); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $network = $_GET['ppp_network']; |
| 24 | - do_action( 'ppp_disconnect-' . $network ); |
|
| 24 | + do_action( 'ppp_disconnect-'.$network ); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | add_action( 'admin_init', 'ppp_disconnect_social', 10 ); |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $tabs = apply_filters( 'ppp_metabox_tabs', array() ); |
| 37 | 37 | $i = 0; |
| 38 | - foreach ( $tabs as $key => $values ) { |
|
| 39 | - if ( $i === 0 ) { |
|
| 38 | + foreach ($tabs as $key => $values) { |
|
| 39 | + if ($i === 0) { |
|
| 40 | 40 | $visibleKey = $key; |
| 41 | 41 | $class = 'tabs'; |
| 42 | 42 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | ?><li class="<?php echo $class; ?>"><a href="#<?php echo $key; ?>"><?php |
| 47 | - if ( $values['class'] !== false ) { |
|
| 47 | + if ($values['class'] !== false) { |
|
| 48 | 48 | ?> |
| 49 | 49 | <span class="dashicons <?php echo $values['class']; ?>"></span> |
| 50 | 50 | <?php |
@@ -65,15 +65,15 @@ discard block |
||
| 65 | 65 | $tabs = apply_filters( 'ppp_admin_tabs', array() ); |
| 66 | 66 | $i = 0; |
| 67 | 67 | ?><h2 id="ppp-social-connect-tabs" class="nav-tab-wrapper"><?php |
| 68 | - foreach ( $tabs as $key => $values ) { |
|
| 69 | - if ( $i === 0 ) { |
|
| 68 | + foreach ($tabs as $key => $values) { |
|
| 69 | + if ($i === 0) { |
|
| 70 | 70 | $visibleSettingTab = $key; |
| 71 | 71 | $class = ' nav-tab-active'; |
| 72 | 72 | } else { |
| 73 | 73 | $class = ''; |
| 74 | 74 | } |
| 75 | 75 | ?><a class="nav-tab<?php echo $class; ?>" href='#<?php echo $key; ?>'><?php |
| 76 | - if ( $values['class'] !== false ) { |
|
| 76 | + if ($values['class'] !== false) { |
|
| 77 | 77 | ?> |
| 78 | 78 | <span class="dashicons <?php echo $values['class']; ?>"></span> |
| 79 | 79 | <?php |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | function ppp_generate_metabox_content( $post ) { |
| 95 | 95 | global $visibleKey; |
| 96 | 96 | $tab_content = apply_filters( 'ppp_metabox_content', array() ); |
| 97 | - if ( empty( $tab_content ) ) { |
|
| 97 | + if (empty($tab_content)) { |
|
| 98 | 98 | printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) ); |
| 99 | 99 | } else { |
| 100 | - foreach ( $tab_content as $service ) { |
|
| 101 | - $hidden = ( $visibleKey == $service ) ? '' : ' hidden'; |
|
| 100 | + foreach ($tab_content as $service) { |
|
| 101 | + $hidden = ($visibleKey == $service) ? '' : ' hidden'; |
|
| 102 | 102 | ?> |
| 103 | 103 | <div class="wp-tab-panel tabs-panel<?php echo $hidden; ?>" id="<?php echo $service; ?>"> |
| 104 | - <?php do_action( 'ppp_generate_metabox_content-' . $service, $post ); ?> |
|
| 104 | + <?php do_action( 'ppp_generate_metabox_content-'.$service, $post ); ?> |
|
| 105 | 105 | </div> |
| 106 | 106 | <?php |
| 107 | 107 | } |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | function ppp_generate_social_account_content() { |
| 117 | 117 | global $visibleSettingTab; |
| 118 | 118 | $tab_content = apply_filters( 'ppp_admin_social_content', array() ); |
| 119 | - if ( empty( $tab_content ) ) { |
|
| 119 | + if (empty($tab_content)) { |
|
| 120 | 120 | printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) ); |
| 121 | 121 | } else { |
| 122 | - foreach ( $tab_content as $service ) { |
|
| 123 | - $hidden = ( $visibleSettingTab == $service ) ? '' : ' hidden'; |
|
| 122 | + foreach ($tab_content as $service) { |
|
| 123 | + $hidden = ($visibleSettingTab == $service) ? '' : ' hidden'; |
|
| 124 | 124 | ?> |
| 125 | 125 | <div class="ppp-social-connect<?php echo $hidden; ?>" id="<?php echo $service; ?>"> |
| 126 | - <?php do_action( 'ppp_connect_display-' . $service ); ?> |
|
| 126 | + <?php do_action( 'ppp_connect_display-'.$service ); ?> |
|
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | 129 | } |
@@ -136,30 +136,30 @@ discard block |
||
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | 138 | function ppp_list_view_maybe_take_action() { |
| 139 | - if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'ppp-schedule-info' ) { |
|
| 139 | + if ( ! isset($_GET['page']) || $_GET['page'] !== 'ppp-schedule-info') { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( ! isset( $_GET['action'] ) ) { |
|
| 143 | + if ( ! isset($_GET['action'])) { |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Get the necessary info for the actions |
| 148 | - $post_id = isset( $_GET['post_id'] ) ? $_GET['post_id'] : 0; |
|
| 149 | - $name = isset( $_GET['name'] ) ? $_GET['name'] : ''; |
|
| 150 | - $index = isset( $_GET['index'] ) ? $_GET['index'] : 0; |
|
| 151 | - $delete = isset( $_GET['delete_too'] ) ? true : false; |
|
| 148 | + $post_id = isset($_GET['post_id']) ? $_GET['post_id'] : 0; |
|
| 149 | + $name = isset($_GET['name']) ? $_GET['name'] : ''; |
|
| 150 | + $index = isset($_GET['index']) ? $_GET['index'] : 0; |
|
| 151 | + $delete = isset($_GET['delete_too']) ? true : false; |
|
| 152 | 152 | |
| 153 | - switch( $_GET['action'] ) { |
|
| 153 | + switch ($_GET['action']) { |
|
| 154 | 154 | case 'delete_item': |
| 155 | - if ( ! empty( $post_id ) && ! empty( $name ) || empty( $index ) ) { |
|
| 156 | - ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron |
|
| 155 | + if ( ! empty($post_id) && ! empty($name) || empty($index)) { |
|
| 156 | + ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron |
|
| 157 | 157 | |
| 158 | 158 | // Remove the item from postmeta if it exists. |
| 159 | 159 | $current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 160 | 160 | |
| 161 | - if ( isset( $current_post_meta[$index] ) ) { |
|
| 162 | - unset( $current_post_meta[$index] ); |
|
| 161 | + if (isset($current_post_meta[$index])) { |
|
| 162 | + unset($current_post_meta[$index]); |
|
| 163 | 163 | update_post_meta( $post_id, '_ppp_tweets', $current_post_meta ); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | case 'share_now': |
| 171 | - if ( ! empty( $post_id ) && ! empty( $name ) ) { |
|
| 171 | + if ( ! empty($post_id) && ! empty($name)) { |
|
| 172 | 172 | ppp_share_post( $post_id, $name ); |
| 173 | 173 | |
| 174 | - if ( $delete && ! empty( $index ) ) { |
|
| 175 | - ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron |
|
| 174 | + if ($delete && ! empty($index)) { |
|
| 175 | + ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron |
|
| 176 | 176 | |
| 177 | 177 | // Remove the item from postmeta if it exists. |
| 178 | 178 | $current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 179 | 179 | |
| 180 | - if ( isset( $current_post_meta[$index] ) ) { |
|
| 181 | - unset( $current_post_meta[$index] ); |
|
| 180 | + if (isset($current_post_meta[$index])) { |
|
| 181 | + unset($current_post_meta[$index]); |
|
| 182 | 182 | update_post_meta( $post_id, '_ppp_tweets', $current_post_meta ); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly. |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -27,18 +27,18 @@ discard block |
||
| 27 | 27 | <?php _e( 'License Key', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Enter your license key', 'ppp-txt' ); ?></span> |
| 28 | 28 | </th> |
| 29 | 29 | <td> |
| 30 | - <input id="ppp_license_key" name="_ppp_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /><?php if ( $status !== false && $status == 'valid' ) { ?> |
|
| 30 | + <input id="ppp_license_key" name="_ppp_license_key" type="text" class="regular-text" value="<?php esc_attr_e( $license ); ?>" /><?php if ($status !== false && $status == 'valid') { ?> |
|
| 31 | 31 | <span style="color:green;"> <?php _e( 'active', 'ppp-txt' ); ?></span><?php } ?> |
| 32 | 32 | </td> |
| 33 | 33 | </tr> |
| 34 | 34 | |
| 35 | - <?php if ( false !== $license ) { ?> |
|
| 35 | + <?php if (false !== $license) { ?> |
|
| 36 | 36 | <tr valign="top"> |
| 37 | 37 | <th scope="row" valign="top"> |
| 38 | 38 | <?php _e( 'Activate License', 'ppp-txt' ); ?> |
| 39 | 39 | </th> |
| 40 | 40 | <td> |
| 41 | - <?php if ( $status !== false && $status == 'valid' ) { ?> |
|
| 41 | + <?php if ($status !== false && $status == 'valid') { ?> |
|
| 42 | 42 | <?php wp_nonce_field( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ); ?> |
| 43 | 43 | <input type="submit" class="button-secondary" name="ppp_license_deactivate" value="<?php _e( 'Deactivate License', 'ppp-txt' ); ?>"/> |
| 44 | 44 | <?php } else { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | <span style="font-size: x-small;"><a href="#" onclick="jQuery('#ppp-text-helper').toggle(); return false;"><?php _e( 'Default Text Tips', 'ppp-txt' ); ?></a></span> |
| 55 | 55 | </th> |
| 56 | 56 | <td> |
| 57 | - <?php $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; ?> |
|
| 57 | + <?php $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; ?> |
|
| 58 | 58 | <input type="text" class="regular-text" name="ppp_options[default_text]" value="<?php echo $default_text; ?>" placeholder="Post Title will be used if empty" size="50" /> |
| 59 | 59 | <p id="ppp-text-helper" style="display: none"> |
| 60 | 60 | <small> |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | <br /> |
| 65 | 65 | <?php _e( 'Possible Replacements:', 'ppp-txt' ); ?> |
| 66 | 66 | <br /> |
| 67 | - <?php foreach ( ppp_get_text_tokens() as $token ) : ?> |
|
| 67 | + <?php foreach (ppp_get_text_tokens() as $token) : ?> |
|
| 68 | 68 | <code>{<?php echo $token['token']; ?>}</code> - <?php echo $token['description']; ?><br /> |
| 69 | 69 | <?php endforeach; ?> |
| 70 | 70 | </small> |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | <th scope="row"><?php _e( 'Post Types', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'What post types do you want to schedule for?', 'ppp-txt' ); ?></span></th> |
| 77 | 77 | <td> |
| 78 | 78 | <?php $post_types = ppp_supported_post_types(); ?> |
| 79 | - <?php foreach ( $post_types as $post_type => $type_data ) : ?> |
|
| 80 | - <?php $value = ( isset( $ppp_options['post_types'] ) && isset( $ppp_options['post_types'][ $post_type ] ) ) ? true : false; ?> |
|
| 79 | + <?php foreach ($post_types as $post_type => $type_data) : ?> |
|
| 80 | + <?php $value = (isset($ppp_options['post_types']) && isset($ppp_options['post_types'][$post_type])) ? true : false; ?> |
|
| 81 | 81 | <input type="checkbox" name="ppp_options[post_types][<?php echo $post_type; ?>]" value="1" id="<?php echo $post_type; ?>" <?php checked( true, $value, true ); ?> /> |
| 82 | 82 | <label for="<?php echo $post_type; ?>"><?php echo $type_data->labels->name; ?></label></br /> |
| 83 | 83 | <?php endforeach; ?> |
@@ -88,15 +88,15 @@ discard block |
||
| 88 | 88 | <th scope="row"><?php _e( 'Advanced', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Tools for troubleshooting and advanced usage', 'ppp-txt' ); ?></span></th> |
| 89 | 89 | <td> |
| 90 | 90 | <p> |
| 91 | - <?php $debug_enabled = isset( $ppp_options['enable_debug'] ) ? true : false; ?> |
|
| 91 | + <?php $debug_enabled = isset($ppp_options['enable_debug']) ? true : false; ?> |
|
| 92 | 92 | <input type="checkbox" name="ppp_options[enable_debug]" <?php checked( true, $debug_enabled, true ); ?> value="1" /> <?php _e( 'Enable Debug', 'ppp-txt' ); ?> |
| 93 | 93 | </p> |
| 94 | 94 | <p> |
| 95 | - <?php $betas_enabled = isset( $ppp_options['enable_betas'] ) ? true : false; ?> |
|
| 95 | + <?php $betas_enabled = isset($ppp_options['enable_betas']) ? true : false; ?> |
|
| 96 | 96 | <input type="checkbox" name="ppp_options[enable_betas]" <?php checked( true, $betas_enabled, true ); ?> value="1" /> <?php _e( 'Enable Beta Versions', 'ppp-txt' ); ?> |
| 97 | 97 | </p> |
| 98 | 98 | <p> |
| 99 | - <?php $delete_on_uninstall = isset( $ppp_options['delete_on_uninstall'] ) ? true : false; ?> |
|
| 99 | + <?php $delete_on_uninstall = isset($ppp_options['delete_on_uninstall']) ? true : false; ?> |
|
| 100 | 100 | <input type="checkbox" name="ppp_options[delete_on_uninstall]" <?php checked( true, $delete_on_uninstall, true ); ?> value="1" /> <?php _e( 'Delete All Data On Uninstall', 'ppp-txt' ); ?> |
| 101 | 101 | </p> |
| 102 | 102 | </td> |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | <?php wp_nonce_field( 'ppp-share-settings' ); ?> |
| 133 | 133 | <h3><?php _e( 'Social Media Accounts', 'ppp-txt' ); ?></h3> |
| 134 | 134 | <?php |
| 135 | - require_once PPP_PATH . 'includes/admin/class-accounts-table.php'; |
|
| 135 | + require_once PPP_PATH.'includes/admin/class-accounts-table.php'; |
|
| 136 | 136 | |
| 137 | 137 | $accounts_table = new PPP_Accounts_Table(); |
| 138 | 138 | $accounts_table->prepare_items(); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $accounts_table->display(); |
| 141 | 141 | ?> |
| 142 | 142 | <table class="form-table"> |
| 143 | - <?php $analytics_option = isset( $ppp_share_settings['analytics'] ) ? $ppp_share_settings['analytics'] : 0; ?> |
|
| 143 | + <?php $analytics_option = isset($ppp_share_settings['analytics']) ? $ppp_share_settings['analytics'] : 0; ?> |
|
| 144 | 144 | <tr valign="top"> |
| 145 | 145 | <th scope="row" valign="top"> |
| 146 | 146 | <?php _e( 'Analytics', 'ppp-txt' ); ?></span> |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | <hr /> |
| 168 | 168 | <small><?php _e( 'Here is an example of what your link will look like', 'ppp-txt' ); ?>: <br /> |
| 169 | 169 | <?php $post = wp_get_recent_posts( array( 'numberposts' => 1 ) ); ?> |
| 170 | - <?php if ( count( $post ) > 0 ) : ?> |
|
| 171 | - <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_' . $post[0]['ID'], false ); ?></code></small> |
|
| 170 | + <?php if (count( $post ) > 0) : ?> |
|
| 171 | + <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_'.$post[0]['ID'], false ); ?></code></small> |
|
| 172 | 172 | <?php else : ?> |
| 173 | 173 | <em><?php _e( 'No posts available to generate link from.', 'ppp-txt' ); ?></em> |
| 174 | 174 | <?php endif; ?> |
@@ -183,34 +183,34 @@ discard block |
||
| 183 | 183 | </th> |
| 184 | 184 | <td id="ppp-share-on-publish-wrapper"> |
| 185 | 185 | <?php $supported_post_types = ppp_supported_post_types(); ?> |
| 186 | - <?php foreach ( $supported_post_types as $post_type => $post_type_details ) : ?> |
|
| 187 | - <?php if ( ppp_twitter_enabled() || ppp_facebook_enabled() || ppp_linkedin_enabled() ) : ?> |
|
| 186 | + <?php foreach ($supported_post_types as $post_type => $post_type_details) : ?> |
|
| 187 | + <?php if (ppp_twitter_enabled() || ppp_facebook_enabled() || ppp_linkedin_enabled()) : ?> |
|
| 188 | 188 | <?php |
| 189 | - $enabled_post_types = ppp_allowed_post_types(); |
|
| 190 | - if ( ! in_array( $post_type, $enabled_post_types ) ) { |
|
| 189 | + $enabled_post_types = ppp_allowed_post_types(); |
|
| 190 | + if ( ! in_array( $post_type, $enabled_post_types )) { |
|
| 191 | 191 | continue; |
| 192 | 192 | } |
| 193 | 193 | ?> |
| 194 | - <strong><?php echo $supported_post_types[ $post_type ]->label; ?></strong> |
|
| 194 | + <strong><?php echo $supported_post_types[$post_type]->label; ?></strong> |
|
| 195 | 195 | <?php endif; ?> |
| 196 | - <?php $post_type_settings = ! empty( $ppp_share_settings['share_on_publish'][ $post_type ] ) ? $ppp_share_settings['share_on_publish'][ $post_type ] : array(); ?> |
|
| 197 | - <?php if ( ppp_twitter_enabled() ) : ?> |
|
| 196 | + <?php $post_type_settings = ! empty($ppp_share_settings['share_on_publish'][$post_type]) ? $ppp_share_settings['share_on_publish'][$post_type] : array(); ?> |
|
| 197 | + <?php if (ppp_twitter_enabled()) : ?> |
|
| 198 | 198 | <p> |
| 199 | - <input type="checkbox" id="<?php echo $post_type; ?>-twitter-share-on-publish" value="1" <?php checked( true, ! empty( $post_type_settings['twitter'] ), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][twitter]" /> |
|
| 199 | + <input type="checkbox" id="<?php echo $post_type; ?>-twitter-share-on-publish" value="1" <?php checked( true, ! empty($post_type_settings['twitter']), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][twitter]" /> |
|
| 200 | 200 | <label for="<?php echo $post_type; ?>-twitter-share-on-publish"><?php _e( 'Twitter', 'ppp-txt' ); ?></label> |
| 201 | 201 | </p> |
| 202 | 202 | <?php endif; ?> |
| 203 | 203 | |
| 204 | - <?php if ( ppp_facebook_enabled() ) : ?> |
|
| 204 | + <?php if (ppp_facebook_enabled()) : ?> |
|
| 205 | 205 | <p> |
| 206 | - <input type="checkbox" id="<?php echo $post_type; ?>-facebook-share-on-publish" value="1" <?php checked( true, ! empty( $post_type_settings['facebook'] ), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][facebook]" /> |
|
| 206 | + <input type="checkbox" id="<?php echo $post_type; ?>-facebook-share-on-publish" value="1" <?php checked( true, ! empty($post_type_settings['facebook']), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][facebook]" /> |
|
| 207 | 207 | <label for="<?php echo $post_type; ?>-facebook-share-on-publish"><?php _e( 'Facebook', 'ppp-txt' ); ?></label> |
| 208 | 208 | </p> |
| 209 | 209 | <?php endif; ?> |
| 210 | 210 | |
| 211 | - <?php if ( ppp_linkedin_enabled() ) : ?> |
|
| 211 | + <?php if (ppp_linkedin_enabled()) : ?> |
|
| 212 | 212 | <p> |
| 213 | - <input type="checkbox" id="<?php echo $post_type; ?>-linkedin-share-on-publish" value="1" <?php checked( true, ! empty( $post_type_settings['linkedin'] ), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][linkedin]" /> |
|
| 213 | + <input type="checkbox" id="<?php echo $post_type; ?>-linkedin-share-on-publish" value="1" <?php checked( true, ! empty($post_type_settings['linkedin']), true ); ?> name="ppp_share_settings[share_on_publish][<?php echo $post_type; ?>][linkedin]" /> |
|
| 214 | 214 | <label for="<?php echo $post_type; ?>-linkedin-share-on-publish"><?php _e( 'LinkedIn', 'ppp-txt' ); ?></label> |
| 215 | 215 | </p> |
| 216 | 216 | <?php endif; ?> |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | </tr> |
| 234 | 234 | |
| 235 | 235 | <?php |
| 236 | - $shortener = isset( $ppp_share_settings['shortener'] ) ? $ppp_share_settings['shortener'] : false; |
|
| 236 | + $shortener = isset($ppp_share_settings['shortener']) ? $ppp_share_settings['shortener'] : false; |
|
| 237 | 237 | ?> |
| 238 | 238 | <tr valign="top"> |
| 239 | 239 | <th scope="row" valign="top"> |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | <?php do_action( 'ppp_url_shorteners', $shortener ); ?> |
| 247 | 247 | </select> |
| 248 | 248 | </p> |
| 249 | - <?php if ( $shortener ) : ?> |
|
| 250 | - <?php do_action( 'ppp_shortener_settings-' . $shortener ); ?> |
|
| 249 | + <?php if ($shortener) : ?> |
|
| 250 | + <?php do_action( 'ppp_shortener_settings-'.$shortener ); ?> |
|
| 251 | 251 | <?php endif; ?> |
| 252 | 252 | </td> |
| 253 | 253 | </tr> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | .wp-list-table .column-content { width: 50%; } |
| 282 | 282 | </style> |
| 283 | 283 | <?php |
| 284 | - require_once PPP_PATH . 'includes/admin/class-schedule-table.php'; |
|
| 284 | + require_once PPP_PATH.'includes/admin/class-schedule-table.php'; |
|
| 285 | 285 | $schedule_table = new PPP_Schedule_Table(); |
| 286 | 286 | $schedule_table->prepare_items(); |
| 287 | 287 | ?> |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - Scheduled Shares', 'ppp-txt' ); ?></h1> |
| 290 | 290 | <?php $schedule_table->display() ?> |
| 291 | 291 | </div> |
| 292 | - <?php if ( ppp_is_shortener_enabled() ) : ?> |
|
| 292 | + <?php if (ppp_is_shortener_enabled()) : ?> |
|
| 293 | 293 | <p> |
| 294 | 294 | <small><?php _e( 'NOTICE: Schedule view does not show shortened links, they will be shortened at the time of sharing', 'ppp-txt' ); ?></small> |
| 295 | 295 | </p> |
@@ -308,24 +308,24 @@ discard block |
||
| 308 | 308 | <div class="wrap"> |
| 309 | 309 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - System Info', 'ppp-txt' ); ?></h1> |
| 310 | 310 | <textarea style="font-family: Menlo, Monaco, monospace; white-space: pre" onclick="this.focus();this.select()" readonly cols="150" rows="35"> |
| 311 | - SITE_URL: <?php echo site_url() . "\n"; ?> |
|
| 312 | - HOME_URL: <?php echo home_url() . "\n"; ?> |
|
| 311 | + SITE_URL: <?php echo site_url()."\n"; ?> |
|
| 312 | + HOME_URL: <?php echo home_url()."\n"; ?> |
|
| 313 | 313 | |
| 314 | - PPP Version: <?php echo PPP_VERSION . "\n"; ?> |
|
| 315 | - WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
|
| 314 | + PPP Version: <?php echo PPP_VERSION."\n"; ?> |
|
| 315 | + WordPress Version: <?php echo get_bloginfo( 'version' )."\n"; ?> |
|
| 316 | 316 | |
| 317 | 317 | PPP SETTINGS: |
| 318 | 318 | <?php |
| 319 | - foreach ( $ppp_options as $name => $value ) { |
|
| 320 | - if ( $value == false ) { |
|
| 319 | + foreach ($ppp_options as $name => $value) { |
|
| 320 | + if ($value == false) { |
|
| 321 | 321 | $value = 'false'; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if ( $value == '1' ) { |
|
| 324 | + if ($value == '1') { |
|
| 325 | 325 | $value = 'true'; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - echo $name . ': ' . maybe_serialize( $value ) . "\n\t"; |
|
| 328 | + echo $name.': '.maybe_serialize( $value )."\n\t"; |
|
| 329 | 329 | } |
| 330 | 330 | ?> |
| 331 | 331 | |
@@ -334,65 +334,65 @@ discard block |
||
| 334 | 334 | $plugins = get_plugins(); |
| 335 | 335 | $active_plugins = get_option( 'active_plugins', array() ); |
| 336 | 336 | |
| 337 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
| 337 | + foreach ($plugins as $plugin_path => $plugin) { |
|
| 338 | 338 | // If the plugin isn't active, don't show it. |
| 339 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
| 339 | + if ( ! in_array( $plugin_path, $active_plugins )) { |
|
| 340 | 340 | continue; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - echo $plugin['Name']; ?>: <?php echo $plugin['Version'] ."\n\t"; |
|
| 343 | + echo $plugin['Name']; ?>: <?php echo $plugin['Version']."\n\t"; |
|
| 344 | 344 | |
| 345 | 345 | } |
| 346 | 346 | ?> |
| 347 | 347 | |
| 348 | 348 | CURRENT THEME: |
| 349 | 349 | <?php |
| 350 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
| 351 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
| 352 | - echo $theme_data['Name'] . ': ' . $theme_data['Version']; |
|
| 350 | + if (get_bloginfo( 'version' ) < '3.4') { |
|
| 351 | + $theme_data = get_theme_data( get_stylesheet_directory().'/style.css' ); |
|
| 352 | + echo $theme_data['Name'].': '.$theme_data['Version']; |
|
| 353 | 353 | } else { |
| 354 | 354 | $theme_data = wp_get_theme(); |
| 355 | - echo $theme_data->Name . ': ' . $theme_data->Version; |
|
| 355 | + echo $theme_data->Name.': '.$theme_data->Version; |
|
| 356 | 356 | } |
| 357 | 357 | ?> |
| 358 | 358 | |
| 359 | 359 | |
| 360 | - Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
|
| 360 | + Multi-site: <?php echo is_multisite() ? 'Yes'."\n" : 'No'."\n" ?> |
|
| 361 | 361 | |
| 362 | 362 | ADVANCED INFO: |
| 363 | - PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
|
| 364 | - MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> |
|
| 365 | - Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> |
|
| 363 | + PHP Version: <?php echo PHP_VERSION."\n"; ?> |
|
| 364 | + MySQL Version: <?php echo $wpdb->db_version()."\n"; ?> |
|
| 365 | + Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE']."\n"; ?> |
|
| 366 | 366 | |
| 367 | - PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
|
| 368 | - PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
|
| 369 | - PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
|
| 367 | + PHP Memory Limit: <?php echo ini_get( 'memory_limit' )."\n"; ?> |
|
| 368 | + PHP Post Max Size: <?php echo ini_get( 'post_max_size' )."\n"; ?> |
|
| 369 | + PHP Time Limit: <?php echo ini_get( 'max_execution_time' )."\n"; ?> |
|
| 370 | 370 | |
| 371 | - WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
| 372 | - SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
| 371 | + WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
| 372 | + SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
| 373 | 373 | |
| 374 | - WP Table Prefix: <?php echo 'Length: '. strlen( $wpdb->prefix ); |
|
| 374 | + WP Table Prefix: <?php echo 'Length: '.strlen( $wpdb->prefix ); |
|
| 375 | 375 | echo ' Status:'; |
| 376 | - if ( strlen( $wpdb->prefix ) > 16 ) {echo ' ERROR: Too Long'; |
|
| 376 | + if (strlen( $wpdb->prefix ) > 16) {echo ' ERROR: Too Long'; |
|
| 377 | 377 | } else { echo ' Acceptable'; |
| 378 | 378 | } echo "\n"; ?> |
| 379 | 379 | |
| 380 | - Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?> |
|
| 381 | - Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
| 382 | - Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
| 380 | + Show On Front: <?php echo get_option( 'show_on_front' )."\n" ?> |
|
| 381 | + Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
| 382 | + Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
| 383 | 383 | |
| 384 | - Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
| 384 | + Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
| 385 | 385 | Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> |
| 386 | 386 | Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> |
| 387 | 387 | Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> |
| 388 | 388 | Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
| 389 | 389 | Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
| 390 | 390 | |
| 391 | - UPLOAD_MAX_FILESIZE: <?php if ( function_exists( 'phpversion' ) ) { echo ini_get( 'upload_max_filesize' ); } ?><?php echo "\n"; ?> |
|
| 392 | - POST_MAX_SIZE: <?php if ( function_exists( 'phpversion' ) ) { echo ini_get( 'post_max_size' ); } ?><?php echo "\n"; ?> |
|
| 391 | + UPLOAD_MAX_FILESIZE: <?php if (function_exists( 'phpversion' )) { echo ini_get( 'upload_max_filesize' ); } ?><?php echo "\n"; ?> |
|
| 392 | + POST_MAX_SIZE: <?php if (function_exists( 'phpversion' )) { echo ini_get( 'post_max_size' ); } ?><?php echo "\n"; ?> |
|
| 393 | 393 | WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
| 394 | - DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
|
| 395 | - FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
| 394 | + DISPLAY ERRORS: <?php echo (ini_get( 'display_errors' )) ? 'On ('.ini_get( 'display_errors' ).')' : 'N/A'; ?><?php echo "\n"; ?> |
|
| 395 | + FSOCKOPEN: <?php echo (function_exists( 'fsockopen' )) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
| 396 | 396 | </textarea> |
| 397 | 397 | </div> |
| 398 | 398 | <?php |
@@ -1,33 +1,33 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -include_once( PPP_PATH . '/includes/wpme-functions.php' ); |
|
| 8 | +include_once(PPP_PATH.'/includes/wpme-functions.php'); |
|
| 9 | 9 | |
| 10 | 10 | global $ppp_twitter_oauth; |
| 11 | -include_once( PPP_PATH . '/includes/twitter-functions.php' ); |
|
| 12 | -require_once( PPP_PATH . '/includes/libs/twitter.php'); |
|
| 11 | +include_once(PPP_PATH.'/includes/twitter-functions.php'); |
|
| 12 | +require_once(PPP_PATH.'/includes/libs/twitter.php'); |
|
| 13 | 13 | $ppp_twitter_oauth = new PPP_Twitter(); |
| 14 | 14 | |
| 15 | 15 | // Also include the user specific Twitter Class ( separate for now ) |
| 16 | -require_once( PPP_PATH . '/includes/libs/twitter-user.php' ); |
|
| 16 | +require_once(PPP_PATH.'/includes/libs/twitter-user.php'); |
|
| 17 | 17 | |
| 18 | 18 | global $ppp_facebook_oauth; |
| 19 | -include_once( PPP_PATH . '/includes/facebook-functions.php' ); |
|
| 20 | -require_once( PPP_PATH . '/includes/libs/facebook.php'); |
|
| 19 | +include_once(PPP_PATH.'/includes/facebook-functions.php'); |
|
| 20 | +require_once(PPP_PATH.'/includes/libs/facebook.php'); |
|
| 21 | 21 | $ppp_facebook_oauth = new PPP_Facebook(); |
| 22 | 22 | |
| 23 | 23 | global $ppp_bitly_oauth; |
| 24 | -include_once( PPP_PATH . '/includes/bitly-functions.php' ); |
|
| 25 | -require_once( PPP_PATH . '/includes/libs/bitly.php' ); |
|
| 24 | +include_once(PPP_PATH.'/includes/bitly-functions.php'); |
|
| 25 | +require_once(PPP_PATH.'/includes/libs/bitly.php'); |
|
| 26 | 26 | $ppp_bitly_oauth = new PPP_Bitly(); |
| 27 | 27 | |
| 28 | 28 | global $ppp_linkedin_oauth; |
| 29 | -include_once( PPP_PATH . '/includes/linkedin-functions.php' ); |
|
| 30 | -require_once( PPP_PATH . '/includes/libs/linkedin.php' ); |
|
| 29 | +include_once(PPP_PATH.'/includes/linkedin-functions.php'); |
|
| 30 | +require_once(PPP_PATH.'/includes/libs/linkedin.php'); |
|
| 31 | 31 | $ppp_linkedin_oauth = new PPP_Linkedin(); |
| 32 | 32 | |
| 33 | -include_once( PPP_PATH . '/includes/pinterest-functions.php' ); |
|
| 33 | +include_once(PPP_PATH.'/includes/pinterest-functions.php'); |
|
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined( 'ABSPATH' )) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @since 1.2 |
| 31 | 31 | */ |
| 32 | 32 | public function __construct() { |
| 33 | - add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
| 33 | + add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
| 34 | 34 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
| 35 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 35 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | remove_submenu_page( 'index.php', 'ppp-getting-started' ); |
| 77 | 77 | |
| 78 | 78 | // Badge for welcome page |
| 79 | - $badge_url = PPP_URL . 'includes/images/ppp-badge.png'; |
|
| 79 | + $badge_url = PPP_URL.'includes/images/ppp-badge.png'; |
|
| 80 | 80 | ?> |
| 81 | 81 | <style type="text/css" media="screen"> |
| 82 | 82 | /*<![CDATA[*/ |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @return void |
| 117 | 117 | */ |
| 118 | 118 | public function tabs() { |
| 119 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'ppp-about'; |
|
| 119 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'ppp-about'; |
|
| 120 | 120 | ?> |
| 121 | 121 | <h1 class="nav-tab-wrapper"> |
| 122 | 122 | <a class="nav-tab <?php echo $selected == 'ppp-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'ppp-about' ), 'index.php' ) ) ); ?>"> |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | 136 | public function about_screen() { |
| 137 | - list( $display_version ) = explode( '-', PPP_VERSION ); |
|
| 137 | + list($display_version) = explode( '-', PPP_VERSION ); |
|
| 138 | 138 | ?> |
| 139 | 139 | <div class="wrap about-wrap"> |
| 140 | 140 | <h1><?php printf( __( 'Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1> |
@@ -144,59 +144,59 @@ discard block |
||
| 144 | 144 | <?php $this->tabs(); ?> |
| 145 | 145 | |
| 146 | 146 | <div class="changelog"> |
| 147 | - <h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' );?></h3> |
|
| 147 | + <h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' ); ?></h3> |
|
| 148 | 148 | |
| 149 | 149 | <div class="feature-section"> |
| 150 | 150 | |
| 151 | - <img src="<?php echo PPP_URL . '/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 151 | + <img src="<?php echo PPP_URL.'/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 152 | 152 | |
| 153 | - <h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' );?></h4> |
|
| 154 | - <p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' );?></p> |
|
| 155 | - <p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' );?></p> |
|
| 153 | + <h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' ); ?></h4> |
|
| 154 | + <p><?php _e( 'No longer do you have to figure out what "Day 1" means. With free form scheduling, you can now create Tweets, days, weeks, or months in the future. Even multiples a day.', 'ppp-txt' ); ?></p> |
|
| 155 | + <p><?php _e( 'Have an old post that you want to promote again? No problem, just go back and add another Scheduled Tweet to the list!', 'ppp-txt' ); ?></p> |
|
| 156 | 156 | |
| 157 | 157 | </div> |
| 158 | 158 | </div> |
| 159 | 159 | |
| 160 | 160 | <div class="changelog"> |
| 161 | - <h3><?php _e( 'Twitter Cards Support', 'ppp-txt' );?></h3> |
|
| 161 | + <h3><?php _e( 'Twitter Cards Support', 'ppp-txt' ); ?></h3> |
|
| 162 | 162 | |
| 163 | 163 | <div class="feature-section"> |
| 164 | 164 | |
| 165 | - <img src="<?php echo PPP_URL . '/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 165 | + <img src="<?php echo PPP_URL.'/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 166 | 166 | |
| 167 | - <h4><?php _e( 'Increased visibility on Twitter','ppp-txt' );?></h4> |
|
| 168 | - <p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' );?></p> |
|
| 169 | - <p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' );?></p> |
|
| 167 | + <h4><?php _e( 'Increased visibility on Twitter', 'ppp-txt' ); ?></h4> |
|
| 168 | + <p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' ); ?></p> |
|
| 169 | + <p><?php _e( 'This is an opt-in setting, so if you have a plugin that already does this, no conflicts will arise upon upgrade.', 'ppp-txt' ); ?></p> |
|
| 170 | 170 | |
| 171 | 171 | </div> |
| 172 | 172 | </div> |
| 173 | 173 | |
| 174 | 174 | <div class="changelog"> |
| 175 | - <h3><?php _e( 'Variable Twitter Images', 'ppp-txt' );?></h3> |
|
| 175 | + <h3><?php _e( 'Variable Twitter Images', 'ppp-txt' ); ?></h3> |
|
| 176 | 176 | |
| 177 | 177 | <div class="feature-section"> |
| 178 | 178 | |
| 179 | - <h4><?php _e( 'Change the image attached to each Tweet','ppp-txt' );?></h4> |
|
| 180 | - <p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' );?></p> |
|
| 179 | + <h4><?php _e( 'Change the image attached to each Tweet', 'ppp-txt' ); ?></h4> |
|
| 180 | + <p><?php _e( 'Have a few rotating images you want to use for your scheduled Tweets? No problem, Version 2.2 supports changing this for every scheduled Tweet.', 'ppp-txt' ); ?></p> |
|
| 181 | 181 | |
| 182 | 182 | </div> |
| 183 | 183 | </div> |
| 184 | 184 | |
| 185 | 185 | <div class="changelog"> |
| 186 | - <h3><?php _e( 'Additional Updates', 'ppp-txt' );?></h3> |
|
| 186 | + <h3><?php _e( 'Additional Updates', 'ppp-txt' ); ?></h3> |
|
| 187 | 187 | |
| 188 | 188 | <div class="feature-section col three-col"> |
| 189 | 189 | <div> |
| 190 | - <h4><?php _e( 'Updated image sizes', 'ppp-txt' );?></h4> |
|
| 191 | - <p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' );?></p> |
|
| 190 | + <h4><?php _e( 'Updated image sizes', 'ppp-txt' ); ?></h4> |
|
| 191 | + <p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' ); ?></p> |
|
| 192 | 192 | |
| 193 | - <h4><?php _e( 'CSS Updates', 'ppp-txt' );?></h4> |
|
| 194 | - <p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' );?></p> |
|
| 193 | + <h4><?php _e( 'CSS Updates', 'ppp-txt' ); ?></h4> |
|
| 194 | + <p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' ); ?></p> |
|
| 195 | 195 | </div> |
| 196 | 196 | |
| 197 | 197 | <div class="last-feature"> |
| 198 | - <h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' );?></h4> |
|
| 199 | - <p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' );?></p> |
|
| 198 | + <h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' ); ?></h4> |
|
| 199 | + <p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' ); ?></p> |
|
| 200 | 200 | </div> |
| 201 | 201 | </div> |
| 202 | 202 | </div> |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @return void |
| 217 | 217 | */ |
| 218 | 218 | public function getting_started_screen() { |
| 219 | - list( $display_version ) = explode( '-', PPP_VERSION ); |
|
| 219 | + list($display_version) = explode( '-', PPP_VERSION ); |
|
| 220 | 220 | ?> |
| 221 | 221 | <div class="wrap about-wrap"> |
| 222 | 222 | <h1><?php printf( __( 'Welcome to Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1> |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | public function welcome() { |
| 243 | 243 | |
| 244 | 244 | $version_level = explode( '.', PPP_VERSION ); |
| 245 | - if ( count( $version_level ) > 2 ) { |
|
| 245 | + if (count( $version_level ) > 2) { |
|
| 246 | 246 | return; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // Bail if no activation redirect |
| 250 | - if ( ! get_transient( '_ppp_activation_redirect' ) ) { |
|
| 250 | + if ( ! get_transient( '_ppp_activation_redirect' )) { |
|
| 251 | 251 | return; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | delete_transient( '_ppp_activation_redirect' ); |
| 256 | 256 | |
| 257 | 257 | // Bail if activating from network, or bulk |
| 258 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 258 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 259 | 259 | return; |
| 260 | 260 | } |
| 261 | 261 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | function ppp_pt_save_post_meta_boxes( $post_id, $post ) { |
| 86 | 86 | |
| 87 | - if ( ! ppp_should_save( $post_id, $post ) ) { |
|
| 87 | + if ( ! ppp_should_save( $post_id, $post )) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if ( ! isset( $_POST['_ppp_pinterest_data'] ) || ! is_array( $_POST['_ppp_pinterest_data'] ) ) { |
|
| 91 | + if ( ! isset($_POST['_ppp_pinterest_data']) || ! is_array( $_POST['_ppp_pinterest_data'] )) { |
|
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | function ppp_pt_open_graph_meta() { |
| 107 | 107 | |
| 108 | - if ( ! is_single() ) { |
|
| 108 | + if ( ! is_single()) { |
|
| 109 | 109 | return; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | global $post, $ppp_options; |
| 113 | 113 | |
| 114 | - if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] ) ) { |
|
| 114 | + if ( ! array_key_exists( $post->post_type, $ppp_options['post_types'] )) { |
|
| 115 | 115 | return; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -129,20 +129,20 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $return = ''; |
| 131 | 131 | |
| 132 | - if ( ! is_single() ) { |
|
| 132 | + if ( ! is_single()) { |
|
| 133 | 133 | return $return; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | global $post; |
| 137 | 137 | |
| 138 | 138 | |
| 139 | - if ( empty( $post ) ) { |
|
| 139 | + if (empty($post)) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $elements = ppp_pt_default_meta_elements(); |
| 144 | - foreach ( $elements as $name => $content ) { |
|
| 145 | - $return .= '<meta name="' . $name . '" content="' . $content . '" />' . "\n"; |
|
| 144 | + foreach ($elements as $name => $content) { |
|
| 145 | + $return .= '<meta name="'.$name.'" content="'.$content.'" />'."\n"; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return apply_filters( 'ppp_pt_og_data', $return ); |
@@ -162,15 +162,15 @@ discard block |
||
| 162 | 162 | $elements = array(); |
| 163 | 163 | $pinterest_data = get_post_meta( $post->ID, '_ppp_pt_media', true ); |
| 164 | 164 | |
| 165 | - if ( ! empty( $pinterest_data['image'] ) ) { |
|
| 165 | + if ( ! empty($pinterest_data['image'])) { |
|
| 166 | 166 | $elements['og:image'] = $pinterest_data['image']; |
| 167 | 167 | |
| 168 | - $thumb_id = ! empty( $pinterest_data['attachment_id'] ) ? (int) $pinterest_data['attachment_id'] : ppp_get_attachment_id_from_image_url( $pinterest_data['image'] ) ; |
|
| 168 | + $thumb_id = ! empty($pinterest_data['attachment_id']) ? (int) $pinterest_data['attachment_id'] : ppp_get_attachment_id_from_image_url( $pinterest_data['image'] ); |
|
| 169 | 169 | |
| 170 | - if ( ! empty( $thumb_id ) ) { |
|
| 170 | + if ( ! empty($thumb_id)) { |
|
| 171 | 171 | $alt_text = ppp_get_attachment_alt_text( $thumb_id ); |
| 172 | 172 | // When adding media via the WP Uploader, any 'alt text' supplied will be used as the accessible alt text. |
| 173 | - if ( ! empty( $alt_text ) ) { |
|
| 173 | + if ( ! empty($alt_text)) { |
|
| 174 | 174 | $elements['og:image:alt'] = esc_attr( $alt_text ); |
| 175 | 175 | } |
| 176 | 176 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | function ppp_schedule_share( $post_id, $post ) { |
| 15 | 15 | $allowed_post_types = ppp_allowed_post_types(); |
| 16 | 16 | |
| 17 | - if ( ! isset( $_POST['post_status'] ) || ! in_array( $post->post_type, $allowed_post_types ) ) { |
|
| 17 | + if ( ! isset($_POST['post_status']) || ! in_array( $post->post_type, $allowed_post_types )) { |
|
| 18 | 18 | return; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | ppp_remove_scheduled_shares( $post_id ); |
| 22 | 22 | |
| 23 | - if( ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' ) || // From anything to published |
|
| 24 | - ( $_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future' ) || // Updating a future post |
|
| 25 | - ( $_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish' ) ) { // Updating an already published post |
|
| 23 | + if (($_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish') || // From anything to published |
|
| 24 | + ($_POST['post_status'] == 'future' && $_POST['original_post_status'] == 'future') || // Updating a future post |
|
| 25 | + ($_POST['post_status'] == 'publish' && $_POST['original_post_status'] == 'publish')) { // Updating an already published post |
|
| 26 | 26 | |
| 27 | 27 | $timestamps = ppp_get_timestamps( $post_id ); |
| 28 | 28 | |
| 29 | - foreach ( $timestamps as $timestamp => $name ) { |
|
| 29 | + foreach ($timestamps as $timestamp => $name) { |
|
| 30 | 30 | $timestamp = substr( $timestamp, 0, strlen( $timestamp ) - 3 ); |
| 31 | 31 | wp_schedule_single_event( $timestamp, 'ppp_share_post_event', array( $post_id, $name ) ); |
| 32 | 32 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $current_item_shares = ppp_get_shceduled_crons( $post_id ); |
| 47 | 47 | |
| 48 | - foreach ( $current_item_shares as $share ) { |
|
| 48 | + foreach ($current_item_shares as $share) { |
|
| 49 | 49 | wp_clear_scheduled_hook( 'ppp_share_post_event', array( $post_id, $share['args'][1] ) ); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | $all_crons = get_option( 'cron' ); |
| 71 | 71 | $ppp_crons = array(); |
| 72 | 72 | |
| 73 | - foreach ( $all_crons as $timestamp => $cron ) { |
|
| 74 | - if ( ! isset( $cron['ppp_share_post_event'] ) ) { |
|
| 73 | + foreach ($all_crons as $timestamp => $cron) { |
|
| 74 | + if ( ! isset($cron['ppp_share_post_event'])) { |
|
| 75 | 75 | continue; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - foreach ( $cron['ppp_share_post_event'] as $key => $single_event ) { |
|
| 78 | + foreach ($cron['ppp_share_post_event'] as $key => $single_event) { |
|
| 79 | 79 | $name_parts = explode( '_', $single_event['args'][1] ); |
| 80 | - if ( false !== $post_id && $post_id != $name_parts[2] ) { |
|
| 80 | + if (false !== $post_id && $post_id != $name_parts[2]) { |
|
| 81 | 81 | continue; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $single_event['timestamp'] = $timestamp; |
| 85 | - $ppp_crons[ $key ] = $single_event; |
|
| 85 | + $ppp_crons[$key] = $single_event; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | } |
@@ -111,26 +111,26 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | */ |
| 113 | 113 | function ppp_has_cron_within( $time = 0, $within = 0 ) { |
| 114 | - if ( empty( $time ) ) { |
|
| 114 | + if (empty($time)) { |
|
| 115 | 115 | $time = current_time( 'timestamp' ); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( empty( $within ) ) { |
|
| 118 | + if (empty($within)) { |
|
| 119 | 119 | $within = ppp_get_default_conflict_window(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $crons = ppp_get_shceduled_crons(); |
| 123 | 123 | |
| 124 | - if ( empty( $crons ) ) { |
|
| 124 | + if (empty($crons)) { |
|
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $scheduled_times = wp_list_pluck( $crons, 'timestamp' ); |
| 129 | 129 | |
| 130 | 130 | $found_time = false; |
| 131 | - foreach ( $scheduled_times as $key => $scheduled_time ) { |
|
| 131 | + foreach ($scheduled_times as $key => $scheduled_time) { |
|
| 132 | 132 | $found_time = ppp_is_time_within( $scheduled_time, $time, $within ); |
| 133 | - if ( $found_time ) { |
|
| 133 | + if ($found_time) { |
|
| 134 | 134 | break; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $min = $target_time - $within; |
| 153 | 153 | $max = $target_time + $within; |
| 154 | 154 | |
| 155 | - return ( ( $time >= $min ) && ( $time <= $max ) ); |
|
| 155 | + return (($time >= $min) && ($time <= $max)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | function ppp_unschedule_shares( $new_status, $old_status, $post ) { |
| 222 | 222 | |
| 223 | - if ( ( $old_status == 'publish' || $old_status == 'future' ) && ( $new_status != 'publish' && $new_status != 'future' ) ) { |
|
| 223 | + if (($old_status == 'publish' || $old_status == 'future') && ($new_status != 'publish' && $new_status != 'future')) { |
|
| 224 | 224 | ppp_remove_scheduled_shares( $post->ID ); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -239,11 +239,11 @@ discard block |
||
| 239 | 239 | // Just in case we need this, let's set it once |
| 240 | 240 | $current_time = current_time( 'timestamp' ); |
| 241 | 241 | |
| 242 | - if ( empty( $date ) ) { |
|
| 242 | + if (empty($date)) { |
|
| 243 | 243 | $date = date( 'm/d/Y', $current_time ); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - if ( empty( $time ) ) { |
|
| 246 | + if (empty($time)) { |
|
| 247 | 247 | $time = date( 'h:ia', $current_time ); |
| 248 | 248 | } |
| 249 | 249 | |
@@ -252,15 +252,15 @@ discard block |
||
| 252 | 252 | $minutes = (int) substr( $share_time[1], 0, 2 ); |
| 253 | 253 | $ampm = strtolower( substr( $share_time[1], -2 ) ); |
| 254 | 254 | |
| 255 | - if ( $ampm == 'pm' && $hours != 12 ) { |
|
| 255 | + if ($ampm == 'pm' && $hours != 12) { |
|
| 256 | 256 | $hours = $hours + 12; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( $ampm == 'am' && $hours == 12 ) { |
|
| 259 | + if ($ampm == 'am' && $hours == 12) { |
|
| 260 | 260 | $hours = 00; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $offset = (int) -( get_option( 'gmt_offset' ) ); |
|
| 263 | + $offset = (int) -(get_option( 'gmt_offset' )); |
|
| 264 | 264 | $hours = $hours + $offset; |
| 265 | 265 | $date = explode( '/', $date ); |
| 266 | 266 | $timestamp = mktime( (int) $hours, (int) $minutes, 0, (int) $date[0], (int) $date[1], (int) $date[2] ); |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( !defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Handles all twitter functions |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -if( !class_exists( 'PPP_Twitter' ) ) { |
|
| 14 | +if ( ! class_exists( 'PPP_Twitter' )) { |
|
| 15 | 15 | |
| 16 | 16 | class PPP_Twitter { |
| 17 | 17 | |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | * Handles to load twitter class |
| 30 | 30 | */ |
| 31 | 31 | public function ppp_load_twitter() { |
| 32 | - if( !class_exists( 'TwitterOAuth' ) ) { |
|
| 33 | - require_once ( PPP_PATH . '/includes/libs/twitter/twitteroauth.php' ); |
|
| 32 | + if ( ! class_exists( 'TwitterOAuth' )) { |
|
| 33 | + require_once (PPP_PATH.'/includes/libs/twitter/twitteroauth.php'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | ppp_set_social_tokens(); |
| 37 | 37 | |
| 38 | - if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' ) ) { |
|
| 38 | + if ( ! defined( 'PPP_TW_CONSUMER_KEY' ) || ! defined( 'PPP_TW_CONSUMER_SECRET' )) { |
|
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | public function revoke_access() { |
| 48 | 48 | global $ppp_social_settings; |
| 49 | 49 | |
| 50 | - unset( $ppp_social_settings['twitter'] ); |
|
| 50 | + unset($ppp_social_settings['twitter']); |
|
| 51 | 51 | |
| 52 | 52 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 53 | 53 | } |
@@ -59,14 +59,14 @@ discard block |
||
| 59 | 59 | public function ppp_initialize_twitter() { |
| 60 | 60 | |
| 61 | 61 | //when user is going to logged in in twitter and verified successfully session will create |
| 62 | - if ( ! empty( $_REQUEST['oauth_verifier'] ) ) { |
|
| 62 | + if ( ! empty($_REQUEST['oauth_verifier'])) { |
|
| 63 | 63 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
| 64 | 64 | |
| 65 | 65 | //load twitter class |
| 66 | 66 | $twitter = $this->ppp_load_twitter(); |
| 67 | 67 | |
| 68 | 68 | //check twitter class is loaded or not |
| 69 | - if( ! $twitter ) { |
|
| 69 | + if ( ! $twitter) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | //session for verifier |
| 79 | 79 | $verifier['oauth_verifier'] = $_REQUEST['oauth_verifier']; |
| 80 | 80 | |
| 81 | - $_SESSION[ 'ppp_twt_user_cache' ] = $verifier; |
|
| 81 | + $_SESSION['ppp_twt_user_cache'] = $verifier; |
|
| 82 | 82 | |
| 83 | 83 | //getting user data from twitter |
| 84 | - $response = $this->twitter->get('account/verify_credentials'); |
|
| 84 | + $response = $this->twitter->get( 'account/verify_credentials' ); |
|
| 85 | 85 | |
| 86 | 86 | //if user data get successfully |
| 87 | - if ( $response->id_str ) { |
|
| 87 | + if ($response->id_str) { |
|
| 88 | 88 | |
| 89 | 89 | $data['user'] = $response; |
| 90 | 90 | $data['user']->accessToken = $ppp_tw_access_token; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $this->ppp_load_twitter(); |
| 101 | 101 | |
| 102 | 102 | global $ppp_social_settings; |
| 103 | - if ( isset( $ppp_social_settings['twitter'] ) ) { |
|
| 103 | + if (isset($ppp_social_settings['twitter'])) { |
|
| 104 | 104 | |
| 105 | 105 | $this->twitter = new TwitterOAuth( |
| 106 | 106 | PPP_TW_CONSUMER_KEY, |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $ppp_social_settings['twitter']['user']->accessToken['oauth_token_secret'] |
| 110 | 110 | ); |
| 111 | 111 | |
| 112 | - $response = $this->twitter->get('account/verify_credentials'); |
|
| 113 | - if ( is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0 ) { |
|
| 114 | - foreach ( $response->errors as $error ) { |
|
| 115 | - if ( $error->code == 89 ) { // Expired or revoked tokens |
|
| 116 | - unset( $ppp_social_settings['twitter'] ); |
|
| 112 | + $response = $this->twitter->get( 'account/verify_credentials' ); |
|
| 113 | + if (is_object( $response ) && property_exists( $response, 'errors' ) && count( $response->errors ) > 0) { |
|
| 114 | + foreach ($response->errors as $error) { |
|
| 115 | + if ($error->code == 89) { // Expired or revoked tokens |
|
| 116 | + unset($ppp_social_settings['twitter']); |
|
| 117 | 117 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 118 | 118 | |
| 119 | 119 | return array( 'error' => __( 'Post Promoter Pro has been removed from your Twitter account. Please reauthorize to continue promoting your content.', 'ppp-txt' ) ); |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | * Get auth url for twitter |
| 130 | 130 | * |
| 131 | 131 | */ |
| 132 | - public function ppp_get_twitter_auth_url ( $return_url = '' ) { |
|
| 132 | + public function ppp_get_twitter_auth_url( $return_url = '' ) { |
|
| 133 | 133 | |
| 134 | - if ( empty( $return_url ) ) { |
|
| 134 | + if (empty($return_url)) { |
|
| 135 | 135 | $return_url = admin_url( 'admin.php?page=ppp-social-settings' ); |
| 136 | 136 | } |
| 137 | 137 | //load twitter class |
| 138 | 138 | $twitter = $this->ppp_load_twitter(); |
| 139 | 139 | |
| 140 | 140 | //check twitter class is loaded or not |
| 141 | - if( !$twitter ) { |
|
| 141 | + if ( ! $twitter) { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $request_token = $this->twitter->getRequestToken( 'oob' ); |
| 146 | 146 | |
| 147 | 147 | // If last connection failed don't display authorization link. |
| 148 | - switch( $this->twitter->http_code ) { |
|
| 148 | + switch ($this->twitter->http_code) { |
|
| 149 | 149 | |
| 150 | 150 | case 200: |
| 151 | 151 | $_SESSION['ppp_twt_oauth_token'] = $request_token['oauth_token']; |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | public function ppp_tweet( $message = '', $media = null ) { |
| 165 | - if ( empty( $message ) ) { |
|
| 165 | + if (empty($message)) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $verify = $this->ppp_verify_twitter_credentials(); |
| 170 | - if ( $verify === true ) { |
|
| 170 | + if ($verify === true) { |
|
| 171 | 171 | $args = array(); |
| 172 | - if ( ! empty( $media ) ) { |
|
| 172 | + if ( ! empty($media)) { |
|
| 173 | 173 | $endpoint = 'statuses/update_with_media'; |
| 174 | 174 | $args['media[]'] = wp_remote_retrieve_body( wp_remote_get( $media ) ); |
| 175 | 175 | } else { |