@@ -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( 'manage_options' ) ) { |
|
| 19 | + if ( ! current_user_can( 'manage_options' )) { |
|
| 20 | 20 | wp_die( __( 'You do not have permission to view this page', 'ppp-txt' ) ); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $network = $_GET['ppp_network']; |
| 24 | - do_action( 'ppp_disconnect-' . $network ); |
|
| 24 | + do_action( 'ppp_disconnect-'.$network ); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | add_action( 'admin_init', 'ppp_disconnect_social', 10 ); |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $tabs = apply_filters( 'ppp_metabox_tabs', array() ); |
| 37 | 37 | $i = 0; |
| 38 | - foreach ( $tabs as $key => $values ) { |
|
| 39 | - if ( $i === 0 ) { |
|
| 38 | + foreach ($tabs as $key => $values) { |
|
| 39 | + if ($i === 0) { |
|
| 40 | 40 | $visibleKey = $key; |
| 41 | 41 | $class = 'tabs'; |
| 42 | 42 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | ?><li class="<?php echo $class; ?>"><a href="#<?php echo $key; ?>"><?php |
| 47 | - if ( $values['class'] !== false ) { |
|
| 47 | + if ($values['class'] !== false) { |
|
| 48 | 48 | ?> |
| 49 | 49 | <span class="dashicons <?php echo $values['class']; ?>"></span> |
| 50 | 50 | <?php |
@@ -65,15 +65,15 @@ discard block |
||
| 65 | 65 | $tabs = apply_filters( 'ppp_admin_tabs', array() ); |
| 66 | 66 | $i = 0; |
| 67 | 67 | ?><h2 id="ppp-social-connect-tabs" class="nav-tab-wrapper"><?php |
| 68 | - foreach ( $tabs as $key => $values ) { |
|
| 69 | - if ( $i === 0 ) { |
|
| 68 | + foreach ($tabs as $key => $values) { |
|
| 69 | + if ($i === 0) { |
|
| 70 | 70 | $visibleSettingTab = $key; |
| 71 | 71 | $class = ' nav-tab-active'; |
| 72 | 72 | } else { |
| 73 | 73 | $class = ''; |
| 74 | 74 | } |
| 75 | 75 | ?><a class="nav-tab<?php echo $class; ?>" href='#<?php echo $key; ?>'><?php |
| 76 | - if ( $values['class'] !== false ) { |
|
| 76 | + if ($values['class'] !== false) { |
|
| 77 | 77 | ?> |
| 78 | 78 | <span class="dashicons <?php echo $values['class']; ?>"></span> |
| 79 | 79 | <?php |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | function ppp_generate_metabox_content( $post ) { |
| 95 | 95 | global $visibleKey; |
| 96 | 96 | $tab_content = apply_filters( 'ppp_metabox_content', array() ); |
| 97 | - if ( empty( $tab_content ) ) { |
|
| 97 | + if (empty($tab_content)) { |
|
| 98 | 98 | printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) ); |
| 99 | 99 | } else { |
| 100 | - foreach ( $tab_content as $service ) { |
|
| 101 | - $hidden = ( $visibleKey == $service ) ? '' : ' hidden'; |
|
| 100 | + foreach ($tab_content as $service) { |
|
| 101 | + $hidden = ($visibleKey == $service) ? '' : ' hidden'; |
|
| 102 | 102 | ?> |
| 103 | 103 | <div class="wp-tab-panel tabs-panel<?php echo $hidden; ?>" id="<?php echo $service; ?>"> |
| 104 | - <?php do_action( 'ppp_generate_metabox_content-' . $service, $post ); ?> |
|
| 104 | + <?php do_action( 'ppp_generate_metabox_content-'.$service, $post ); ?> |
|
| 105 | 105 | </div> |
| 106 | 106 | <?php |
| 107 | 107 | } |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | function ppp_generate_social_account_content() { |
| 117 | 117 | global $visibleSettingTab; |
| 118 | 118 | $tab_content = apply_filters( 'ppp_admin_social_content', array() ); |
| 119 | - if ( empty( $tab_content ) ) { |
|
| 119 | + if (empty($tab_content)) { |
|
| 120 | 120 | printf( __( 'No social media accounts active. <a href="%s">Connect with your accounts now</a>.', 'ppp-txt' ), admin_url( 'admin.php?page=ppp-social-settings' ) ); |
| 121 | 121 | } else { |
| 122 | - foreach ( $tab_content as $service ) { |
|
| 123 | - $hidden = ( $visibleSettingTab == $service ) ? '' : ' hidden'; |
|
| 122 | + foreach ($tab_content as $service) { |
|
| 123 | + $hidden = ($visibleSettingTab == $service) ? '' : ' hidden'; |
|
| 124 | 124 | ?> |
| 125 | 125 | <div class="ppp-social-connect<?php echo $hidden; ?>" id="<?php echo $service; ?>"> |
| 126 | - <?php do_action( 'ppp_connect_display-' . $service ); ?> |
|
| 126 | + <?php do_action( 'ppp_connect_display-'.$service ); ?> |
|
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | 129 | } |
@@ -136,30 +136,30 @@ discard block |
||
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | 138 | function ppp_list_view_maybe_take_action() { |
| 139 | - if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'ppp-schedule-info' ) { |
|
| 139 | + if ( ! isset($_GET['page']) || $_GET['page'] !== 'ppp-schedule-info') { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( ! isset( $_GET['action'] ) ) { |
|
| 143 | + if ( ! isset($_GET['action'])) { |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Get the necessary info for the actions |
| 148 | - $post_id = isset( $_GET['post_id'] ) ? $_GET['post_id'] : 0; |
|
| 149 | - $name = isset( $_GET['name'] ) ? $_GET['name'] : ''; |
|
| 150 | - $index = isset( $_GET['index'] ) ? $_GET['index'] : 0; |
|
| 151 | - $delete = isset( $_GET['delete_too'] ) ? true : false; |
|
| 148 | + $post_id = isset($_GET['post_id']) ? $_GET['post_id'] : 0; |
|
| 149 | + $name = isset($_GET['name']) ? $_GET['name'] : ''; |
|
| 150 | + $index = isset($_GET['index']) ? $_GET['index'] : 0; |
|
| 151 | + $delete = isset($_GET['delete_too']) ? true : false; |
|
| 152 | 152 | |
| 153 | - switch( $_GET['action'] ) { |
|
| 153 | + switch ($_GET['action']) { |
|
| 154 | 154 | case 'delete_item': |
| 155 | - if ( ! empty( $post_id ) && ! empty( $name ) || empty( $index ) ) { |
|
| 156 | - ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron |
|
| 155 | + if ( ! empty($post_id) && ! empty($name) || empty($index)) { |
|
| 156 | + ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron |
|
| 157 | 157 | |
| 158 | 158 | // Remove the item from postmeta if it exists. |
| 159 | 159 | $current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 160 | 160 | |
| 161 | - if ( isset( $current_post_meta[$index] ) ) { |
|
| 162 | - unset( $current_post_meta[$index] ); |
|
| 161 | + if (isset($current_post_meta[$index])) { |
|
| 162 | + unset($current_post_meta[$index]); |
|
| 163 | 163 | update_post_meta( $post_id, '_ppp_tweets', $current_post_meta ); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | case 'share_now': |
| 171 | - if ( ! empty( $post_id ) && ! empty( $name ) ) { |
|
| 171 | + if ( ! empty($post_id) && ! empty($name)) { |
|
| 172 | 172 | ppp_share_post( $post_id, $name ); |
| 173 | 173 | |
| 174 | - if ( $delete && ! empty( $index ) ) { |
|
| 175 | - ppp_remove_scheduled_share( array( (int)$post_id, $name ) ); // Remove the item in cron |
|
| 174 | + if ($delete && ! empty($index)) { |
|
| 175 | + ppp_remove_scheduled_share( array( (int) $post_id, $name ) ); // Remove the item in cron |
|
| 176 | 176 | |
| 177 | 177 | // Remove the item from postmeta if it exists. |
| 178 | 178 | $current_post_meta = get_post_meta( $post_id, '_ppp_tweets', true ); |
| 179 | 179 | |
| 180 | - if ( isset( $current_post_meta[$index] ) ) { |
|
| 181 | - unset( $current_post_meta[$index] ); |
|
| 180 | + if (isset($current_post_meta[$index])) { |
|
| 181 | + unset($current_post_meta[$index]); |
|
| 182 | 182 | update_post_meta( $post_id, '_ppp_tweets', $current_post_meta ); |
| 183 | 183 | } |
| 184 | 184 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if ( ! defined( 'ABSPATH' )) { |
|
| 5 | 5 | exit; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | $date = sanitize_text_field( $_POST['date'] ); |
| 11 | 11 | $time = sanitize_text_field( $_POST['time'] ); |
| 12 | 12 | |
| 13 | - $offset = (int) -( get_option( 'gmt_offset' ) ); // Make the timestamp in the users' timezone, b/c that makes more sense |
|
| 13 | + $offset = (int) -(get_option( 'gmt_offset' )); // Make the timestamp in the users' timezone, b/c that makes more sense |
|
| 14 | 14 | |
| 15 | 15 | $share_time = explode( ':', $time ); |
| 16 | 16 | |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | $minutes = (int) substr( $share_time[1], 0, 2 ); |
| 19 | 19 | $ampm = strtolower( substr( $share_time[1], -2 ) ); |
| 20 | 20 | |
| 21 | - if ( $ampm == 'pm' && $hours != 12 ) { |
|
| 21 | + if ($ampm == 'pm' && $hours != 12) { |
|
| 22 | 22 | $hours = $hours + 12; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if ( $ampm == 'am' && $hours == 12 ) { |
|
| 25 | + if ($ampm == 'am' && $hours == 12) { |
|
| 26 | 26 | $hours = 00; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -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,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return string The Content to display |
| 43 | 43 | */ |
| 44 | 44 | public function column_default( $item, $column_name ) { |
| 45 | - return $item[ $column_name ]; |
|
| 45 | + return $item[$column_name]; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $accounts = apply_filters( 'ppp_register_social_service', array() ); |
| 76 | 76 | |
| 77 | - foreach ( $accounts as $account ) { |
|
| 77 | + foreach ($accounts as $account) { |
|
| 78 | 78 | $data[$account] = array( |
| 79 | - 'icon' => apply_filters( 'ppp_account_list_icon-' . $account, '' ), |
|
| 80 | - 'avatar' => apply_filters( 'ppp_account_list_avatar-' . $account, '' ), |
|
| 81 | - 'name' => apply_filters( 'ppp_account_list_name-' . $account, '' ), |
|
| 82 | - 'actions' => apply_filters( 'ppp_account_list_actions-' . $account, '' ), |
|
| 83 | - 'extras' => apply_filters( 'ppp_account_list_extras-' . $account, '' ), |
|
| 79 | + 'icon' => apply_filters( 'ppp_account_list_icon-'.$account, '' ), |
|
| 80 | + 'avatar' => apply_filters( 'ppp_account_list_avatar-'.$account, '' ), |
|
| 81 | + 'name' => apply_filters( 'ppp_account_list_name-'.$account, '' ), |
|
| 82 | + 'actions' => apply_filters( 'ppp_account_list_actions-'.$account, '' ), |
|
| 83 | + 'extras' => apply_filters( 'ppp_account_list_extras-'.$account, '' ), |
|
| 84 | 84 | ); |
| 85 | 85 | } |
| 86 | 86 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly |
| 13 | -if ( !defined( 'ABSPATH' ) ) exit; |
|
| 13 | +if ( ! defined( 'ABSPATH' )) exit; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Render Upgrades Screen |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | * @return void |
| 20 | 20 | */ |
| 21 | 21 | function ppp_upgrades_screen() { |
| 22 | - $action = isset( $_GET['ppp-upgrade'] ) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : ''; |
|
| 23 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 24 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
| 25 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
| 26 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
| 27 | - $steps = round( ( $total / $number ), 0 ); |
|
| 22 | + $action = isset($_GET['ppp-upgrade']) ? sanitize_text_field( $_GET['ppp-upgrade'] ) : ''; |
|
| 23 | + $step = isset($_GET['step']) ? absint( $_GET['step'] ) : 1; |
|
| 24 | + $total = isset($_GET['total']) ? absint( $_GET['total'] ) : false; |
|
| 25 | + $custom = isset($_GET['custom']) ? absint( $_GET['custom'] ) : 0; |
|
| 26 | + $number = isset($_GET['number']) ? absint( $_GET['number'] ) : 100; |
|
| 27 | + $steps = round( ($total / $number), 0 ); |
|
| 28 | 28 | |
| 29 | 29 | $doing_upgrade_args = array( |
| 30 | 30 | 'page' => 'ppp-upgrades', |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | update_option( 'ppp_doing_upgrade', $doing_upgrade_args ); |
| 39 | - if ( $step > $steps ) { |
|
| 39 | + if ($step > $steps) { |
|
| 40 | 40 | // Prevent a weird case where the estimate was off. Usually only a couple. |
| 41 | 41 | $steps = $step; |
| 42 | 42 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | <div class="wrap"> |
| 45 | 45 | <h1><?php _e( 'Post Promoter Pro - Upgrades', 'ppp-txt' ); ?></h1> |
| 46 | 46 | |
| 47 | - <?php if( ! empty( $action ) ) : ?> |
|
| 47 | + <?php if ( ! empty($action)) : ?> |
|
| 48 | 48 | |
| 49 | 49 | <div id="ppp-upgrade-status"> |
| 50 | 50 | <p><?php _e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'ppp-txt' ); ?></p> |
| 51 | 51 | |
| 52 | - <?php if( ! empty( $total ) ) : ?> |
|
| 52 | + <?php if ( ! empty($total)) : ?> |
|
| 53 | 53 | <p><strong><?php printf( __( 'Step %d of approximately %d running', 'ppp-txt' ), $step, $steps ); ?></strong></p> |
| 54 | 54 | <?php endif; ?> |
| 55 | 55 | </div> |
@@ -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 | |
@@ -12,11 +12,11 @@ discard block |
||
| 12 | 12 | function ppp_register_meta_boxes() { |
| 13 | 13 | global $post, $ppp_options; |
| 14 | 14 | |
| 15 | - if ( !isset( $ppp_options['post_types'] ) || !is_array( $ppp_options['post_types'] ) ) { |
|
| 15 | + if ( ! isset($ppp_options['post_types']) || ! is_array( $ppp_options['post_types'] )) { |
|
| 16 | 16 | return; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - foreach ( $ppp_options['post_types'] as $post_type => $value ) { |
|
| 19 | + foreach ($ppp_options['post_types'] as $post_type => $value) { |
|
| 20 | 20 | add_meta_box( 'ppp_schedule_metabox', 'Post Promoter Pro', 'ppp_schedule_callback', $post_type, 'normal', 'high' ); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -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 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @since 1.2 |
| 36 | 36 | */ |
| 37 | 37 | public function __construct() { |
| 38 | - add_action( 'admin_menu', array( $this, 'admin_menus') ); |
|
| 38 | + add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
| 39 | 39 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
| 40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | remove_submenu_page( 'index.php', 'ppp-getting-started' ); |
| 82 | 82 | |
| 83 | 83 | // Badge for welcome page |
| 84 | - $badge_url = PPP_URL . 'includes/images/ppp-badge.png'; |
|
| 84 | + $badge_url = PPP_URL.'includes/images/ppp-badge.png'; |
|
| 85 | 85 | ?> |
| 86 | 86 | <style type="text/css" media="screen"> |
| 87 | 87 | /*<![CDATA[*/ |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @return void |
| 122 | 122 | */ |
| 123 | 123 | public function tabs() { |
| 124 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'ppp-about'; |
|
| 124 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'ppp-about'; |
|
| 125 | 125 | ?> |
| 126 | 126 | <h1 class="nav-tab-wrapper"> |
| 127 | 127 | <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' ) ) ); ?>"> |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return void |
| 140 | 140 | */ |
| 141 | 141 | public function about_screen() { |
| 142 | - list( $display_version ) = explode( '-', PPP_VERSION ); |
|
| 142 | + list($display_version) = explode( '-', PPP_VERSION ); |
|
| 143 | 143 | ?> |
| 144 | 144 | <div class="wrap about-wrap"> |
| 145 | 145 | <h1><?php printf( __( 'Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1> |
@@ -149,59 +149,59 @@ discard block |
||
| 149 | 149 | <?php $this->tabs(); ?> |
| 150 | 150 | |
| 151 | 151 | <div class="changelog"> |
| 152 | - <h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' );?></h3> |
|
| 152 | + <h3><?php _e( 'Free Form Tweet Scheduling', 'ppp-txt' ); ?></h3> |
|
| 153 | 153 | |
| 154 | 154 | <div class="feature-section"> |
| 155 | 155 | |
| 156 | - <img src="<?php echo PPP_URL . '/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 156 | + <img src="<?php echo PPP_URL.'/includes/images/screenshots/free-form-tweets.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 157 | 157 | |
| 158 | - <h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' );?></h4> |
|
| 159 | - <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> |
|
| 160 | - <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> |
|
| 158 | + <h4><?php _e( 'More effective, and user friendly.', 'ppp-txt' ); ?></h4> |
|
| 159 | + <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> |
|
| 160 | + <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> |
|
| 161 | 161 | |
| 162 | 162 | </div> |
| 163 | 163 | </div> |
| 164 | 164 | |
| 165 | 165 | <div class="changelog"> |
| 166 | - <h3><?php _e( 'Twitter Cards Support', 'ppp-txt' );?></h3> |
|
| 166 | + <h3><?php _e( 'Twitter Cards Support', 'ppp-txt' ); ?></h3> |
|
| 167 | 167 | |
| 168 | 168 | <div class="feature-section"> |
| 169 | 169 | |
| 170 | - <img src="<?php echo PPP_URL . '/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 170 | + <img src="<?php echo PPP_URL.'/includes/images/screenshots/twitter-cards.jpg'; ?>" class="ppp-welcome-screenshots"/> |
|
| 171 | 171 | |
| 172 | - <h4><?php _e( 'Increased visibility on Twitter','ppp-txt' );?></h4> |
|
| 173 | - <p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' );?></p> |
|
| 174 | - <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> |
|
| 172 | + <h4><?php _e( 'Increased visibility on Twitter', 'ppp-txt' ); ?></h4> |
|
| 173 | + <p><?php _e( 'Enable this feature if you want your Tweets to look the best they can.', 'ppp-txt' ); ?></p> |
|
| 174 | + <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> |
|
| 175 | 175 | |
| 176 | 176 | </div> |
| 177 | 177 | </div> |
| 178 | 178 | |
| 179 | 179 | <div class="changelog"> |
| 180 | - <h3><?php _e( 'Variable Twitter Images', 'ppp-txt' );?></h3> |
|
| 180 | + <h3><?php _e( 'Variable Twitter Images', 'ppp-txt' ); ?></h3> |
|
| 181 | 181 | |
| 182 | 182 | <div class="feature-section"> |
| 183 | 183 | |
| 184 | - <h4><?php _e( 'Change the image attached to each Tweet','ppp-txt' );?></h4> |
|
| 185 | - <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> |
|
| 184 | + <h4><?php _e( 'Change the image attached to each Tweet', 'ppp-txt' ); ?></h4> |
|
| 185 | + <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> |
|
| 186 | 186 | |
| 187 | 187 | </div> |
| 188 | 188 | </div> |
| 189 | 189 | |
| 190 | 190 | <div class="changelog"> |
| 191 | - <h3><?php _e( 'Additional Updates', 'ppp-txt' );?></h3> |
|
| 191 | + <h3><?php _e( 'Additional Updates', 'ppp-txt' ); ?></h3> |
|
| 192 | 192 | |
| 193 | 193 | <div class="feature-section col three-col"> |
| 194 | 194 | <div> |
| 195 | - <h4><?php _e( 'Updated image sizes', 'ppp-txt' );?></h4> |
|
| 196 | - <p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' );?></p> |
|
| 195 | + <h4><?php _e( 'Updated image sizes', 'ppp-txt' ); ?></h4> |
|
| 196 | + <p><?php _e( 'Changed the optimal thumbnail image sizes to meet the 2015 network standards.', 'ppp-txt' ); ?></p> |
|
| 197 | 197 | |
| 198 | - <h4><?php _e( 'CSS Updates', 'ppp-txt' );?></h4> |
|
| 199 | - <p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' );?></p> |
|
| 198 | + <h4><?php _e( 'CSS Updates', 'ppp-txt' ); ?></h4> |
|
| 199 | + <p><?php _e( 'Fixed a conflict in the media library CSS.', 'ppp-txt' ); ?></p> |
|
| 200 | 200 | </div> |
| 201 | 201 | |
| 202 | 202 | <div class="last-feature"> |
| 203 | - <h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' );?></h4> |
|
| 204 | - <p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' );?></p> |
|
| 203 | + <h4><?php _e( 'Improved Facebook Token Refresh', 'ppp-txt' ); ?></h4> |
|
| 204 | + <p><?php _e( 'Fixed a bug with the Facebook token refresh resetting the "Post As", dropdown.', 'ppp-txt' ); ?></p> |
|
| 205 | 205 | </div> |
| 206 | 206 | </div> |
| 207 | 207 | </div> |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @return void |
| 222 | 222 | */ |
| 223 | 223 | public function getting_started_screen() { |
| 224 | - list( $display_version ) = explode( '-', PPP_VERSION ); |
|
| 224 | + list($display_version) = explode( '-', PPP_VERSION ); |
|
| 225 | 225 | ?> |
| 226 | 226 | <div class="wrap about-wrap"> |
| 227 | 227 | <h1><?php printf( __( 'Welcome to Post Promoter Pro %s', 'ppp-txt' ), $display_version ); ?></h1> |
@@ -247,12 +247,12 @@ discard block |
||
| 247 | 247 | public function welcome() { |
| 248 | 248 | |
| 249 | 249 | $version_level = explode( '.', PPP_VERSION ); |
| 250 | - if ( count( $version_level > 2 ) ) { |
|
| 250 | + if (count( $version_level > 2 )) { |
|
| 251 | 251 | return; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // Bail if no activation redirect |
| 255 | - if ( ! get_transient( '_ppp_activation_redirect' ) ) { |
|
| 255 | + if ( ! get_transient( '_ppp_activation_redirect' )) { |
|
| 256 | 256 | return; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | delete_transient( '_ppp_activation_redirect' ); |
| 261 | 261 | |
| 262 | 262 | // Bail if activating from network, or bulk |
| 263 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
| 263 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
| 264 | 264 | return; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -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 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function ppp_bitly_enabled() { |
| 13 | 13 | global $ppp_social_settings; |
| 14 | 14 | |
| 15 | - if ( isset( $ppp_social_settings['bitly'] ) && !empty( $ppp_social_settings['bitly'] ) ) { |
|
| 15 | + if (isset($ppp_social_settings['bitly']) && ! empty($ppp_social_settings['bitly'])) { |
|
| 16 | 16 | return true; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | global $ppp_bitly_oauth, $ppp_social_settings; |
| 38 | 38 | ?> |
| 39 | 39 | <p> |
| 40 | - <?php if ( !ppp_bitly_enabled() ) : ?> |
|
| 40 | + <?php if ( ! ppp_bitly_enabled()) : ?> |
|
| 41 | 41 | <form autocomplete="off"> |
| 42 | 42 | <input id="bitly-username" name="ppp-bitly-username" autocomplete="off" type="text" value="" placeholder="Bit.ly Username" size="25" /><br /> |
| 43 | 43 | <input id="bitly-password" name="ppp-bitly-password" autocomplete="off" type="password" value="" placeholder="Bit.ly Password" size="25" /><br /> |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | <input type="hidden" id="bitly-redirect-url" value="<?php echo admin_url( 'admin.php?page=ppp-social-settings' ); ?>" /> |
| 49 | 49 | </form> |
| 50 | 50 | <?php endif; ?> |
| 51 | - <?php if ( ppp_bitly_enabled() ) : ?> |
|
| 51 | + <?php if (ppp_bitly_enabled()) : ?> |
|
| 52 | 52 | <div class="ppp-social-profile ppp-bitly-profile"> |
| 53 | 53 | <img class="ppp-social-icon" src="<?php echo $ppp_social_settings['bitly']['avatar']; ?>" /> |
| 54 | 54 | <div class="ppp-bitly-info"> |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | function ppp_disconnect_bitly() { |
| 73 | 73 | global $ppp_social_settings; |
| 74 | 74 | $ppp_social_settings = get_option( 'ppp_social_settings' ); |
| 75 | - if ( isset( $ppp_social_settings['bitly'] ) ) { |
|
| 76 | - unset( $ppp_social_settings['bitly'] ); |
|
| 75 | + if (isset($ppp_social_settings['bitly'])) { |
|
| 76 | + unset($ppp_social_settings['bitly']); |
|
| 77 | 77 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | add_action( 'ppp_disconnect-bitly', 'ppp_disconnect_bitly', 10 ); |
| 81 | 81 | |
| 82 | 82 | function ppp_set_bitly_token_constants( $social_tokens ) { |
| 83 | - if ( !empty( $social_tokens ) && property_exists( $social_tokens, 'bitly' ) ) { |
|
| 83 | + if ( ! empty($social_tokens) && property_exists( $social_tokens, 'bitly' )) { |
|
| 84 | 84 | define( 'bitly_clientid', $social_tokens->bitly->client_id ); |
| 85 | 85 | define( 'bitly_secret', $social_tokens->bitly->client_secret ); |
| 86 | 86 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $result = $ppp_bitly_oauth->ppp_make_bitly_link( $link ); |
| 99 | 99 | $result = json_decode( $result, true ); |
| 100 | 100 | |
| 101 | - if ( isset ( $result['status_code'] ) && $result['status_code'] == 200 ) { |
|
| 101 | + if (isset ($result['status_code']) && $result['status_code'] == 200) { |
|
| 102 | 102 | return $result['data']['url']; |
| 103 | 103 | } else { |
| 104 | 104 | return $link; |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | $url = 'https://api-ssl.bitly.com/oauth/access_token'; |
| 117 | 117 | $username = $_POST['username']; |
| 118 | 118 | $password = $_POST['password']; |
| 119 | - $headers = array( 'Authorization' => 'Basic ' . base64_encode( bitly_clientid . ':' . bitly_secret ) ); |
|
| 120 | - $body = 'grant_type=password&username=' . $username . '&password=' . $password; |
|
| 119 | + $headers = array( 'Authorization' => 'Basic '.base64_encode( bitly_clientid.':'.bitly_secret ) ); |
|
| 120 | + $body = 'grant_type=password&username='.$username.'&password='.$password; |
|
| 121 | 121 | $result = wp_remote_post( $url, array( 'headers' => $headers, 'body' => $body ) ); |
| 122 | 122 | $body = wp_remote_retrieve_body( $result ); |
| 123 | 123 | $data = json_decode( $body ); |
| 124 | 124 | |
| 125 | - if ( isset( $data->access_token ) ) { |
|
| 125 | + if (isset($data->access_token)) { |
|
| 126 | 126 | global $ppp_social_settings; |
| 127 | 127 | $ppp_social_settings['bitly']['access_token'] = $data->access_token; |
| 128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 135 | 135 | echo 1; |
| 136 | - } elseif ( $body == 'INVALID_LOGIN' ) { |
|
| 136 | + } elseif ($body == 'INVALID_LOGIN') { |
|
| 137 | 137 | echo 'INVALID_LOGIN'; |
| 138 | 138 | } else { |
| 139 | 139 | echo 0; |
@@ -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 bitly functions |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -if( !class_exists( 'PPP_Bitly' ) ) { |
|
| 14 | +if ( ! class_exists( 'PPP_Bitly' )) { |
|
| 15 | 15 | |
| 16 | 16 | class PPP_Bitly { |
| 17 | 17 | |
| 18 | 18 | var $bitly; |
| 19 | 19 | |
| 20 | - public function __construct(){ |
|
| 20 | + public function __construct() { |
|
| 21 | 21 | ppp_maybe_start_session(); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,20 +27,20 @@ discard block |
||
| 27 | 27 | * Handles to load twitter class |
| 28 | 28 | */ |
| 29 | 29 | public function ppp_load_bitly() { |
| 30 | - if( !class_exists( 'Bitly' ) ) { |
|
| 31 | - require_once ( PPP_PATH . '/includes/libs/bitly/bitly.php' ); |
|
| 30 | + if ( ! class_exists( 'Bitly' )) { |
|
| 31 | + require_once (PPP_PATH.'/includes/libs/bitly/bitly.php'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | ppp_set_social_tokens(); |
| 35 | 35 | |
| 36 | - if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' ) ) { |
|
| 36 | + if ( ! defined( 'bitly_clientid' ) || ! defined( 'bitly_secret' )) { |
|
| 37 | 37 | return false; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | global $ppp_social_settings; |
| 41 | 41 | |
| 42 | - if ( isset( $ppp_social_settings['bitly'] ) ) { |
|
| 43 | - if ( !defined( 'bitly_accesstoken' ) ) { |
|
| 42 | + if (isset($ppp_social_settings['bitly'])) { |
|
| 43 | + if ( ! defined( 'bitly_accesstoken' )) { |
|
| 44 | 44 | define( 'bitly_accesstoken', $ppp_social_settings['bitly']['access_token'] ); |
| 45 | 45 | } |
| 46 | 46 | $this->bitly = new Bitly( bitly_clientid, bitly_secret, bitly_accesstoken ); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function revoke_access() { |
| 55 | 55 | global $ppp_social_settings; |
| 56 | 56 | |
| 57 | - unset( $ppp_social_settings['bitly'] ); |
|
| 57 | + unset($ppp_social_settings['bitly']); |
|
| 58 | 58 | |
| 59 | 59 | update_option( 'ppp_social_settings', $ppp_social_settings ); |
| 60 | 60 | } |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | * Get auth codes for Bitly |
| 64 | 64 | * |
| 65 | 65 | */ |
| 66 | - public function ppp_get_bitly_auth_url () { |
|
| 66 | + public function ppp_get_bitly_auth_url() { |
|
| 67 | 67 | //load bitly class |
| 68 | 68 | $bitly = $this->ppp_load_bitly(); |
| 69 | 69 | |
| 70 | 70 | //check bitly class is loaded or not |
| 71 | - if( !$bitly ) { |
|
| 71 | + if ( ! $bitly) { |
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | public function ppp_make_bitly_link( $link = null ) { |
| 80 | - if ( empty( $link ) ) { |
|
| 80 | + if (empty($link)) { |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $bitly = $this->ppp_load_bitly(); |
| 85 | 85 | |
| 86 | - if ( !$bitly ) { |
|
| 86 | + if ( ! $bitly) { |
|
| 87 | 87 | return false; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | public function ppp_bitly_user_info() { |
| 94 | 94 | $bitly = $this->ppp_load_bitly(); |
| 95 | 95 | |
| 96 | - if ( !$bitly ) { |
|
| 96 | + if ( ! $bitly) { |
|
| 97 | 97 | return false; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -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 = 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 | } |