Completed
Push — develop ( c1c2c4...440a55 )
by David
07:35
created
src/admin/class-wordlift-admin.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -22,103 +22,103 @@
 block discarded – undo
22 22
  */
23 23
 class Wordlift_Admin {
24 24
 
25
-	/**
26
-	 * The ID of this plugin.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   private
30
-	 * @var      string $plugin_name The ID of this plugin.
31
-	 */
32
-	private $plugin_name;
33
-
34
-	/**
35
-	 * The version of this plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   private
39
-	 * @var      string $version The current version of this plugin.
40
-	 */
41
-	private $version;
42
-
43
-	/**
44
-	 * Initialize the class and set its properties.
45
-	 *
46
-	 * @since    1.0.0
47
-	 *
48
-	 * @param      string $plugin_name The name of this plugin.
49
-	 * @param      string $version     The version of this plugin.
50
-	 */
51
-	public function __construct( $plugin_name, $version ) {
52
-
53
-		$this->plugin_name = $plugin_name;
54
-		$this->version     = $version;
55
-
56
-	}
57
-
58
-	/**
59
-	 * Register the stylesheets for the admin area.
60
-	 *
61
-	 * @since    1.0.0
62
-	 */
63
-	public function enqueue_styles() {
64
-
65
-		/**
66
-		 * This function is provided for demonstration purposes only.
67
-		 *
68
-		 * An instance of this class should be passed to the run() function
69
-		 * defined in Wordlift_Loader as all of the hooks are defined
70
-		 * in that particular class.
71
-		 *
72
-		 * The Wordlift_Loader will then create the relationship
73
-		 * between the defined hooks and the functions defined in this
74
-		 * class.
75
-		 */
76
-
77
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
78
-
79
-	}
80
-
81
-	/**
82
-	 * Register the JavaScript for the admin area.
83
-	 *
84
-	 * @since    1.0.0
85
-	 */
86
-	public function enqueue_scripts() {
87
-
88
-		/**
89
-		 * This function is provided for demonstration purposes only.
90
-		 *
91
-		 * An instance of this class should be passed to the run() function
92
-		 * defined in Wordlift_Loader as all of the hooks are defined
93
-		 * in that particular class.
94
-		 *
95
-		 * The Wordlift_Loader will then create the relationship
96
-		 * between the defined hooks and the functions defined in this
97
-		 * class.
98
-		 */
99
-
100
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array( 'jquery' ), $this->version, FALSE );
101
-
102
-		// Add WL api endpoint to retrieve entities based on their title. We only load it on the entity edit page.
103
-		$entity_being_edited = get_post();
104
-
105
-		wp_localize_script( $this->plugin_name, 'wlSettings', array(
106
-				'ajax_url'          => admin_url( 'admin-ajax.php' ),
107
-				'action'            => 'entity_by_title',
108
-				'post_id'           => $entity_being_edited->ID,
109
-				'entityBeingEdited' => isset( $entity_being_edited->post_type ) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric( get_the_ID() ),
110
-				'language'          => Wordlift_Configuration_Service::get_instance()->get_language_code(),
111
-				// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
112
-				// from the results, since we don't want the current entity to be discovered by the analysis.
113
-				//
114
-				// See https://github.com/insideout10/wordlift-plugin/issues/345
115
-				'itemId'            => Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID ),
116
-				'l10n'              => array(
117
-					'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
118
-				),
119
-			)
120
-		);
121
-
122
-	}
25
+    /**
26
+     * The ID of this plugin.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   private
30
+     * @var      string $plugin_name The ID of this plugin.
31
+     */
32
+    private $plugin_name;
33
+
34
+    /**
35
+     * The version of this plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   private
39
+     * @var      string $version The current version of this plugin.
40
+     */
41
+    private $version;
42
+
43
+    /**
44
+     * Initialize the class and set its properties.
45
+     *
46
+     * @since    1.0.0
47
+     *
48
+     * @param      string $plugin_name The name of this plugin.
49
+     * @param      string $version     The version of this plugin.
50
+     */
51
+    public function __construct( $plugin_name, $version ) {
52
+
53
+        $this->plugin_name = $plugin_name;
54
+        $this->version     = $version;
55
+
56
+    }
57
+
58
+    /**
59
+     * Register the stylesheets for the admin area.
60
+     *
61
+     * @since    1.0.0
62
+     */
63
+    public function enqueue_styles() {
64
+
65
+        /**
66
+         * This function is provided for demonstration purposes only.
67
+         *
68
+         * An instance of this class should be passed to the run() function
69
+         * defined in Wordlift_Loader as all of the hooks are defined
70
+         * in that particular class.
71
+         *
72
+         * The Wordlift_Loader will then create the relationship
73
+         * between the defined hooks and the functions defined in this
74
+         * class.
75
+         */
76
+
77
+        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
78
+
79
+    }
80
+
81
+    /**
82
+     * Register the JavaScript for the admin area.
83
+     *
84
+     * @since    1.0.0
85
+     */
86
+    public function enqueue_scripts() {
87
+
88
+        /**
89
+         * This function is provided for demonstration purposes only.
90
+         *
91
+         * An instance of this class should be passed to the run() function
92
+         * defined in Wordlift_Loader as all of the hooks are defined
93
+         * in that particular class.
94
+         *
95
+         * The Wordlift_Loader will then create the relationship
96
+         * between the defined hooks and the functions defined in this
97
+         * class.
98
+         */
99
+
100
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array( 'jquery' ), $this->version, FALSE );
101
+
102
+        // Add WL api endpoint to retrieve entities based on their title. We only load it on the entity edit page.
103
+        $entity_being_edited = get_post();
104
+
105
+        wp_localize_script( $this->plugin_name, 'wlSettings', array(
106
+                'ajax_url'          => admin_url( 'admin-ajax.php' ),
107
+                'action'            => 'entity_by_title',
108
+                'post_id'           => $entity_being_edited->ID,
109
+                'entityBeingEdited' => isset( $entity_being_edited->post_type ) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric( get_the_ID() ),
110
+                'language'          => Wordlift_Configuration_Service::get_instance()->get_language_code(),
111
+                // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
112
+                // from the results, since we don't want the current entity to be discovered by the analysis.
113
+                //
114
+                // See https://github.com/insideout10/wordlift-plugin/issues/345
115
+                'itemId'            => Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID ),
116
+                'l10n'              => array(
117
+                    'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
118
+                ),
119
+            )
120
+        );
121
+
122
+    }
123 123
 
