Completed
Push — develop ( f5cfcc...e2baaf )
by Naveen
01:17
created
src/admin/elements/class-wordlift-admin-country-select-element.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -18,38 +18,38 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Country_Select_Element extends Wordlift_Admin_Select_Element {
20 20
 
21
-	/**
22
-	 * Adds a filter that will add data `country-codes` attrbiute to the country select
23
-	 * to allow front-end validation.
24
-	 *
25
-	 * @since 3.18.0
26
-	 *
27
-	 */
28
-	public function __construct() {
29
-		// Adds the country codes as data attribute to allow front-end validation.
30
-		add_filter( 'wl_admin_select_element_data_attributes', array( $this, 'add_country_codes_data' ), 10, 1 );
31
-	}
21
+    /**
22
+     * Adds a filter that will add data `country-codes` attrbiute to the country select
23
+     * to allow front-end validation.
24
+     *
25
+     * @since 3.18.0
26
+     *
27
+     */
28
+    public function __construct() {
29
+        // Adds the country codes as data attribute to allow front-end validation.
30
+        add_filter( 'wl_admin_select_element_data_attributes', array( $this, 'add_country_codes_data' ), 10, 1 );
31
+    }
32 32
 
33
-	/**
34
-	 * @inheritdoc
35
-	 */
36
-	public function render_options( $params ) {
37
-		// Print all the supported countries, preselecting the one configured
38
-		// in WP (or United Kingdom if not supported). We now use the `Wordlift_Countries`
39
-		// class which provides the list of countries supported by WordLift.
40
-		//
41
-		// https://github.com/insideout10/wordlift-plugin/issues/713
33
+    /**
34
+     * @inheritdoc
35
+     */
36
+    public function render_options( $params ) {
37
+        // Print all the supported countries, preselecting the one configured
38
+        // in WP (or United Kingdom if not supported). We now use the `Wordlift_Countries`
39
+        // class which provides the list of countries supported by WordLift.
40
+        //
41
+        // https://github.com/insideout10/wordlift-plugin/issues/713
42 42
 
43
-		$lang = ( isset( $params['lang'] ) ) ? $params['lang'] : false;
43
+        $lang = ( isset( $params['lang'] ) ) ? $params['lang'] : false;
44 44
 
45
-		// Get WordLift's supported countries.
46
-		$countries = Wordlift_Countries::get_countries( $lang );
45
+        // Get WordLift's supported countries.
46
+        $countries = Wordlift_Countries::get_countries( $lang );
47 47
 
48
-		// If we support WP's configured language, then use that, otherwise use English by default.
49
-		$language = isset( $countries[ $params['value'] ] ) ? $params['value'] : 'uk';
48
+        // If we support WP's configured language, then use that, otherwise use English by default.
49
+        $language = isset( $countries[ $params['value'] ] ) ? $params['value'] : 'uk';
50 50
 
51
-		foreach ( $countries as $code => $label ) :
52
-			?>
51
+        foreach ( $countries as $code => $label ) :
52
+            ?>
53 53
             <option
54 54
                     value="<?php echo esc_attr( $code ); ?>"
55 55
 				<?php echo selected( $code, $language, false ); ?>
@@ -57,48 +57,48 @@  discard block
 block discarded – undo
57 57
 				<?php echo esc_html( $label ); ?>
58 58
             </option>
59 59
 		<?php
60
-		endforeach;
61
-	}
60
+        endforeach;
61
+    }
62 62
 
63
-	/**
64
-	 * Returns select options html.
65
-	 *
66
-	 * @since 3.18.0
67
-	 *
68
-	 * @return void Echoes select options or empty string if required params are not set.
69
-	 */
70
-	public function get_options_html() {
71
-		$html = '';
63
+    /**
64
+     * Returns select options html.
65
+     *
66
+     * @since 3.18.0
67
+     *
68
+     * @return void Echoes select options or empty string if required params are not set.
69
+     */
70
+    public function get_options_html() {
71
+        $html = '';
72 72
 
73
-		// Check whether the required params are set.
74
-		if ( ! empty( $_POST['lang'] ) && ! empty( $_POST['value'] ) ) { // WPCS: CSRF, input var, sanitization ok.
75
-			ob_start();
76
-			// Get the new options.
77
-			$this->render_options( $_POST ); // WPCS: CSRF, input var, sanitization ok.
73
+        // Check whether the required params are set.
74
+        if ( ! empty( $_POST['lang'] ) && ! empty( $_POST['value'] ) ) { // WPCS: CSRF, input var, sanitization ok.
75
+            ob_start();
76
+            // Get the new options.
77
+            $this->render_options( $_POST ); // WPCS: CSRF, input var, sanitization ok.
78 78
 
79
-			$html = ob_get_clean();
80
-		}
79
+            $html = ob_get_clean();
80
+        }
81 81
 
82
-		// Return the html.
83
-		wp_send_json_success( $html );
84
-	}
82
+        // Return the html.
83
+        wp_send_json_success( $html );
84
+    }
85 85
 
86
-	/**
87
-	 * Modify the field data attributes by adding`country-code`
88
-	 * to existing attributes.
89
-	 *
90
-	 * @param array $attributes Current data attributes.
91
-	 *
92
-	 * @since 3.18.0
93
-	 *
94
-	 * @return array $attributes Modified attributes.
95
-	 */
96
-	public function add_country_codes_data( $attributes ) {
97
-		// Add the country codes.
98
-		$attributes['country-codes'] = json_encode( Wordlift_Countries::get_codes() );
86
+    /**
87
+     * Modify the field data attributes by adding`country-code`
88
+     * to existing attributes.
89
+     *
90
+     * @param array $attributes Current data attributes.
91
+     *
92
+     * @since 3.18.0
93
+     *
94
+     * @return array $attributes Modified attributes.
95
+     */
96
+    public function add_country_codes_data( $attributes ) {
97
+        // Add the country codes.
98
+        $attributes['country-codes'] = json_encode( Wordlift_Countries::get_codes() );
99 99
 
100
-		// Return the attributes.
101
-		return $attributes;
102
-	}
100
+        // Return the attributes.
101
+        return $attributes;
102
+    }
103 103
 
104 104
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
 	 */
28 28
 	public function __construct() {
29 29
 		// Adds the country codes as data attribute to allow front-end validation.
30
-		add_filter( 'wl_admin_select_element_data_attributes', array( $this, 'add_country_codes_data' ), 10, 1 );
30
+		add_filter('wl_admin_select_element_data_attributes', array($this, 'add_country_codes_data'), 10, 1);
31 31
 	}
32 32
 
33 33
 	/**
34 34
 	 * @inheritdoc
35 35
 	 */
36
-	public function render_options( $params ) {
36
+	public function render_options($params) {
37 37
 		// Print all the supported countries, preselecting the one configured
38 38
 		// in WP (or United Kingdom if not supported). We now use the `Wordlift_Countries`
39 39
 		// class which provides the list of countries supported by WordLift.
40 40
 		//
41 41
 		// https://github.com/insideout10/wordlift-plugin/issues/713
42 42
 
43
-		$lang = ( isset( $params['lang'] ) ) ? $params['lang'] : false;
43
+		$lang = (isset($params['lang'])) ? $params['lang'] : false;
44 44
 
45 45
 		// Get WordLift's supported countries.
46
-		$countries = Wordlift_Countries::get_countries( $lang );
46
+		$countries = Wordlift_Countries::get_countries($lang);
47 47
 
48 48
 		// If we support WP's configured language, then use that, otherwise use English by default.
49
-		$language = isset( $countries[ $params['value'] ] ) ? $params['value'] : 'uk';
49
+		$language = isset($countries[$params['value']]) ? $params['value'] : 'uk';
50 50
 
51
-		foreach ( $countries as $code => $label ) :
51
+		foreach ($countries as $code => $label) :
52 52
 			?>
53 53
             <option
54
-                    value="<?php echo esc_attr( $code ); ?>"
55
-				<?php echo selected( $code, $language, false ); ?>
54
+                    value="<?php echo esc_attr($code); ?>"
55
+				<?php echo selected($code, $language, false); ?>
56 56
             >
57
-				<?php echo esc_html( $label ); ?>
57
+				<?php echo esc_html($label); ?>
58 58
             </option>
59 59
 		<?php
60 60
 		endforeach;
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
 		$html = '';
72 72
 
73 73
 		// Check whether the required params are set.
74
-		if ( ! empty( $_POST['lang'] ) && ! empty( $_POST['value'] ) ) { // WPCS: CSRF, input var, sanitization ok.
74
+		if ( ! empty($_POST['lang']) && ! empty($_POST['value'])) { // WPCS: CSRF, input var, sanitization ok.
75 75
 			ob_start();
76 76
 			// Get the new options.
77
-			$this->render_options( $_POST ); // WPCS: CSRF, input var, sanitization ok.
77
+			$this->render_options($_POST); // WPCS: CSRF, input var, sanitization ok.
78 78
 
79 79
 			$html = ob_get_clean();
80 80
 		}
81 81
 
82 82
 		// Return the html.
83
-		wp_send_json_success( $html );
83
+		wp_send_json_success($html);
84 84
 	}
85 85
 
86 86
 	/**
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return array $attributes Modified attributes.
95 95
 	 */
96
-	public function add_country_codes_data( $attributes ) {
96
+	public function add_country_codes_data($attributes) {
97 97
 		// Add the country codes.
98
-		$attributes['country-codes'] = json_encode( Wordlift_Countries::get_codes() );
98
+		$attributes['country-codes'] = json_encode(Wordlift_Countries::get_codes());
99 99
 
100 100
 		// Return the attributes.
101 101
 		return $attributes;
Please login to merge, or discard this patch.
src/admin/elements/class-wordlift-admin-select2-element.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Select2_Element extends Wordlift_Admin_Select_Element {
20 20
 
21
-	/**
22
-	 * @inheritdoc
23
-	 */
24
-	public function render_options( $params ) {
25
-		// Loop through all params and add the options.
26
-		foreach ( $params['options'] as $value => $label ) :
27
-			?>
21
+    /**
22
+     * @inheritdoc
23
+     */
24
+    public function render_options( $params ) {
25
+        // Loop through all params and add the options.
26
+        foreach ( $params['options'] as $value => $label ) :
27
+            ?>
28 28
             <option
29 29
                     value="<?php echo esc_attr( $value ); ?>"
30 30
 				<?php selected( $params['value'], $value ); ?>
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 				<?php echo esc_html( $label ); ?>
33 33
             </option>
34 34
 		<?php
35
-		endforeach;
36
-	}
35
+        endforeach;
36
+    }
37 37
 
38
-	/**
39
-	 * @inheritdoc
40
-	 */
41
-	protected function enqueue_resources() {
42
-		// Enqueue select2 library js and css.
43
-		// Underscore is needed for Select2's `templateResult` and `templateSelection` templates.
44
-		wp_enqueue_script( 'wordlift-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'js/select2/js/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js', array(
45
-			'jquery',
46
-			'underscore',
47
-		), '4.0.3' );
48
-		wp_enqueue_style( 'wordlift-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'js/select2/css/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), '4.0.3' );
49
-	}
38
+    /**
39
+     * @inheritdoc
40
+     */
41
+    protected function enqueue_resources() {
42
+        // Enqueue select2 library js and css.
43
+        // Underscore is needed for Select2's `templateResult` and `templateSelection` templates.
44
+        wp_enqueue_script( 'wordlift-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'js/select2/js/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js', array(
45
+            'jquery',
46
+            'underscore',
47
+        ), '4.0.3' );
48
+        wp_enqueue_style( 'wordlift-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'js/select2/css/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), '4.0.3' );
49
+    }
50 50
 
51 51
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * @inheritdoc
23 23
 	 */
24
-	public function render_options( $params ) {
24
+	public function render_options($params) {
25 25
 		// Loop through all params and add the options.
26
-		foreach ( $params['options'] as $value => $label ) :
26
+		foreach ($params['options'] as $value => $label) :
27 27
 			?>
28 28
             <option
29
-                    value="<?php echo esc_attr( $value ); ?>"
30
-				<?php selected( $params['value'], $value ); ?>
29
+                    value="<?php echo esc_attr($value); ?>"
30
+				<?php selected($params['value'], $value); ?>
31 31
             >
32
-				<?php echo esc_html( $label ); ?>
32
+				<?php echo esc_html($label); ?>
33 33
             </option>
34 34
 		<?php
35 35
 		endforeach;
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	protected function enqueue_resources() {
42 42
 		// Enqueue select2 library js and css.
43 43
 		// Underscore is needed for Select2's `templateResult` and `templateSelection` templates.
44
-		wp_enqueue_script( 'wordlift-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'js/select2/js/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.js', array(
44
+		wp_enqueue_script('wordlift-select2', plugin_dir_url(dirname(__FILE__)).'js/select2/js/select2'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.js', array(
45 45
 			'jquery',
46 46
 			'underscore',
47
-		), '4.0.3' );
48
-		wp_enqueue_style( 'wordlift-select2', plugin_dir_url( dirname( __FILE__ ) ) . 'js/select2/css/select2' . ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ? '.min' : '' ) . '.css', array(), '4.0.3' );
47
+		), '4.0.3');
48
+		wp_enqueue_style('wordlift-select2', plugin_dir_url(dirname(__FILE__)).'js/select2/css/select2'.( ! defined('SCRIPT_DEBUG') || ! SCRIPT_DEBUG ? '.min' : '').'.css', array(), '4.0.3');
49 49
 	}
50 50
 
51 51
 }
