@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | namespace SimpleCalendar\Admin; |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -106,43 +106,43 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @param array $notice |
| 108 | 108 | */ |
| 109 | - public function __construct( $notice ) { |
|
| 109 | + public function __construct($notice) { |
|
| 110 | 110 | |
| 111 | - if ( ! empty( $notice['id'] ) && ! empty( $notice['content'] ) ) { |
|
| 111 | + if ( ! empty($notice['id']) && ! empty($notice['content'])) { |
|
| 112 | 112 | |
| 113 | 113 | // Content. |
| 114 | - $this->id = is_array( $notice['id'] ) ? array_map( 'sanitize_key', $notice['id'] ) : sanitize_key( $notice['id'] ); |
|
| 115 | - $this->content = wp_kses_post( $notice['content'] ); |
|
| 116 | - if ( ! empty( $notice['class'] ) ) { |
|
| 117 | - $this->class = is_array( $notice['class'] ) ? join( ' ', array_map( 'esc_attr', $notice['class'] ) ) : esc_attr( $notice['class'] ); |
|
| 114 | + $this->id = is_array($notice['id']) ? array_map('sanitize_key', $notice['id']) : sanitize_key($notice['id']); |
|
| 115 | + $this->content = wp_kses_post($notice['content']); |
|
| 116 | + if ( ! empty($notice['class'])) { |
|
| 117 | + $this->class = is_array($notice['class']) ? join(' ', array_map('esc_attr', $notice['class'])) : esc_attr($notice['class']); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Type. |
| 121 | 121 | $default = 'notice'; |
| 122 | - $type = isset( $notice['type'] ) ? esc_attr( $notice['type'] ) : $default; |
|
| 122 | + $type = isset($notice['type']) ? esc_attr($notice['type']) : $default; |
|
| 123 | 123 | $types = array( |
| 124 | 124 | 'error', |
| 125 | 125 | 'notice', |
| 126 | 126 | 'updated', |
| 127 | 127 | 'update-nag', |
| 128 | 128 | ); |
| 129 | - $this->type = in_array( $type, $types ) ? $type : $default; |
|
| 129 | + $this->type = in_array($type, $types) ? $type : $default; |
|
| 130 | 130 | |
| 131 | 131 | // Visibility. |
| 132 | - if ( ! empty( $notice['capability'] ) ) { |
|
| 133 | - $this->capability = esc_attr( $notice['capability'] ); |
|
| 132 | + if ( ! empty($notice['capability'])) { |
|
| 133 | + $this->capability = esc_attr($notice['capability']); |
|
| 134 | 134 | } |
| 135 | - if ( ! empty( $notice['screen'] ) ) { |
|
| 136 | - $this->screen = is_array( $notice['screen'] ) ? array_map( 'esc_attr', $notice['screens'] ) : array( esc_attr( $notice['screen'] ) ); |
|
| 135 | + if ( ! empty($notice['screen'])) { |
|
| 136 | + $this->screen = is_array($notice['screen']) ? array_map('esc_attr', $notice['screens']) : array(esc_attr($notice['screen'])); |
|
| 137 | 137 | } |
| 138 | - if ( ! empty( $notice['post'] ) ) { |
|
| 139 | - $this->post = is_array( $notice['post'] ) ? array_map( 'intval', $notice['post'] ) : array( intval( $notice['post'] ) ); |
|
| 138 | + if ( ! empty($notice['post'])) { |
|
| 139 | + $this->post = is_array($notice['post']) ? array_map('intval', $notice['post']) : array(intval($notice['post'])); |
|
| 140 | 140 | } |
| 141 | - if ( ! empty( $notice['dismissible'] ) ) { |
|
| 142 | - $this->dismissible = $notice['dismissible'] === false ? false: true; |
|
| 141 | + if ( ! empty($notice['dismissible'])) { |
|
| 142 | + $this->dismissible = $notice['dismissible'] === false ? false : true; |
|
| 143 | 143 | } |
| 144 | - if ( ! empty( $notice['visible'] ) ) { |
|
| 145 | - $this->visible = $notice['visible'] === false ? false: true; |
|
| 144 | + if ( ! empty($notice['visible'])) { |
|
| 145 | + $this->visible = $notice['visible'] === false ? false : true; |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | * @since 3.0.0 |
| 155 | 155 | */ |
| 156 | 156 | public function add() { |
| 157 | - if ( ! empty( $this->id ) && ! empty( $this->content ) ) { |
|
| 158 | - $notices = get_option( 'simple-calendar_admin_notices', array() ); |
|
| 159 | - if ( is_array( $this->id ) ) { |
|
| 160 | - foreach ( $this->id as $k => $v ) { |
|
| 161 | - $notices[ $k ][ $v ] = $this; |
|
| 157 | + if ( ! empty($this->id) && ! empty($this->content)) { |
|
| 158 | + $notices = get_option('simple-calendar_admin_notices', array()); |
|
| 159 | + if (is_array($this->id)) { |
|
| 160 | + foreach ($this->id as $k => $v) { |
|
| 161 | + $notices[$k][$v] = $this; |
|
| 162 | 162 | } |
| 163 | 163 | } else { |
| 164 | - $notices[ $this->id ][] = $this; |
|
| 164 | + $notices[$this->id][] = $this; |
|
| 165 | 165 | } |
| 166 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
| 166 | + update_option('simple-calendar_admin_notices', $notices); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -173,16 +173,16 @@ discard block |
||
| 173 | 173 | * @since 3.0.0 |
| 174 | 174 | */ |
| 175 | 175 | public function remove() { |
| 176 | - if ( ! empty( $this->id ) && ! empty( $this->content ) ) { |
|
| 177 | - $notices = get_option( 'simple-calendar_admin_notices', array() ); |
|
| 178 | - if ( is_array( $this->id ) ) { |
|
| 179 | - foreach ( $this->id as $k => $v ) { |
|
| 180 | - unset( $notices[ $k ] ); |
|
| 176 | + if ( ! empty($this->id) && ! empty($this->content)) { |
|
| 177 | + $notices = get_option('simple-calendar_admin_notices', array()); |
|
| 178 | + if (is_array($this->id)) { |
|
| 179 | + foreach ($this->id as $k => $v) { |
|
| 180 | + unset($notices[$k]); |
|
| 181 | 181 | } |
| 182 | 182 | } else { |
| 183 | - unset( $notices[ $this->id ] ); |
|
| 183 | + unset($notices[$this->id]); |
|
| 184 | 184 | } |
| 185 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
| 185 | + update_option('simple-calendar_admin_notices', $notices); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | namespace SimpleCalendar\Admin; |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * @since 3.0.0 |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - add_action( 'admin_init', array( $this, 'remove_notice' ), 10 ); |
|
| 29 | - add_action( 'admin_init', array( $this, 'process_notices' ), 40 ); |
|
| 28 | + add_action('admin_init', array($this, 'remove_notice'), 10); |
|
| 29 | + add_action('admin_init', array($this, 'process_notices'), 40); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -38,35 +38,35 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $notices = $this->get_notices(); |
| 40 | 40 | |
| 41 | - if ( ! empty( $notices ) && is_array( $notices ) ) { |
|
| 41 | + if ( ! empty($notices) && is_array($notices)) { |
|
| 42 | 42 | |
| 43 | - foreach ( $notices as $group ) { |
|
| 44 | - foreach ( $group as $notice ) { |
|
| 43 | + foreach ($notices as $group) { |
|
| 44 | + foreach ($group as $notice) { |
|
| 45 | 45 | |
| 46 | - if ( $notice instanceof Notice ) { |
|
| 46 | + if ($notice instanceof Notice) { |
|
| 47 | 47 | |
| 48 | - if ( $notice->visible === false ) { |
|
| 48 | + if ($notice->visible === false) { |
|
| 49 | 49 | continue; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ( ! empty( $notice->capability ) ) { |
|
| 53 | - if ( ! current_user_can( $notice->capability ) ) { |
|
| 52 | + if ( ! empty($notice->capability)) { |
|
| 53 | + if ( ! current_user_can($notice->capability)) { |
|
| 54 | 54 | continue; |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if ( ! empty( $notice->screen ) && is_array( $notice->screen ) && function_exists( 'get_current_screen' ) ) { |
|
| 58 | + if ( ! empty($notice->screen) && is_array($notice->screen) && function_exists('get_current_screen')) { |
|
| 59 | 59 | $screen = get_current_screen(); |
| 60 | - if ( isset( $screen->id ) ) { |
|
| 61 | - if ( ! in_array( $screen->id, $notice->screen ) ) { |
|
| 60 | + if (isset($screen->id)) { |
|
| 61 | + if ( ! in_array($screen->id, $notice->screen)) { |
|
| 62 | 62 | continue; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if ( ! empty( $notice->post ) && is_array( $notice->post ) ) { |
|
| 68 | - if ( isset( $_GET['post'] ) ) { |
|
| 69 | - if ( ! in_array( intval( $_GET['post'] ), $notice->post ) ) { |
|
| 67 | + if ( ! empty($notice->post) && is_array($notice->post)) { |
|
| 68 | + if (isset($_GET['post'])) { |
|
| 69 | + if ( ! in_array(intval($_GET['post']), $notice->post)) { |
|
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | } else { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $this->add_notice( $notice ); |
|
| 77 | + $this->add_notice($notice); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -92,19 +92,19 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | - public function add_notice( $notice ) { |
|
| 95 | + public function add_notice($notice) { |
|
| 96 | 96 | |
| 97 | - if ( $notice instanceof Notice ) { |
|
| 97 | + if ($notice instanceof Notice) { |
|
| 98 | 98 | |
| 99 | - add_action( 'admin_notices', $print_notice = function() use ( $notice ) { |
|
| 99 | + add_action('admin_notices', $print_notice = function() use ($notice) { |
|
| 100 | 100 | |
| 101 | - $name = is_array( $notice->id ) ? key( $notice->id ) : $notice->id; |
|
| 102 | - $url = add_query_arg( array( 'dismiss_simcal_notice' => $name ) ); |
|
| 101 | + $name = is_array($notice->id) ? key($notice->id) : $notice->id; |
|
| 102 | + $url = add_query_arg(array('dismiss_simcal_notice' => $name)); |
|
| 103 | 103 | $dismiss_link = $notice->dismissible === true |
| 104 | - ? sprintf( '<a class="dashicons-before dashicons-dismiss simcal-dismiss-notice" href="%1$s"></a>', $url ) |
|
| 104 | + ? sprintf('<a class="dashicons-before dashicons-dismiss simcal-dismiss-notice" href="%1$s"></a>', $url) |
|
| 105 | 105 | : ''; |
| 106 | 106 | |
| 107 | - echo '<div class="' . $notice->type . ' ' . $notice->class . ' simcal-admin-notice" data-notice-id="' . $name . '">' . $dismiss_link . $notice->content . '</div>'; |
|
| 107 | + echo '<div class="'.$notice->type.' '.$notice->class.' simcal-admin-notice" data-notice-id="'.$name.'">'.$dismiss_link.$notice->content.'</div>'; |
|
| 108 | 108 | } ); |
| 109 | 109 | |
| 110 | 110 | } |
@@ -121,27 +121,27 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return void |
| 123 | 123 | */ |
| 124 | - public function remove_notice( $notice = '' ) { |
|
| 124 | + public function remove_notice($notice = '') { |
|
| 125 | 125 | |
| 126 | 126 | $notices = $this->get_notices(); |
| 127 | 127 | $update = false; |
| 128 | 128 | |
| 129 | - if ( ! empty( $notice ) ) { |
|
| 130 | - if ( isset( $notices[ $notice ] ) ) { |
|
| 131 | - unset( $notices[ $notice ] ); |
|
| 129 | + if ( ! empty($notice)) { |
|
| 130 | + if (isset($notices[$notice])) { |
|
| 131 | + unset($notices[$notice]); |
|
| 132 | 132 | $update = true; |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if ( isset( $_GET['dismiss_simcal_notice'] ) ) { |
|
| 137 | - if ( isset( $notices[ $_GET['dismiss_simcal_notice'] ] ) ) { |
|
| 138 | - unset( $notices[ esc_attr( $_GET['dismiss_simcal_notice'] ) ] ); |
|
| 136 | + if (isset($_GET['dismiss_simcal_notice'])) { |
|
| 137 | + if (isset($notices[$_GET['dismiss_simcal_notice']])) { |
|
| 138 | + unset($notices[esc_attr($_GET['dismiss_simcal_notice'])]); |
|
| 139 | 139 | $update = true; |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( $update === true ) { |
|
| 144 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
| 143 | + if ($update === true) { |
|
| 144 | + update_option('simple-calendar_admin_notices', $notices); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @return void |
| 156 | 156 | */ |
| 157 | - public function show_notice( $notice ) { |
|
| 157 | + public function show_notice($notice) { |
|
| 158 | 158 | |
| 159 | 159 | $notices = $this->get_notices(); |
| 160 | 160 | |
| 161 | - if ( isset( $notices[ $notice ]->visible ) ) { |
|
| 162 | - $notices[ $notice ]->visible = true; |
|
| 163 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
| 161 | + if (isset($notices[$notice]->visible)) { |
|
| 162 | + $notices[$notice]->visible = true; |
|
| 163 | + update_option('simple-calendar_admin_notices', $notices); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | * |
| 174 | 174 | * @return void |
| 175 | 175 | */ |
| 176 | - public function hide_notice( $notice ) { |
|
| 176 | + public function hide_notice($notice) { |
|
| 177 | 177 | |
| 178 | 178 | $notices = $this->get_notices(); |
| 179 | 179 | |
| 180 | - if ( isset( $notices[ $notice ]->visible ) ) { |
|
| 181 | - $notices[ $notice ]->visible = false; |
|
| 182 | - update_option( 'simple-calendar_admin_notices', $notices ); |
|
| 180 | + if (isset($notices[$notice]->visible)) { |
|
| 181 | + $notices[$notice]->visible = false; |
|
| 182 | + update_option('simple-calendar_admin_notices', $notices); |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | public function get_notices() { |
| 194 | 194 | return apply_filters( |
| 195 | 195 | 'simcal_admin_notices', |
| 196 | - get_option( 'simple-calendar_admin_notices', array() ) |
|
| 196 | + get_option('simple-calendar_admin_notices', array()) |
|
| 197 | 197 | ); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
| 10 | 10 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $this->id = $tab = 'add-ons'; |
| 30 | 30 | $this->option_group = $page = 'add-ons'; |
| 31 | - $this->label = __( 'Add-ons', 'google-calendar-events' ); |
|
| 31 | + $this->label = __('Add-ons', 'google-calendar-events'); |
|
| 32 | 32 | $this->description = ''; |
| 33 | 33 | $this->sections = $this->add_sections(); |
| 34 | 34 | $this->fields = $this->add_fields(); |
| 35 | 35 | |
| 36 | 36 | // Disable the submit button for this page. |
| 37 | - add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } ); |
|
| 37 | + add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } ); |
|
| 38 | 38 | |
| 39 | 39 | // Add html. |
| 40 | - add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) ); |
|
| 40 | + add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html')); |
|
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | // @todo pull data from simplecalendar.io to showcase add-ons |
| 52 | 52 | $js_redirect = '<script type="text/javascript">'; |
| 53 | - $js_redirect .= 'window.location = "' . simcal_ga_campaign_url( simcal_get_url( 'add-ons' ), 'core-plugin', 'plugin-submenu-link', true ) . '"'; |
|
| 53 | + $js_redirect .= 'window.location = "'.simcal_ga_campaign_url(simcal_get_url('add-ons'), 'core-plugin', 'plugin-submenu-link', true).'"'; |
|
| 54 | 54 | $js_redirect .= '</script>'; |
| 55 | 55 | |
| 56 | 56 | echo $js_redirect; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | use SimpleCalendar\Abstracts\Calendar; |
| 10 | 10 | use SimpleCalendar\Abstracts\Admin_Page; |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $this->id = 'calendars'; |
| 41 | 41 | $this->option_group = 'settings'; |
| 42 | - $this->label = __( 'Calendars', 'google-calendar-events' ); |
|
| 42 | + $this->label = __('Calendars', 'google-calendar-events'); |
|
| 43 | 43 | //$this->description = __( 'Manage calendar preferences and calendar types settings and options.', 'google-calendar-events' ); |
| 44 | 44 | |
| 45 | 45 | $calendars = simcal_get_calendar_types(); |
| 46 | 46 | $calendar_settings = array(); |
| 47 | - if ( ! empty( $calendars ) && is_array( $calendars ) ) { |
|
| 48 | - foreach ( $calendars as $calendar => $views ) { |
|
| 47 | + if ( ! empty($calendars) && is_array($calendars)) { |
|
| 48 | + foreach ($calendars as $calendar => $views) { |
|
| 49 | 49 | |
| 50 | - $calendar_type = simcal_get_calendar( $calendar ); |
|
| 50 | + $calendar_type = simcal_get_calendar($calendar); |
|
| 51 | 51 | |
| 52 | - if ( $calendar_type instanceof Calendar ) { |
|
| 52 | + if ($calendar_type instanceof Calendar) { |
|
| 53 | 53 | $settings = $calendar_type->settings_fields(); |
| 54 | - if ( ! empty( $settings ) ) { |
|
| 55 | - $calendar_settings[ $calendar ] = $settings; |
|
| 54 | + if ( ! empty($settings)) { |
|
| 55 | + $calendar_settings[$calendar] = $settings; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -74,17 +74,17 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $sections = array( |
| 76 | 76 | 'general' => array( |
| 77 | - 'title' => __( 'General', 'google-calendar-events' ), |
|
| 77 | + 'title' => __('General', 'google-calendar-events'), |
|
| 78 | 78 | 'description' => '', |
| 79 | 79 | ), |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | 82 | $calendar_types = $this->calendar_types; |
| 83 | 83 | |
| 84 | - if ( ! empty( $calendar_types ) && is_array( $calendar_types ) ) { |
|
| 85 | - foreach ( $calendar_types as $calendar_type => $type ) { |
|
| 84 | + if ( ! empty($calendar_types) && is_array($calendar_types)) { |
|
| 85 | + foreach ($calendar_types as $calendar_type => $type) { |
|
| 86 | 86 | |
| 87 | - $sections[ $calendar_type ] = array( |
|
| 87 | + $sections[$calendar_type] = array( |
|
| 88 | 88 | 'title' => $type['name'], |
| 89 | 89 | 'description' => $type['description'], |
| 90 | 90 | ); |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - arsort( $calendar_types ); |
|
| 95 | + arsort($calendar_types); |
|
| 96 | 96 | |
| 97 | 97 | $sections['poweredby'] = array( |
| 98 | - 'title' => __( 'Show Some Love', 'google-calendar-events' ), |
|
| 98 | + 'title' => __('Show Some Love', 'google-calendar-events'), |
|
| 99 | 99 | 'description' => '', |
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections ); |
|
| 102 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $fields = array(); |
| 115 | 115 | $feed_types = $this->calendar_types; |
| 116 | - $this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id ); |
|
| 116 | + $this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id); |
|
| 117 | 117 | |
| 118 | - foreach ( $this->sections as $section => $contents ) : |
|
| 118 | + foreach ($this->sections as $section => $contents) : |
|
| 119 | 119 | |
| 120 | - if ( 'general' == $section ) { |
|
| 120 | + if ('general' == $section) { |
|
| 121 | 121 | |
| 122 | 122 | $options = array(); |
| 123 | 123 | $post_types = get_post_types( |
@@ -129,54 +129,54 @@ discard block |
||
| 129 | 129 | 'objects', |
| 130 | 130 | 'not' |
| 131 | 131 | ); |
| 132 | - unset( $post_types['attachment'] ); |
|
| 133 | - unset( $post_types['calendar'] ); |
|
| 134 | - unset( $post_types['gce_feed'] ); |
|
| 135 | - foreach ( $post_types as $slug => $post_type ) { |
|
| 136 | - $options[ $slug ] = $post_type->label; |
|
| 132 | + unset($post_types['attachment']); |
|
| 133 | + unset($post_types['calendar']); |
|
| 134 | + unset($post_types['gce_feed']); |
|
| 135 | + foreach ($post_types as $slug => $post_type) { |
|
| 136 | + $options[$slug] = $post_type->label; |
|
| 137 | 137 | } |
| 138 | - asort( $options ); |
|
| 138 | + asort($options); |
|
| 139 | 139 | |
| 140 | - $fields[ $section ][] = array( |
|
| 140 | + $fields[$section][] = array( |
|
| 141 | 141 | 'type' => 'select', |
| 142 | 142 | 'multiselect' => 'multiselect', |
| 143 | 143 | 'enhanced' => 'enhanced', |
| 144 | - 'title' => __( 'Attach Calendars', 'google-calendar-events' ), |
|
| 145 | - 'tooltip' => __( 'You can choose on which content types to add the ability to attach calendars.', 'google-calendar-events' ), |
|
| 146 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][attach_calendars_posts]', |
|
| 147 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-attach-calendars-posts', |
|
| 148 | - 'value' => $this->get_option_value( $section, 'attach_calendars_posts' ), |
|
| 144 | + 'title' => __('Attach Calendars', 'google-calendar-events'), |
|
| 145 | + 'tooltip' => __('You can choose on which content types to add the ability to attach calendars.', 'google-calendar-events'), |
|
| 146 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][attach_calendars_posts]', |
|
| 147 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-attach-calendars-posts', |
|
| 148 | + 'value' => $this->get_option_value($section, 'attach_calendars_posts'), |
|
| 149 | 149 | 'default' => 'post,page', |
| 150 | 150 | 'options' => $options, |
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | - } elseif ( isset( $feed_types[ $section ]['fields'] ) ) { |
|
| 153 | + } elseif (isset($feed_types[$section]['fields'])) { |
|
| 154 | 154 | |
| 155 | - foreach ( $feed_types[ $section ]['fields'] as $key => $args ) { |
|
| 155 | + foreach ($feed_types[$section]['fields'] as $key => $args) { |
|
| 156 | 156 | |
| 157 | - $fields[ $section ][] = array_merge( $args, array( |
|
| 158 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][' . $key . ']', |
|
| 159 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $key, |
|
| 160 | - 'value' => $this->get_option_value( $section, $key ) |
|
| 161 | - ) ); |
|
| 157 | + $fields[$section][] = array_merge($args, array( |
|
| 158 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.']['.$key.']', |
|
| 159 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$key, |
|
| 160 | + 'value' => $this->get_option_value($section, $key) |
|
| 161 | + )); |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - } elseif ( 'poweredby' == $section ) { |
|
| 165 | + } elseif ('poweredby' == $section) { |
|
| 166 | 166 | |
| 167 | - $fields[ $section ][] = array( |
|
| 167 | + $fields[$section][] = array( |
|
| 168 | 168 | 'type' => 'checkbox', |
| 169 | - 'title' => __( 'Powered by Simple Calendar', 'google-calendar-events' ), |
|
| 170 | - 'tooltip' => __( 'Help our plugin get noticed and display a small link to our plugin below your calendars. Thanks!', 'google-calendar-events' ), |
|
| 171 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][opt_in]', |
|
| 172 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-poweredby-optin', |
|
| 173 | - 'value' => $this->get_option_value( $section, 'opt_in' ), |
|
| 169 | + 'title' => __('Powered by Simple Calendar', 'google-calendar-events'), |
|
| 170 | + 'tooltip' => __('Help our plugin get noticed and display a small link to our plugin below your calendars. Thanks!', 'google-calendar-events'), |
|
| 171 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][opt_in]', |
|
| 172 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-poweredby-optin', |
|
| 173 | + 'value' => $this->get_option_value($section, 'opt_in'), |
|
| 174 | 174 | ); |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | endforeach; |
| 178 | 178 | |
| 179 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields ); |
|
| 179 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | use SimpleCalendar\Abstracts\Feed; |
| 10 | 10 | use SimpleCalendar\Abstracts\Admin_Page; |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -39,20 +39,20 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $this->id = 'feeds'; |
| 41 | 41 | $this->option_group = 'settings'; |
| 42 | - $this->label = __( 'Event Sources', 'google-calendar-events' ); |
|
| 42 | + $this->label = __('Event Sources', 'google-calendar-events'); |
|
| 43 | 43 | //$this->description = __( 'Manage calendar event sources settings.', 'google-calendar-events' ); |
| 44 | 44 | |
| 45 | 45 | $feeds_settings = array(); |
| 46 | 46 | $feeds = simcal_get_feed_types(); |
| 47 | - if ( ! empty( $feeds ) && is_array( $feeds ) ) { |
|
| 48 | - foreach ( $feeds as $feed ) { |
|
| 47 | + if ( ! empty($feeds) && is_array($feeds)) { |
|
| 48 | + foreach ($feeds as $feed) { |
|
| 49 | 49 | |
| 50 | - $feed_type = simcal_get_feed( $feed ); |
|
| 50 | + $feed_type = simcal_get_feed($feed); |
|
| 51 | 51 | |
| 52 | - if ( $feed_type instanceof Feed ) { |
|
| 52 | + if ($feed_type instanceof Feed) { |
|
| 53 | 53 | $settings = $feed_type->settings_fields(); |
| 54 | - if ( ! empty( $settings ) ) { |
|
| 55 | - $feeds_settings[ $feed ] = $settings; |
|
| 54 | + if ( ! empty($settings)) { |
|
| 55 | + $feeds_settings[$feed] = $settings; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $sections = array(); |
| 76 | 76 | |
| 77 | - foreach ( $this->feed_types as $feed_type => $type ) { |
|
| 77 | + foreach ($this->feed_types as $feed_type => $type) { |
|
| 78 | 78 | |
| 79 | - $sections[ $feed_type ] = array( |
|
| 79 | + $sections[$feed_type] = array( |
|
| 80 | 80 | 'title' => $type['name'], |
| 81 | 81 | 'description' => $type['description'], |
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - arsort( $sections ); |
|
| 86 | + arsort($sections); |
|
| 87 | 87 | |
| 88 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections ); |
|
| 88 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -99,25 +99,25 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $fields = array(); |
| 101 | 101 | $feed_types = $this->feed_types; |
| 102 | - $this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id ); |
|
| 102 | + $this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id); |
|
| 103 | 103 | |
| 104 | - foreach ( $this->sections as $type => $contents ) : |
|
| 104 | + foreach ($this->sections as $type => $contents) : |
|
| 105 | 105 | |
| 106 | - if ( isset( $feed_types[ $type ]['fields'] ) ) { |
|
| 107 | - foreach ( $feed_types[ $type ]['fields'] as $key => $args ) { |
|
| 106 | + if (isset($feed_types[$type]['fields'])) { |
|
| 107 | + foreach ($feed_types[$type]['fields'] as $key => $args) { |
|
| 108 | 108 | |
| 109 | - $fields[ $type ][] = array_merge( $args, array( |
|
| 110 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $type . '][' . $key . ']', |
|
| 111 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $type . '-' . $key, |
|
| 112 | - 'value' => $this->get_option_value( $type, $key ) |
|
| 113 | - ) ); |
|
| 109 | + $fields[$type][] = array_merge($args, array( |
|
| 110 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$type.']['.$key.']', |
|
| 111 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$type.'-'.$key, |
|
| 112 | + 'value' => $this->get_option_value($type, $key) |
|
| 113 | + )); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | endforeach; |
| 119 | 119 | |
| 120 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields ); |
|
| 120 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
| 10 | 10 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $this->id = $tab = 'licenses'; |
| 32 | 32 | $this->option_group = $page = 'settings'; |
| 33 | - $this->label = __( 'Add-on Licenses', 'google-calendar-events' ); |
|
| 33 | + $this->label = __('Add-on Licenses', 'google-calendar-events'); |
|
| 34 | 34 | //$this->description = __( 'Manage your premium add-on license keys.', 'google-calendar-events' ); |
| 35 | 35 | $this->sections = $this->add_sections(); |
| 36 | 36 | $this->fields = $this->add_fields(); |
| 37 | 37 | |
| 38 | 38 | // Disabled the 'save changes' button for this page. |
| 39 | - add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } ); |
|
| 39 | + add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } ); |
|
| 40 | 40 | |
| 41 | 41 | // Add html to page. |
| 42 | - add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( __CLASS__, 'html' ) ); |
|
| 42 | + add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array(__CLASS__, 'html')); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public static function html() { |
|
| 52 | + public static function html() { |
|
| 53 | 53 | // Add a nonce field used in ajax. |
| 54 | - wp_nonce_field( 'simcal_license_manager', 'simcal_license_manager' ); |
|
| 54 | + wp_nonce_field('simcal_license_manager', 'simcal_license_manager'); |
|
| 55 | 55 | // Add a license 'reset' button. |
| 56 | 56 | ?> |
| 57 | 57 | <br><br> |
| 58 | - <a href="#" id="simcal-reset-licenses" data-dialog="<?php _e( 'WARNING: Are you sure you want to start over and delete all license keys from the settings?', 'google-calendar-events' ) ?>"> |
|
| 59 | - <?php _e( 'Delete your license keys', 'google-calendar-events' ) ?> |
|
| 58 | + <a href="#" id="simcal-reset-licenses" data-dialog="<?php _e('WARNING: Are you sure you want to start over and delete all license keys from the settings?', 'google-calendar-events') ?>"> |
|
| 59 | + <?php _e('Delete your license keys', 'google-calendar-events') ?> |
|
| 60 | 60 | <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> |
| 61 | 61 | </a> |
| 62 | 62 | <?php |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | public function add_sections() { |
| 74 | 74 | $sections = array( |
| 75 | 75 | 'keys' => array( |
| 76 | - 'title' => __( 'Premium Add-on License Keys', 'google-calendar-events' ), |
|
| 77 | - 'description' => __( 'Enter your add-on license keys below, making sure to activate each one to ensure they are valid.', 'google-calendar-events' ) . |
|
| 78 | - '<br/><br/>' . |
|
| 79 | - '<em>' . __( 'Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events' ) . '</em>', |
|
| 76 | + 'title' => __('Premium Add-on License Keys', 'google-calendar-events'), |
|
| 77 | + 'description' => __('Enter your add-on license keys below, making sure to activate each one to ensure they are valid.', 'google-calendar-events'). |
|
| 78 | + '<br/><br/>'. |
|
| 79 | + '<em>'.__('Your license keys are used for access to automatic upgrades and premium support.', 'google-calendar-events').'</em>', |
|
| 80 | 80 | ), |
| 81 | 81 | ); |
| 82 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections ); |
|
| 82 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', $sections); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -92,25 +92,25 @@ discard block |
||
| 92 | 92 | public function add_fields() { |
| 93 | 93 | |
| 94 | 94 | $fields = array(); |
| 95 | - $this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id ); |
|
| 95 | + $this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id); |
|
| 96 | 96 | |
| 97 | - foreach ( $this->sections as $section => $contents ) { |
|
| 97 | + foreach ($this->sections as $section => $contents) { |
|
| 98 | 98 | |
| 99 | - if ( 'keys' == $section ) { |
|
| 99 | + if ('keys' == $section) { |
|
| 100 | 100 | |
| 101 | - $addons = apply_filters( 'simcal_installed_addons', array() ); |
|
| 101 | + $addons = apply_filters('simcal_installed_addons', array()); |
|
| 102 | 102 | |
| 103 | - if ( ! empty( $addons ) && is_array( $addons ) ) { |
|
| 103 | + if ( ! empty($addons) && is_array($addons)) { |
|
| 104 | 104 | |
| 105 | - foreach ( $addons as $addon_id => $addon_name ) { |
|
| 105 | + foreach ($addons as $addon_id => $addon_name) { |
|
| 106 | 106 | |
| 107 | - $fields[ $section ][ $addon_id ] = array( |
|
| 107 | + $fields[$section][$addon_id] = array( |
|
| 108 | 108 | 'type' => 'license', |
| 109 | 109 | 'addon' => $addon_id, |
| 110 | - 'title' => esc_attr( $addon_name ), |
|
| 111 | - 'name' => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][' . $addon_id . ']', |
|
| 112 | - 'id' => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-' . sanitize_key( $addon_id ), |
|
| 113 | - 'value' => $this->get_option_value( $section, $addon_id ), |
|
| 110 | + 'title' => esc_attr($addon_name), |
|
| 111 | + 'name' => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.']['.$addon_id.']', |
|
| 112 | + 'id' => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-'.sanitize_key($addon_id), |
|
| 113 | + 'value' => $this->get_option_value($section, $addon_id), |
|
| 114 | 114 | 'class' => array( |
| 115 | 115 | 'regular-text', |
| 116 | 116 | 'ltr', |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields ); |
|
| 128 | + return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | use SimpleCalendar\Abstracts\Admin_Page; |
| 10 | 10 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $this->id = $tab = 'system-status'; |
| 32 | 32 | $this->option_group = $page = 'tools'; |
| 33 | - $this->label = __( 'System Report', 'google-calendar-events' ); |
|
| 33 | + $this->label = __('System Report', 'google-calendar-events'); |
|
| 34 | 34 | $this->description = ''; |
| 35 | 35 | $this->sections = $this->add_sections(); |
| 36 | 36 | $this->fields = $this->add_fields(); |
| 37 | 37 | |
| 38 | 38 | // Disable the submit button for this page. |
| 39 | - add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } ); |
|
| 39 | + add_filter('simcal_admin_page_'.$page.'_'.$tab.'_submit', function() { return false; } ); |
|
| 40 | 40 | |
| 41 | 41 | // Add html. |
| 42 | - add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) ); |
|
| 42 | + add_action('simcal_admin_page_'.$page.'_'.$tab.'_end', array($this, 'html')); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -51,37 +51,37 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | ?> |
| 53 | 53 | <div id="simcal-system-status-report"> |
| 54 | - <p><?php _e( 'Please copy and paste this information when contacting support:', 'google-calendar-events' ); ?> </p> |
|
| 54 | + <p><?php _e('Please copy and paste this information when contacting support:', 'google-calendar-events'); ?> </p> |
|
| 55 | 55 | <textarea readonly="readonly" onclick="this.select();"></textarea> |
| 56 | - <p><?php _e( 'You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events' ); ?></p> |
|
| 57 | - <p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e( 'Download System Report', 'google-calendar-events' ); ?></a></p> |
|
| 56 | + <p><?php _e('You can also download your information as a text file to attach, or simply view it below.', 'google-calendar-events'); ?></p> |
|
| 57 | + <p><a href="#" id="simcal-system-status-report-download" class="button button-primary"><?php _e('Download System Report', 'google-calendar-events'); ?></a></p> |
|
| 58 | 58 | </div> |
| 59 | 59 | <hr> |
| 60 | 60 | <?php |
| 61 | 61 | |
| 62 | 62 | global $wpdb; |
| 63 | - $wp_version = get_bloginfo( 'version' ); |
|
| 63 | + $wp_version = get_bloginfo('version'); |
|
| 64 | 64 | |
| 65 | 65 | $sections = array(); |
| 66 | 66 | $panels = array( |
| 67 | 67 | 'wordpress' => array( |
| 68 | - 'label' => __( 'WordPress Installation', 'google-calendar-events' ), |
|
| 68 | + 'label' => __('WordPress Installation', 'google-calendar-events'), |
|
| 69 | 69 | 'export' => 'WordPress Installation', |
| 70 | 70 | ), |
| 71 | 71 | 'theme' => array( |
| 72 | - 'label' => __( 'Active Theme', 'google-calendar-events' ), |
|
| 72 | + 'label' => __('Active Theme', 'google-calendar-events'), |
|
| 73 | 73 | 'export' => 'Active Theme', |
| 74 | 74 | ), |
| 75 | 75 | 'plugins' => array( |
| 76 | - 'label' => __( 'Active Plugins', 'google-calendar-events' ), |
|
| 76 | + 'label' => __('Active Plugins', 'google-calendar-events'), |
|
| 77 | 77 | 'export' => 'Active Plugins', |
| 78 | 78 | ), |
| 79 | 79 | 'server' => array( |
| 80 | - 'label' => __( 'Server Environment', 'google-calendar-events' ), |
|
| 80 | + 'label' => __('Server Environment', 'google-calendar-events'), |
|
| 81 | 81 | 'export' => 'Server Environment', |
| 82 | 82 | ), |
| 83 | 83 | 'client' => array( |
| 84 | - 'label' => __( 'Client Information', 'google-calendar-events' ), |
|
| 84 | + 'label' => __('Client Information', 'google-calendar-events'), |
|
| 85 | 85 | 'export' => 'Client Information', |
| 86 | 86 | ) |
| 87 | 87 | ); |
@@ -98,68 +98,68 @@ discard block |
||
| 98 | 98 | * ====================== |
| 99 | 99 | */ |
| 100 | 100 | |
| 101 | - $debug_mode = $script_debug = __( 'No', 'google-calendar-events' ); |
|
| 102 | - if ( defined( 'WP_DEBUG' ) ) { |
|
| 103 | - $debug_mode = true === WP_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $debug_mode; |
|
| 101 | + $debug_mode = $script_debug = __('No', 'google-calendar-events'); |
|
| 102 | + if (defined('WP_DEBUG')) { |
|
| 103 | + $debug_mode = true === WP_DEBUG ? __('Yes', 'google-calendar-events') : $debug_mode; |
|
| 104 | 104 | } |
| 105 | - if ( defined( 'SCRIPT_DEBUG' ) ) { |
|
| 106 | - $script_debug = true === SCRIPT_DEBUG ? __( 'Yes', 'google-calendar-events' ) : $script_debug; |
|
| 105 | + if (defined('SCRIPT_DEBUG')) { |
|
| 106 | + $script_debug = true === SCRIPT_DEBUG ? __('Yes', 'google-calendar-events') : $script_debug; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $memory = $this->let_to_num( WP_MEMORY_LIMIT ); |
|
| 110 | - $memory_export = size_format( $memory ); |
|
| 111 | - if ( $memory < 67108864 ) { |
|
| 112 | - $memory = '<mark class="error">' . sprintf( __( '%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events' ), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP' ) . '</mark>'; |
|
| 109 | + $memory = $this->let_to_num(WP_MEMORY_LIMIT); |
|
| 110 | + $memory_export = size_format($memory); |
|
| 111 | + if ($memory < 67108864) { |
|
| 112 | + $memory = '<mark class="error">'.sprintf(__('%1$s - It is recomendend to set memory to at least 64MB. See: <a href="%2$s" target="_blank">Increasing memory allocated to PHP</a>', 'google-calendar-events'), $memory_export, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP').'</mark>'; |
|
| 113 | 113 | } else { |
| 114 | - $memory = '<mark class="ok">' . $memory_export . '</mark>'; |
|
| 114 | + $memory = '<mark class="ok">'.$memory_export.'</mark>'; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - $permalinks = get_option( 'permalink_structure' ); |
|
| 118 | - $permalinks = empty( $permalinks ) ? '/?' : $permalinks; |
|
| 117 | + $permalinks = get_option('permalink_structure'); |
|
| 118 | + $permalinks = empty($permalinks) ? '/?' : $permalinks; |
|
| 119 | 119 | |
| 120 | 120 | $is_multisite = is_multisite(); |
| 121 | 121 | |
| 122 | 122 | $sections['wordpress'] = array( |
| 123 | 123 | 'name' => array( |
| 124 | - 'label' => __( 'Site Name', 'google-calendar-events' ), |
|
| 124 | + 'label' => __('Site Name', 'google-calendar-events'), |
|
| 125 | 125 | 'label_export' => 'Site Name', |
| 126 | - 'result' => get_bloginfo( 'name' ), |
|
| 126 | + 'result' => get_bloginfo('name'), |
|
| 127 | 127 | ), |
| 128 | 128 | 'home_url' => array( |
| 129 | - 'label' => __( 'Home URL', 'google-calendar-events' ), |
|
| 129 | + 'label' => __('Home URL', 'google-calendar-events'), |
|
| 130 | 130 | 'label_export' => 'Home URL', |
| 131 | 131 | 'result' => home_url(), |
| 132 | 132 | ), |
| 133 | 133 | 'site_url' => array( |
| 134 | - 'label' => __( 'Site URL', 'google-calendar-events' ), |
|
| 134 | + 'label' => __('Site URL', 'google-calendar-events'), |
|
| 135 | 135 | 'label_export' => 'Site URL', |
| 136 | 136 | 'result' => site_url(), |
| 137 | 137 | ), |
| 138 | 138 | 'version' => array( |
| 139 | - 'label' => __( 'Version', 'google-calendar-events' ), |
|
| 139 | + 'label' => __('Version', 'google-calendar-events'), |
|
| 140 | 140 | 'label_export' => 'Version', |
| 141 | 141 | 'result' => $wp_version, |
| 142 | 142 | ), |
| 143 | 143 | 'locale' => array( |
| 144 | - 'label' => __( 'Locale', 'google-calendar-events' ), |
|
| 144 | + 'label' => __('Locale', 'google-calendar-events'), |
|
| 145 | 145 | 'label_export' => 'Locale', |
| 146 | 146 | 'result' => get_locale(), |
| 147 | 147 | ), |
| 148 | 148 | 'wp_timezone' => array( |
| 149 | - 'label' => __( 'Timezone', 'google-calendar-events' ), |
|
| 149 | + 'label' => __('Timezone', 'google-calendar-events'), |
|
| 150 | 150 | 'label_export' => 'Timezone', |
| 151 | 151 | 'result' => simcal_get_wp_timezone(), |
| 152 | 152 | ), |
| 153 | 153 | 'multisite' => array( |
| 154 | - 'label' => __( 'Multisite', 'google-calendar-events' ), |
|
| 154 | + 'label' => __('Multisite', 'google-calendar-events'), |
|
| 155 | 155 | 'label_export' => 'Multisite', |
| 156 | - 'result' => $is_multisite ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 156 | + 'result' => $is_multisite ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 157 | 157 | 'result_export' => $is_multisite ? 'Yes' : 'No' |
| 158 | 158 | ), |
| 159 | 159 | 'permalink' => array( |
| 160 | - 'label' => __( 'Permalinks', 'google-calendar-events' ), |
|
| 160 | + 'label' => __('Permalinks', 'google-calendar-events'), |
|
| 161 | 161 | 'label_export' => 'Permalinks', |
| 162 | - 'result' => '<code>' . $permalinks . '</code>', |
|
| 162 | + 'result' => '<code>'.$permalinks.'</code>', |
|
| 163 | 163 | 'result_export' => $permalinks, |
| 164 | 164 | ), |
| 165 | 165 | 'memory_limit' => array( |
@@ -182,86 +182,86 @@ discard block |
||
| 182 | 182 | * ============ |
| 183 | 183 | */ |
| 184 | 184 | |
| 185 | - include_once ABSPATH . 'wp-admin/includes/theme-install.php'; |
|
| 185 | + include_once ABSPATH.'wp-admin/includes/theme-install.php'; |
|
| 186 | 186 | |
| 187 | - if ( version_compare( $wp_version, '3.4', '<' ) ) { |
|
| 188 | - $active_theme = get_theme_data( get_stylesheet_directory() . '/style.css' ); |
|
| 189 | - $theme_name = '<a href="' . $active_theme['URI'] . '" target="_blank">' . $active_theme['Name'] . '</a>'; |
|
| 187 | + if (version_compare($wp_version, '3.4', '<')) { |
|
| 188 | + $active_theme = get_theme_data(get_stylesheet_directory().'/style.css'); |
|
| 189 | + $theme_name = '<a href="'.$active_theme['URI'].'" target="_blank">'.$active_theme['Name'].'</a>'; |
|
| 190 | 190 | $theme_version = $active_theme['Version']; |
| 191 | - $theme_author = '<a href="' . $active_theme['AuthorURI'] . '" target="_blank">' . $active_theme['Author'] . '</a>'; |
|
| 192 | - $theme_export = $active_theme['Name'] . ' - ' . $theme_version; |
|
| 191 | + $theme_author = '<a href="'.$active_theme['AuthorURI'].'" target="_blank">'.$active_theme['Author'].'</a>'; |
|
| 192 | + $theme_export = $active_theme['Name'].' - '.$theme_version; |
|
| 193 | 193 | } else { |
| 194 | 194 | $active_theme = wp_get_theme(); |
| 195 | - $theme_name = '<a href="' . $active_theme->ThemeURI . '" target="_blank">' . $active_theme->Name . '</a>'; |
|
| 195 | + $theme_name = '<a href="'.$active_theme->ThemeURI.'" target="_blank">'.$active_theme->Name.'</a>'; |
|
| 196 | 196 | $theme_version = $active_theme->Version; |
| 197 | 197 | $theme_author = $active_theme->Author; |
| 198 | - $theme_export = $active_theme->Name . ' - ' . $theme_version; |
|
| 198 | + $theme_export = $active_theme->Name.' - '.$theme_version; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $theme_update_version = $theme_version; |
| 202 | 202 | |
| 203 | - $api = themes_api( 'theme_information', array( |
|
| 203 | + $api = themes_api('theme_information', array( |
|
| 204 | 204 | 'slug' => get_template(), |
| 205 | - 'fields' => array( 'sections' => false, 'tags' => false ), |
|
| 206 | - ) ); |
|
| 207 | - if ( $api && ! is_wp_error( $api ) ) { |
|
| 205 | + 'fields' => array('sections' => false, 'tags' => false), |
|
| 206 | + )); |
|
| 207 | + if ($api && ! is_wp_error($api)) { |
|
| 208 | 208 | $theme_update_version = $api->version; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if ( version_compare( $theme_version, $theme_update_version, '<' ) ) { |
|
| 212 | - $theme_version = '<mark class="error">' . $theme_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $theme_update_version ) ) . ')</mark>'; |
|
| 211 | + if (version_compare($theme_version, $theme_update_version, '<')) { |
|
| 212 | + $theme_version = '<mark class="error">'.$theme_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($theme_update_version)).')</mark>'; |
|
| 213 | 213 | } else { |
| 214 | - $theme_version = '<mark class="ok">' . $theme_version . '</mark>'; |
|
| 214 | + $theme_version = '<mark class="ok">'.$theme_version.'</mark>'; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $theme = '<dl>'; |
| 218 | - $theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) . '</dt>'; |
|
| 219 | - $theme .= '<dd>' . $theme_name . '</dd>'; |
|
| 220 | - $theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>'; |
|
| 221 | - $theme .= '<dd>' . $theme_author . '</dd>'; |
|
| 222 | - $theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>'; |
|
| 223 | - $theme .= '<dd>' . $theme_version . '</dd>'; |
|
| 218 | + $theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>'; |
|
| 219 | + $theme .= '<dd>'.$theme_name.'</dd>'; |
|
| 220 | + $theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>'; |
|
| 221 | + $theme .= '<dd>'.$theme_author.'</dd>'; |
|
| 222 | + $theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>'; |
|
| 223 | + $theme .= '<dd>'.$theme_version.'</dd>'; |
|
| 224 | 224 | $theme .= '</dl>'; |
| 225 | 225 | |
| 226 | 226 | $is_child_theme = is_child_theme(); |
| 227 | 227 | $parent_theme = $parent_theme_export = '-'; |
| 228 | 228 | |
| 229 | - if ( $is_child_theme ) { |
|
| 230 | - if ( version_compare( $wp_version, '3.4', '<' ) ) { |
|
| 229 | + if ($is_child_theme) { |
|
| 230 | + if (version_compare($wp_version, '3.4', '<')) { |
|
| 231 | 231 | |
| 232 | 232 | $parent_theme = $parent_theme_export = $active_theme['Template']; |
| 233 | 233 | |
| 234 | 234 | } else { |
| 235 | 235 | |
| 236 | - $parent = wp_get_theme( $active_theme->Template ); |
|
| 236 | + $parent = wp_get_theme($active_theme->Template); |
|
| 237 | 237 | $parent_theme = '<dl>'; |
| 238 | - $parent_theme .= '<dt>' . __( 'Name', 'google-calendar-events' ) . '</dt>'; |
|
| 239 | - $parent_theme .= '<dd>' . $parent->Name . '</dd>'; |
|
| 240 | - $parent_theme .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>'; |
|
| 241 | - $parent_theme .= '<dd>' . $parent->Author . '</dd>'; |
|
| 242 | - $parent_theme .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>'; |
|
| 243 | - $parent_theme .= '<dd>' . $parent->Version . '</dd>'; |
|
| 238 | + $parent_theme .= '<dt>'.__('Name', 'google-calendar-events').'</dt>'; |
|
| 239 | + $parent_theme .= '<dd>'.$parent->Name.'</dd>'; |
|
| 240 | + $parent_theme .= '<dt>'.__('Author', 'google-calendar-events').'</dt>'; |
|
| 241 | + $parent_theme .= '<dd>'.$parent->Author.'</dd>'; |
|
| 242 | + $parent_theme .= '<dt>'.__('Version', 'google-calendar-events').'</dt>'; |
|
| 243 | + $parent_theme .= '<dd>'.$parent->Version.'</dd>'; |
|
| 244 | 244 | $parent_theme .= '</dl>'; |
| 245 | 245 | |
| 246 | - $parent_theme_export = strip_tags( $parent->Name ) . ' - ' . $parent->Version; |
|
| 246 | + $parent_theme_export = strip_tags($parent->Name).' - '.$parent->Version; |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $sections['theme'] = array( |
| 251 | 251 | 'theme' => array( |
| 252 | - 'label' => __( 'Theme Information', 'google-calendar-events' ), |
|
| 252 | + 'label' => __('Theme Information', 'google-calendar-events'), |
|
| 253 | 253 | 'label_export' => 'Theme', |
| 254 | 254 | 'result' => $theme, |
| 255 | 255 | 'result_export' => $theme_export, |
| 256 | 256 | ), |
| 257 | 257 | 'theme_child' => array( |
| 258 | - 'label' => __( 'Child Theme', 'google-calendar-events' ), |
|
| 258 | + 'label' => __('Child Theme', 'google-calendar-events'), |
|
| 259 | 259 | 'label_export' => 'Child Theme', |
| 260 | - 'result' => $is_child_theme ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 260 | + 'result' => $is_child_theme ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 261 | 261 | 'result_export' => $is_child_theme ? 'Yes' : 'No', |
| 262 | 262 | ), |
| 263 | 263 | 'theme_parent' => array( |
| 264 | - 'label' => __( 'Parent Theme', 'google-calendar-events' ), |
|
| 264 | + 'label' => __('Parent Theme', 'google-calendar-events'), |
|
| 265 | 265 | 'label_export' => 'Parent Theme', |
| 266 | 266 | 'result' => $parent_theme, |
| 267 | 267 | 'result_export' => $parent_theme_export, |
@@ -273,61 +273,61 @@ discard block |
||
| 273 | 273 | * ============== |
| 274 | 274 | */ |
| 275 | 275 | |
| 276 | - include_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
|
| 276 | + include_once ABSPATH.'wp-admin/includes/plugin-install.php'; |
|
| 277 | 277 | |
| 278 | - $active_plugins = (array) get_option( 'active_plugins', array() ); |
|
| 279 | - if ( is_multisite() ) { |
|
| 280 | - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); |
|
| 278 | + $active_plugins = (array) get_option('active_plugins', array()); |
|
| 279 | + if (is_multisite()) { |
|
| 280 | + $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - foreach ( $active_plugins as $plugin ) { |
|
| 283 | + foreach ($active_plugins as $plugin) { |
|
| 284 | 284 | |
| 285 | - $plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); |
|
| 285 | + $plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin); |
|
| 286 | 286 | |
| 287 | - if ( ! empty( $plugin_data['Name'] ) ) { |
|
| 287 | + if ( ! empty($plugin_data['Name'])) { |
|
| 288 | 288 | |
| 289 | 289 | $plugin_name = $plugin_data['Title']; |
| 290 | 290 | $plugin_author = $plugin_data['Author']; |
| 291 | 291 | $plugin_version = $plugin_update_version = $plugin_data['Version']; |
| 292 | 292 | |
| 293 | 293 | // Afraid that querying many plugins may risk a timeout. |
| 294 | - if ( count( $active_plugins ) <= 10 ) { |
|
| 295 | - $api = plugins_api( 'plugin_information', array( |
|
| 294 | + if (count($active_plugins) <= 10) { |
|
| 295 | + $api = plugins_api('plugin_information', array( |
|
| 296 | 296 | 'slug' => $plugin_data['Name'], |
| 297 | 297 | 'fields' => array( |
| 298 | 298 | 'version' => true, |
| 299 | 299 | ), |
| 300 | - ) ); |
|
| 301 | - if ( $api && ! is_wp_error( $api ) ) { |
|
| 302 | - if ( ! empty( $api->version ) ) { |
|
| 300 | + )); |
|
| 301 | + if ($api && ! is_wp_error($api)) { |
|
| 302 | + if ( ! empty($api->version)) { |
|
| 303 | 303 | $plugin_update_version = $api->version; |
| 304 | - if ( version_compare( $plugin_version, $plugin_update_version, '<' ) ) { |
|
| 305 | - $plugin_version = '<mark class="error">' . $plugin_version . ' (' . sprintf( __( '%s is available', 'google-calendar-events' ), esc_html( $plugin_update_version ) ) . ')</mark>'; |
|
| 304 | + if (version_compare($plugin_version, $plugin_update_version, '<')) { |
|
| 305 | + $plugin_version = '<mark class="error">'.$plugin_version.' ('.sprintf(__('%s is available', 'google-calendar-events'), esc_html($plugin_update_version)).')</mark>'; |
|
| 306 | 306 | } else { |
| 307 | - $plugin_version = '<mark class="ok">' . $plugin_version . '</mark>'; |
|
| 307 | + $plugin_version = '<mark class="ok">'.$plugin_version.'</mark>'; |
|
| 308 | 308 | } |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $plugin = '<dl>'; |
| 314 | - $plugin .= '<dt>' . __( 'Author', 'google-calendar-events' ) . '</dt>'; |
|
| 315 | - $plugin .= '<dd>' . $plugin_author . '</dd>'; |
|
| 316 | - $plugin .= '<dt>' . __( 'Version', 'google-calendar-events' ) . '</dt>'; |
|
| 317 | - $plugin .= '<dd>' . $plugin_version . '</dd>'; |
|
| 314 | + $plugin .= '<dt>'.__('Author', 'google-calendar-events').'</dt>'; |
|
| 315 | + $plugin .= '<dd>'.$plugin_author.'</dd>'; |
|
| 316 | + $plugin .= '<dt>'.__('Version', 'google-calendar-events').'</dt>'; |
|
| 317 | + $plugin .= '<dd>'.$plugin_version.'</dd>'; |
|
| 318 | 318 | $plugin .= '</dl>'; |
| 319 | 319 | |
| 320 | - $sections['plugins'][ sanitize_key( strip_tags( $plugin_name ) ) ] = array( |
|
| 320 | + $sections['plugins'][sanitize_key(strip_tags($plugin_name))] = array( |
|
| 321 | 321 | 'label' => $plugin_name, |
| 322 | - 'label_export' => strip_tags( $plugin_data['Title'] ), |
|
| 322 | + 'label_export' => strip_tags($plugin_data['Title']), |
|
| 323 | 323 | 'result' => $plugin, |
| 324 | 324 | 'result_export' => $plugin_data['Version'], |
| 325 | 325 | ); |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if ( isset( $sections['plugins'] ) ) { |
|
| 330 | - rsort( $sections['plugins'] ); |
|
| 329 | + if (isset($sections['plugins'])) { |
|
| 330 | + rsort($sections['plugins']); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
@@ -335,51 +335,51 @@ discard block |
||
| 335 | 335 | * ================== |
| 336 | 336 | */ |
| 337 | 337 | |
| 338 | - if ( version_compare( PHP_VERSION, '5.4', '<' ) ) { |
|
| 339 | - $php = '<mark class="error">' . sprintf( __( '%1$s - It is recomendend to upgrade at least to PHP version 5.4 for security reasons. <a href="%2$s" target="_blank">Read more.</a>', 'google-calendar-events' ), PHP_VERSION, 'http://www.wpupdatephp.com/update/' ) . '</mark>'; |
|
| 338 | + if (version_compare(PHP_VERSION, '5.4', '<')) { |
|
| 339 | + $php = '<mark class="error">'.sprintf(__('%1$s - It is recomendend to upgrade at least to PHP version 5.4 for security reasons. <a href="%2$s" target="_blank">Read more.</a>', 'google-calendar-events'), PHP_VERSION, 'http://www.wpupdatephp.com/update/').'</mark>'; |
|
| 340 | 340 | } else { |
| 341 | - $php = '<mark class="ok">' . PHP_VERSION . '</mark>'; |
|
| 341 | + $php = '<mark class="ok">'.PHP_VERSION.'</mark>'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if ( $wpdb->use_mysqli ) { |
|
| 345 | - $mysql = @mysqli_get_server_info( $wpdb->dbh ); |
|
| 344 | + if ($wpdb->use_mysqli) { |
|
| 345 | + $mysql = @mysqli_get_server_info($wpdb->dbh); |
|
| 346 | 346 | } else { |
| 347 | 347 | $mysql = @mysql_get_server_info(); |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $host = $_SERVER['SERVER_SOFTWARE']; |
| 351 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 351 | + if (defined('WPE_APIKEY')) { |
|
| 352 | 352 | $host .= ' (WP Engine)'; |
| 353 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
| 353 | + } elseif (defined('PAGELYBIN')) { |
|
| 354 | 354 | $host .= ' (Pagely)'; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | $default_timezone = $server_timezone_export = date_default_timezone_get(); |
| 358 | - if ( 'UTC' !== $default_timezone ) { |
|
| 359 | - $server_timezone = '<mark class="error">' . sprintf( __( 'Server default timezone is %s - it should be UTC', 'google-calendar-events' ), $default_timezone ) . '</mark>'; |
|
| 358 | + if ('UTC' !== $default_timezone) { |
|
| 359 | + $server_timezone = '<mark class="error">'.sprintf(__('Server default timezone is %s - it should be UTC', 'google-calendar-events'), $default_timezone).'</mark>'; |
|
| 360 | 360 | } else { |
| 361 | 361 | $server_timezone = '<mark class="ok">UTC</mark>'; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // WP Remote POST test. |
| 365 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
| 365 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
| 366 | 366 | 'timeout' => 60, |
| 367 | 367 | 'body' => array( |
| 368 | 368 | 'cmd' => '_notify-validate', |
| 369 | 369 | ), |
| 370 | - ) ); |
|
| 371 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
| 370 | + )); |
|
| 371 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
| 372 | 372 | $wp_post_export = 'Yes'; |
| 373 | - $wp_post = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>'; |
|
| 373 | + $wp_post = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>'; |
|
| 374 | 374 | } else { |
| 375 | 375 | $wp_post_export = 'No'; |
| 376 | - $wp_post = '<mark class="error">' . __( 'No', 'google-calendar-events' ); |
|
| 377 | - if ( is_wp_error( $response ) ) { |
|
| 378 | - $error = ' (' . $response->get_error_message() . ')'; |
|
| 376 | + $wp_post = '<mark class="error">'.__('No', 'google-calendar-events'); |
|
| 377 | + if (is_wp_error($response)) { |
|
| 378 | + $error = ' ('.$response->get_error_message().')'; |
|
| 379 | 379 | $wp_post .= $error; |
| 380 | 380 | $wp_post_export .= $error; |
| 381 | 381 | } else { |
| 382 | - $error = ' (' . $response['response']['code'] . ')'; |
|
| 382 | + $error = ' ('.$response['response']['code'].')'; |
|
| 383 | 383 | $wp_post .= $error; |
| 384 | 384 | $wp_post_export .= $error; |
| 385 | 385 | } |
@@ -387,64 +387,64 @@ discard block |
||
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | // WP Remote GET test. |
| 390 | - $response = wp_safe_remote_get( get_home_url( '/?p=1' ) ); |
|
| 391 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
| 390 | + $response = wp_safe_remote_get(get_home_url('/?p=1')); |
|
| 391 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
| 392 | 392 | $wp_get_export = 'Yes'; |
| 393 | - $wp_get = '<mark class="ok">' . __( 'Yes', 'google-calendar-events' ) . '</mark>'; |
|
| 393 | + $wp_get = '<mark class="ok">'.__('Yes', 'google-calendar-events').'</mark>'; |
|
| 394 | 394 | } else { |
| 395 | 395 | $wp_get_export = 'No'; |
| 396 | - $wp_get = '<mark class="error">' . __( 'No', 'google-calendar-events' ); |
|
| 397 | - if ( is_wp_error( $response ) ) { |
|
| 398 | - $error = ' (' . $response->get_error_message() . ')'; |
|
| 396 | + $wp_get = '<mark class="error">'.__('No', 'google-calendar-events'); |
|
| 397 | + if (is_wp_error($response)) { |
|
| 398 | + $error = ' ('.$response->get_error_message().')'; |
|
| 399 | 399 | $wp_get .= $error; |
| 400 | 400 | $wp_get_export .= $error; |
| 401 | 401 | } else { |
| 402 | - $error = ' (' . $response['response']['code'] . ')'; |
|
| 402 | + $error = ' ('.$response['response']['code'].')'; |
|
| 403 | 403 | $wp_get .= $error; |
| 404 | 404 | $wp_get_export .= $error; |
| 405 | 405 | } |
| 406 | 406 | $wp_get .= '</mark>'; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - $php_memory_limit = ini_get( 'memory_limit' ); |
|
| 410 | - $php_max_upload_filesize = ini_get( 'upload_max_filesize' ); |
|
| 411 | - $php_post_max_size = ini_get( 'post_max_size' ); |
|
| 412 | - $php_max_execution_time = ini_get( 'max_execution_time' ); |
|
| 413 | - $php_max_input_vars = ini_get( 'max_input_vars' ); |
|
| 409 | + $php_memory_limit = ini_get('memory_limit'); |
|
| 410 | + $php_max_upload_filesize = ini_get('upload_max_filesize'); |
|
| 411 | + $php_post_max_size = ini_get('post_max_size'); |
|
| 412 | + $php_max_execution_time = ini_get('max_execution_time'); |
|
| 413 | + $php_max_input_vars = ini_get('max_input_vars'); |
|
| 414 | 414 | |
| 415 | 415 | $sections['server'] = array( |
| 416 | 416 | 'host' => array( |
| 417 | - 'label' => __( 'Web Server', 'google-calendar-events' ), |
|
| 417 | + 'label' => __('Web Server', 'google-calendar-events'), |
|
| 418 | 418 | 'label_export' => 'Web Server', |
| 419 | 419 | 'result' => $host, |
| 420 | 420 | ), |
| 421 | 421 | 'php_version' => array( |
| 422 | - 'label' => __( 'PHP Version', 'google-calendar-events' ), |
|
| 422 | + 'label' => __('PHP Version', 'google-calendar-events'), |
|
| 423 | 423 | 'label_export' => 'PHP Version', |
| 424 | 424 | 'result' => $php, |
| 425 | 425 | 'result_export' => PHP_VERSION, |
| 426 | 426 | ), |
| 427 | 427 | 'mysql_version' => array( |
| 428 | - 'label' => __( 'MySQL Version', 'google-calendar-events' ), |
|
| 428 | + 'label' => __('MySQL Version', 'google-calendar-events'), |
|
| 429 | 429 | 'label_export' => 'MySQL Version', |
| 430 | - 'result' => version_compare( $mysql, '5.5', '>' ) ? '<mark class="ok">' . $mysql . '</mark>' : $mysql, |
|
| 430 | + 'result' => version_compare($mysql, '5.5', '>') ? '<mark class="ok">'.$mysql.'</mark>' : $mysql, |
|
| 431 | 431 | 'result_export' => $mysql, |
| 432 | 432 | ), |
| 433 | 433 | 'server_timezone' => array( |
| 434 | - 'label' => __( 'Server Timezone', 'google-calendar-events' ), |
|
| 434 | + 'label' => __('Server Timezone', 'google-calendar-events'), |
|
| 435 | 435 | 'label_export' => 'Server Timezone', |
| 436 | 436 | 'result' => $server_timezone, |
| 437 | 437 | 'result_export' => $server_timezone_export, |
| 438 | 438 | ), |
| 439 | 439 | 'display_errors' => array( |
| 440 | 440 | 'label' => 'Display Errors', |
| 441 | - 'result' => ( ini_get( 'display_errors' ) ) ? __( 'Yes', 'google-calendar-events' ) . ' (' . ini_get( 'display_errors' ) . ')' : '-', |
|
| 442 | - 'result_export' => ( ini_get( 'display_errors' ) ) ? 'Yes' : 'No', |
|
| 441 | + 'result' => (ini_get('display_errors')) ? __('Yes', 'google-calendar-events').' ('.ini_get('display_errors').')' : '-', |
|
| 442 | + 'result_export' => (ini_get('display_errors')) ? 'Yes' : 'No', |
|
| 443 | 443 | ), |
| 444 | 444 | 'php_safe_mode' => array( |
| 445 | 445 | 'label' => 'Safe Mode', |
| 446 | - 'result' => ( ini_get( 'safe_mode' ) ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 447 | - 'result_export' => ( ini_get( 'safe_mode' ) ) ? 'Yes' : 'No', |
|
| 446 | + 'result' => (ini_get('safe_mode')) ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 447 | + 'result_export' => (ini_get('safe_mode')) ? 'Yes' : 'No', |
|
| 448 | 448 | ), |
| 449 | 449 | 'php_memory_limit' => array( |
| 450 | 450 | 'label' => 'Memory Limit', |
@@ -468,23 +468,23 @@ discard block |
||
| 468 | 468 | ), |
| 469 | 469 | 'fsockopen' => array( |
| 470 | 470 | 'label' => 'fsockopen', |
| 471 | - 'result' => function_exists( 'fsockopen' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 472 | - 'result_export' => function_exists( 'fsockopen' ) ? 'Yes' : 'No', |
|
| 471 | + 'result' => function_exists('fsockopen') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 472 | + 'result_export' => function_exists('fsockopen') ? 'Yes' : 'No', |
|
| 473 | 473 | ), |
| 474 | 474 | 'curl_init' => array( |
| 475 | 475 | 'label' => 'cURL', |
| 476 | - 'result' => function_exists( 'curl_init' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 477 | - 'result_export' => function_exists( 'curl_init' ) ? 'Yes' : 'No', |
|
| 476 | + 'result' => function_exists('curl_init') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 477 | + 'result_export' => function_exists('curl_init') ? 'Yes' : 'No', |
|
| 478 | 478 | ), |
| 479 | 479 | 'soap' => array( |
| 480 | 480 | 'label' => 'SOAP', |
| 481 | - 'result' => class_exists( 'SoapClient' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 482 | - 'result_export' => class_exists( 'SoapClient' ) ? 'Yes' : 'No', |
|
| 481 | + 'result' => class_exists('SoapClient') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 482 | + 'result_export' => class_exists('SoapClient') ? 'Yes' : 'No', |
|
| 483 | 483 | ), |
| 484 | 484 | 'suhosin' => array( |
| 485 | 485 | 'label' => 'SUHOSIN', |
| 486 | - 'result' => extension_loaded( 'suhosin' ) ? __( 'Yes', 'google-calendar-events' ) : __( 'No', 'google-calendar-events' ), |
|
| 487 | - 'result_export' => extension_loaded( 'suhosin' ) ? 'Yes' : 'No', |
|
| 486 | + 'result' => extension_loaded('suhosin') ? __('Yes', 'google-calendar-events') : __('No', 'google-calendar-events'), |
|
| 487 | + 'result_export' => extension_loaded('suhosin') ? 'Yes' : 'No', |
|
| 488 | 488 | ), |
| 489 | 489 | 'wp_remote_post' => array( |
| 490 | 490 | 'label' => 'WP Remote POST', |
@@ -506,26 +506,26 @@ discard block |
||
| 506 | 506 | $user_client = new \Browser(); |
| 507 | 507 | |
| 508 | 508 | $browser = '<dl>'; |
| 509 | - $browser .= '<dt>' . __( 'Name:', 'google-calendar-events' ) . '</dt>'; |
|
| 510 | - $browser .= '<dd>' . $user_client->getBrowser() . '</dd>'; |
|
| 511 | - $browser .= '<dt>' . __( 'Version:', 'google-calendar-events' ) . '</dt>'; |
|
| 512 | - $browser .= '<dd>' . $user_client->getVersion() . '</dd>'; |
|
| 513 | - $browser .= '<dt>' . __( 'User Agent:', 'google-calendar-events' ) . '</dt>'; |
|
| 514 | - $browser .= '<dd>' . $user_client->getUserAgent() . '</dd>'; |
|
| 515 | - $browser .= '<dt>' . __( 'Platform:', 'google-calendar-events' ) . '</dt>'; |
|
| 516 | - $browser .= '<dd>' . $user_client->getPlatform() . '</dd>'; |
|
| 509 | + $browser .= '<dt>'.__('Name:', 'google-calendar-events').'</dt>'; |
|
| 510 | + $browser .= '<dd>'.$user_client->getBrowser().'</dd>'; |
|
| 511 | + $browser .= '<dt>'.__('Version:', 'google-calendar-events').'</dt>'; |
|
| 512 | + $browser .= '<dd>'.$user_client->getVersion().'</dd>'; |
|
| 513 | + $browser .= '<dt>'.__('User Agent:', 'google-calendar-events').'</dt>'; |
|
| 514 | + $browser .= '<dd>'.$user_client->getUserAgent().'</dd>'; |
|
| 515 | + $browser .= '<dt>'.__('Platform:', 'google-calendar-events').'</dt>'; |
|
| 516 | + $browser .= '<dd>'.$user_client->getPlatform().'</dd>'; |
|
| 517 | 517 | $browser .= '</dl>'; |
| 518 | 518 | |
| 519 | - $browser_export = $user_client->getBrowser() . ' ' . $user_client->getVersion() . ' (' . $user_client->getPlatform() . ')'; |
|
| 519 | + $browser_export = $user_client->getBrowser().' '.$user_client->getVersion().' ('.$user_client->getPlatform().')'; |
|
| 520 | 520 | |
| 521 | 521 | $sections['client'] = array( |
| 522 | 522 | 'user_ip' => array( |
| 523 | - 'label' => __( 'IP Address', 'google-calendar-events' ), |
|
| 523 | + 'label' => __('IP Address', 'google-calendar-events'), |
|
| 524 | 524 | 'label_export' => 'IP Address', |
| 525 | 525 | 'result' => $_SERVER['SERVER_ADDR'], |
| 526 | 526 | ), |
| 527 | 527 | 'browser' => array( |
| 528 | - 'label' => __( 'Browser', 'google-calendar-events' ), |
|
| 528 | + 'label' => __('Browser', 'google-calendar-events'), |
|
| 529 | 529 | 'result' => $browser, |
| 530 | 530 | 'result_export' => $browser_export, |
| 531 | 531 | ) |
@@ -536,12 +536,12 @@ discard block |
||
| 536 | 536 | * ============ |
| 537 | 537 | */ |
| 538 | 538 | |
| 539 | - $panels = apply_filters( 'simcal_system_status_report_panels', $panels ); |
|
| 540 | - $sections = apply_filters( 'simcal_system_status_report_sections', $sections ); |
|
| 539 | + $panels = apply_filters('simcal_system_status_report_panels', $panels); |
|
| 540 | + $sections = apply_filters('simcal_system_status_report_sections', $sections); |
|
| 541 | 541 | |
| 542 | - foreach ( $panels as $panel => $v ) : |
|
| 542 | + foreach ($panels as $panel => $v) : |
|
| 543 | 543 | |
| 544 | - if ( isset( $sections[ $panel ] ) ) : |
|
| 544 | + if (isset($sections[$panel])) : |
|
| 545 | 545 | |
| 546 | 546 | ?> |
| 547 | 547 | <table class="widefat simcal-system-status-report-panel"> |
@@ -551,15 +551,15 @@ discard block |
||
| 551 | 551 | </tr> |
| 552 | 552 | </thead> |
| 553 | 553 | <tbody> |
| 554 | - <?php foreach ( $sections[ $panel ] as $row => $cell ) : ?> |
|
| 554 | + <?php foreach ($sections[$panel] as $row => $cell) : ?> |
|
| 555 | 555 | <tr> |
| 556 | 556 | <?php |
| 557 | - $label_export = isset( $cell['label_export'] ) ? $cell['label_export'] : $cell['label']; |
|
| 558 | - $result_export = isset( $cell['result_export'] ) ? $cell['result_export'] : $cell['result']; |
|
| 557 | + $label_export = isset($cell['label_export']) ? $cell['label_export'] : $cell['label']; |
|
| 558 | + $result_export = isset($cell['result_export']) ? $cell['result_export'] : $cell['result']; |
|
| 559 | 559 | ?> |
| 560 | - <td class="tooltip"><?php echo isset( $cell['tooltip'] ) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="' . $cell['tooltip'] . '"></i> ' : ''; ?></td> |
|
| 561 | - <td class="label" data-export="<?php echo trim( $label_export ); ?>"><?php echo $cell['label']; ?></td> |
|
| 562 | - <td class="result" data-export="<?php echo trim( $result_export ); ?>"><?php echo $cell['result']; ?></td> |
|
| 560 | + <td class="tooltip"><?php echo isset($cell['tooltip']) ? ' <i class="simcal-icon-help simcal-help-tip" data-tip="'.$cell['tooltip'].'"></i> ' : ''; ?></td> |
|
| 561 | + <td class="label" data-export="<?php echo trim($label_export); ?>"><?php echo $cell['label']; ?></td> |
|
| 562 | + <td class="result" data-export="<?php echo trim($result_export); ?>"><?php echo $cell['result']; ?></td> |
|
| 563 | 563 | </tr> |
| 564 | 564 | <?php endforeach; ?> |
| 565 | 565 | </tbody> |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | jQuery( '#simcal-system-status-report-download' ).on( 'click', function() { |
| 638 | 638 | var file = new Blob( [ report ], { type: 'text/plain' } ); |
| 639 | 639 | jQuery( this ).attr( 'href', URL.createObjectURL( file ) ); |
| 640 | - jQuery( this ).attr( 'download', '<?php echo sanitize_title( str_replace( array( 'http://', 'https://' ), '', get_bloginfo( 'url' ) ) . '-system-report-' . date( 'Y-m-d', time() ) ); ?>' ); |
|
| 640 | + jQuery( this ).attr( 'download', '<?php echo sanitize_title(str_replace(array('http://', 'https://'), '', get_bloginfo('url')).'-system-report-'.date('Y-m-d', time())); ?>' ); |
|
| 641 | 641 | } ); |
| 642 | 642 | |
| 643 | 643 | </script> |
@@ -657,13 +657,13 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @return int|double|string |
| 659 | 659 | */ |
| 660 | - private function let_to_num( $size ) { |
|
| 660 | + private function let_to_num($size) { |
|
| 661 | 661 | |
| 662 | - $l = substr( $size, -1 ); |
|
| 663 | - $ret = substr( $size, 0, -1 ); |
|
| 662 | + $l = substr($size, -1); |
|
| 663 | + $ret = substr($size, 0, -1); |
|
| 664 | 664 | |
| 665 | 665 | // Note: do not insert break or default in this switch loop. |
| 666 | - switch ( strtoupper( $l ) ) { |
|
| 666 | + switch (strtoupper($l)) { |
|
| 667 | 667 | case 'P': |
| 668 | 668 | $ret *= 1024; |
| 669 | 669 | // no break |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | $ret *= 1024; |
| 678 | 678 | // no break |
| 679 | 679 | case 'K': |
| 680 | - $ret *= 1024;; |
|
| 680 | + $ret *= 1024; ; |
|
| 681 | 681 | // no break |
| 682 | 682 | } |
| 683 | 683 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | use SimpleCalendar\Abstracts\Calendar; |
| 10 | 10 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -32,26 +32,26 @@ discard block |
||
| 32 | 32 | new Meta_Boxes(); |
| 33 | 33 | |
| 34 | 34 | // Add column headers in calendar feeds admin archives. |
| 35 | - add_filter( 'manage_calendar_posts_columns', array( $this, 'add_calendar_feed_column_headers' ) ); |
|
| 35 | + add_filter('manage_calendar_posts_columns', array($this, 'add_calendar_feed_column_headers')); |
|
| 36 | 36 | // Process column contents for calendar feeds. |
| 37 | - add_action( 'manage_calendar_posts_custom_column', array( $this, 'calendar_feed_column_content' ), 10, 2 ); |
|
| 37 | + add_action('manage_calendar_posts_custom_column', array($this, 'calendar_feed_column_content'), 10, 2); |
|
| 38 | 38 | |
| 39 | 39 | // Add actions in calendar feed rows. |
| 40 | - add_filter( 'post_row_actions', array( $this, 'row_actions' ), 10, 2 ); |
|
| 40 | + add_filter('post_row_actions', array($this, 'row_actions'), 10, 2); |
|
| 41 | 41 | // Add bulk actions. |
| 42 | - add_action( 'admin_init', array( $this, 'bulk_actions' ) ); |
|
| 42 | + add_action('admin_init', array($this, 'bulk_actions')); |
|
| 43 | 43 | // Add content to edit calendars page. |
| 44 | - add_action( 'load-edit.php', array( $this, 'edit_table_hooks' ) ); |
|
| 44 | + add_action('load-edit.php', array($this, 'edit_table_hooks')); |
|
| 45 | 45 | |
| 46 | 46 | // Default calendar post type content (default event template). |
| 47 | - add_filter( 'default_content', array( $this, 'default_event_template' ), 10, 2 ); |
|
| 47 | + add_filter('default_content', array($this, 'default_event_template'), 10, 2); |
|
| 48 | 48 | |
| 49 | 49 | // Add a clear cache link in submit post box. |
| 50 | - add_action( 'post_submitbox_misc_actions', array( $this, 'clear_cache_button' ) ); |
|
| 50 | + add_action('post_submitbox_misc_actions', array($this, 'clear_cache_button')); |
|
| 51 | 51 | |
| 52 | 52 | // Add media button to post editor for adding a shortcode. |
| 53 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 100 ); |
|
| 54 | - add_action( 'edit_form_after_editor', array( $this, 'add_shortcode_panel' ), 100 ); |
|
| 53 | + add_action('media_buttons', array($this, 'add_shortcode_button'), 100); |
|
| 54 | + add_action('edit_form_after_editor', array($this, 'add_shortcode_panel'), 100); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return array Filtered output. |
| 65 | 65 | */ |
| 66 | - public function add_calendar_feed_column_headers( $columns ) { |
|
| 66 | + public function add_calendar_feed_column_headers($columns) { |
|
| 67 | 67 | |
| 68 | 68 | // New columns. |
| 69 | - $feed_info = array( 'feed' => __( 'Events Source', 'google-calendar-events' ) ); |
|
| 70 | - $calendar_info = array( 'calendar' => __( 'Calendar Type', 'google-calendar-events' ) ); |
|
| 71 | - $shortcode = array( 'shortcode' => __( 'Shortcode', 'google-calendar-events' ) ); |
|
| 69 | + $feed_info = array('feed' => __('Events Source', 'google-calendar-events')); |
|
| 70 | + $calendar_info = array('calendar' => __('Calendar Type', 'google-calendar-events')); |
|
| 71 | + $shortcode = array('shortcode' => __('Shortcode', 'google-calendar-events')); |
|
| 72 | 72 | |
| 73 | 73 | // Merge with existing columns and rearrange. |
| 74 | - $columns = array_slice( $columns, 0, 2, true ) + $feed_info + $calendar_info + $shortcode + array_slice( $columns, 2, null, true ); |
|
| 74 | + $columns = array_slice($columns, 0, 2, true) + $feed_info + $calendar_info + $shortcode + array_slice($columns, 2, null, true); |
|
| 75 | 75 | |
| 76 | 76 | return $columns; |
| 77 | 77 | } |
@@ -86,32 +86,32 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return void |
| 88 | 88 | */ |
| 89 | - public function calendar_feed_column_content( $column_name, $post_id ) { |
|
| 89 | + public function calendar_feed_column_content($column_name, $post_id) { |
|
| 90 | 90 | |
| 91 | - switch ( $column_name ) { |
|
| 91 | + switch ($column_name) { |
|
| 92 | 92 | |
| 93 | 93 | case 'feed': |
| 94 | 94 | |
| 95 | - $feed = simcal_get_feed( $post_id ); |
|
| 96 | - echo isset( $feed->name ) ? $feed->name : '—'; |
|
| 95 | + $feed = simcal_get_feed($post_id); |
|
| 96 | + echo isset($feed->name) ? $feed->name : '—'; |
|
| 97 | 97 | break; |
| 98 | 98 | |
| 99 | 99 | case 'calendar': |
| 100 | 100 | |
| 101 | 101 | $info = '—'; |
| 102 | 102 | |
| 103 | - if ( $terms = wp_get_object_terms( $post_id, 'calendar_type' ) ) { |
|
| 103 | + if ($terms = wp_get_object_terms($post_id, 'calendar_type')) { |
|
| 104 | 104 | |
| 105 | - $calendar_type = sanitize_title( current( $terms )->name ); |
|
| 106 | - $calendar = simcal_get_calendar( $calendar_type ); |
|
| 105 | + $calendar_type = sanitize_title(current($terms)->name); |
|
| 106 | + $calendar = simcal_get_calendar($calendar_type); |
|
| 107 | 107 | |
| 108 | - if ( $calendar instanceof Calendar ) { |
|
| 108 | + if ($calendar instanceof Calendar) { |
|
| 109 | 109 | $info = $calendar->name; |
| 110 | - $views = get_post_meta( $post_id, '_calendar_view', true );; |
|
| 111 | - $view = isset( $views[ $calendar->type ] ) ? $views[ $calendar->type ] : ''; |
|
| 110 | + $views = get_post_meta($post_id, '_calendar_view', true); ; |
|
| 111 | + $view = isset($views[$calendar->type]) ? $views[$calendar->type] : ''; |
|
| 112 | 112 | |
| 113 | - if ( isset( $calendar->views[ $view ] ) ) { |
|
| 114 | - $info .= ' → ' . $calendar->views[ $view ]; |
|
| 113 | + if (isset($calendar->views[$view])) { |
|
| 114 | + $info .= ' → '.$calendar->views[$view]; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | case 'shortcode' : |
| 123 | 123 | |
| 124 | - simcal_print_shortcode_tip( $post_id ); |
|
| 124 | + simcal_print_shortcode_tip($post_id); |
|
| 125 | 125 | break; |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | * @return array Filtered output. |
| 138 | 138 | */ |
| 139 | - public function row_actions( $actions, $post ) { |
|
| 139 | + public function row_actions($actions, $post) { |
|
| 140 | 140 | |
| 141 | 141 | // Add a clear feed cache action link. |
| 142 | - if ( $post->post_type == 'calendar' ) { |
|
| 143 | - $actions['duplicate_feed'] = '<a href="' . esc_url( add_query_arg( array( 'duplicate_feed' => $post->ID ) ) ) . '">' . __( 'Clone', 'google-calendar-events' ) . '</a>'; |
|
| 144 | - $actions['clear_cache'] = '<a href="' . esc_url( add_query_arg( array( 'clear_cache' => $post->ID ) ) ) . '">' . __( 'Clear Cache', 'google-calendar-events' ) . '</a>'; |
|
| 142 | + if ($post->post_type == 'calendar') { |
|
| 143 | + $actions['duplicate_feed'] = '<a href="'.esc_url(add_query_arg(array('duplicate_feed' => $post->ID))).'">'.__('Clone', 'google-calendar-events').'</a>'; |
|
| 144 | + $actions['clear_cache'] = '<a href="'.esc_url(add_query_arg(array('clear_cache' => $post->ID))).'">'.__('Clear Cache', 'google-calendar-events').'</a>'; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return $actions; |
@@ -156,38 +156,38 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | // Clear an individual feed cache. |
| 158 | 158 | // @todo Convert the clear cache request to ajax. |
| 159 | - if ( isset( $_REQUEST['clear_cache'] ) ) { |
|
| 159 | + if (isset($_REQUEST['clear_cache'])) { |
|
| 160 | 160 | |
| 161 | - $id = intval( $_REQUEST['clear_cache'] ); |
|
| 161 | + $id = intval($_REQUEST['clear_cache']); |
|
| 162 | 162 | |
| 163 | - if ( $id > 0 ) { |
|
| 164 | - simcal_delete_feed_transients( $id ); |
|
| 163 | + if ($id > 0) { |
|
| 164 | + simcal_delete_feed_transients($id); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - wp_redirect( remove_query_arg( 'clear_cache' ) ); |
|
| 167 | + wp_redirect(remove_query_arg('clear_cache')); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // Duplicate a feed post type. |
| 171 | - if ( isset( $_REQUEST['duplicate_feed'] ) ) { |
|
| 171 | + if (isset($_REQUEST['duplicate_feed'])) { |
|
| 172 | 172 | |
| 173 | - $id = intval( $_REQUEST['duplicate_feed'] ); |
|
| 173 | + $id = intval($_REQUEST['duplicate_feed']); |
|
| 174 | 174 | |
| 175 | - if ( $id > 0 ) { |
|
| 176 | - $this->duplicate_feed( $id ); |
|
| 175 | + if ($id > 0) { |
|
| 176 | + $this->duplicate_feed($id); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - wp_redirect( remove_query_arg( 'duplicate_feed' ) ); |
|
| 179 | + wp_redirect(remove_query_arg('duplicate_feed')); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - $bulk_actions = new Bulk_Actions( 'calendar' ); |
|
| 182 | + $bulk_actions = new Bulk_Actions('calendar'); |
|
| 183 | 183 | |
| 184 | - $bulk_actions->register_bulk_action( array( |
|
| 185 | - 'menu_text' => __( 'Clear cache', 'google-calendar-events' ), |
|
| 184 | + $bulk_actions->register_bulk_action(array( |
|
| 185 | + 'menu_text' => __('Clear cache', 'google-calendar-events'), |
|
| 186 | 186 | 'action_name' => 'clear_calendars_cache', |
| 187 | - 'callback' => function( $post_ids ) { |
|
| 188 | - simcal_delete_feed_transients( $post_ids ); |
|
| 187 | + 'callback' => function($post_ids) { |
|
| 188 | + simcal_delete_feed_transients($post_ids); |
|
| 189 | 189 | }, |
| 190 | - 'admin_notice' => __( 'Cache cleared.', 'google-calendar-events' ), |
|
| 190 | + 'admin_notice' => __('Cache cleared.', 'google-calendar-events'), |
|
| 191 | 191 | ) |
| 192 | 192 | ); |
| 193 | 193 | |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | $screen = simcal_is_admin_screen(); |
| 206 | 206 | |
| 207 | - if ( 'edit-calendar' == $screen ) { |
|
| 208 | - add_action( 'in_admin_footer', function() { |
|
| 207 | + if ('edit-calendar' == $screen) { |
|
| 208 | + add_action('in_admin_footer', function() { |
|
| 209 | 209 | |
| 210 | 210 | } ); |
| 211 | 211 | } |
@@ -218,29 +218,29 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @param int $post_id |
| 220 | 220 | */ |
| 221 | - private function duplicate_feed( $post_id ) { |
|
| 221 | + private function duplicate_feed($post_id) { |
|
| 222 | 222 | |
| 223 | - if ( $duplicate = get_post( intval( $post_id ), 'ARRAY_A' ) ) { |
|
| 223 | + if ($duplicate = get_post(intval($post_id), 'ARRAY_A')) { |
|
| 224 | 224 | |
| 225 | - if ( 'calendar' == $duplicate['post_type'] ) { |
|
| 225 | + if ('calendar' == $duplicate['post_type']) { |
|
| 226 | 226 | |
| 227 | - $duplicate['post_title'] = $duplicate['post_title'] . ' (' . __( 'Copy', 'google-calendar-events' ) . ')'; |
|
| 227 | + $duplicate['post_title'] = $duplicate['post_title'].' ('.__('Copy', 'google-calendar-events').')'; |
|
| 228 | 228 | |
| 229 | - unset( $duplicate['ID'] ); |
|
| 230 | - unset( $duplicate['guid'] ); |
|
| 231 | - unset( $duplicate['comment_count'] ); |
|
| 229 | + unset($duplicate['ID']); |
|
| 230 | + unset($duplicate['guid']); |
|
| 231 | + unset($duplicate['comment_count']); |
|
| 232 | 232 | |
| 233 | - $duplicate_id = wp_insert_post( $duplicate ); |
|
| 233 | + $duplicate_id = wp_insert_post($duplicate); |
|
| 234 | 234 | |
| 235 | - $taxonomies = get_object_taxonomies( $duplicate['post_type'] ); |
|
| 236 | - foreach ( $taxonomies as $taxonomy ) { |
|
| 237 | - $terms = wp_get_post_terms( $post_id, $taxonomy, array( 'fields' => 'names' ) ); |
|
| 238 | - wp_set_object_terms( $duplicate_id, $terms, $taxonomy ); |
|
| 235 | + $taxonomies = get_object_taxonomies($duplicate['post_type']); |
|
| 236 | + foreach ($taxonomies as $taxonomy) { |
|
| 237 | + $terms = wp_get_post_terms($post_id, $taxonomy, array('fields' => 'names')); |
|
| 238 | + wp_set_object_terms($duplicate_id, $terms, $taxonomy); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $custom_fields = get_post_custom( $post_id ); |
|
| 242 | - foreach ( $custom_fields as $key => $value ) { |
|
| 243 | - add_post_meta( $duplicate_id, $key, maybe_unserialize( $value[0] ) ); |
|
| 241 | + $custom_fields = get_post_custom($post_id); |
|
| 242 | + foreach ($custom_fields as $key => $value) { |
|
| 243 | + add_post_meta($duplicate_id, $key, maybe_unserialize($value[0])); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @return string |
| 259 | 259 | */ |
| 260 | - public function default_event_template( $content, $post ) { |
|
| 260 | + public function default_event_template($content, $post) { |
|
| 261 | 261 | return 'calendar' == $post->post_type ? simcal_default_event_template() : $content; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | global $post, $post_type; |
| 272 | 272 | |
| 273 | - if ( $post_type == 'calendar' && isset( $post->ID ) ) { |
|
| 274 | - echo '<a id="simcal-clear-cache" class="button" data-id="' . $post->ID . ' ">' . |
|
| 275 | - '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> ' . |
|
| 276 | - __( 'Clear cache', 'google-calendar-events' ) . |
|
| 273 | + if ($post_type == 'calendar' && isset($post->ID)) { |
|
| 274 | + echo '<a id="simcal-clear-cache" class="button" data-id="'.$post->ID.' ">'. |
|
| 275 | + '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> '. |
|
| 276 | + __('Clear cache', 'google-calendar-events'). |
|
| 277 | 277 | '</a>'; |
| 278 | 278 | } |
| 279 | 279 | } |
@@ -290,20 +290,20 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | $post_types = array(); |
| 292 | 292 | |
| 293 | - $settings = get_option( 'simple-calendar_settings_calendars' ); |
|
| 294 | - if ( isset( $settings['general']['attach_calendars_posts'] ) ) { |
|
| 293 | + $settings = get_option('simple-calendar_settings_calendars'); |
|
| 294 | + if (isset($settings['general']['attach_calendars_posts'])) { |
|
| 295 | 295 | $post_types = $settings['general']['attach_calendars_posts']; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | global $post_type; |
| 299 | 299 | |
| 300 | - if ( in_array( $post_type, $post_types ) ) { |
|
| 300 | + if (in_array($post_type, $post_types)) { |
|
| 301 | 301 | |
| 302 | 302 | // Thickbox will ignore height and width, will adjust these in js. |
| 303 | 303 | // @see https://core.trac.wordpress.org/ticket/17249 |
| 304 | 304 | ?> |
| 305 | 305 | <a href="#TB_inline?height=250&width=500&inlineId=simcal-insert-shortcode-panel" id="simcal-insert-shortcode-button" class="thickbox button insert-calendar add_calendar"> |
| 306 | - <span class="wp-media-buttons-icon dashicons-before dashicons-calendar-alt"></span> <?php _e( 'Add Calendar', 'google-calendar-events' ); ?> |
|
| 306 | + <span class="wp-media-buttons-icon dashicons-before dashicons-calendar-alt"></span> <?php _e('Add Calendar', 'google-calendar-events'); ?> |
|
| 307 | 307 | </a> |
| 308 | 308 | <?php |
| 309 | 309 | |
@@ -325,25 +325,25 @@ discard block |
||
| 325 | 325 | ?> |
| 326 | 326 | <div id="simcal-insert-shortcode-panel" style="display:none;"> |
| 327 | 327 | <div class="simcal-insert-shortcode-panel"> |
| 328 | - <h1><?php _e( 'Add Calendar', 'google-calendar-events' ); ?></h1> |
|
| 329 | - <?php _e( 'Add a calendar to your post.', 'google-calendar-events' ); ?> |
|
| 330 | - <?php if ( ! empty( $calendars ) && is_array( $calendars ) ) : ?> |
|
| 328 | + <h1><?php _e('Add Calendar', 'google-calendar-events'); ?></h1> |
|
| 329 | + <?php _e('Add a calendar to your post.', 'google-calendar-events'); ?> |
|
| 330 | + <?php if ( ! empty($calendars) && is_array($calendars)) : ?> |
|
| 331 | 331 | <p> |
| 332 | 332 | <label for="simcal-choose-calendar"> |
| 333 | - <?php $multiselect = count( $calendars ) > 15 ? ' simcal-field-select-enhanced' : ''; ?> |
|
| 333 | + <?php $multiselect = count($calendars) > 15 ? ' simcal-field-select-enhanced' : ''; ?> |
|
| 334 | 334 | <select id="simcal-choose-calendar" |
| 335 | 335 | class="simcal-field simcal-field-select<?php echo $multiselect; ?>" |
| 336 | 336 | name=""> |
| 337 | - <?php foreach ( $calendars as $id => $title ) : ?> |
|
| 337 | + <?php foreach ($calendars as $id => $title) : ?> |
|
| 338 | 338 | <option value="<?php echo $id ?>"><?php echo $title ?></option> |
| 339 | 339 | <?php endforeach; ?> |
| 340 | 340 | </select> |
| 341 | 341 | </label> |
| 342 | 342 | </p> |
| 343 | - <p><input type="button" value="<?php _e( 'Insert Calendar', 'google-calendar-events' ); ?>" id="simcal-insert-shortcode" class="button button-primary button-large" name="" /></p> |
|
| 343 | + <p><input type="button" value="<?php _e('Insert Calendar', 'google-calendar-events'); ?>" id="simcal-insert-shortcode" class="button button-primary button-large" name="" /></p> |
|
| 344 | 344 | <?php else : ?> |
| 345 | - <p><em><?php _e( 'Could not find any calendars to add to this post.', 'google-calendar-events' ); ?></em></p> |
|
| 346 | - <strong><a href="post-new.php?post_type=calendar"><?php _e( 'Please add and configure new calendar first.', 'google-calendar-events' ); ?></a></strong> |
|
| 345 | + <p><em><?php _e('Could not find any calendars to add to this post.', 'google-calendar-events'); ?></em></p> |
|
| 346 | + <strong><a href="post-new.php?post_type=calendar"><?php _e('Please add and configure new calendar first.', 'google-calendar-events'); ?></a></strong> |
|
| 347 | 347 | <?php endif; ?> |
| 348 | 348 | </div> |
| 349 | 349 | </div> |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | * @param string $_plugin_file Path to the plugin file. |
| 63 | 63 | * @param array $_api_data Optional data to send with API calls. |
| 64 | 64 | */ |
| 65 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
| 65 | + public function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
| 66 | 66 | |
| 67 | - $this->api_url = trailingslashit( $_api_url ); |
|
| 67 | + $this->api_url = trailingslashit($_api_url); |
|
| 68 | 68 | $this->api_data = $_api_data; |
| 69 | - $this->name = plugin_basename( $_plugin_file ); |
|
| 70 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
| 69 | + $this->name = plugin_basename($_plugin_file); |
|
| 70 | + $this->slug = basename($_plugin_file, '.php'); |
|
| 71 | 71 | $this->version = $_api_data['version']; |
| 72 | 72 | |
| 73 | 73 | // Set up hooks. |
| 74 | 74 | $this->init(); |
| 75 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
| 75 | + add_action('admin_init', array($this, 'show_changelog')); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | * @return void |
| 84 | 84 | */ |
| 85 | 85 | public function init() { |
| 86 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 87 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
| 88 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
| 89 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
| 86 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 87 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
| 88 | + remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10); |
|
| 89 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -103,30 +103,30 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return array|\stdClass Modified update array with custom plugin data. |
| 105 | 105 | */ |
| 106 | - public function check_update( $_transient_data ) { |
|
| 106 | + public function check_update($_transient_data) { |
|
| 107 | 107 | |
| 108 | 108 | global $pagenow; |
| 109 | 109 | |
| 110 | - if ( ! is_object( $_transient_data ) ) { |
|
| 110 | + if ( ! is_object($_transient_data)) { |
|
| 111 | 111 | $_transient_data = new \stdClass(); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
| 114 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
| 115 | 115 | return $_transient_data; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
| 118 | + if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) { |
|
| 119 | 119 | |
| 120 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
| 120 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
| 121 | 121 | |
| 122 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
| 122 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
| 123 | 123 | |
| 124 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 125 | - $_transient_data->response[ $this->name ] = $version_info; |
|
| 124 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 125 | + $_transient_data->response[$this->name] = $version_info; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $_transient_data->last_checked = time(); |
| 129 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
| 129 | + $_transient_data->checked[$this->name] = $this->version; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | } |
@@ -144,81 +144,81 @@ discard block |
||
| 144 | 144 | * @param string $file |
| 145 | 145 | * @param array $plugin |
| 146 | 146 | */ |
| 147 | - public function show_update_notification( $file, $plugin ) { |
|
| 147 | + public function show_update_notification($file, $plugin) { |
|
| 148 | 148 | |
| 149 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
| 149 | + if ( ! current_user_can('update_plugins')) { |
|
| 150 | 150 | return; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if ( ! is_multisite() ) { |
|
| 153 | + if ( ! is_multisite()) { |
|
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if ( $this->name != $file ) { |
|
| 157 | + if ($this->name != $file) { |
|
| 158 | 158 | return; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Remove our filter on the site transient |
| 162 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
| 162 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
| 163 | 163 | |
| 164 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
| 164 | + $update_cache = get_site_transient('update_plugins'); |
|
| 165 | 165 | |
| 166 | - if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
| 166 | + if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
| 167 | 167 | |
| 168 | - $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
| 169 | - $version_info = get_transient( $cache_key ); |
|
| 168 | + $cache_key = md5('edd_plugin_'.sanitize_key($this->name).'_version_info'); |
|
| 169 | + $version_info = get_transient($cache_key); |
|
| 170 | 170 | |
| 171 | - if ( false === $version_info ) { |
|
| 171 | + if (false === $version_info) { |
|
| 172 | 172 | |
| 173 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
| 173 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
| 174 | 174 | |
| 175 | - set_transient( $cache_key, $version_info, 3600 ); |
|
| 175 | + set_transient($cache_key, $version_info, 3600); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if ( ! is_object( $version_info ) ) { |
|
| 178 | + if ( ! is_object($version_info)) { |
|
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 183 | - $update_cache->response[ $this->name ] = $version_info; |
|
| 182 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 183 | + $update_cache->response[$this->name] = $version_info; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $update_cache->last_checked = time(); |
| 187 | - $update_cache->checked[ $this->name ] = $this->version; |
|
| 187 | + $update_cache->checked[$this->name] = $this->version; |
|
| 188 | 188 | |
| 189 | - set_site_transient( 'update_plugins', $update_cache ); |
|
| 189 | + set_site_transient('update_plugins', $update_cache); |
|
| 190 | 190 | |
| 191 | 191 | } else { |
| 192 | 192 | |
| 193 | - $version_info = $update_cache->response[ $this->name ]; |
|
| 193 | + $version_info = $update_cache->response[$this->name]; |
|
| 194 | 194 | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // Restore our filter |
| 198 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 198 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 199 | 199 | |
| 200 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 200 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
| 201 | 201 | |
| 202 | 202 | // build a plugin list row, with update notification |
| 203 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
| 204 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
| 203 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
| 204 | + echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">'; |
|
| 205 | 205 | |
| 206 | - $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' ); |
|
| 206 | + $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'); |
|
| 207 | 207 | |
| 208 | - if ( empty( $version_info->download_link ) ) { |
|
| 208 | + if (empty($version_info->download_link)) { |
|
| 209 | 209 | printf( |
| 210 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'google-calendar-events' ), |
|
| 211 | - esc_html( $version_info->name ), |
|
| 212 | - esc_url( $changelog_link ), |
|
| 213 | - esc_html( $version_info->new_version ) |
|
| 210 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'google-calendar-events'), |
|
| 211 | + esc_html($version_info->name), |
|
| 212 | + esc_url($changelog_link), |
|
| 213 | + esc_html($version_info->new_version) |
|
| 214 | 214 | ); |
| 215 | 215 | } else { |
| 216 | 216 | printf( |
| 217 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'google-calendar-events' ), |
|
| 218 | - esc_html( $version_info->name ), |
|
| 219 | - esc_url( $changelog_link ), |
|
| 220 | - esc_html( $version_info->new_version ), |
|
| 221 | - esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
| 217 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'google-calendar-events'), |
|
| 218 | + esc_html($version_info->name), |
|
| 219 | + esc_url($changelog_link), |
|
| 220 | + esc_html($version_info->new_version), |
|
| 221 | + esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)) |
|
| 222 | 222 | ); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -238,13 +238,13 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return object |
| 240 | 240 | */ |
| 241 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
| 241 | + public function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
| 242 | 242 | |
| 243 | - if ( 'plugin_information' != $_action ) { |
|
| 243 | + if ('plugin_information' != $_action) { |
|
| 244 | 244 | return $_data; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
| 247 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
| 248 | 248 | return $_data; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | ), |
| 258 | 258 | ); |
| 259 | 259 | |
| 260 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
| 260 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
| 261 | 261 | |
| 262 | - if ( false !== $api_response ) { |
|
| 262 | + if (false !== $api_response) { |
|
| 263 | 263 | $_data = $api_response; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | * @param string $url |
| 277 | 277 | * @return object|array $array |
| 278 | 278 | */ |
| 279 | - public function http_request_args( $args, $url ) { |
|
| 279 | + public function http_request_args($args, $url) { |
|
| 280 | 280 | // If it is an https request and we are performing a package download, disable ssl verification |
| 281 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
| 281 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
| 282 | 282 | $args['sslverify'] = false; |
| 283 | 283 | } |
| 284 | 284 | return $args; |
@@ -293,42 +293,42 @@ discard block |
||
| 293 | 293 | * @param array $_data Parameters for the API action. |
| 294 | 294 | * @return false|object |
| 295 | 295 | */ |
| 296 | - private function api_request( $_action, $_data ) { |
|
| 296 | + private function api_request($_action, $_data) { |
|
| 297 | 297 | |
| 298 | 298 | global $wp_version; |
| 299 | 299 | |
| 300 | - $data = array_merge( $this->api_data, $_data ); |
|
| 300 | + $data = array_merge($this->api_data, $_data); |
|
| 301 | 301 | |
| 302 | - if ( $data['slug'] != $this->slug ) { |
|
| 302 | + if ($data['slug'] != $this->slug) { |
|
| 303 | 303 | return; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if ( empty( $data['license'] ) ) { |
|
| 306 | + if (empty($data['license'])) { |
|
| 307 | 307 | return; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if ( $this->api_url == home_url() ) { |
|
| 310 | + if ($this->api_url == home_url()) { |
|
| 311 | 311 | return false; // Don't allow a plugin to ping itself |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $api_params = array( |
| 315 | 315 | 'edd_action' => 'get_version', |
| 316 | 316 | 'license' => $data['license'], |
| 317 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 318 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 317 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 318 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 319 | 319 | 'slug' => $data['slug'], |
| 320 | 320 | 'author' => $data['author'], |
| 321 | 321 | 'url' => home_url() |
| 322 | 322 | ); |
| 323 | 323 | |
| 324 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
| 324 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
| 325 | 325 | |
| 326 | - if ( ! is_wp_error( $request ) ) { |
|
| 327 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
| 326 | + if ( ! is_wp_error($request)) { |
|
| 327 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if ( $request && isset( $request->sections ) ) { |
|
| 331 | - $request->sections = maybe_unserialize( $request->sections ); |
|
| 330 | + if ($request && isset($request->sections)) { |
|
| 331 | + $request->sections = maybe_unserialize($request->sections); |
|
| 332 | 332 | } else { |
| 333 | 333 | $request = false; |
| 334 | 334 | } |
@@ -343,26 +343,26 @@ discard block |
||
| 343 | 343 | */ |
| 344 | 344 | public function show_changelog() { |
| 345 | 345 | |
| 346 | - if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
| 346 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
| 347 | 347 | return; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if ( empty( $_REQUEST['plugin'] ) ) { |
|
| 350 | + if (empty($_REQUEST['plugin'])) { |
|
| 351 | 351 | return; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - if ( empty( $_REQUEST['slug'] ) ) { |
|
| 354 | + if (empty($_REQUEST['slug'])) { |
|
| 355 | 355 | return; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
| 359 | - wp_die( __( 'You do not have permission to install plugin updates', 'google-calendar-events' ), __( 'Error', 'google-calendar-events' ), array( 'response' => 403 ) ); |
|
| 358 | + if ( ! current_user_can('update_plugins')) { |
|
| 359 | + wp_die(__('You do not have permission to install plugin updates', 'google-calendar-events'), __('Error', 'google-calendar-events'), array('response' => 403)); |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
| 362 | + $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug'])); |
|
| 363 | 363 | |
| 364 | - if ( $response && isset( $response->sections['changelog'] ) ) { |
|
| 365 | - echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
| 364 | + if ($response && isset($response->sections['changelog'])) { |
|
| 365 | + echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>'; |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | exit; |