124 124
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param      string $plugin_name The name of this plugin.
49 49
 	 * @param      string $version     The version of this plugin.
50 50
 	 */
51
-	public function __construct( $plugin_name, $version ) {
51
+	public function __construct($plugin_name, $version) {
52 52
 
53 53
 		$this->plugin_name = $plugin_name;
54 54
 		$this->version     = $version;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		 * class.
75 75
 		 */
76 76
 
77
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
77
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all');
78 78
 
79 79
 	}
80 80
 
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
 		 * class.
98 98
 		 */
99 99
 
100
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array( 'jquery' ), $this->version, FALSE );
100
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-admin.bundle.js', array('jquery'), $this->version, FALSE);
101 101
 
102 102
 		// Add WL api endpoint to retrieve entities based on their title. We only load it on the entity edit page.
103 103
 		$entity_being_edited = get_post();
104 104
 
105
-		wp_localize_script( $this->plugin_name, 'wlSettings', array(
106
-				'ajax_url'          => admin_url( 'admin-ajax.php' ),
105
+		wp_localize_script($this->plugin_name, 'wlSettings', array(
106
+				'ajax_url'          => admin_url('admin-ajax.php'),
107 107
 				'action'            => 'entity_by_title',
108 108
 				'post_id'           => $entity_being_edited->ID,
109
-				'entityBeingEdited' => isset( $entity_being_edited->post_type ) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric( get_the_ID() ),
109
+				'entityBeingEdited' => isset($entity_being_edited->post_type) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric(get_the_ID()),
110 110
 				'language'          => Wordlift_Configuration_Service::get_instance()->get_language_code(),
111 111
 				// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
112 112
 				// from the results, since we don't want the current entity to be discovered by the analysis.
113 113
 				//
114 114
 				// See https://github.com/insideout10/wordlift-plugin/issues/345
115
-				'itemId'            => Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID ),
115
+				'itemId'            => Wordlift_Entity_Service::get_instance()->get_uri($entity_being_edited->ID),
116 116
 				'l10n'              => array(
117
-					'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
117
+					'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'),
118 118
 				),
119 119
 			)
120 120
 		);
Please login to merge, or discard this patch.