@@ -77,7 +77,7 @@ |
||
77 | 77 | * @uses api_request() |
78 | 78 | * |
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | - * @return array Modified update array with custom plugin data. |
|
80 | + * @return stdClass Modified update array with custom plugin data. |
|
81 | 81 | */ |
82 | 82 | public function check_update( $_transient_data ) { |
83 | 83 |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * Allows plugins to use their own update API. |
@@ -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 |
@@ -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 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function ppp_replace_text_tokens( $string, $args = array() ) { |
30 | 30 | $tokens = wp_list_pluck( ppp_get_text_tokens(), 'token' ); |
31 | - foreach ( $tokens as $key => $token ) { |
|
32 | - $string = apply_filters( 'ppp_replace_token-' . $token, $string, $args ); |
|
31 | + foreach ($tokens as $key => $token) { |
|
32 | + $string = apply_filters( 'ppp_replace_token-'.$token, $string, $args ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $string; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return string The string with the token {post_title} replaced |
44 | 44 | */ |
45 | 45 | function ppp_post_title_token( $string, $args ) { |
46 | - if ( !isset( $args['post_id'] ) ) { |
|
46 | + if ( ! isset($args['post_id'])) { |
|
47 | 47 | return $string; |
48 | 48 | } |
49 | 49 | |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function ppp_generate_unique_link( $share_link, $post_id, $name ) { |
73 | 73 | $name_parts = explode( '_', $name ); |
74 | - $share_link .= strpos( $share_link, '?' ) ? '&' : '?' ; |
|
74 | + $share_link .= strpos( $share_link, '?' ) ? '&' : '?'; |
|
75 | 75 | |
76 | 76 | $query_string_var = apply_filters( 'ppp_query_string_var', 'ppp' ); |
77 | 77 | |
78 | - $share_link .= $query_string_var . '=' . $post_id . '-' . $name_parts[1]; |
|
78 | + $share_link .= $query_string_var.'='.$post_id.'-'.$name_parts[1]; |
|
79 | 79 | |
80 | 80 | return $share_link; |
81 | 81 | } |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | */ |
91 | 91 | function ppp_generate_google_utm_link( $share_link, $post_id, $name ) { |
92 | 92 | $name_parts = explode( '_', $name ); |
93 | - $service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw'; |
|
93 | + $service = isset($name_parts[3]) ? $name_parts[3] : 'tw'; |
|
94 | 94 | |
95 | - switch( $service ) { |
|
95 | + switch ($service) { |
|
96 | 96 | case 'li': |
97 | 97 | $network = 'LinkedIn'; |
98 | 98 | break; |
@@ -107,19 +107,19 @@ discard block |
||
107 | 107 | |
108 | 108 | $utm['source'] = $network; |
109 | 109 | $utm['medium'] = 'social'; |
110 | - $utm['term'] = ppp_get_post_slug_by_id( $post_id ); |
|
110 | + $utm['term'] = ppp_get_post_slug_by_id( $post_id ); |
|
111 | 111 | $utm['content'] = $name_parts[1]; // The day after publishing |
112 | 112 | $utm['campaign'] = 'PostPromoterPro'; |
113 | 113 | |
114 | 114 | $utm = apply_filters( 'ppp_utm_tags', $utm, $post_id, $name ); |
115 | 115 | |
116 | - $utm_string = strpos( $share_link, '?' ) ? '&' : '?' ; |
|
116 | + $utm_string = strpos( $share_link, '?' ) ? '&' : '?'; |
|
117 | 117 | $first = true; |
118 | - foreach ( $utm as $key => $value ) { |
|
119 | - if ( !$first ) { |
|
118 | + foreach ($utm as $key => $value) { |
|
119 | + if ( ! $first) { |
|
120 | 120 | $utm_string .= '&'; |
121 | 121 | } |
122 | - $utm_string .= 'utm_' . $key . '=' . $value; |
|
122 | + $utm_string .= 'utm_'.$key.'='.$value; |
|
123 | 123 | $first = false; |
124 | 124 | } |
125 | 125 |
@@ -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,13 +11,13 @@ discard block |
||
11 | 11 | * Handles all linkedin functions |
12 | 12 | * |
13 | 13 | */ |
14 | -if( !class_exists( 'PPP_Linkedin' ) ) { |
|
14 | +if ( ! class_exists( 'PPP_Linkedin' )) { |
|
15 | 15 | |
16 | 16 | class PPP_Linkedin { |
17 | 17 | |
18 | 18 | var $linkedin; |
19 | 19 | |
20 | - public function __construct(){ |
|
20 | + public function __construct() { |
|
21 | 21 | ppp_maybe_start_session(); |
22 | 22 | } |
23 | 23 | |
@@ -28,24 +28,24 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function ppp_load_linkedin() { |
30 | 30 | |
31 | - if( !class_exists( 'LinkedIn' ) ) { |
|
32 | - require_once ( PPP_PATH . '/includes/libs/linkedin/linkedin_oAuth.php' ); |
|
31 | + if ( ! class_exists( 'LinkedIn' )) { |
|
32 | + require_once (PPP_PATH.'/includes/libs/linkedin/linkedin_oAuth.php'); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
36 | 36 | ppp_set_social_tokens(); |
37 | 37 | |
38 | - if ( ! defined( 'LINKEDIN_KEY' ) || ! defined( 'LINKEDIN_SECRET' ) ) { |
|
38 | + if ( ! defined( 'LINKEDIN_KEY' ) || ! defined( 'LINKEDIN_SECRET' )) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
42 | 42 | global $ppp_social_settings; |
43 | 43 | $config = array( 'appKey' => LINKEDIN_KEY, 'appSecret' => LINKEDIN_SECRET ); |
44 | - if ( isset( $ppp_social_settings['linkedin']->access_token ) ) { |
|
44 | + if (isset($ppp_social_settings['linkedin']->access_token)) { |
|
45 | 45 | $config['accessToken'] = $ppp_social_settings['linkedin']->access_token; |
46 | 46 | } |
47 | 47 | |
48 | - if ( !$this->linkedin ) { |
|
48 | + if ( ! $this->linkedin) { |
|
49 | 49 | $this->linkedin = new LinkedIn( $config ); |
50 | 50 | } |
51 | 51 | |
@@ -60,36 +60,36 @@ discard block |
||
60 | 60 | $linkedin = $this->ppp_load_linkedin(); |
61 | 61 | |
62 | 62 | //when user is going to logged in and verified successfully session will create |
63 | - if ( isset( $_REQUEST['li_access_token'] ) && isset( $_REQUEST['expires_in'] ) ) { |
|
63 | + if (isset($_REQUEST['li_access_token']) && isset($_REQUEST['expires_in'])) { |
|
64 | 64 | |
65 | 65 | $access_token = $_REQUEST['li_access_token']; |
66 | 66 | $expires_in = $_REQUEST['expires_in']; |
67 | 67 | |
68 | - } elseif ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false ) { |
|
69 | - $access_code = isset( $_GET['code'] ) ? $_GET['code'] : false; |
|
68 | + } elseif (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-li' ) !== false) { |
|
69 | + $access_code = isset($_GET['code']) ? $_GET['code'] : false; |
|
70 | 70 | |
71 | - if ( empty( $access_code ) ) { |
|
71 | + if (empty($access_code)) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | - $params = 'grant_type=authorization_code&client_id=' . LINKEDIN_KEY; |
|
76 | - $params .= '&client_secret=' . LINKEDIN_SECRET; |
|
77 | - $params .= '&code=' . $access_code; |
|
78 | - $params .= '&redirect_uri=' . admin_url( 'admin.php?page=ppp-social-settings' ); |
|
79 | - $url = 'https://www.linkedin.com/uas/oauth2/accessToken?' . $params; |
|
75 | + $params = 'grant_type=authorization_code&client_id='.LINKEDIN_KEY; |
|
76 | + $params .= '&client_secret='.LINKEDIN_SECRET; |
|
77 | + $params .= '&code='.$access_code; |
|
78 | + $params .= '&redirect_uri='.admin_url( 'admin.php?page=ppp-social-settings' ); |
|
79 | + $url = 'https://www.linkedin.com/uas/oauth2/accessToken?'.$params; |
|
80 | 80 | $response = json_decode( wp_remote_retrieve_body( wp_remote_post( $url ) ) ); |
81 | 81 | |
82 | - $access_token = isset( $response->access_token ) ? $response->access_token : false; |
|
83 | - $expires_in = isset( $response->expires_in ) ? $response->expires_in : false; |
|
82 | + $access_token = isset($response->access_token) ? $response->access_token : false; |
|
83 | + $expires_in = isset($response->expires_in) ? $response->expires_in : false; |
|
84 | 84 | |
85 | 85 | } |
86 | 86 | |
87 | - if ( ! empty( $access_token ) && ! empty( $expires_in ) ) { |
|
87 | + if ( ! empty($access_token) && ! empty($expires_in)) { |
|
88 | 88 | global $ppp_social_settings; |
89 | 89 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
90 | 90 | |
91 | 91 | //check linkedin class is loaded or not |
92 | - if( !$linkedin ) { |
|
92 | + if ( ! $linkedin) { |
|
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $expires_in = (int) $expires_in; |
100 | 100 | $data->expires_on = current_time( 'timestamp' ) + $expires_in; |
101 | 101 | |
102 | - update_option( '_ppp_linkedin_refresh', current_time( 'timestamp' ) + round( $expires_in/1.25 ) ); |
|
102 | + update_option( '_ppp_linkedin_refresh', current_time( 'timestamp' ) + round( $expires_in / 1.25 ) ); |
|
103 | 103 | |
104 | 104 | $ppp_social_settings['linkedin'] = $data; |
105 | 105 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
114 | 114 | |
115 | - $url = remove_query_arg( array( 'li_access_token' , 'expires_in' ) ); |
|
115 | + $url = remove_query_arg( array( 'li_access_token', 'expires_in' ) ); |
|
116 | 116 | wp_redirect( $url ); |
117 | 117 | die(); |
118 | 118 | } |
@@ -122,19 +122,19 @@ discard block |
||
122 | 122 | * Get auth url for linkedin |
123 | 123 | * |
124 | 124 | */ |
125 | - public function ppp_get_linkedin_auth_url ( $return_url ) { |
|
125 | + public function ppp_get_linkedin_auth_url( $return_url ) { |
|
126 | 126 | |
127 | - if ( ! PPP_LOCAL_TOKENS ) { |
|
127 | + if ( ! PPP_LOCAL_TOKENS) { |
|
128 | 128 | $base_url = 'https://postpromoterpro.com/?ppp-social-auth'; |
129 | - $url = $base_url . '&ppp-service=li&ppp-license-key=' . trim( get_option( '_ppp_license_key' ) ); |
|
129 | + $url = $base_url.'&ppp-service=li&ppp-license-key='.trim( get_option( '_ppp_license_key' ) ); |
|
130 | 130 | $url .= '&nocache'; |
131 | - $url .= '&return_url=' . esc_url( $return_url ); |
|
131 | + $url .= '&return_url='.esc_url( $return_url ); |
|
132 | 132 | } else { |
133 | 133 | $url = 'https://www.linkedin.com/uas/oauth2/authorization?response_type=code'; |
134 | - $url .= '&client_id=' . LINKEDIN_KEY; |
|
134 | + $url .= '&client_id='.LINKEDIN_KEY; |
|
135 | 135 | $url .= '&scope=w_share%20r_basicprofile'; |
136 | 136 | $url .= '&state=ppp-local-keys-li'; |
137 | - $url .= '&redirect_uri=' . $return_url; |
|
137 | + $url .= '&redirect_uri='.$return_url; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return $url; |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | * Share somethign on linkedin |
145 | 145 | */ |
146 | 146 | public function ppp_linkedin_share( $args ) { |
147 | - if ( empty( $args ) ) { |
|
147 | + if (empty($args)) { |
|
148 | 148 | return false; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $this->ppp_load_linkedin(); |
152 | 152 | global $ppp_social_settings; |
153 | - $url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token=' . $ppp_social_settings['linkedin']->access_token; |
|
153 | + $url = 'https://api.linkedin.com/v1/people/~/shares?oauth2_access_token='.$ppp_social_settings['linkedin']->access_token; |
|
154 | 154 | $share = array( |
155 | 155 | 'content' => array( |
156 | 156 | 'title' => $args['title'], |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ) |
163 | 163 | ); |
164 | 164 | |
165 | - if ( $args['submitted-image-url'] !== false ) { |
|
165 | + if ($args['submitted-image-url'] !== false) { |
|
166 | 166 | $share['content']['submitted-image-url'] = $args['submitted-image-url']; |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | $this->ppp_load_linkedin(); |
179 | 179 | global $ppp_social_settings; |
180 | - $url = 'https://api.linkedin.com/v1/people/~?oauth2_access_token=' . $ppp_social_settings['linkedin']->access_token; |
|
180 | + $url = 'https://api.linkedin.com/v1/people/~?oauth2_access_token='.$ppp_social_settings['linkedin']->access_token; |
|
181 | 181 | |
182 | 182 | $headers = array( 'x-li-format' => 'json', 'Content-Type' => 'application/json' ); |
183 | 183 |
@@ -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,13 +11,13 @@ discard block |
||
11 | 11 | * Handles all facebook functions |
12 | 12 | * |
13 | 13 | */ |
14 | -if( !class_exists( 'PPP_Facebook' ) ) { |
|
14 | +if ( ! class_exists( 'PPP_Facebook' )) { |
|
15 | 15 | |
16 | 16 | class PPP_Facebook { |
17 | 17 | |
18 | 18 | var $facebook; |
19 | 19 | |
20 | - public function __construct(){ |
|
20 | + public function __construct() { |
|
21 | 21 | ppp_maybe_start_session(); |
22 | 22 | } |
23 | 23 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | public function ppp_load_facebook() { |
31 | 31 | |
32 | 32 | |
33 | - if( !class_exists( 'Facebook' ) ) { |
|
34 | - require_once ( PPP_PATH . '/includes/libs/facebook/facebook.php' ); |
|
33 | + if ( ! class_exists( 'Facebook' )) { |
|
34 | + require_once (PPP_PATH.'/includes/libs/facebook/facebook.php'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | ppp_set_social_tokens(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | 'appId' => PPP_FB_APP_ID, |
41 | 41 | 'secret' => PPP_FB_APP_SECRET, |
42 | 42 | 'cookie' => true |
43 | - )); |
|
43 | + ) ); |
|
44 | 44 | |
45 | 45 | return true; |
46 | 46 | |
@@ -55,72 +55,72 @@ discard block |
||
55 | 55 | $facebook = $this->ppp_load_facebook(); |
56 | 56 | |
57 | 57 | //when user is going to logged in and verified successfully session will create |
58 | - if ( isset( $_REQUEST['fb_access_token'] ) && isset( $_REQUEST['expires_in'] ) ) { |
|
58 | + if (isset($_REQUEST['fb_access_token']) && isset($_REQUEST['expires_in'])) { |
|
59 | 59 | |
60 | 60 | $access_token = $_REQUEST['fb_access_token']; |
61 | 61 | $expires_in = $_REQUEST['expires_in']; |
62 | 62 | |
63 | - } elseif ( isset( $_GET['state'] ) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false ) { |
|
64 | - $access_code = isset( $_GET['code'] ) ? $_GET['code'] : false; |
|
63 | + } elseif (isset($_GET['state']) && strpos( $_GET['state'], 'ppp-local-keys-fb' ) !== false) { |
|
64 | + $access_code = isset($_GET['code']) ? $_GET['code'] : false; |
|
65 | 65 | |
66 | - if ( empty( $access_code ) ) { |
|
66 | + if (empty($access_code)) { |
|
67 | 67 | return; |
68 | 68 | } |
69 | 69 | |
70 | - $params = '?client_id=' . PPP_FB_APP_ID; |
|
71 | - $params .= '&client_secret=' . PPP_FB_APP_SECRET; |
|
72 | - $params .= '&code=' . $access_code; |
|
73 | - $params .= '&redirect_uri=' . admin_url( 'admin.php?page=ppp-social-settings' ); |
|
74 | - $url = 'https://graph.facebook.com/oauth/access_token' . $params; |
|
70 | + $params = '?client_id='.PPP_FB_APP_ID; |
|
71 | + $params .= '&client_secret='.PPP_FB_APP_SECRET; |
|
72 | + $params .= '&code='.$access_code; |
|
73 | + $params .= '&redirect_uri='.admin_url( 'admin.php?page=ppp-social-settings' ); |
|
74 | + $url = 'https://graph.facebook.com/oauth/access_token'.$params; |
|
75 | 75 | |
76 | 76 | $access_token = ''; |
77 | 77 | $expires = ''; |
78 | 78 | parse_str( wp_remote_retrieve_body( wp_remote_post( $url ) ) ); |
79 | 79 | |
80 | - $access_token = ! empty( $access_token ) ? $access_token : false; |
|
81 | - $expires_in = ! empty( $expires ) ? $expires : false; |
|
80 | + $access_token = ! empty($access_token) ? $access_token : false; |
|
81 | + $expires_in = ! empty($expires) ? $expires : false; |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | |
85 | - if ( ! empty( $access_token ) ) { |
|
85 | + if ( ! empty($access_token)) { |
|
86 | 86 | global $ppp_social_settings; |
87 | 87 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
88 | 88 | |
89 | 89 | //check facebook class is loaded or not |
90 | - if( !$facebook ) { |
|
90 | + if ( ! $facebook) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $data = new stdClass(); |
95 | 95 | $data->access_token = $access_token; |
96 | 96 | |
97 | - $expires_in = empty( $expires_in ) ? 60 * 24 * 60 * 60 : $expires_in; // days * hours * minutes * seconds |
|
97 | + $expires_in = empty($expires_in) ? 60 * 24 * 60 * 60 : $expires_in; // days * hours * minutes * seconds |
|
98 | 98 | $data->expires_on = current_time( 'timestamp' ) + $expires_in; |
99 | 99 | |
100 | - update_option( '_ppp_facebook_refresh', current_time( 'timestamp' ) + round( $expires_in/1.25 ) ); |
|
100 | + update_option( '_ppp_facebook_refresh', current_time( 'timestamp' ) + round( $expires_in / 1.25 ) ); |
|
101 | 101 | |
102 | 102 | // Now that we have a valid auth, get some user info |
103 | 103 | $user_info = $this->ppp_get_fb_user( $data->access_token ); |
104 | 104 | |
105 | - if ( $user_info ) { |
|
106 | - if ( !empty( $user_info->name ) ) { |
|
105 | + if ($user_info) { |
|
106 | + if ( ! empty($user_info->name)) { |
|
107 | 107 | $data->name = $user_info->name; |
108 | 108 | } else { |
109 | - $parsed_name = $user_info->first_name . ' ' . $user_info->last_name; |
|
109 | + $parsed_name = $user_info->first_name.' '.$user_info->last_name; |
|
110 | 110 | $data->name = $parsed_name; |
111 | 111 | } |
112 | 112 | $data->userid = $user_info->id; |
113 | 113 | $data->avatar = $this->ppp_fb_get_profile_picture( array( 'type' => 'square' ), $data->userid ); |
114 | 114 | |
115 | - if ( ! empty( $ppp_social_settings['facebook']->page ) ) { |
|
115 | + if ( ! empty($ppp_social_settings['facebook']->page)) { |
|
116 | 116 | $current_page = $ppp_social_settings['facebook']->page; |
117 | 117 | $page_parts = explode( '|', $current_page ); |
118 | 118 | |
119 | 119 | $pages = $this->ppp_get_fb_user_pages( $data->access_token ); |
120 | 120 | |
121 | - foreach ( $pages as $page ) { |
|
122 | - if ( $page->id == $page_parts[2] ) { |
|
123 | - $data->page = $page->name . '|' . $page->access_token . '|' . $page->id; |
|
121 | + foreach ($pages as $page) { |
|
122 | + if ($page->id == $page_parts[2]) { |
|
123 | + $data->page = $page->name.'|'.$page->access_token.'|'.$page->id; |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | |
136 | - $url = remove_query_arg( array( 'fb_access_token' , 'expires_in' ) ); |
|
136 | + $url = remove_query_arg( array( 'fb_access_token', 'expires_in' ) ); |
|
137 | 137 | wp_redirect( $url ); |
138 | 138 | die(); |
139 | 139 | } |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | $facebook = $this->ppp_load_facebook(); |
152 | 152 | |
153 | 153 | //check facebook class is exis or not |
154 | - if( !$facebook ) { |
|
154 | + if ( ! $facebook) { |
|
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | |
158 | 158 | global $ppp_social_settings; |
159 | - $user = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me?access_token=' . $access_token ) ) ); |
|
159 | + $user = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me?access_token='.$access_token ) ) ); |
|
160 | 160 | |
161 | 161 | return $user; |
162 | 162 | |
@@ -168,27 +168,27 @@ discard block |
||
168 | 168 | $facebook = $this->ppp_load_facebook(); |
169 | 169 | |
170 | 170 | // check facebook cleast is exists or not |
171 | - if( !$facebook ) { |
|
171 | + if ( ! $facebook) { |
|
172 | 172 | return false; |
173 | 173 | } |
174 | 174 | |
175 | 175 | global $ppp_social_settings; |
176 | 176 | $facebook_settings = $ppp_social_settings['facebook']; |
177 | 177 | |
178 | - if ( ! isset( $facebook_settings->available_pages ) || |
|
179 | - ! isset( $facebook_settings->pages_last_updated ) || |
|
180 | - $facebook_settings->pages_last_updated < current_time( 'timestamp' ) ) { |
|
178 | + if ( ! isset($facebook_settings->available_pages) || |
|
179 | + ! isset($facebook_settings->pages_last_updated) || |
|
180 | + $facebook_settings->pages_last_updated < current_time( 'timestamp' )) { |
|
181 | 181 | |
182 | - $all_pages = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me/accounts?access_token=' . $access_token ) ) ); |
|
182 | + $all_pages = json_decode( wp_remote_retrieve_body( wp_remote_get( 'https://graph.facebook.com/me/accounts?access_token='.$access_token ) ) ); |
|
183 | 183 | $pages = array(); |
184 | 184 | |
185 | - if ( !empty( $all_pages ) ) { |
|
186 | - foreach ( $all_pages->data as $page ) { |
|
187 | - if ( in_array( 'CREATE_CONTENT', $page->perms ) ) { |
|
185 | + if ( ! empty($all_pages)) { |
|
186 | + foreach ($all_pages->data as $page) { |
|
187 | + if (in_array( 'CREATE_CONTENT', $page->perms )) { |
|
188 | 188 | $pages[] = $page; |
189 | 189 | |
190 | - if ( ! empty( $ppp_social_settings['facebook']->page ) && strpos( $ppp_social_settings['facebook']->page, $page->id ) ) { |
|
191 | - $ppp_social_settings['facebook']->page = $page->name . '|' . $page->access_token . '|' . $page->id; |
|
190 | + if ( ! empty($ppp_social_settings['facebook']->page) && strpos( $ppp_social_settings['facebook']->page, $page->id )) { |
|
191 | + $ppp_social_settings['facebook']->page = $page->name.'|'.$page->access_token.'|'.$page->id; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | $pages = (object) $pages; |
201 | 201 | $ppp_social_settings['facebook']->available_pages = $pages; |
202 | - $ppp_social_settings['facebook']->pages_last_updated = current_time( 'timestamp' ) + ( HOUR_IN_SECONDS / 4 ); |
|
202 | + $ppp_social_settings['facebook']->pages_last_updated = current_time( 'timestamp' ) + (HOUR_IN_SECONDS / 4); |
|
203 | 203 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
204 | 204 | } else { |
205 | 205 | $pages = $facebook_settings->available_pages; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $facebook = $this->ppp_load_facebook(); |
222 | 222 | |
223 | 223 | //check facebook class is exis or not |
224 | - if( !$facebook ) { |
|
224 | + if ( ! $facebook) { |
|
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | |
@@ -232,27 +232,27 @@ discard block |
||
232 | 232 | * Get auth url for facebook |
233 | 233 | * |
234 | 234 | */ |
235 | - public function ppp_get_facebook_auth_url ( $return_url ) { |
|
235 | + public function ppp_get_facebook_auth_url( $return_url ) { |
|
236 | 236 | |
237 | 237 | //load facebook class |
238 | 238 | $facebook = $this->ppp_load_facebook(); |
239 | 239 | |
240 | 240 | //check facebook class is exis or not |
241 | - if( !$facebook ) { |
|
241 | + if ( ! $facebook) { |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! PPP_LOCAL_TOKENS ) { |
|
245 | + if ( ! PPP_LOCAL_TOKENS) { |
|
246 | 246 | $base_url = 'https://postpromoterpro.com/?ppp-social-auth'; |
247 | - $url = $base_url . '&ppp-service=fb&ppp-license-key=' . trim( get_option( '_ppp_license_key' ) ); |
|
247 | + $url = $base_url.'&ppp-service=fb&ppp-license-key='.trim( get_option( '_ppp_license_key' ) ); |
|
248 | 248 | $url .= '&nocache'; |
249 | - $url .= '&return_url=' . esc_url( $return_url ); |
|
249 | + $url .= '&return_url='.esc_url( $return_url ); |
|
250 | 250 | } else { |
251 | 251 | $url = 'https://graph.facebook.com/oauth/authorize?'; |
252 | - $url .= 'client_id=' . PPP_FB_APP_ID; |
|
252 | + $url .= 'client_id='.PPP_FB_APP_ID; |
|
253 | 253 | $url .= '&scope=public_profile,publish_actions,manage_pages,publish_pages'; |
254 | 254 | $url .= '&state=ppp-local-keys-fb'; |
255 | - $url .= '&redirect_uri=' . esc_url( $return_url ) . '&nocache'; |
|
255 | + $url .= '&redirect_uri='.esc_url( $return_url ).'&nocache'; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return $url; |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * Getting the the profile image of the connected Facebook user. |
265 | 265 | * |
266 | 266 | */ |
267 | - public function ppp_fb_get_profile_picture( $args=array(), $user ) { |
|
267 | + public function ppp_fb_get_profile_picture( $args = array(), $user ) { |
|
268 | 268 | |
269 | - if( isset( $args['type'] ) && !empty( $args['type'] ) ) { |
|
269 | + if (isset($args['type']) && ! empty($args['type'])) { |
|
270 | 270 | $type = $args['type']; |
271 | 271 | } else { |
272 | 272 | $type = 'large'; |
273 | 273 | } |
274 | - $url = 'https://graph.facebook.com/' . $user . '/picture?type=' . $type; |
|
274 | + $url = 'https://graph.facebook.com/'.$user.'/picture?type='.$type; |
|
275 | 275 | return $url; |
276 | 276 | } |
277 | 277 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | global $ppp_social_settings; |
280 | 280 | $facebook_settings = $ppp_social_settings['facebook']; |
281 | 281 | |
282 | - if ( !isset( $facebook_settings->page ) || strtolower( $facebook_settings->page ) === 'me' ) { |
|
282 | + if ( ! isset($facebook_settings->page) || strtolower( $facebook_settings->page ) === 'me') { |
|
283 | 283 | $account = 'me'; |
284 | 284 | $access_token = $facebook_settings->access_token; |
285 | 285 | } else { |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | $access_token = $page_info[1]; |
289 | 289 | } |
290 | 290 | |
291 | - $url = 'https://graph.facebook.com/' . $account . '/feed?access_token=' . $access_token; |
|
291 | + $url = 'https://graph.facebook.com/'.$account.'/feed?access_token='.$access_token; |
|
292 | 292 | $args = array( 'link' => $link, 'message' => $message ); |
293 | - if ( !empty( $image ) ) { |
|
293 | + if ( ! empty($image)) { |
|
294 | 294 | $args['picture'] = $image; |
295 | 295 | } |
296 | 296 | $results = json_decode( wp_remote_retrieve_body( wp_remote_post( $url, array( 'body' => $args ) ) ) ); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | public function ppp_get_data_from_url( $url ) { |
310 | 310 | |
311 | 311 | //Use wp_remote_post and wp_remote_get |
312 | - $data = wp_remote_retrieve_body( wp_remote_get( $url ) ); |
|
312 | + $data = wp_remote_retrieve_body( wp_remote_get( $url ) ); |
|
313 | 313 | |
314 | 314 | return $data; |
315 | 315 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function clear_og_cache( $post_id ) { |
323 | 323 | $post_url = get_permalink( $post_id ); |
324 | - if ( ! empty( $post_url ) ) { |
|
324 | + if ( ! empty($post_url)) { |
|
325 | 325 | $args = array( 'body' => array( 'id' => $post_url, 'scrape' => true ) ); |
326 | 326 | $response = json_decode( wp_remote_retrieve_body( wp_remote_post( 'https://graph.facebook.com/', $args ) ) ); |
327 | 327 | } |
@@ -1,13 +1,13 @@ 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 | |
8 | 8 | function ppp_upgrade_notices() { |
9 | 9 | |
10 | - if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades' ) ) { |
|
10 | + if (isset($_GET['page']) && ($_GET['page'] == 'ppp-about' || $_GET['page'] == 'ppp-upgrades')) { |
|
11 | 11 | return; // Don't show notices on the upgrades page |
12 | 12 | } |
13 | 13 | |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | // Sequential Orders was the first stepped upgrade, so check if we have a stalled upgrade |
17 | 17 | $resume_upgrade = ppp_maybe_resume_upgrade(); |
18 | - if ( ! empty( $resume_upgrade ) ) { |
|
18 | + if ( ! empty($resume_upgrade)) { |
|
19 | 19 | |
20 | 20 | $resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ); |
21 | 21 | printf( |
22 | - '<div class="error"><p>' . __( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
22 | + '<div class="error"><p>'.__( 'Post Promoter Pro needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'ppp-txt' ).'</p></div>', |
|
23 | 23 | esc_url( $resume_url ) |
24 | 24 | ); |
25 | 25 | |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | // Include all 'Stepped' upgrade process notices in this else statement, |
29 | 29 | // to avoid having a pending, and new upgrade suggested at the same time |
30 | 30 | |
31 | - if ( version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' ) ) { |
|
31 | + if (version_compare( $ppp_version, '2.2', '<' ) || ! ppp_has_upgrade_completed( 'upgrade_post_meta' )) { |
|
32 | 32 | printf( |
33 | - '<div class="notice notice-info"><p>' . __( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ) . '</p></div>', |
|
33 | + '<div class="notice notice-info"><p>'.__( 'Post Promoter Pro needs to upgrade share override data, click <a href="%s">here</a> to start the upgrade.', 'ppp-txt' ).'</p></div>', |
|
34 | 34 | esc_url( admin_url( 'index.php?page=ppp-upgrades&ppp-upgrade=upgrade_post_meta' ) ) |
35 | 35 | ); |
36 | 36 | } |
@@ -52,17 +52,17 @@ discard block |
||
52 | 52 | $upgrades_executed = false; |
53 | 53 | |
54 | 54 | // We don't have a version yet, so we need to run the upgrader |
55 | - if ( !$ppp_version && PPP_VERSION == '1.3' ) { |
|
55 | + if ( ! $ppp_version && PPP_VERSION == '1.3') { |
|
56 | 56 | ppp_v13_upgrades(); |
57 | 57 | $upgrades_executed = true; |
58 | 58 | } |
59 | 59 | |
60 | - if ( version_compare( $ppp_version, 2.1, '<' ) ) { |
|
60 | + if (version_compare( $ppp_version, 2.1, '<' )) { |
|
61 | 61 | ppp_v21_upgrades(); |
62 | 62 | $upgrades_executed = true; |
63 | 63 | } |
64 | 64 | |
65 | - if ( $upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' ) ) { |
|
65 | + if ($upgrades_executed || version_compare( $ppp_version, PPP_VERSION, '<' )) { |
|
66 | 66 | set_transient( '_ppp_activation_redirect', '1', 60 ); |
67 | 67 | update_option( 'ppp_version', PPP_VERSION ); |
68 | 68 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | $doing_upgrade = get_option( 'ppp_doing_upgrade', false ); |
82 | 82 | |
83 | - if ( empty( $doing_upgrade ) ) { |
|
83 | + if (empty($doing_upgrade)) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function ppp_v13_upgrades() { |
98 | 98 | global $ppp_share_settings; |
99 | - $uq_status = ( isset( $ppp_share_settings['ppp_unique_links'] ) && $ppp_share_settings['ppp_unique_links'] == '1' ) ? $ppp_share_settings['ppp_unique_links'] : 0; |
|
100 | - $ga_status = ( isset( $ppp_share_settings['ppp_ga_tags'] ) && $ppp_share_settings['ppp_ga_tags'] == '1' ) ? $ppp_share_settings['ppp_ga_tags'] : 0; |
|
99 | + $uq_status = (isset($ppp_share_settings['ppp_unique_links']) && $ppp_share_settings['ppp_unique_links'] == '1') ? $ppp_share_settings['ppp_unique_links'] : 0; |
|
100 | + $ga_status = (isset($ppp_share_settings['ppp_ga_tags']) && $ppp_share_settings['ppp_ga_tags'] == '1') ? $ppp_share_settings['ppp_ga_tags'] : 0; |
|
101 | 101 | |
102 | - if ( $uq_status ) { |
|
102 | + if ($uq_status) { |
|
103 | 103 | $ppp_share_settings['analytics'] = 'unique_links'; |
104 | - unset( $ppp_share_settings['ppp_unique_links'] ); |
|
105 | - } elseif ( $ga_status ) { |
|
104 | + unset($ppp_share_settings['ppp_unique_links']); |
|
105 | + } elseif ($ga_status) { |
|
106 | 106 | $ppp_share_settings['analytics'] = 'google_analytics'; |
107 | - unset( $ppp_share_settings['ppp_ga_tags'] ); |
|
107 | + unset($ppp_share_settings['ppp_ga_tags']); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | update_option( 'ppp_share_settings', $ppp_share_settings ); |
111 | 111 | |
112 | 112 | global $ppp_options; |
113 | 113 | $ppp_options['default_text'] = '{post_title}'; |
114 | - $ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on'); |
|
114 | + $ppp_options['days'] = array( 'day1' => 'on', 'day2' => 'on', 'day3' => 'on', 'day4' => 'on', 'day5' => 'on', 'day6' => 'on' ); |
|
115 | 115 | |
116 | 116 | update_option( 'ppp_options', $ppp_options ); |
117 | 117 | } |
@@ -133,29 +133,29 @@ discard block |
||
133 | 133 | */ |
134 | 134 | function ppp_v22_postmeta_upgrade() { |
135 | 135 | |
136 | - if( ! current_user_can( PostPromoterPro::get_manage_capability() ) ) { |
|
136 | + if ( ! current_user_can( PostPromoterPro::get_manage_capability() )) { |
|
137 | 137 | wp_die( __( 'You do not have permission to do upgrades', 'ppp-txt' ), __( 'Error', 'ppp-txt' ), array( 'response' => 403 ) ); |
138 | 138 | } |
139 | 139 | |
140 | 140 | ignore_user_abort( true ); |
141 | 141 | |
142 | - if ( ! ini_get( 'safe_mode' ) ) { |
|
143 | - @set_time_limit(0); |
|
142 | + if ( ! ini_get( 'safe_mode' )) { |
|
143 | + @set_time_limit( 0 ); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | global $wpdb; |
147 | 147 | |
148 | 148 | |
149 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
149 | + $step = isset($_GET['step']) ? absint( $_GET['step'] ) : 1; |
|
150 | 150 | $number = 25; |
151 | - $offset = $step == 1 ? 0 : ( $step - 1 ) * $number; |
|
151 | + $offset = $step == 1 ? 0 : ($step - 1) * $number; |
|
152 | 152 | |
153 | - if ( $step < 2 ) { |
|
153 | + if ($step < 2) { |
|
154 | 154 | // Check if we have any payments before moving on |
155 | 155 | $sql = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' LIMIT 1"; |
156 | 156 | $has_overrides = $wpdb->get_col( $sql ); |
157 | 157 | |
158 | - if( empty( $has_overrides ) ) { |
|
158 | + if (empty($has_overrides)) { |
|
159 | 159 | // We had no payments, just complete |
160 | 160 | update_option( 'ppp_version', preg_replace( '/[^0-9.].*/', '', PPP_VERSION ) ); |
161 | 161 | ppp_set_upgrade_complete( 'upgrade_post_meta' ); |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
167 | + $total = isset($_GET['total']) ? absint( $_GET['total'] ) : false; |
|
168 | 168 | |
169 | - if ( empty( $total ) || $total <= 1 ) { |
|
169 | + if (empty($total) || $total <= 1) { |
|
170 | 170 | $total_sql = "SELECT COUNT(post_id) as total FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data'"; |
171 | 171 | $results = $wpdb->get_row( $total_sql, 0 ); |
172 | 172 | |
@@ -176,48 +176,48 @@ discard block |
||
176 | 176 | $results = $wpdb->get_results( $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_ppp_post_override_data' ORDER BY meta_id DESC LIMIT %d,%d;", $offset, $number ) ); |
177 | 177 | $new_post_meta = array(); |
178 | 178 | |
179 | - if ( $results ) { |
|
180 | - foreach ( $results as $result ) { |
|
179 | + if ($results) { |
|
180 | + foreach ($results as $result) { |
|
181 | 181 | |
182 | 182 | $share_key = 1; |
183 | 183 | |
184 | 184 | $override_data = unserialize( $result->meta_value ); |
185 | 185 | |
186 | - foreach ( $override_data as $day => $values ) { |
|
186 | + foreach ($override_data as $day => $values) { |
|
187 | 187 | |
188 | - if ( ! isset( $values['enabled'] ) ) { |
|
188 | + if ( ! isset($values['enabled'])) { |
|
189 | 189 | continue; |
190 | 190 | } |
191 | 191 | |
192 | - $text = ! empty( $values['text'] ) ? $values['text'] : ''; |
|
193 | - $time = ! empty( $values['time'] ) ? $values['time'] : '8:00am'; |
|
192 | + $text = ! empty($values['text']) ? $values['text'] : ''; |
|
193 | + $time = ! empty($values['time']) ? $values['time'] : '8:00am'; |
|
194 | 194 | |
195 | 195 | $post = get_post( $result->post_id ); |
196 | 196 | $days_ahead = substr( $day, -1 ); |
197 | - $date = date( 'm\/d\/Y', strtotime( $post->post_date . '+' . $days_ahead . ' days' ) ); |
|
197 | + $date = date( 'm\/d\/Y', strtotime( $post->post_date.'+'.$days_ahead.' days' ) ); |
|
198 | 198 | $image = ''; |
199 | 199 | $attachment_id = ''; |
200 | 200 | |
201 | - if ( ! empty( $values['use_image'] ) ) { |
|
201 | + if ( ! empty($values['use_image'])) { |
|
202 | 202 | $thumb_id = get_post_thumbnail_id( $result->post_id ); |
203 | 203 | $thumb_url = wp_get_attachment_image_src( $thumb_id, 'ppp-tw-share-image', true ); |
204 | 204 | |
205 | - if ( isset( $thumb_url[0] ) && ! empty( $thumb_url[0] ) && !strpos( $thumb_url[0], 'wp-includes/images/media/default.png' ) ) { |
|
205 | + if (isset($thumb_url[0]) && ! empty($thumb_url[0]) && ! strpos( $thumb_url[0], 'wp-includes/images/media/default.png' )) { |
|
206 | 206 | $thumb_url = $thumb_url[0]; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! empty( $thumb_id ) && ! empty( $thumb_url ) ) { |
|
209 | + if ( ! empty($thumb_id) && ! empty($thumb_url)) { |
|
210 | 210 | $attachment_id = $thumb_id; |
211 | 211 | $image = $thumb_url; |
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - $new_post_meta[$share_key] = array ( |
|
215 | + $new_post_meta[$share_key] = array( |
|
216 | 216 | 'date' => $date, |
217 | 217 | 'time' => $time, |
218 | 218 | 'text' => $text, |
219 | - 'image' => ! empty( $image ) ? $image : '', |
|
220 | - 'attachment_id' => ! empty( $attachment_id ) ? $attachment_id : '' |
|
219 | + 'image' => ! empty($image) ? $image : '', |
|
220 | + 'attachment_id' => ! empty($attachment_id) ? $attachment_id : '' |
|
221 | 221 | ); |
222 | 222 | |
223 | 223 | $share_key++; |
@@ -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,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 |