Completed
Push — master ( 492b47...187862 )
by
unknown
02:47
created
includes/admin/meta-boxes.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Admin\Metaboxes as Metabox;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 
47
-		$settings = get_option( 'simple-calendar_settings_calendars' );
48
-		if ( isset( $settings['general']['attach_calendars_posts'] ) ) {
47
+		$settings = get_option('simple-calendar_settings_calendars');
48
+		if (isset($settings['general']['attach_calendars_posts'])) {
49 49
 			$this->post_types = $settings['general']['attach_calendars_posts'];
50 50
 		}
51 51
 
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 		new Metabox\Settings();
54 54
 		new Metabox\Attach_Calendar();
55 55
 		new Metabox\Newsletter();
56
-		do_action( 'simcal_load_meta_boxes' );
56
+		do_action('simcal_load_meta_boxes');
57 57
 
58 58
 		// Add meta boxes.
59
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 30 );
59
+		add_action('add_meta_boxes', array($this, 'add_meta_boxes'), 30);
60 60
 
61 61
 		// Process meta boxes.
62
-		add_action( 'simcal_save_settings_meta','\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2 );
63
-		add_action( 'simcal_save_attach_calendar_meta','\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2 );
62
+		add_action('simcal_save_settings_meta', '\SimpleCalendar\Admin\Metaboxes\Settings::save', 10, 2);
63
+		add_action('simcal_save_attach_calendar_meta', '\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::save', 10, 2);
64 64
 
65 65
 		// Save meta boxes data.
66
-		add_action( 'save_post', array( $this, 'save_meta_boxes' ), 1, 2 );
66
+		add_action('save_post', array($this, 'save_meta_boxes'), 1, 2);
67 67
 
68 68
 		// Uncomment this for debugging $_POST while saving a meta box.
69 69
 		// add_action( 'save_post', function() { echo '<pre>'; print_r( $_POST ); echo '</pre>'; die(); } );
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 
79 79
 		add_meta_box(
80 80
 			'simcal-calendar-settings',
81
-			__( 'Calendar Settings', 'google-calendar-events' ),
81
+			__('Calendar Settings', 'google-calendar-events'),
82 82
 			'\SimpleCalendar\Admin\Metaboxes\Settings::html',
83 83
 			'calendar',
84 84
 			'normal',
85 85
 			'core'
86 86
 		);
87 87
 
88
-		$addons = apply_filters( 'simcal_installed_addons', array() );
89
-		if ( empty( $addons ) ) {
88
+		$addons = apply_filters('simcal_installed_addons', array());
89
+		if (empty($addons)) {
90 90
 
91 91
 			add_meta_box(
92 92
 				'simcal-newsletter',
93
-				__( 'Get 20% off all Pro Add-ons', 'google-calendar-events' ),
93
+				__('Get 20% off all Pro Add-ons', 'google-calendar-events'),
94 94
 				'\SimpleCalendar\Admin\Metaboxes\Newsletter::html',
95 95
 				'calendar',
96 96
 				'side',
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 		add_meta_box(
103 103
 			'simcal-get-shortcode',
104
-			__( 'Calendar Shortcode', 'google-calendar-events' ),
104
+			__('Calendar Shortcode', 'google-calendar-events'),
105 105
 			'\SimpleCalendar\Admin\Metaboxes\Get_Shortcode::html',
106 106
 			'calendar',
107 107
 			'side',
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 		);
110 110
 
111 111
 		// Add meta box if there are calendars.
112
-		if ( ( true == simcal_get_calendars() ) && ! empty( $this->post_types ) ) {
113
-			foreach ( $this->post_types as $post_type ) {
112
+		if ((true == simcal_get_calendars()) && ! empty($this->post_types)) {
113
+			foreach ($this->post_types as $post_type) {
114 114
 				add_meta_box(
115 115
 					'simcal-attach-calendar',
116
-					__( 'Attach Calendar', 'google-calendar-events' ),
116
+					__('Attach Calendar', 'google-calendar-events'),
117 117
 					'\SimpleCalendar\Admin\Metaboxes\Attach_Calendar::html',
118 118
 					$post_type,
119 119
 					'side',
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			}
123 123
 		}
124 124
 
125
-		do_action( 'simcal_add_meta_boxes' );
125
+		do_action('simcal_add_meta_boxes');
126 126
 	}
127 127
 
128 128
 	/**
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @return void
137 137
 	 */
138
-	public function save_meta_boxes( $post_id, $post ) {
138
+	public function save_meta_boxes($post_id, $post) {
139 139
 
140 140
 		// $post_id and $post are required.
141
-		if ( empty( $post_id ) || empty( $post ) || self::$saved_meta_boxes ) {
141
+		if (empty($post_id) || empty($post) || self::$saved_meta_boxes) {
142 142
 			return;
143 143
 		}
144 144
 
145 145
 		// Don't save meta boxes for revisions or autosaves.
146
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
146
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
147 147
 			return;
148 148
 		}
149 149
 
150 150
 		// Check the nonce.
151
-		if ( empty( $_POST['simcal_meta_nonce'] ) || ! wp_verify_nonce( $_POST['simcal_meta_nonce'], 'simcal_save_data' ) ) {
151
+		if (empty($_POST['simcal_meta_nonce']) || ! wp_verify_nonce($_POST['simcal_meta_nonce'], 'simcal_save_data')) {
152 152
 			return;
153 153
 		}
154 154
 
155 155
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
156
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
156
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
157 157
 			return;
158 158
 		}
159 159
 
160 160
 		// Check user has permission to edit
161
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
161
+		if ( ! current_user_can('edit_post', $post_id)) {
162 162
 			return;
163 163
 		}
164 164
 
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 		self::$saved_meta_boxes = true;
172 172
 
173 173
 		// Check the post type.
174
-		if ( 'calendar' == $post->post_type ) {
175
-			do_action( 'simcal_save_settings_meta', $post_id, $post );
176
-		} elseif ( in_array( $post->post_type, $this->post_types ) ) {
177
-			do_action( 'simcal_save_attach_calendar_meta', $post_id, $post );
174
+		if ('calendar' == $post->post_type) {
175
+			do_action('simcal_save_settings_meta', $post_id, $post);
176
+		} elseif (in_array($post->post_type, $this->post_types)) {
177
+			do_action('simcal_save_attach_calendar_meta', $post_id, $post);
178 178
 		}
179 179
 
180
-		do_action( 'simcal_save_meta_boxes', $post_id, $post );
180
+		do_action('simcal_save_meta_boxes', $post_id, $post);
181 181
 	}
182 182
 
183 183
 }
Please login to merge, or discard this patch.
includes/admin/fields/license.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 	 *
35 35
 	 * @param array $field
36 36
 	 */
37
-	public function __construct( $field ) {
38
-		$this->addon      = isset( $field['addon'] ) ? esc_attr( $field['addon'] ) : '';
37
+	public function __construct($field) {
38
+		$this->addon      = isset($field['addon']) ? esc_attr($field['addon']) : '';
39 39
 		$this->type_class = 'simcal-field-license';
40
-		parent::__construct( $field );
40
+		parent::__construct($field);
41 41
 	}
42 42
 
43 43
 	/**
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function html() {
49 49
 
50
-		if ( ! empty( $this->addon ) ) {
50
+		if ( ! empty($this->addon)) {
51 51
 
52
-			$status = apply_filters( 'simcal_addon_status_' . $this->addon, simcal_get_license_status( $this->addon ) );
52
+			$status = apply_filters('simcal_addon_status_'.$this->addon, simcal_get_license_status($this->addon));
53 53
 
54
-			if ( $status !== 'valid' ) {
54
+			if ($status !== 'valid') {
55 55
 				$display_activate   = 'display: inline-block';
56 56
 				$display_deactivate = 'display: none';
57 57
 				$active             = 'valid' == $status ? 'display: block' : 'display: none';
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			} else {
60 60
 				$display_activate   = $active = 'display: none';
61 61
 				$display_deactivate = 'display: inline-block';
62
-				$disabled           = empty( $this->value ) ? '' : 'disabled="disabled"';
62
+				$disabled           = empty($this->value) ? '' : 'disabled="disabled"';
63 63
 			}
64 64
 
65 65
 			?>
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
 				<span class="simcal-addon-manage-license-buttons">
75 75
 
76 76
 					<button class="button-secondary simcal-addon-manage-license deactivate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_deactivate; ?>">
77
-				        <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Deactivate', 'google-calendar-events' ); ?>
77
+				        <i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Deactivate', 'google-calendar-events'); ?>
78 78
 					</button>
79 79
 
80 80
 					<button class="button-secondary simcal-addon-manage-license activate" data-add-on="<?php echo $this->addon; ?>" style="<?php echo $display_activate; ?>">
81
-						<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e( 'Activate', 'google-calendar-events' ); ?>
81
+						<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i><?php _e('Activate', 'google-calendar-events'); ?>
82 82
 					</button>
83 83
 
84 84
 					<span class="error" style="color: red; display: none"> </span>
85 85
 
86
-					<strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e( '(active)', 'google-calendar-events' ); ?></strong>
86
+					<strong class="label" style="color:green; <?php echo $active; ?>"> <?php _e('(active)', 'google-calendar-events'); ?></strong>
87 87
 
88 88
 				</span>
89 89
 
Please login to merge, or discard this patch.
includes/admin/fields/checkbox.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit; // Exit if accessed directly.
13 13
 }
14 14
 
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param array $field
30 30
 	 */
31
-	public function __construct( $field ) {
31
+	public function __construct($field) {
32 32
 		$this->type_class = 'simcal-field-checkboxes';
33
-		parent::__construct( $field );
33
+		parent::__construct($field);
34 34
 	}
35 35
 
36 36
 	/**
@@ -40,33 +40,33 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function html() {
42 42
 
43
-		if ( ! empty( $this->options ) && count( (array) $this->options ) > 1 ) {
43
+		if ( ! empty($this->options) && count((array) $this->options) > 1) {
44 44
 
45
-			if ( ! empty( $this->description ) ) {
46
-				echo '<p class="description">' . wp_kses_post( $this->description ) . ' ' . $this->tooltip . '</p>';
45
+			if ( ! empty($this->description)) {
46
+				echo '<p class="description">'.wp_kses_post($this->description).' '.$this->tooltip.'</p>';
47 47
 			}
48 48
 
49 49
 			?>
50
-			<fieldset class="<?php echo $this->class; ?>" <?php echo ! empty( $this->style ) ? 'style="' . $this->style . '"' : ''; ?>>
50
+			<fieldset class="<?php echo $this->class; ?>" <?php echo ! empty($this->style) ? 'style="'.$this->style.'"' : ''; ?>>
51 51
 				<?php
52 52
 
53
-				if ( ! empty( $this->title ) ) {
54
-					echo '<legend class="screen-reader-text"><span>' . $this->title . '</span></legend>';
53
+				if ( ! empty($this->title)) {
54
+					echo '<legend class="screen-reader-text"><span>'.$this->title.'</span></legend>';
55 55
 				}
56 56
 
57 57
 				?>
58 58
 				<ul>
59
-					<?php foreach ( $this->options as $option => $name ) : ?>
59
+					<?php foreach ($this->options as $option => $name) : ?>
60 60
 						<li>
61
-							<label for="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>">
61
+							<label for="<?php echo $this->id.'-'.trim(strval($option)); ?>">
62 62
 								<input name="<?php echo $this->name; ?>"
63
-								       id="<?php echo $this->id . '-' . trim( strval( $option ) ); ?>"
63
+								       id="<?php echo $this->id.'-'.trim(strval($option)); ?>"
64 64
 								       class="simcal-field simcal-field-checkbox"
65 65
 								       type="checkbox"
66
-								       value="<?php echo trim( strval( $option ) ); ?>"
67
-										<?php checked( $this->value, 'yes', true ); ?>
66
+								       value="<?php echo trim(strval($option)); ?>"
67
+										<?php checked($this->value, 'yes', true); ?>
68 68
 									<?php echo $this->attributes; ?>
69
-									/><?php echo esc_attr( $name ); ?>
69
+									/><?php echo esc_attr($name); ?>
70 70
 							</label>
71 71
 						</li>
72 72
 					<?php endforeach; ?>
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 		} else {
78 78
 
79 79
 			?>
80
-			<span class="simcal-field-bool" <?php echo $this->style ? 'style="' . $this->style . '"' : ''; ?>>
81
-				<?php if ( ! empty( $this->title ) ) : ?>
80
+			<span class="simcal-field-bool" <?php echo $this->style ? 'style="'.$this->style.'"' : ''; ?>>
81
+				<?php if ( ! empty($this->title)) : ?>
82 82
 					<span class="screen-reader-text"><?php echo $this->title; ?></span>
83 83
 				<?php endif; ?>
84 84
 				<input name="<?php echo $this->name; ?>"
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 				       id="<?php echo $this->id; ?>"
87 87
 				       class="simcal-field simcal-field-checkbox <?php echo $this->class; ?>"
88 88
 				       value="yes"
89
-					<?php checked( $this->value, 'yes', true ); ?>
90
-					<?php echo $this->attributes; ?>/><?php echo ( ! empty( $this->text ) ? $this->text : __( 'Yes', 'google-calendar-events' ) ); ?>
89
+					<?php checked($this->value, 'yes', true); ?>
90
+					<?php echo $this->attributes; ?>/><?php echo ( ! empty($this->text) ? $this->text : __('Yes', 'google-calendar-events')); ?>
91 91
 			</span>
92 92
 			<?php
93 93
 
94 94
 			echo $this->tooltip;
95 95
 
96
-			if ( ! empty( $this->description ) ) {
97
-				echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
96
+			if ( ! empty($this->description)) {
97
+				echo '<p class="description">'.wp_kses_post($this->description).'</p>';
98 98
 			}
99 99
 
100 100
 		}
Please login to merge, or discard this patch.
includes/admin/menus.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
 
144 144
 			$links = array();
145 145
 			$links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' .
146
-			                           __( 'Add-ons', 'google-calendar-events' ) . '</a>';
146
+									   __( 'Add-ons', 'google-calendar-events' ) . '</a>';
147 147
 
148 148
 			return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) );
149 149
 		}
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 namespace SimpleCalendar\Admin;
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 
45 45
 		self::$main_menu = 'edit.php?post_type=calendar';
46 46
 
47
-		add_action( 'admin_menu', array( __CLASS__, 'add_menu_items' ) );
47
+		add_action('admin_menu', array(__CLASS__, 'add_menu_items'));
48 48
 
49
-		self::$plugin = plugin_basename( SIMPLE_CALENDAR_MAIN_FILE );
49
+		self::$plugin = plugin_basename(SIMPLE_CALENDAR_MAIN_FILE);
50 50
 
51 51
 		new Welcome();
52 52
 
53 53
 		// Links and meta content in plugins page.
54
-		add_filter( 'plugin_action_links_' . self::$plugin, array( __CLASS__, 'plugin_action_links' ), 10, 5 );
55
-		add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
54
+		add_filter('plugin_action_links_'.self::$plugin, array(__CLASS__, 'plugin_action_links'), 10, 5);
55
+		add_filter('plugin_row_meta', array(__CLASS__, 'plugin_row_meta'), 10, 2);
56 56
 		// Custom text in admin footer.
57
-		add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
57
+		add_filter('admin_footer_text', array($this, 'admin_footer_text'), 1);
58 58
 	}
59 59
 
60 60
 	/**
@@ -66,41 +66,41 @@  discard block
 block discarded – undo
66 66
 
67 67
 		add_submenu_page(
68 68
 			self::$main_menu,
69
-			__( 'Settings', 'google-calendar-events' ),
70
-			__( 'Settings', 'google-calendar-events' ),
69
+			__('Settings', 'google-calendar-events'),
70
+			__('Settings', 'google-calendar-events'),
71 71
 			'manage_options',
72 72
 			'simple-calendar_settings',
73
-			function () {
74
-				$page = new Pages( 'settings' );
73
+			function() {
74
+				$page = new Pages('settings');
75 75
 				$page->html();
76 76
 			}
77 77
 		);
78 78
 
79 79
 		add_submenu_page(
80 80
 			self::$main_menu,
81
-			__( 'Add-ons', 'google-calendar-events' ),
82
-			__( 'Add-ons', 'google-calendar-events' ),
81
+			__('Add-ons', 'google-calendar-events'),
82
+			__('Add-ons', 'google-calendar-events'),
83 83
 			'manage_options',
84 84
 			'simple-calendar_add_ons',
85 85
 			function() {
86
-				$page = new Pages( 'add-ons' );
86
+				$page = new Pages('add-ons');
87 87
 				$page->html();
88 88
 			}
89 89
 		);
90 90
 
91 91
 		add_submenu_page(
92 92
 			self::$main_menu,
93
-			__( 'Tools', 'google-calendar-events' ),
94
-			__( 'Tools', 'google-calendar-events' ),
93
+			__('Tools', 'google-calendar-events'),
94
+			__('Tools', 'google-calendar-events'),
95 95
 			'manage_options',
96 96
 			'simple-calendar_tools',
97
-			function () {
98
-				$page = new Pages( 'tools' );
97
+			function() {
98
+				$page = new Pages('tools');
99 99
 				$page->html();
100 100
 			}
101 101
 		);
102 102
 
103
-		do_action( 'simcal_admin_add_menu_items' );
103
+		do_action('simcal_admin_add_menu_items');
104 104
 	}
105 105
 
106 106
 	/**
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return array
115 115
 	 */
116
-	public static function plugin_action_links( $action_links, $file ) {
116
+	public static function plugin_action_links($action_links, $file) {
117 117
 
118
-		if ( self::$plugin == $file ) {
118
+		if (self::$plugin == $file) {
119 119
 
120 120
 			$links = array();
121
-			$links['settings']  = '<a href="' . admin_url( 'edit.php?post_type=calendar&page=simple-calendar_settings' ) . '">' . __( 'Settings', 'google-calendar-events' ) . '</a>';
122
-			$links['feeds']     = '<a href="' . admin_url( 'edit.php?post_type=calendar' ) . '">' . __( 'Calendars', 'google-calendar-events' ) . '</a>';
121
+			$links['settings']  = '<a href="'.admin_url('edit.php?post_type=calendar&page=simple-calendar_settings').'">'.__('Settings', 'google-calendar-events').'</a>';
122
+			$links['feeds']     = '<a href="'.admin_url('edit.php?post_type=calendar').'">'.__('Calendars', 'google-calendar-events').'</a>';
123 123
 
124
-			return apply_filters( 'simcal_plugin_action_links', array_merge( $links, $action_links ) );
124
+			return apply_filters('simcal_plugin_action_links', array_merge($links, $action_links));
125 125
 		}
126 126
 
127 127
 		return $action_links;
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return array
139 139
 	 */
140
-	public static function plugin_row_meta( $meta_links, $file ) {
140
+	public static function plugin_row_meta($meta_links, $file) {
141 141
 
142
-		if ( self::$plugin == $file ) {
142
+		if (self::$plugin == $file) {
143 143
 
144 144
 			$links = array();
145
-			$links['add-ons'] = '<a href="' . simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'plugin-listing' ) . '" target="_blank" >' .
146
-			                           __( 'Add-ons', 'google-calendar-events' ) . '</a>';
145
+			$links['add-ons'] = '<a href="'.simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'plugin-listing').'" target="_blank" >'.
146
+			                           __('Add-ons', 'google-calendar-events').'</a>';
147 147
 
148
-			return apply_filters( 'simcal_plugin_action_links', array_merge( $meta_links, $links ) );
148
+			return apply_filters('simcal_plugin_action_links', array_merge($meta_links, $links));
149 149
 		}
150 150
 
151 151
 		return $meta_links;
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @return string|void
164 164
 	 */
165
-	public function admin_footer_text( $footer_text ) {
165
+	public function admin_footer_text($footer_text) {
166 166
 
167 167
 		// Check to make sure we're on a SimpleCal admin page
168 168
 		$screen = simcal_is_admin_screen();
169
-		if ( $screen !== false ) {
169
+		if ($screen !== false) {
170 170
 
171
-			if ( 'calendar' == $screen ) {
171
+			if ('calendar' == $screen) {
172 172
 
173 173
 				// Add Drip promo signup form (@see Newsletter meta box).
174 174
 
@@ -196,23 +196,23 @@  discard block
 block discarded – undo
196 196
 			}
197 197
 
198 198
 			// Change the footer text
199
-			if ( ! get_option( 'simple-calendar_admin_footer_text_rated' ) ) {
199
+			if ( ! get_option('simple-calendar_admin_footer_text_rated')) {
200 200
 
201 201
 				$footer_text = sprintf(
202
-					__( 'If you like <strong>Simple Calendar</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733; rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events' ),
203
-					'<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="' . esc_attr__( 'Thanks :)', 'google-calendar-events' ) . '">', '</a>'
202
+					__('If you like <strong>Simple Calendar</strong> please leave us a %s&#9733;&#9733;&#9733;&#9733;&#9733; rating on WordPress.org%s. A huge thank you in advance!', 'google-calendar-events'),
203
+					'<a href="https://wordpress.org/support/view/plugin-reviews/google-calendar-events?filter=5#postform" target="_blank" class="simcal-rating-link" data-rated="'.esc_attr__('Thanks :)', 'google-calendar-events').'">', '</a>'
204 204
 				);
205 205
 
206 206
 				$footer_text .= '<script type="text/javascript">';
207 207
 				$footer_text .= "jQuery( 'a.simcal-rating-link' ).click( function() {
208
-						jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url() . "', { action: 'simcal_rated' } );
208
+						jQuery.post( '" . \SimpleCalendar\plugin()->ajax_url()."', { action: 'simcal_rated' } );
209 209
 						jQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );
210 210
 					});";
211 211
 				$footer_text .= '</script>';
212 212
 
213 213
 			} else {
214 214
 
215
-				$footer_text = __( 'Thanks for using Simple Calendar!', 'google-calendar-events' );
215
+				$footer_text = __('Thanks for using Simple Calendar!', 'google-calendar-events');
216 216
 
217 217
 			}
218 218
 
Please login to merge, or discard this patch.
includes/admin/ajax.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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,19 +25,19 @@  discard block
 block discarded – undo
25 25
 	public function __construct() {
26 26
 
27 27
 		// Set an option if the user rated the plugin.
28
-		add_action( 'wp_ajax_simcal_rated', array( $this, 'rate_plugin' ) );
28
+		add_action('wp_ajax_simcal_rated', array($this, 'rate_plugin'));
29 29
 
30 30
 		// Set an option if the user rated the plugin.
31
-		add_action( 'wp_ajax_simcal_clear_cache', array( $this, 'clear_cache' ) );
31
+		add_action('wp_ajax_simcal_clear_cache', array($this, 'clear_cache'));
32 32
 
33 33
 		// Convert a datetime format.
34
-		add_action( 'wp_ajax_simcal_date_i18n_input_preview', array( $this, 'date_i18n' ) );
34
+		add_action('wp_ajax_simcal_date_i18n_input_preview', array($this, 'date_i18n'));
35 35
 
36 36
 		// Manage an add-on license activation or deactivation.
37
-		add_action( 'wp_ajax_simcal_manage_add_on_license', array( $this, 'manage_add_on_license' ) );
37
+		add_action('wp_ajax_simcal_manage_add_on_license', array($this, 'manage_add_on_license'));
38 38
 
39 39
 		// Reset add-ons licenses.
40
-		add_action( 'wp_ajax_simcal_reset_add_ons_licenses', array( $this, 'reset_licenses' ) );
40
+		add_action('wp_ajax_simcal_reset_add_ons_licenses', array($this, 'reset_licenses'));
41 41
 
42 42
 	}
43 43
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function clear_cache() {
50 50
 
51
-		$id = isset( $_POST['id'] ) ? ( is_array( $_POST['id'] ) ? array_map( 'intval', $_POST['id'] ) : intval( $_POST['id'] ) ) : '';
51
+		$id = isset($_POST['id']) ? (is_array($_POST['id']) ? array_map('intval', $_POST['id']) : intval($_POST['id'])) : '';
52 52
 
53
-		if ( ! empty( $id ) ) {
54
-			simcal_delete_feed_transients( $id );
53
+		if ( ! empty($id)) {
54
+			simcal_delete_feed_transients($id);
55 55
 		}
56 56
 	}
57 57
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @since 3.0.0
62 62
 	 */
63 63
 	public function rate_plugin() {
64
-		update_option( 'simple-calendar_admin_footer_text_rated', date( 'Y-m-d', time() ) );
64
+		update_option('simple-calendar_admin_footer_text_rated', date('Y-m-d', time()));
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function date_i18n() {
73 73
 
74
-		$value     = isset( $_POST['value'] ) ? esc_attr( $_POST['value'] ) : ' ';
75
-		$timestamp = isset( $_POST['timestamp'] ) ? absint( $_POST['timestamp'] ) : time();
74
+		$value     = isset($_POST['value']) ? esc_attr($_POST['value']) : ' ';
75
+		$timestamp = isset($_POST['timestamp']) ? absint($_POST['timestamp']) : time();
76 76
 
77
-		wp_send_json_success( date_i18n( $value, $timestamp ) );
77
+		wp_send_json_success(date_i18n($value, $timestamp));
78 78
 	}
79 79
 
80 80
 	/**
@@ -86,35 +86,35 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function manage_add_on_license() {
88 88
 
89
-		$addon  = isset( $_POST['add_on'] )         ? sanitize_key( $_POST['add_on'] ) : false;
90
-		$action = isset( $_POST['license_action'] ) ? esc_attr( $_POST['license_action'] ) : false;
91
-		$key    = isset( $_POST['license_key'] )    ? esc_attr( $_POST['license_key'] ) : '';
92
-		$nonce  = isset( $_POST['nonce'] )          ? esc_attr( $_POST['nonce'] ) : '';
89
+		$addon  = isset($_POST['add_on']) ? sanitize_key($_POST['add_on']) : false;
90
+		$action = isset($_POST['license_action']) ? esc_attr($_POST['license_action']) : false;
91
+		$key    = isset($_POST['license_key']) ? esc_attr($_POST['license_key']) : '';
92
+		$nonce  = isset($_POST['nonce']) ? esc_attr($_POST['nonce']) : '';
93 93
 
94 94
 		// Verify that there are valid variables to process.
95
-		if ( false === $addon || ! in_array( $action, array( 'activate_license', 'deactivate_license' ) ) ) {
96
-			wp_send_json_error( __( 'Add-on unspecified or invalid action.', 'google-calendar-events' ) );
95
+		if (false === $addon || ! in_array($action, array('activate_license', 'deactivate_license'))) {
96
+			wp_send_json_error(__('Add-on unspecified or invalid action.', 'google-calendar-events'));
97 97
 		}
98 98
 
99 99
 		// Verify this request comes from the add-ons licenses activation settings page.
100
-		if ( ! wp_verify_nonce( $nonce, 'simcal_license_manager' ) ) {
101
-			wp_send_json_error( sprintf( __( 'An error occurred: %s', 'google-calendar-events' ), 'Nonce verification failed.' ) );
100
+		if ( ! wp_verify_nonce($nonce, 'simcal_license_manager')) {
101
+			wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
102 102
 		}
103 103
 
104 104
 		// Removes the prefix and converts simcal_{id_no} to {id_no}.
105
-		$id = intval( substr( $addon, 7 ) );
105
+		$id = intval(substr($addon, 7));
106 106
 
107 107
 		// Data to send in API request.
108 108
 		$api_request = array(
109 109
 			'edd_action' => $action,
110 110
 			'license'    => $key,
111
-			'item_id'    => urlencode( $id ),
111
+			'item_id'    => urlencode($id),
112 112
 			'url'        => home_url()
113 113
 		);
114 114
 
115 115
 		// Call the custom API.
116 116
 		$response = wp_remote_post(
117
-			defined( 'SIMPLE_CALENDAR_STORE_URL' ) ? SIMPLE_CALENDAR_STORE_URL : simcal_get_url( 'home' ),
117
+			defined('SIMPLE_CALENDAR_STORE_URL') ? SIMPLE_CALENDAR_STORE_URL : simcal_get_url('home'),
118 118
 			array(
119 119
 				'timeout' => 15,
120 120
 				'sslverify' => false,
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
 		);
124 124
 
125 125
 		// Update license in db.
126
-		$keys = get_option( 'simple-calendar_settings_licenses', array() );
127
-		$keys['keys'][ $addon ] = $key;
128
-		update_option( 'simple-calendar_settings_licenses', $keys );
126
+		$keys = get_option('simple-calendar_settings_licenses', array());
127
+		$keys['keys'][$addon] = $key;
128
+		update_option('simple-calendar_settings_licenses', $keys);
129 129
 
130 130
 		// Make sure there is a response.
131
-		if ( is_wp_error( $response ) ) {
132
-			wp_send_json_error( sprintf( __( 'There was an error processing your request: %s', 'google-calendar-events' ), $response->get_error_message() ) );
131
+		if (is_wp_error($response)) {
132
+			wp_send_json_error(sprintf(__('There was an error processing your request: %s', 'google-calendar-events'), $response->get_error_message()));
133 133
 		}
134 134
 
135 135
 		// Decode the license data and save.
136
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
136
+		$license_data = json_decode(wp_remote_retrieve_body($response));
137 137
 		$status = simcal_get_license_status();
138 138
 
139
-		if ( ! empty( $license_data ) ) {
139
+		if ( ! empty($license_data)) {
140 140
 			if ('deactivated' == $license_data->license) {
141 141
 				unset($status[$addon]);
142 142
 				update_option('simple-calendar_licenses_status', $status);
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 				$message = 'valid' == $license_data->license ? 'valid' : __('License key is invalid.', 'google-calendar-events');
148 148
 				wp_send_json_success($message);
149 149
 			} else {
150
-				wp_send_json_error( '' );
150
+				wp_send_json_error('');
151 151
 			}
152 152
 		} else {
153
-			wp_send_json_error( __( 'An error has occurred, please try again.', 'google-calendar-events' ) );
153
+			wp_send_json_error(__('An error has occurred, please try again.', 'google-calendar-events'));
154 154
 		}
155 155
 	}
156 156
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	public function reset_licenses() {
163 163
 
164
-		$nonce  = isset( $_POST['nonce'] ) ? esc_attr( $_POST['nonce'] ) : '';
164
+		$nonce = isset($_POST['nonce']) ? esc_attr($_POST['nonce']) : '';
165 165
 
166 166
 		// Verify this request comes from the add-ons licenses activation settings page.
167
-		if ( empty ( $nonce ) || ! wp_verify_nonce( $nonce, 'simcal_license_manager' ) ) {
168
-			wp_send_json_error( sprintf( __( 'An error occurred: %s', 'google-calendar-events' ), 'Nonce verification failed.' ) );
167
+		if (empty ($nonce) || ! wp_verify_nonce($nonce, 'simcal_license_manager')) {
168
+			wp_send_json_error(sprintf(__('An error occurred: %s', 'google-calendar-events'), 'Nonce verification failed.'));
169 169
 		}
170 170
 
171
-		delete_option( 'simple-calendar_settings_licenses' );
172
-		delete_option( 'simple-calendar_licenses_status' );
171
+		delete_option('simple-calendar_settings_licenses');
172
+		delete_option('simple-calendar_licenses_status');
173 173
 
174
-		wp_send_json_success( 'success' );
174
+		wp_send_json_success('success');
175 175
 	}
176 176
 
177 177
 }
Please login to merge, or discard this patch.
includes/admin/pages/advanced.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	public function __construct() {
30 30
 		$this->id           = 'advanced';
31 31
 		$this->option_group = 'settings';
32
-		$this->label        = __( 'Advanced', 'google-calendar-events' );
32
+		$this->label        = __('Advanced', 'google-calendar-events');
33 33
 		//$this->description  = __( 'Advanced settings.', 'google-calendar-events' );
34 34
 		$this->sections     = $this->add_sections();
35 35
 		$this->fields       = $this->add_fields();
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 	 * @return array
44 44
 	 */
45 45
 	public function add_sections() {
46
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', array(
46
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_sections', array(
47 47
 			'assets' => array(
48
-				'title'       => __( 'Styles', 'google-calendar-events' ),
49
-				'description' => __( 'Manage front end assets that handle the calendars appearance.', 'google-calendar-events' )
48
+				'title'       => __('Styles', 'google-calendar-events'),
49
+				'description' => __('Manage front end assets that handle the calendars appearance.', 'google-calendar-events')
50 50
 			),
51 51
 			'installation' => array(
52
-				'title'       => __( 'Installation', 'google-calendar-events' ),
53
-				'description' => __( 'Manage your data (plugin settings and saved calendars).', 'google-calendar-events' )
52
+				'title'       => __('Installation', 'google-calendar-events'),
53
+				'description' => __('Manage your data (plugin settings and saved calendars).', 'google-calendar-events')
54 54
 			)
55
-		) );
55
+		));
56 56
 	}
57 57
 
58 58
 	/**
@@ -65,41 +65,41 @@  discard block
 block discarded – undo
65 65
 	public function add_fields() {
66 66
 
67 67
 		$fields       = array();
68
-		$this->values = get_option( 'simple-calendar_' . $this->option_group . '_' . $this->id );
68
+		$this->values = get_option('simple-calendar_'.$this->option_group.'_'.$this->id);
69 69
 
70
-		foreach ( $this->sections  as $section => $a ) :
70
+		foreach ($this->sections  as $section => $a) :
71 71
 
72
-			if ( 'assets' == $section ) {
72
+			if ('assets' == $section) {
73 73
 
74
-				$fields[ $section ] = array(
74
+				$fields[$section] = array(
75 75
 					'disable_css' => array(
76
-						'title'   => __( 'Disable CSS', 'google-calendar-events' ),
77
-						'tooltip' => __( 'If ticked, this option will prevent all front end stylesheets to load. This also includes all add-on stylesheets.', 'google-calendar-events' ),
76
+						'title'   => __('Disable CSS', 'google-calendar-events'),
77
+						'tooltip' => __('If ticked, this option will prevent all front end stylesheets to load. This also includes all add-on stylesheets.', 'google-calendar-events'),
78 78
 						'type'    => 'checkbox',
79
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][disable_css]',
80
-						'id'      => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-disable-css',
81
-						'value'   => $this->get_option_value( $section, 'disable_css' )
79
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][disable_css]',
80
+						'id'      => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-disable-css',
81
+						'value'   => $this->get_option_value($section, 'disable_css')
82 82
 					),
83 83
 				);
84 84
 
85
-			} elseif ( 'installation' == $section ) {
85
+			} elseif ('installation' == $section) {
86 86
 
87
-				$fields[ $section ] = array(
87
+				$fields[$section] = array(
88 88
 					'delete_settings' => array(
89
-						'title'   => __( 'Delete settings', 'google-calendar-events' ),
90
-						'tooltip' => __( 'Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events' ),
89
+						'title'   => __('Delete settings', 'google-calendar-events'),
90
+						'tooltip' => __('Tick this option if you want to wipe this plugin settings from database when uninstalling.', 'google-calendar-events'),
91 91
 						'type'    => 'checkbox',
92
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][delete_settings]',
93
-						'id'      => 'simple-calendar-' . $this->option_group . '-' . $this->id . '-' . $section . '-delete-settings',
94
-						'value'   => $this->get_option_value( $section, 'delete_settings' ),
92
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][delete_settings]',
93
+						'id'      => 'simple-calendar-'.$this->option_group.'-'.$this->id.'-'.$section.'-delete-settings',
94
+						'value'   => $this->get_option_value($section, 'delete_settings'),
95 95
 					),
96 96
 					'erase_data' => array(
97
-						'title'   => __( 'Erase calendar data', 'google-calendar-events' ),
98
-						'tooltip' => __( 'By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events' ),
97
+						'title'   => __('Erase calendar data', 'google-calendar-events'),
98
+						'tooltip' => __('By default your data will be retained in database even after uninstall. Tick this option if you want to delete all your calendar data when uninstalling.', 'google-calendar-events'),
99 99
 						'type'    => 'checkbox',
100
-						'name'    => 'simple-calendar_' . $this->option_group . '_' . $this->id . '[' . $section . '][erase_data]',
101
-						'id'      => 'simple-calendar_' . $this->option_group . '_' . $this->id . '-delete-data',
102
-						'value'   => $this->get_option_value( $section, 'erase_data' ),
100
+						'name'    => 'simple-calendar_'.$this->option_group.'_'.$this->id.'['.$section.'][erase_data]',
101
+						'id'      => 'simple-calendar_'.$this->option_group.'_'.$this->id.'-delete-data',
102
+						'value'   => $this->get_option_value($section, 'erase_data'),
103 103
 					)
104 104
 				);
105 105
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 		endforeach;
109 109
 
110
-		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id . '_fields', $fields );
110
+		return apply_filters('simcal_add_'.$this->option_group.'_'.$this->id.'_fields', $fields);
111 111
 	}
112 112
 
113 113
 }
Please login to merge, or discard this patch.
includes/admin/pages/add-ons.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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( 'addons' ), 'core-plugin', 'plugin-submenu-link', true ) . '"';
53
+		$js_redirect .= 'window.location = "'.simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'plugin-submenu-link', true).'"';
54 54
 		$js_redirect .= '</script>';
55 55
 
56 56
 		echo $js_redirect;
Please login to merge, or discard this patch.
includes/admin/metaboxes/attach-calendar.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use SimpleCalendar\Abstracts\Meta_Box;
10 10
 
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -28,38 +28,38 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param \WP_Post $post
30 30
 	 */
31
-	public static function html( $post ) {
31
+	public static function html($post) {
32 32
 
33 33
 		// @see Meta_Boxes::save_meta_boxes()
34
-		wp_nonce_field( 'simcal_save_data', 'simcal_meta_nonce' );
34
+		wp_nonce_field('simcal_save_data', 'simcal_meta_nonce');
35 35
 
36 36
 		$calendars = simcal_get_calendars();
37 37
 
38
-		simcal_print_field( array(
38
+		simcal_print_field(array(
39 39
 			'type'       => 'select',
40 40
 			'id'         => '_simcal_attach_calendar_id',
41 41
 			'name'       => '_simcal_attach_calendar_id',
42
-			'enhanced'   => count( $calendars ) > 15 ? 'enhanced' : '',
42
+			'enhanced'   => count($calendars) > 15 ? 'enhanced' : '',
43 43
 			'allow_void' => 'allow_void',
44
-			'value'      => absint( get_post_meta( $post->ID, '_simcal_attach_calendar_id', true ) ),
44
+			'value'      => absint(get_post_meta($post->ID, '_simcal_attach_calendar_id', true)),
45 45
 			'options'    => $calendars,
46 46
 			'attributes' => array(
47 47
 				'data-allowclear' => 'true',
48 48
 			)
49
-		) );
49
+		));
50 50
 
51
-		$position = get_post_meta( $post->ID, '_simcal_attach_calendar_position', true );
51
+		$position = get_post_meta($post->ID, '_simcal_attach_calendar_position', true);
52 52
 
53
-		simcal_print_field( array(
53
+		simcal_print_field(array(
54 54
 			'type'      => 'radio',
55 55
 			'id'        => '_simcal_attach_calendar_position',
56 56
 			'name'      => '_simcal_attach_calendar_position',
57 57
 			'value'     => $position ? $position : 'after',
58 58
 			'options'   => array(
59
-				'after'  => __( 'After Content', 'google-calendar-events' ),
60
-				'before' => __( 'Before Content', 'google-calendar-events' ),
59
+				'after'  => __('After Content', 'google-calendar-events'),
60
+				'before' => __('Before Content', 'google-calendar-events'),
61 61
 			),
62
-		) );
62
+		));
63 63
 
64 64
 	}
65 65
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 	 * @param int      $post_id
72 72
 	 * @param \WP_Post $post
73 73
 	 */
74
-	public static function save( $post_id, $post ) {
74
+	public static function save($post_id, $post) {
75 75
 
76
-		$id = isset( $_POST['_simcal_attach_calendar_id'] ) ? absint( $_POST['_simcal_attach_calendar_id'] ) : '';
77
-		update_post_meta( $post_id, '_simcal_attach_calendar_id', $id );
76
+		$id = isset($_POST['_simcal_attach_calendar_id']) ? absint($_POST['_simcal_attach_calendar_id']) : '';
77
+		update_post_meta($post_id, '_simcal_attach_calendar_id', $id);
78 78
 
79
-		$position = isset( $_POST['_simcal_attach_calendar_position'] ) ? sanitize_title( $_POST['_simcal_attach_calendar_position'] ) : 'after';
80
-		update_post_meta( $post_id, '_simcal_attach_calendar_position', $position );
79
+		$position = isset($_POST['_simcal_attach_calendar_position']) ? sanitize_title($_POST['_simcal_attach_calendar_position']) : 'after';
80
+		update_post_meta($post_id, '_simcal_attach_calendar_position', $position);
81 81
 
82 82
 	}
83 83
 
Please login to merge, or discard this patch.
includes/functions/admin.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @package SimpleCalendar/Admin/Functions
8 8
  */
9 9
 
10
-if ( ! defined( 'ABSPATH' ) ) {
10
+if ( ! defined('ABSPATH')) {
11 11
 	exit;
12 12
 }
13 13
 
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return null|\SimpleCalendar\Abstracts\Admin_Page
34 34
  */
35
-function simcal_get_admin_page( $page ) {
35
+function simcal_get_admin_page($page) {
36 36
 	$objects = \SimpleCalendar\plugin()->objects;
37
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page( $page ) : null;
37
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_admin_page($page) : null;
38 38
 }
39 39
 
40 40
 /**
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
  *
48 48
  * @return null|\SimpleCalendar\Abstracts\Field
49 49
  */
50
-function simcal_get_field( $args, $name = '' ) {
50
+function simcal_get_field($args, $name = '') {
51 51
 	$objects = \SimpleCalendar\plugin()->objects;
52
-	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field( $args, $name ) : null;
52
+	return $objects instanceof \SimpleCalendar\Objects ? $objects->get_field($args, $name) : null;
53 53
 }
54 54
 
55 55
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return void
64 64
  */
65
-function simcal_print_field( $args, $name = '' ) {
65
+function simcal_print_field($args, $name = '') {
66 66
 
67
-	$field = simcal_get_field( $args, $name );
67
+	$field = simcal_get_field($args, $name);
68 68
 
69
-	if ( $field instanceof \SimpleCalendar\Abstracts\Field ) {
69
+	if ($field instanceof \SimpleCalendar\Abstracts\Field) {
70 70
 		$field->html();
71 71
 	}
72 72
 }
@@ -84,33 +84,33 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return array|string Sanitized variable
86 86
  */
87
-function simcal_sanitize_input( $var, $func = 'sanitize_text_field'  ) {
87
+function simcal_sanitize_input($var, $func = 'sanitize_text_field') {
88 88
 
89
-	if ( is_null( $var ) ) {
89
+	if (is_null($var)) {
90 90
 		return '';
91 91
 	}
92 92
 
93
-	if ( is_bool( $var ) ) {
94
-		if ( $var === true ) {
93
+	if (is_bool($var)) {
94
+		if ($var === true) {
95 95
 			return 'yes';
96 96
 		} else {
97 97
 			return 'no';
98 98
 		}
99 99
 	}
100 100
 
101
-	if ( is_string( $var ) || is_numeric( $var ) ) {
102
-		$func = is_string( $func ) && function_exists( $func ) ? $func : 'sanitize_text_field';
103
-		return call_user_func( $func, trim( strval( $var ) ) );
101
+	if (is_string($var) || is_numeric($var)) {
102
+		$func = is_string($func) && function_exists($func) ? $func : 'sanitize_text_field';
103
+		return call_user_func($func, trim(strval($var)));
104 104
 	}
105 105
 
106
-	if ( is_object( $var ) ) {
106
+	if (is_object($var)) {
107 107
 		$var = (array) $var;
108 108
 	}
109 109
 
110
-	if ( is_array( $var ) ) {
110
+	if (is_array($var)) {
111 111
 		$array = array();
112
-		foreach ( $var as $k => $v ) {
113
-			$array[ $k ] = simcal_sanitize_input( $v );
112
+		foreach ($var as $k => $v) {
113
+			$array[$k] = simcal_sanitize_input($v);
114 114
 		}
115 115
 		return $array;
116 116
 	}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
  */
129 129
 function simcal_is_admin_screen() {
130 130
 
131
-	$view = function_exists( 'get_current_screen' ) ? get_current_screen() : false;
131
+	$view = function_exists('get_current_screen') ? get_current_screen() : false;
132 132
 
133
-	if ( $view instanceof WP_Screen ) {
133
+	if ($view instanceof WP_Screen) {
134 134
 
135 135
 		// Screens used by this plugin.
136 136
 		$screens = array(
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'dashboard_page_simple-calendar_credits',
146 146
 			'dashboard_page_simple-calendar_translators',
147 147
 		);
148
-		if ( in_array( $view->id, $screens ) ) {
148
+		if (in_array($view->id, $screens)) {
149 149
 			return $view->id;
150 150
 		}
151 151
 	}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @return \SimpleCalendar\Admin\Updater
166 166
  */
167
-function simcal_addon_updater( $_api_url, $_plugin_file, $_api_data = null ) {
168
-	return new \SimpleCalendar\Admin\Updater( $_api_url, $_plugin_file, $_api_data );
167
+function simcal_addon_updater($_api_url, $_plugin_file, $_api_data = null) {
168
+	return new \SimpleCalendar\Admin\Updater($_api_url, $_plugin_file, $_api_data);
169 169
 }
170 170
 
171 171
 /**
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return null|string
179 179
  */
180
-function simcal_get_license_key( $addon ) {
181
-	$licenses = get_option( 'simple-calendar_settings_licenses', array() );
182
-	if ( isset( $licenses['keys'][ $addon ] ) ) {
183
-		return empty( $licenses['keys'][ $addon ] ) ? null : $licenses['keys'][ $addon ];
180
+function simcal_get_license_key($addon) {
181
+	$licenses = get_option('simple-calendar_settings_licenses', array());
182
+	if (isset($licenses['keys'][$addon])) {
183
+		return empty($licenses['keys'][$addon]) ? null : $licenses['keys'][$addon];
184 184
 	}
185 185
 	return null;
186 186
 }
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return array|string
198 198
  */
199
-function simcal_get_license_status( $addon = null ) {
200
-	$licenses = get_option( 'simple-calendar_licenses_status', array() );
201
-	return isset( $licenses[ $addon ] ) ? $licenses[ $addon ] : $licenses;
199
+function simcal_get_license_status($addon = null) {
200
+	$licenses = get_option('simple-calendar_licenses_status', array());
201
+	return isset($licenses[$addon]) ? $licenses[$addon] : $licenses;
202 202
 }
203 203
 
204 204
 /**
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  * @since 3.0.0
220 220
  */
221 221
 function simcal_delete_admin_notices() {
222
-	delete_option( 'simple-calendar_admin_notices' );
222
+	delete_option('simple-calendar_admin_notices');
223 223
 }
224 224
 
225 225
 /**
@@ -231,22 +231,22 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return void
233 233
  */
234
-function simcal_print_shortcode_tip( $post_id ) {
234
+function simcal_print_shortcode_tip($post_id) {
235 235
 
236 236
 	$browser = new \SimpleCalendar\Browser();
237
-	if ( $browser::PLATFORM_APPLE == $browser->getPlatform() ) {
237
+	if ($browser::PLATFORM_APPLE == $browser->getPlatform()) {
238 238
 		$cmd = '&#8984;&#43;C';
239 239
 	} else {
240 240
 		$cmd = 'Ctrl&#43;C';
241 241
 	}
242 242
 
243
-	$shortcut  = sprintf( __( 'Press %s to copy.', 'google-calendar-events' ), $cmd );
244
-	$shortcode = sprintf( '[calendar id="%s"]', $post_id );
243
+	$shortcut  = sprintf(__('Press %s to copy.', 'google-calendar-events'), $cmd);
244
+	$shortcode = sprintf('[calendar id="%s"]', $post_id);
245 245
 
246
-	echo "<input readonly='readonly' " .
247
-				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' " .
248
-				"title='" . $shortcut . "' " .
249
-				"onclick='this.select();' value='" . $shortcode . "' />";
246
+	echo "<input readonly='readonly' ".
247
+				"class='simcal-shortcode simcal-calendar-shortcode simcal-shortcode-tip' ".
248
+				"title='".$shortcut."' ".
249
+				"onclick='this.select();' value='".$shortcode."' />";
250 250
 }
251 251
 
252 252
 /**
@@ -261,20 +261,20 @@  discard block
 block discarded – undo
261 261
  *
262 262
  * @return  string  $url        Full Google Analytics campaign URL
263 263
  */
264
-function simcal_ga_campaign_url( $base_url, $campaign, $content, $raw = false ) {
264
+function simcal_ga_campaign_url($base_url, $campaign, $content, $raw = false) {
265 265
 
266
-	$url = add_query_arg( array(
266
+	$url = add_query_arg(array(
267 267
 		'utm_source'   => 'inside-plugin',
268 268
 		'utm_medium'   => 'link',
269 269
 		'utm_campaign' => $campaign, // i.e. 'core-plugin', 'gcal-pro'
270 270
 		'utm_content'  => $content // i.e. 'sidebar-link', 'settings-link'
271
-	), $base_url );
271
+	), $base_url);
272 272
 
273
-	if ( $raw ) {
274
-		return esc_url_raw( $url );
273
+	if ($raw) {
274
+		return esc_url_raw($url);
275 275
 	}
276 276
 
277
-	return esc_url( $url );
277
+	return esc_url($url);
278 278
 }
279 279
 
280 280
 /**
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
  */
287 287
 function simcal_newsletter_signup() {
288 288
 
289
-	if ( $screen = simcal_is_admin_screen() ) {
289
+	if ($screen = simcal_is_admin_screen()) {
290 290
 
291 291
 		global $current_user;
292 292
 		wp_get_current_user();
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		<div id="simcal-drip" class="<?php echo $screen; ?>">
298 298
 			<div class="signup">
299 299
 				<p>
300
-					<?php _e( "Enter your name and email and we'll send you a coupon code for <strong>20% off</strong> all Pro Add-on purchases.", 'google-calendar-events' ); ?>
300
+					<?php _e("Enter your name and email and we'll send you a coupon code for <strong>20% off</strong> all Pro Add-on purchases.", 'google-calendar-events'); ?>
301 301
 				</p>
302 302
 
303 303
 				<p>
304
-					<label for="simcal-drip-field-email"><?php _e( 'Your Email', 'google-calendar-events' ); ?></label><br />
304
+					<label for="simcal-drip-field-email"><?php _e('Your Email', 'google-calendar-events'); ?></label><br />
305 305
 					<input type="email"
306 306
 					       id="simcal-drip-field-email"
307 307
 					       name="fields[email]"
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				</p>
310 310
 
311 311
 				<p>
312
-					<label for="simcal-drip-field-first_name"><?php _e( 'First Name', 'google-calendar-events' ); ?></label><br />
312
+					<label for="simcal-drip-field-first_name"><?php _e('First Name', 'google-calendar-events'); ?></label><br />
313 313
 					<input type="text"
314 314
 					       id="simcal-drip-field-first_name"
315 315
 					       name="fields[first_name]"
@@ -318,17 +318,17 @@  discard block
 block discarded – undo
318 318
 				<p class="textright">
319 319
 					<a href="#"
320 320
 					   id="simcal-drip-signup"
321
-					   class="button button-primary"><?php _e( 'Send me the coupon', 'google-calendar-events' ); ?></a>
321
+					   class="button button-primary"><?php _e('Send me the coupon', 'google-calendar-events'); ?></a>
322 322
 				</p>
323 323
 				<div class="textright">
324
-					<em><?php _e( 'No spam. Unsubscribe anytime.', 'google-calendar-events' ); ?></em>
324
+					<em><?php _e('No spam. Unsubscribe anytime.', 'google-calendar-events'); ?></em>
325 325
 					<br/>
326
-					<a href="<?php echo simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'sidebar-link' ); ?>"
327
-					   target="_blank"><?php _e( 'Just take me the add-ons', 'google-calendar-events' ); ?></a>
326
+					<a href="<?php echo simcal_ga_campaign_url(simcal_get_url('addons'), 'core-plugin', 'sidebar-link'); ?>"
327
+					   target="_blank"><?php _e('Just take me the add-ons', 'google-calendar-events'); ?></a>
328 328
 				</div>
329 329
 			</div>
330 330
 			<div class="thank-you" style="display: none;">
331
-				<?php _e( 'Thank you!', 'google-calendar-events' ); ?>
331
+				<?php _e('Thank you!', 'google-calendar-events'); ?>
332 332
 			</div>
333 333
 			<div class="clear">
334 334
 			</div>
Please login to merge, or discard this patch.