Passed
Push — master ( c7e94e...22348d )
by Warwick
03:34 queued 11s
created
includes/settings/display.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,147 +1,147 @@
 block discarded – undo
1 1
 <div class="uix-field-wrapper">
2 2
 	<ul class="ui-tab-nav">
3
-		<?php if ( class_exists( 'LSX_Banners' ) ) { ?>
4
-			<li><a href="#ui-placeholders" class="active"><?php esc_html_e( 'Placeholders', 'lsx-projects' ); ?></a></li>
3
+		<?php if (class_exists('LSX_Banners')) { ?>
4
+			<li><a href="#ui-placeholders" class="active"><?php esc_html_e('Placeholders', 'lsx-projects'); ?></a></li>
5 5
 		<?php } ?>
6 6
 
7
-		<?php if ( class_exists( 'LSX_Currencies' ) ) { ?>
8
-			<?php $class_active = class_exists( 'LSX_Banners' ) ? '' : 'active' ?>
9
-			<li><a href="#ui-currencies" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Currencies', 'lsx-projects' ); ?></a></li>
7
+		<?php if (class_exists('LSX_Currencies')) { ?>
8
+			<?php $class_active = class_exists('LSX_Banners') ? '' : 'active' ?>
9
+			<li><a href="#ui-currencies" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Currencies', 'lsx-projects'); ?></a></li>
10 10
 		<?php } ?>
11 11
 
12
-		<?php if ( class_exists( 'LSX_Team' ) ) { ?>
13
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) ) ? '' : 'active' ?>
14
-			<li><a href="#ui-team" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Team', 'lsx-projects' ); ?></a></li>
12
+		<?php if (class_exists('LSX_Team')) { ?>
13
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active' ?>
14
+			<li><a href="#ui-team" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Team', 'lsx-projects'); ?></a></li>
15 15
 		<?php } ?>
16 16
 
17
-		<?php if ( class_exists( 'LSX_Testimonials' ) ) { ?>
18
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) ) ? '' : 'active' ?>
19
-			<li><a href="#ui-testimonials" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Testimonials', 'lsx-projects' ); ?></a></li>
17
+		<?php if (class_exists('LSX_Testimonials')) { ?>
18
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active' ?>
19
+			<li><a href="#ui-testimonials" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Testimonials', 'lsx-projects'); ?></a></li>
20 20
 		<?php } ?>
21 21
 
22
-		<?php if ( class_exists( 'LSX_Projects' ) ) { ?>
23
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) ) ? '' : 'active' ?>
24
-			<li><a href="#ui-projects" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Projects', 'lsx-projects' ); ?></a></li>
22
+		<?php if (class_exists('LSX_Projects')) { ?>
23
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active' ?>
24
+			<li><a href="#ui-projects" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Projects', 'lsx-projects'); ?></a></li>
25 25
 		<?php } ?>
26 26
 
27
-		<?php if ( class_exists( 'LSX_Services' ) ) { ?>
28
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) ) ? '' : 'active' ?>
29
-			<li><a href="#ui-services" class="<?php echo esc_attr( $class ) ?>"><?php esc_html_e( 'Services', 'lsx-projects' ); ?></a></li>
27
+		<?php if (class_exists('LSX_Services')) { ?>
28
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active' ?>
29
+			<li><a href="#ui-services" class="<?php echo esc_attr($class) ?>"><?php esc_html_e('Services', 'lsx-projects'); ?></a></li>
30 30
 		<?php $class = ''; } ?>
31 31
 
32
-		<?php if ( class_exists( 'LSX_Blog_Customizer' ) ) { ?>
33
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) ) ? '' : 'active' ?>
34
-			<li><a href="#ui-blog-customizer" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Blog Customizer (posts widget)', 'lsx-projects' ); ?></a></li>
32
+		<?php if (class_exists('LSX_Blog_Customizer')) { ?>
33
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services')) ? '' : 'active' ?>
34
+			<li><a href="#ui-blog-customizer" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Blog Customizer (posts widget)', 'lsx-projects'); ?></a></li>
35 35
 		<?php } ?>
36 36
 
37
-		<?php if ( class_exists( 'LSX_Sharing' ) ) { ?>
38
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) ) ? '' : 'active' ?>
39
-			<li><a href="#ui-sharing" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Sharing', 'lsx-projects' ); ?></a></li>
37
+		<?php if (class_exists('LSX_Sharing')) { ?>
38
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer')) ? '' : 'active' ?>
39
+			<li><a href="#ui-sharing" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Sharing', 'lsx-projects'); ?></a></li>
40 40
 		<?php } ?>
41 41
 
42
-		<?php if ( class_exists( 'LSX_Videos' ) ) { ?>
43
-			<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) || class_exists( 'LSX_Sharing' ) ) ? '' : 'active' ?>
44
-			<li><a href="#ui-videos" class="<?php echo esc_attr( $class_active ) ?>"><?php esc_html_e( 'Videos', 'lsx-projects' ); ?></a></li>
42
+		<?php if (class_exists('LSX_Videos')) { ?>
43
+			<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing')) ? '' : 'active' ?>
44
+			<li><a href="#ui-videos" class="<?php echo esc_attr($class_active) ?>"><?php esc_html_e('Videos', 'lsx-projects'); ?></a></li>
45 45
 		<?php } ?>
46 46
 	</ul>
47 47
 
48
-	<?php if ( class_exists( 'LSX_Banners' ) ) { ?>
48
+	<?php if (class_exists('LSX_Banners')) { ?>
49 49
 		<div id="ui-placeholders" class="ui-tab active">
50 50
 			<table class="form-table">
51 51
 				<tbody>
52
-					<?php do_action( 'lsx_framework_display_tab_content', 'placeholders' ); ?>
52
+					<?php do_action('lsx_framework_display_tab_content', 'placeholders'); ?>
53 53
 				</tbody>
54 54
 			</table>
55 55
 		</div>
56 56
 	<?php } ?>
57 57
 
58
-	<?php if ( class_exists( 'LSX_Currencies' ) ) { ?>
59
-		<?php $class_active = class_exists( 'LSX_Banners' ) ? '' : 'active' ?>
60
-		<div id="ui-currencies" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
58
+	<?php if (class_exists('LSX_Currencies')) { ?>
59
+		<?php $class_active = class_exists('LSX_Banners') ? '' : 'active' ?>
60
+		<div id="ui-currencies" class="ui-tab <?php echo esc_attr($class_active) ?>">
61 61
 			<table class="form-table">
62 62
 				<tbody>
63
-					<?php do_action( 'lsx_framework_display_tab_content', 'currency_switcher' ); ?>
63
+					<?php do_action('lsx_framework_display_tab_content', 'currency_switcher'); ?>
64 64
 				</tbody>
65 65
 			</table>
66 66
 		</div>
67 67
 	<?php } ?>
68 68
 
69
-	<?php if ( class_exists( 'LSX_Team' ) ) { ?>
70
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) ) ? '' : 'active' ?>
71
-		<div id="ui-team" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
69
+	<?php if (class_exists('LSX_Team')) { ?>
70
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies')) ? '' : 'active' ?>
71
+		<div id="ui-team" class="ui-tab <?php echo esc_attr($class_active) ?>">
72 72
 			<table class="form-table">
73 73
 				<tbody>
74
-					<?php do_action( 'lsx_framework_display_tab_content', 'team' ); ?>
74
+					<?php do_action('lsx_framework_display_tab_content', 'team'); ?>
75 75
 				</tbody>
76 76
 			</table>
77 77
 		</div>
78 78
 	<?php } ?>
79 79
 
80
-	<?php if ( class_exists( 'LSX_Testimonials' ) ) { ?>
81
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) ) ? '' : 'active' ?>
82
-		<div id="ui-testimonials" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
80
+	<?php if (class_exists('LSX_Testimonials')) { ?>
81
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team')) ? '' : 'active' ?>
82
+		<div id="ui-testimonials" class="ui-tab <?php echo esc_attr($class_active) ?>">
83 83
 			<table class="form-table">
84 84
 				<tbody>
85
-					<?php do_action( 'lsx_framework_display_tab_content', 'testimonials' ); ?>
85
+					<?php do_action('lsx_framework_display_tab_content', 'testimonials'); ?>
86 86
 				</tbody>
87 87
 			</table>
88 88
 		</div>
89 89
 	<?php } ?>
90 90
 
91
-	<?php if ( class_exists( 'LSX_Projects' ) ) { ?>
92
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) ) ? '' : 'active' ?>
93
-		<div id="ui-projects" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
91
+	<?php if (class_exists('LSX_Projects')) { ?>
92
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials')) ? '' : 'active' ?>
93
+		<div id="ui-projects" class="ui-tab <?php echo esc_attr($class_active) ?>">
94 94
 			<table class="form-table">
95 95
 				<tbody>
96
-					<?php do_action( 'lsx_framework_display_tab_content', 'projects' ); ?>
96
+					<?php do_action('lsx_framework_display_tab_content', 'projects'); ?>
97 97
 				</tbody>
98 98
 			</table>
99 99
 		</div>
100 100
 	<?php } ?>
101 101
 
102
-	<?php if ( class_exists( 'LSX_Services' ) ) { ?>
103
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) ) ? '' : 'active' ?>
104
-		<div id="ui-services" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
102
+	<?php if (class_exists('LSX_Services')) { ?>
103
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects')) ? '' : 'active' ?>
104
+		<div id="ui-services" class="ui-tab <?php echo esc_attr($class_active) ?>">
105 105
 			<table class="form-table">
106 106
 				<tbody>
107
-					<?php do_action( 'lsx_framework_display_tab_content', 'services' ); ?>
107
+					<?php do_action('lsx_framework_display_tab_content', 'services'); ?>
108 108
 				</tbody>
109 109
 			</table>
110 110
 		</div>
111 111
 	<?php } ?>
112 112
 
113
-	<?php if ( class_exists( 'LSX_Blog_Customizer' ) ) { ?>
114
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) ) ? '' : 'active' ?>
115
-		<div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
113
+	<?php if (class_exists('LSX_Blog_Customizer')) { ?>
114
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services')) ? '' : 'active' ?>
115
+		<div id="ui-blog-customizer" class="ui-tab <?php echo esc_attr($class_active) ?>">
116 116
 			<table class="form-table">
117 117
 				<tbody>
118
-					<?php do_action( 'lsx_framework_display_tab_content', 'blog-customizer' ); ?>
118
+					<?php do_action('lsx_framework_display_tab_content', 'blog-customizer'); ?>
119 119
 				</tbody>
120 120
 			</table>
121 121
 		</div>
122 122
 	<?php } ?>
123 123
 
124
-	<?php if ( class_exists( 'LSX_Sharing' ) ) { ?>
125
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) ) ? '' : 'active' ?>
126
-		<div id="ui-sharing" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
124
+	<?php if (class_exists('LSX_Sharing')) { ?>
125
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer')) ? '' : 'active' ?>
126
+		<div id="ui-sharing" class="ui-tab <?php echo esc_attr($class_active) ?>">
127 127
 			<table class="form-table">
128 128
 				<tbody>
129
-					<?php do_action( 'lsx_framework_display_tab_content', 'sharing' ); ?>
129
+					<?php do_action('lsx_framework_display_tab_content', 'sharing'); ?>
130 130
 				</tbody>
131 131
 			</table>
132 132
 		</div>
133 133
 	<?php } ?>
134 134
 