Please login to merge, or discard this patch.
src/admin/elements/class-wordlift-admin-publisher-element.php 2 patches
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -19,122 +19,122 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Admin_Publisher_Element extends Wordlift_Admin_Author_Element {
21 21
 
22
-	/**
23
-	 * The {@link Wordlift_Configuration_Service} instance.
24
-	 *
25
-	 * @since  3.11.0
26
-	 * @access private
27
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
28
-	 */
29
-	private $configuration_service;
30
-
31
-	/**
32
-	 * The {@link Wordlift_Publisher_Service} instance.
33
-	 *
34
-	 * @since  3.11.0
35
-	 * @access private
36
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
37
-	 */
38
-	private $publisher_service;
39
-
40
-	/**
41
-	 * @var Wordlift_Admin_Tabs_Element
42
-	 */
43
-	private $tabs_element;
44
-
45
-	/**
46
-	 * Create a {@link Wordlift_Admin_Publisher_Element} instance.
47
-	 *
48
-	 * @since 3.11.0
49
-	 *
50
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
51
-	 * @param \Wordlift_Publisher_Service     $publisher_service The {@link Wordlift_Publisher_Service} instance.
52
-	 * @param \Wordlift_Admin_Tabs_Element    $tabs_element The {@link Wordlift_Admin_Tabs_Element} instance.
53
-	 * @param \Wordlift_Admin_Select2_Element $select_element The {@link Wordlift_Admin_Select_Element} instance.
54
-	 */
55
-	function __construct( $configuration_service, $publisher_service, $tabs_element, $select_element ) {
56
-		parent::__construct( $publisher_service, $select_element );
57
-
58
-		$this->configuration_service = $configuration_service;
59
-		$this->publisher_service     = $publisher_service;
60
-
61
-		// Child elements.
62
-		$this->tabs_element = $tabs_element;
63
-
64
-	}
65
-
66
-	/**
67
-	 * @inheritdoc
68
-	 */
69
-	public function render( $args ) {
70
-
71
-		// Parse the arguments and merge with default values.
72
-		$params = wp_parse_args( $args, array(
73
-			'id'   => uniqid( 'wl-input-' ),
74
-			'name' => uniqid( 'wl-input-' ),
75
-		) );
76
-
77
-		// Get the number of potential candidates as publishers.
78
-		$count = $this->publisher_service->count();
79
-
80
-		$this->tabs_element->render( array(
81
-			'tabs'   => array(
82
-				array(
83
-					'label'    => __( 'Select an Existing Publisher', 'wordlift' ),
84
-					'callback' => array( $this, 'select' ),
85
-					'args'     => $params,
86
-				),
87
-				array(
88
-					'label'    => __( 'Create a New Publisher', 'wordlift' ),
89
-					'callback' => array( $this, 'create' ),
90
-					'args'     => $params,
91
-				),
92
-			),
93
-			// Set the default tab according to the number of potential publishers
94
-			// configured in WP: 0 = select, 1 = create.
95
-			'active' => 0 === $count ? 1 : 0,
96
-		) );
97
-
98
-		// Finally return the element instance.
99
-		return $this;
100
-	}
101
-
102
-	/**
103
-	 * Render the publisher's select.
104
-	 *
105
-	 * @since 3.11.0
106
-	 *
107
-	 * @param array $params An array of parameters.
108
-	 */
109
-	public function select( $params ) {
110
-
111
-		// Get the configured publisher id. In case a publisher id is already configured
112
-		// this must be pre-loaded in the options.
113
-		$publisher_id = $this->configuration_service->get_publisher_id();
114
-
115
-		// Get the publisher data.
116
-		$data = $this->publisher_service->query();
117
-		array_unshift( $data, array(
118
-			'id'            => '',
119
-			'text'          => _x( '(none)', 'Publisher Select in Settings Screen.', 'wordlift' ),
120
-			'type'          => '',
121
-			'thumbnail_url' => false,
122
-		) );
123
-
124
-		// Call the select internal render.
125
-		$this->do_render( $params, $publisher_id, $data );
126
-
127
-	}
128
-
129
-	/**
130
-	 * Render the 'create publisher' form.
131
-	 *
132
-	 * @since 3.11.0
133
-	 *
134
-	 * @param array $params An array of parameters.
135
-	 */
136
-	public function create( $params ) {
137
-		?>
22
+    /**
23
+     * The {@link Wordlift_Configuration_Service} instance.
24
+     *
25
+     * @since  3.11.0
26
+     * @access private
27
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
28
+     */
29
+    private $configuration_service;
30
+
31
+    /**
32
+     * The {@link Wordlift_Publisher_Service} instance.
33
+     *
34
+     * @since  3.11.0
35
+     * @access private
36
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
37
+     */
38
+    private $publisher_service;
39
+
40
+    /**
41
+     * @var Wordlift_Admin_Tabs_Element
42
+     */
43
+    private $tabs_element;
44
+
45
+    /**
46
+     * Create a {@link Wordlift_Admin_Publisher_Element} instance.
47
+     *
48
+     * @since 3.11.0
49
+     *
50
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
51
+     * @param \Wordlift_Publisher_Service     $publisher_service The {@link Wordlift_Publisher_Service} instance.
52
+     * @param \Wordlift_Admin_Tabs_Element    $tabs_element The {@link Wordlift_Admin_Tabs_Element} instance.
53
+     * @param \Wordlift_Admin_Select2_Element $select_element The {@link Wordlift_Admin_Select_Element} instance.
54
+     */
55
+    function __construct( $configuration_service, $publisher_service, $tabs_element, $select_element ) {
56
+        parent::__construct( $publisher_service, $select_element );
57
+
58
+        $this->configuration_service = $configuration_service;
59
+        $this->publisher_service     = $publisher_service;
60
+
61
+        // Child elements.
62
+        $this->tabs_element = $tabs_element;
63
+
64
+    }
65
+
66
+    /**
67
+     * @inheritdoc
68
+     */
69
+    public function render( $args ) {
70
+
71
+        // Parse the arguments and merge with default values.
72
+        $params = wp_parse_args( $args, array(
73
+            'id'   => uniqid( 'wl-input-' ),
74
+            'name' => uniqid( 'wl-input-' ),
75
+        ) );
76
+
77
+        // Get the number of potential candidates as publishers.
78
+        $count = $this->publisher_service->count();
79
+
80
+        $this->tabs_element->render( array(
81
+            'tabs'   => array(
82
+                array(
83
+                    'label'    => __( 'Select an Existing Publisher', 'wordlift' ),
84
+                    'callback' => array( $this, 'select' ),
85
+                    'args'     => $params,
86
+                ),
87
+                array(
88
+                    'label'    => __( 'Create a New Publisher', 'wordlift' ),
89
+                    'callback' => array( $this, 'create' ),
90
+                    'args'     => $params,
91
+                ),
92
+            ),
93
+            // Set the default tab according to the number of potential publishers
94
+            // configured in WP: 0 = select, 1 = create.
95
+            'active' => 0 === $count ? 1 : 0,
96
+        ) );
97
+
98
+        // Finally return the element instance.
99
+        return $this;
100
+    }
101
+
102
+    /**
103
+     * Render the publisher's select.
104
+     *
105
+     * @since 3.11.0
106
+     *
107
+     * @param array $params An array of parameters.
108
+     */
109
+    public function select( $params ) {
110
+
111
+        // Get the configured publisher id. In case a publisher id is already configured
112
+        // this must be pre-loaded in the options.
113
+        $publisher_id = $this->configuration_service->get_publisher_id();
114
+
115
+        // Get the publisher data.
116
+        $data = $this->publisher_service->query();
117
+        array_unshift( $data, array(
118
+            'id'            => '',
119
+            'text'          => _x( '(none)', 'Publisher Select in Settings Screen.', 'wordlift' ),
120
+            'type'          => '',
121
+            'thumbnail_url' => false,
122
+        ) );
123
+
124
+        // Call the select internal render.
125
+        $this->do_render( $params, $publisher_id, $data );
126
+
127
+    }
128
+
129
+    /**
130
+     * Render the 'create publisher' form.
131
+     *
132
+     * @since 3.11.0
133
+     *
134
+     * @param array $params An array of parameters.
135
+     */
136
+    public function create( $params ) {
137
+        ?>
138 138
         <p>
139 139
             <strong><?php esc_html_e( 'Are you publishing as an individual or as a company?', 'wordlift' ); ?></strong>
140 140
         </p>
@@ -199,6 +199,6 @@  discard block
 block discarded – undo
199 199
             </p>
200 200
         </div>
201 201
 		<?php
202
-	}
202
+    }
203 203
 
204 204
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	 * @param \Wordlift_Admin_Tabs_Element    $tabs_element The {@link Wordlift_Admin_Tabs_Element} instance.
53 53
 	 * @param \Wordlift_Admin_Select2_Element $select_element The {@link Wordlift_Admin_Select_Element} instance.
54 54
 	 */
55
-	function __construct( $configuration_service, $publisher_service, $tabs_element, $select_element ) {
56
-		parent::__construct( $publisher_service, $select_element );
55
+	function __construct($configuration_service, $publisher_service, $tabs_element, $select_element) {
56
+		parent::__construct($publisher_service, $select_element);
57 57
 
58 58
 		$this->configuration_service = $configuration_service;
59 59
 		$this->publisher_service     = $publisher_service;
@@ -66,34 +66,34 @@  discard block
 block discarded – undo
66 66
 	/**
67 67
 	 * @inheritdoc
68 68
 	 */
69
-	public function render( $args ) {
69
+	public function render($args) {
70 70
 
71 71
 		// Parse the arguments and merge with default values.
72
-		$params = wp_parse_args( $args, array(
73
-			'id'   => uniqid( 'wl-input-' ),
74
-			'name' => uniqid( 'wl-input-' ),
75
-		) );
72
+		$params = wp_parse_args($args, array(
73
+			'id'   => uniqid('wl-input-'),
74
+			'name' => uniqid('wl-input-'),
75
+		));
76 76
 
77 77
 		// Get the number of potential candidates as publishers.
78 78
 		$count = $this->publisher_service->count();
79 79
 
80
-		$this->tabs_element->render( array(
80
+		$this->tabs_element->render(array(
81 81
 			'tabs'   => array(
82 82
 				array(
83
-					'label'    => __( 'Select an Existing Publisher', 'wordlift' ),
84
-					'callback' => array( $this, 'select' ),
83
+					'label'    => __('Select an Existing Publisher', 'wordlift'),
84
+					'callback' => array($this, 'select'),
85 85
 					'args'     => $params,
86 86
 				),
87 87
 				array(
88
-					'label'    => __( 'Create a New Publisher', 'wordlift' ),
89
-					'callback' => array( $this, 'create' ),
88
+					'label'    => __('Create a New Publisher', 'wordlift'),
89
+					'callback' => array($this, 'create'),
90 90
 					'args'     => $params,
91 91
 				),
92 92
 			),
93 93
 			// Set the default tab according to the number of potential publishers
94 94
 			// configured in WP: 0 = select, 1 = create.
95 95
 			'active' => 0 === $count ? 1 : 0,
96
-		) );
96
+		));
97 97
 
98 98
 		// Finally return the element instance.
99 99
 		return $this;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @param array $params An array of parameters.
108 108
 	 */
109
-	public function select( $params ) {
109
+	public function select($params) {
110 110
 
111 111
 		// Get the configured publisher id. In case a publisher id is already configured
112 112
 		// this must be pre-loaded in the options.
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 
115 115
 		// Get the publisher data.
116 116
 		$data = $this->publisher_service->query();
117
-		array_unshift( $data, array(
117
+		array_unshift($data, array(
118 118
 			'id'            => '',
119
-			'text'          => _x( '(none)', 'Publisher Select in Settings Screen.', 'wordlift' ),
119
+			'text'          => _x('(none)', 'Publisher Select in Settings Screen.', 'wordlift'),
120 120
 			'type'          => '',
121 121
 			'thumbnail_url' => false,
122
-		) );
122
+		));
123 123
 
124 124
 		// Call the select internal render.
125
-		$this->do_render( $params, $publisher_id, $data );
125
+		$this->do_render($params, $publisher_id, $data);
126 126
 
127 127
 	}
128 128
 
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @param array $params An array of parameters.
135 135
 	 */
136
-	public function create( $params ) {
136
+	public function create($params) {
137 137
 		?>
138 138
         <p>
139
-            <strong><?php esc_html_e( 'Are you publishing as an individual or as a company?', 'wordlift' ); ?></strong>
139
+            <strong><?php esc_html_e('Are you publishing as an individual or as a company?', 'wordlift'); ?></strong>
140 140
         </p>
141 141
 
142 142
         <p id="wl-publisher-type">
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                 >
151 151
 
152 152
 				<label for="wl-publisher-person">
153
-					<?php esc_html_e( 'Person', 'wordlift' ); ?>
153
+					<?php esc_html_e('Person', 'wordlift'); ?>
154 154
 				</label>
155 155
 			</span>
156 156
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 >
164 164
 
165 165
 				<label for="wl-publisher-company">
166
-					<?php esc_html_e( 'Company', 'wordlift' ); ?>
166
+					<?php esc_html_e('Company', 'wordlift'); ?>
167 167
 				</label>
168 168
 			</span>
169 169
         </p>
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             <input
173 173
                     type="text"
174 174
                     name="wl_publisher[name]"
175
-                    placeholder="<?php echo esc_attr__( "What's your name?", 'wordlift' ); ?>"
175
+                    placeholder="<?php echo esc_attr__("What's your name?", 'wordlift'); ?>"
176 176
             >
177 177
         </p>
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             />
185 185
 
186 186
             <p>
187
-                <b><?php esc_html_e( "Choose the publisher's Logo", 'wordlift' ); ?></b>
187
+                <b><?php esc_html_e("Choose the publisher's Logo", 'wordlift'); ?></b>
188 188
             </p>
189 189
 
190 190
             <p>
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
                         type="button"
195 195
                         class="button"
196 196
                         id="wl-publisher-media-uploader">
197
-					<?php esc_html_e( 'Select an existing image or upload a new one', 'wordlift' ); ?>
197
+					<?php esc_html_e('Select an existing image or upload a new one', 'wordlift'); ?>
198 198
                 </button>
199 199
             </p>
200 200
         </div>
Please login to merge, or discard this patch.
src/includes/class-wordlift-schema-location-property-service.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param Wordlift_Sparql_Service $sparql_service
82 82
 	 */
83
-	public function __construct( $sparql_service ) {
83
+	public function __construct($sparql_service) {
84 84
 		parent::__construct();
85 85
 
86 86
 		$this->sparql_service = $sparql_service;
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return array|NULL The schema:url value or NULL if not set.
97 97
 	 */
98
-	public function get( $post_id ) {
98
+	public function get($post_id) {
99 99
 
100 100
 		// Get the schema:url values set in WP.
101
-		$values = get_post_meta( $post_id, self::META_KEY, false );
101
+		$values = get_post_meta($post_id, self::META_KEY, false);
102 102
 
103 103
 		// Finally return whatever values the editor set.
104 104
 		return $values;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	/**
108 108
 	 * {@inheritdoc}
109 109
 	 */
110
-	public function sanitize( $value ) {
110
+	public function sanitize($value) {
111 111
 
112 112
 		// TODO: check that it's an URL or that is <permalink>
113 113
 
Please login to merge, or discard this patch.
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -13,105 +13,105 @@
 block discarded – undo
13 13
  */
14 14
 class Wordlift_Schema_Location_Property_Service extends Wordlift_Property_Service {
15 15
 
16
-	/**
17
-	 * The meta key used to store data for this property. We don't use wl_url to
18
-	 * avoid potential confusion about other URLs.
19
-	 *
20
-	 * @since 3.7.0
21
-	 */
22
-	const META_KEY = 'wl_location';
23
-
24
-	/**
25
-	 * {@inheritdoc}
26
-	 */
27
-	public function get_rdf_predicate() {
28
-
29
-		return 'http://schema.org/location';
30
-	}
31
-
32
-	/**
33
-	 * {@inheritdoc}
34
-	 */
35
-	public function get_rdf_data_type() {
36
-
37
-		return 'xsd:anyURI';
38
-	}
39
-
40
-	/**
41
-	 * {@inheritdoc}
42
-	 */
43
-	public function get_data_type() {
44
-
45
-		return Wordlift_Schema_Service::DATA_TYPE_URI;
46
-	}
47
-
48
-	/**
49
-	 * {@inheritdoc}
50
-	 */
51
-	public function get_cardinality() {
52
-
53
-		return INF;
54
-	}
55
-
56
-	/**
57
-	 * {@inheritdoc}
58
-	 */
59
-	public function get_metabox_class() {
60
-
61
-		return 'Wl_Metabox_Field';
62
-	}
63
-
64
-	/**
65
-	 * {@inheritdoc}
66
-	 */
67
-	public function get_metabox_label() {
68
-
69
-		return 'Location(s)';
70
-	}
71
-
72
-	/**
73
-	 * @var
74
-	 */
75
-	private $sparql_service;
76
-
77
-	/**
78
-	 * Create a Wordlift_Schema_Location_Property_Service instance.
79
-	 * @since 3.7.0
80
-	 *
81
-	 * @param Wordlift_Sparql_Service $sparql_service
82
-	 */
83
-	public function __construct( $sparql_service ) {
84
-		parent::__construct();
85
-
86
-		$this->sparql_service = $sparql_service;
87
-	}
88
-
89
-	/**
90
-	 * Get the schema:url value for the specified post/entity.
91
-	 *
92
-	 * @since 3.7.0
93
-	 *
94
-	 * @param int $post_id The post id.
95
-	 *
96
-	 * @return array|NULL The schema:url value or NULL if not set.
97
-	 */
98
-	public function get( $post_id ) {
99
-
100
-		// Get the schema:url values set in WP.
101
-		$values = get_post_meta( $post_id, self::META_KEY, false );
102
-
103
-		// Finally return whatever values the editor set.
104
-		return $values;
105
-	}
106
-
107
-	/**
108
-	 * {@inheritdoc}
109
-	 */
110
-	public function sanitize( $value ) {
111
-
112
-		// TODO: check that it's an URL or that is <permalink>
113
-
114
-		return $value;
115
-	}
16
+    /**
17
+     * The meta key used to store data for this property. We don't use wl_url to
18
+     * avoid potential confusion about other URLs.
19
+     *
20
+     * @since 3.7.0
21
+     */
22
+    const META_KEY = 'wl_location';
23
+
24
+    /**
25
+     * {@inheritdoc}
26
+     */
27
+    public function get_rdf_predicate() {
28
+
29
+        return 'http://schema.org/location';
30
+    }
31
+
32
+    /**
33
+     * {@inheritdoc}
34
+     */
35
+    public function get_rdf_data_type() {
36
+
37
+        return 'xsd:anyURI';
38
+    }
39
+
40
+    /**
41
+     * {@inheritdoc}
42
+     */
43
+    public function get_data_type() {
44
+
45
+        return Wordlift_Schema_Service::DATA_TYPE_URI;
46
+    }
47
+
48
+    /**
49
+     * {@inheritdoc}
50
+     */
51
+    public function get_cardinality() {
52
+
53
+        return INF;
54
+    }
55
+
56
+    /**
57
+     * {@inheritdoc}
58
+     */
59
+    public function get_metabox_class() {
60
+
61
+        return 'Wl_Metabox_Field';
62
+    }
63
+
64
+    /**
65
+     * {@inheritdoc}
66
+     */
67
+    public function get_metabox_label() {
68
+
69
+        return 'Location(s)';
70
+    }
71
+
72
+    /**
73
+     * @var
74
+     */
75
+    private $sparql_service;
76
+
77
+    /**
78
+     * Create a Wordlift_Schema_Location_Property_Service instance.
79
+     * @since 3.7.0
80
+     *
81
+     * @param Wordlift_Sparql_Service $sparql_service
82
+     */
83
+    public function __construct( $sparql_service ) {
84
+        parent::__construct();
85
+
86
+        $this->sparql_service = $sparql_service;
87
+    }
88
+
89
+    /**
90
+     * Get the schema:url value for the specified post/entity.
91
+     *
92
+     * @since 3.7.0
93
+     *
94
+     * @param int $post_id The post id.
95
+     *
96
+     * @return array|NULL The schema:url value or NULL if not set.
97
+     */
98
+    public function get( $post_id ) {
99
+
100
+        // Get the schema:url values set in WP.
101
+        $values = get_post_meta( $post_id, self::META_KEY, false );
102
+
103
+        // Finally return whatever values the editor set.
104
+        return $values;
105
+    }
106
+
107
+    /**
108
+     * {@inheritdoc}
109
+     */
110
+    public function sanitize( $value ) {
111
+
112
+        // TODO: check that it's an URL or that is <permalink>
113
+
114
+        return $value;
115
+    }
116 116
 
117 117
 }
Please login to merge, or discard this patch.
src/install/class-wordlift-install-package-type.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,51 +16,51 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Install_Package_Type extends Wordlift_Install {
18 18
 
19
-	/**
20
-	 * The install version.
21
-	 *
22
-	 * @since 3.20.0
23
-	 */
24
-	protected static $version = '3.20.0';
19
+    /**
20
+     * The install version.
21
+     *
22
+     * @since 3.20.0
23
+     */
24
+    protected static $version = '3.20.0';
25 25
 
26
-	/**
27
-	 * Run the install procedure.
28
-	 *
29
-	 * @since 3.20.0
30
-	 *
31
-	 * @return mixed The result.
32
-	 */
33
-	public function install() {
26
+    /**
27
+     * Run the install procedure.
28
+     *
29
+     * @since 3.20.0
30
+     *
31
+     * @return mixed The result.
32
+     */
33
+    public function install() {
34 34
 
35
-		$configuration_service = Wordlift_Configuration_Service::get_instance();
36
-		$key                   = $configuration_service->get_key();
35
+        $configuration_service = Wordlift_Configuration_Service::get_instance();
36
+        $key                   = $configuration_service->get_key();
37 37
 
38
-		// Bail out if the `key` isn't set.
39
-		if ( empty( $key ) ) {
40
-			return;
41
-		}
38
+        // Bail out if the `key` isn't set.
39
+        if ( empty( $key ) ) {
40
+            return;
41
+        }
42 42
 
43
-		// Calling this function will get and set the remote dataset and package type.
44
-		$configuration_service->get_remote_dataset_uri( $key );
43
+        // Calling this function will get and set the remote dataset and package type.
44
+        $configuration_service->get_remote_dataset_uri( $key );
45 45
 
46
-	}
46
+    }
47 47
 
48
-	/**
49
-	 * Must install when the package type isn't set.
50
-	 *
51
-	 * https://github.com/insideout10/wordlift-plugin/issues/761
52
-	 *
53
-	 * @since 3.20.0
54
-	 * @return bool True if package type is set, otherwise false.
55
-	 */
56
-	public function must_install() {
48
+    /**
49
+     * Must install when the package type isn't set.
50
+     *
51
+     * https://github.com/insideout10/wordlift-plugin/issues/761
52
+     *
53
+     * @since 3.20.0
54
+     * @return bool True if package type is set, otherwise false.
55
+     */
56
+    public function must_install() {
57 57
 
58
-		$configuration_service = Wordlift_Configuration_Service::get_instance();
59
-		$key                   = $configuration_service->get_key();
60
-		$package_type          = $configuration_service->get_package_type();
58
+        $configuration_service = Wordlift_Configuration_Service::get_instance();
59
+        $key                   = $configuration_service->get_key();
60
+        $package_type          = $configuration_service->get_package_type();
61 61
 
62
-		// We need to determine the package type if the `key` is set, but the `package_type` isn't.
63
-		return is_admin() && ! empty( $key ) && empty( $package_type );
64
-	}
62
+        // We need to determine the package type if the `key` is set, but the `package_type` isn't.
63
+        return is_admin() && ! empty( $key ) && empty( $package_type );
64
+    }
65 65
 
66 66
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 		$key                   = $configuration_service->get_key();
37 37
 
38 38
 		// Bail out if the `key` isn't set.
39
-		if ( empty( $key ) ) {
39
+		if (empty($key)) {
40 40
 			return;
41 41
 		}
42 42
 
43 43
 		// Calling this function will get and set the remote dataset and package type.
44
-		$configuration_service->get_remote_dataset_uri( $key );
44
+		$configuration_service->get_remote_dataset_uri($key);
45 45
 
46 46
 	}
47 47
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		$package_type          = $configuration_service->get_package_type();
61 61
 
62 62
 		// We need to determine the package type if the `key` is set, but the `package_type` isn't.
63
-		return is_admin() && ! empty( $key ) && empty( $package_type );
63
+		return is_admin() && ! empty($key) && empty($package_type);
64 64
 	}
65 65
 
66 66
 }
Please login to merge, or discard this patch.
src/install/class-wordlift-install-3-14-0.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -15,67 +15,67 @@
 block discarded – undo
15 15
  * @subpackage Wordlift/install
16 16
  */
17 17
 class Wordlift_Install_3_14_0 extends Wordlift_Install {
18
-	/**
19
-	 * @inheritdoc
20
-	 */
21
-	protected static $version = '3.14.0';
18
+    /**
19
+     * @inheritdoc
20
+     */
21
+    protected static $version = '3.14.0';
22 22
 
23
-	/**
24
-	 * @inheritdoc
25
-	 */
26
-	public function install() {
27
-		// Check whether the `recipe` term exists.
28
-		$recipe = get_term_by( 'slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
23
+    /**
24
+     * @inheritdoc
25
+     */
26
+    public function install() {
27
+        // Check whether the `recipe` term exists.
28
+        $recipe = get_term_by( 'slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
29 29
 
30
-		// The recipe term doesn't exists, so create it.
31
-		if ( empty( $recipe ) ) {
32
-			$result = wp_insert_term(
33
-				'Recipe',
34
-				Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
35
-				array(
36
-					'slug'        => 'recipe',
37
-					'description' => 'A Recipe.',
38
-				)
39
-			);
40
-		}
30
+        // The recipe term doesn't exists, so create it.
31
+        if ( empty( $recipe ) ) {
32
+            $result = wp_insert_term(
33
+                'Recipe',
34
+                Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
35
+                array(
36
+                    'slug'        => 'recipe',
37
+                    'description' => 'A Recipe.',
38
+                )
39
+            );
40
+        }
41 41
 
42
-		// Assign capabilities to manipulate entities to admins.
43
-		$admins = get_role( 'administrator' );
42
+        // Assign capabilities to manipulate entities to admins.
43
+        $admins = get_role( 'administrator' );
44 44
 
45
-		$admins->add_cap( 'edit_wordlift_entity' );
46
-		$admins->add_cap( 'edit_wordlift_entities' );
47
-		$admins->add_cap( 'edit_others_wordlift_entities' );
48
-		$admins->add_cap( 'publish_wordlift_entities' );
49
-		$admins->add_cap( 'read_private_wordlift_entities' );
50
-		$admins->add_cap( 'delete_wordlift_entity' );
51
-		$admins->add_cap( 'delete_wordlift_entities' );
52
-		$admins->add_cap( 'delete_others_wordlift_entities' );
53
-		$admins->add_cap( 'delete_published_wordlift_entities' );
54
-		$admins->add_cap( 'delete_private_wordlift_entities' );
45
+        $admins->add_cap( 'edit_wordlift_entity' );
46
+        $admins->add_cap( 'edit_wordlift_entities' );
47
+        $admins->add_cap( 'edit_others_wordlift_entities' );
48
+        $admins->add_cap( 'publish_wordlift_entities' );
49
+        $admins->add_cap( 'read_private_wordlift_entities' );
50
+        $admins->add_cap( 'delete_wordlift_entity' );
51
+        $admins->add_cap( 'delete_wordlift_entities' );
52
+        $admins->add_cap( 'delete_others_wordlift_entities' );
53
+        $admins->add_cap( 'delete_published_wordlift_entities' );
54
+        $admins->add_cap( 'delete_private_wordlift_entities' );
55 55
 
56
-		// Assign capabilities to manipulate entities to editors.
57
-		/*
56
+        // Assign capabilities to manipulate entities to editors.
57
+        /*
58 58
 		 * Check that the `editor` role exists before using it.
59 59
 		 *
60 60
 		 * @since 3.19.6
61 61
 		 *
62 62
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/886
63 63
 		 */
64
-		$editors = get_role( 'editor' );
64
+        $editors = get_role( 'editor' );
65 65
 
66
-		if ( isset( $editors ) ) {
67
-			$editors->add_cap( 'edit_wordlift_entity' );
68
-			$editors->add_cap( 'edit_wordlift_entities' );
69
-			$editors->add_cap( 'edit_others_wordlift_entities' );
70
-			$editors->add_cap( 'publish_wordlift_entities' );
71
-			$editors->add_cap( 'read_private_wordlift_entities' );
72
-			$editors->add_cap( 'delete_wordlift_entity' );
73
-			$editors->add_cap( 'delete_wordlift_entities' );
74
-			$editors->add_cap( 'delete_others_wordlift_entities' );
75
-			$editors->add_cap( 'delete_published_wordlift_entities' );
76
-			$editors->add_cap( 'delete_private_wordlift_entities' );
77
-		}
66
+        if ( isset( $editors ) ) {
67
+            $editors->add_cap( 'edit_wordlift_entity' );
68
+            $editors->add_cap( 'edit_wordlift_entities' );
69
+            $editors->add_cap( 'edit_others_wordlift_entities' );
70
+            $editors->add_cap( 'publish_wordlift_entities' );
71
+            $editors->add_cap( 'read_private_wordlift_entities' );
72
+            $editors->add_cap( 'delete_wordlift_entity' );
73
+            $editors->add_cap( 'delete_wordlift_entities' );
74
+            $editors->add_cap( 'delete_others_wordlift_entities' );
75
+            $editors->add_cap( 'delete_published_wordlift_entities' );
76
+            $editors->add_cap( 'delete_private_wordlift_entities' );
77
+        }
78 78
 
79
-	}
79
+    }
80 80
 
81 81
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 */
26 26
 	public function install() {
27 27
 		// Check whether the `recipe` term exists.
28
-		$recipe = get_term_by( 'slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
28
+		$recipe = get_term_by('slug', 'article', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
29 29
 
30 30
 		// The recipe term doesn't exists, so create it.
31
-		if ( empty( $recipe ) ) {
31
+		if (empty($recipe)) {
32 32
 			$result = wp_insert_term(
33 33
 				'Recipe',
34 34
 				Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 
42 42
 		// Assign capabilities to manipulate entities to admins.
43
-		$admins = get_role( 'administrator' );
43
+		$admins = get_role('administrator');
44 44
 
45
-		$admins->add_cap( 'edit_wordlift_entity' );
46
-		$admins->add_cap( 'edit_wordlift_entities' );
47
-		$admins->add_cap( 'edit_others_wordlift_entities' );
48
-		$admins->add_cap( 'publish_wordlift_entities' );
49
-		$admins->add_cap( 'read_private_wordlift_entities' );
50
-		$admins->add_cap( 'delete_wordlift_entity' );
51
-		$admins->add_cap( 'delete_wordlift_entities' );
52
-		$admins->add_cap( 'delete_others_wordlift_entities' );
53
-		$admins->add_cap( 'delete_published_wordlift_entities' );
54
-		$admins->add_cap( 'delete_private_wordlift_entities' );
45
+		$admins->add_cap('edit_wordlift_entity');
46
+		$admins->add_cap('edit_wordlift_entities');
47
+		$admins->add_cap('edit_others_wordlift_entities');
48
+		$admins->add_cap('publish_wordlift_entities');
49
+		$admins->add_cap('read_private_wordlift_entities');
50
+		$admins->add_cap('delete_wordlift_entity');
51
+		$admins->add_cap('delete_wordlift_entities');
52
+		$admins->add_cap('delete_others_wordlift_entities');
53
+		$admins->add_cap('delete_published_wordlift_entities');
54
+		$admins->add_cap('delete_private_wordlift_entities');
55 55
 
56 56
 		// Assign capabilities to manipulate entities to editors.
57 57
 		/*
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 		 *
62 62
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/886
63 63
 		 */
64
-		$editors = get_role( 'editor' );
64
+		$editors = get_role('editor');
65 65
 
66
-		if ( isset( $editors ) ) {
67
-			$editors->add_cap( 'edit_wordlift_entity' );
68
-			$editors->add_cap( 'edit_wordlift_entities' );
69
-			$editors->add_cap( 'edit_others_wordlift_entities' );
70
-			$editors->add_cap( 'publish_wordlift_entities' );
71
-			$editors->add_cap( 'read_private_wordlift_entities' );
72
-			$editors->add_cap( 'delete_wordlift_entity' );
73
-			$editors->add_cap( 'delete_wordlift_entities' );
74
-			$editors->add_cap( 'delete_others_wordlift_entities' );
75
-			$editors->add_cap( 'delete_published_wordlift_entities' );
76
-			$editors->add_cap( 'delete_private_wordlift_entities' );
66
+		if (isset($editors)) {
67
+			$editors->add_cap('edit_wordlift_entity');
68
+			$editors->add_cap('edit_wordlift_entities');
69
+			$editors->add_cap('edit_others_wordlift_entities');
70
+			$editors->add_cap('publish_wordlift_entities');
71
+			$editors->add_cap('read_private_wordlift_entities');
72
+			$editors->add_cap('delete_wordlift_entity');
73
+			$editors->add_cap('delete_wordlift_entities');
74
+			$editors->add_cap('delete_others_wordlift_entities');
75
+			$editors->add_cap('delete_published_wordlift_entities');
76
+			$editors->add_cap('delete_private_wordlift_entities');
77 77
 		}
78 78
 
79 79
 	}
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-not-enriched-filter.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -4,53 +4,53 @@
 block discarded – undo
4 4
 
5 5
 class Wordlift_Admin_Not_Enriched_Filter {
6 6
 
7
-	const PARAMETER_NAME = 'wl_enriched';
7
+    const PARAMETER_NAME = 'wl_enriched';
8 8
 
9
-	public function __construct() {
9
+    public function __construct() {
10 10
 
11
-		// Hook to `views_edit-post`.
12
-		add_filter( 'views_edit-post', array( $this, 'view_edit' ) );
11
+        // Hook to `views_edit-post`.
12
+        add_filter( 'views_edit-post', array( $this, 'view_edit' ) );
13 13
 
14
-		// Add the `posts_where` filter if the filter is active.
15
-		if ( $this->is_filter_active() ) {
16
-			add_filter( 'posts_where', array( $this, 'posts_where' ) );
17
-		}
14
+        // Add the `posts_where` filter if the filter is active.
15
+        if ( $this->is_filter_active() ) {
16
+            add_filter( 'posts_where', array( $this, 'posts_where' ) );
17
+        }
18 18
 
19
-	}
19
+    }
20 20
 
21
-	public function posts_where( $where ) {
22
-		global $wpdb;
21
+    public function posts_where( $where ) {
22
+        global $wpdb;
23 23
 
24
-		return $where .
25
-		       " AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )";
26
-	}
24
+        return $where .
25
+                " AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )";
26
+    }
27 27
 
28
-	public function view_edit( $views ) {
29
-		global $wpdb;
28
+    public function view_edit( $views ) {
29
+        global $wpdb;
30 30
 
31
-		$url = add_query_arg( array( self::PARAMETER_NAME => 'no', 'post_type' => 'post', ), 'edit.php' );
31
+        $url = add_query_arg( array( self::PARAMETER_NAME => 'no', 'post_type' => 'post', ), 'edit.php' );
32 32
 
33
-		$not_enriched_count = $wpdb->get_var( <<<EOF
33
+        $not_enriched_count = $wpdb->get_var( <<<EOF
34 34
 SELECT COUNT( 1 ) FROM $wpdb->posts p
35 35
  WHERE p.post_type = 'post'
36 36
    AND p.post_status <> 'trash' 
37 37
    AND p.post_status <> 'auto-draft'
38 38
    AND p.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )
39 39
 EOF
40
-		);
40
+        );
41 41
 
42
-		$link = '<a href="'
43
-		        . esc_url( $url ) . '"'
44
-		        . ( $this->is_filter_active() ? ' class="current" aria-current="page"' : '' )
45
-		        . '>' . esc_html( __( 'Not enriched', 'wordlift' ) ) . '</a> (' . $not_enriched_count . ')';
42
+        $link = '<a href="'
43
+                . esc_url( $url ) . '"'
44
+                . ( $this->is_filter_active() ? ' class="current" aria-current="page"' : '' )
45
+                . '>' . esc_html( __( 'Not enriched', 'wordlift' ) ) . '</a> (' . $not_enriched_count . ')';
46 46
 
47
-		$views['wl_not_enriched'] = $link;
47
+        $views['wl_not_enriched'] = $link;
48 48
 
49
-		return $views;
50
-	}
49
+        return $views;
50
+    }
51 51
 
52
-	public function is_filter_active() {
53
-		return 'no' === filter_input( INPUT_GET, self::PARAMETER_NAME );
54
-	}
52
+    public function is_filter_active() {
53
+        return 'no' === filter_input( INPUT_GET, self::PARAMETER_NAME );
54
+    }
55 55
 
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@  discard block
 block discarded – undo
9 9
 	public function __construct() {
10 10
 
11 11
 		// Hook to `views_edit-post`.
12
-		add_filter( 'views_edit-post', array( $this, 'view_edit' ) );
12
+		add_filter('views_edit-post', array($this, 'view_edit'));
13 13
 
14 14
 		// Add the `posts_where` filter if the filter is active.
15
-		if ( $this->is_filter_active() ) {
16
-			add_filter( 'posts_where', array( $this, 'posts_where' ) );
15
+		if ($this->is_filter_active()) {
16
+			add_filter('posts_where', array($this, 'posts_where'));
17 17
 		}
18 18
 
19 19
 	}
20 20
 
21
-	public function posts_where( $where ) {
21
+	public function posts_where($where) {
22 22
 		global $wpdb;
23 23
 
24
-		return $where .
24
+		return $where.
25 25
 		       " AND {$wpdb->posts}.ID NOT IN ( SELECT DISTINCT subject_id FROM {$wpdb->prefix}wl_relation_instances )";
26 26
 	}
27 27
 
28
-	public function view_edit( $views ) {
28
+	public function view_edit($views) {
29 29
 		global $wpdb;
30 30
 
31
-		$url = add_query_arg( array( self::PARAMETER_NAME => 'no', 'post_type' => 'post', ), 'edit.php' );
31
+		$url = add_query_arg(array(self::PARAMETER_NAME => 'no', 'post_type' => 'post',), 'edit.php');
32 32
 
33
-		$not_enriched_count = $wpdb->get_var( <<<EOF
33
+		$not_enriched_count = $wpdb->get_var(<<<EOF
34 34
 SELECT COUNT( 1 ) FROM $wpdb->posts p
35 35
  WHERE p.post_type = 'post'
36 36
    AND p.post_status <> 'trash' 
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 		);
41 41
 
42 42
 		$link = '<a href="'
43
-		        . esc_url( $url ) . '"'
44
-		        . ( $this->is_filter_active() ? ' class="current" aria-current="page"' : '' )
45
-		        . '>' . esc_html( __( 'Not enriched', 'wordlift' ) ) . '</a> (' . $not_enriched_count . ')';
43
+		        . esc_url($url).'"'
44
+		        . ($this->is_filter_active() ? ' class="current" aria-current="page"' : '')
45
+		        . '>'.esc_html(__('Not enriched', 'wordlift')).'</a> ('.$not_enriched_count.')';
46 46
 
47 47
 		$views['wl_not_enriched'] = $link;
48 48
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	public function is_filter_active() {
53
-		return 'no' === filter_input( INPUT_GET, self::PARAMETER_NAME );
53
+		return 'no' === filter_input(INPUT_GET, self::PARAMETER_NAME);
54 54
 	}
55 55
 
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-settings-general-page.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit;
10
+    exit;
11 11
 }
12 12
 ?>
13 13
 
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 <form action="options.php" method="post">
17 17
 	<?php
18
-	settings_fields( 'wl_general_settings' );
19
-	do_settings_sections( 'wl_general_settings' );
20
-	submit_button();
21
-	?>
18
+    settings_fields( 'wl_general_settings' );
19
+    do_settings_sections( 'wl_general_settings' );
20
+    submit_button();
21
+    ?>
22 22
 </form>
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package Wordlift/admin
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 ?>
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 <form action="options.php" method="post">
17 17
 	<?php
18
-	settings_fields( 'wl_general_settings' );
19
-	do_settings_sections( 'wl_general_settings' );
18
+	settings_fields('wl_general_settings');
19
+	do_settings_sections('wl_general_settings');
20 20
 	submit_button();
21 21
 	?>
22 22
 </form>
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/admin/partials/wordlift-admin-mappings-page.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -17,50 +17,50 @@  discard block
 block discarded – undo
17 17
 
18 18
 	<?php
19 19
 
20
-	$mappings = array_reduce(
21
-	// The list of valid post types.
22
-		Wordlift_Entity_Service::valid_entity_post_types(),
20
+    $mappings = array_reduce(
21
+    // The list of valid post types.
22
+        Wordlift_Entity_Service::valid_entity_post_types(),
23 23
 
24
-		function ( $carry, $post_type ) use ( $mapping_service ) {
25
-			$entity_types = array_filter( Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ),
26
-				function ( $item ) {
27
-					return 'http://schema.org/Article' !== $item;
28
-				} );
24
+        function ( $carry, $post_type ) use ( $mapping_service ) {
25
+            $entity_types = array_filter( Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ),
26
+                function ( $item ) {
27
+                    return 'http://schema.org/Article' !== $item;
28
+                } );
29 29
 
30
-			if ( empty( $entity_types ) ) {
31
-				return $carry;
32
-			}
30
+            if ( empty( $entity_types ) ) {
31
+                return $carry;
32
+            }
33 33
 
34
-			return $carry + array(
35
-					$post_type => array(
36
-						'entity_types' => $entity_types,
37
-						'count'        => $mapping_service->count( $post_type, $entity_types ),
38
-					),
39
-				);
40
-		},
41
-		array() );
34
+            return $carry + array(
35
+                    $post_type => array(
36
+                        'entity_types' => $entity_types,
37
+                        'count'        => $mapping_service->count( $post_type, $entity_types ),
38
+                    ),
39
+                );
40
+        },
41
+        array() );
42 42
 
43
-	$mappings['_nonce'] = wp_create_nonce( 'update_post_type_entity_types' );
43
+    $mappings['_nonce'] = wp_create_nonce( 'update_post_type_entity_types' );
44 44
 
45 45
 
46
-	$json = wp_json_encode( $mappings );
47
-	echo "<script type='application/javascript'>var wlMappings = $json;</script>";
46
+    $json = wp_json_encode( $mappings );
47
+    echo "<script type='application/javascript'>var wlMappings = $json;</script>";
48 48
 
49
-	?>
49
+    ?>
50 50
 
51 51
 	<?php
52 52
 
53
-	foreach ( $mappings as $key => $value ) {
54
-		// Continue if this is the nonce.
55
-		if ( '_nonce' == $key ) {
56
-			continue;
57
-		}
58
-
59
-		// Continue if the count isn't set or it's zero, i.e. no need to apply the taxonomy.
60
-		if ( ! isset( $value['count'] ) || 0 === $value['count'] ) {
61
-			continue;
62
-		}
63
-		?>
53
+    foreach ( $mappings as $key => $value ) {
54
+        // Continue if this is the nonce.
55
+        if ( '_nonce' == $key ) {
56
+            continue;
57
+        }
58
+
59
+        // Continue if the count isn't set or it's zero, i.e. no need to apply the taxonomy.
60
+        if ( ! isset( $value['count'] ) || 0 === $value['count'] ) {
61
+            continue;
62
+        }
63
+        ?>
64 64
         <div class="post-type-to-entity-types">
65 65
             <button data-post-type="<?php echo esc_attr( $key ); ?>"
66 66
                     data-entity-types="<?php echo esc_attr( wp_json_encode( $value['entity_types'] ) ); ?>"
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
             <div><?php echo esc_html( $value['count'] ); ?></div>
69 69
         </div>
70 70
 		<?php
71
-	}
71
+    }
72 72
 
73
-	?>
73
+    ?>
74 74
 
75 75
     <div id="schemaorg-sync">
76 76
         <button>Sync Schema.org classes</button>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
  * @package Wordlift
7 7
  * @subpackage Wordlift/admin/partials
8 8
  */
9
-wp_enqueue_script( 'wp-util' );
9
+wp_enqueue_script('wp-util');
10 10
 
11 11
 $mapping_service = Wordlift_Mapping_Service::get_instance();
12 12
 ?>
13 13
 <div id="wpbody-content" aria-label="Main content" tabindex="0">
14 14
     <div class="wrap">
15
-        <h1><?php echo esc_html__( 'Mappings', 'wordlift' ); ?></h1>
15
+        <h1><?php echo esc_html__('Mappings', 'wordlift'); ?></h1>
16 16
     </div>
17 17
 
18 18
 	<?php
@@ -21,51 +21,51 @@  discard block
 block discarded – undo
21 21
 	// The list of valid post types.
22 22
 		Wordlift_Entity_Service::valid_entity_post_types(),
23 23
 
24
-		function ( $carry, $post_type ) use ( $mapping_service ) {
25
-			$entity_types = array_filter( Wordlift_Entity_Type_Adapter::get_entity_types( $post_type ),
26
-				function ( $item ) {
24
+		function($carry, $post_type) use ($mapping_service) {
25
+			$entity_types = array_filter(Wordlift_Entity_Type_Adapter::get_entity_types($post_type),
26
+				function($item) {
27 27
 					return 'http://schema.org/Article' !== $item;
28 28
 				} );
29 29
 
30
-			if ( empty( $entity_types ) ) {
30
+			if (empty($entity_types)) {
31 31
 				return $carry;
32 32
 			}
33 33
 
34 34
 			return $carry + array(
35 35
 					$post_type => array(
36 36
 						'entity_types' => $entity_types,
37
-						'count'        => $mapping_service->count( $post_type, $entity_types ),
37
+						'count'        => $mapping_service->count($post_type, $entity_types),
38 38
 					),
39 39
 				);
40 40
 		},
41 41
 		array() );
42 42
 
43
-	$mappings['_nonce'] = wp_create_nonce( 'update_post_type_entity_types' );
43
+	$mappings['_nonce'] = wp_create_nonce('update_post_type_entity_types');
44 44
 
45 45
 
46
-	$json = wp_json_encode( $mappings );
46
+	$json = wp_json_encode($mappings);
47 47
 	echo "<script type='application/javascript'>var wlMappings = $json;</script>";
48 48
 
49 49
 	?>
50 50
 
51 51
 	<?php
52 52
 
53
-	foreach ( $mappings as $key => $value ) {
53
+	foreach ($mappings as $key => $value) {
54 54
 		// Continue if this is the nonce.
55
-		if ( '_nonce' == $key ) {
55
+		if ('_nonce' == $key) {
56 56
 			continue;
57 57
 		}
58 58
 
59 59
 		// Continue if the count isn't set or it's zero, i.e. no need to apply the taxonomy.
60
-		if ( ! isset( $value['count'] ) || 0 === $value['count'] ) {
60
+		if ( ! isset($value['count']) || 0 === $value['count']) {
61 61
 			continue;
62 62
 		}
63 63
 		?>
64 64
         <div class="post-type-to-entity-types">
65
-            <button data-post-type="<?php echo esc_attr( $key ); ?>"
66
-                    data-entity-types="<?php echo esc_attr( wp_json_encode( $value['entity_types'] ) ); ?>"
67
-            ><?php echo esc_html( $key ); ?></button>
68
-            <div><?php echo esc_html( $value['count'] ); ?></div>
65
+            <button data-post-type="<?php echo esc_attr($key); ?>"
66
+                    data-entity-types="<?php echo esc_attr(wp_json_encode($value['entity_types'])); ?>"
67
+            ><?php echo esc_html($key); ?></button>
68
+            <div><?php echo esc_html($value['count']); ?></div>
69 69
         </div>
70 70
 		<?php
71 71
 	}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     <div id="schemaorg-sync">
76 76
         <button>Sync Schema.org classes</button>
77
-        <div class="count"><?php echo esc_html( Wordlift_Schemaorg_Sync_Batch_Operation::get_instance()->count() ); ?></div>
77
+        <div class="count"><?php echo esc_html(Wordlift_Schemaorg_Sync_Batch_Operation::get_instance()->count()); ?></div>
78 78
     </div>
79 79
 
80 80
     <div class="clear"></div>
Please login to merge, or discard this patch.