@@ -1,12 +1,12 @@ 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 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
9 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
8 | +if ( ! class_exists( 'WP_List_Table' )) { |
|
9 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | * @return string The Content to display |
43 | 43 | */ |
44 | 44 | public function column_default( $item, $column_name ) { |
45 | - switch ( $column_name ) { |
|
45 | + switch ($column_name) { |
|
46 | 46 | case 'date': |
47 | 47 | case 'post_title': |
48 | - return $item[ $column_name ]; |
|
48 | + return $item[$column_name]; |
|
49 | 49 | case 'content': |
50 | - $content = $item[ $column_name ]; |
|
50 | + $content = $item[$column_name]; |
|
51 | 51 | return $content; |
52 | 52 | case 'image': |
53 | - if ( ! empty( $item['image_url'] ) ) { |
|
54 | - $content = '<img src="' . $item['image_url'] . '" />'; |
|
53 | + if ( ! empty($item['image_url'])) { |
|
54 | + $content = '<img src="'.$item['image_url'].'" />'; |
|
55 | 55 | } else { |
56 | 56 | $content = __( 'None', 'ppp-txt' ); |
57 | 57 | } |
@@ -83,13 +83,13 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function column_post_title( $item ) { |
85 | 85 | $actions = array( |
86 | - 'edit' => sprintf( __( '<a href="%s">Edit</a>', 'ppp-txt' ), admin_url( 'post.php?post=' . $item['post_id'] . '&action=edit#ppp_schedule_metabox' ) ), |
|
87 | - 'delete' => sprintf( __( '<a href="%s">Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=delete_item&post_id=' . $item['post_id'] . '&name=' . $item['name'] . '&index=' . $item['index'] ) ), |
|
88 | - 'share' => sprintf( __( '<a href="%s">Share Now</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id=' . $item['post_id'] . '&name=' . $item['name'] ) ), |
|
89 | - 'share_delete' => sprintf( __( '<a href="%s">Share Now & Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id=' . $item['post_id'] . '&name=' . $item['name'] . '&index=' . $item['index'] . '&delete_too=true' ) ), |
|
86 | + 'edit' => sprintf( __( '<a href="%s">Edit</a>', 'ppp-txt' ), admin_url( 'post.php?post='.$item['post_id'].'&action=edit#ppp_schedule_metabox' ) ), |
|
87 | + 'delete' => sprintf( __( '<a href="%s">Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=delete_item&post_id='.$item['post_id'].'&name='.$item['name'].'&index='.$item['index'] ) ), |
|
88 | + 'share' => sprintf( __( '<a href="%s">Share Now</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id='.$item['post_id'].'&name='.$item['name'] ) ), |
|
89 | + 'share_delete' => sprintf( __( '<a href="%s">Share Now & Delete</a>', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-schedule-info&action=share_now&post_id='.$item['post_id'].'&name='.$item['name'].'&index='.$item['index'].'&delete_too=true' ) ), |
|
90 | 90 | ); |
91 | 91 | |
92 | - return sprintf( '<span class="dashicons icon-ppp-' . $item['service'] . '"></span> %1$s %2$s', $item['post_title'], $this->row_actions( $actions ) ); |
|
92 | + return sprintf( '<span class="dashicons icon-ppp-'.$item['service'].'"></span> %1$s %2$s', $item['post_title'], $this->row_actions( $actions ) ); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | * @return string The HTML to display the date |
99 | 99 | */ |
100 | 100 | public function column_date( $item ) { |
101 | - $date = date_i18n( get_option('date_format') . ' @ ' . get_option('time_format'), $item['date'] ); |
|
102 | - if ( $item['conflict'] ) { |
|
103 | - $date .= '<br /><small style="color: red">' . __( 'Warning: Multiple items scheduled at this time.', 'ppp-txt' ) . '</small>'; |
|
101 | + $date = date_i18n( get_option( 'date_format' ).' @ '.get_option( 'time_format' ), $item['date'] ); |
|
102 | + if ($item['conflict']) { |
|
103 | + $date .= '<br /><small style="color: red">'.__( 'Warning: Multiple items scheduled at this time.', 'ppp-txt' ).'</small>'; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return $date; |
@@ -121,48 +121,48 @@ discard block |
||
121 | 121 | |
122 | 122 | $crons = ppp_get_shceduled_crons(); |
123 | 123 | $cron_tally = array(); |
124 | - foreach ( $crons as $key => $cron ) { |
|
124 | + foreach ($crons as $key => $cron) { |
|
125 | 125 | $ppp_data = $cron; |
126 | 126 | $timestamp = $ppp_data['timestamp']; |
127 | 127 | |
128 | - $cron_tally[$timestamp] = isset( $cron_tally[$timestamp] ) ? $cron_tally[$timestamp] + 1 : 1; |
|
128 | + $cron_tally[$timestamp] = isset($cron_tally[$timestamp]) ? $cron_tally[$timestamp] + 1 : 1; |
|
129 | 129 | |
130 | 130 | $name_parts = explode( '_', $ppp_data['args'][1] ); |
131 | 131 | $post_id = $ppp_data['args'][0]; |
132 | 132 | $index = $name_parts[1]; |
133 | - $service = isset( $name_parts[3] ) ? $name_parts[3] : 'tw'; |
|
134 | - $builder = 'ppp_' . $service . '_build_share_message'; |
|
135 | - $post_meta = apply_filters( 'ppp_get_scheduled_items_' . $service, array(), $post_id ); |
|
133 | + $service = isset($name_parts[3]) ? $name_parts[3] : 'tw'; |
|
134 | + $builder = 'ppp_'.$service.'_build_share_message'; |
|
135 | + $post_meta = apply_filters( 'ppp_get_scheduled_items_'.$service, array(), $post_id ); |
|
136 | 136 | $image_url = ''; |
137 | 137 | |
138 | - if ( ! empty( $post_meta[$index]['attachment_id'] ) ) { |
|
139 | - $image_url = ppp_post_has_media( $post_id, $service, true, $post_meta[ $index ]['attachment_id'] ); |
|
140 | - } elseif ( ! empty( $post_meta[ $index ]['image'] ) ) { |
|
141 | - $image_url = $post_meta[ $index ]['image']; |
|
138 | + if ( ! empty($post_meta[$index]['attachment_id'])) { |
|
139 | + $image_url = ppp_post_has_media( $post_id, $service, true, $post_meta[$index]['attachment_id'] ); |
|
140 | + } elseif ( ! empty($post_meta[$index]['image'])) { |
|
141 | + $image_url = $post_meta[$index]['image']; |
|
142 | 142 | } |
143 | 143 | |
144 | - $conflict = $cron_tally[ $timestamp ] > 1 ? true : false; |
|
144 | + $conflict = $cron_tally[$timestamp] > 1 ? true : false; |
|
145 | 145 | |
146 | - $data[ $key ] = array( |
|
146 | + $data[$key] = array( |
|
147 | 147 | 'post_id' => $post_id, |
148 | 148 | 'post_title' => get_the_title( $post_id ), |
149 | 149 | 'service' => $service, |
150 | 150 | 'index' => $index, |
151 | - 'date' => $timestamp + ( get_option( 'gmt_offset' ) * 3600 ), |
|
151 | + 'date' => $timestamp + (get_option( 'gmt_offset' ) * 3600), |
|
152 | 152 | 'content' => function_exists( $builder ) ? $builder( $post_id, $ppp_data['args'][1], false ) : '', |
153 | - 'name' => 'sharedate_' . $index . '_' . $post_id, |
|
153 | + 'name' => 'sharedate_'.$index.'_'.$post_id, |
|
154 | 154 | 'conflict' => $conflict, |
155 | 155 | ); |
156 | 156 | |
157 | - if ( ! empty( $image_url ) ) { |
|
158 | - $data[ $key ]['image_url'] = $image_url; |
|
157 | + if ( ! empty($image_url)) { |
|
158 | + $data[$key]['image_url'] = $image_url; |
|
159 | 159 | } |
160 | 160 | |
161 | - $description_function = 'ppp_' . $service . '_get_share_description'; |
|
162 | - if ( function_exists( $description_function ) ) { |
|
161 | + $description_function = 'ppp_'.$service.'_get_share_description'; |
|
162 | + if (function_exists( $description_function )) { |
|
163 | 163 | $description = $description_function( $post_id, $index ); |
164 | - if ( ! empty( $description ) ) { |
|
165 | - $data[ $key ]['content'] .= '<br />' . $description; |
|
164 | + if ( ! empty($description)) { |
|
165 | + $data[$key]['content'] .= '<br />'.$description; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $total_items = count( $data ); |
172 | 172 | |
173 | - $offset = isset( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
173 | + $offset = isset($_GET['paged']) ? $_GET['paged'] : 1; |
|
174 | 174 | |
175 | - $data = array_slice( $data, ( $offset - 1 ) * $per_page, $per_page, true ); |
|
175 | + $data = array_slice( $data, ($offset - 1) * $per_page, $per_page, true ); |
|
176 | 176 | $this->items = $data; |
177 | 177 | |
178 | 178 |
@@ -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( 'manage_options' ) ) { |
|
20 | + if ( ! current_user_can( 'manage_options' )) { |
|
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,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 | |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | <?php _e( 'License Key', 'ppp-txt' ); ?><br /><span style="font-size: x-small;"><?php _e( 'Enter your license key', 'ppp-txt' ); ?></span> |
27 | 27 | </th> |
28 | 28 | <td> |
29 | - <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' ) { ?> |
|
29 | + <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 | 30 | <span style="color:green;"> <?php _e( 'active', 'ppp-txt' ); ?></span><?php } ?> |
31 | 31 | </td> |
32 | 32 | </tr> |
33 | 33 | |
34 | - <?php if( false !== $license ) { ?> |
|
34 | + <?php if (false !== $license) { ?> |
|
35 | 35 | <tr valign="top"> |
36 | 36 | <th scope="row" valign="top"> |
37 | 37 | <?php _e( 'Activate License', 'ppp-txt' ); ?> |
38 | 38 | </th> |
39 | 39 | <td> |
40 | - <?php if( $status !== false && $status == 'valid' ) { ?> |
|
40 | + <?php if ($status !== false && $status == 'valid') { ?> |
|
41 | 41 | <?php wp_nonce_field( 'ppp_deactivate_nonce', 'ppp_deactivate_nonce' ); ?> |
42 | 42 | <input type="submit" class="button-secondary" name="ppp_license_deactivate" value="<?php _e( 'Deactivate License', 'ppp-txt' ); ?>"/> |
43 | 43 | <?php } else { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | <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> |
54 | 54 | </th> |
55 | 55 | <td> |
56 | - <?php $default_text = isset( $ppp_options['default_text'] ) ? $ppp_options['default_text'] : ''; ?> |
|
56 | + <?php $default_text = isset($ppp_options['default_text']) ? $ppp_options['default_text'] : ''; ?> |
|
57 | 57 | <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" /> |
58 | 58 | <p id="ppp-text-helper" style="display: none"> |
59 | 59 | <small> |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | <br /> |
64 | 64 | <?php _e( 'Possible Replacements:', 'ppp-txt' ); ?> |
65 | 65 | <br /> |
66 | - <?php foreach( ppp_get_text_tokens() as $token ): ?> |
|
66 | + <?php foreach (ppp_get_text_tokens() as $token): ?> |
|
67 | 67 | <code>{<?php echo $token['token']; ?>}</code> - <?php echo $token['description']; ?><br /> |
68 | 68 | <?php endforeach; ?> |
69 | 69 | </small> |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | <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> |
76 | 76 | <td> |
77 | 77 | <?php $post_types = ppp_supported_post_types(); ?> |
78 | - <?php foreach ( $post_types as $post_type => $type_data ): ?> |
|
79 | - <?php $value = ( isset( $ppp_options['post_types'] ) && isset( $ppp_options['post_types'][$post_type] ) ) ? true : false; ?> |
|
78 | + <?php foreach ($post_types as $post_type => $type_data): ?> |
|
79 | + <?php $value = (isset($ppp_options['post_types']) && isset($ppp_options['post_types'][$post_type])) ? true : false; ?> |
|
80 | 80 | <input type="checkbox" name="ppp_options[post_types][<?php echo $post_type; ?>]" value="1" id="<?php echo $post_type; ?>" <?php checked( true, $value, true ); ?> /> |
81 | 81 | <label for="<?php echo $post_type; ?>"><?php echo $type_data->labels->name; ?></label></br /> |
82 | 82 | <?php endforeach; ?> |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | <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> |
88 | 88 | <td> |
89 | 89 | <p> |
90 | - <?php $debug_enabled = isset( $ppp_options['enable_debug'] ) ? true : false; ?> |
|
90 | + <?php $debug_enabled = isset($ppp_options['enable_debug']) ? true : false; ?> |
|
91 | 91 | <input type="checkbox" name="ppp_options[enable_debug]" <?php checked( true, $debug_enabled, true ); ?> value="1" /> <?php _e( 'Enable Debug', 'ppp-txt' ); ?> |
92 | 92 | </p> |
93 | 93 | <p> |
94 | - <?php $delete_on_uninstall = isset( $ppp_options['delete_on_uninstall'] ) ? true : false; ?> |
|
94 | + <?php $delete_on_uninstall = isset($ppp_options['delete_on_uninstall']) ? true : false; ?> |
|
95 | 95 | <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' ); ?> |
96 | 96 | </p> |
97 | 97 | </td> |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | <?php wp_nonce_field( 'ppp-share-settings' ); ?> |
127 | 127 | <h3><?php _e( 'Social Media Accounts', 'ppp-txt' ); ?></h3> |
128 | 128 | <?php |
129 | - require_once PPP_PATH . 'includes/admin/class-accounts-table.php'; |
|
129 | + require_once PPP_PATH.'includes/admin/class-accounts-table.php'; |
|
130 | 130 | |
131 | 131 | $accounts_table = new PPP_Accounts_Table(); |
132 | 132 | $accounts_table->prepare_items(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $accounts_table->display(); |
135 | 135 | ?> |
136 | 136 | <table class="form-table"> |
137 | - <?php $analytics_option = isset( $ppp_share_settings['analytics'] ) ? $ppp_share_settings['analytics'] : 0; ?> |
|
137 | + <?php $analytics_option = isset($ppp_share_settings['analytics']) ? $ppp_share_settings['analytics'] : 0; ?> |
|
138 | 138 | <tr valign="top"> |
139 | 139 | <th scope="row" valign="top"> |
140 | 140 | <?php _e( 'Analytics', 'ppp-txt' ); ?></span> |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | <hr /> |
174 | 174 | <small><?php _e( 'Here is an example of what your link will look like', 'ppp-txt' ); ?>: <br /> |
175 | 175 | <?php $post = wp_get_recent_posts( array( 'numberposts' => 1 ) ); ?> |
176 | - <?php if( count( $post ) > 0 ): ?> |
|
177 | - <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_' . $post[0]['ID'], false ); ?></code></small> |
|
176 | + <?php if (count( $post ) > 0): ?> |
|
177 | + <code><?php echo ppp_generate_link( $post[0]['ID'], 'sharedate_1_'.$post[0]['ID'], false ); ?></code></small> |
|
178 | 178 | <?php else: ?> |
179 | 179 | <em><?php _e( 'No posts available to generate link from.', 'ppp-txt' ); ?></em> |
180 | 180 | <?php endif; ?> |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | </tr> |
184 | 184 | |
185 | 185 | <?php |
186 | - $tw_sop = ! empty( $ppp_share_settings['twitter']['share_on_publish'] ) ? true : false; |
|
187 | - $fb_sop = ! empty( $ppp_share_settings['facebook']['share_on_publish'] ) ? true : false; |
|
188 | - $li_sop = ! empty( $ppp_share_settings['linkedin']['share_on_publish'] ) ? true : false; |
|
186 | + $tw_sop = ! empty($ppp_share_settings['twitter']['share_on_publish']) ? true : false; |
|
187 | + $fb_sop = ! empty($ppp_share_settings['facebook']['share_on_publish']) ? true : false; |
|
188 | + $li_sop = ! empty($ppp_share_settings['linkedin']['share_on_publish']) ? true : false; |
|
189 | 189 | ?> |
190 | 190 | <tr valign="top"> |
191 | 191 | <th scope="row" valign="top"> |
@@ -193,21 +193,21 @@ discard block |
||
193 | 193 | <small><em><?php _e( 'Enabled sharing on publish by default', 'ppp-txt' ); ?></em></small> |
194 | 194 | </th> |
195 | 195 | <td id="ppp-share-on-publish-wrapper"> |
196 | - <?php if ( ppp_twitter_enabled() ) : ?> |
|
196 | + <?php if (ppp_twitter_enabled()) : ?> |
|
197 | 197 | <p> |
198 | 198 | <input type="checkbox" id="twitter-share-on-publish" value="1" <?php checked( true, $tw_sop, true ); ?> name="ppp_share_settings[twitter][share_on_publish]" /> |
199 | 199 | <label for="twitter-share-on-publish"><?php _e( 'Twitter', 'ppp-txt' ); ?></label> |
200 | 200 | </p> |
201 | 201 | <?php endif; ?> |
202 | 202 | |
203 | - <?php if ( ppp_facebook_enabled() ) : ?> |
|
203 | + <?php if (ppp_facebook_enabled()) : ?> |
|
204 | 204 | <p> |
205 | 205 | <input type="checkbox" id="facebook-share-on-publish" value="1" <?php checked( true, $fb_sop, true ); ?> name="ppp_share_settings[facebook][share_on_publish]" /> |
206 | 206 | <label for="facebook-share-on-publish"><?php _e( 'Facebook', 'ppp-txt' ); ?></label> |
207 | 207 | </p> |
208 | 208 | <?php endif; ?> |
209 | 209 | |
210 | - <?php if ( ppp_linkedin_enabled() ) : ?> |
|
210 | + <?php if (ppp_linkedin_enabled()) : ?> |
|
211 | 211 | <p> |
212 | 212 | <input type="checkbox" id="linkedin-share-on-publish" value="1" <?php checked( true, $li_sop, true ); ?> name="ppp_share_settings[linkedin][share_on_publish]" /> |
213 | 213 | <label for="linkedin-share-on-publish"><?php _e( 'LinkedIn', 'ppp-txt' ); ?></label> |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | </tr> |
235 | 235 | |
236 | 236 | <?php |
237 | - $shortener = isset( $ppp_share_settings['shortener'] ) ? $ppp_share_settings['shortener'] : false; |
|
237 | + $shortener = isset($ppp_share_settings['shortener']) ? $ppp_share_settings['shortener'] : false; |
|
238 | 238 | ?> |
239 | 239 | <tr valign="top"> |
240 | 240 | <th scope="row" valign="top"> |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | <?php do_action( 'ppp_url_shorteners', $shortener ); ?> |
248 | 248 | </select> |
249 | 249 | </p> |
250 | - <?php if ( $shortener ) : ?> |
|
251 | - <?php do_action( 'ppp_shortener_settings-' . $shortener ); ?> |
|
250 | + <?php if ($shortener) : ?> |
|
251 | + <?php do_action( 'ppp_shortener_settings-'.$shortener ); ?> |
|
252 | 252 | <?php endif; ?> |
253 | 253 | </td> |
254 | 254 | </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> |
@@ -307,24 +307,24 @@ discard block |
||
307 | 307 | <div class="wrap"> |
308 | 308 | <div id="icon-options-general" class="icon32"></div><h1><?php _e( 'Post Promoter Pro - System Info', 'ppp-txt' ); ?></h1> |
309 | 309 | <textarea style="font-family: Menlo, Monaco, monospace; white-space: pre" onclick="this.focus();this.select()" readonly cols="150" rows="35"> |
310 | - SITE_URL: <?php echo site_url() . "\n"; ?> |
|
311 | - HOME_URL: <?php echo home_url() . "\n"; ?> |
|
310 | + SITE_URL: <?php echo site_url()."\n"; ?> |
|
311 | + HOME_URL: <?php echo home_url()."\n"; ?> |
|
312 | 312 | |
313 | - PPP Version: <?php echo PPP_VERSION . "\n"; ?> |
|
314 | - WordPress Version: <?php echo get_bloginfo( 'version' ) . "\n"; ?> |
|
313 | + PPP Version: <?php echo PPP_VERSION."\n"; ?> |
|
314 | + WordPress Version: <?php echo get_bloginfo( 'version' )."\n"; ?> |
|
315 | 315 | |
316 | 316 | PPP SETTINGS: |
317 | 317 | <?php |
318 | - foreach ( $ppp_options as $name => $value ) { |
|
319 | - if ( $value == false ) { |
|
318 | + foreach ($ppp_options as $name => $value) { |
|
319 | + if ($value == false) { |
|
320 | 320 | $value = 'false'; |
321 | 321 | } |
322 | 322 | |
323 | - if ( $value == '1' ) { |
|
323 | + if ($value == '1') { |
|
324 | 324 | $value = 'true'; |
325 | 325 | } |
326 | 326 | |
327 | - echo $name . ': ' . maybe_serialize( $value ) . "\n\t"; |
|
327 | + echo $name.': '.maybe_serialize( $value )."\n\t"; |
|
328 | 328 | } |
329 | 329 | ?> |
330 | 330 | |
@@ -333,61 +333,61 @@ discard block |
||
333 | 333 | $plugins = get_plugins(); |
334 | 334 | $active_plugins = get_option( 'active_plugins', array() ); |
335 | 335 | |
336 | - foreach ( $plugins as $plugin_path => $plugin ) { |
|
336 | + foreach ($plugins as $plugin_path => $plugin) { |
|
337 | 337 | // If the plugin isn't active, don't show it. |
338 | - if ( ! in_array( $plugin_path, $active_plugins ) ) { |
|
338 | + if ( ! in_array( $plugin_path, $active_plugins )) { |
|
339 | 339 | continue; |
340 | 340 | } |
341 | 341 | |
342 | - echo $plugin['Name']; ?>: <?php echo $plugin['Version'] ."\n\t"; |
|
342 | + echo $plugin['Name']; ?>: <?php echo $plugin['Version']."\n\t"; |
|
343 | 343 | |
344 | 344 | } |
345 | 345 | ?> |
346 | 346 | |
347 | 347 | CURRENT THEME: |
348 | 348 | <?php |
349 | - if ( get_bloginfo( 'version' ) < '3.4' ) { |
|
350 | - $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
351 | - echo $theme_data['Name'] . ': ' . $theme_data['Version']; |
|
349 | + if (get_bloginfo( 'version' ) < '3.4') { |
|
350 | + $theme_data = get_theme_data( get_stylesheet_directory().'/style.css' ); |
|
351 | + echo $theme_data['Name'].': '.$theme_data['Version']; |
|
352 | 352 | } else { |
353 | 353 | $theme_data = wp_get_theme(); |
354 | - echo $theme_data->Name . ': ' . $theme_data->Version; |
|
354 | + echo $theme_data->Name.': '.$theme_data->Version; |
|
355 | 355 | } |
356 | 356 | ?> |
357 | 357 | |
358 | 358 | |
359 | - Multi-site: <?php echo is_multisite() ? 'Yes' . "\n" : 'No' . "\n" ?> |
|
359 | + Multi-site: <?php echo is_multisite() ? 'Yes'."\n" : 'No'."\n" ?> |
|
360 | 360 | |
361 | 361 | ADVANCED INFO: |
362 | - PHP Version: <?php echo PHP_VERSION . "\n"; ?> |
|
363 | - MySQL Version: <?php echo $wpdb->db_version() . "\n"; ?> |
|
364 | - Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> |
|
362 | + PHP Version: <?php echo PHP_VERSION."\n"; ?> |
|
363 | + MySQL Version: <?php echo $wpdb->db_version()."\n"; ?> |
|
364 | + Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE']."\n"; ?> |
|
365 | 365 | |
366 | - PHP Memory Limit: <?php echo ini_get( 'memory_limit' ) . "\n"; ?> |
|
367 | - PHP Post Max Size: <?php echo ini_get( 'post_max_size' ) . "\n"; ?> |
|
368 | - PHP Time Limit: <?php echo ini_get( 'max_execution_time' ) . "\n"; ?> |
|
366 | + PHP Memory Limit: <?php echo ini_get( 'memory_limit' )."\n"; ?> |
|
367 | + PHP Post Max Size: <?php echo ini_get( 'post_max_size' )."\n"; ?> |
|
368 | + PHP Time Limit: <?php echo ini_get( 'max_execution_time' )."\n"; ?> |
|
369 | 369 | |
370 | - WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
371 | - SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled' . "\n" : 'Disabled' . "\n" : 'Not set' . "\n" ?> |
|
370 | + WP_DEBUG: <?php echo defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
371 | + SCRIPT_DEBUG: <?php echo defined( 'SCRIPT_DEBUG' ) ? SCRIPT_DEBUG ? 'Enabled'."\n" : 'Disabled'."\n" : 'Not set'."\n" ?> |
|
372 | 372 | |
373 | - WP Table Prefix: <?php echo "Length: ". strlen( $wpdb->prefix ); echo " Status:"; if ( strlen( $wpdb->prefix )>16 ) {echo " ERROR: Too Long";} else {echo " Acceptable";} echo "\n"; ?> |
|
373 | + WP Table Prefix: <?php echo "Length: ".strlen( $wpdb->prefix ); echo " Status:"; if (strlen( $wpdb->prefix ) > 16) {echo " ERROR: Too Long"; } else {echo " Acceptable"; } echo "\n"; ?> |
|
374 | 374 | |
375 | - Show On Front: <?php echo get_option( 'show_on_front' ) . "\n" ?> |
|
376 | - Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
377 | - Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ) . ' #' . $id . "\n" ?> |
|
375 | + Show On Front: <?php echo get_option( 'show_on_front' )."\n" ?> |
|
376 | + Page On Front: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
377 | + Page For Posts: <?php $id = get_option( 'page_on_front' ); echo get_the_title( $id ).' #'.$id."\n" ?> |
|
378 | 378 | |
379 | - Session: <?php echo isset( $_SESSION ) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
379 | + Session: <?php echo isset($_SESSION) ? 'Enabled' : 'Disabled'; ?><?php echo "\n"; ?> |
|
380 | 380 | Session Name: <?php echo esc_html( ini_get( 'session.name' ) ); ?><?php echo "\n"; ?> |
381 | 381 | Cookie Path: <?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?><?php echo "\n"; ?> |
382 | 382 | Save Path: <?php echo esc_html( ini_get( 'session.save_path' ) ); ?><?php echo "\n"; ?> |
383 | 383 | Use Cookies: <?php echo ini_get( 'session.use_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
384 | 384 | Use Only Cookies: <?php echo ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off'; ?><?php echo "\n"; ?> |
385 | 385 | |
386 | - UPLOAD_MAX_FILESIZE: <?php if ( function_exists( 'phpversion' ) ) echo ini_get( 'upload_max_filesize' ); ?><?php echo "\n"; ?> |
|
387 | - POST_MAX_SIZE: <?php if ( function_exists( 'phpversion' ) ) echo ini_get( 'post_max_size' ); ?><?php echo "\n"; ?> |
|
386 | + UPLOAD_MAX_FILESIZE: <?php if (function_exists( 'phpversion' )) echo ini_get( 'upload_max_filesize' ); ?><?php echo "\n"; ?> |
|
387 | + POST_MAX_SIZE: <?php if (function_exists( 'phpversion' )) echo ini_get( 'post_max_size' ); ?><?php echo "\n"; ?> |
|
388 | 388 | WordPress Memory Limit: <?php echo WP_MEMORY_LIMIT; ?><?php echo "\n"; ?> |
389 | - DISPLAY ERRORS: <?php echo ( ini_get( 'display_errors' ) ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A'; ?><?php echo "\n"; ?> |
|
390 | - FSOCKOPEN: <?php echo ( function_exists( 'fsockopen' ) ) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
389 | + DISPLAY ERRORS: <?php echo (ini_get( 'display_errors' )) ? 'On ('.ini_get( 'display_errors' ).')' : 'N/A'; ?><?php echo "\n"; ?> |
|
390 | + FSOCKOPEN: <?php echo (function_exists( 'fsockopen' )) ? __( 'Your server supports fsockopen.', 'ppp-txt' ) : __( 'Your server does not support fsockopen.', 'ppp-txt' ); ?><?php echo "\n"; ?> |
|
391 | 391 | </textarea> |
392 | 392 | </div> |
393 | 393 | <?php |
@@ -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( 'manage_options' ) ) { |
|
136 | + if ( ! current_user_can( 'manage_options' )) { |
|
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++; |