135
-	<?php if ( class_exists( 'LSX_Videos' ) ) { ?>
136
-		<?php $class_active = ( class_exists( 'LSX_Banners' ) || class_exists( 'LSX_Currencies' ) || class_exists( 'LSX_Team' ) || class_exists( 'LSX_Testimonials' ) || class_exists( 'LSX_Projects' ) || class_exists( 'LSX_Services' ) || class_exists( 'LSX_Blog_Customizer' ) || class_exists( 'LSX_Sharing' ) ) ? '' : 'active' ?>
137
-		<div id="ui-videos" class="ui-tab <?php echo esc_attr( $class_active ) ?>">
135
+	<?php if (class_exists('LSX_Videos')) { ?>
136
+		<?php $class_active = (class_exists('LSX_Banners') || class_exists('LSX_Currencies') || class_exists('LSX_Team') || class_exists('LSX_Testimonials') || class_exists('LSX_Projects') || class_exists('LSX_Services') || class_exists('LSX_Blog_Customizer') || class_exists('LSX_Sharing')) ? '' : 'active' ?>
137
+		<div id="ui-videos" class="ui-tab <?php echo esc_attr($class_active) ?>">
138 138
 			<table class="form-table">
139 139
 				<tbody>
140
-					<?php do_action( 'lsx_framework_display_tab_content', 'videos' ); ?>
140
+					<?php do_action('lsx_framework_display_tab_content', 'videos'); ?>
141 141
 				</tbody>
142 142
 			</table>
143 143
 		</div>
144 144
 	<?php } ?>
145 145
 
146
-	<?php do_action( 'lsx_framework_display_tab_bottom', 'display' ); ?>
146
+	<?php do_action('lsx_framework_display_tab_bottom', 'display'); ?>
147 147
 </div>
Please login to merge, or discard this patch.
includes/class-lsx-projects-scpo-engine.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -14,45 +14,45 @@  discard block
 block discarded – undo
14 14
 class LSX_Projects_SCPO_Engine {
15 15
 
16 16
 	function __construct() {
17
-		if ( ! get_option( 'lsx_projects_scporder_install' ) ) {
17
+		if ( ! get_option('lsx_projects_scporder_install')) {
18 18
 			$this->lsx_projects_scporder_install();
19 19
 		}
20 20
 
21
-		add_action( 'admin_init', array( $this, 'refresh' ) );
22
-		add_action( 'admin_init', array( $this, 'load_script_css' ) );
21
+		add_action('admin_init', array($this, 'refresh'));
22
+		add_action('admin_init', array($this, 'load_script_css'));
23 23
 
24
-		add_action( 'wp_ajax_update-menu-order', array( $this, 'update_menu_order' ) );
24
+		add_action('wp_ajax_update-menu-order', array($this, 'update_menu_order'));
25 25
 
26
-		add_action( 'pre_get_posts', array( $this, 'lsx_projects_scporder_pre_get_posts' ) );
26
+		add_action('pre_get_posts', array($this, 'lsx_projects_scporder_pre_get_posts'));
27 27
 
28
-		add_filter( 'get_previous_post_where', array( $this, 'lsx_projects_scporder_previous_post_where' ) );
29
-		add_filter( 'get_previous_post_sort', array( $this, 'lsx_projects_scporder_previous_post_sort' ) );
30
-		add_filter( 'get_next_post_where', array( $this, 'lsx_projects_scporder_next_post_where' ) );
31
-		add_filter( 'get_next_post_sort', array( $this, 'lsx_projects_scporder_next_post_sort' ) );
28
+		add_filter('get_previous_post_where', array($this, 'lsx_projects_scporder_previous_post_where'));
29
+		add_filter('get_previous_post_sort', array($this, 'lsx_projects_scporder_previous_post_sort'));
30
+		add_filter('get_next_post_where', array($this, 'lsx_projects_scporder_next_post_where'));
31
+		add_filter('get_next_post_sort', array($this, 'lsx_projects_scporder_next_post_sort'));
32 32
 	}
33 33
 
34 34
 	function lsx_projects_scporder_install() {
35
-		update_option( 'lsx_projects_scporder_install', 1 );
35
+		update_option('lsx_projects_scporder_install', 1);
36 36
 	}
37 37
 
38 38
 	function _check_load_script_css() {
39 39
 		$active = false;
40 40
 		$objects = $this->get_lsx_projects_scporder_options_objects();
41 41
 
42
-		if ( empty( $objects ) ) {
42
+		if (empty($objects)) {
43 43
 			return false;
44 44
 		}
45 45
 
46
-		if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'action=edit' ) || strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/post-new.php' ) ) {
46
+		if (isset($_GET['orderby']) || strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'action=edit') || strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'wp-admin/post-new.php')) {
47 47
 			return false;
48 48
 		}
49 49
 
50
-		if ( ! empty( $objects ) ) {
51
-			if ( isset( $_GET['post_type'] ) && ! isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( wp_unslash( $_GET['post_type'] ) ), $objects ) ) { // if page or custom post types
50
+		if ( ! empty($objects)) {
51
+			if (isset($_GET['post_type']) && ! isset($_GET['taxonomy']) && array_key_exists(sanitize_text_field(wp_unslash($_GET['post_type'])), $objects)) { // if page or custom post types
52 52
 				$active = true;
53 53
 			}
54 54
 
55
-			if ( ! isset( $_GET['post_type'] ) && strstr( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'wp-admin/edit.php' ) && array_key_exists( 'post', $objects ) ) { // if post
55
+			if ( ! isset($_GET['post_type']) && strstr(sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])), 'wp-admin/edit.php') && array_key_exists('post', $objects)) { // if post
56 56
 				$active = true;
57 57
 			}
58 58
 		}
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 
63 63
 	function load_script_css() {
64
-		if ( $this->_check_load_script_css() ) {
65
-			wp_enqueue_script( 'scporderjs', LSX_PROJECTS_URL . 'assets/js/scporder.min.js', array( 'jquery', 'jquery-ui-sortable' ), null, true );
64
+		if ($this->_check_load_script_css()) {
65
+			wp_enqueue_script('scporderjs', LSX_PROJECTS_URL . 'assets/js/scporder.min.js', array('jquery', 'jquery-ui-sortable'), null, true);
66 66
 
67 67
 			$scporderjs_params = array(
68
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
69
-				'ajax_nonce' => wp_create_nonce( 'scporder' ),
68
+				'ajax_url' => admin_url('admin-ajax.php'),
69
+				'ajax_nonce' => wp_create_nonce('scporder'),
70 70
 			);
71 71
 
72
-			wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params );
72
+			wp_localize_script('scporderjs', 'scporderjs_params', $scporderjs_params);
73 73
 
74
-			wp_enqueue_style( 'scporder', LSX_PROJECTS_URL . 'assets/css/scporder.css', array(), null );
74
+			wp_enqueue_style('scporder', LSX_PROJECTS_URL . 'assets/css/scporder.css', array(), null);
75 75
 		}
76 76
 	}
77 77
 
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
 
81 81
 		$objects = $this->get_lsx_projects_scporder_options_objects();
82 82
 
83
-		if ( ! empty( $objects ) ) {
84
-			foreach ( $objects as $object => $object_data ) {
83
+		if ( ! empty($objects)) {
84
+			foreach ($objects as $object => $object_data) {
85 85
 				$result = $wpdb->get_results($wpdb->prepare("
86 86
 					SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min
87 87
 					FROM $wpdb->posts
88 88
 					WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
89 89
 				", $object));
90 90
 
91
-				if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
91
+				if (0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max) {
92 92
 					continue;
93 93
 				}
94 94
 
95
-				$results = $wpdb->get_results( $wpdb->prepare("
95
+				$results = $wpdb->get_results($wpdb->prepare("
96 96
 					SELECT ID
97 97
 					FROM $wpdb->posts
98 98
 					WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
99 99
 					ORDER BY menu_order ASC
100
-				", $object ) );
100
+				", $object));
101 101
 
102
-				foreach ( $results as $key => $result ) {
102
+				foreach ($results as $key => $result) {
103 103
 					$wpdb->update(
104 104
 						$wpdb->posts,
105 105
 						array(
@@ -115,61 +115,61 @@  discard block
 block discarded – undo
115 115
 	}
116 116
 
117 117
 	function update_menu_order() {
118
-		check_ajax_referer( 'scporder', 'security' );
118
+		check_ajax_referer('scporder', 'security');
119 119
 
120 120
 		global $wpdb;
121 121
 
122
-		parse_str( sanitize_text_field( wp_unslash( $_POST['order'] ) ), $data );
122
+		parse_str(sanitize_text_field(wp_unslash($_POST['order'])), $data);
123 123
 
124
-		if ( ! is_array( $data ) ) {
124
+		if ( ! is_array($data)) {
125 125
 			return false;
126 126
 		}
127 127
 
128 128
 		$id_arr = array();
129 129
 
130
-		foreach ( $data as $key => $values ) {
131
-			foreach ( $values as $position => $id ) {
130
+		foreach ($data as $key => $values) {
131
+			foreach ($values as $position => $id) {
132 132
 				$id_arr[] = $id;
133 133
 			}
134 134
 		}
135 135
 
136 136
 		$menu_order_arr = array();
137 137
 
138
-		foreach ( $id_arr as $key => $id ) {
139
-			$results = $wpdb->get_results( "SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval( $id ) );
138
+		foreach ($id_arr as $key => $id) {
139
+			$results = $wpdb->get_results("SELECT menu_order FROM $wpdb->posts WHERE ID = " . intval($id));
140 140
 
141
-			foreach ( $results as $result ) {
141
+			foreach ($results as $result) {
142 142
 				$menu_order_arr[] = $result->menu_order;
143 143
 			}
144 144
 		}
145 145
 
146
-		sort( $menu_order_arr );
146
+		sort($menu_order_arr);
147 147
 
148
-		foreach ( $data as $key => $values ) {
149
-			foreach ( $values as $position => $id ) {
148
+		foreach ($data as $key => $values) {
149
+			foreach ($values as $position => $id) {
150 150
 				$wpdb->update(
151 151
 					$wpdb->posts,
152 152
 					array(
153
-						'menu_order' => $menu_order_arr[ $position ],
153
+						'menu_order' => $menu_order_arr[$position],
154 154
 					),
155 155
 					array(
156
-						'ID' => intval( $id ),
156
+						'ID' => intval($id),
157 157
 					)
158 158
 				);
159 159
 			}
160 160
 		}
161 161
 	}
162 162
 
163
-	function lsx_projects_scporder_previous_post_where( $where ) {
163
+	function lsx_projects_scporder_previous_post_where($where) {
164 164
 		global $post;
165 165
 
166 166
 		$objects = $this->get_lsx_projects_scporder_options_objects();
167 167
 
168
-		if ( empty( $objects ) ) {
168
+		if (empty($objects)) {
169 169
 			return $where;
170 170
 		}
171 171
 
172
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
172
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
173 173
 			$current_menu_order = $post->menu_order;
174 174
 			$where = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
175 175
 		}
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
 		return $where;
178 178
 	}
179 179
 
180
-	function lsx_projects_scporder_previous_post_sort( $orderby ) {
180
+	function lsx_projects_scporder_previous_post_sort($orderby) {
181 181
 		global $post;
182 182
 
183 183
 		$objects = $this->get_lsx_projects_scporder_options_objects();
184 184
 
185
-		if ( empty( $objects ) ) {
185
+		if (empty($objects)) {
186 186
 			return $orderby;
187 187
 		}
188 188
 
189
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
189
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
190 190
 			$orderby = 'ORDER BY p.menu_order ASC LIMIT 1';
191 191
 		}
192 192
 
193 193
 		return $orderby;
194 194
 	}
195 195
 
196
-	function lsx_projects_scporder_next_post_where( $where ) {
196
+	function lsx_projects_scporder_next_post_where($where) {
197 197
 		global $post;
198 198
 
199 199
 		$objects = $this->get_lsx_projects_scporder_options_objects();
200 200
 
201
-		if ( empty( $objects ) ) {
201
+		if (empty($objects)) {
202 202
 			return $where;
203 203
 		}
204 204
 
205
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
205
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
206 206
 			$current_menu_order = $post->menu_order;
207 207
 			$where = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
208 208
 		}
@@ -210,70 +210,70 @@  discard block
 block discarded – undo
210 210
 		return $where;
211 211
 	}
212 212
 
213
-	function lsx_projects_scporder_next_post_sort( $orderby ) {
213
+	function lsx_projects_scporder_next_post_sort($orderby) {
214 214
 		global $post;
215 215
 
216 216
 		$objects = $this->get_lsx_projects_scporder_options_objects();
217 217
 
218
-		if ( empty( $objects ) ) {
218
+		if (empty($objects)) {
219 219
 			return $orderby;
220 220
 		}
221 221
 
222
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
222
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
223 223
 			$orderby = 'ORDER BY p.menu_order DESC LIMIT 1';
224 224
 		}
225 225
 
226 226
 		return $orderby;
227 227
 	}
228 228
 
229
-	function lsx_projects_scporder_pre_get_posts( $wp_query ) {
229
+	function lsx_projects_scporder_pre_get_posts($wp_query) {
230 230
 		$objects = $this->get_lsx_projects_scporder_options_objects();
231 231
 
232
-		if ( empty( $objects ) ) {
232
+		if (empty($objects)) {
233 233
 			return false;
234 234
 		}
235 235
 
236
-		if ( is_admin() ) {
237
-			if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) {
238
-				if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) {
239
-					$wp_query->set( 'orderby', 'menu_order' );
240
-					$wp_query->set( 'order', 'ASC' );
236
+		if (is_admin()) {
237
+			if (isset($wp_query->query['post_type']) && ! isset($_GET['orderby'])) {
238
+				if (array_key_exists($wp_query->query['post_type'], $objects)) {
239
+					$wp_query->set('orderby', 'menu_order');
240
+					$wp_query->set('order', 'ASC');
241 241
 				}
242 242
 			}
243 243
 		} else {
244 244
 			$active = false;
245 245
 
246
-			if ( isset( $wp_query->query['post_type'] ) ) {
247
-				if ( ! is_array( $wp_query->query['post_type'] ) ) {
248
-					if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) {
246
+			if (isset($wp_query->query['post_type'])) {
247
+				if ( ! is_array($wp_query->query['post_type'])) {
248
+					if (array_key_exists($wp_query->query['post_type'], $objects)) {
249 249
 						$active = true;
250 250
 					}
251 251
 				}
252 252
 			} else {
253
-				if ( array_key_exists( 'post', $objects ) ) {
253
+				if (array_key_exists('post', $objects)) {
254 254
 					$active = true;
255 255
 				}
256 256
 			}
257 257
 
258
-			if ( ! $active ) {
258
+			if ( ! $active) {
259 259
 				return false;
260 260
 			}
261 261
 
262
-			if ( isset( $wp_query->query['suppress_filters'] ) ) {
263
-				if ( $wp_query->get( 'orderby' ) == 'date' ) {
264
-					$wp_query->set( 'orderby', 'menu_order' );
262
+			if (isset($wp_query->query['suppress_filters'])) {
263
+				if ($wp_query->get('orderby') == 'date') {
264
+					$wp_query->set('orderby', 'menu_order');
265 265
 				}
266 266
 
267
-				if ( $wp_query->get( 'order' ) == 'DESC' ) {
268
-					$wp_query->set( 'order', 'ASC' );
267
+				if ($wp_query->get('order') == 'DESC') {
268
+					$wp_query->set('order', 'ASC');
269 269
 				}
270 270
 			} else {
271
-				if ( ! $wp_query->get( 'orderby' ) ) {
272
-					$wp_query->set( 'orderby', 'menu_order' );
271
+				if ( ! $wp_query->get('orderby')) {
272
+					$wp_query->set('orderby', 'menu_order');
273 273
 				}
274 274
 
275
-				if ( ! $wp_query->get( 'order' ) ) {
276
-					$wp_query->set( 'order', 'ASC' );
275
+				if ( ! $wp_query->get('order')) {
276
+					$wp_query->set('order', 'ASC');
277 277
 				}
278 278
 			}
279 279
 		}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 	function get_lsx_projects_scporder_options_objects() {
283 283
 		return array(
284
-			'project' => esc_html_x( 'Project', 'post type singular name', 'lsx-project' ),
284
+			'project' => esc_html_x('Project', 'post type singular name', 'lsx-project'),
285 285
 		);
286 286
 	}
287 287
 
@@ -290,26 +290,26 @@  discard block
 block discarded – undo
290 290
 /**
291 291
  * SCP Order Uninstall hook
292 292
  */
293
-register_uninstall_hook( __FILE__, 'lsx_projects_scporder_uninstall' );
293
+register_uninstall_hook(__FILE__, 'lsx_projects_scporder_uninstall');
294 294
 
295 295
 function lsx_projects_scporder_uninstall() {
296 296
 	global $wpdb;
297 297
 
298
-	if ( function_exists( 'is_multisite' ) && is_multisite() ) {
298
+	if (function_exists('is_multisite') && is_multisite()) {
299 299
 		$curr_blog = $wpdb->blogid;
300
-		$blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
300
+		$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
301 301
 
302
-		foreach ( $blogids as $blog_id ) {
303
-			switch_to_blog( $blog_id );
302
+		foreach ($blogids as $blog_id) {
303
+			switch_to_blog($blog_id);
304 304
 			lsx_projects_scporder_uninstall_db();
305 305
 		}
306 306
 
307
-		switch_to_blog( $curr_blog );
307
+		switch_to_blog($curr_blog);
308 308
 	} else {
309 309
 		lsx_projects_scporder_uninstall_db();
310 310
 	}
311 311
 }
312 312
 
313 313
 function lsx_projects_scporder_uninstall_db() {
314
-	delete_option( 'lsx_projects_scporder_install' );
314
+	delete_option('lsx_projects_scporder_install');
315 315
 }
Please login to merge, or discard this patch.
templates/single-projects.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 <?php lsx_content_wrap_before(); ?>
11 11
 
12
-<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
12
+<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>">
13 13
 
14 14
 	<?php lsx_content_before(); ?>
15 15
 
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 
18 18
 		<?php lsx_content_top(); ?>
19 19
 
20
-		<?php if ( have_posts() ) : ?>
20
+		<?php if (have_posts()) : ?>
21 21
 
22
-			<?php while ( have_posts() ) : the_post(); ?>
22
+			<?php while (have_posts()) : the_post(); ?>
23 23
 
24
-				<?php include( LSX_PROJECTS_PATH . '/templates/content-single-projects.php' ); ?>
24
+				<?php include(LSX_PROJECTS_PATH . '/templates/content-single-projects.php'); ?>
25 25
 
26 26
 			<?php endwhile; ?>
27 27
 
Please login to merge, or discard this patch.
templates/archive-projects.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 <?php lsx_content_wrap_before(); ?>
11 11
 
12
-<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
12
+<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>">
13 13
 
14 14
 	<?php lsx_content_before(); ?>
15 15
 
@@ -23,33 +23,33 @@  discard block
 block discarded – undo
23 23
 				'hide_empty' => false,
24 24
 			);
25 25
 
26
-			$groups = get_terms( $args );
27
-			$group_selected = get_query_var( 'project-group' );
26
+			$groups = get_terms($args);
27
+			$group_selected = get_query_var('project-group');
28 28
 
29
-			if ( count( $groups ) > 0 ) :
29
+			if (count($groups) > 0) :
30 30
 			?>
31 31
 
32 32
 			<ul class="nav nav-tabs lsx-projects-filter">
33 33
 				<?php
34 34
 					$group_selected_class = '';
35 35
 
36
-					if ( empty( $group_selected ) ) {
36
+					if (empty($group_selected)) {
37 37
 						$group_selected_class = ' class="active"';
38 38
 					}
39 39
 				?>
40 40
 
41
-				<li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'project' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-projects' ); ?></a></li>
41
+				<li<?php echo wp_kses_post($group_selected_class); ?>><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_post_type_archive_link('project')); ?>" data-filter="*"><?php esc_html_e('All', 'lsx-projects'); ?></a></li>
42 42
 
43
-				<?php foreach ( $groups as $group ) : ?>
43
+				<?php foreach ($groups as $group) : ?>
44 44
 					<?php
45 45
 						$group_selected_class = '';
46 46
 
47
-						if ( (string) $group_selected === (string) $group->slug ) {
47
+						if ((string) $group_selected === (string) $group->slug) {
48 48
 							$group_selected_class = ' class="active"';
49 49
 						}
50 50
 					?>
51 51
 
52
-					<li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_term_link( $group ) ); ?>" data-filter=".filter-<?php echo esc_attr( $group->slug ); ?>"><?php echo esc_attr( $group->name ); ?></a></li>
52
+					<li<?php echo wp_kses_post($group_selected_class); ?>><a href="<?php echo empty($group_selected) ? '#' : esc_url(get_term_link($group)); ?>" data-filter=".filter-<?php echo esc_attr($group->slug); ?>"><?php echo esc_attr($group->name); ?></a></li>
53 53
 				<?php endforeach; ?>
54 54
 			</ul>
55 55
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			endif;
58 58
 		?>
59 59
 
60
-		<?php if ( have_posts() ) : ?>
60
+		<?php if (have_posts()) : ?>
61 61
 
62 62
 			<div class="lsx-projects-container">
63 63
 				<div class="row row-flex lsx-projects-row"">
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 					<?php
66 66
 						$count = 0;
67 67
 
68
-						while ( have_posts() ) {
68
+						while (have_posts()) {
69 69
 							the_post();
70
-							include( LSX_PROJECTS_PATH . '/templates/content-archive-projects.php' );
70
+							include(LSX_PROJECTS_PATH . '/templates/content-archive-projects.php');
71 71
 						}
72 72
 					?>
73 73
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		<?php else : ?>
80 80
 
81
-			<?php get_template_part( 'partials/content', 'none' ); ?>
81
+			<?php get_template_part('partials/content', 'none'); ?>
82 82
 
83 83
 		<?php endif; ?>
84 84
 
Please login to merge, or discard this patch.
classes/class-lsx-projects-widget.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 			'classname' => 'lsx-projects',
16 16
 		);
17 17
 
18
-		parent::__construct( 'LSX_Projects_Widget', esc_html__( 'LSX Projects', 'lsx-projects' ), $widget_ops );
18
+		parent::__construct('LSX_Projects_Widget', esc_html__('LSX Projects', 'lsx-projects'), $widget_ops);
19 19
 	}
20 20
 
21
-	function widget( $args, $instance ) {
22
-		extract( $args );
21
+	function widget($args, $instance) {
22
+		extract($args);
23 23
 
24 24
 		$title = $instance['title'];
25 25
 		$title_link = $instance['title_link'];
@@ -38,40 +38,40 @@  discard block
 block discarded – undo
38 38
 		$featured = $instance['featured'];
39 39
 
40 40
 		// If limit not set, display 99 posts
41
-		if ( empty( $limit ) ) {
41
+		if (empty($limit)) {
42 42
 			$limit = '99';
43 43
 		}
44 44
 
45 45
 		// If specific posts included, display 99 posts
46
-		if ( ! empty( $include ) ) {
46
+		if ( ! empty($include)) {
47 47
 			$limit = '99';
48 48
 		}
49 49
 
50
-		if ( '1' == $responsive ) {
50
+		if ('1' == $responsive) {
51 51
 			$responsive = 'true';
52 52
 		} else {
53 53
 			$responsive = 'false';
54 54
 		}
55 55
 
56
-		if ( '1' == $show_image ) {
56
+		if ('1' == $show_image) {
57 57
 			$show_image = 'true';
58 58
 		} else {
59 59
 			$show_image = 'false';
60 60
 		}
61 61
 
62
-		if ( '1' == $carousel ) {
62
+		if ('1' == $carousel) {
63 63
 			$carousel = 'true';
64 64
 		} else {
65 65
 			$carousel = 'false';
66 66
 		}
67 67
 
68
-		if ( '1' == $featured ) {
68
+		if ('1' == $featured) {
69 69
 			$featured = 'true';
70 70
 		} else {
71 71
 			$featured = 'false';
72 72
 		}
73 73
 
74
-		if ( $title_link ) {
74
+		if ($title_link) {
75 75
 			//$link_open = '<a href="' . $title_link . '">';
76 76
 			$link_open = '';
77 77
 			$link_btn_open = '<a href="' . $title_link . '" class="btn border-btn">';
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 			$link_btn_close = '';
86 86
 		}
87 87
 
88
-		echo wp_kses_post( $before_widget );
88
+		echo wp_kses_post($before_widget);
89 89
 
90
-		if ( $title ) {
91
-			echo wp_kses_post( $before_title . $link_open . $title . $link_close . $after_title );
90
+		if ($title) {
91
+			echo wp_kses_post($before_title . $link_open . $title . $link_close . $after_title);
92 92
 		}
93 93
 
94
-		if ( $tagline ) {
95
-			echo '<p class="tagline text-center">' . esc_html( $tagline ) . '</p>';
94
+		if ($tagline) {
95
+			echo '<p class="tagline text-center">' . esc_html($tagline) . '</p>';
96 96
 		}
97 97
 
98
-		if ( class_exists( 'LSX_Projects' ) ) {
99
-			lsx_projects( array(
98
+		if (class_exists('LSX_Projects')) {
99
+			lsx_projects(array(
100 100
 				'columns' => $columns,
101 101
 				'orderby' => $orderby,
102 102
 				'order' => $order,
@@ -108,39 +108,39 @@  discard block
 block discarded – undo
108 108
 				'show_image' => $show_image,
109 109
 				'carousel' => $carousel,
110 110
 				'featured' => $featured,
111
-			) );
111
+			));
112 112
 		};
113 113
 
114
-		if ( $button_text && $title_link ) {
115
-			echo wp_kses_post( '<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>' );
114
+		if ($button_text && $title_link) {
115
+			echo wp_kses_post('<p class="text-center lsx-projects-archive-link-wrap"><span class="lsx-projects-archive-link">' . $link_btn_open . $button_text . ' <i class="fa fa-angle-right"></i>' . $link_btn_close . '</span></p>');
116 116
 		}
117 117
 
118
-		echo wp_kses_post( $after_widget );
118
+		echo wp_kses_post($after_widget);
119 119
 	}
120 120
 
121
-	function update( $new_instance, $old_instance ) {
121
+	function update($new_instance, $old_instance) {
122 122
 		$instance = $old_instance;
123 123
 
124
-		$instance['title'] = wp_kses_post( force_balance_tags( $new_instance['title'] ) );
125
-		$instance['title_link'] = strip_tags( $new_instance['title_link'] );
126
-		$instance['tagline'] = wp_kses_post( force_balance_tags( $new_instance['tagline'] ) );
127
-		$instance['columns'] = strip_tags( $new_instance['columns'] );
128
-		$instance['orderby'] = strip_tags( $new_instance['orderby'] );
129
-		$instance['order'] = strip_tags( $new_instance['order'] );
130
-		$instance['limit'] = strip_tags( $new_instance['limit'] );
131
-		$instance['include'] = strip_tags( $new_instance['include'] );
132
-		$instance['display'] = strip_tags( $new_instance['display'] );
133
-		$instance['size'] = strip_tags( $new_instance['size'] );
134
-		$instance['button_text'] = strip_tags( $new_instance['button_text'] );
135
-		$instance['responsive'] = strip_tags( $new_instance['responsive'] );
136
-		$instance['show_image'] = strip_tags( $new_instance['show_image'] );
137
-		$instance['carousel'] = strip_tags( $new_instance['carousel'] );
138
-		$instance['featured'] = strip_tags( $new_instance['featured'] );
124
+		$instance['title'] = wp_kses_post(force_balance_tags($new_instance['title']));
125
+		$instance['title_link'] = strip_tags($new_instance['title_link']);
126
+		$instance['tagline'] = wp_kses_post(force_balance_tags($new_instance['tagline']));
127
+		$instance['columns'] = strip_tags($new_instance['columns']);
128
+		$instance['orderby'] = strip_tags($new_instance['orderby']);
129
+		$instance['order'] = strip_tags($new_instance['order']);
130
+		$instance['limit'] = strip_tags($new_instance['limit']);
131
+		$instance['include'] = strip_tags($new_instance['include']);
132
+		$instance['display'] = strip_tags($new_instance['display']);
133
+		$instance['size'] = strip_tags($new_instance['size']);
134
+		$instance['button_text'] = strip_tags($new_instance['button_text']);
135
+		$instance['responsive'] = strip_tags($new_instance['responsive']);
136
+		$instance['show_image'] = strip_tags($new_instance['show_image']);
137
+		$instance['carousel'] = strip_tags($new_instance['carousel']);
138
+		$instance['featured'] = strip_tags($new_instance['featured']);
139 139
 
140 140
 		return $instance;
141 141
 	}
142 142
 
143
-	function form( $instance ) {
143
+	function form($instance) {
144 144
 		$defaults = array(
145 145
 			'title' => 'Projects',
146 146
 			'title_link' => '',
@@ -159,134 +159,134 @@  discard block
 block discarded – undo
159 159
 			'featured' => 0,
160 160
 		);
161 161
 
162
-		$instance = wp_parse_args( (array) $instance, $defaults );
162
+		$instance = wp_parse_args((array) $instance, $defaults);
163 163
 
164
-		$title          = esc_attr( $instance['title'] );
165
-		$title_link     = esc_attr( $instance['title_link'] );
166
-		$tagline        = esc_attr( $instance['tagline'] );
167
-		$columns        = esc_attr( $instance['columns'] );
168
-		$orderby        = esc_attr( $instance['orderby'] );
169
-		$order          = esc_attr( $instance['order'] );
170
-		$limit          = esc_attr( $instance['limit'] );
171
-		$include        = esc_attr( $instance['include'] );
172
-		$display        = esc_attr( $instance['display'] );
173
-		$size           = esc_attr( $instance['size'] );
174
-		$button_text    = esc_attr( $instance['button_text'] );
175
-		$responsive     = esc_attr( $instance['responsive'] );
176
-		$show_image     = esc_attr( $instance['show_image'] );
177
-		$carousel       = esc_attr( $instance['carousel'] );
178
-		$featured       = esc_attr( $instance['featured'] );
164
+		$title          = esc_attr($instance['title']);
165
+		$title_link     = esc_attr($instance['title_link']);
166
+		$tagline        = esc_attr($instance['tagline']);
167
+		$columns        = esc_attr($instance['columns']);
168
+		$orderby        = esc_attr($instance['orderby']);
169
+		$order          = esc_attr($instance['order']);
170
+		$limit          = esc_attr($instance['limit']);
171
+		$include        = esc_attr($instance['include']);
172
+		$display        = esc_attr($instance['display']);
173
+		$size           = esc_attr($instance['size']);
174
+		$button_text    = esc_attr($instance['button_text']);
175
+		$responsive     = esc_attr($instance['responsive']);
176
+		$show_image     = esc_attr($instance['show_image']);
177
+		$carousel       = esc_attr($instance['carousel']);
178
+		$featured       = esc_attr($instance['featured']);
179 179
 		?>
180 180
 		<p>
181
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'lsx-projects' ); ?></label>
182
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
181
+			<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'lsx-projects'); ?></label>
182
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
183 183
 		</p>
184 184
 		<p>
185
-			<label for="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>"><?php esc_html_e( 'Page Link:', 'lsx-projects' ); ?></label>
186
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title_link' ) ); ?>" type="text" value="<?php echo esc_attr( $title_link ); ?>" />
187
-			<small><?php esc_html_e( 'Link the widget to a page', 'lsx-projects' ); ?></small>
185
+			<label for="<?php echo esc_attr($this->get_field_id('title_link')); ?>"><?php esc_html_e('Page Link:', 'lsx-projects'); ?></label>
186
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title_link')); ?>" name="<?php echo esc_attr($this->get_field_name('title_link')); ?>" type="text" value="<?php echo esc_attr($title_link); ?>" />
187
+			<small><?php esc_html_e('Link the widget to a page', 'lsx-projects'); ?></small>
188 188
 		</p>
189 189
 		<p>
190
-			<label for="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>"><?php esc_html_e( 'Tagline:', 'lsx-projects' ); ?></label>
191
-			<textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr( $this->get_field_id( 'tagline' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'tagline' ) ); ?>"><?php echo esc_html( $tagline ); ?></textarea>
192
-			<small><?php esc_html_e( 'Tagline to display below the widget title', 'lsx-projects' ); ?></small>
190
+			<label for="<?php echo esc_attr($this->get_field_id('tagline')); ?>"><?php esc_html_e('Tagline:', 'lsx-projects'); ?></label>
191
+			<textarea class="widefat" rows="8" cols="20" id="<?php echo esc_attr($this->get_field_id('tagline')); ?>" name="<?php echo esc_attr($this->get_field_name('tagline')); ?>"><?php echo esc_html($tagline); ?></textarea>
192
+			<small><?php esc_html_e('Tagline to display below the widget title', 'lsx-projects'); ?></small>
193 193
 		</p>
194 194
 		<p>
195
-			<label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'lsx-projects' ); ?></label>
196
-			<select name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" class="widefat">
195
+			<label for="<?php echo esc_attr($this->get_field_id('columns')); ?>"><?php esc_html_e('Columns:', 'lsx-projects'); ?></label>
196
+			<select name="<?php echo esc_attr($this->get_field_name('columns')); ?>" id="<?php echo esc_attr($this->get_field_id('columns')); ?>" class="widefat">
197 197
 			<?php
198
-				$options = array( '1', '2', '3', '4' );
198
+				$options = array('1', '2', '3', '4');
199 199
 
200
-				foreach ( $options as $option ) {
201
-					echo '<option value="' . esc_attr( lcfirst( $option ) ) . '" id="' . esc_attr( $option ) . '"', lcfirst( $option ) == $columns ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>';
200
+				foreach ($options as $option) {
201
+					echo '<option value="' . esc_attr(lcfirst($option)) . '" id="' . esc_attr($option) . '"', lcfirst($option) == $columns ? ' selected="selected"' : '', '>', esc_html($option), '</option>';
202 202
 				}
203 203
 			?>
204 204
 			</select>
205 205
 		</p>
206 206
 		<p>
207
-			<label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order By:', 'lsx-projects' ); ?></label>
208
-			<select name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" class="widefat">
207
+			<label for="<?php echo esc_attr($this->get_field_id('orderby')); ?>"><?php esc_html_e('Order By:', 'lsx-projects'); ?></label>
208
+			<select name="<?php echo esc_attr($this->get_field_name('orderby')); ?>" id="<?php echo esc_attr($this->get_field_id('orderby')); ?>" class="widefat">
209 209
 			<?php
210 210
 				$options = array(
211
-					esc_html__( 'None', 'lsx-projects' ) => 'none',
212
-					esc_html__( 'ID', 'lsx-projects' ) => 'ID',
213
-					esc_html__( 'Name', 'lsx-projects' ) => 'name',
214
-					esc_html__( 'Date', 'lsx-projects' ) => 'date',
215
-					esc_html__( 'Modified Date', 'lsx-projects' ) => 'modified',
216
-					esc_html__( 'Random', 'lsx-projects' ) => 'rand',
217
-					esc_html__( 'Menu (WP dashboard order)', 'lsx-projects' ) => 'menu_order',
211
+					esc_html__('None', 'lsx-projects') => 'none',
212
+					esc_html__('ID', 'lsx-projects') => 'ID',
213
+					esc_html__('Name', 'lsx-projects') => 'name',
214
+					esc_html__('Date', 'lsx-projects') => 'date',
215
+					esc_html__('Modified Date', 'lsx-projects') => 'modified',
216
+					esc_html__('Random', 'lsx-projects') => 'rand',
217
+					esc_html__('Menu (WP dashboard order)', 'lsx-projects') => 'menu_order',
218 218
 				);
219 219
 
220
-				foreach ( $options as $name => $value ) {
221
-					echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>';
220
+				foreach ($options as $name => $value) {
221
+					echo '<option value="' . esc_attr($value) . '" id="' . esc_attr($value) . '"', $orderby == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>';
222 222
 				}
223 223
 			?>
224 224
 			</select>
225 225
 		</p>
226 226
 		<p>
227
-			<label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'lsx-projects' ); ?></label>
228
-			<select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>" class="widefat">
227
+			<label for="<?php echo esc_attr($this->get_field_id('order')); ?>"><?php esc_html_e('Order:', 'lsx-projects'); ?></label>
228
+			<select name="<?php echo esc_attr($this->get_field_name('order')); ?>" id="<?php echo esc_attr($this->get_field_id('order')); ?>" class="widefat">
229 229
 			<?php
230 230
 				$options = array(
231
-					esc_html__( 'Ascending', 'lsx-projects' ) => 'ASC',
232
-					esc_html__( 'Descending', 'lsx-projects' ) => 'DESC',
231
+					esc_html__('Ascending', 'lsx-projects') => 'ASC',
232
+					esc_html__('Descending', 'lsx-projects') => 'DESC',
233 233
 				);
234 234
 
235
-				foreach ( $options as $name => $value ) {
236
-					echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>';
235
+				foreach ($options as $name => $value) {
236
+					echo '<option value="' . esc_attr($value) . '" id="' . esc_attr($value) . '"', $order == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>';
237 237
 				}
238 238
 			?>
239 239
 			</select>
240 240
 		</p>
241 241
 		<p class="limit">
242
-			<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php esc_html_e( 'Maximum amount:', 'lsx-projects' ); ?></label>
243
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'limit' ) ); ?>" type="text" value="<?php echo esc_attr( $limit ); ?>" />
244
-			<small><?php esc_html_e( 'Leave empty to display all', 'lsx-projects' ); ?></small>
242
+			<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php esc_html_e('Maximum amount:', 'lsx-projects'); ?></label>
243
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('limit')); ?>" name="<?php echo esc_attr($this->get_field_name('limit')); ?>" type="text" value="<?php echo esc_attr($limit); ?>" />
244
+			<small><?php esc_html_e('Leave empty to display all', 'lsx-projects'); ?></small>
245 245
 		</p>
246 246
 		<p>
247
-			<label for="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>"><?php esc_html_e( 'Specify Projects by ID:', 'lsx-projects' ); ?></label>
248
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'include' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'include' ) ); ?>" type="text" value="<?php echo esc_attr( $include ); ?>" />
249
-			<small><?php esc_html_e( 'Comma separated list, overrides limit and order settings', 'lsx-projects' ); ?></small>
247
+			<label for="<?php echo esc_attr($this->get_field_id('include')); ?>"><?php esc_html_e('Specify Projects by ID:', 'lsx-projects'); ?></label>
248
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('include')); ?>" name="<?php echo esc_attr($this->get_field_name('include')); ?>" type="text" value="<?php echo esc_attr($include); ?>" />
249
+			<small><?php esc_html_e('Comma separated list, overrides limit and order settings', 'lsx-projects'); ?></small>
250 250
 		</p>
251 251
 		<p>
252
-			<label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display:', 'lsx-projects' ); ?></label>
253
-			<select name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" class="widefat">
252
+			<label for="<?php echo esc_attr($this->get_field_id('display')); ?>"><?php esc_html_e('Display:', 'lsx-projects'); ?></label>
253
+			<select name="<?php echo esc_attr($this->get_field_name('display')); ?>" id="<?php echo esc_attr($this->get_field_id('display')); ?>" class="widefat">
254 254
 			<?php
255 255
 				$options = array(
256
-					esc_html__( 'Excerpt', 'lsx-projects' ) => 'excerpt',
257
-					esc_html__( 'Full Content', 'lsx-projects' ) => 'full',
256
+					esc_html__('Excerpt', 'lsx-projects') => 'excerpt',
257
+					esc_html__('Full Content', 'lsx-projects') => 'full',
258 258
 				);
259 259
 
260
-				foreach ( $options as $name => $value ) {
261
-					echo '<option value="' . esc_attr( $value ) . '" id="' . esc_attr( $value ) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html( $name ), '</option>';
260
+				foreach ($options as $name => $value) {
261
+					echo '<option value="' . esc_attr($value) . '" id="' . esc_attr($value) . '"', $display == $value ? ' selected="selected"' : '', '>', esc_html($name), '</option>';
262 262
 				}
263 263
 			?>
264 264
 			</select>
265 265
 		</p>
266 266
 		<p>
267
-			<label for="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>"><?php esc_html_e( 'Image size:', 'lsx-projects' ); ?></label>
268
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'size' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'size' ) ); ?>" type="text" value="<?php echo esc_attr( $size ); ?>" />
267
+			<label for="<?php echo esc_attr($this->get_field_id('size')); ?>"><?php esc_html_e('Image size:', 'lsx-projects'); ?></label>
268
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('size')); ?>" name="<?php echo esc_attr($this->get_field_name('size')); ?>" type="text" value="<?php echo esc_attr($size); ?>" />
269 269
 		</p>
270 270
 		<p>
271
-			<label for="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>"><?php esc_html_e( 'Button "view all" text:', 'lsx-projects' ); ?></label>
272
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'button_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'button_text' ) ); ?>" type="text" value="<?php echo esc_attr( $button_text ); ?>" />
273
-			<small><?php esc_html_e( 'Leave empty to not display the button', 'lsx-projects' ); ?></small>
271
+			<label for="<?php echo esc_attr($this->get_field_id('button_text')); ?>"><?php esc_html_e('Button "view all" text:', 'lsx-projects'); ?></label>
272
+			<input class="widefat" id="<?php echo esc_attr($this->get_field_id('button_text')); ?>" name="<?php echo esc_attr($this->get_field_name('button_text')); ?>" type="text" value="<?php echo esc_attr($button_text); ?>" />
273
+			<small><?php esc_html_e('Leave empty to not display the button', 'lsx-projects'); ?></small>
274 274
 		</p>
275 275
 		<p>
276
-			<input id="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'show_image' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $show_image ); ?> />
277
-			<label for="<?php echo esc_attr( $this->get_field_id( 'show_image' ) ); ?>"><?php esc_html_e( 'Display Images', 'lsx-projects' ); ?></label>
276
+			<input id="<?php echo esc_attr($this->get_field_id('show_image')); ?>" name="<?php echo esc_attr($this->get_field_name('show_image')); ?>" type="checkbox" value="1" <?php checked('1', $show_image); ?> />
277
+			<label for="<?php echo esc_attr($this->get_field_id('show_image')); ?>"><?php esc_html_e('Display Images', 'lsx-projects'); ?></label>
278 278
 		</p>
279 279
 		<p>
280
-			<input id="<?php echo esc_attr( $this->get_field_id( 'responsive' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'responsive' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $responsive ); ?> />
281
-			<label for="<?php echo esc_attr( $this->get_field_id( 'responsive' ) ); ?>"><?php esc_html_e( 'Responsive Images', 'lsx-projects' ); ?></label>
280
+			<input id="<?php echo esc_attr($this->get_field_id('responsive')); ?>" name="<?php echo esc_attr($this->get_field_name('responsive')); ?>" type="checkbox" value="1" <?php checked('1', $responsive); ?> />
281
+			<label for="<?php echo esc_attr($this->get_field_id('responsive')); ?>"><?php esc_html_e('Responsive Images', 'lsx-projects'); ?></label>
282 282
 		</p>
283 283
 		<p>
284
-			<input id="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'carousel' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $carousel ); ?> />
285
-			<label for="<?php echo esc_attr( $this->get_field_id( 'carousel' ) ); ?>"><?php esc_html_e( 'Carousel', 'lsx-projects' ); ?></label>
284
+			<input id="<?php echo esc_attr($this->get_field_id('carousel')); ?>" name="<?php echo esc_attr($this->get_field_name('carousel')); ?>" type="checkbox" value="1" <?php checked('1', $carousel); ?> />
285
+			<label for="<?php echo esc_attr($this->get_field_id('carousel')); ?>"><?php esc_html_e('Carousel', 'lsx-projects'); ?></label>
286 286
 		</p>
287 287
 		<p>
288
-			<input id="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'featured' ) ); ?>" type="checkbox" value="1" <?php checked( '1', $featured ); ?> />
289
-			<label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured posts', 'lsx-projects' ); ?></label>
288
+			<input id="<?php echo esc_attr($this->get_field_id('featured')); ?>" name="<?php echo esc_attr($this->get_field_name('featured')); ?>" type="checkbox" value="1" <?php checked('1', $featured); ?> />
289
+			<label for="<?php echo esc_attr($this->get_field_id('featured')); ?>"><?php esc_html_e('Featured posts', 'lsx-projects'); ?></label>
290 290
 		</p>
291 291
 		<?php
292 292
 	}
@@ -294,6 +294,6 @@  discard block
 block discarded – undo
294 294
 }
295 295
 
296 296
 function lsx_projects_register_widget() {
297
-	return register_widget( 'LSX_Projects_Widget' );
297
+	return register_widget('LSX_Projects_Widget');
298 298
 }
299
-add_action( 'widgets_init', 'lsx_projects_register_widget' );
299
+add_action('widgets_init', 'lsx_projects_register_widget');
Please login to merge, or discard this patch.
lsx-projects.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
 // If this file is called directly, abort.
16
-if ( ! defined( 'WPINC' ) ) {
16
+if ( ! defined('WPINC')) {
17 17
 	die;
18 18
 }
19 19
 
20
-define( 'LSX_PROJECTS_PATH', plugin_dir_path( __FILE__ ) );
21
-define( 'LSX_PROJECTS_CORE', __FILE__ );
22
-define( 'LSX_PROJECTS_URL', plugin_dir_url( __FILE__ ) );
23
-define( 'LSX_PROJECTS_VER', '1.1.3' );
20
+define('LSX_PROJECTS_PATH', plugin_dir_path(__FILE__));
21
+define('LSX_PROJECTS_CORE', __FILE__);
22
+define('LSX_PROJECTS_URL', plugin_dir_url(__FILE__));
23
+define('LSX_PROJECTS_VER', '1.1.3');
24 24
 
25 25
 /* ======================= Below is the Plugin Class init ========================= */
26 26
 
Please login to merge, or discard this patch.
vendor/CMB2/init.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-if ( ! class_exists( 'CMB2_Bootstrap_270', false ) ) {
7
+if ( ! class_exists('CMB2_Bootstrap_270', false)) {
8 8
 
9 9
 	class CMB2_Bootstrap_270 {
10 10
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		 * @return CMB2_Bootstrap_270 Single instance object
40 40
 		 */
41 41
 		public static function initiate() {
42
-			if ( null === self::$single_instance ) {
42
+			if (null === self::$single_instance) {
43 43
 				self::$single_instance = new self();
44 44
 			}
45 45
 			return self::$single_instance;
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 			 * A constant you can use to check if CMB2 is loaded
60 60
 			 * for your plugins/themes with CMB2 dependency
61 61
 			 */
62
-			if ( ! defined( 'CMB2_LOADED' ) ) {
63
-				define( 'CMB2_LOADED', self::PRIORITY );
62
+			if ( ! defined('CMB2_LOADED')) {
63
+				define('CMB2_LOADED', self::PRIORITY);
64 64
 			}
65 65
 
66
-			if ( ! function_exists( 'add_action' ) ) {
66
+			if ( ! function_exists('add_action')) {
67 67
 				// We are running outside of the context of WordPress.
68 68
 				return;
69 69
 			}
70
-			add_action( 'init', array( $this, 'include_cmb' ), self::PRIORITY );
70
+			add_action('init', array($this, 'include_cmb'), self::PRIORITY);
71 71
 		}
72 72
 
73 73
 		/**
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 		 * @since  2.0.0
78 78
 		 */
79 79
 		public function include_cmb() {
80
-			if ( class_exists( 'CMB2', false ) ) {
80
+			if (class_exists('CMB2', false)) {
81 81
 				return;
82 82
 			}
83 83
 
84
-			if ( ! defined( 'CMB2_VERSION' ) ) {
85
-				define( 'CMB2_VERSION', self::VERSION );
84
+			if ( ! defined('CMB2_VERSION')) {
85
+				define('CMB2_VERSION', self::VERSION);
86 86
 			}
87 87
 
88
-			if ( ! defined( 'CMB2_DIR' ) ) {
89
-				define( 'CMB2_DIR', trailingslashit( dirname( __FILE__ ) ) );
88
+			if ( ! defined('CMB2_DIR')) {
89
+				define('CMB2_DIR', trailingslashit(dirname(__FILE__)));
90 90
 			}
91 91
 
92 92
 			$this->l10ni18n();
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 			require_once CMB2_DIR . 'includes/helper-functions.php';
98 98
 
99 99
 			// Now kick off the class autoloader.
100
-			spl_autoload_register( 'cmb2_autoload_classes' );
100
+			spl_autoload_register('cmb2_autoload_classes');
101 101
 
102 102
 			// Kick the whole thing off.
103
-			require_once( cmb2_dir( 'bootstrap.php' ) );
103
+			require_once(cmb2_dir('bootstrap.php'));
104 104
 			cmb2_bootstrap();
105 105
 		}
106 106
 
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
 		 */
112 112
 		public function l10ni18n() {
113 113
 
114
-			$loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' );
114
+			$loaded = load_plugin_textdomain('cmb2', false, '/languages/');
115 115
 
116
-			if ( ! $loaded ) {
117
-				$loaded = load_muplugin_textdomain( 'cmb2', '/languages/' );
116
+			if ( ! $loaded) {
117
+				$loaded = load_muplugin_textdomain('cmb2', '/languages/');
118 118
 			}
119 119
 
120
-			if ( ! $loaded ) {
121
-				$loaded = load_theme_textdomain( 'cmb2', get_stylesheet_directory() . '/languages/' );
120
+			if ( ! $loaded) {
121
+				$loaded = load_theme_textdomain('cmb2', get_stylesheet_directory() . '/languages/');
122 122
 			}
123 123
 
124
-			if ( ! $loaded ) {
125
-				$locale = apply_filters( 'plugin_locale', function_exists( 'determine_locale' ) ? determine_locale() : get_locale(), 'cmb2' );
126
-				$mofile = dirname( __FILE__ ) . '/languages/cmb2-' . $locale . '.mo';
127
-				load_textdomain( 'cmb2', $mofile );
124
+			if ( ! $loaded) {
125
+				$locale = apply_filters('plugin_locale', function_exists('determine_locale') ? determine_locale() : get_locale(), 'cmb2');
126
+				$mofile = dirname(__FILE__) . '/languages/cmb2-' . $locale . '.mo';
127
+				load_textdomain('cmb2', $mofile);
128 128
 			}
129 129
 
130 130
 		}
Please login to merge, or discard this patch.
vendor/CMB2/includes/rest-api/CMB2_REST_Controller_Boxes.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @since 2.2.3
37 37
 	 */
38
-	public function __construct( WP_REST_Server $wp_rest_server ) {
38
+	public function __construct(WP_REST_Server $wp_rest_server) {
39 39
 		$this->namespace_base = $this->namespace . '/' . $this->rest_base;
40
-		parent::__construct( $wp_rest_server );
40
+		parent::__construct($wp_rest_server);
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	public function register_routes() {
49 49
 		$args = array(
50 50
 			'_embed' => array(
51
-				'description' => __( 'Includes the registered fields for the box in the response.', 'cmb2' ),
51
+				'description' => __('Includes the registered fields for the box in the response.', 'cmb2'),
52 52
 			),
53 53
 		);
54 54
 
@@ -58,30 +58,30 @@  discard block
 block discarded – undo
58 58
 		// $args['context']['default'] = 'view';
59 59
 		// $args['context']['enum'] = array( 'view', 'embed' );
60 60
 		// Returns all boxes data.
61
-		register_rest_route( $this->namespace, '/' . $this->rest_base, array(
61
+		register_rest_route($this->namespace, '/' . $this->rest_base, array(
62 62
 			array(
63 63
 				'methods'             => WP_REST_Server::READABLE,
64
-				'permission_callback' => array( $this, 'get_items_permissions_check' ),
65
-				'callback'            => array( $this, 'get_items' ),
64
+				'permission_callback' => array($this, 'get_items_permissions_check'),
65
+				'callback'            => array($this, 'get_items'),
66 66
 				'args'                => $args,
67 67
 			),
68
-			'schema' => array( $this, 'get_item_schema' ),
69
-		) );
68
+			'schema' => array($this, 'get_item_schema'),
69
+		));
70 70
 
71 71
 		$args['_rendered'] = array(
72
-			'description' => __( 'Includes the fully rendered attributes, \'form_open\', \'form_close\', as well as the enqueued \'js_dependencies\' script handles, and \'css_dependencies\' stylesheet handles.', 'cmb2' ),
72
+			'description' => __('Includes the fully rendered attributes, \'form_open\', \'form_close\', as well as the enqueued \'js_dependencies\' script handles, and \'css_dependencies\' stylesheet handles.', 'cmb2'),
73 73
 		);
74 74
 
75 75
 		// Returns specific box's data.
76
-		register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)', array(
76
+		register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)', array(
77 77
 			array(
78 78
 				'methods'             => WP_REST_Server::READABLE,
79
-				'permission_callback' => array( $this, 'get_item_permissions_check' ),
80
-				'callback'            => array( $this, 'get_item' ),
79
+				'permission_callback' => array($this, 'get_item_permissions_check'),
80
+				'callback'            => array($this, 'get_item'),
81 81
 				'args'                => $args,
82 82
 			),
83
-			'schema' => array( $this, 'get_item_schema' ),
84
-		) );
83
+			'schema' => array($this, 'get_item_schema'),
84
+		));
85 85
 	}
86 86
 
87 87
 	/**
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param  WP_REST_Request $request Full data about the request.
93 93
 	 * @return WP_Error|boolean
94 94
 	 */
95
-	public function get_items_permissions_check( $request ) {
96
-		$this->initiate_request( $request, __FUNCTION__ );
95
+	public function get_items_permissions_check($request) {
96
+		$this->initiate_request($request, __FUNCTION__);
97 97
 
98 98
 		/**
99 99
 		 * By default, no special permissions needed.
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 * @param bool   $can_access Whether this CMB2 endpoint can be accessed.
104 104
 		 * @param object $controller This CMB2_REST_Controller object.
105 105
 		 */
106
-		return apply_filters( 'cmb2_api_get_boxes_permissions_check', true, $this );
106
+		return apply_filters('cmb2_api_get_boxes_permissions_check', true, $this);
107 107
 	}
108 108
 
109 109
 	/**
@@ -114,34 +114,34 @@  discard block
 block discarded – undo
114 114
 	 * @param  WP_REST_Request $request Full data about the request.
115 115
 	 * @return WP_Error|WP_REST_Response
116 116
 	 */
117
-	public function get_items( $request ) {
118
-		$this->initiate_request( $request, 'boxes_read' );
117
+	public function get_items($request) {
118
+		$this->initiate_request($request, 'boxes_read');
119 119
 
120 120
 		$boxes = CMB2_REST::get_all();
121
-		if ( empty( $boxes ) ) {
122
-			return new WP_Error( 'cmb2_rest_no_boxes', __( 'No boxes found.', 'cmb2' ), array(
121
+		if (empty($boxes)) {
122
+			return new WP_Error('cmb2_rest_no_boxes', __('No boxes found.', 'cmb2'), array(
123 123
 				'status' => 403,
124
-			) );
124
+			));
125 125
 		}
126 126
 
127 127
 		$boxes_data = array();
128 128
 
129 129
 		// Loop and prepare boxes data.
130
-		foreach ( $boxes as $this->rest_box ) {
130
+		foreach ($boxes as $this->rest_box) {
131 131
 			if (
132 132
 				// Make sure this box can be read
133 133
 				$this->rest_box->rest_read
134 134
 				// And make sure current user can view this box.
135
-				&& $this->get_item_permissions_check_filter( $this->request )
135
+				&& $this->get_item_permissions_check_filter($this->request)
136 136
 			) {
137 137
 				$boxes_data[] = $this->server->response_to_data(
138 138
 					$this->get_rest_box(),
139
-					isset( $this->request['_embed'] )
139
+					isset($this->request['_embed'])
140 140
 				);
141 141
 			}
142 142
 		}
143 143
 
144
-		return $this->prepare_item( $boxes_data );
144
+		return $this->prepare_item($boxes_data);
145 145
 	}
146 146
 
147 147
 	/**
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param  WP_REST_Request $request Full details about the request.
154 154
 	 * @return WP_Error|boolean
155 155
 	 */
156
-	public function get_item_permissions_check( $request ) {
157
-		$this->initiate_rest_read_box( $request, 'box_read' );
156
+	public function get_item_permissions_check($request) {
157
+		$this->initiate_rest_read_box($request, 'box_read');
158 158
 
159 159
 		return $this->get_item_permissions_check_filter();
160 160
 	}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param  bool $can_access Whether the current request has access to view the box by default.
169 169
 	 * @return WP_Error|boolean
170 170
 	 */
171
-	public function get_item_permissions_check_filter( $can_access = true ) {
171
+	public function get_item_permissions_check_filter($can_access = true) {
172 172
 		/**
173 173
 		 * By default, no special permissions needed.
174 174
 		 *
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		 * @param bool   $can_access Whether this CMB2 endpoint can be accessed.
178 178
 		 * @param object $controller This CMB2_REST_Controller object.
179 179
 		 */
180
-		return $this->maybe_hook_callback_and_apply_filters( 'cmb2_api_get_box_permissions_check', $can_access );
180
+		return $this->maybe_hook_callback_and_apply_filters('cmb2_api_get_box_permissions_check', $can_access);
181 181
 	}
182 182
 
183 183
 	/**
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
 	 * @param  WP_REST_Request $request Full data about the request.
189 189
 	 * @return WP_Error|WP_REST_Response
190 190
 	 */
191
-	public function get_item( $request ) {
192
-		$this->initiate_rest_read_box( $request, 'box_read' );
191
+	public function get_item($request) {
192
+		$this->initiate_rest_read_box($request, 'box_read');
193 193
 
194
-		if ( is_wp_error( $this->rest_box ) ) {
194
+		if (is_wp_error($this->rest_box)) {
195 195
 			return $this->rest_box;
196 196
 		}
197 197
 
198
-		return $this->prepare_item( $this->get_rest_box() );
198
+		return $this->prepare_item($this->get_rest_box());
199 199
 	}
200 200
 
201 201
 	/**
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$boxes_data = $cmb->meta_box;
212 212
 
213
-		if ( isset( $this->request['_rendered'] ) && $this->namespace_base !== ltrim( CMB2_REST_Controller::get_intial_route(), '/' ) ) {
214
-			$boxes_data['form_open'] = $this->get_cb_results( array( $cmb, 'render_form_open' ) );
215
-			$boxes_data['form_close'] = $this->get_cb_results( array( $cmb, 'render_form_close' ) );
213
+		if (isset($this->request['_rendered']) && $this->namespace_base !== ltrim(CMB2_REST_Controller::get_intial_route(), '/')) {
214
+			$boxes_data['form_open'] = $this->get_cb_results(array($cmb, 'render_form_open'));
215
+			$boxes_data['form_close'] = $this->get_cb_results(array($cmb, 'render_form_close'));
216 216
 
217 217
 			global $wp_scripts, $wp_styles;
218 218
 			$before_css = $wp_styles->queue;
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 
221 221
 			CMB2_JS::enqueue();
222 222
 
223
-			$boxes_data['js_dependencies'] = array_values( array_diff( $wp_scripts->queue, $before_js ) );
224
-			$boxes_data['css_dependencies'] = array_values( array_diff( $wp_styles->queue, $before_css ) );
223
+			$boxes_data['js_dependencies'] = array_values(array_diff($wp_scripts->queue, $before_js));
224
+			$boxes_data['css_dependencies'] = array_values(array_diff($wp_styles->queue, $before_css));
225 225
 		}
226 226
 
227 227
 		// TODO: look into 'embed' parameter.
228 228
 		// http://demo.wp-api.org/wp-json/wp/v2/posts?_embed
229
-		unset( $boxes_data['fields'] );
229
+		unset($boxes_data['fields']);
230 230
 		// Handle callable properties.
231
-		unset( $boxes_data['show_on_cb'] );
231
+		unset($boxes_data['show_on_cb']);
232 232
 
233
-		$response = rest_ensure_response( $boxes_data );
233
+		$response = rest_ensure_response($boxes_data);
234 234
 
235
-		$response->add_links( $this->prepare_links( $cmb ) );
235
+		$response->add_links($this->prepare_links($cmb));
236 236
 
237 237
 		return $response;
238 238
 	}
@@ -246,22 +246,22 @@  discard block
 block discarded – undo
246 246
 	 *
247 247
 	 * @return array          Array of links
248 248
 	 */
249
-	protected function prepare_links( $cmb ) {
249
+	protected function prepare_links($cmb) {
250 250
 		$boxbase      = $this->namespace_base . '/' . $cmb->cmb_id;
251 251
 		$query_string = $this->get_query_string();
252 252
 
253 253
 		return array(
254 254
 			// Standard Link Relations -- http://v2.wp-api.org/extending/linking/
255 255
 			'self' => array(
256
-				'href' => rest_url( $boxbase . $query_string ),
256
+				'href' => rest_url($boxbase . $query_string),
257 257
 			),
258 258
 			'collection' => array(
259
-				'href' => rest_url( $this->namespace_base . $query_string ),
259
+				'href' => rest_url($this->namespace_base . $query_string),
260 260
 			),
261 261
 			// Custom Link Relations -- http://v2.wp-api.org/extending/linking/
262 262
 			// TODO URL should document relationship.
263 263
 			'https://cmb2.io/fields' => array(
264
-				'href' => rest_url( trailingslashit( $boxbase ) . 'fields' . $query_string ),
264
+				'href' => rest_url(trailingslashit($boxbase) . 'fields' . $query_string),
265 265
 				'embeddable' => true,
266 266
 			),
267 267
 		);
Please login to merge, or discard this patch.
vendor/CMB2/includes/rest-api/CMB2_REST_Controller_Fields.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -24,57 +24,57 @@  discard block
 block discarded – undo
24 24
 	public function register_routes() {
25 25
 		$args = array(
26 26
 			'_embed' => array(
27
-				'description' => __( 'Includes the box object which the fields are registered to in the response.', 'cmb2' ),
27
+				'description' => __('Includes the box object which the fields are registered to in the response.', 'cmb2'),
28 28
 			),
29 29
 			'_rendered' => array(
30
-				'description' => __( 'When the \'_rendered\' argument is passed, the renderable field attributes will be returned fully rendered. By default, the names of the callback handers for the renderable attributes will be returned.', 'cmb2' ),
30
+				'description' => __('When the \'_rendered\' argument is passed, the renderable field attributes will be returned fully rendered. By default, the names of the callback handers for the renderable attributes will be returned.', 'cmb2'),
31 31
 			),
32 32
 			'object_id' => array(
33
-				'description' => __( 'To view or modify the field\'s value, the \'object_id\' and \'object_type\' arguments are required.', 'cmb2' ),
33
+				'description' => __('To view or modify the field\'s value, the \'object_id\' and \'object_type\' arguments are required.', 'cmb2'),
34 34
 			),
35 35
 			'object_type' => array(
36
-				'description' => __( 'To view or modify the field\'s value, the \'object_id\' and \'object_type\' arguments are required.', 'cmb2' ),
36
+				'description' => __('To view or modify the field\'s value, the \'object_id\' and \'object_type\' arguments are required.', 'cmb2'),
37 37
 			),
38 38
 		);
39 39
 
40 40
 		// Returns specific box's fields.
41
-		register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)/fields/', array(
41
+		register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)/fields/', array(
42 42
 			array(
43 43
 				'methods'             => WP_REST_Server::READABLE,
44
-				'permission_callback' => array( $this, 'get_items_permissions_check' ),
45
-				'callback'            => array( $this, 'get_items' ),
44
+				'permission_callback' => array($this, 'get_items_permissions_check'),
45
+				'callback'            => array($this, 'get_items'),
46 46
 				'args'                => $args,
47 47
 			),
48
-			'schema' => array( $this, 'get_item_schema' ),
49
-		) );
48
+			'schema' => array($this, 'get_item_schema'),
49
+		));
50 50
 
51 51
 		$delete_args = $args;
52 52
 		$delete_args['object_id']['required'] = true;
53 53
 		$delete_args['object_type']['required'] = true;
54 54
 
55 55
 		// Returns specific field data.
56
-		register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)/fields/(?P<field_id>[\w-]+)', array(
56
+		register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)/fields/(?P<field_id>[\w-]+)', array(
57 57
 			array(
58 58
 				'methods'             => WP_REST_Server::READABLE,
59
-				'permission_callback' => array( $this, 'get_item_permissions_check' ),
60
-				'callback'            => array( $this, 'get_item' ),
59
+				'permission_callback' => array($this, 'get_item_permissions_check'),
60
+				'callback'            => array($this, 'get_item'),
61 61
 				'args'                => $args,
62 62
 			),
63 63
 			array(
64 64
 				'methods'             => WP_REST_Server::EDITABLE,
65
-				'permission_callback' => array( $this, 'update_item_permissions_check' ),
66
-				'callback'            => array( $this, 'update_item' ),
67
-				'args'                => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
65
+				'permission_callback' => array($this, 'update_item_permissions_check'),
66
+				'callback'            => array($this, 'update_item'),
67
+				'args'                => $this->get_endpoint_args_for_item_schema(WP_REST_Server::EDITABLE),
68 68
 				'args'                => $args,
69 69
 			),
70 70
 			array(
71 71
 				'methods'             => WP_REST_Server::DELETABLE,
72
-				'permission_callback' => array( $this, 'delete_item_permissions_check' ),
73
-				'callback'            => array( $this, 'delete_item' ),
72
+				'permission_callback' => array($this, 'delete_item_permissions_check'),
73
+				'callback'            => array($this, 'delete_item'),
74 74
 				'args'                => $delete_args,
75 75
 			),
76
-			'schema' => array( $this, 'get_item_schema' ),
77
-		) );
76
+			'schema' => array($this, 'get_item_schema'),
77
+		));
78 78
 	}
79 79
 
80 80
 	/**
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 * @param  WP_REST_Request $request Full data about the request.
87 87
 	 * @return WP_Error|boolean
88 88
 	 */
89
-	public function get_items_permissions_check( $request ) {
90
-		$this->initiate_rest_read_box( $request, 'fields_read' );
89
+	public function get_items_permissions_check($request) {
90
+		$this->initiate_rest_read_box($request, 'fields_read');
91 91
 		$can_access = true;
92 92
 
93 93
 		/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		 * @param bool   $can_access Whether this CMB2 endpoint can be accessed.
99 99
 		 * @param object $controller This CMB2_REST_Controller object.
100 100
 		 */
101
-		return $this->maybe_hook_callback_and_apply_filters( 'cmb2_api_get_fields_permissions_check', $can_access );
101
+		return $this->maybe_hook_callback_and_apply_filters('cmb2_api_get_fields_permissions_check', $can_access);
102 102
 	}
103 103
 
104 104
 	/**
@@ -109,31 +109,31 @@  discard block
 block discarded – undo
109 109
 	 * @param  WP_REST_Request $request Full data about the request.
110 110
 	 * @return WP_Error|WP_REST_Response
111 111
 	 */
112
-	public function get_items( $request ) {
113
-		if ( ! $this->rest_box ) {
114
-			$this->initiate_rest_read_box( $request, 'fields_read' );
112
+	public function get_items($request) {
113
+		if ( ! $this->rest_box) {
114
+			$this->initiate_rest_read_box($request, 'fields_read');
115 115
 		}
116 116
 
117
-		if ( is_wp_error( $this->rest_box ) ) {
117
+		if (is_wp_error($this->rest_box)) {
118 118
 			return $this->rest_box;
119 119
 		}
120 120
 
121 121
 		$fields = array();
122
-		foreach ( $this->rest_box->cmb->prop( 'fields', array() ) as $field ) {
122
+		foreach ($this->rest_box->cmb->prop('fields', array()) as $field) {
123 123
 
124 124
 			// Make sure this field can be read.
125
-			$this->field = $this->rest_box->field_can_read( $field['id'], true );
125
+			$this->field = $this->rest_box->field_can_read($field['id'], true);
126 126
 
127 127
 			// And make sure current user can view this box.
128
-			if ( $this->field && $this->get_item_permissions_check_filter() ) {
129
-				$fields[ $field['id'] ] = $this->server->response_to_data(
128
+			if ($this->field && $this->get_item_permissions_check_filter()) {
129
+				$fields[$field['id']] = $this->server->response_to_data(
130 130
 					$this->prepare_field_response(),
131
-					isset( $this->request['_embed'] )
131
+					isset($this->request['_embed'])
132 132
 				);
133 133
 			}
134 134
 		}
135 135
 
136
-		return $this->prepare_item( $fields );
136
+		return $this->prepare_item($fields);
137 137
 	}
138 138
 
139 139
 	/**
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 	 * @param  WP_REST_Request $request Full details about the request.
146 146
 	 * @return WP_Error|boolean
147 147
 	 */
148
-	public function get_item_permissions_check( $request ) {
149
-		$this->initiate_rest_read_box( $request, 'field_read' );
150
-		if ( ! is_wp_error( $this->rest_box ) ) {
151
-			$this->field = $this->rest_box->field_can_read( $this->request->get_param( 'field_id' ), true );
148
+	public function get_item_permissions_check($request) {
149
+		$this->initiate_rest_read_box($request, 'field_read');
150
+		if ( ! is_wp_error($this->rest_box)) {
151
+			$this->field = $this->rest_box->field_can_read($this->request->get_param('field_id'), true);
152 152
 		}
153 153
 
154 154
 		return $this->get_item_permissions_check_filter();
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param  bool $can_access Whether the current request has access to view the field by default.
164 164
 	 * @return WP_Error|boolean
165 165
 	 */
166
-	public function get_item_permissions_check_filter( $can_access = true ) {
166
+	public function get_item_permissions_check_filter($can_access = true) {
167 167
 		/**
168 168
 		 * By default, no special permissions needed.
169 169
 		 *
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		 * @param bool   $can_access Whether this CMB2 endpoint can be accessed.
173 173
 		 * @param object $controller This CMB2_REST_Controller object.
174 174
 		 */
175
-		return $this->maybe_hook_callback_and_apply_filters( 'cmb2_api_get_field_permissions_check', $can_access );
175
+		return $this->maybe_hook_callback_and_apply_filters('cmb2_api_get_field_permissions_check', $can_access);
176 176
 	}
177 177
 
178 178
 	/**
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 	 * @param  WP_REST_Request $request Full data about the request.
184 184
 	 * @return WP_Error|WP_REST_Response
185 185
 	 */
186
-	public function get_item( $request ) {
187
-		$this->initiate_rest_read_box( $request, 'field_read' );
186
+	public function get_item($request) {
187
+		$this->initiate_rest_read_box($request, 'field_read');
188 188
 
189
-		if ( is_wp_error( $this->rest_box ) ) {
189
+		if (is_wp_error($this->rest_box)) {
190 190
 			return $this->rest_box;
191 191
 		}
192 192
 
193
-		return $this->prepare_read_field( $this->request->get_param( 'field_id' ) );
193
+		return $this->prepare_read_field($this->request->get_param('field_id'));
194 194
 	}
195 195
 
196 196
 	/**
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 	 * @param  WP_REST_Request $request Full details about the request.
203 203
 	 * @return WP_Error|boolean
204 204
 	 */
205
-	public function update_item_permissions_check( $request ) {
206
-		$this->initiate_rest_read_box( $request, 'field_value_update' );
207
-		if ( ! is_wp_error( $this->rest_box ) ) {
208
-			$this->field = $this->rest_box->field_can_edit( $this->request->get_param( 'field_id' ), true );
205
+	public function update_item_permissions_check($request) {
206
+		$this->initiate_rest_read_box($request, 'field_value_update');
207
+		if ( ! is_wp_error($this->rest_box)) {
208
+			$this->field = $this->rest_box->field_can_edit($this->request->get_param('field_id'), true);
209 209
 		}
210 210
 
211
-		$can_update = current_user_can( 'edit_others_posts' );
211
+		$can_update = current_user_can('edit_others_posts');
212 212
 
213 213
 		/**
214 214
 		 * By default, 'edit_others_posts' is required capability.
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		 * @param bool   $can_update Whether this CMB2 endpoint can be accessed.
219 219
 		 * @param object $controller This CMB2_REST_Controller object.
220 220
 		 */
221
-		return $this->maybe_hook_callback_and_apply_filters( 'cmb2_api_update_field_value_permissions_check', $can_update );
221
+		return $this->maybe_hook_callback_and_apply_filters('cmb2_api_update_field_value_permissions_check', $can_update);
222 222
 	}
223 223
 
224 224
 	/**
@@ -229,16 +229,16 @@  discard block
 block discarded – undo
229 229
 	 * @param  WP_REST_Request $request Full data about the request.
230 230
 	 * @return WP_Error|WP_REST_Response
231 231
 	 */
232
-	public function update_item( $request ) {
233
-		$this->initiate_rest_read_box( $request, 'field_value_update' );
232
+	public function update_item($request) {
233
+		$this->initiate_rest_read_box($request, 'field_value_update');
234 234
 
235
-		if ( ! $this->request['value'] ) {
236
-			return new WP_Error( 'cmb2_rest_update_field_error', __( 'CMB2 Field value cannot be updated without the value parameter specified.', 'cmb2' ), array(
235
+		if ( ! $this->request['value']) {
236
+			return new WP_Error('cmb2_rest_update_field_error', __('CMB2 Field value cannot be updated without the value parameter specified.', 'cmb2'), array(
237 237
 				'status' => 400,
238
-			) );
238
+			));
239 239
 		}
240 240
 
241
-		return $this->modify_field_value( 'updated' );
241
+		return $this->modify_field_value('updated');
242 242
 	}
243 243
 
244 244
 	/**
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 	 * @param  WP_REST_Request $request Full details about the request.
251 251
 	 * @return WP_Error|boolean
252 252
 	 */
253
-	public function delete_item_permissions_check( $request ) {
254
-		$this->initiate_rest_read_box( $request, 'field_value_delete' );
255
-		if ( ! is_wp_error( $this->rest_box ) ) {
256
-			$this->field = $this->rest_box->field_can_edit( $this->request->get_param( 'field_id' ), true );
253
+	public function delete_item_permissions_check($request) {
254
+		$this->initiate_rest_read_box($request, 'field_value_delete');
255
+		if ( ! is_wp_error($this->rest_box)) {
256
+			$this->field = $this->rest_box->field_can_edit($this->request->get_param('field_id'), true);
257 257
 		}
258 258
 
259
-		$can_delete = current_user_can( 'delete_others_posts' );
259
+		$can_delete = current_user_can('delete_others_posts');
260 260
 
261 261
 		/**
262 262
 		 * By default, 'delete_others_posts' is required capability.
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		 * @param bool   $can_delete Whether this CMB2 endpoint can be accessed.
267 267
 		 * @param object $controller This CMB2_REST_Controller object.
268 268
 		 */
269
-		return $this->maybe_hook_callback_and_apply_filters( 'cmb2_api_delete_field_value_permissions_check', $can_delete );
269
+		return $this->maybe_hook_callback_and_apply_filters('cmb2_api_delete_field_value_permissions_check', $can_delete);
270 270
 	}
271 271
 
272 272
 	/**
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
 	 * @param  WP_REST_Request $request Full data about the request.
278 278
 	 * @return WP_Error|WP_REST_Response
279 279
 	 */
280
-	public function delete_item( $request ) {
281
-		$this->initiate_rest_read_box( $request, 'field_value_delete' );
280
+	public function delete_item($request) {
281
+		$this->initiate_rest_read_box($request, 'field_value_delete');
282 282
 
283
-		return $this->modify_field_value( 'deleted' );
283
+		return $this->modify_field_value('deleted');
284 284
 	}
285 285
 
286 286
 	/**
@@ -291,39 +291,39 @@  discard block
 block discarded – undo
291 291
 	 * @param  string $activity The modification activity (updated or deleted).
292 292
 	 * @return WP_Error|WP_REST_Response
293 293
 	 */
294
-	public function modify_field_value( $activity ) {
294
+	public function modify_field_value($activity) {
295 295
 
296
-		if ( ! $this->request['object_id'] || ! $this->request['object_type'] ) {
297
-			return new WP_Error( 'cmb2_rest_modify_field_value_error', __( 'CMB2 Field value cannot be modified without the object_id and object_type parameters specified.', 'cmb2' ), array(
296
+		if ( ! $this->request['object_id'] || ! $this->request['object_type']) {
297
+			return new WP_Error('cmb2_rest_modify_field_value_error', __('CMB2 Field value cannot be modified without the object_id and object_type parameters specified.', 'cmb2'), array(
298 298
 				'status' => 400,
299
-			) );
299
+			));
300 300
 		}
301 301
 
302
-		if ( is_wp_error( $this->rest_box ) ) {
302
+		if (is_wp_error($this->rest_box)) {
303 303
 			return $this->rest_box;
304 304
 		}
305 305
 
306 306
 		$this->field = $this->rest_box->field_can_edit(
307
-			$this->field ? $this->field : $this->request->get_param( 'field_id' ),
307
+			$this->field ? $this->field : $this->request->get_param('field_id'),
308 308
 			true
309 309
 		);
310 310
 
311
-		if ( ! $this->field ) {
312
-			return new WP_Error( 'cmb2_rest_no_field_by_id_error', __( 'No field found by that id.', 'cmb2' ), array(
311
+		if ( ! $this->field) {
312
+			return new WP_Error('cmb2_rest_no_field_by_id_error', __('No field found by that id.', 'cmb2'), array(
313 313
 				'status' => 403,
314
-			) );
314
+			));
315 315
 		}
316 316
 
317
-		$this->field->args[ "value_{$activity}" ] = (bool) 'deleted' === $activity
317
+		$this->field->args["value_{$activity}"] = (bool) 'deleted' === $activity
318 318
 			? $this->field->remove_data()
319
-			: $this->field->save_field( $this->request['value'] );
319
+			: $this->field->save_field($this->request['value']);
320 320
 
321 321
 		// If options page, save the $activity options
322
-		if ( 'options-page' == $this->request['object_type'] ) {
323
-			$this->field->args[ "value_{$activity}" ] = cmb2_options( $this->request['object_id'] )->set();
322
+		if ('options-page' == $this->request['object_type']) {
323
+			$this->field->args["value_{$activity}"] = cmb2_options($this->request['object_id'])->set();
324 324
 		}
325 325
 
326
-		return $this->prepare_read_field( $this->field );
326
+		return $this->prepare_read_field($this->field);
327 327
 	}
328 328
 
329 329
 	/**
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 	 * @param  string\CMB2_Field Field id or Field object.
335 335
 	 * @return WP_Error|WP_REST_Response
336 336
 	 */
337
-	public function prepare_read_field( $field ) {
338
-		$this->field = $this->rest_box->field_can_read( $field, true );
337
+	public function prepare_read_field($field) {
338
+		$this->field = $this->rest_box->field_can_read($field, true);
339 339
 
340
-		if ( ! $this->field ) {
341
-			return new WP_Error( 'cmb2_rest_no_field_by_id_error', __( 'No field found by that id.', 'cmb2' ), array(
340
+		if ( ! $this->field) {
341
+			return new WP_Error('cmb2_rest_no_field_by_id_error', __('No field found by that id.', 'cmb2'), array(
342 342
 				'status' => 403,
343
-			) );
343
+			));
344 344
 		}
345 345
 
346
-		return $this->prepare_item( $this->prepare_field_response() );
346
+		return $this->prepare_item($this->prepare_field_response());
347 347
 	}
348 348
 
349 349
 	/**
@@ -355,10 +355,10 @@  discard block
 block discarded – undo
355 355
 	 * @return array      Response array.
356 356
 	 */
357 357
 	public function prepare_field_response() {
358
-		$field_data = $this->prepare_field_data( $this->field );
359
-		$response = rest_ensure_response( $field_data );
358
+		$field_data = $this->prepare_field_data($this->field);
359
+		$response = rest_ensure_response($field_data);
360 360
 
361
-		$response->add_links( $this->prepare_links( $this->field ) );
361
+		$response->add_links($this->prepare_links($this->field));
362 362
 
363 363
 		return $response;
364 364
 	}
@@ -372,55 +372,55 @@  discard block
 block discarded – undo
372 372
 	 *
373 373
 	 * @return array             Array of field data.
374 374
 	 */
375
-	protected function prepare_field_data( CMB2_Field $field ) {
375
+	protected function prepare_field_data(CMB2_Field $field) {
376 376
 		$field_data = array();
377
-		$params_to_ignore = array( 'show_in_rest', 'options' );
377
+		$params_to_ignore = array('show_in_rest', 'options');
378 378
 		$params_to_rename = array(
379 379
 			'label_cb' => 'label',
380 380
 			'options_cb' => 'options',
381 381
 		);
382 382
 
383 383
 		// Run this first so the js_dependencies arg is populated.
384
-		$rendered = ( $cb = $field->maybe_callback( 'render_row_cb' ) )
384
+		$rendered = ($cb = $field->maybe_callback('render_row_cb'))
385 385
 			// Ok, callback is good, let's run it.
386
-			? $this->get_cb_results( $cb, $field->args(), $field )
386
+			? $this->get_cb_results($cb, $field->args(), $field)
387 387
 			: false;
388 388
 
389 389
 		$field_args = $field->args();
390 390
 
391
-		foreach ( $field_args as $key => $value ) {
392
-			if ( in_array( $key, $params_to_ignore, true ) ) {
391
+		foreach ($field_args as $key => $value) {
392
+			if (in_array($key, $params_to_ignore, true)) {
393 393
 				continue;
394 394
 			}
395 395
 
396
-			if ( 'options_cb' === $key ) {
396
+			if ('options_cb' === $key) {
397 397
 				$value = $field->options();
398
-			} elseif ( in_array( $key, CMB2_Field::$callable_fields, true ) ) {
398
+			} elseif (in_array($key, CMB2_Field::$callable_fields, true)) {
399 399
 
400
-				if ( isset( $this->request['_rendered'] ) ) {
401
-					$value = $key === 'render_row_cb' ? $rendered : $field->get_param_callback_result( $key );
402
-				} elseif ( is_array( $value ) ) {
400
+				if (isset($this->request['_rendered'])) {
401
+					$value = $key === 'render_row_cb' ? $rendered : $field->get_param_callback_result($key);
402
+				} elseif (is_array($value)) {
403 403
 					// We need to rewrite callbacks as string as they will cause
404 404
 					// JSON recursion errors.
405
-					$class = is_string( $value[0] ) ? $value[0] : get_class( $value[0] );
405
+					$class = is_string($value[0]) ? $value[0] : get_class($value[0]);
406 406
 					$value = $class . '::' . $value[1];
407 407
 				}
408 408
 			}
409 409
 
410
-			$key = isset( $params_to_rename[ $key ] ) ? $params_to_rename[ $key ] : $key;
410
+			$key = isset($params_to_rename[$key]) ? $params_to_rename[$key] : $key;
411 411
 
412
-			if ( empty( $value ) || is_scalar( $value ) || is_array( $value ) ) {
413
-				$field_data[ $key ] = $value;
412
+			if (empty($value) || is_scalar($value) || is_array($value)) {
413
+				$field_data[$key] = $value;
414 414
 			} else {
415
-				$field_data[ $key ] = sprintf( __( 'Value Error for %s', 'cmb2' ), $key );
415
+				$field_data[$key] = sprintf(__('Value Error for %s', 'cmb2'), $key);
416 416
 			}
417 417
 		}
418 418
 
419
-		if ( $field->args( 'has_supporting_data' ) ) {
420
-			$field_data = $this->get_supporting_data( $field_data, $field );
419
+		if ($field->args('has_supporting_data')) {
420
+			$field_data = $this->get_supporting_data($field_data, $field);
421 421
 		}
422 422
 
423
-		if ( $this->request['object_id'] && $this->request['object_type'] ) {
423
+		if ($this->request['object_id'] && $this->request['object_type']) {
424 424
 			$field_data['value'] = $field->get_rest_value();
425 425
 		}
426 426
 
@@ -437,18 +437,18 @@  discard block
 block discarded – undo
437 437
 	 *
438 438
 	 * @return array                  Array of field data.
439 439
 	 */
440
-	public function get_supporting_data( $field_data, $field ) {
440
+	public function get_supporting_data($field_data, $field) {
441 441
 
442 442
 		// Reset placement of this property.
443
-		unset( $field_data['has_supporting_data'] );
443
+		unset($field_data['has_supporting_data']);
444 444
 		$field_data['has_supporting_data'] = true;
445 445
 
446 446
 		$field = $field->get_supporting_field();
447 447
 		$field_data['supporting_data'] = array(
448
-			'id' => $field->_id( '', false ),
448
+			'id' => $field->_id('', false),
449 449
 		);
450 450
 
451
-		if ( $this->request['object_id'] && $this->request['object_type'] ) {
451
+		if ($this->request['object_id'] && $this->request['object_type']) {
452 452
 			$field_data['supporting_data']['value'] = $field->get_rest_value();
453 453
 		}
454 454
 
@@ -464,20 +464,20 @@  discard block
 block discarded – undo
464 464
 	 *
465 465
 	 * @return array             Array of links
466 466
 	 */
467
-	protected function prepare_links( $field ) {
467
+	protected function prepare_links($field) {
468 468
 		$boxbase      = $this->namespace_base . '/' . $this->rest_box->cmb->cmb_id;
469 469
 		$query_string = $this->get_query_string();
470 470
 
471 471
 		$links = array(
472 472
 			'self' => array(
473
-				'href' => rest_url( trailingslashit( $boxbase ) . 'fields/' . $field->_id( '', false ) . $query_string ),
473
+				'href' => rest_url(trailingslashit($boxbase) . 'fields/' . $field->_id('', false) . $query_string),
474 474
 			),
475 475
 			'collection' => array(
476
-				'href' => rest_url( trailingslashit( $boxbase ) . 'fields' . $query_string ),
476
+				'href' => rest_url(trailingslashit($boxbase) . 'fields' . $query_string),
477 477
 			),
478 478
 			'up' => array(
479 479
 				'embeddable' => true,
480
-				'href' => rest_url( $boxbase . $query_string ),
480
+				'href' => rest_url($boxbase . $query_string),
481 481
 			),
482 482
 		);
483 483
 
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @return bool                The possibly-modified filter value (if the _cb param is a non-callable).
500 500
 	 */
501
-	public function maybe_hook_registered_callback( $filter, $default_val ) {
502
-		$default_val = parent::maybe_hook_registered_callback( $filter, $default_val );
501
+	public function maybe_hook_registered_callback($filter, $default_val) {
502
+		$default_val = parent::maybe_hook_registered_callback($filter, $default_val);
503 503
 
504
-		if ( $this->field ) {
504
+		if ($this->field) {
505 505
 
506 506
 			// Hook field specific filter callbacks.
507
-			$val = $this->field->maybe_hook_parameter( $filter, $default_val );
508
-			if ( null !== $val ) {
507
+			$val = $this->field->maybe_hook_parameter($filter, $default_val);
508
+			if (null !== $val) {
509 509
 				$default_val = $val;
510 510
 			}
511 511
 		}
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 	 *
523 523
 	 * @return void
524 524
 	 */
525
-	public function maybe_unhook_registered_callback( $filter ) {
526
-		parent::maybe_unhook_registered_callback( $filter );
525
+	public function maybe_unhook_registered_callback($filter) {
526
+		parent::maybe_unhook_registered_callback($filter);
527 527
 
528
-		if ( $this->field ) {
528
+		if ($this->field) {
529 529
 			// Unhook field specific filter callbacks.
530
-			$this->field->maybe_hook_parameter( $filter, null, 'remove_filter' );
530
+			$this->field->maybe_hook_parameter($filter, null, 'remove_filter');
531 531
 		}
532 532
 	}
533 533
 
Please login to merge, or discard this patch.