Completed
Push — master ( 72dfec...61887c )
by
unknown
06:50
created
includes/admin/fields/textarea.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -26,17 +26,17 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param array $field
28 28
 	 */
29
-	public function __construct( $field ) {
29
+	public function __construct($field) {
30 30
 
31 31
 		$this->type_class = 'simcal-field-textarea';
32 32
 
33
-		parent::__construct( $field );
33
+		parent::__construct($field);
34 34
 
35
-		if ( ! empty( $field['value'] ) ) {
36
-			$this->value = esc_textarea( $field['value'] );
35
+		if ( ! empty($field['value'])) {
36
+			$this->value = esc_textarea($field['value']);
37 37
 		}
38
-		if ( ! empty( $field['default'] ) ) {
39
-			$this->default = esc_textarea( $field['default'] );
38
+		if ( ! empty($field['default'])) {
39
+			$this->default = esc_textarea($field['default']);
40 40
 		}
41 41
 	}
42 42
 
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
 			name="<?php echo $this->name; ?>"
53 53
 			id="<?php echo $this->id; ?>"
54 54
 			<?php
55
-			echo $this->class ? 'class="'  . $this->class . '" ' : '';
56
-			echo $this->placeholder ? 'placeholder="'  . $this->placeholder . '" ' : '';
57
-			echo $this->style ? 'style="'  . $this->style . '" ' : '';
55
+			echo $this->class ? 'class="'.$this->class.'" ' : '';
56
+			echo $this->placeholder ? 'placeholder="'.$this->placeholder.'" ' : '';
57
+			echo $this->style ? 'style="'.$this->style.'" ' : '';
58 58
 			echo $this->attributes;
59
-			?>><?php echo $this->value;  ?></textarea>
59
+			?>><?php echo $this->value; ?></textarea>
60 60
 		<?php
61 61
 
62 62
 		echo $this->tooltip;
63 63
 
64
-		if ( ! empty( $this->description ) ) {
65
-			echo '<p class="description">' . wp_kses_post( $this->description ) . '</p>';
64
+		if ( ! empty($this->description)) {
65
+			echo '<p class="description">'.wp_kses_post($this->description).'</p>';
66 66
 		}
67 67
 
68 68
 	}
Please login to merge, or discard this patch.
includes/admin/metaboxes/get-shortcode.php 1 patch
Spacing   +4 added lines, -4 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
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \WP_Post $post
28 28
 	 */
29
-	public static function html( $post ) {
30
-		simcal_print_shortcode_tip( $post->ID );
29
+	public static function html($post) {
30
+		simcal_print_shortcode_tip($post->ID);
31 31
 	}
32 32
 
33 33
 	/**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param int      $post_id
39 39
 	 * @param \WP_Post $post
40 40
 	 */
41
-	public static function save( $post_id, $post ) {
41
+	public static function save($post_id, $post) {
42 42
 		// This Meta Box does not have settings.
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
includes/admin/metaboxes/newsletter.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param \WP_Post $post
28 28
 	 */
29
-	public static function html( $post ) {
29
+	public static function html($post) {
30 30
 		simcal_newsletter_signup();
31 31
 	}
32 32
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param int      $post_id
39 39
 	 * @param \WP_Post $post
40 40
 	 */
41
-	public static function save( $post_id, $post ) {
41
+	public static function save($post_id, $post) {
42 42
 		// This meta box has no persistent settings.
43 43
 	}
44 44
 
Please login to merge, or discard this patch.
includes/admin/notice.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -106,43 +106,43 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/notices.php 1 patch
Spacing   +42 added lines, -42 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,8 +25,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
includes/admin/pages.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use SimpleCalendar\Abstracts\Field;
10 10
 use SimpleCalendar\Abstracts\Admin_Page;
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param string $page
55 55
 	 */
56
-	public function __construct( $page = 'settings' ) {
56
+	public function __construct($page = 'settings') {
57 57
 
58 58
 		$this->page = $page;
59
-		$settings_pages = ! is_null( \SimpleCalendar\plugin()->objects ) ? simcal_get_admin_pages() : '';
59
+		$settings_pages = ! is_null(\SimpleCalendar\plugin()->objects) ? simcal_get_admin_pages() : '';
60 60
 		$settings_page_tabs = array();
61
-		$tabs = isset( $settings_pages[ $page ] ) ? $settings_pages[ $page ] : false;
61
+		$tabs = isset($settings_pages[$page]) ? $settings_pages[$page] : false;
62 62
 
63
-		if ( $tabs && is_array( $tabs ) ) {
64
-			foreach ( $tabs as $tab ) {
63
+		if ($tabs && is_array($tabs)) {
64
+			foreach ($tabs as $tab) {
65 65
 
66
-				$settings_page = simcal_get_admin_page( $tab );
66
+				$settings_page = simcal_get_admin_page($tab);
67 67
 
68
-				if ( $settings_page instanceof Admin_Page ) {
69
-					$settings_page_tabs[ $settings_page->id ] = $settings_page;
68
+				if ($settings_page instanceof Admin_Page) {
69
+					$settings_page_tabs[$settings_page->id] = $settings_page;
70 70
 				}
71 71
 			}
72 72
 
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		// The first tab is the default tab when opening a page.
77
-		$this->tab = isset( $tabs[0] ) ? $tabs[0] : '';
77
+		$this->tab = isset($tabs[0]) ? $tabs[0] : '';
78 78
 
79
-		do_action( 'simcal_admin_pages', $page );
79
+		do_action('simcal_admin_pages', $page);
80 80
 	}
81 81
 
82 82
 	/**
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
 
92 92
 		$settings = array();
93 93
 
94
-		if ( ! empty( $this->settings ) && is_array( $this->settings ) ) {
95
-			foreach ( $this->settings as $id => $object ) {
94
+		if ( ! empty($this->settings) && is_array($this->settings)) {
95
+			foreach ($this->settings as $id => $object) {
96 96
 
97
-				if ( $object instanceof Admin_Page ) {
97
+				if ($object instanceof Admin_Page) {
98 98
 
99 99
 					$settings_page = $object->get_settings();
100 100
 
101
-					if ( isset( $settings_page[ $id ] ) ) {
102
-						$settings[ $id ] = $settings_page[ $id ];
101
+					if (isset($settings_page[$id])) {
102
+						$settings[$id] = $settings_page[$id];
103 103
 					}
104 104
 				}
105 105
 
@@ -118,48 +118,48 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @param array $settings
120 120
 	 */
121
-	public function register_settings( $settings = array() ) {
121
+	public function register_settings($settings = array()) {
122 122
 
123 123
 		$settings = $settings ? $settings : $this->get_settings();
124 124
 
125
-		if ( ! empty( $settings ) && is_array( $settings ) ) {
125
+		if ( ! empty($settings) && is_array($settings)) {
126 126
 
127
-			foreach ( $settings as $tab_id => $settings_page ) {
127
+			foreach ($settings as $tab_id => $settings_page) {
128 128
 
129
-				if ( isset( $settings_page['sections'] ) ) {
129
+				if (isset($settings_page['sections'])) {
130 130
 
131 131
 					$sections = $settings_page['sections'];
132 132
 
133
-					if ( ! empty( $sections ) && is_array( $sections ) ) {
133
+					if ( ! empty($sections) && is_array($sections)) {
134 134
 
135
-						foreach ( $sections as $section_id => $section ) {
135
+						foreach ($sections as $section_id => $section) {
136 136
 
137 137
 							add_settings_section(
138 138
 								$section_id,
139
-								isset( $section['title'] ) ? $section['title'] : '',
140
-								isset( $section['callback'] ) ? $section['callback'] : '',
141
-								'simple-calendar_' . $this->page . '_' . $tab_id
139
+								isset($section['title']) ? $section['title'] : '',
140
+								isset($section['callback']) ? $section['callback'] : '',
141
+								'simple-calendar_'.$this->page.'_'.$tab_id
142 142
 							);
143 143
 
144
-							if ( isset( $section['fields'] ) ) {
144
+							if (isset($section['fields'])) {
145 145
 
146 146
 								$fields = $section['fields'];
147 147
 
148
-								if ( ! empty( $fields ) && is_array( $fields ) ) {
148
+								if ( ! empty($fields) && is_array($fields)) {
149 149
 
150
-									foreach ( $fields as $field ) {
150
+									foreach ($fields as $field) {
151 151
 
152
-										if ( isset( $field['id'] ) && isset( $field['type'] ) ) {
152
+										if (isset($field['id']) && isset($field['type'])) {
153 153
 
154
-											$field_object = simcal_get_field( $field, $field['type'] );
154
+											$field_object = simcal_get_field($field, $field['type']);
155 155
 
156
-											if ( $field_object instanceof Field ) {
156
+											if ($field_object instanceof Field) {
157 157
 
158 158
 												add_settings_field(
159 159
 													$field['id'],
160
-													isset( $field['title'] ) ? $field['title'] : '',
161
-													array( $field_object, 'html' ),
162
-													'simple-calendar_' . $this->page . '_' . $tab_id,
160
+													isset($field['title']) ? $field['title'] : '',
161
+													array($field_object, 'html'),
162
+													'simple-calendar_'.$this->page.'_'.$tab_id,
163 163
 													$section_id
164 164
 												);
165 165
 
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 
174 174
 							} // are there fields?
175 175
 
176
-							$page = simcal_get_admin_page( $tab_id );
176
+							$page = simcal_get_admin_page($tab_id);
177 177
 
178 178
 							register_setting(
179
-								'simple-calendar_' . $this->page . '_' . $tab_id,
180
-								'simple-calendar_' . $this->page . '_' . $tab_id,
181
-								$page instanceof Admin_Page ? array( $page, 'validate' ) : ''
179
+								'simple-calendar_'.$this->page.'_'.$tab_id,
180
+								'simple-calendar_'.$this->page.'_'.$tab_id,
181
+								$page instanceof Admin_Page ? array($page, 'validate') : ''
182 182
 							);
183 183
 
184 184
 						} // loop sections
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		global $current_tab;
204 204
 
205 205
 		// Get current tab/section
206
-		$current_tab = empty( $_GET['tab'] ) ? $this->tab : sanitize_title( $_GET['tab'] );
206
+		$current_tab = empty($_GET['tab']) ? $this->tab : sanitize_title($_GET['tab']);
207 207
 		$this->tab = $current_tab;
208 208
 
209 209
 		?>
@@ -215,45 +215,45 @@  discard block
 block discarded – undo
215 215
 
216 216
 				// Include settings pages
217 217
 				$settings_pages = self::get_settings();
218
-				if ( ! empty( $settings_pages ) && is_array( $settings_pages ) ) {
218
+				if ( ! empty($settings_pages) && is_array($settings_pages)) {
219 219
 
220 220
 					echo '<h2 class="nav-tab-wrapper simcal-nav-tab-wrapper">';
221 221
 
222 222
 					// Get tabs for the settings page
223
-					if ( ! empty( $settings_pages ) && is_array( $settings_pages ) ) {
223
+					if ( ! empty($settings_pages) && is_array($settings_pages)) {
224 224
 
225
-						foreach ( $settings_pages as $id => $settings ) {
225
+						foreach ($settings_pages as $id => $settings) {
226 226
 
227
-							$tab_id    = isset( $id ) ? $id : '';
228
-							$tab_label = isset( $settings['label'] ) ? $settings['label'] : '';
229
-							$tab_link  = admin_url( 'edit.php?post_type=calendar&page=simple-calendar_' . $this->page . '&tab=' . $tab_id );
227
+							$tab_id    = isset($id) ? $id : '';
228
+							$tab_label = isset($settings['label']) ? $settings['label'] : '';
229
+							$tab_link  = admin_url('edit.php?post_type=calendar&page=simple-calendar_'.$this->page.'&tab='.$tab_id);
230 230
 
231
-							echo '<a href="' . $tab_link . '" class="nav-tab ' . ( $current_tab == $tab_id ? 'nav-tab-active' : '' ) . '">' . $tab_label . '</a>';
231
+							echo '<a href="'.$tab_link.'" class="nav-tab '.($current_tab == $tab_id ? 'nav-tab-active' : '').'">'.$tab_label.'</a>';
232 232
 						}
233 233
 
234 234
 					}
235 235
 
236
-					do_action( 'simcal_admin_page_' . $this->page . '_tabs' );
236
+					do_action('simcal_admin_page_'.$this->page.'_tabs');
237 237
 
238 238
 					echo '</h2>';
239 239
 
240 240
 					settings_errors();
241 241
 
242
-					foreach ( $settings_pages as $tab_id => $contents ) {
242
+					foreach ($settings_pages as $tab_id => $contents) {
243 243
 
244
-						if ( $tab_id === $current_tab ) {
244
+						if ($tab_id === $current_tab) {
245 245
 
246
-							echo isset( $contents['description'] ) ? '<p>' . $contents['description'] . '</p>' : '';
246
+							echo isset($contents['description']) ? '<p>'.$contents['description'].'</p>' : '';
247 247
 
248
-							do_action( 'simcal_admin_page_' .  $this->page . '_' . $current_tab . '_start' );
248
+							do_action('simcal_admin_page_'.$this->page.'_'.$current_tab.'_start');
249 249
 
250
-							settings_fields( 'simple-calendar_' . $this->page . '_' . $tab_id );
251
-							do_settings_sections( 'simple-calendar_' . $this->page . '_' . $tab_id );
250
+							settings_fields('simple-calendar_'.$this->page.'_'.$tab_id);
251
+							do_settings_sections('simple-calendar_'.$this->page.'_'.$tab_id);
252 252
 
253
-							do_action( 'simcal_admin_page_' .  $this->page . '_' . $current_tab . '_end' );
253
+							do_action('simcal_admin_page_'.$this->page.'_'.$current_tab.'_end');
254 254
 
255
-							$submit = apply_filters( 'simcal_admin_page_' . $this->page . '_' . $current_tab . '_submit', true );
256
-							if ( true === $submit ) {
255
+							$submit = apply_filters('simcal_admin_page_'.$this->page.'_'.$current_tab.'_submit', true);
256
+							if (true === $submit) {
257 257
 								submit_button();
258 258
 							}
259 259
 						}
Please login to merge, or discard this patch.
includes/admin/pages/feeds.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/admin/pages/licenses.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,8 +75,8 @@
 block discarded – undo
75 75
 			'keys' => array(
76 76
 				'title' => __( 'Premium Add-on License Keys', 'google-calendar-events' ),
77 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>',
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 82
 		return apply_filters( 'simcal_add_' . $this->option_group . '_' . $this->id .'_sections', $sections );
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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
 
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/admin/post-types.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -272,9 +272,9 @@
 block discarded – undo
272 272
 
273 273
 		if ( $post_type == 'calendar' && isset( $post->ID ) ) {
274 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
-			     '</a>';
275
+				 '<i class="simcal-icon-spinner simcal-icon-spin" style="display: none;"></i> ' .
276
+				 __( 'Clear cache', 'google-calendar-events' ) .
277
+				 '</a>';
278 278
 		}
279 279
 	}
280 280
 
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 : '&mdash;';
95
+				$feed = simcal_get_feed($post_id);
96
+				echo isset($feed->name) ? $feed->name : '&mdash;';
97 97
 				break;
98 98
 
99 99
 			case 'calendar':
100 100
 
101 101
 				$info = '&mdash;';
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 .= ' &rarr; ' . $calendar->views[ $view ];
113
+						if (isset($calendar->views[$view])) {
114
+							$info .= ' &rarr; '.$calendar->views[$view];
115 115
 						}
116 116
 					}
117 117
 				}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,8 +341,11 @@
 block discarded – undo
341 341
 						</label>
342 342
 					</p>
343 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
-				<?php else : ?>
345
-					<p><em><?php _e( 'Could not find any calendars to add to this post.', 'google-calendar-events' ); ?></em></p>
344
+				<?php else {
345
+	: ?>
346
+					<p><em><?php _e( 'Could not find any calendars to add to this post.', 'google-calendar-events' );
347
+}
348
+?></em></p>
346 349
 					<strong><a href="post-new.php?post_type=calendar"><?php _e( 'Please add and configure new calendar first.', 'google-calendar-events' ); ?></a></strong>
347 350
 				<?php endif; ?>
348 351
 			</div>
Please login to merge, or discard this patch.