@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-hooks', 'wp-i18n', 'wp-polyfill' ), |
|
3 | - 'version' => '8b6a9c18251baebefdc72d2933cc24c0', |
|
2 | + 'dependencies' => array( 'react', 'react-dom', 'wp-hooks', 'wp-i18n', 'wp-polyfill' ), |
|
3 | + 'version' => '8b6a9c18251baebefdc72d2933cc24c0', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-hooks', 'wp-i18n', 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('react', 'react-dom', 'wp-hooks', 'wp-i18n', 'wp-polyfill'), |
|
3 | 3 | 'version' => '8b6a9c18251baebefdc72d2933cc24c0', |
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
3 | - 'version' => '0c57500bd37063fdc65ebde551e8f64d', |
|
2 | + 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
3 | + 'version' => '0c57500bd37063fdc65ebde551e8f64d', |
|
4 | 4 | ); |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php return array( |
2 | - 'dependencies' => array( 'react', 'react-dom', 'wp-polyfill' ), |
|
2 | + 'dependencies' => array('react', 'react-dom', 'wp-polyfill'), |
|
3 | 3 | 'version' => '0c57500bd37063fdc65ebde551e8f64d', |
4 | 4 | ); |
@@ -16,175 +16,175 @@ |
||
16 | 16 | */ |
17 | 17 | class Wordlift_Entity_Post_Type_Service { |
18 | 18 | |
19 | - /** |
|
20 | - * The entity post type. |
|
21 | - * |
|
22 | - * @since 3.6.0 |
|
23 | - * @access private |
|
24 | - * @var string $post_type The entity post type. |
|
25 | - */ |
|
26 | - private $post_type; |
|
27 | - |
|
28 | - /** |
|
29 | - * The entity type slug. |
|
30 | - * |
|
31 | - * @since 3.6.0 |
|
32 | - * @access private |
|
33 | - * @var string $slug The entity type slug. |
|
34 | - */ |
|
35 | - private $slug; |
|
36 | - |
|
37 | - /** |
|
38 | - * A {@link Wordlift_Log_Service} instance. |
|
39 | - * |
|
40 | - * @since 3.16.3 |
|
41 | - * @access private |
|
42 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
43 | - */ |
|
44 | - private $log; |
|
45 | - |
|
46 | - /** |
|
47 | - * A singleton instance of the entity type service. |
|
48 | - * |
|
49 | - * @since 3.6.0 |
|
50 | - * @access private |
|
51 | - * @var Wordlift_Entity_Post_Type_Service |
|
52 | - */ |
|
53 | - private static $instance; |
|
54 | - |
|
55 | - /** |
|
56 | - * Create an entity type service instance. |
|
57 | - * |
|
58 | - * @param string $post_type The post type, e.g. entity. |
|
59 | - * @param string $slug The entity type slug, if the slug is empty, the default slug will be used. |
|
60 | - * |
|
61 | - * @since 3.6.0 |
|
62 | - */ |
|
63 | - public function __construct( $post_type, $slug ) { |
|
64 | - |
|
65 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
66 | - |
|
67 | - $this->post_type = $post_type; |
|
68 | - |
|
69 | - // We cannot assign an empty slug to the register_post_type function, therefore if the slug is empty we default |
|
70 | - // to the type name. |
|
71 | - $this->slug = $slug ? $slug : $post_type; |
|
72 | - |
|
73 | - self::$instance = $this; |
|
74 | - |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Get the entity type service singleton instance. |
|
79 | - * |
|
80 | - * @return Wordlift_Entity_Post_Type_Service The entity type service singleton instance. |
|
81 | - * @since 3.6.0 |
|
82 | - */ |
|
83 | - public static function get_instance() { |
|
84 | - |
|
85 | - return self::$instance; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Get the entity type slug. |
|
90 | - * |
|
91 | - * @return string The entity type slug. |
|
92 | - * @since 3.6.0 |
|
93 | - */ |
|
94 | - public function get_slug() { |
|
95 | - |
|
96 | - return $this->slug; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Get the entity post type name. |
|
101 | - * |
|
102 | - * @return string The entity post type. |
|
103 | - * @since 3.6.0 |
|
104 | - */ |
|
105 | - public function get_post_type() { |
|
106 | - |
|
107 | - return $this->post_type; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * Register the WordLift entity post type. This method is hooked to WordPress' init action. |
|
112 | - * |
|
113 | - * @since 3.6.0 |
|
114 | - */ |
|
115 | - public function register() { |
|
116 | - |
|
117 | - $this->log->debug( "Registering post type $this->post_type..." ); |
|
118 | - |
|
119 | - $labels = array( |
|
120 | - 'name' => _x( 'Vocabulary', 'post type general name', 'wordlift' ), |
|
121 | - 'singular_name' => _x( 'Entity', 'post type singular name', 'wordlift' ), |
|
122 | - 'add_new' => _x( 'Add New Entity', 'entity', 'wordlift' ), |
|
123 | - 'add_new_item' => __( 'Add New Entity', 'wordlift' ), |
|
124 | - 'edit_item' => __( 'Edit Entity', 'wordlift' ), |
|
125 | - 'new_item' => __( 'New Entity', 'wordlift' ), |
|
126 | - 'all_items' => __( 'All Entities', 'wordlift' ), |
|
127 | - 'view_item' => __( 'View Entity', 'wordlift' ), |
|
128 | - 'search_items' => __( 'Search in Vocabulary', 'wordlift' ), |
|
129 | - 'not_found' => __( 'No entities found', 'wordlift' ), |
|
130 | - 'not_found_in_trash' => __( 'No entities found in the Trash', 'wordlift' ), |
|
131 | - 'parent_item_colon' => '', |
|
132 | - 'menu_name' => __( 'Vocabulary', 'wordlift' ), |
|
133 | - ); |
|
134 | - |
|
135 | - $args = array( |
|
136 | - 'labels' => $labels, |
|
137 | - 'description' => 'Holds our vocabulary (set of entities) and entity specific data', |
|
138 | - 'public' => true, |
|
139 | - 'menu_position' => 20, |
|
140 | - // after the pages menu. |
|
141 | - // Add support for 'authors' and 'revisions': |
|
142 | - // * see https://github.com/insideout10/wordlift-plugin/issues/395 |
|
143 | - // * see https://github.com/insideout10/wordlift-plugin/issues/376 |
|
144 | - 'supports' => array( |
|
145 | - 'title', |
|
146 | - 'editor', |
|
147 | - 'thumbnail', |
|
148 | - 'excerpt', |
|
149 | - 'comments', |
|
150 | - 'author', |
|
151 | - 'revisions', |
|
152 | - 'custom-fields', |
|
153 | - ), |
|
154 | - 'menu_icon' => WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-vocabulary-icon.svg', |
|
155 | - // Although we define our slug here, we further manage linking to entities using the Wordlift_Entity_Link_Service. |
|
156 | - 'rewrite' => array( 'slug' => $this->slug ), |
|
157 | - 'capability_type' => array( |
|
158 | - 'wordlift_entity', |
|
159 | - 'wordlift_entities', |
|
160 | - ), |
|
161 | - 'capabilities' => array( |
|
162 | - 'delete_posts' => 'delete_wordlift_entities', |
|
163 | - ), |
|
164 | - 'rest_base' => 'entities', |
|
165 | - 'show_in_rest' => true, |
|
166 | - /** |
|
167 | - * Filter: wl_feature__enable__vocabulary. |
|
168 | - * |
|
169 | - * @param bool whether the vocabulary needs to be shown in menu. |
|
170 | - * |
|
171 | - * @return bool |
|
172 | - * @since 3.27.6 |
|
173 | - */ |
|
174 | - 'show_in_menu' => apply_filters( 'wl_feature__enable__vocabulary', true ), |
|
175 | - ); |
|
176 | - |
|
177 | - register_post_type( $this->post_type, $args ); |
|
178 | - |
|
179 | - // Enable WP's standard `category` taxonomy for entities. |
|
180 | - // |
|
181 | - // While this enables editors to bind entities to the WP posts' category |
|
182 | - // taxonomy, in Wordlift_Category_Taxonomy_Service we also need to alter |
|
183 | - // WP's main category query to include the `entity` post type. |
|
184 | - // |
|
185 | - // See https://github.com/insideout10/wordlift-plugin/issues/442 |
|
186 | - register_taxonomy_for_object_type( 'category', $this->post_type ); |
|
187 | - |
|
188 | - } |
|
19 | + /** |
|
20 | + * The entity post type. |
|
21 | + * |
|
22 | + * @since 3.6.0 |
|
23 | + * @access private |
|
24 | + * @var string $post_type The entity post type. |
|
25 | + */ |
|
26 | + private $post_type; |
|
27 | + |
|
28 | + /** |
|
29 | + * The entity type slug. |
|
30 | + * |
|
31 | + * @since 3.6.0 |
|
32 | + * @access private |
|
33 | + * @var string $slug The entity type slug. |
|
34 | + */ |
|
35 | + private $slug; |
|
36 | + |
|
37 | + /** |
|
38 | + * A {@link Wordlift_Log_Service} instance. |
|
39 | + * |
|
40 | + * @since 3.16.3 |
|
41 | + * @access private |
|
42 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
43 | + */ |
|
44 | + private $log; |
|
45 | + |
|
46 | + /** |
|
47 | + * A singleton instance of the entity type service. |
|
48 | + * |
|
49 | + * @since 3.6.0 |
|
50 | + * @access private |
|
51 | + * @var Wordlift_Entity_Post_Type_Service |
|
52 | + */ |
|
53 | + private static $instance; |
|
54 | + |
|
55 | + /** |
|
56 | + * Create an entity type service instance. |
|
57 | + * |
|
58 | + * @param string $post_type The post type, e.g. entity. |
|
59 | + * @param string $slug The entity type slug, if the slug is empty, the default slug will be used. |
|
60 | + * |
|
61 | + * @since 3.6.0 |
|
62 | + */ |
|
63 | + public function __construct( $post_type, $slug ) { |
|
64 | + |
|
65 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
66 | + |
|
67 | + $this->post_type = $post_type; |
|
68 | + |
|
69 | + // We cannot assign an empty slug to the register_post_type function, therefore if the slug is empty we default |
|
70 | + // to the type name. |
|
71 | + $this->slug = $slug ? $slug : $post_type; |
|
72 | + |
|
73 | + self::$instance = $this; |
|
74 | + |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Get the entity type service singleton instance. |
|
79 | + * |
|
80 | + * @return Wordlift_Entity_Post_Type_Service The entity type service singleton instance. |
|
81 | + * @since 3.6.0 |
|
82 | + */ |
|
83 | + public static function get_instance() { |
|
84 | + |
|
85 | + return self::$instance; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Get the entity type slug. |
|
90 | + * |
|
91 | + * @return string The entity type slug. |
|
92 | + * @since 3.6.0 |
|
93 | + */ |
|
94 | + public function get_slug() { |
|
95 | + |
|
96 | + return $this->slug; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Get the entity post type name. |
|
101 | + * |
|
102 | + * @return string The entity post type. |
|
103 | + * @since 3.6.0 |
|
104 | + */ |
|
105 | + public function get_post_type() { |
|
106 | + |
|
107 | + return $this->post_type; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * Register the WordLift entity post type. This method is hooked to WordPress' init action. |
|
112 | + * |
|
113 | + * @since 3.6.0 |
|
114 | + */ |
|
115 | + public function register() { |
|
116 | + |
|
117 | + $this->log->debug( "Registering post type $this->post_type..." ); |
|
118 | + |
|
119 | + $labels = array( |
|
120 | + 'name' => _x( 'Vocabulary', 'post type general name', 'wordlift' ), |
|
121 | + 'singular_name' => _x( 'Entity', 'post type singular name', 'wordlift' ), |
|
122 | + 'add_new' => _x( 'Add New Entity', 'entity', 'wordlift' ), |
|
123 | + 'add_new_item' => __( 'Add New Entity', 'wordlift' ), |
|
124 | + 'edit_item' => __( 'Edit Entity', 'wordlift' ), |
|
125 | + 'new_item' => __( 'New Entity', 'wordlift' ), |
|
126 | + 'all_items' => __( 'All Entities', 'wordlift' ), |
|
127 | + 'view_item' => __( 'View Entity', 'wordlift' ), |
|
128 | + 'search_items' => __( 'Search in Vocabulary', 'wordlift' ), |
|
129 | + 'not_found' => __( 'No entities found', 'wordlift' ), |
|
130 | + 'not_found_in_trash' => __( 'No entities found in the Trash', 'wordlift' ), |
|
131 | + 'parent_item_colon' => '', |
|
132 | + 'menu_name' => __( 'Vocabulary', 'wordlift' ), |
|
133 | + ); |
|
134 | + |
|
135 | + $args = array( |
|
136 | + 'labels' => $labels, |
|
137 | + 'description' => 'Holds our vocabulary (set of entities) and entity specific data', |
|
138 | + 'public' => true, |
|
139 | + 'menu_position' => 20, |
|
140 | + // after the pages menu. |
|
141 | + // Add support for 'authors' and 'revisions': |
|
142 | + // * see https://github.com/insideout10/wordlift-plugin/issues/395 |
|
143 | + // * see https://github.com/insideout10/wordlift-plugin/issues/376 |
|
144 | + 'supports' => array( |
|
145 | + 'title', |
|
146 | + 'editor', |
|
147 | + 'thumbnail', |
|
148 | + 'excerpt', |
|
149 | + 'comments', |
|
150 | + 'author', |
|
151 | + 'revisions', |
|
152 | + 'custom-fields', |
|
153 | + ), |
|
154 | + 'menu_icon' => WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-vocabulary-icon.svg', |
|
155 | + // Although we define our slug here, we further manage linking to entities using the Wordlift_Entity_Link_Service. |
|
156 | + 'rewrite' => array( 'slug' => $this->slug ), |
|
157 | + 'capability_type' => array( |
|
158 | + 'wordlift_entity', |
|
159 | + 'wordlift_entities', |
|
160 | + ), |
|
161 | + 'capabilities' => array( |
|
162 | + 'delete_posts' => 'delete_wordlift_entities', |
|
163 | + ), |
|
164 | + 'rest_base' => 'entities', |
|
165 | + 'show_in_rest' => true, |
|
166 | + /** |
|
167 | + * Filter: wl_feature__enable__vocabulary. |
|
168 | + * |
|
169 | + * @param bool whether the vocabulary needs to be shown in menu. |
|
170 | + * |
|
171 | + * @return bool |
|
172 | + * @since 3.27.6 |
|
173 | + */ |
|
174 | + 'show_in_menu' => apply_filters( 'wl_feature__enable__vocabulary', true ), |
|
175 | + ); |
|
176 | + |
|
177 | + register_post_type( $this->post_type, $args ); |
|
178 | + |
|
179 | + // Enable WP's standard `category` taxonomy for entities. |
|
180 | + // |
|
181 | + // While this enables editors to bind entities to the WP posts' category |
|
182 | + // taxonomy, in Wordlift_Category_Taxonomy_Service we also need to alter |
|
183 | + // WP's main category query to include the `entity` post type. |
|
184 | + // |
|
185 | + // See https://github.com/insideout10/wordlift-plugin/issues/442 |
|
186 | + register_taxonomy_for_object_type( 'category', $this->post_type ); |
|
187 | + |
|
188 | + } |
|
189 | 189 | |
190 | 190 | } |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @since 3.6.0 |
62 | 62 | */ |
63 | - public function __construct( $post_type, $slug ) { |
|
63 | + public function __construct($post_type, $slug) { |
|
64 | 64 | |
65 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
65 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
66 | 66 | |
67 | 67 | $this->post_type = $post_type; |
68 | 68 | |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function register() { |
116 | 116 | |
117 | - $this->log->debug( "Registering post type $this->post_type..." ); |
|
117 | + $this->log->debug("Registering post type $this->post_type..."); |
|
118 | 118 | |
119 | 119 | $labels = array( |
120 | - 'name' => _x( 'Vocabulary', 'post type general name', 'wordlift' ), |
|
121 | - 'singular_name' => _x( 'Entity', 'post type singular name', 'wordlift' ), |
|
122 | - 'add_new' => _x( 'Add New Entity', 'entity', 'wordlift' ), |
|
123 | - 'add_new_item' => __( 'Add New Entity', 'wordlift' ), |
|
124 | - 'edit_item' => __( 'Edit Entity', 'wordlift' ), |
|
125 | - 'new_item' => __( 'New Entity', 'wordlift' ), |
|
126 | - 'all_items' => __( 'All Entities', 'wordlift' ), |
|
127 | - 'view_item' => __( 'View Entity', 'wordlift' ), |
|
128 | - 'search_items' => __( 'Search in Vocabulary', 'wordlift' ), |
|
129 | - 'not_found' => __( 'No entities found', 'wordlift' ), |
|
130 | - 'not_found_in_trash' => __( 'No entities found in the Trash', 'wordlift' ), |
|
120 | + 'name' => _x('Vocabulary', 'post type general name', 'wordlift'), |
|
121 | + 'singular_name' => _x('Entity', 'post type singular name', 'wordlift'), |
|
122 | + 'add_new' => _x('Add New Entity', 'entity', 'wordlift'), |
|
123 | + 'add_new_item' => __('Add New Entity', 'wordlift'), |
|
124 | + 'edit_item' => __('Edit Entity', 'wordlift'), |
|
125 | + 'new_item' => __('New Entity', 'wordlift'), |
|
126 | + 'all_items' => __('All Entities', 'wordlift'), |
|
127 | + 'view_item' => __('View Entity', 'wordlift'), |
|
128 | + 'search_items' => __('Search in Vocabulary', 'wordlift'), |
|
129 | + 'not_found' => __('No entities found', 'wordlift'), |
|
130 | + 'not_found_in_trash' => __('No entities found in the Trash', 'wordlift'), |
|
131 | 131 | 'parent_item_colon' => '', |
132 | - 'menu_name' => __( 'Vocabulary', 'wordlift' ), |
|
132 | + 'menu_name' => __('Vocabulary', 'wordlift'), |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | $args = array( |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | 'revisions', |
152 | 152 | 'custom-fields', |
153 | 153 | ), |
154 | - 'menu_icon' => WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-vocabulary-icon.svg', |
|
154 | + 'menu_icon' => WP_CONTENT_URL.'/plugins/wordlift/images/svg/wl-vocabulary-icon.svg', |
|
155 | 155 | // Although we define our slug here, we further manage linking to entities using the Wordlift_Entity_Link_Service. |
156 | - 'rewrite' => array( 'slug' => $this->slug ), |
|
156 | + 'rewrite' => array('slug' => $this->slug), |
|
157 | 157 | 'capability_type' => array( |
158 | 158 | 'wordlift_entity', |
159 | 159 | 'wordlift_entities', |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | * @return bool |
172 | 172 | * @since 3.27.6 |
173 | 173 | */ |
174 | - 'show_in_menu' => apply_filters( 'wl_feature__enable__vocabulary', true ), |
|
174 | + 'show_in_menu' => apply_filters('wl_feature__enable__vocabulary', true), |
|
175 | 175 | ); |
176 | 176 | |
177 | - register_post_type( $this->post_type, $args ); |
|
177 | + register_post_type($this->post_type, $args); |
|
178 | 178 | |
179 | 179 | // Enable WP's standard `category` taxonomy for entities. |
180 | 180 | // |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // WP's main category query to include the `entity` post type. |
184 | 184 | // |
185 | 185 | // See https://github.com/insideout10/wordlift-plugin/issues/442 |
186 | - register_taxonomy_for_object_type( 'category', $this->post_type ); |
|
186 | + register_taxonomy_for_object_type('category', $this->post_type); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 |
@@ -7,17 +7,17 @@ |
||
7 | 7 | */ |
8 | 8 | class Wordlift_Install_3_39_1 extends Wordlift_Install { |
9 | 9 | |
10 | - /** |
|
11 | - * {@inheritdoc} |
|
12 | - */ |
|
13 | - protected static $version = '3.39.1'; |
|
10 | + /** |
|
11 | + * {@inheritdoc} |
|
12 | + */ |
|
13 | + protected static $version = '3.39.1'; |
|
14 | 14 | |
15 | - public function install() { |
|
15 | + public function install() { |
|
16 | 16 | |
17 | - Wordlift_Configuration_Service::get_instance()->set_alternate_name( |
|
18 | - wp_strip_all_tags( get_bloginfo( 'description' ) ) |
|
19 | - ); |
|
17 | + Wordlift_Configuration_Service::get_instance()->set_alternate_name( |
|
18 | + wp_strip_all_tags( get_bloginfo( 'description' ) ) |
|
19 | + ); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function install() { |
16 | 16 | |
17 | 17 | Wordlift_Configuration_Service::get_instance()->set_alternate_name( |
18 | - wp_strip_all_tags( get_bloginfo( 'description' ) ) |
|
18 | + wp_strip_all_tags(get_bloginfo('description')) |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | } |
@@ -7,13 +7,13 @@ |
||
7 | 7 | */ |
8 | 8 | class Wordlift_Install_3_40_1 extends Wordlift_Install { |
9 | 9 | |
10 | - /** |
|
11 | - * {@inheritdoc} |
|
12 | - */ |
|
13 | - protected static $version = '3.40.1'; |
|
10 | + /** |
|
11 | + * {@inheritdoc} |
|
12 | + */ |
|
13 | + protected static $version = '3.40.1'; |
|
14 | 14 | |
15 | - public function install() { |
|
16 | - // Flush the rewrite rules. |
|
17 | - flush_rewrite_rules(); |
|
18 | - } |
|
15 | + public function install() { |
|
16 | + // Flush the rewrite rules. |
|
17 | + flush_rewrite_rules(); |
|
18 | + } |
|
19 | 19 | } |
@@ -30,396 +30,396 @@ |
||
30 | 30 | */ |
31 | 31 | class Wordlift_Admin { |
32 | 32 | |
33 | - /** |
|
34 | - * The singleton instance. |
|
35 | - * |
|
36 | - * @since 3.19.4 |
|
37 | - * @access private |
|
38 | - * @var Wordlift_Admin $instance The singleton instance. |
|
39 | - */ |
|
40 | - private static $instance; |
|
41 | - /** |
|
42 | - * The ID of this plugin. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * @access private |
|
46 | - * @var string $plugin_name The ID of this plugin. |
|
47 | - */ |
|
48 | - private $plugin_name; |
|
49 | - /** |
|
50 | - * The version of this plugin. |
|
51 | - * |
|
52 | - * @since 1.0.0 |
|
53 | - * @access private |
|
54 | - * @var string $version The current version of this plugin. |
|
55 | - */ |
|
56 | - private $version; |
|
57 | - /** |
|
58 | - * The {@link Wordlift_User_Service} instance. |
|
59 | - * |
|
60 | - * @since 3.14.0 |
|
61 | - * @access private |
|
62 | - * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
63 | - */ |
|
64 | - private $user_service; |
|
65 | - /** |
|
66 | - * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
67 | - * |
|
68 | - * @since 3.20.0 |
|
69 | - * @access private |
|
70 | - * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
71 | - */ |
|
72 | - private $sync_batch_operation_ajax_adapter; |
|
73 | - |
|
74 | - /** |
|
75 | - * Initialize the class and set its properties. |
|
76 | - * |
|
77 | - * @param string $plugin_name The name of this plugin. |
|
78 | - * @param string $version The version of this plugin. |
|
79 | - * @param Wordlift_Notice_Service $notice_service The notice service. |
|
80 | - * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
81 | - * |
|
82 | - * @since 1.0.0 |
|
83 | - */ |
|
84 | - public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
85 | - |
|
86 | - $this->plugin_name = $plugin_name; |
|
87 | - $this->version = $version; |
|
88 | - |
|
89 | - $this->user_service = $user_service; |
|
90 | - |
|
91 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
92 | - $dataset_uri = $configuration_service->get_dataset_uri(); |
|
93 | - $key = $configuration_service->get_key(); |
|
94 | - $features_registry = Features_Registry::get_instance(); |
|
95 | - if ( empty( $dataset_uri ) ) { |
|
96 | - $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
97 | - if ( empty( $key ) ) { |
|
98 | - /* translators: %s: The link to the settings page. */ |
|
99 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
100 | - } else { |
|
101 | - /* translators: %s: The link to the settings page. */ |
|
102 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
103 | - } |
|
104 | - $notice_service->add_error( $error ); |
|
105 | - } |
|
106 | - |
|
107 | - // Load additional code if we're in the admin UI. |
|
108 | - if ( is_admin() ) { |
|
109 | - |
|
110 | - // Require the PHP files for the next code fragment. |
|
111 | - self::require_files(); |
|
112 | - |
|
113 | - /* |
|
33 | + /** |
|
34 | + * The singleton instance. |
|
35 | + * |
|
36 | + * @since 3.19.4 |
|
37 | + * @access private |
|
38 | + * @var Wordlift_Admin $instance The singleton instance. |
|
39 | + */ |
|
40 | + private static $instance; |
|
41 | + /** |
|
42 | + * The ID of this plugin. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * @access private |
|
46 | + * @var string $plugin_name The ID of this plugin. |
|
47 | + */ |
|
48 | + private $plugin_name; |
|
49 | + /** |
|
50 | + * The version of this plugin. |
|
51 | + * |
|
52 | + * @since 1.0.0 |
|
53 | + * @access private |
|
54 | + * @var string $version The current version of this plugin. |
|
55 | + */ |
|
56 | + private $version; |
|
57 | + /** |
|
58 | + * The {@link Wordlift_User_Service} instance. |
|
59 | + * |
|
60 | + * @since 3.14.0 |
|
61 | + * @access private |
|
62 | + * @var Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
63 | + */ |
|
64 | + private $user_service; |
|
65 | + /** |
|
66 | + * The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
67 | + * |
|
68 | + * @since 3.20.0 |
|
69 | + * @access private |
|
70 | + * @var Wordlift_Batch_Operation_Ajax_Adapter $sync_batch_operation_ajax_adapter The {@link Wordlift_Batch_Operation_Ajax_Adapter} instance. |
|
71 | + */ |
|
72 | + private $sync_batch_operation_ajax_adapter; |
|
73 | + |
|
74 | + /** |
|
75 | + * Initialize the class and set its properties. |
|
76 | + * |
|
77 | + * @param string $plugin_name The name of this plugin. |
|
78 | + * @param string $version The version of this plugin. |
|
79 | + * @param Wordlift_Notice_Service $notice_service The notice service. |
|
80 | + * @param Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance. |
|
81 | + * |
|
82 | + * @since 1.0.0 |
|
83 | + */ |
|
84 | + public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
85 | + |
|
86 | + $this->plugin_name = $plugin_name; |
|
87 | + $this->version = $version; |
|
88 | + |
|
89 | + $this->user_service = $user_service; |
|
90 | + |
|
91 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
92 | + $dataset_uri = $configuration_service->get_dataset_uri(); |
|
93 | + $key = $configuration_service->get_key(); |
|
94 | + $features_registry = Features_Registry::get_instance(); |
|
95 | + if ( empty( $dataset_uri ) ) { |
|
96 | + $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
97 | + if ( empty( $key ) ) { |
|
98 | + /* translators: %s: The link to the settings page. */ |
|
99 | + $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
100 | + } else { |
|
101 | + /* translators: %s: The link to the settings page. */ |
|
102 | + $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
103 | + } |
|
104 | + $notice_service->add_error( $error ); |
|
105 | + } |
|
106 | + |
|
107 | + // Load additional code if we're in the admin UI. |
|
108 | + if ( is_admin() ) { |
|
109 | + |
|
110 | + // Require the PHP files for the next code fragment. |
|
111 | + self::require_files(); |
|
112 | + |
|
113 | + /* |
|
114 | 114 | * @since 3.24.2 This function isn't called anymore because it was causing the Block Category to |
115 | 115 | * multiply in Block Editor. |
116 | 116 | * |
117 | 117 | * @see https://github.com/insideout10/wordlift-plugin/issues/1004 |
118 | 118 | */ |
119 | - // Add Wordlift custom block category. |
|
120 | - // self::add_block_category(); |
|
119 | + // Add Wordlift custom block category. |
|
120 | + // self::add_block_category(); |
|
121 | 121 | |
122 | - new Wordlift_Dashboard_Latest_News(); |
|
122 | + new Wordlift_Dashboard_Latest_News(); |
|
123 | 123 | |
124 | - /* |
|
124 | + /* |
|
125 | 125 | * Add support for `All Entity Types`. |
126 | 126 | * |
127 | 127 | * @since 3.20.0 |
128 | 128 | * |
129 | 129 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
130 | 130 | */ |
131 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
132 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
131 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
132 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
133 | 133 | |
134 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
135 | - /* |
|
134 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
135 | + /* |
|
136 | 136 | * The `Mappings` admin page. |
137 | 137 | */ |
138 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
138 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
139 | 139 | |
140 | - new Wordlift_Admin_Mappings_Page(); |
|
140 | + new Wordlift_Admin_Mappings_Page(); |
|
141 | 141 | |
142 | - /* |
|
142 | + /* |
|
143 | 143 | * Allow sync'ing the schema.org taxonomy with the schema.org json file. |
144 | 144 | * |
145 | 145 | * @since 3.20.0 |
146 | 146 | */ |
147 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
147 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
148 | 148 | |
149 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
149 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
150 | 150 | |
151 | - } |
|
151 | + } |
|
152 | 152 | |
153 | - /* |
|
153 | + /* |
|
154 | 154 | * Add the {@link Wordlift_Admin_Term_Adapter}. |
155 | 155 | * |
156 | 156 | * @since 3.20.0 |
157 | 157 | */ |
158 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
159 | - new Wordlift_Admin_Term_Adapter(); |
|
158 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
159 | + new Wordlift_Admin_Term_Adapter(); |
|
160 | 160 | |
161 | - /* |
|
161 | + /* |
|
162 | 162 | * The new dashboard. |
163 | 163 | * |
164 | 164 | * @since 3.20.0 |
165 | 165 | * |
166 | 166 | * @see https://github.com/insideout10/wordlift-plugin/issues/879 |
167 | 167 | */ |
168 | - new Wordlift_Admin_Dashboard_V2( |
|
169 | - Wordlift_Entity_Service::get_instance() |
|
170 | - ); |
|
171 | - new Wordlift_Admin_Not_Enriched_Filter(); |
|
172 | - |
|
173 | - } |
|
174 | - |
|
175 | - // @@todo only load this class if ACF is available. |
|
176 | - // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available. |
|
177 | - new Acf_Mappings(); |
|
178 | - |
|
179 | - // Add the Mappings' REST Controller. |
|
180 | - new Mappings_REST_Controller(); |
|
181 | - |
|
182 | - $features_registry->register_feature_from_slug( |
|
183 | - 'mappings', |
|
184 | - ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
185 | - array( $this, 'init_mappings' ) |
|
186 | - ); |
|
187 | - |
|
188 | - // Set the singleton instance. |
|
189 | - self::$instance = $this; |
|
190 | - |
|
191 | - } |
|
192 | - |
|
193 | - /** |
|
194 | - * Require files needed for the Admin UI. |
|
195 | - * |
|
196 | - * @since 3.20.0 |
|
197 | - */ |
|
198 | - private static function require_files() { |
|
199 | - |
|
200 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
203 | - |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * Get the singleton instance. |
|
208 | - * |
|
209 | - * @return Wordlift_Admin The singleton instance. |
|
210 | - * @since 3.19.4 |
|
211 | - */ |
|
212 | - public static function get_instance() { |
|
213 | - |
|
214 | - return self::$instance; |
|
215 | - } |
|
216 | - |
|
217 | - public static function is_gutenberg() { |
|
218 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
219 | - is_gutenberg_page() |
|
220 | - ) { |
|
221 | - // The Gutenberg plugin is on. |
|
222 | - return true; |
|
223 | - } |
|
224 | - $current_screen = get_current_screen(); |
|
225 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
226 | - $current_screen->is_block_editor() |
|
227 | - ) { |
|
228 | - // Gutenberg page on 5+. |
|
229 | - return true; |
|
230 | - } |
|
231 | - |
|
232 | - return false; |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * Register the stylesheets for the admin area. |
|
237 | - * |
|
238 | - * @since 1.0.0 |
|
239 | - */ |
|
240 | - public function enqueue_styles() { |
|
241 | - |
|
242 | - /** |
|
243 | - * This function is provided for demonstration purposes only. |
|
244 | - * |
|
245 | - * An instance of this class should be passed to the run() function |
|
246 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
247 | - * in that particular class. |
|
248 | - * |
|
249 | - * The Wordlift_Loader will then create the relationship |
|
250 | - * between the defined hooks and the functions defined in this |
|
251 | - * class. |
|
252 | - */ |
|
253 | - |
|
254 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
255 | - |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Register the JavaScript for the admin area. |
|
260 | - * |
|
261 | - * @since 1.0.0 |
|
262 | - */ |
|
263 | - public function enqueue_scripts() { |
|
264 | - |
|
265 | - /* |
|
168 | + new Wordlift_Admin_Dashboard_V2( |
|
169 | + Wordlift_Entity_Service::get_instance() |
|
170 | + ); |
|
171 | + new Wordlift_Admin_Not_Enriched_Filter(); |
|
172 | + |
|
173 | + } |
|
174 | + |
|
175 | + // @@todo only load this class if ACF is available. |
|
176 | + // Add support for ACF mappings, so that the admin edit mappings page can pick up ACF support when ACF is available. |
|
177 | + new Acf_Mappings(); |
|
178 | + |
|
179 | + // Add the Mappings' REST Controller. |
|
180 | + new Mappings_REST_Controller(); |
|
181 | + |
|
182 | + $features_registry->register_feature_from_slug( |
|
183 | + 'mappings', |
|
184 | + ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
185 | + array( $this, 'init_mappings' ) |
|
186 | + ); |
|
187 | + |
|
188 | + // Set the singleton instance. |
|
189 | + self::$instance = $this; |
|
190 | + |
|
191 | + } |
|
192 | + |
|
193 | + /** |
|
194 | + * Require files needed for the Admin UI. |
|
195 | + * |
|
196 | + * @since 3.20.0 |
|
197 | + */ |
|
198 | + private static function require_files() { |
|
199 | + |
|
200 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
203 | + |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * Get the singleton instance. |
|
208 | + * |
|
209 | + * @return Wordlift_Admin The singleton instance. |
|
210 | + * @since 3.19.4 |
|
211 | + */ |
|
212 | + public static function get_instance() { |
|
213 | + |
|
214 | + return self::$instance; |
|
215 | + } |
|
216 | + |
|
217 | + public static function is_gutenberg() { |
|
218 | + if ( function_exists( 'is_gutenberg_page' ) && |
|
219 | + is_gutenberg_page() |
|
220 | + ) { |
|
221 | + // The Gutenberg plugin is on. |
|
222 | + return true; |
|
223 | + } |
|
224 | + $current_screen = get_current_screen(); |
|
225 | + if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
226 | + $current_screen->is_block_editor() |
|
227 | + ) { |
|
228 | + // Gutenberg page on 5+. |
|
229 | + return true; |
|
230 | + } |
|
231 | + |
|
232 | + return false; |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * Register the stylesheets for the admin area. |
|
237 | + * |
|
238 | + * @since 1.0.0 |
|
239 | + */ |
|
240 | + public function enqueue_styles() { |
|
241 | + |
|
242 | + /** |
|
243 | + * This function is provided for demonstration purposes only. |
|
244 | + * |
|
245 | + * An instance of this class should be passed to the run() function |
|
246 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
247 | + * in that particular class. |
|
248 | + * |
|
249 | + * The Wordlift_Loader will then create the relationship |
|
250 | + * between the defined hooks and the functions defined in this |
|
251 | + * class. |
|
252 | + */ |
|
253 | + |
|
254 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
255 | + |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Register the JavaScript for the admin area. |
|
260 | + * |
|
261 | + * @since 1.0.0 |
|
262 | + */ |
|
263 | + public function enqueue_scripts() { |
|
264 | + |
|
265 | + /* |
|
266 | 266 | * Do not load our scripts on the Filter Urls plugin admin pages. |
267 | 267 | * |
268 | 268 | * @see https://github.com/insideout10/wordlift-plugin/issues/901 |
269 | 269 | * @since 3.20.0 |
270 | 270 | */ |
271 | - $screen = get_current_screen(); |
|
272 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
273 | - return; |
|
274 | - } |
|
275 | - |
|
276 | - // Enqueue the admin scripts. |
|
277 | - wp_enqueue_script( |
|
278 | - $this->plugin_name, |
|
279 | - plugin_dir_url( __FILE__ ) . 'js/1/admin.js', |
|
280 | - array( |
|
281 | - 'jquery', |
|
282 | - 'underscore', |
|
283 | - 'backbone', |
|
284 | - ), |
|
285 | - $this->version, |
|
286 | - false |
|
287 | - ); |
|
288 | - |
|
289 | - $params = $this->get_params(); |
|
290 | - |
|
291 | - // Finally output the params as `wlSettings` for JavaScript code. |
|
292 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
293 | - |
|
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * Return the settings array by applying filters. |
|
298 | - * |
|
299 | - * @return array |
|
300 | - */ |
|
301 | - public function get_params() { |
|
302 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
303 | - /* |
|
271 | + $screen = get_current_screen(); |
|
272 | + if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
273 | + return; |
|
274 | + } |
|
275 | + |
|
276 | + // Enqueue the admin scripts. |
|
277 | + wp_enqueue_script( |
|
278 | + $this->plugin_name, |
|
279 | + plugin_dir_url( __FILE__ ) . 'js/1/admin.js', |
|
280 | + array( |
|
281 | + 'jquery', |
|
282 | + 'underscore', |
|
283 | + 'backbone', |
|
284 | + ), |
|
285 | + $this->version, |
|
286 | + false |
|
287 | + ); |
|
288 | + |
|
289 | + $params = $this->get_params(); |
|
290 | + |
|
291 | + // Finally output the params as `wlSettings` for JavaScript code. |
|
292 | + wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
293 | + |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * Return the settings array by applying filters. |
|
298 | + * |
|
299 | + * @return array |
|
300 | + */ |
|
301 | + public function get_params() { |
|
302 | + $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
303 | + /* |
|
304 | 304 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
305 | 305 | * that cannot edit create entities will always see the local entities. |
306 | 306 | * |
307 | 307 | * @see https://github.com/insideout10/wordlift-plugin/issues/839 |
308 | 308 | */ |
309 | - $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : 'local'; |
|
310 | - |
|
311 | - // Set the basic params. |
|
312 | - $params = array( |
|
313 | - // @todo scripts in admin should use wp.post. |
|
314 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
315 | - // @todo remove specific actions from settings. |
|
316 | - 'action' => 'entity_by_title', |
|
317 | - 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
|
318 | - 'language' => Wordlift_Configuration_Service::get_instance()->get_language_code(), |
|
319 | - 'link_by_default' => Wordlift_Configuration_Service::get_instance()->is_link_by_default(), |
|
320 | - // Whether the current user is allowed to create new entities. |
|
321 | - // |
|
322 | - // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
323 | - // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
|
324 | - 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
325 | - 'l10n' => array( |
|
326 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
327 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
328 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
329 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
330 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
331 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
332 | - 'Please wait while we look for ingredients in the linked data cloud...' => _x( 'Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
333 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
334 | - ), |
|
335 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
336 | - 'autocomplete_scope' => $autocomplete_scope, |
|
337 | - 'wl_video_api_nonce' => wp_create_nonce( 'wl_video_api_nonce' ), |
|
338 | - |
|
339 | - /** |
|
340 | - * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
341 | - * or change the TinyMCE id. |
|
342 | - * |
|
343 | - * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
344 | - * |
|
345 | - * @param string $editor The default editor id, by default `content`. |
|
346 | - * |
|
347 | - * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
348 | - * |
|
349 | - * @since 3.19.4 |
|
350 | - */ |
|
351 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
352 | - |
|
353 | - 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
354 | - /** |
|
355 | - * Faceted search default limit |
|
356 | - * |
|
357 | - * @since 3.26.1 |
|
358 | - */ |
|
359 | - 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
360 | - /** |
|
361 | - * WL Root path, to access in JS |
|
362 | - * |
|
363 | - * @since 3.27.3 |
|
364 | - */ |
|
365 | - 'wl_root' => plugin_dir_url( __DIR__ ), |
|
366 | - /** |
|
367 | - * Enable synonyms, to access in JS |
|
368 | - * Show classification sidebar, to access in JS |
|
369 | - * |
|
370 | - * @since 3.30.0 |
|
371 | - */ |
|
372 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
373 | - 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
374 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
375 | - 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
376 | - // By default the videoobject should not show. |
|
377 | - 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ), |
|
378 | - ); |
|
379 | - |
|
380 | - // Set post-related values if there's a current post. |
|
381 | - $entity_being_edited = get_post(); |
|
382 | - $post = $entity_being_edited; |
|
383 | - if ( null !== $post ) { |
|
384 | - |
|
385 | - $params['post_id'] = $entity_being_edited->ID; |
|
386 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
387 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
388 | - // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
389 | - // from the results, since we don't want the current entity to be discovered by the analysis. |
|
390 | - // |
|
391 | - // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
392 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
393 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
394 | - |
|
395 | - /* |
|
309 | + $autocomplete_scope = $can_edit_wordlift_entities ? WL_AUTOCOMPLETE_SCOPE : 'local'; |
|
310 | + |
|
311 | + // Set the basic params. |
|
312 | + $params = array( |
|
313 | + // @todo scripts in admin should use wp.post. |
|
314 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
315 | + // @todo remove specific actions from settings. |
|
316 | + 'action' => 'entity_by_title', |
|
317 | + 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
|
318 | + 'language' => Wordlift_Configuration_Service::get_instance()->get_language_code(), |
|
319 | + 'link_by_default' => Wordlift_Configuration_Service::get_instance()->is_link_by_default(), |
|
320 | + // Whether the current user is allowed to create new entities. |
|
321 | + // |
|
322 | + // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
|
323 | + // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
|
324 | + 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
325 | + 'l10n' => array( |
|
326 | + 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
327 | + 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
328 | + 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
329 | + 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
330 | + 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
331 | + 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
332 | + 'Please wait while we look for ingredients in the linked data cloud...' => _x( 'Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
333 | + 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
334 | + ), |
|
335 | + 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
336 | + 'autocomplete_scope' => $autocomplete_scope, |
|
337 | + 'wl_video_api_nonce' => wp_create_nonce( 'wl_video_api_nonce' ), |
|
338 | + |
|
339 | + /** |
|
340 | + * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
|
341 | + * or change the TinyMCE id. |
|
342 | + * |
|
343 | + * The editor id is currently referenced by `src/coffee/editpost-widget/app.services.EditorAdapter.coffee`. |
|
344 | + * |
|
345 | + * @param string $editor The default editor id, by default `content`. |
|
346 | + * |
|
347 | + * @see https://github.com/insideout10/wordlift-plugin/issues/848 |
|
348 | + * |
|
349 | + * @since 3.19.4 |
|
350 | + */ |
|
351 | + 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
352 | + |
|
353 | + 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
354 | + /** |
|
355 | + * Faceted search default limit |
|
356 | + * |
|
357 | + * @since 3.26.1 |
|
358 | + */ |
|
359 | + 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
360 | + /** |
|
361 | + * WL Root path, to access in JS |
|
362 | + * |
|
363 | + * @since 3.27.3 |
|
364 | + */ |
|
365 | + 'wl_root' => plugin_dir_url( __DIR__ ), |
|
366 | + /** |
|
367 | + * Enable synonyms, to access in JS |
|
368 | + * Show classification sidebar, to access in JS |
|
369 | + * |
|
370 | + * @since 3.30.0 |
|
371 | + */ |
|
372 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
373 | + 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
374 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
375 | + 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
376 | + // By default the videoobject should not show. |
|
377 | + 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ), |
|
378 | + ); |
|
379 | + |
|
380 | + // Set post-related values if there's a current post. |
|
381 | + $entity_being_edited = get_post(); |
|
382 | + $post = $entity_being_edited; |
|
383 | + if ( null !== $post ) { |
|
384 | + |
|
385 | + $params['post_id'] = $entity_being_edited->ID; |
|
386 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
387 | + $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
388 | + // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
389 | + // from the results, since we don't want the current entity to be discovered by the analysis. |
|
390 | + // |
|
391 | + // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
392 | + $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
393 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
394 | + |
|
395 | + /* |
|
396 | 396 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
397 | 397 | * |
398 | 398 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
399 | 399 | */ |
400 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
401 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
402 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
403 | - } |
|
404 | - } |
|
405 | - |
|
406 | - return $params; |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Initialize the mappings. |
|
411 | - * |
|
412 | - * @return void |
|
413 | - */ |
|
414 | - public function init_mappings() { |
|
415 | - new Admin_Mappings_Page(); |
|
416 | - /** |
|
417 | - * @since 3.27.0 |
|
418 | - * Hooks in to ui of edit mapping screen, add taxonomy as a option. |
|
419 | - */ |
|
420 | - $taxonomy_option = new Taxonomy_Option(); |
|
421 | - $taxonomy_option->add_taxonomy_option(); |
|
422 | - new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
423 | - } |
|
400 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
401 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
402 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
403 | + } |
|
404 | + } |
|
405 | + |
|
406 | + return $params; |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Initialize the mappings. |
|
411 | + * |
|
412 | + * @return void |
|
413 | + */ |
|
414 | + public function init_mappings() { |
|
415 | + new Admin_Mappings_Page(); |
|
416 | + /** |
|
417 | + * @since 3.27.0 |
|
418 | + * Hooks in to ui of edit mapping screen, add taxonomy as a option. |
|
419 | + */ |
|
420 | + $taxonomy_option = new Taxonomy_Option(); |
|
421 | + $taxonomy_option->add_taxonomy_option(); |
|
422 | + new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
423 | + } |
|
424 | 424 | |
425 | 425 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @since 1.0.0 |
83 | 83 | */ |
84 | - public function __construct( $plugin_name, $version, $notice_service, $user_service ) { |
|
84 | + public function __construct($plugin_name, $version, $notice_service, $user_service) { |
|
85 | 85 | |
86 | 86 | $this->plugin_name = $plugin_name; |
87 | 87 | $this->version = $version; |
@@ -92,20 +92,20 @@ discard block |
||
92 | 92 | $dataset_uri = $configuration_service->get_dataset_uri(); |
93 | 93 | $key = $configuration_service->get_key(); |
94 | 94 | $features_registry = Features_Registry::get_instance(); |
95 | - if ( empty( $dataset_uri ) ) { |
|
95 | + if (empty($dataset_uri)) { |
|
96 | 96 | $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
97 | - if ( empty( $key ) ) { |
|
97 | + if (empty($key)) { |
|
98 | 98 | /* translators: %s: The link to the settings page. */ |
99 | - $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
99 | + $error = sprintf(esc_html__("WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
100 | 100 | } else { |
101 | 101 | /* translators: %s: The link to the settings page. */ |
102 | - $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' ); |
|
102 | + $error = sprintf(esc_html__("WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>'); |
|
103 | 103 | } |
104 | - $notice_service->add_error( $error ); |
|
104 | + $notice_service->add_error($error); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // Load additional code if we're in the admin UI. |
108 | - if ( is_admin() ) { |
|
108 | + if (is_admin()) { |
|
109 | 109 | |
110 | 110 | // Require the PHP files for the next code fragment. |
111 | 111 | self::require_files(); |
@@ -129,13 +129,13 @@ discard block |
||
129 | 129 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
130 | 130 | */ |
131 | 131 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
132 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
132 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
133 | 133 | |
134 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
134 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-schemaorg-taxonomy-metabox.php'; |
|
135 | 135 | /* |
136 | 136 | * The `Mappings` admin page. |
137 | 137 | */ |
138 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-mappings-page.php'; |
|
138 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-mappings-page.php'; |
|
139 | 139 | |
140 | 140 | new Wordlift_Admin_Mappings_Page(); |
141 | 141 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @since 3.20.0 |
146 | 146 | */ |
147 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
147 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-sync-batch-operation.php'; |
|
148 | 148 | |
149 | - $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter( new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync' ); |
|
149 | + $this->sync_batch_operation_ajax_adapter = new Wordlift_Batch_Operation_Ajax_Adapter(new Wordlift_Schemaorg_Sync_Batch_Operation(), 'wl_schemaorg_sync'); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @since 3.20.0 |
157 | 157 | */ |
158 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-term-adapter.php'; |
|
158 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-term-adapter.php'; |
|
159 | 159 | new Wordlift_Admin_Term_Adapter(); |
160 | 160 | |
161 | 161 | /* |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | |
182 | 182 | $features_registry->register_feature_from_slug( |
183 | 183 | 'mappings', |
184 | - ( defined( 'WL_ENABLE_MAPPINGS' ) && WL_ENABLE_MAPPINGS ), |
|
185 | - array( $this, 'init_mappings' ) |
|
184 | + (defined('WL_ENABLE_MAPPINGS') && WL_ENABLE_MAPPINGS), |
|
185 | + array($this, 'init_mappings') |
|
186 | 186 | ); |
187 | 187 | |
188 | 188 | // Set the singleton instance. |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | */ |
198 | 198 | private static function require_files() { |
199 | 199 | |
200 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
200 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-dashboard-latest-news.php'; |
|
201 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-dashboard-v2.php'; |
|
202 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-not-enriched-filter.php'; |
|
203 | 203 | |
204 | 204 | } |
205 | 205 | |
@@ -215,14 +215,14 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | public static function is_gutenberg() { |
218 | - if ( function_exists( 'is_gutenberg_page' ) && |
|
218 | + if (function_exists('is_gutenberg_page') && |
|
219 | 219 | is_gutenberg_page() |
220 | 220 | ) { |
221 | 221 | // The Gutenberg plugin is on. |
222 | 222 | return true; |
223 | 223 | } |
224 | 224 | $current_screen = get_current_screen(); |
225 | - if ( method_exists( $current_screen, 'is_block_editor' ) && |
|
225 | + if (method_exists($current_screen, 'is_block_editor') && |
|
226 | 226 | $current_screen->is_block_editor() |
227 | 227 | ) { |
228 | 228 | // Gutenberg page on 5+. |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * class. |
252 | 252 | */ |
253 | 253 | |
254 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
254 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all'); |
|
255 | 255 | |
256 | 256 | } |
257 | 257 | |
@@ -269,14 +269,14 @@ discard block |
||
269 | 269 | * @since 3.20.0 |
270 | 270 | */ |
271 | 271 | $screen = get_current_screen(); |
272 | - if ( is_a( $screen, 'WP_Screen' ) && 'filter-urls_page_filter_urls_form' === $screen->id ) { |
|
272 | + if (is_a($screen, 'WP_Screen') && 'filter-urls_page_filter_urls_form' === $screen->id) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | // Enqueue the admin scripts. |
277 | 277 | wp_enqueue_script( |
278 | 278 | $this->plugin_name, |
279 | - plugin_dir_url( __FILE__ ) . 'js/1/admin.js', |
|
279 | + plugin_dir_url(__FILE__).'js/1/admin.js', |
|
280 | 280 | array( |
281 | 281 | 'jquery', |
282 | 282 | 'underscore', |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $params = $this->get_params(); |
290 | 290 | |
291 | 291 | // Finally output the params as `wlSettings` for JavaScript code. |
292 | - wp_localize_script( $this->plugin_name, 'wlSettings', apply_filters( 'wl_admin_settings', $params ) ); |
|
292 | + wp_localize_script($this->plugin_name, 'wlSettings', apply_filters('wl_admin_settings', $params)); |
|
293 | 293 | |
294 | 294 | } |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return array |
300 | 300 | */ |
301 | 301 | public function get_params() { |
302 | - $can_edit_wordlift_entities = current_user_can( 'edit_wordlift_entities' ); |
|
302 | + $can_edit_wordlift_entities = current_user_can('edit_wordlift_entities'); |
|
303 | 303 | /* |
304 | 304 | * People that can create entities will see the scope set in the wp-config.php file (by default `cloud`). People |
305 | 305 | * that cannot edit create entities will always see the local entities. |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | // Set the basic params. |
312 | 312 | $params = array( |
313 | 313 | // @todo scripts in admin should use wp.post. |
314 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
314 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
315 | 315 | // @todo remove specific actions from settings. |
316 | 316 | 'action' => 'entity_by_title', |
317 | 317 | 'datasetUri' => Wordlift_Configuration_Service::get_instance()->get_dataset_uri(), |
@@ -321,20 +321,20 @@ discard block |
||
321 | 321 | // |
322 | 322 | // @see https://github.com/insideout10/wordlift-plugin/issues/561 |
323 | 323 | // @see https://github.com/insideout10/wordlift-plugin/issues/1267 |
324 | - 'can_create_entities' => apply_filters( 'wl_feature__enable__dataset', true ) ? ( $can_edit_wordlift_entities ? 'yes' : 'no' ) : 'no', |
|
324 | + 'can_create_entities' => apply_filters('wl_feature__enable__dataset', true) ? ($can_edit_wordlift_entities ? 'yes' : 'no') : 'no', |
|
325 | 325 | 'l10n' => array( |
326 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
327 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
328 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
329 | - 'Type at least 3 characters to search...' => _x( 'Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift' ), |
|
330 | - 'No results found for your search.' => _x( 'No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift' ), |
|
331 | - 'Please wait while we look for entities in the linked data cloud...' => _x( 'Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
332 | - 'Please wait while we look for ingredients in the linked data cloud...' => _x( 'Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift' ), |
|
333 | - 'Add keywords to track' => __( 'Add Keywords to track', 'wordlift' ), |
|
326 | + 'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'), |
|
327 | + 'logo_selection_title' => __('WordLift Choose Logo', 'wordlift'), |
|
328 | + 'logo_selection_button' => array('text' => __('Choose Logo', 'wordlift')), |
|
329 | + 'Type at least 3 characters to search...' => _x('Type at least 3 characters to search...', 'Autocomplete Select', 'wordlift'), |
|
330 | + 'No results found for your search.' => _x('No results found: try changing or removing some words.', 'Autocomplete Select', 'wordlift'), |
|
331 | + 'Please wait while we look for entities in the linked data cloud...' => _x('Please wait while we look for entities in the linked data cloud...', 'Autocomplete Select', 'wordlift'), |
|
332 | + 'Please wait while we look for ingredients in the linked data cloud...' => _x('Please wait while we look for ingredients in the linked data cloud...', 'Autocomplete Select', 'wordlift'), |
|
333 | + 'Add keywords to track' => __('Add Keywords to track', 'wordlift'), |
|
334 | 334 | ), |
335 | - 'wl_autocomplete_nonce' => wp_create_nonce( 'wl_autocomplete' ), |
|
335 | + 'wl_autocomplete_nonce' => wp_create_nonce('wl_autocomplete'), |
|
336 | 336 | 'autocomplete_scope' => $autocomplete_scope, |
337 | - 'wl_video_api_nonce' => wp_create_nonce( 'wl_video_api_nonce' ), |
|
337 | + 'wl_video_api_nonce' => wp_create_nonce('wl_video_api_nonce'), |
|
338 | 338 | |
339 | 339 | /** |
340 | 340 | * Allow 3rd parties to define the default editor id. This turns useful if 3rd parties load |
@@ -348,21 +348,21 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @since 3.19.4 |
350 | 350 | */ |
351 | - 'default_editor_id' => apply_filters( 'wl_default_editor_id', 'content' ), |
|
351 | + 'default_editor_id' => apply_filters('wl_default_editor_id', 'content'), |
|
352 | 352 | |
353 | - 'analysis' => array( '_wpnonce' => wp_create_nonce( 'wl_analyze' ) ), |
|
353 | + 'analysis' => array('_wpnonce' => wp_create_nonce('wl_analyze')), |
|
354 | 354 | /** |
355 | 355 | * Faceted search default limit |
356 | 356 | * |
357 | 357 | * @since 3.26.1 |
358 | 358 | */ |
359 | - 'faceted_search_default_limit' => apply_filters( 'wl_faceted_search_default_limit', 10 ), |
|
359 | + 'faceted_search_default_limit' => apply_filters('wl_faceted_search_default_limit', 10), |
|
360 | 360 | /** |
361 | 361 | * WL Root path, to access in JS |
362 | 362 | * |
363 | 363 | * @since 3.27.3 |
364 | 364 | */ |
365 | - 'wl_root' => plugin_dir_url( __DIR__ ), |
|
365 | + 'wl_root' => plugin_dir_url(__DIR__), |
|
366 | 366 | /** |
367 | 367 | * Enable synonyms, to access in JS |
368 | 368 | * Show classification sidebar, to access in JS |
@@ -370,27 +370,27 @@ discard block |
||
370 | 370 | * @since 3.30.0 |
371 | 371 | */ |
372 | 372 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
373 | - 'can_add_synonyms' => apply_filters( 'wl_feature__enable__add-synonyms', true ), |
|
373 | + 'can_add_synonyms' => apply_filters('wl_feature__enable__add-synonyms', true), |
|
374 | 374 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
375 | - 'show_classification_sidebar' => apply_filters( 'wl_feature__enable__classification-sidebar', true ), |
|
375 | + 'show_classification_sidebar' => apply_filters('wl_feature__enable__classification-sidebar', true), |
|
376 | 376 | // By default the videoobject should not show. |
377 | - 'show_videoobject' => apply_filters( 'wl_feature__enable__videoobject', false ), |
|
377 | + 'show_videoobject' => apply_filters('wl_feature__enable__videoobject', false), |
|
378 | 378 | ); |
379 | 379 | |
380 | 380 | // Set post-related values if there's a current post. |
381 | 381 | $entity_being_edited = get_post(); |
382 | 382 | $post = $entity_being_edited; |
383 | - if ( null !== $post ) { |
|
383 | + if (null !== $post) { |
|
384 | 384 | |
385 | 385 | $params['post_id'] = $entity_being_edited->ID; |
386 | 386 | $entity_service = Wordlift_Entity_Service::get_instance(); |
387 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && $entity_service->is_entity( $post->ID ) && is_numeric( get_the_ID() ); |
|
387 | + $params['entityBeingEdited'] = isset($entity_being_edited->post_type) && $entity_service->is_entity($post->ID) && is_numeric(get_the_ID()); |
|
388 | 388 | // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
389 | 389 | // from the results, since we don't want the current entity to be discovered by the analysis. |
390 | 390 | // |
391 | 391 | // See https://github.com/insideout10/wordlift-plugin/issues/345 |
392 | - $params['itemId'] = $entity_service->get_uri( $entity_being_edited->ID ); |
|
393 | - $params['wl_schemaorg_property_nonce'] = wp_create_nonce( 'wl_schemaorg_property' ); |
|
392 | + $params['itemId'] = $entity_service->get_uri($entity_being_edited->ID); |
|
393 | + $params['wl_schemaorg_property_nonce'] = wp_create_nonce('wl_schemaorg_property'); |
|
394 | 394 | |
395 | 395 | /* |
396 | 396 | * Add the `properties` if `WL_ALL_ENTITY_TYPES` is enabled. |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
399 | 399 | */ |
400 | 400 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
401 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
402 | - $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all( $post->ID ); |
|
401 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
402 | + $params['properties'] = Wordlift_Schemaorg_Property_Service::get_instance()->get_all($post->ID); |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | $taxonomy_option = new Taxonomy_Option(); |
421 | 421 | $taxonomy_option->add_taxonomy_option(); |
422 | - new Edit_Mappings_Page( new Mappings_Transform_Functions_Registry() ); |
|
422 | + new Edit_Mappings_Page(new Mappings_Transform_Functions_Registry()); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | } |
@@ -23,55 +23,55 @@ |
||
23 | 23 | */ |
24 | 24 | class Wordlift_Post_Excerpt_Helper { |
25 | 25 | |
26 | - /** |
|
27 | - * Get the text excerpt for the provided {@link WP_Post}. |
|
28 | - * |
|
29 | - * Since anyone can hook on the excerpt generation filters, and |
|
30 | - * amend it with non textual content, we play it self and generate |
|
31 | - * the excerpt ourselves, mimicking the way WordPress core does it. |
|
32 | - * |
|
33 | - * @since 3.10.0 |
|
34 | - * |
|
35 | - * @param WP_Post $post The {@link WP_Post}. |
|
36 | - * @param int $length The desired excerpt length. |
|
37 | - * @param string $more The desired more string. |
|
38 | - * |
|
39 | - * @return string The excerpt. |
|
40 | - */ |
|
41 | - public static function get_text_excerpt( $post, $length = 55, $more = '...' ) { |
|
26 | + /** |
|
27 | + * Get the text excerpt for the provided {@link WP_Post}. |
|
28 | + * |
|
29 | + * Since anyone can hook on the excerpt generation filters, and |
|
30 | + * amend it with non textual content, we play it self and generate |
|
31 | + * the excerpt ourselves, mimicking the way WordPress core does it. |
|
32 | + * |
|
33 | + * @since 3.10.0 |
|
34 | + * |
|
35 | + * @param WP_Post $post The {@link WP_Post}. |
|
36 | + * @param int $length The desired excerpt length. |
|
37 | + * @param string $more The desired more string. |
|
38 | + * |
|
39 | + * @return string The excerpt. |
|
40 | + */ |
|
41 | + public static function get_text_excerpt( $post, $length = 55, $more = '...' ) { |
|
42 | 42 | |
43 | - /* |
|
43 | + /* |
|
44 | 44 | * Apply the `wl_post_content` filter, in case 3rd parties want to change the post content, e.g. |
45 | 45 | * because the content is written elsewhere. |
46 | 46 | * |
47 | 47 | * @since 3.20.0 |
48 | 48 | */ |
49 | - $post_content = apply_filters( 'wl_post_content', $post->post_content, $post ); |
|
49 | + $post_content = apply_filters( 'wl_post_content', $post->post_content, $post ); |
|
50 | 50 | |
51 | - // Filter shortcode content in post_content, before using it for trimming |
|
52 | - $post_content = do_shortcode( $post_content ); |
|
51 | + // Filter shortcode content in post_content, before using it for trimming |
|
52 | + $post_content = do_shortcode( $post_content ); |
|
53 | 53 | |
54 | - // Get the excerpt and trim it. Use the `post_excerpt` if available. |
|
55 | - $excerpt = wp_trim_words( ! empty( $post->post_excerpt ) ? $post->post_excerpt : $post_content, $length, $more ); |
|
54 | + // Get the excerpt and trim it. Use the `post_excerpt` if available. |
|
55 | + $excerpt = wp_trim_words( ! empty( $post->post_excerpt ) ? $post->post_excerpt : $post_content, $length, $more ); |
|
56 | 56 | |
57 | - // Remove shortcodes and decode html entities. |
|
58 | - return wp_strip_all_tags( html_entity_decode( self::strip_all_shortcodes( $excerpt ) ) ); |
|
59 | - } |
|
57 | + // Remove shortcodes and decode html entities. |
|
58 | + return wp_strip_all_tags( html_entity_decode( self::strip_all_shortcodes( $excerpt ) ) ); |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Remove all the shortcodes from the content. We're using our own function |
|
63 | - * because WordPress' own `strip_shortcodes` only takes into consideration |
|
64 | - * shortcodes for installed plugins/themes. |
|
65 | - * |
|
66 | - * @since 3.12.0 |
|
67 | - * |
|
68 | - * @param string $content The content with shortcodes. |
|
69 | - * |
|
70 | - * @return string The content without shortcodes. |
|
71 | - */ |
|
72 | - private static function strip_all_shortcodes( $content ) { |
|
61 | + /** |
|
62 | + * Remove all the shortcodes from the content. We're using our own function |
|
63 | + * because WordPress' own `strip_shortcodes` only takes into consideration |
|
64 | + * shortcodes for installed plugins/themes. |
|
65 | + * |
|
66 | + * @since 3.12.0 |
|
67 | + * |
|
68 | + * @param string $content The content with shortcodes. |
|
69 | + * |
|
70 | + * @return string The content without shortcodes. |
|
71 | + */ |
|
72 | + private static function strip_all_shortcodes( $content ) { |
|
73 | 73 | |
74 | - return preg_replace( '/\[[^]]+\]/', '', $content ); |
|
75 | - } |
|
74 | + return preg_replace( '/\[[^]]+\]/', '', $content ); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return string The excerpt. |
40 | 40 | */ |
41 | - public static function get_text_excerpt( $post, $length = 55, $more = '...' ) { |
|
41 | + public static function get_text_excerpt($post, $length = 55, $more = '...') { |
|
42 | 42 | |
43 | 43 | /* |
44 | 44 | * Apply the `wl_post_content` filter, in case 3rd parties want to change the post content, e.g. |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @since 3.20.0 |
48 | 48 | */ |
49 | - $post_content = apply_filters( 'wl_post_content', $post->post_content, $post ); |
|
49 | + $post_content = apply_filters('wl_post_content', $post->post_content, $post); |
|
50 | 50 | |
51 | 51 | // Filter shortcode content in post_content, before using it for trimming |
52 | - $post_content = do_shortcode( $post_content ); |
|
52 | + $post_content = do_shortcode($post_content); |
|
53 | 53 | |
54 | 54 | // Get the excerpt and trim it. Use the `post_excerpt` if available. |
55 | - $excerpt = wp_trim_words( ! empty( $post->post_excerpt ) ? $post->post_excerpt : $post_content, $length, $more ); |
|
55 | + $excerpt = wp_trim_words( ! empty($post->post_excerpt) ? $post->post_excerpt : $post_content, $length, $more); |
|
56 | 56 | |
57 | 57 | // Remove shortcodes and decode html entities. |
58 | - return wp_strip_all_tags( html_entity_decode( self::strip_all_shortcodes( $excerpt ) ) ); |
|
58 | + return wp_strip_all_tags(html_entity_decode(self::strip_all_shortcodes($excerpt))); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string The content without shortcodes. |
71 | 71 | */ |
72 | - private static function strip_all_shortcodes( $content ) { |
|
72 | + private static function strip_all_shortcodes($content) { |
|
73 | 73 | |
74 | - return preg_replace( '/\[[^]]+\]/', '', $content ); |
|
74 | + return preg_replace('/\[[^]]+\]/', '', $content); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | } |
@@ -16,97 +16,97 @@ |
||
16 | 16 | $wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
17 | 17 | |
18 | 18 | return array( |
19 | - // The prefix configuration. If a non null value is be used, a random prefix |
|
20 | - // will be generated instead. |
|
21 | - // |
|
22 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
23 | - 'prefix' => 'Wordlift\Modules\Include_Exclude_Push_Config', |
|
19 | + // The prefix configuration. If a non null value is be used, a random prefix |
|
20 | + // will be generated instead. |
|
21 | + // |
|
22 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#prefix |
|
23 | + 'prefix' => 'Wordlift\Modules\Include_Exclude_Push_Config', |
|
24 | 24 | |
25 | - // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
26 | - // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
27 | - // following configuration key. |
|
28 | - // |
|
29 | - // This configuration entry is completely ignored when using Box. |
|
30 | - // |
|
31 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
32 | - 'finders' => array( |
|
33 | - Finder::create() |
|
34 | - ->files() |
|
35 | - ->ignoreVCS( true ) |
|
36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
37 | - ->exclude( |
|
38 | - array( |
|
39 | - 'doc', |
|
40 | - 'test', |
|
41 | - 'test_old', |
|
42 | - 'tests', |
|
43 | - 'Tests', |
|
44 | - 'vendor-bin', |
|
45 | - ) |
|
46 | - ) |
|
47 | - ->in( |
|
48 | - array( |
|
49 | - 'vendor/cweagans/composer-patches', |
|
50 | - 'vendor/mcaskill/composer-exclude-files', |
|
51 | - 'vendor/psr/container', |
|
52 | - 'vendor/symfony/config', |
|
53 | - 'vendor/symfony/dependency-injection', |
|
54 | - 'vendor/symfony/filesystem', |
|
55 | - 'vendor/symfony/polyfill-ctype', |
|
56 | - 'vendor/symfony/polyfill-php73', |
|
57 | - 'vendor/symfony/polyfill-php80', |
|
58 | - 'vendor/symfony/yaml', |
|
59 | - ) |
|
60 | - ), |
|
25 | + // By default when running php-scoper add-prefix, it will prefix all relevant code found in the current working |
|
26 | + // directory. You can however define which files should be scoped by defining a collection of Finders in the |
|
27 | + // following configuration key. |
|
28 | + // |
|
29 | + // This configuration entry is completely ignored when using Box. |
|
30 | + // |
|
31 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#finders-and-paths |
|
32 | + 'finders' => array( |
|
33 | + Finder::create() |
|
34 | + ->files() |
|
35 | + ->ignoreVCS( true ) |
|
36 | + ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
37 | + ->exclude( |
|
38 | + array( |
|
39 | + 'doc', |
|
40 | + 'test', |
|
41 | + 'test_old', |
|
42 | + 'tests', |
|
43 | + 'Tests', |
|
44 | + 'vendor-bin', |
|
45 | + ) |
|
46 | + ) |
|
47 | + ->in( |
|
48 | + array( |
|
49 | + 'vendor/cweagans/composer-patches', |
|
50 | + 'vendor/mcaskill/composer-exclude-files', |
|
51 | + 'vendor/psr/container', |
|
52 | + 'vendor/symfony/config', |
|
53 | + 'vendor/symfony/dependency-injection', |
|
54 | + 'vendor/symfony/filesystem', |
|
55 | + 'vendor/symfony/polyfill-ctype', |
|
56 | + 'vendor/symfony/polyfill-php73', |
|
57 | + 'vendor/symfony/polyfill-php80', |
|
58 | + 'vendor/symfony/yaml', |
|
59 | + ) |
|
60 | + ), |
|
61 | 61 | |
62 | - // Symfony mbstring polyfill. |
|
63 | - Finder::create() |
|
64 | - ->files() |
|
65 | - ->ignoreVCS( true ) |
|
66 | - ->ignoreDotFiles( true ) |
|
67 | - ->name( '/\.*.php8?/' ) |
|
68 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
69 | - ->append( |
|
70 | - array( |
|
71 | - 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
72 | - 'vendor/symfony/polyfill-mbstring/composer.json', |
|
73 | - ) |
|
74 | - ), |
|
62 | + // Symfony mbstring polyfill. |
|
63 | + Finder::create() |
|
64 | + ->files() |
|
65 | + ->ignoreVCS( true ) |
|
66 | + ->ignoreDotFiles( true ) |
|
67 | + ->name( '/\.*.php8?/' ) |
|
68 | + ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
69 | + ->append( |
|
70 | + array( |
|
71 | + 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
|
72 | + 'vendor/symfony/polyfill-mbstring/composer.json', |
|
73 | + ) |
|
74 | + ), |
|
75 | 75 | |
76 | - Finder::create()->append( |
|
77 | - array( |
|
78 | - 'composer.json', |
|
79 | - ) |
|
80 | - ), |
|
81 | - ), |
|
76 | + Finder::create()->append( |
|
77 | + array( |
|
78 | + 'composer.json', |
|
79 | + ) |
|
80 | + ), |
|
81 | + ), |
|
82 | 82 | |
83 | - // List of excluded files, i.e. files for which the content will be left untouched. |
|
84 | - // Paths are relative to the configuration file unless if they are already absolute |
|
85 | - // |
|
86 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
87 | - 'exclude-files' => array(), |
|
83 | + // List of excluded files, i.e. files for which the content will be left untouched. |
|
84 | + // Paths are relative to the configuration file unless if they are already absolute |
|
85 | + // |
|
86 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
87 | + 'exclude-files' => array(), |
|
88 | 88 | |
89 | - // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
90 | - // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
91 | - // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
92 | - // heart contents. |
|
93 | - // |
|
94 | - // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
95 | - 'patchers' => array(), |
|
89 | + // When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the |
|
90 | + // original namespace. These will include, for example, strings or string manipulations. PHP-Scoper has limited |
|
91 | + // support for prefixing such strings. To circumvent that, you can define patchers to manipulate the file to your |
|
92 | + // heart contents. |
|
93 | + // |
|
94 | + // For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers |
|
95 | + 'patchers' => array(), |
|
96 | 96 | |
97 | - // List of symbols to consider internal i.e. to leave untouched. |
|
98 | - // |
|
99 | - // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
100 | - 'exclude-namespaces' => array( |
|
101 | - // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
102 | - // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
103 | - // '~^$~', // The root namespace only |
|
104 | - // '', // Any namespace |
|
105 | - ), |
|
106 | - 'exclude-classes' => $wp_classes, |
|
97 | + // List of symbols to consider internal i.e. to leave untouched. |
|
98 | + // |
|
99 | + // For more information see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#excluded-symbols |
|
100 | + 'exclude-namespaces' => array( |
|
101 | + // 'Acme\Foo' // The Acme\Foo namespace (and sub-namespaces) |
|
102 | + // '~^PHPUnit\\\\Framework$~', // The whole namespace PHPUnit\Framework (but not sub-namespaces) |
|
103 | + // '~^$~', // The root namespace only |
|
104 | + // '', // Any namespace |
|
105 | + ), |
|
106 | + 'exclude-classes' => $wp_classes, |
|
107 | 107 | |
108 | - 'exclude-functions' => $wp_functions, |
|
108 | + 'exclude-functions' => $wp_functions, |
|
109 | 109 | |
110 | - 'exclude-constants' => $wp_constants, |
|
110 | + 'exclude-constants' => $wp_constants, |
|
111 | 111 | |
112 | 112 | ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare( strict_types=1 ); |
|
3 | +declare(strict_types=1); |
|
4 | 4 | |
5 | 5 | use Isolated\Symfony\Component\Finder\Finder; |
6 | 6 | |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | // to auto-load any code here: it can result in a conflict or even corrupt |
12 | 12 | // the PHP-Scoper analysis. |
13 | 13 | |
14 | -$wp_classes = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json' ), true ); |
|
15 | -$wp_functions = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json' ), true ); |
|
16 | -$wp_constants = json_decode( file_get_contents( 'vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json' ), true ); |
|
14 | +$wp_classes = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-classes.json'), true); |
|
15 | +$wp_functions = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-functions.json'), true); |
|
16 | +$wp_constants = json_decode(file_get_contents('vendor/sniccowp/php-scoper-wordpress-excludes/generated/exclude-wordpress-constants.json'), true); |
|
17 | 17 | |
18 | 18 | return array( |
19 | 19 | // The prefix configuration. If a non null value is be used, a random prefix |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | 'finders' => array( |
33 | 33 | Finder::create() |
34 | 34 | ->files() |
35 | - ->ignoreVCS( true ) |
|
36 | - ->notName( '/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/' ) |
|
35 | + ->ignoreVCS(true) |
|
36 | + ->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/') |
|
37 | 37 | ->exclude( |
38 | 38 | array( |
39 | 39 | 'doc', |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | // Symfony mbstring polyfill. |
63 | 63 | Finder::create() |
64 | 64 | ->files() |
65 | - ->ignoreVCS( true ) |
|
66 | - ->ignoreDotFiles( true ) |
|
67 | - ->name( '/\.*.php8?/' ) |
|
68 | - ->in( 'vendor/symfony/polyfill-mbstring/Resources' ) |
|
65 | + ->ignoreVCS(true) |
|
66 | + ->ignoreDotFiles(true) |
|
67 | + ->name('/\.*.php8?/') |
|
68 | + ->in('vendor/symfony/polyfill-mbstring/Resources') |
|
69 | 69 | ->append( |
70 | 70 | array( |
71 | 71 | 'vendor/symfony/polyfill-mbstring/Mbstring.php', |
@@ -18,80 +18,80 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Admin_Input_Element implements Wordlift_Admin_Element { |
20 | 20 | |
21 | - /** |
|
22 | - * Output the HTML for an input box type settings_page |
|
23 | - * |
|
24 | - * @param array $args An array with the following keys: |
|
25 | - * Parameters controlling the result. |
|
26 | - * |
|
27 | - * @type string name The name attribute of the input element. Mandatory. |
|
28 | - * |
|
29 | - * @type string id The id attribute of the input element. Optional. |
|
30 | - * @type string id The id attribute of the input element. |
|
31 | - * Optional, randomly generated one is used if not supplied. |
|
32 | - * @type string value The value of the input element. |
|
33 | - * Optional, defaults to empty string. |
|
34 | - * @type bool readonly Indicates whether the input is read only. |
|
35 | - * Optional, defaults to read-write |
|
36 | - * @type string css_class The class attribute for the input element. |
|
37 | - * If empty string no class attribute will be added. |
|
38 | - * Optional, defaults to empty string. |
|
39 | - * @type string description The descriptio text to be displayed below the element. |
|
40 | - * Can include some HTML element. |
|
41 | - * If empty string no description will be displayed. |
|
42 | - * Optional, defaults to empty string. |
|
43 | - * @since 3.21.0 added the ability to use a $type arg. |
|
44 | - * |
|
45 | - * @return $this|Wordlift_Admin_Element |
|
46 | - */ |
|
47 | - public function render( $args ) { |
|
21 | + /** |
|
22 | + * Output the HTML for an input box type settings_page |
|
23 | + * |
|
24 | + * @param array $args An array with the following keys: |
|
25 | + * Parameters controlling the result. |
|
26 | + * |
|
27 | + * @type string name The name attribute of the input element. Mandatory. |
|
28 | + * |
|
29 | + * @type string id The id attribute of the input element. Optional. |
|
30 | + * @type string id The id attribute of the input element. |
|
31 | + * Optional, randomly generated one is used if not supplied. |
|
32 | + * @type string value The value of the input element. |
|
33 | + * Optional, defaults to empty string. |
|
34 | + * @type bool readonly Indicates whether the input is read only. |
|
35 | + * Optional, defaults to read-write |
|
36 | + * @type string css_class The class attribute for the input element. |
|
37 | + * If empty string no class attribute will be added. |
|
38 | + * Optional, defaults to empty string. |
|
39 | + * @type string description The descriptio text to be displayed below the element. |
|
40 | + * Can include some HTML element. |
|
41 | + * If empty string no description will be displayed. |
|
42 | + * Optional, defaults to empty string. |
|
43 | + * @since 3.21.0 added the ability to use a $type arg. |
|
44 | + * |
|
45 | + * @return $this|Wordlift_Admin_Element |
|
46 | + */ |
|
47 | + public function render( $args ) { |
|
48 | 48 | |
49 | - /* |
|
49 | + /* |
|
50 | 50 | * Parse the arguments and merge with default values. |
51 | 51 | * Name intentionally do not have a default as it has to be in SyncEvent |
52 | 52 | * with form handling code |
53 | 53 | */ |
54 | - $pre_params = wp_parse_args( |
|
55 | - $args, |
|
56 | - array( |
|
57 | - 'id' => uniqid( 'wl-input-' ), |
|
58 | - 'value' => '', |
|
59 | - 'readonly' => false, |
|
60 | - 'css_class' => '', |
|
61 | - 'description' => '', |
|
62 | - ) |
|
63 | - ); |
|
64 | - $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
65 | - // allow different types of input - default to 'text'. |
|
66 | - $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
67 | - ?> |
|
54 | + $pre_params = wp_parse_args( |
|
55 | + $args, |
|
56 | + array( |
|
57 | + 'id' => uniqid( 'wl-input-' ), |
|
58 | + 'value' => '', |
|
59 | + 'readonly' => false, |
|
60 | + 'css_class' => '', |
|
61 | + 'description' => '', |
|
62 | + ) |
|
63 | + ); |
|
64 | + $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
65 | + // allow different types of input - default to 'text'. |
|
66 | + $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
67 | + ?> |
|
68 | 68 | |
69 | 69 | <input type="<?php echo esc_attr( $input_type ); ?>" |
70 | 70 | id="<?php echo esc_attr( $params['id'] ); ?>" |
71 | 71 | name="<?php echo esc_attr( $params['name'] ); ?>" |
72 | 72 | value="<?php echo esc_attr( $params['value'] ); ?>" |
73 | 73 | <?php |
74 | - if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) { |
|
75 | - foreach ( $params['data'] as $key => $value ) { |
|
76 | - echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; |
|
77 | - } |
|
78 | - } |
|
79 | - if ( ! empty( $params['readonly'] ) ) { |
|
80 | - ?> |
|
74 | + if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) { |
|
75 | + foreach ( $params['data'] as $key => $value ) { |
|
76 | + echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; |
|
77 | + } |
|
78 | + } |
|
79 | + if ( ! empty( $params['readonly'] ) ) { |
|
80 | + ?> |
|
81 | 81 | readonly="readonly" <?php } ?> |
82 | 82 | <?php |
83 | - if ( ! empty( $params['css_class'] ) ) { |
|
84 | - ?> |
|
83 | + if ( ! empty( $params['css_class'] ) ) { |
|
84 | + ?> |
|
85 | 85 | class="<?php echo esc_attr( $params['css_class'] ); ?>" <?php } ?> |
86 | 86 | /> |
87 | 87 | <?php |
88 | - if ( ! empty( $params['description'] ) ) { |
|
89 | - ?> |
|
88 | + if ( ! empty( $params['description'] ) ) { |
|
89 | + ?> |
|
90 | 90 | <p><?php echo wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ); ?></p><?php } ?> |
91 | 91 | |
92 | 92 | <?php |
93 | 93 | |
94 | - return $this; |
|
95 | - } |
|
94 | + return $this; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return $this|Wordlift_Admin_Element |
46 | 46 | */ |
47 | - public function render( $args ) { |
|
47 | + public function render($args) { |
|
48 | 48 | |
49 | 49 | /* |
50 | 50 | * Parse the arguments and merge with default values. |
@@ -54,40 +54,40 @@ discard block |
||
54 | 54 | $pre_params = wp_parse_args( |
55 | 55 | $args, |
56 | 56 | array( |
57 | - 'id' => uniqid( 'wl-input-' ), |
|
57 | + 'id' => uniqid('wl-input-'), |
|
58 | 58 | 'value' => '', |
59 | 59 | 'readonly' => false, |
60 | 60 | 'css_class' => '', |
61 | 61 | 'description' => '', |
62 | 62 | ) |
63 | 63 | ); |
64 | - $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
64 | + $params = apply_filters('wl_admin_input_element_params', $pre_params); |
|
65 | 65 | // allow different types of input - default to 'text'. |
66 | - $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
66 | + $input_type = ! empty($params['type']) ? $params['type'] : 'text'; |
|
67 | 67 | ?> |
68 | 68 | |
69 | - <input type="<?php echo esc_attr( $input_type ); ?>" |
|
70 | - id="<?php echo esc_attr( $params['id'] ); ?>" |
|
71 | - name="<?php echo esc_attr( $params['name'] ); ?>" |
|
72 | - value="<?php echo esc_attr( $params['value'] ); ?>" |
|
69 | + <input type="<?php echo esc_attr($input_type); ?>" |
|
70 | + id="<?php echo esc_attr($params['id']); ?>" |
|
71 | + name="<?php echo esc_attr($params['name']); ?>" |
|
72 | + value="<?php echo esc_attr($params['value']); ?>" |
|
73 | 73 | <?php |
74 | - if ( ! empty( $params['data'] ) && is_array( $params['data'] ) ) { |
|
75 | - foreach ( $params['data'] as $key => $value ) { |
|
76 | - echo 'data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '" '; |
|
74 | + if ( ! empty($params['data']) && is_array($params['data'])) { |
|
75 | + foreach ($params['data'] as $key => $value) { |
|
76 | + echo 'data-'.esc_attr($key).'="'.esc_attr($value).'" '; |
|
77 | 77 | } |
78 | 78 | } |
79 | - if ( ! empty( $params['readonly'] ) ) { |
|
79 | + if ( ! empty($params['readonly'])) { |
|
80 | 80 | ?> |
81 | 81 | readonly="readonly" <?php } ?> |
82 | 82 | <?php |
83 | - if ( ! empty( $params['css_class'] ) ) { |
|
83 | + if ( ! empty($params['css_class'])) { |
|
84 | 84 | ?> |
85 | - class="<?php echo esc_attr( $params['css_class'] ); ?>" <?php } ?> |
|
85 | + class="<?php echo esc_attr($params['css_class']); ?>" <?php } ?> |
|
86 | 86 | /> |
87 | 87 | <?php |
88 | - if ( ! empty( $params['description'] ) ) { |
|
88 | + if ( ! empty($params['description'])) { |
|
89 | 89 | ?> |
90 | - <p><?php echo wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ); ?></p><?php } ?> |
|
90 | + <p><?php echo wp_kses($params['description'], array('a' => array('href' => array()))); ?></p><?php } ?> |
|
91 | 91 | |
92 | 92 | <?php |
93 | 93 |