@@ -111,7 +111,7 @@ |
||
| 111 | 111 | * Get the singleton instance of the Notice service. |
| 112 | 112 | * |
| 113 | 113 | * @since 3.14.0 |
| 114 | - * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service. |
|
| 114 | + * @return Wordlift_Notice_Service The singleton instance of the settings page service. |
|
| 115 | 115 | */ |
| 116 | 116 | public static function get_instance() { |
| 117 | 117 | |
@@ -18,321 +18,321 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Admin_Settings_Page extends Wordlift_Admin_Page { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * A singleton instance of the Notice service. |
|
| 23 | - * |
|
| 24 | - * @since 3.2.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service. |
|
| 27 | - */ |
|
| 28 | - private static $instance; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * A {@link Wordlift_Entity_Service} instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.11.0 |
|
| 34 | - * @access private |
|
| 35 | - * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private $entity_service; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 41 | - * |
|
| 42 | - * @since 3.11.0 |
|
| 43 | - * @access private |
|
| 44 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 45 | - */ |
|
| 46 | - private $configuration_service; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * A {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 50 | - * |
|
| 51 | - * @since 3.11.0 |
|
| 52 | - * @access private |
|
| 53 | - * @var \Wordlift_Admin_Input_Element $input_element An {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 54 | - */ |
|
| 55 | - private $input_element; |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 59 | - * |
|
| 60 | - * @since 3.13.0 |
|
| 61 | - * @access protected |
|
| 62 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 63 | - */ |
|
| 64 | - private $radio_input_element; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 68 | - * |
|
| 69 | - * @since 3.11.0 |
|
| 70 | - * @access private |
|
| 71 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 72 | - */ |
|
| 73 | - private $language_select_element; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * A {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 77 | - * |
|
| 78 | - * @since 3.11.0 |
|
| 79 | - * @access private |
|
| 80 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 81 | - */ |
|
| 82 | - private $publisher_element; |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * Create a {@link Wordlift_Admin_Settings_Page} instance. |
|
| 86 | - * |
|
| 87 | - * @since 3.11.0 |
|
| 88 | - * |
|
| 89 | - * @param \Wordlift_Configuration_Service $configuration_service |
|
| 90 | - * @param \Wordlift_Entity_Service $entity_service |
|
| 91 | - * @param \Wordlift_Admin_Input_Element $input_element |
|
| 92 | - * @param \Wordlift_Admin_Language_Select_Element $language_select_element |
|
| 93 | - * @param \Wordlift_Admin_Publisher_Element $publisher_element |
|
| 94 | - * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element |
|
| 95 | - */ |
|
| 96 | - function __construct( $configuration_service, $entity_service, $input_element, $language_select_element, $publisher_element, $radio_input_element ) { |
|
| 97 | - |
|
| 98 | - $this->configuration_service = $configuration_service; |
|
| 99 | - $this->entity_service = $entity_service; |
|
| 100 | - |
|
| 101 | - // Set a reference to the UI elements. |
|
| 102 | - $this->input_element = $input_element; |
|
| 103 | - $this->radio_input_element = $radio_input_element; |
|
| 104 | - $this->language_select_element = $language_select_element; |
|
| 105 | - $this->publisher_element = $publisher_element; |
|
| 106 | - |
|
| 107 | - self::$instance = $this; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * Get the singleton instance of the Notice service. |
|
| 112 | - * |
|
| 113 | - * @since 3.14.0 |
|
| 114 | - * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service. |
|
| 115 | - */ |
|
| 116 | - public static function get_instance() { |
|
| 117 | - |
|
| 118 | - return self::$instance; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * @inheritdoc |
|
| 123 | - */ |
|
| 124 | - function get_parent_slug() { |
|
| 125 | - |
|
| 126 | - return 'wl_admin_menu'; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * @inheritdoc |
|
| 131 | - */ |
|
| 132 | - function get_capability() { |
|
| 133 | - |
|
| 134 | - return 'manage_options'; |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * @inheritdoc |
|
| 139 | - */ |
|
| 140 | - function get_page_title() { |
|
| 141 | - |
|
| 142 | - return 'WorldLift Settings'; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @inheritdoc |
|
| 147 | - */ |
|
| 148 | - function get_menu_title() { |
|
| 149 | - |
|
| 150 | - return 'Settings'; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * @inheritdoc |
|
| 155 | - */ |
|
| 156 | - function get_menu_slug() { |
|
| 157 | - |
|
| 158 | - return 'wl_configuration_admin_menu'; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * @inheritdoc |
|
| 163 | - */ |
|
| 164 | - function get_partial_name() { |
|
| 165 | - |
|
| 166 | - return 'wordlift-admin-settings-page.php'; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * @inheritdoc |
|
| 171 | - */ |
|
| 172 | - public function enqueue_scripts() { |
|
| 173 | - |
|
| 174 | - // Enqueue the media scripts to be used for the publisher's logo selection. |
|
| 175 | - wp_enqueue_media(); |
|
| 176 | - |
|
| 177 | - // JavaScript required for the settings page. |
|
| 178 | - // @todo: try to move to the `wordlift-admin.bundle.js`. |
|
| 179 | - wp_enqueue_script( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift-admin-settings-page.bundle.js', array( 'wp-util' ) ); |
|
| 180 | - |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Configure all the configuration parameters. |
|
| 185 | - * |
|
| 186 | - * Called by the *admin_init* hook. |
|
| 187 | - * |
|
| 188 | - * @since 3.11.0 |
|
| 189 | - */ |
|
| 190 | - function admin_init() { |
|
| 191 | - |
|
| 192 | - // Register WordLift's general settings, providing our own sanitize callback |
|
| 193 | - // which will also check whether the user filled the WL Publisher form. |
|
| 194 | - register_setting( |
|
| 195 | - 'wl_general_settings', |
|
| 196 | - 'wl_general_settings', |
|
| 197 | - array( $this, 'sanitize_callback', ) |
|
| 198 | - ); |
|
| 199 | - |
|
| 200 | - // Add the general settings section. |
|
| 201 | - add_settings_section( |
|
| 202 | - 'wl_general_settings_section', // ID used to identify this section and with which to register options. |
|
| 203 | - '', // Section header. |
|
| 204 | - '', // Callback used to render the description of the section. |
|
| 205 | - 'wl_general_settings' // Page on which to add this section of options. |
|
| 206 | - ); |
|
| 207 | - |
|
| 208 | - $key_args = array( |
|
| 209 | - 'id' => 'wl-key', |
|
| 210 | - 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::KEY . ']', |
|
| 211 | - 'value' => $this->configuration_service->get_key(), |
|
| 212 | - 'description' => _x( 'Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift' ), |
|
| 213 | - ); |
|
| 214 | - |
|
| 215 | - // Set the class for the key field based on the validity of the key. |
|
| 216 | - // Class should be "untouched" for an empty (virgin) value, "valid" |
|
| 217 | - // if the key is valid, or "invalid" otherwise. |
|
| 218 | - $validation_service = new Wordlift_Key_Validation_Service(); |
|
| 219 | - |
|
| 220 | - if ( empty( $key_args['value'] ) ) { |
|
| 221 | - $key_args['css_class'] = 'untouched'; |
|
| 222 | - } elseif ( $validation_service->is_valid( $key_args['value'] ) ) { |
|
| 223 | - $key_args['css_class'] = 'valid'; |
|
| 224 | - } else { |
|
| 225 | - $key_args['css_class'] = 'invalid'; |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // Add the `key` field. |
|
| 229 | - add_settings_field( |
|
| 230 | - 'wl-key', // Element id used to identify the field throughout the theme. |
|
| 231 | - _x( 'WordLift Key', 'wordlift' ), // The label to the left of the option interface element. |
|
| 232 | - // The name of the function responsible for rendering the option interface. |
|
| 233 | - array( $this->input_element, 'render', ), |
|
| 234 | - 'wl_general_settings', // The page on which this option will be displayed. |
|
| 235 | - 'wl_general_settings_section', // The name of the section to which this field belongs. |
|
| 236 | - $key_args // The array of arguments to pass to the callback. In this case, just a description. |
|
| 237 | - ); |
|
| 238 | - |
|
| 239 | - // Entity Base Path input. |
|
| 240 | - $entity_base_path_args = array( |
|
| 241 | - // The array of arguments to pass to the callback. In this case, just a description. |
|
| 242 | - 'id' => 'wl-entity-base-path', |
|
| 243 | - 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::ENTITY_BASE_PATH_KEY . ']', |
|
| 244 | - 'value' => $this->configuration_service->get_entity_base_path(), |
|
| 245 | - 'description' => sprintf( _x( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field above. Check our <a href="%s">FAQs</a> if you need more info.', 'wordlift' ), 'https://wordlift.io/wordlift-user-faqs/#10-why-and-how-should-i-customize-the-url-of-the-entity-pages-created-in-my-vocabulary' ), |
|
| 246 | - ); |
|
| 247 | - |
|
| 248 | - $entity_base_path_args['readonly'] = 0 < $this->entity_service->count(); |
|
| 249 | - |
|
| 250 | - // Add the `wl_entity_base_path` field. |
|
| 251 | - add_settings_field( |
|
| 252 | - 'wl-entity-base-path', // ID used to identify the field throughout the theme |
|
| 253 | - _x( 'Entity Base Path', 'wordlift' ), // The label to the left of the option interface element |
|
| 254 | - // The name of the function responsible for rendering the option interface |
|
| 255 | - array( $this->input_element, 'render', ), |
|
| 256 | - 'wl_general_settings', // The page on which this option will be displayed |
|
| 257 | - 'wl_general_settings_section', // The name of the section to which this field belongs |
|
| 258 | - $entity_base_path_args |
|
| 259 | - ); |
|
| 260 | - |
|
| 261 | - // Add the `language_name` field. |
|
| 262 | - add_settings_field( |
|
| 263 | - 'wl-site-language', |
|
| 264 | - _x( 'Site Language', 'wordlift' ), |
|
| 265 | - array( $this->language_select_element, 'render' ), |
|
| 266 | - 'wl_general_settings', |
|
| 267 | - 'wl_general_settings_section', |
|
| 268 | - array( |
|
| 269 | - // The array of arguments to pass to the callback. In this case, just a description. |
|
| 270 | - 'id' => 'wl-site-language', |
|
| 271 | - 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::LANGUAGE . ']', |
|
| 272 | - 'value' => $this->configuration_service->get_language_code(), |
|
| 273 | - 'description' => __( 'Each WordLift Key can be used only in one language. Pick yours.', 'wordlift' ), |
|
| 274 | - ) |
|
| 275 | - ); |
|
| 276 | - |
|
| 277 | - // Add the `publisher` field. |
|
| 278 | - add_settings_field( |
|
| 279 | - 'wl-publisher-id', |
|
| 280 | - _x( 'Publisher', 'wordlift' ), |
|
| 281 | - array( $this->publisher_element, 'render' ), |
|
| 282 | - 'wl_general_settings', |
|
| 283 | - 'wl_general_settings_section', |
|
| 284 | - array( |
|
| 285 | - 'id' => 'wl-publisher-id', |
|
| 286 | - 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::PUBLISHER_ID . ']', |
|
| 287 | - ) |
|
| 288 | - ); |
|
| 289 | - |
|
| 290 | - // Add the `link by default` field. |
|
| 291 | - add_settings_field( |
|
| 292 | - 'wl-link-by-default', |
|
| 293 | - _x( 'Link by Default', 'wordlift' ), |
|
| 294 | - array( $this->radio_input_element, 'render' ), |
|
| 295 | - 'wl_general_settings', |
|
| 296 | - 'wl_general_settings_section', |
|
| 297 | - array( |
|
| 298 | - 'id' => 'wl-link-by-default', |
|
| 299 | - 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::LINK_BY_DEFAULT . ']', |
|
| 300 | - 'value' => $this->configuration_service->is_link_by_default() ? 'yes' : 'no', |
|
| 301 | - 'description' => _x( 'Whether to link entities by default or not. This setting applies to all the entities.', 'wordlift' ), |
|
| 302 | - ) |
|
| 303 | - ); |
|
| 304 | - |
|
| 305 | - } |
|
| 306 | - |
|
| 307 | - /** |
|
| 308 | - * Sanitize the configuration settings to be stored. |
|
| 309 | - * |
|
| 310 | - * If a new entity is being created for the publisher, create it and set The |
|
| 311 | - * publisher setting. |
|
| 312 | - * |
|
| 313 | - * @since 3.11.0 |
|
| 314 | - * |
|
| 315 | - * @param array $input The configuration settings array. |
|
| 316 | - * |
|
| 317 | - * @return array The sanitized input array. |
|
| 318 | - */ |
|
| 319 | - function sanitize_callback( $input ) { |
|
| 320 | - |
|
| 321 | - // Check whether a publisher name has been set. |
|
| 322 | - if ( isset( $_POST['wl_publisher'] ) && ! empty( $_POST['wl_publisher']['name'] ) ) { |
|
| 323 | - $name = $_POST['wl_publisher']['name']; |
|
| 324 | - $type = $_POST['wl_publisher']['type']; |
|
| 325 | - $thumbnail_id = $_POST['wl_publisher']['thumbnail_id'] ?: null; |
|
| 326 | - |
|
| 327 | - // Set the type URI, either http://schema.org/Person or http://schema.org/Organization. |
|
| 328 | - $type_uri = sprintf( 'http://schema.org/%s', 'organization' === $type ? 'Organization' : 'Person' ); |
|
| 329 | - |
|
| 330 | - // Create an entity for the publisher and assign it to the input |
|
| 331 | - // parameter which WordPress automatically saves into the settings. |
|
| 332 | - $input['publisher_id'] = $this->entity_service->create( $name, $type_uri, $thumbnail_id, 'publish' ); |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - return $input; |
|
| 336 | - } |
|
| 21 | + /** |
|
| 22 | + * A singleton instance of the Notice service. |
|
| 23 | + * |
|
| 24 | + * @since 3.2.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service. |
|
| 27 | + */ |
|
| 28 | + private static $instance; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * A {@link Wordlift_Entity_Service} instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.11.0 |
|
| 34 | + * @access private |
|
| 35 | + * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private $entity_service; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 41 | + * |
|
| 42 | + * @since 3.11.0 |
|
| 43 | + * @access private |
|
| 44 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 45 | + */ |
|
| 46 | + private $configuration_service; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * A {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 50 | + * |
|
| 51 | + * @since 3.11.0 |
|
| 52 | + * @access private |
|
| 53 | + * @var \Wordlift_Admin_Input_Element $input_element An {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 54 | + */ |
|
| 55 | + private $input_element; |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 59 | + * |
|
| 60 | + * @since 3.13.0 |
|
| 61 | + * @access protected |
|
| 62 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 63 | + */ |
|
| 64 | + private $radio_input_element; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 68 | + * |
|
| 69 | + * @since 3.11.0 |
|
| 70 | + * @access private |
|
| 71 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 72 | + */ |
|
| 73 | + private $language_select_element; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * A {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 77 | + * |
|
| 78 | + * @since 3.11.0 |
|
| 79 | + * @access private |
|
| 80 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 81 | + */ |
|
| 82 | + private $publisher_element; |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * Create a {@link Wordlift_Admin_Settings_Page} instance. |
|
| 86 | + * |
|
| 87 | + * @since 3.11.0 |
|
| 88 | + * |
|
| 89 | + * @param \Wordlift_Configuration_Service $configuration_service |
|
| 90 | + * @param \Wordlift_Entity_Service $entity_service |
|
| 91 | + * @param \Wordlift_Admin_Input_Element $input_element |
|
| 92 | + * @param \Wordlift_Admin_Language_Select_Element $language_select_element |
|
| 93 | + * @param \Wordlift_Admin_Publisher_Element $publisher_element |
|
| 94 | + * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element |
|
| 95 | + */ |
|
| 96 | + function __construct( $configuration_service, $entity_service, $input_element, $language_select_element, $publisher_element, $radio_input_element ) { |
|
| 97 | + |
|
| 98 | + $this->configuration_service = $configuration_service; |
|
| 99 | + $this->entity_service = $entity_service; |
|
| 100 | + |
|
| 101 | + // Set a reference to the UI elements. |
|
| 102 | + $this->input_element = $input_element; |
|
| 103 | + $this->radio_input_element = $radio_input_element; |
|
| 104 | + $this->language_select_element = $language_select_element; |
|
| 105 | + $this->publisher_element = $publisher_element; |
|
| 106 | + |
|
| 107 | + self::$instance = $this; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * Get the singleton instance of the Notice service. |
|
| 112 | + * |
|
| 113 | + * @since 3.14.0 |
|
| 114 | + * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service. |
|
| 115 | + */ |
|
| 116 | + public static function get_instance() { |
|
| 117 | + |
|
| 118 | + return self::$instance; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * @inheritdoc |
|
| 123 | + */ |
|
| 124 | + function get_parent_slug() { |
|
| 125 | + |
|
| 126 | + return 'wl_admin_menu'; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @inheritdoc |
|
| 131 | + */ |
|
| 132 | + function get_capability() { |
|
| 133 | + |
|
| 134 | + return 'manage_options'; |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @inheritdoc |
|
| 139 | + */ |
|
| 140 | + function get_page_title() { |
|
| 141 | + |
|
| 142 | + return 'WorldLift Settings'; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @inheritdoc |
|
| 147 | + */ |
|
| 148 | + function get_menu_title() { |
|
| 149 | + |
|
| 150 | + return 'Settings'; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * @inheritdoc |
|
| 155 | + */ |
|
| 156 | + function get_menu_slug() { |
|
| 157 | + |
|
| 158 | + return 'wl_configuration_admin_menu'; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * @inheritdoc |
|
| 163 | + */ |
|
| 164 | + function get_partial_name() { |
|
| 165 | + |
|
| 166 | + return 'wordlift-admin-settings-page.php'; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * @inheritdoc |
|
| 171 | + */ |
|
| 172 | + public function enqueue_scripts() { |
|
| 173 | + |
|
| 174 | + // Enqueue the media scripts to be used for the publisher's logo selection. |
|
| 175 | + wp_enqueue_media(); |
|
| 176 | + |
|
| 177 | + // JavaScript required for the settings page. |
|
| 178 | + // @todo: try to move to the `wordlift-admin.bundle.js`. |
|
| 179 | + wp_enqueue_script( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift-admin-settings-page.bundle.js', array( 'wp-util' ) ); |
|
| 180 | + |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Configure all the configuration parameters. |
|
| 185 | + * |
|
| 186 | + * Called by the *admin_init* hook. |
|
| 187 | + * |
|
| 188 | + * @since 3.11.0 |
|
| 189 | + */ |
|
| 190 | + function admin_init() { |
|
| 191 | + |
|
| 192 | + // Register WordLift's general settings, providing our own sanitize callback |
|
| 193 | + // which will also check whether the user filled the WL Publisher form. |
|
| 194 | + register_setting( |
|
| 195 | + 'wl_general_settings', |
|
| 196 | + 'wl_general_settings', |
|
| 197 | + array( $this, 'sanitize_callback', ) |
|
| 198 | + ); |
|
| 199 | + |
|
| 200 | + // Add the general settings section. |
|
| 201 | + add_settings_section( |
|
| 202 | + 'wl_general_settings_section', // ID used to identify this section and with which to register options. |
|
| 203 | + '', // Section header. |
|
| 204 | + '', // Callback used to render the description of the section. |
|
| 205 | + 'wl_general_settings' // Page on which to add this section of options. |
|
| 206 | + ); |
|
| 207 | + |
|
| 208 | + $key_args = array( |
|
| 209 | + 'id' => 'wl-key', |
|
| 210 | + 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::KEY . ']', |
|
| 211 | + 'value' => $this->configuration_service->get_key(), |
|
| 212 | + 'description' => _x( 'Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift' ), |
|
| 213 | + ); |
|
| 214 | + |
|
| 215 | + // Set the class for the key field based on the validity of the key. |
|
| 216 | + // Class should be "untouched" for an empty (virgin) value, "valid" |
|
| 217 | + // if the key is valid, or "invalid" otherwise. |
|
| 218 | + $validation_service = new Wordlift_Key_Validation_Service(); |
|
| 219 | + |
|
| 220 | + if ( empty( $key_args['value'] ) ) { |
|
| 221 | + $key_args['css_class'] = 'untouched'; |
|
| 222 | + } elseif ( $validation_service->is_valid( $key_args['value'] ) ) { |
|
| 223 | + $key_args['css_class'] = 'valid'; |
|
| 224 | + } else { |
|
| 225 | + $key_args['css_class'] = 'invalid'; |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // Add the `key` field. |
|
| 229 | + add_settings_field( |
|
| 230 | + 'wl-key', // Element id used to identify the field throughout the theme. |
|
| 231 | + _x( 'WordLift Key', 'wordlift' ), // The label to the left of the option interface element. |
|
| 232 | + // The name of the function responsible for rendering the option interface. |
|
| 233 | + array( $this->input_element, 'render', ), |
|
| 234 | + 'wl_general_settings', // The page on which this option will be displayed. |
|
| 235 | + 'wl_general_settings_section', // The name of the section to which this field belongs. |
|
| 236 | + $key_args // The array of arguments to pass to the callback. In this case, just a description. |
|
| 237 | + ); |
|
| 238 | + |
|
| 239 | + // Entity Base Path input. |
|
| 240 | + $entity_base_path_args = array( |
|
| 241 | + // The array of arguments to pass to the callback. In this case, just a description. |
|
| 242 | + 'id' => 'wl-entity-base-path', |
|
| 243 | + 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::ENTITY_BASE_PATH_KEY . ']', |
|
| 244 | + 'value' => $this->configuration_service->get_entity_base_path(), |
|
| 245 | + 'description' => sprintf( _x( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field above. Check our <a href="%s">FAQs</a> if you need more info.', 'wordlift' ), 'https://wordlift.io/wordlift-user-faqs/#10-why-and-how-should-i-customize-the-url-of-the-entity-pages-created-in-my-vocabulary' ), |
|
| 246 | + ); |
|
| 247 | + |
|
| 248 | + $entity_base_path_args['readonly'] = 0 < $this->entity_service->count(); |
|
| 249 | + |
|
| 250 | + // Add the `wl_entity_base_path` field. |
|
| 251 | + add_settings_field( |
|
| 252 | + 'wl-entity-base-path', // ID used to identify the field throughout the theme |
|
| 253 | + _x( 'Entity Base Path', 'wordlift' ), // The label to the left of the option interface element |
|
| 254 | + // The name of the function responsible for rendering the option interface |
|
| 255 | + array( $this->input_element, 'render', ), |
|
| 256 | + 'wl_general_settings', // The page on which this option will be displayed |
|
| 257 | + 'wl_general_settings_section', // The name of the section to which this field belongs |
|
| 258 | + $entity_base_path_args |
|
| 259 | + ); |
|
| 260 | + |
|
| 261 | + // Add the `language_name` field. |
|
| 262 | + add_settings_field( |
|
| 263 | + 'wl-site-language', |
|
| 264 | + _x( 'Site Language', 'wordlift' ), |
|
| 265 | + array( $this->language_select_element, 'render' ), |
|
| 266 | + 'wl_general_settings', |
|
| 267 | + 'wl_general_settings_section', |
|
| 268 | + array( |
|
| 269 | + // The array of arguments to pass to the callback. In this case, just a description. |
|
| 270 | + 'id' => 'wl-site-language', |
|
| 271 | + 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::LANGUAGE . ']', |
|
| 272 | + 'value' => $this->configuration_service->get_language_code(), |
|
| 273 | + 'description' => __( 'Each WordLift Key can be used only in one language. Pick yours.', 'wordlift' ), |
|
| 274 | + ) |
|
| 275 | + ); |
|
| 276 | + |
|
| 277 | + // Add the `publisher` field. |
|
| 278 | + add_settings_field( |
|
| 279 | + 'wl-publisher-id', |
|
| 280 | + _x( 'Publisher', 'wordlift' ), |
|
| 281 | + array( $this->publisher_element, 'render' ), |
|
| 282 | + 'wl_general_settings', |
|
| 283 | + 'wl_general_settings_section', |
|
| 284 | + array( |
|
| 285 | + 'id' => 'wl-publisher-id', |
|
| 286 | + 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::PUBLISHER_ID . ']', |
|
| 287 | + ) |
|
| 288 | + ); |
|
| 289 | + |
|
| 290 | + // Add the `link by default` field. |
|
| 291 | + add_settings_field( |
|
| 292 | + 'wl-link-by-default', |
|
| 293 | + _x( 'Link by Default', 'wordlift' ), |
|
| 294 | + array( $this->radio_input_element, 'render' ), |
|
| 295 | + 'wl_general_settings', |
|
| 296 | + 'wl_general_settings_section', |
|
| 297 | + array( |
|
| 298 | + 'id' => 'wl-link-by-default', |
|
| 299 | + 'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::LINK_BY_DEFAULT . ']', |
|
| 300 | + 'value' => $this->configuration_service->is_link_by_default() ? 'yes' : 'no', |
|
| 301 | + 'description' => _x( 'Whether to link entities by default or not. This setting applies to all the entities.', 'wordlift' ), |
|
| 302 | + ) |
|
| 303 | + ); |
|
| 304 | + |
|
| 305 | + } |
|
| 306 | + |
|
| 307 | + /** |
|
| 308 | + * Sanitize the configuration settings to be stored. |
|
| 309 | + * |
|
| 310 | + * If a new entity is being created for the publisher, create it and set The |
|
| 311 | + * publisher setting. |
|
| 312 | + * |
|
| 313 | + * @since 3.11.0 |
|
| 314 | + * |
|
| 315 | + * @param array $input The configuration settings array. |
|
| 316 | + * |
|
| 317 | + * @return array The sanitized input array. |
|
| 318 | + */ |
|
| 319 | + function sanitize_callback( $input ) { |
|
| 320 | + |
|
| 321 | + // Check whether a publisher name has been set. |
|
| 322 | + if ( isset( $_POST['wl_publisher'] ) && ! empty( $_POST['wl_publisher']['name'] ) ) { |
|
| 323 | + $name = $_POST['wl_publisher']['name']; |
|
| 324 | + $type = $_POST['wl_publisher']['type']; |
|
| 325 | + $thumbnail_id = $_POST['wl_publisher']['thumbnail_id'] ?: null; |
|
| 326 | + |
|
| 327 | + // Set the type URI, either http://schema.org/Person or http://schema.org/Organization. |
|
| 328 | + $type_uri = sprintf( 'http://schema.org/%s', 'organization' === $type ? 'Organization' : 'Person' ); |
|
| 329 | + |
|
| 330 | + // Create an entity for the publisher and assign it to the input |
|
| 331 | + // parameter which WordPress automatically saves into the settings. |
|
| 332 | + $input['publisher_id'] = $this->entity_service->create( $name, $type_uri, $thumbnail_id, 'publish' ); |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + return $input; |
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | 338 | } |
@@ -22,137 +22,137 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Wordlift_Admin { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The ID of this plugin. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var string $plugin_name The ID of this plugin. |
|
| 31 | - */ |
|
| 32 | - private $plugin_name; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * The version of this plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access private |
|
| 39 | - * @var string $version The current version of this plugin. |
|
| 40 | - */ |
|
| 41 | - private $version; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Initialize the class and set its properties. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * |
|
| 48 | - * @param string $plugin_name The name of this plugin. |
|
| 49 | - * @param string $version The version of this plugin. |
|
| 50 | - * @param \Wordlift_Configuration_Service $configuration_service The configuration service. |
|
| 51 | - * @param \Wordlift_Notice_Service $notice_service The notice service. |
|
| 52 | - */ |
|
| 53 | - public function __construct( $plugin_name, $version, $configuration_service, $notice_service ) { |
|
| 54 | - |
|
| 55 | - $this->plugin_name = $plugin_name; |
|
| 56 | - $this->version = $version; |
|
| 57 | - |
|
| 58 | - $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 59 | - $key = $configuration_service->get_key(); |
|
| 60 | - |
|
| 61 | - if ( empty( $dataset_uri ) ) { |
|
| 62 | - $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 63 | - if ( empty( $key ) ) { |
|
| 64 | - $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>' ); |
|
| 65 | - } else { |
|
| 66 | - $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>' ); |
|
| 67 | - } |
|
| 68 | - $notice_service->add_error( $error ); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Register the stylesheets for the admin area. |
|
| 75 | - * |
|
| 76 | - * @since 1.0.0 |
|
| 77 | - */ |
|
| 78 | - public function enqueue_styles() { |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * This function is provided for demonstration purposes only. |
|
| 82 | - * |
|
| 83 | - * An instance of this class should be passed to the run() function |
|
| 84 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 85 | - * in that particular class. |
|
| 86 | - * |
|
| 87 | - * The Wordlift_Loader will then create the relationship |
|
| 88 | - * between the defined hooks and the functions defined in this |
|
| 89 | - * class. |
|
| 90 | - */ |
|
| 91 | - |
|
| 92 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 93 | - |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Register the JavaScript for the admin area. |
|
| 98 | - * |
|
| 99 | - * @since 1.0.0 |
|
| 100 | - */ |
|
| 101 | - public function enqueue_scripts() { |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * This function is provided for demonstration purposes only. |
|
| 105 | - * |
|
| 106 | - * An instance of this class should be passed to the run() function |
|
| 107 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 108 | - * in that particular class. |
|
| 109 | - * |
|
| 110 | - * The Wordlift_Loader will then create the relationship |
|
| 111 | - * between the defined hooks and the functions defined in this |
|
| 112 | - * class. |
|
| 113 | - */ |
|
| 114 | - |
|
| 115 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 116 | - |
|
| 117 | - // Enqueue the admin scripts. |
|
| 118 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array( |
|
| 119 | - 'jquery', |
|
| 120 | - 'underscore', |
|
| 121 | - 'backbone', |
|
| 122 | - ), $this->version, false ); |
|
| 123 | - |
|
| 124 | - // Set the basic params. |
|
| 125 | - $params = array( |
|
| 126 | - // @todo scripts in admin should use wp.post. |
|
| 127 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 128 | - // @todo remove specific actions from settings. |
|
| 129 | - 'action' => 'entity_by_title', |
|
| 130 | - 'datasetUri' => $configuration_service->get_dataset_uri(), |
|
| 131 | - 'language' => $configuration_service->get_language_code(), |
|
| 132 | - 'link_by_default' => $configuration_service->is_link_by_default(), |
|
| 133 | - 'l10n' => array( |
|
| 134 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 135 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 136 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 137 | - ), |
|
| 138 | - ); |
|
| 139 | - |
|
| 140 | - // Set post-related values if there's a current post. |
|
| 141 | - if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 142 | - |
|
| 143 | - $params['post_id'] = $entity_being_edited->ID; |
|
| 144 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() ); |
|
| 145 | - // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
| 146 | - // from the results, since we don't want the current entity to be discovered by the analysis. |
|
| 147 | - // |
|
| 148 | - // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
| 149 | - $params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID ); |
|
| 150 | - |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - // Finally output the params as `wlSettings` for JavaScript code. |
|
| 154 | - wp_localize_script( $this->plugin_name, 'wlSettings', $params ); |
|
| 155 | - |
|
| 156 | - } |
|
| 25 | + /** |
|
| 26 | + * The ID of this plugin. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var string $plugin_name The ID of this plugin. |
|
| 31 | + */ |
|
| 32 | + private $plugin_name; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * The version of this plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access private |
|
| 39 | + * @var string $version The current version of this plugin. |
|
| 40 | + */ |
|
| 41 | + private $version; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Initialize the class and set its properties. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * |
|
| 48 | + * @param string $plugin_name The name of this plugin. |
|
| 49 | + * @param string $version The version of this plugin. |
|
| 50 | + * @param \Wordlift_Configuration_Service $configuration_service The configuration service. |
|
| 51 | + * @param \Wordlift_Notice_Service $notice_service The notice service. |
|
| 52 | + */ |
|
| 53 | + public function __construct( $plugin_name, $version, $configuration_service, $notice_service ) { |
|
| 54 | + |
|
| 55 | + $this->plugin_name = $plugin_name; |
|
| 56 | + $this->version = $version; |
|
| 57 | + |
|
| 58 | + $dataset_uri = $configuration_service->get_dataset_uri(); |
|
| 59 | + $key = $configuration_service->get_key(); |
|
| 60 | + |
|
| 61 | + if ( empty( $dataset_uri ) ) { |
|
| 62 | + $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 63 | + if ( empty( $key ) ) { |
|
| 64 | + $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>' ); |
|
| 65 | + } else { |
|
| 66 | + $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>' ); |
|
| 67 | + } |
|
| 68 | + $notice_service->add_error( $error ); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Register the stylesheets for the admin area. |
|
| 75 | + * |
|
| 76 | + * @since 1.0.0 |
|
| 77 | + */ |
|
| 78 | + public function enqueue_styles() { |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * This function is provided for demonstration purposes only. |
|
| 82 | + * |
|
| 83 | + * An instance of this class should be passed to the run() function |
|
| 84 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 85 | + * in that particular class. |
|
| 86 | + * |
|
| 87 | + * The Wordlift_Loader will then create the relationship |
|
| 88 | + * between the defined hooks and the functions defined in this |
|
| 89 | + * class. |
|
| 90 | + */ |
|
| 91 | + |
|
| 92 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 93 | + |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Register the JavaScript for the admin area. |
|
| 98 | + * |
|
| 99 | + * @since 1.0.0 |
|
| 100 | + */ |
|
| 101 | + public function enqueue_scripts() { |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * This function is provided for demonstration purposes only. |
|
| 105 | + * |
|
| 106 | + * An instance of this class should be passed to the run() function |
|
| 107 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 108 | + * in that particular class. |
|
| 109 | + * |
|
| 110 | + * The Wordlift_Loader will then create the relationship |
|
| 111 | + * between the defined hooks and the functions defined in this |
|
| 112 | + * class. |
|
| 113 | + */ |
|
| 114 | + |
|
| 115 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
| 116 | + |
|
| 117 | + // Enqueue the admin scripts. |
|
| 118 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array( |
|
| 119 | + 'jquery', |
|
| 120 | + 'underscore', |
|
| 121 | + 'backbone', |
|
| 122 | + ), $this->version, false ); |
|
| 123 | + |
|
| 124 | + // Set the basic params. |
|
| 125 | + $params = array( |
|
| 126 | + // @todo scripts in admin should use wp.post. |
|
| 127 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 128 | + // @todo remove specific actions from settings. |
|
| 129 | + 'action' => 'entity_by_title', |
|
| 130 | + 'datasetUri' => $configuration_service->get_dataset_uri(), |
|
| 131 | + 'language' => $configuration_service->get_language_code(), |
|
| 132 | + 'link_by_default' => $configuration_service->is_link_by_default(), |
|
| 133 | + 'l10n' => array( |
|
| 134 | + 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 135 | + 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 136 | + 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 137 | + ), |
|
| 138 | + ); |
|
| 139 | + |
|
| 140 | + // Set post-related values if there's a current post. |
|
| 141 | + if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 142 | + |
|
| 143 | + $params['post_id'] = $entity_being_edited->ID; |
|
| 144 | + $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() ); |
|
| 145 | + // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
|
| 146 | + // from the results, since we don't want the current entity to be discovered by the analysis. |
|
| 147 | + // |
|
| 148 | + // See https://github.com/insideout10/wordlift-plugin/issues/345 |
|
| 149 | + $params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID ); |
|
| 150 | + |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + // Finally output the params as `wlSettings` for JavaScript code. |
|
| 154 | + wp_localize_script( $this->plugin_name, 'wlSettings', $params ); |
|
| 155 | + |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | 158 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param \Wordlift_Configuration_Service $configuration_service The configuration service. |
| 51 | 51 | * @param \Wordlift_Notice_Service $notice_service The notice service. |
| 52 | 52 | */ |
| 53 | - public function __construct( $plugin_name, $version, $configuration_service, $notice_service ) { |
|
| 53 | + public function __construct($plugin_name, $version, $configuration_service, $notice_service) { |
|
| 54 | 54 | |
| 55 | 55 | $this->plugin_name = $plugin_name; |
| 56 | 56 | $this->version = $version; |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | $dataset_uri = $configuration_service->get_dataset_uri(); |
| 59 | 59 | $key = $configuration_service->get_key(); |
| 60 | 60 | |
| 61 | - if ( empty( $dataset_uri ) ) { |
|
| 61 | + if (empty($dataset_uri)) { |
|
| 62 | 62 | $settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
| 63 | - if ( empty( $key ) ) { |
|
| 64 | - $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>' ); |
|
| 63 | + if (empty($key)) { |
|
| 64 | + $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>'); |
|
| 65 | 65 | } else { |
| 66 | - $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>' ); |
|
| 66 | + $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>'); |
|
| 67 | 67 | } |
| 68 | - $notice_service->add_error( $error ); |
|
| 68 | + $notice_service->add_error($error); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * class. |
| 90 | 90 | */ |
| 91 | 91 | |
| 92 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 92 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all'); |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -115,43 +115,43 @@ discard block |
||
| 115 | 115 | $configuration_service = Wordlift_Configuration_Service::get_instance(); |
| 116 | 116 | |
| 117 | 117 | // Enqueue the admin scripts. |
| 118 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array( |
|
| 118 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-admin.bundle.js', array( |
|
| 119 | 119 | 'jquery', |
| 120 | 120 | 'underscore', |
| 121 | 121 | 'backbone', |
| 122 | - ), $this->version, false ); |
|
| 122 | + ), $this->version, false); |
|
| 123 | 123 | |
| 124 | 124 | // Set the basic params. |
| 125 | 125 | $params = array( |
| 126 | 126 | // @todo scripts in admin should use wp.post. |
| 127 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 127 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 128 | 128 | // @todo remove specific actions from settings. |
| 129 | 129 | 'action' => 'entity_by_title', |
| 130 | 130 | 'datasetUri' => $configuration_service->get_dataset_uri(), |
| 131 | 131 | 'language' => $configuration_service->get_language_code(), |
| 132 | 132 | 'link_by_default' => $configuration_service->is_link_by_default(), |
| 133 | 133 | 'l10n' => array( |
| 134 | - 'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ), |
|
| 135 | - 'logo_selection_title' => __( 'WordLift Choose Logo', 'wordlift' ), |
|
| 136 | - 'logo_selection_button' => array( 'text' => __( 'Choose Logo', 'wordlift' ) ), |
|
| 134 | + 'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'), |
|
| 135 | + 'logo_selection_title' => __('WordLift Choose Logo', 'wordlift'), |
|
| 136 | + 'logo_selection_button' => array('text' => __('Choose Logo', 'wordlift')), |
|
| 137 | 137 | ), |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | // Set post-related values if there's a current post. |
| 141 | - if ( null !== $post = $entity_being_edited = get_post() ) { |
|
| 141 | + if (null !== $post = $entity_being_edited = get_post()) { |
|
| 142 | 142 | |
| 143 | 143 | $params['post_id'] = $entity_being_edited->ID; |
| 144 | - $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() ); |
|
| 144 | + $params['entityBeingEdited'] = isset($entity_being_edited->post_type) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric(get_the_ID()); |
|
| 145 | 145 | // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it |
| 146 | 146 | // from the results, since we don't want the current entity to be discovered by the analysis. |
| 147 | 147 | // |
| 148 | 148 | // See https://github.com/insideout10/wordlift-plugin/issues/345 |
| 149 | - $params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID ); |
|
| 149 | + $params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri($entity_being_edited->ID); |
|
| 150 | 150 | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // Finally output the params as `wlSettings` for JavaScript code. |
| 154 | - wp_localize_script( $this->plugin_name, 'wlSettings', $params ); |
|
| 154 | + wp_localize_script($this->plugin_name, 'wlSettings', $params); |
|
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
@@ -18,130 +18,130 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | abstract class Wordlift_Admin_Page { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Get the parent slug. |
|
| 23 | - * |
|
| 24 | - * @since 3.11.0 |
|
| 25 | - * |
|
| 26 | - * @return string The parent slug (default 'wl_admin_menu'). |
|
| 27 | - */ |
|
| 28 | - protected function get_parent_slug() { |
|
| 29 | - |
|
| 30 | - return 'wl_admin_menu'; |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * Get the required capability. |
|
| 35 | - * |
|
| 36 | - * @since 3.11.0 |
|
| 37 | - * |
|
| 38 | - * @return string The capability (default 'manage_options'). |
|
| 39 | - */ |
|
| 40 | - protected function get_capability() { |
|
| 41 | - |
|
| 42 | - return 'manage_options'; |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * Get the page title. Will be translated. |
|
| 47 | - * |
|
| 48 | - * @since 3.11.0 |
|
| 49 | - * |
|
| 50 | - * @return string The page title. |
|
| 51 | - */ |
|
| 52 | - abstract function get_page_title(); |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Get the menu title. Will be translated. |
|
| 56 | - * |
|
| 57 | - * @since 3.11.0 |
|
| 58 | - * |
|
| 59 | - * @return string The menu title. |
|
| 60 | - */ |
|
| 61 | - abstract function get_menu_title(); |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Get the menu slug. |
|
| 65 | - * |
|
| 66 | - * @since 3.11.0 |
|
| 67 | - * |
|
| 68 | - * @return string The menu slug. |
|
| 69 | - */ |
|
| 70 | - abstract function get_menu_slug(); |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Get the page url. |
|
| 74 | - * |
|
| 75 | - * @since 3.14.0 |
|
| 76 | - * |
|
| 77 | - * @return string The escaped url of the admin page |
|
| 78 | - */ |
|
| 79 | - function get_url() { |
|
| 80 | - |
|
| 81 | - // ideally should have used menu_page_url, but it is loaded later than some usages. |
|
| 82 | - $url = admin_url( 'admin.php?page=' . $this->get_menu_slug() ); |
|
| 83 | - |
|
| 84 | - return esc_url( $url ); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Get the partial file name, used in the {@link render} function. |
|
| 89 | - * |
|
| 90 | - * @since 3.11.0 |
|
| 91 | - * |
|
| 92 | - * @return string The partial file name. |
|
| 93 | - */ |
|
| 94 | - abstract function get_partial_name(); |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The `admin_menu` callback. Will call {@link add_submenu_page} to add the |
|
| 98 | - * page to the admin menu. |
|
| 99 | - * |
|
| 100 | - * @since 3.11.0 |
|
| 101 | - * |
|
| 102 | - * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
|
| 103 | - */ |
|
| 104 | - public function admin_menu() { |
|
| 105 | - |
|
| 106 | - // Add the sub-menu page. |
|
| 107 | - // |
|
| 108 | - // See http://codex.wordpress.org/Function_Reference/add_submenu_page |
|
| 109 | - $page = add_submenu_page( |
|
| 110 | - $this->get_parent_slug(), |
|
| 111 | - $this->get_page_title(), |
|
| 112 | - $this->get_menu_title(), |
|
| 113 | - $this->get_capability(), // The required capability, provided by the calling hook. |
|
| 114 | - $this->get_menu_slug(), |
|
| 115 | - array( $this, 'render' ) |
|
| 116 | - ); |
|
| 117 | - |
|
| 118 | - // Set a hook to enqueue scripts only when the settings page is displayed. |
|
| 119 | - add_action( 'admin_print_scripts-' . $page, array( |
|
| 120 | - $this, |
|
| 121 | - 'enqueue_scripts', |
|
| 122 | - ) ); |
|
| 123 | - |
|
| 124 | - // Finally return the page hook_suffix. |
|
| 125 | - return $page; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Enqueue scripts for the specific page. Subclasses can override this function |
|
| 130 | - * to provide their own styles/scripts. |
|
| 131 | - * |
|
| 132 | - * @since 3.11.0 |
|
| 133 | - */ |
|
| 134 | - public function enqueue_scripts() { |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * Render the page. |
|
| 139 | - */ |
|
| 140 | - public function render() { |
|
| 141 | - |
|
| 142 | - // Include the partial. |
|
| 143 | - include( plugin_dir_path( __FILE__ ) . 'partials/' . $this->get_partial_name() ); |
|
| 144 | - |
|
| 145 | - } |
|
| 21 | + /** |
|
| 22 | + * Get the parent slug. |
|
| 23 | + * |
|
| 24 | + * @since 3.11.0 |
|
| 25 | + * |
|
| 26 | + * @return string The parent slug (default 'wl_admin_menu'). |
|
| 27 | + */ |
|
| 28 | + protected function get_parent_slug() { |
|
| 29 | + |
|
| 30 | + return 'wl_admin_menu'; |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * Get the required capability. |
|
| 35 | + * |
|
| 36 | + * @since 3.11.0 |
|
| 37 | + * |
|
| 38 | + * @return string The capability (default 'manage_options'). |
|
| 39 | + */ |
|
| 40 | + protected function get_capability() { |
|
| 41 | + |
|
| 42 | + return 'manage_options'; |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * Get the page title. Will be translated. |
|
| 47 | + * |
|
| 48 | + * @since 3.11.0 |
|
| 49 | + * |
|
| 50 | + * @return string The page title. |
|
| 51 | + */ |
|
| 52 | + abstract function get_page_title(); |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Get the menu title. Will be translated. |
|
| 56 | + * |
|
| 57 | + * @since 3.11.0 |
|
| 58 | + * |
|
| 59 | + * @return string The menu title. |
|
| 60 | + */ |
|
| 61 | + abstract function get_menu_title(); |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Get the menu slug. |
|
| 65 | + * |
|
| 66 | + * @since 3.11.0 |
|
| 67 | + * |
|
| 68 | + * @return string The menu slug. |
|
| 69 | + */ |
|
| 70 | + abstract function get_menu_slug(); |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Get the page url. |
|
| 74 | + * |
|
| 75 | + * @since 3.14.0 |
|
| 76 | + * |
|
| 77 | + * @return string The escaped url of the admin page |
|
| 78 | + */ |
|
| 79 | + function get_url() { |
|
| 80 | + |
|
| 81 | + // ideally should have used menu_page_url, but it is loaded later than some usages. |
|
| 82 | + $url = admin_url( 'admin.php?page=' . $this->get_menu_slug() ); |
|
| 83 | + |
|
| 84 | + return esc_url( $url ); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Get the partial file name, used in the {@link render} function. |
|
| 89 | + * |
|
| 90 | + * @since 3.11.0 |
|
| 91 | + * |
|
| 92 | + * @return string The partial file name. |
|
| 93 | + */ |
|
| 94 | + abstract function get_partial_name(); |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The `admin_menu` callback. Will call {@link add_submenu_page} to add the |
|
| 98 | + * page to the admin menu. |
|
| 99 | + * |
|
| 100 | + * @since 3.11.0 |
|
| 101 | + * |
|
| 102 | + * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
|
| 103 | + */ |
|
| 104 | + public function admin_menu() { |
|
| 105 | + |
|
| 106 | + // Add the sub-menu page. |
|
| 107 | + // |
|
| 108 | + // See http://codex.wordpress.org/Function_Reference/add_submenu_page |
|
| 109 | + $page = add_submenu_page( |
|
| 110 | + $this->get_parent_slug(), |
|
| 111 | + $this->get_page_title(), |
|
| 112 | + $this->get_menu_title(), |
|
| 113 | + $this->get_capability(), // The required capability, provided by the calling hook. |
|
| 114 | + $this->get_menu_slug(), |
|
| 115 | + array( $this, 'render' ) |
|
| 116 | + ); |
|
| 117 | + |
|
| 118 | + // Set a hook to enqueue scripts only when the settings page is displayed. |
|
| 119 | + add_action( 'admin_print_scripts-' . $page, array( |
|
| 120 | + $this, |
|
| 121 | + 'enqueue_scripts', |
|
| 122 | + ) ); |
|
| 123 | + |
|
| 124 | + // Finally return the page hook_suffix. |
|
| 125 | + return $page; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Enqueue scripts for the specific page. Subclasses can override this function |
|
| 130 | + * to provide their own styles/scripts. |
|
| 131 | + * |
|
| 132 | + * @since 3.11.0 |
|
| 133 | + */ |
|
| 134 | + public function enqueue_scripts() { |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * Render the page. |
|
| 139 | + */ |
|
| 140 | + public function render() { |
|
| 141 | + |
|
| 142 | + // Include the partial. |
|
| 143 | + include( plugin_dir_path( __FILE__ ) . 'partials/' . $this->get_partial_name() ); |
|
| 144 | + |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | 147 | } |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | function get_url() { |
| 80 | 80 | |
| 81 | 81 | // ideally should have used menu_page_url, but it is loaded later than some usages. |
| 82 | - $url = admin_url( 'admin.php?page=' . $this->get_menu_slug() ); |
|
| 82 | + $url = admin_url('admin.php?page='.$this->get_menu_slug()); |
|
| 83 | 83 | |
| 84 | - return esc_url( $url ); |
|
| 84 | + return esc_url($url); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -110,16 +110,16 @@ discard block |
||
| 110 | 110 | $this->get_parent_slug(), |
| 111 | 111 | $this->get_page_title(), |
| 112 | 112 | $this->get_menu_title(), |
| 113 | - $this->get_capability(), // The required capability, provided by the calling hook. |
|
| 113 | + $this->get_capability(), // The required capability, provided by the calling hook. |
|
| 114 | 114 | $this->get_menu_slug(), |
| 115 | - array( $this, 'render' ) |
|
| 115 | + array($this, 'render') |
|
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | // Set a hook to enqueue scripts only when the settings page is displayed. |
| 119 | - add_action( 'admin_print_scripts-' . $page, array( |
|
| 119 | + add_action('admin_print_scripts-'.$page, array( |
|
| 120 | 120 | $this, |
| 121 | 121 | 'enqueue_scripts', |
| 122 | - ) ); |
|
| 122 | + )); |
|
| 123 | 123 | |
| 124 | 124 | // Finally return the page hook_suffix. |
| 125 | 125 | return $page; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function render() { |
| 141 | 141 | |
| 142 | 142 | // Include the partial. |
| 143 | - include( plugin_dir_path( __FILE__ ) . 'partials/' . $this->get_partial_name() ); |
|
| 143 | + include(plugin_dir_path(__FILE__).'partials/'.$this->get_partial_name()); |
|
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
@@ -29,1219 +29,1219 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Wordlift { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | - * the plugin. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @access protected |
|
| 38 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | - */ |
|
| 40 | - protected $loader; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * The unique identifier of this plugin. |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @access protected |
|
| 47 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | - */ |
|
| 49 | - protected $plugin_name; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * The current version of the plugin. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * @access protected |
|
| 56 | - * @var string $version The current version of the plugin. |
|
| 57 | - */ |
|
| 58 | - protected $version; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 62 | - * |
|
| 63 | - * @since 3.12.0 |
|
| 64 | - * @access protected |
|
| 65 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 66 | - */ |
|
| 67 | - protected $tinymce_adapter; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The Thumbnail service. |
|
| 71 | - * |
|
| 72 | - * @since 3.1.5 |
|
| 73 | - * @access private |
|
| 74 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 75 | - */ |
|
| 76 | - private $thumbnail_service; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * The UI service. |
|
| 80 | - * |
|
| 81 | - * @since 3.2.0 |
|
| 82 | - * @access private |
|
| 83 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 84 | - */ |
|
| 85 | - private $ui_service; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The Schema service. |
|
| 89 | - * |
|
| 90 | - * @since 3.3.0 |
|
| 91 | - * @access private |
|
| 92 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 93 | - */ |
|
| 94 | - private $schema_service; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The Entity service. |
|
| 98 | - * |
|
| 99 | - * @since 3.1.0 |
|
| 100 | - * @access protected |
|
| 101 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 102 | - */ |
|
| 103 | - protected $entity_service; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The Topic Taxonomy service. |
|
| 107 | - * |
|
| 108 | - * @since 3.5.0 |
|
| 109 | - * @access private |
|
| 110 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 111 | - */ |
|
| 112 | - private $topic_taxonomy_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The User service. |
|
| 116 | - * |
|
| 117 | - * @since 3.1.7 |
|
| 118 | - * @access protected |
|
| 119 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 120 | - */ |
|
| 121 | - protected $user_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The Timeline service. |
|
| 125 | - * |
|
| 126 | - * @since 3.1.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 129 | - */ |
|
| 130 | - private $timeline_service; |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * The Redirect service. |
|
| 134 | - * |
|
| 135 | - * @since 3.2.0 |
|
| 136 | - * @access private |
|
| 137 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 138 | - */ |
|
| 139 | - private $redirect_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Notice service. |
|
| 143 | - * |
|
| 144 | - * @since 3.3.0 |
|
| 145 | - * @access private |
|
| 146 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 147 | - */ |
|
| 148 | - private $notice_service; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The Entity list customization. |
|
| 152 | - * |
|
| 153 | - * @since 3.3.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 156 | - */ |
|
| 157 | - private $entity_list_service; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The Entity Types Taxonomy Walker. |
|
| 161 | - * |
|
| 162 | - * @since 3.1.0 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 165 | - */ |
|
| 166 | - private $entity_types_taxonomy_walker; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * The ShareThis service. |
|
| 170 | - * |
|
| 171 | - * @since 3.2.0 |
|
| 172 | - * @access private |
|
| 173 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 174 | - */ |
|
| 175 | - private $sharethis_service; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * The PrimaShop adapter. |
|
| 179 | - * |
|
| 180 | - * @since 3.2.3 |
|
| 181 | - * @access private |
|
| 182 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 183 | - */ |
|
| 184 | - private $primashop_adapter; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The WordLift Dashboard adapter. |
|
| 188 | - * |
|
| 189 | - * @since 3.4.0 |
|
| 190 | - * @access private |
|
| 191 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 192 | - */ |
|
| 193 | - private $dashboard_service; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The entity type service. |
|
| 197 | - * |
|
| 198 | - * @since 3.6.0 |
|
| 199 | - * @access private |
|
| 200 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 201 | - */ |
|
| 202 | - private $entity_post_type_service; |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 206 | - * |
|
| 207 | - * @since 3.6.0 |
|
| 208 | - * @access private |
|
| 209 | - * @var \Wordlift_Entity_Link_Service |
|
| 210 | - */ |
|
| 211 | - private $entity_link_service; |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 215 | - * |
|
| 216 | - * @var 3.6.0 |
|
| 217 | - * @access protected |
|
| 218 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 219 | - */ |
|
| 220 | - protected $sparql_service; |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * A {@link Wordlift_Import_Service} instance. |
|
| 224 | - * |
|
| 225 | - * @since 3.6.0 |
|
| 226 | - * @access private |
|
| 227 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 228 | - */ |
|
| 229 | - private $import_service; |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 233 | - * |
|
| 234 | - * @since 3.6.0 |
|
| 235 | - * @access private |
|
| 236 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 237 | - */ |
|
| 238 | - private $rebuild_service; |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 242 | - * |
|
| 243 | - * @since 3.7.0 |
|
| 244 | - * @access protected |
|
| 245 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 246 | - */ |
|
| 247 | - protected $jsonld_service; |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * |
|
| 251 | - * @since 3.7.0 |
|
| 252 | - * @access private |
|
| 253 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 254 | - */ |
|
| 255 | - private $property_factory; |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * The 'Download Your Data' page. |
|
| 259 | - * |
|
| 260 | - * @since 3.6.0 |
|
| 261 | - * @access private |
|
| 262 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 263 | - */ |
|
| 264 | - private $download_your_data_page; |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * The 'WordLift Settings' page. |
|
| 268 | - * |
|
| 269 | - * @since 3.11.0 |
|
| 270 | - * @access protected |
|
| 271 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 272 | - */ |
|
| 273 | - protected $settings_page; |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * The install wizard page. |
|
| 277 | - * |
|
| 278 | - * @since 3.9.0 |
|
| 279 | - * @access private |
|
| 280 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 281 | - */ |
|
| 282 | - private $admin_setup; |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 286 | - * linking of entities to their pages. |
|
| 287 | - * |
|
| 288 | - * @since 3.8.0 |
|
| 289 | - * @access private |
|
| 290 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 291 | - */ |
|
| 292 | - private $content_filter_service; |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 296 | - * |
|
| 297 | - * @since 3.9.0 |
|
| 298 | - * @access private |
|
| 299 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 300 | - */ |
|
| 301 | - private $key_validation_service; |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 305 | - * |
|
| 306 | - * @since 3.10.0 |
|
| 307 | - * @access private |
|
| 308 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 309 | - */ |
|
| 310 | - private $rating_service; |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 314 | - * |
|
| 315 | - * @since 3.10.0 |
|
| 316 | - * @access protected |
|
| 317 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 318 | - */ |
|
| 319 | - protected $post_to_jsonld_converter; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 323 | - * |
|
| 324 | - * @since 3.10.0 |
|
| 325 | - * @access protected |
|
| 326 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 327 | - */ |
|
| 328 | - protected $configuration_service; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 332 | - * |
|
| 333 | - * @since 3.10.0 |
|
| 334 | - * @access protected |
|
| 335 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 336 | - */ |
|
| 337 | - protected $entity_type_service; |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 341 | - * |
|
| 342 | - * @since 3.10.0 |
|
| 343 | - * @access protected |
|
| 344 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 345 | - */ |
|
| 346 | - protected $entity_post_to_jsonld_converter; |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 350 | - * |
|
| 351 | - * @since 3.10.0 |
|
| 352 | - * @access protected |
|
| 353 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 354 | - */ |
|
| 355 | - protected $postid_to_jsonld_converter; |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
| 359 | - * |
|
| 360 | - * @since 3.9.8 |
|
| 361 | - * @access private |
|
| 362 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 363 | - */ |
|
| 364 | - private $status_page; |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 368 | - * |
|
| 369 | - * @since 3.11.0 |
|
| 370 | - * @access protected |
|
| 371 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 372 | - */ |
|
| 373 | - protected $category_taxonomy_service; |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 377 | - * |
|
| 378 | - * @since 3.11.0 |
|
| 379 | - * @access protected |
|
| 380 | - * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 381 | - */ |
|
| 382 | - protected $event_entity_page_service; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 386 | - * |
|
| 387 | - * @since 3.11.0 |
|
| 388 | - * @access protected |
|
| 389 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 390 | - */ |
|
| 391 | - protected $settings_page_action_link; |
|
| 392 | - |
|
| 393 | - /** |
|
| 394 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 395 | - * |
|
| 396 | - * @since 3.11.0 |
|
| 397 | - * @access protected |
|
| 398 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 399 | - */ |
|
| 400 | - protected $publisher_ajax_adapter; |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 404 | - * |
|
| 405 | - * @since 3.11.0 |
|
| 406 | - * @access protected |
|
| 407 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 408 | - */ |
|
| 409 | - protected $input_element; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 413 | - * |
|
| 414 | - * @since 3.13.0 |
|
| 415 | - * @access protected |
|
| 416 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 417 | - */ |
|
| 418 | - protected $radio_input_element; |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 422 | - * |
|
| 423 | - * @since 3.11.0 |
|
| 424 | - * @access protected |
|
| 425 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 426 | - */ |
|
| 427 | - protected $language_select_element; |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 431 | - * |
|
| 432 | - * @since 3.11.0 |
|
| 433 | - * @access protected |
|
| 434 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 435 | - */ |
|
| 436 | - protected $publisher_element; |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 440 | - * |
|
| 441 | - * @since 3.11.0 |
|
| 442 | - * @access protected |
|
| 443 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 444 | - */ |
|
| 445 | - protected $select2_element; |
|
| 446 | - |
|
| 447 | - /** |
|
| 448 | - * The controller for the entity type list admin page |
|
| 449 | - * |
|
| 450 | - * @since 3.11.0 |
|
| 451 | - * @access private |
|
| 452 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 453 | - */ |
|
| 454 | - private $entity_type_admin_page; |
|
| 455 | - |
|
| 456 | - /** |
|
| 457 | - * The controller for the entity type settings admin page |
|
| 458 | - * |
|
| 459 | - * @since 3.11.0 |
|
| 460 | - * @access private |
|
| 461 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 462 | - */ |
|
| 463 | - private $entity_type_settings_admin_page; |
|
| 464 | - |
|
| 465 | - /** |
|
| 466 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 467 | - * |
|
| 468 | - * @since 3.11.0 |
|
| 469 | - * @access protected |
|
| 470 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 471 | - */ |
|
| 472 | - protected $related_entities_cloud_widget; |
|
| 473 | - |
|
| 474 | - /** |
|
| 475 | - * {@link Wordlift}'s singleton instance. |
|
| 476 | - * |
|
| 477 | - * @since 3.11.2 |
|
| 478 | - * |
|
| 479 | - * @since 3.11.2 |
|
| 480 | - * @access private |
|
| 481 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 482 | - */ |
|
| 483 | - private static $instance; |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * Define the core functionality of the plugin. |
|
| 487 | - * |
|
| 488 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 489 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 490 | - * the public-facing side of the site. |
|
| 491 | - * |
|
| 492 | - * @since 1.0.0 |
|
| 493 | - */ |
|
| 494 | - public function __construct() { |
|
| 495 | - |
|
| 496 | - $this->plugin_name = 'wordlift'; |
|
| 497 | - $this->version = '3.13.3'; |
|
| 498 | - $this->load_dependencies(); |
|
| 499 | - $this->set_locale(); |
|
| 500 | - $this->define_admin_hooks(); |
|
| 501 | - $this->define_public_hooks(); |
|
| 502 | - |
|
| 503 | - self::$instance = $this; |
|
| 504 | - |
|
| 505 | - } |
|
| 506 | - |
|
| 507 | - /** |
|
| 508 | - * Get the singleton instance. |
|
| 509 | - * |
|
| 510 | - * @since 3.11.2 |
|
| 511 | - * |
|
| 512 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 513 | - */ |
|
| 514 | - public static function get_instance() { |
|
| 515 | - |
|
| 516 | - return self::$instance; |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - /** |
|
| 520 | - * Load the required dependencies for this plugin. |
|
| 521 | - * |
|
| 522 | - * Include the following files that make up the plugin: |
|
| 523 | - * |
|
| 524 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 525 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 526 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 527 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 528 | - * |
|
| 529 | - * Create an instance of the loader which will be used to register the hooks |
|
| 530 | - * with WordPress. |
|
| 531 | - * |
|
| 532 | - * @since 1.0.0 |
|
| 533 | - * @access private |
|
| 534 | - */ |
|
| 535 | - private function load_dependencies() { |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * The class responsible for orchestrating the actions and filters of the |
|
| 539 | - * core plugin. |
|
| 540 | - */ |
|
| 541 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 542 | - |
|
| 543 | - /** |
|
| 544 | - * The class responsible for defining internationalization functionality |
|
| 545 | - * of the plugin. |
|
| 546 | - */ |
|
| 547 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 548 | - |
|
| 549 | - /** |
|
| 550 | - * WordLift's supported languages. |
|
| 551 | - */ |
|
| 552 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 553 | - |
|
| 554 | - /** |
|
| 555 | - * Provide support functions to sanitize data. |
|
| 556 | - */ |
|
| 557 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 558 | - |
|
| 559 | - /** |
|
| 560 | - * The Redirect service. |
|
| 561 | - */ |
|
| 562 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 563 | - |
|
| 564 | - /** |
|
| 565 | - * The Log service. |
|
| 566 | - */ |
|
| 567 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 568 | - |
|
| 569 | - /** |
|
| 570 | - * The configuration service. |
|
| 571 | - */ |
|
| 572 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 573 | - |
|
| 574 | - /** |
|
| 575 | - * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 576 | - */ |
|
| 577 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 578 | - |
|
| 579 | - /** |
|
| 580 | - * The entity type service (i.e. the schema type). |
|
| 581 | - */ |
|
| 582 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 583 | - |
|
| 584 | - /** |
|
| 585 | - * The entity link service. |
|
| 586 | - */ |
|
| 587 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 588 | - |
|
| 589 | - /** |
|
| 590 | - * The Query builder. |
|
| 591 | - */ |
|
| 592 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 593 | - |
|
| 594 | - /** |
|
| 595 | - * The Schema service. |
|
| 596 | - */ |
|
| 597 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 598 | - |
|
| 599 | - /** |
|
| 600 | - * The schema:url property service. |
|
| 601 | - */ |
|
| 602 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 603 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 604 | - |
|
| 605 | - /** |
|
| 606 | - * The UI service. |
|
| 607 | - */ |
|
| 608 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 609 | - |
|
| 610 | - /** |
|
| 611 | - * The Thumbnail service. |
|
| 612 | - */ |
|
| 613 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 614 | - |
|
| 615 | - /** |
|
| 616 | - * The Entity Types Taxonomy service. |
|
| 617 | - */ |
|
| 618 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 619 | - |
|
| 620 | - /** |
|
| 621 | - * The Entity service. |
|
| 622 | - */ |
|
| 623 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 624 | - |
|
| 625 | - // Add the entity rating service. |
|
| 626 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 627 | - |
|
| 628 | - /** |
|
| 629 | - * The User service. |
|
| 630 | - */ |
|
| 631 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 632 | - |
|
| 633 | - /** |
|
| 634 | - * The Timeline service. |
|
| 635 | - */ |
|
| 636 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The Topic Taxonomy service. |
|
| 640 | - */ |
|
| 641 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 642 | - |
|
| 643 | - /** |
|
| 644 | - * The SPARQL service. |
|
| 645 | - */ |
|
| 646 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 647 | - |
|
| 648 | - /** |
|
| 649 | - * The WordLift import service. |
|
| 650 | - */ |
|
| 651 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 652 | - |
|
| 653 | - /** |
|
| 654 | - * The WordLift URI service. |
|
| 655 | - */ |
|
| 656 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 657 | - |
|
| 658 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 659 | - |
|
| 660 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 661 | - |
|
| 662 | - /** |
|
| 663 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 664 | - */ |
|
| 665 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 666 | - |
|
| 667 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 668 | - |
|
| 669 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 670 | - |
|
| 671 | - /** |
|
| 672 | - * Load the converters. |
|
| 673 | - */ |
|
| 674 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 675 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 676 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 677 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 678 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 679 | - |
|
| 680 | - /** |
|
| 681 | - * Load the content filter. |
|
| 682 | - */ |
|
| 683 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 684 | - |
|
| 685 | - /* |
|
| 32 | + /** |
|
| 33 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | + * the plugin. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @access protected |
|
| 38 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | + */ |
|
| 40 | + protected $loader; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * The unique identifier of this plugin. |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @access protected |
|
| 47 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | + */ |
|
| 49 | + protected $plugin_name; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * The current version of the plugin. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * @access protected |
|
| 56 | + * @var string $version The current version of the plugin. |
|
| 57 | + */ |
|
| 58 | + protected $version; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 62 | + * |
|
| 63 | + * @since 3.12.0 |
|
| 64 | + * @access protected |
|
| 65 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 66 | + */ |
|
| 67 | + protected $tinymce_adapter; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The Thumbnail service. |
|
| 71 | + * |
|
| 72 | + * @since 3.1.5 |
|
| 73 | + * @access private |
|
| 74 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 75 | + */ |
|
| 76 | + private $thumbnail_service; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * The UI service. |
|
| 80 | + * |
|
| 81 | + * @since 3.2.0 |
|
| 82 | + * @access private |
|
| 83 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 84 | + */ |
|
| 85 | + private $ui_service; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The Schema service. |
|
| 89 | + * |
|
| 90 | + * @since 3.3.0 |
|
| 91 | + * @access private |
|
| 92 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 93 | + */ |
|
| 94 | + private $schema_service; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The Entity service. |
|
| 98 | + * |
|
| 99 | + * @since 3.1.0 |
|
| 100 | + * @access protected |
|
| 101 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 102 | + */ |
|
| 103 | + protected $entity_service; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The Topic Taxonomy service. |
|
| 107 | + * |
|
| 108 | + * @since 3.5.0 |
|
| 109 | + * @access private |
|
| 110 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 111 | + */ |
|
| 112 | + private $topic_taxonomy_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The User service. |
|
| 116 | + * |
|
| 117 | + * @since 3.1.7 |
|
| 118 | + * @access protected |
|
| 119 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 120 | + */ |
|
| 121 | + protected $user_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The Timeline service. |
|
| 125 | + * |
|
| 126 | + * @since 3.1.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 129 | + */ |
|
| 130 | + private $timeline_service; |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * The Redirect service. |
|
| 134 | + * |
|
| 135 | + * @since 3.2.0 |
|
| 136 | + * @access private |
|
| 137 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 138 | + */ |
|
| 139 | + private $redirect_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Notice service. |
|
| 143 | + * |
|
| 144 | + * @since 3.3.0 |
|
| 145 | + * @access private |
|
| 146 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 147 | + */ |
|
| 148 | + private $notice_service; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The Entity list customization. |
|
| 152 | + * |
|
| 153 | + * @since 3.3.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 156 | + */ |
|
| 157 | + private $entity_list_service; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The Entity Types Taxonomy Walker. |
|
| 161 | + * |
|
| 162 | + * @since 3.1.0 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 165 | + */ |
|
| 166 | + private $entity_types_taxonomy_walker; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * The ShareThis service. |
|
| 170 | + * |
|
| 171 | + * @since 3.2.0 |
|
| 172 | + * @access private |
|
| 173 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 174 | + */ |
|
| 175 | + private $sharethis_service; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * The PrimaShop adapter. |
|
| 179 | + * |
|
| 180 | + * @since 3.2.3 |
|
| 181 | + * @access private |
|
| 182 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 183 | + */ |
|
| 184 | + private $primashop_adapter; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The WordLift Dashboard adapter. |
|
| 188 | + * |
|
| 189 | + * @since 3.4.0 |
|
| 190 | + * @access private |
|
| 191 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 192 | + */ |
|
| 193 | + private $dashboard_service; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The entity type service. |
|
| 197 | + * |
|
| 198 | + * @since 3.6.0 |
|
| 199 | + * @access private |
|
| 200 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 201 | + */ |
|
| 202 | + private $entity_post_type_service; |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 206 | + * |
|
| 207 | + * @since 3.6.0 |
|
| 208 | + * @access private |
|
| 209 | + * @var \Wordlift_Entity_Link_Service |
|
| 210 | + */ |
|
| 211 | + private $entity_link_service; |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 215 | + * |
|
| 216 | + * @var 3.6.0 |
|
| 217 | + * @access protected |
|
| 218 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 219 | + */ |
|
| 220 | + protected $sparql_service; |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * A {@link Wordlift_Import_Service} instance. |
|
| 224 | + * |
|
| 225 | + * @since 3.6.0 |
|
| 226 | + * @access private |
|
| 227 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 228 | + */ |
|
| 229 | + private $import_service; |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 233 | + * |
|
| 234 | + * @since 3.6.0 |
|
| 235 | + * @access private |
|
| 236 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 237 | + */ |
|
| 238 | + private $rebuild_service; |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 242 | + * |
|
| 243 | + * @since 3.7.0 |
|
| 244 | + * @access protected |
|
| 245 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 246 | + */ |
|
| 247 | + protected $jsonld_service; |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * |
|
| 251 | + * @since 3.7.0 |
|
| 252 | + * @access private |
|
| 253 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 254 | + */ |
|
| 255 | + private $property_factory; |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * The 'Download Your Data' page. |
|
| 259 | + * |
|
| 260 | + * @since 3.6.0 |
|
| 261 | + * @access private |
|
| 262 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 263 | + */ |
|
| 264 | + private $download_your_data_page; |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * The 'WordLift Settings' page. |
|
| 268 | + * |
|
| 269 | + * @since 3.11.0 |
|
| 270 | + * @access protected |
|
| 271 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 272 | + */ |
|
| 273 | + protected $settings_page; |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * The install wizard page. |
|
| 277 | + * |
|
| 278 | + * @since 3.9.0 |
|
| 279 | + * @access private |
|
| 280 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 281 | + */ |
|
| 282 | + private $admin_setup; |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 286 | + * linking of entities to their pages. |
|
| 287 | + * |
|
| 288 | + * @since 3.8.0 |
|
| 289 | + * @access private |
|
| 290 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 291 | + */ |
|
| 292 | + private $content_filter_service; |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 296 | + * |
|
| 297 | + * @since 3.9.0 |
|
| 298 | + * @access private |
|
| 299 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 300 | + */ |
|
| 301 | + private $key_validation_service; |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 305 | + * |
|
| 306 | + * @since 3.10.0 |
|
| 307 | + * @access private |
|
| 308 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 309 | + */ |
|
| 310 | + private $rating_service; |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 314 | + * |
|
| 315 | + * @since 3.10.0 |
|
| 316 | + * @access protected |
|
| 317 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 318 | + */ |
|
| 319 | + protected $post_to_jsonld_converter; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 323 | + * |
|
| 324 | + * @since 3.10.0 |
|
| 325 | + * @access protected |
|
| 326 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 327 | + */ |
|
| 328 | + protected $configuration_service; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 332 | + * |
|
| 333 | + * @since 3.10.0 |
|
| 334 | + * @access protected |
|
| 335 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 336 | + */ |
|
| 337 | + protected $entity_type_service; |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 341 | + * |
|
| 342 | + * @since 3.10.0 |
|
| 343 | + * @access protected |
|
| 344 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 345 | + */ |
|
| 346 | + protected $entity_post_to_jsonld_converter; |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 350 | + * |
|
| 351 | + * @since 3.10.0 |
|
| 352 | + * @access protected |
|
| 353 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 354 | + */ |
|
| 355 | + protected $postid_to_jsonld_converter; |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
| 359 | + * |
|
| 360 | + * @since 3.9.8 |
|
| 361 | + * @access private |
|
| 362 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 363 | + */ |
|
| 364 | + private $status_page; |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 368 | + * |
|
| 369 | + * @since 3.11.0 |
|
| 370 | + * @access protected |
|
| 371 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 372 | + */ |
|
| 373 | + protected $category_taxonomy_service; |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 377 | + * |
|
| 378 | + * @since 3.11.0 |
|
| 379 | + * @access protected |
|
| 380 | + * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 381 | + */ |
|
| 382 | + protected $event_entity_page_service; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 386 | + * |
|
| 387 | + * @since 3.11.0 |
|
| 388 | + * @access protected |
|
| 389 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 390 | + */ |
|
| 391 | + protected $settings_page_action_link; |
|
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 395 | + * |
|
| 396 | + * @since 3.11.0 |
|
| 397 | + * @access protected |
|
| 398 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 399 | + */ |
|
| 400 | + protected $publisher_ajax_adapter; |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 404 | + * |
|
| 405 | + * @since 3.11.0 |
|
| 406 | + * @access protected |
|
| 407 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 408 | + */ |
|
| 409 | + protected $input_element; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 413 | + * |
|
| 414 | + * @since 3.13.0 |
|
| 415 | + * @access protected |
|
| 416 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 417 | + */ |
|
| 418 | + protected $radio_input_element; |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 422 | + * |
|
| 423 | + * @since 3.11.0 |
|
| 424 | + * @access protected |
|
| 425 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 426 | + */ |
|
| 427 | + protected $language_select_element; |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 431 | + * |
|
| 432 | + * @since 3.11.0 |
|
| 433 | + * @access protected |
|
| 434 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 435 | + */ |
|
| 436 | + protected $publisher_element; |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 440 | + * |
|
| 441 | + * @since 3.11.0 |
|
| 442 | + * @access protected |
|
| 443 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 444 | + */ |
|
| 445 | + protected $select2_element; |
|
| 446 | + |
|
| 447 | + /** |
|
| 448 | + * The controller for the entity type list admin page |
|
| 449 | + * |
|
| 450 | + * @since 3.11.0 |
|
| 451 | + * @access private |
|
| 452 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 453 | + */ |
|
| 454 | + private $entity_type_admin_page; |
|
| 455 | + |
|
| 456 | + /** |
|
| 457 | + * The controller for the entity type settings admin page |
|
| 458 | + * |
|
| 459 | + * @since 3.11.0 |
|
| 460 | + * @access private |
|
| 461 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 462 | + */ |
|
| 463 | + private $entity_type_settings_admin_page; |
|
| 464 | + |
|
| 465 | + /** |
|
| 466 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 467 | + * |
|
| 468 | + * @since 3.11.0 |
|
| 469 | + * @access protected |
|
| 470 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 471 | + */ |
|
| 472 | + protected $related_entities_cloud_widget; |
|
| 473 | + |
|
| 474 | + /** |
|
| 475 | + * {@link Wordlift}'s singleton instance. |
|
| 476 | + * |
|
| 477 | + * @since 3.11.2 |
|
| 478 | + * |
|
| 479 | + * @since 3.11.2 |
|
| 480 | + * @access private |
|
| 481 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 482 | + */ |
|
| 483 | + private static $instance; |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * Define the core functionality of the plugin. |
|
| 487 | + * |
|
| 488 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 489 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 490 | + * the public-facing side of the site. |
|
| 491 | + * |
|
| 492 | + * @since 1.0.0 |
|
| 493 | + */ |
|
| 494 | + public function __construct() { |
|
| 495 | + |
|
| 496 | + $this->plugin_name = 'wordlift'; |
|
| 497 | + $this->version = '3.13.3'; |
|
| 498 | + $this->load_dependencies(); |
|
| 499 | + $this->set_locale(); |
|
| 500 | + $this->define_admin_hooks(); |
|
| 501 | + $this->define_public_hooks(); |
|
| 502 | + |
|
| 503 | + self::$instance = $this; |
|
| 504 | + |
|
| 505 | + } |
|
| 506 | + |
|
| 507 | + /** |
|
| 508 | + * Get the singleton instance. |
|
| 509 | + * |
|
| 510 | + * @since 3.11.2 |
|
| 511 | + * |
|
| 512 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 513 | + */ |
|
| 514 | + public static function get_instance() { |
|
| 515 | + |
|
| 516 | + return self::$instance; |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + /** |
|
| 520 | + * Load the required dependencies for this plugin. |
|
| 521 | + * |
|
| 522 | + * Include the following files that make up the plugin: |
|
| 523 | + * |
|
| 524 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 525 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 526 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 527 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 528 | + * |
|
| 529 | + * Create an instance of the loader which will be used to register the hooks |
|
| 530 | + * with WordPress. |
|
| 531 | + * |
|
| 532 | + * @since 1.0.0 |
|
| 533 | + * @access private |
|
| 534 | + */ |
|
| 535 | + private function load_dependencies() { |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * The class responsible for orchestrating the actions and filters of the |
|
| 539 | + * core plugin. |
|
| 540 | + */ |
|
| 541 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 542 | + |
|
| 543 | + /** |
|
| 544 | + * The class responsible for defining internationalization functionality |
|
| 545 | + * of the plugin. |
|
| 546 | + */ |
|
| 547 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 548 | + |
|
| 549 | + /** |
|
| 550 | + * WordLift's supported languages. |
|
| 551 | + */ |
|
| 552 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 553 | + |
|
| 554 | + /** |
|
| 555 | + * Provide support functions to sanitize data. |
|
| 556 | + */ |
|
| 557 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 558 | + |
|
| 559 | + /** |
|
| 560 | + * The Redirect service. |
|
| 561 | + */ |
|
| 562 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 563 | + |
|
| 564 | + /** |
|
| 565 | + * The Log service. |
|
| 566 | + */ |
|
| 567 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 568 | + |
|
| 569 | + /** |
|
| 570 | + * The configuration service. |
|
| 571 | + */ |
|
| 572 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 573 | + |
|
| 574 | + /** |
|
| 575 | + * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 576 | + */ |
|
| 577 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 578 | + |
|
| 579 | + /** |
|
| 580 | + * The entity type service (i.e. the schema type). |
|
| 581 | + */ |
|
| 582 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 583 | + |
|
| 584 | + /** |
|
| 585 | + * The entity link service. |
|
| 586 | + */ |
|
| 587 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 588 | + |
|
| 589 | + /** |
|
| 590 | + * The Query builder. |
|
| 591 | + */ |
|
| 592 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 593 | + |
|
| 594 | + /** |
|
| 595 | + * The Schema service. |
|
| 596 | + */ |
|
| 597 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 598 | + |
|
| 599 | + /** |
|
| 600 | + * The schema:url property service. |
|
| 601 | + */ |
|
| 602 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 603 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 604 | + |
|
| 605 | + /** |
|
| 606 | + * The UI service. |
|
| 607 | + */ |
|
| 608 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 609 | + |
|
| 610 | + /** |
|
| 611 | + * The Thumbnail service. |
|
| 612 | + */ |
|
| 613 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 614 | + |
|
| 615 | + /** |
|
| 616 | + * The Entity Types Taxonomy service. |
|
| 617 | + */ |
|
| 618 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 619 | + |
|
| 620 | + /** |
|
| 621 | + * The Entity service. |
|
| 622 | + */ |
|
| 623 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 624 | + |
|
| 625 | + // Add the entity rating service. |
|
| 626 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 627 | + |
|
| 628 | + /** |
|
| 629 | + * The User service. |
|
| 630 | + */ |
|
| 631 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 632 | + |
|
| 633 | + /** |
|
| 634 | + * The Timeline service. |
|
| 635 | + */ |
|
| 636 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The Topic Taxonomy service. |
|
| 640 | + */ |
|
| 641 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 642 | + |
|
| 643 | + /** |
|
| 644 | + * The SPARQL service. |
|
| 645 | + */ |
|
| 646 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 647 | + |
|
| 648 | + /** |
|
| 649 | + * The WordLift import service. |
|
| 650 | + */ |
|
| 651 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 652 | + |
|
| 653 | + /** |
|
| 654 | + * The WordLift URI service. |
|
| 655 | + */ |
|
| 656 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 657 | + |
|
| 658 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 659 | + |
|
| 660 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 661 | + |
|
| 662 | + /** |
|
| 663 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 664 | + */ |
|
| 665 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 666 | + |
|
| 667 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 668 | + |
|
| 669 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 670 | + |
|
| 671 | + /** |
|
| 672 | + * Load the converters. |
|
| 673 | + */ |
|
| 674 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 675 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 676 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 677 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 678 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 679 | + |
|
| 680 | + /** |
|
| 681 | + * Load the content filter. |
|
| 682 | + */ |
|
| 683 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 684 | + |
|
| 685 | + /* |
|
| 686 | 686 | * Load the excerpt helper. |
| 687 | 687 | */ |
| 688 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 689 | - |
|
| 690 | - /** |
|
| 691 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 692 | - * |
|
| 693 | - * @since 3.8.0 |
|
| 694 | - */ |
|
| 695 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 696 | - |
|
| 697 | - // The Publisher Service and the AJAX adapter. |
|
| 698 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 699 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 700 | - |
|
| 701 | - /** |
|
| 702 | - * Load the WordLift key validation service. |
|
| 703 | - */ |
|
| 704 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 705 | - |
|
| 706 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 707 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 708 | - |
|
| 709 | - // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
|
| 710 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 711 | - |
|
| 712 | - /** Adapters. */ |
|
| 713 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 714 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 715 | - |
|
| 716 | - /** Async Tasks. */ |
|
| 717 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php'; |
|
| 718 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 722 | - */ |
|
| 723 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 724 | - |
|
| 725 | - /** |
|
| 726 | - * The class to customize the entity list admin page. |
|
| 727 | - */ |
|
| 728 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 729 | - |
|
| 730 | - /** |
|
| 731 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 732 | - */ |
|
| 733 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 734 | - |
|
| 735 | - /** |
|
| 736 | - * The Notice service. |
|
| 737 | - */ |
|
| 738 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 739 | - |
|
| 740 | - /** |
|
| 741 | - * The PrimaShop adapter. |
|
| 742 | - */ |
|
| 743 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 744 | - |
|
| 745 | - /** |
|
| 746 | - * The WordLift Dashboard service. |
|
| 747 | - */ |
|
| 748 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 749 | - |
|
| 750 | - /** |
|
| 751 | - * The admin 'Install wizard' page. |
|
| 752 | - */ |
|
| 753 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 688 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 689 | + |
|
| 690 | + /** |
|
| 691 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 692 | + * |
|
| 693 | + * @since 3.8.0 |
|
| 694 | + */ |
|
| 695 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 696 | + |
|
| 697 | + // The Publisher Service and the AJAX adapter. |
|
| 698 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 699 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 700 | + |
|
| 701 | + /** |
|
| 702 | + * Load the WordLift key validation service. |
|
| 703 | + */ |
|
| 704 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 705 | + |
|
| 706 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 707 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 708 | + |
|
| 709 | + // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
|
| 710 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 711 | + |
|
| 712 | + /** Adapters. */ |
|
| 713 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 714 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 715 | + |
|
| 716 | + /** Async Tasks. */ |
|
| 717 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php'; |
|
| 718 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 722 | + */ |
|
| 723 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 724 | + |
|
| 725 | + /** |
|
| 726 | + * The class to customize the entity list admin page. |
|
| 727 | + */ |
|
| 728 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 729 | + |
|
| 730 | + /** |
|
| 731 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 732 | + */ |
|
| 733 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 734 | + |
|
| 735 | + /** |
|
| 736 | + * The Notice service. |
|
| 737 | + */ |
|
| 738 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 739 | + |
|
| 740 | + /** |
|
| 741 | + * The PrimaShop adapter. |
|
| 742 | + */ |
|
| 743 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 744 | + |
|
| 745 | + /** |
|
| 746 | + * The WordLift Dashboard service. |
|
| 747 | + */ |
|
| 748 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 749 | + |
|
| 750 | + /** |
|
| 751 | + * The admin 'Install wizard' page. |
|
| 752 | + */ |
|
| 753 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 754 | + |
|
| 755 | + /** |
|
| 756 | + * The WordLift entity type list admin page controller. |
|
| 757 | + */ |
|
| 758 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 759 | + |
|
| 760 | + /** |
|
| 761 | + * The WordLift entity type settings admin page controller. |
|
| 762 | + */ |
|
| 763 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 764 | + |
|
| 765 | + /** |
|
| 766 | + * The admin 'Download Your Data' page. |
|
| 767 | + */ |
|
| 768 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * The admin 'Download Your Data' page. |
|
| 772 | + */ |
|
| 773 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 774 | + |
|
| 775 | + /** |
|
| 776 | + * The admin 'WordLift Settings' page. |
|
| 777 | + */ |
|
| 778 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 779 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 780 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 781 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 782 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 783 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 784 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 785 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 786 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 787 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 788 | + |
|
| 789 | + /** Admin Pages */ |
|
| 790 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 791 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 792 | + |
|
| 793 | + /** |
|
| 794 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 795 | + * side of the site. |
|
| 796 | + */ |
|
| 797 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 798 | + |
|
| 799 | + /** |
|
| 800 | + * The shortcode abstract class. |
|
| 801 | + */ |
|
| 802 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 803 | + |
|
| 804 | + /** |
|
| 805 | + * The Timeline shortcode. |
|
| 806 | + */ |
|
| 807 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 808 | + |
|
| 809 | + /** |
|
| 810 | + * The Navigator shortcode. |
|
| 811 | + */ |
|
| 812 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 813 | + |
|
| 814 | + /** |
|
| 815 | + * The chord shortcode. |
|
| 816 | + */ |
|
| 817 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 818 | + |
|
| 819 | + /** |
|
| 820 | + * The geomap shortcode. |
|
| 821 | + */ |
|
| 822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 823 | + |
|
| 824 | + /** |
|
| 825 | + * The entity cloud shortcode. |
|
| 826 | + */ |
|
| 827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 754 | 828 | |
| 755 | - /** |
|
| 756 | - * The WordLift entity type list admin page controller. |
|
| 757 | - */ |
|
| 758 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 759 | - |
|
| 760 | - /** |
|
| 761 | - * The WordLift entity type settings admin page controller. |
|
| 762 | - */ |
|
| 763 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 764 | - |
|
| 765 | - /** |
|
| 766 | - * The admin 'Download Your Data' page. |
|
| 767 | - */ |
|
| 768 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * The admin 'Download Your Data' page. |
|
| 772 | - */ |
|
| 773 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 774 | - |
|
| 775 | - /** |
|
| 776 | - * The admin 'WordLift Settings' page. |
|
| 777 | - */ |
|
| 778 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 779 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 780 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 781 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 782 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 783 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 785 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 786 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 787 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 788 | - |
|
| 789 | - /** Admin Pages */ |
|
| 790 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 791 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 792 | - |
|
| 793 | - /** |
|
| 794 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 795 | - * side of the site. |
|
| 796 | - */ |
|
| 797 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 798 | - |
|
| 799 | - /** |
|
| 800 | - * The shortcode abstract class. |
|
| 801 | - */ |
|
| 802 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 803 | - |
|
| 804 | - /** |
|
| 805 | - * The Timeline shortcode. |
|
| 806 | - */ |
|
| 807 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 808 | - |
|
| 809 | - /** |
|
| 810 | - * The Navigator shortcode. |
|
| 811 | - */ |
|
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 829 | + /** |
|
| 830 | + * The ShareThis service. |
|
| 831 | + */ |
|
| 832 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 813 | 833 | |
| 814 | - /** |
|
| 815 | - * The chord shortcode. |
|
| 816 | - */ |
|
| 817 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 834 | + /** |
|
| 835 | + * The SEO service. |
|
| 836 | + */ |
|
| 837 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 818 | 838 | |
| 819 | - /** |
|
| 820 | - * The geomap shortcode. |
|
| 821 | - */ |
|
| 822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 823 | - |
|
| 824 | - /** |
|
| 825 | - * The entity cloud shortcode. |
|
| 826 | - */ |
|
| 827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 828 | - |
|
| 829 | - /** |
|
| 830 | - * The ShareThis service. |
|
| 831 | - */ |
|
| 832 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 833 | - |
|
| 834 | - /** |
|
| 835 | - * The SEO service. |
|
| 836 | - */ |
|
| 837 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 838 | - |
|
| 839 | - /** |
|
| 840 | - * The AMP service. |
|
| 841 | - */ |
|
| 842 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 839 | + /** |
|
| 840 | + * The AMP service. |
|
| 841 | + */ |
|
| 842 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 843 | 843 | |
| 844 | - /** Widgets */ |
|
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 846 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 844 | + /** Widgets */ |
|
| 845 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 846 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 847 | 847 | |
| 848 | - $this->loader = new Wordlift_Loader(); |
|
| 848 | + $this->loader = new Wordlift_Loader(); |
|
| 849 | 849 | |
| 850 | - // Instantiate a global logger. |
|
| 851 | - global $wl_logger; |
|
| 852 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 850 | + // Instantiate a global logger. |
|
| 851 | + global $wl_logger; |
|
| 852 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 853 | 853 | |
| 854 | - // Create the configuration service. |
|
| 855 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 854 | + // Create the configuration service. |
|
| 855 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 856 | 856 | |
| 857 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 858 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 857 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 858 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 859 | 859 | |
| 860 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 861 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 860 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 861 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 862 | 862 | |
| 863 | - // Create an instance of the UI service. |
|
| 864 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 863 | + // Create an instance of the UI service. |
|
| 864 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 865 | 865 | |
| 866 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 867 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 866 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 867 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 868 | 868 | |
| 869 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 869 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 870 | 870 | |
| 871 | - // Create an instance of the Schema service. |
|
| 872 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 873 | - $this->schema_service = new Wordlift_Schema_Service(); |
|
| 871 | + // Create an instance of the Schema service. |
|
| 872 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 873 | + $this->schema_service = new Wordlift_Schema_Service(); |
|
| 874 | 874 | |
| 875 | - // Create an instance of the Notice service. |
|
| 876 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 875 | + // Create an instance of the Notice service. |
|
| 876 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 877 | 877 | |
| 878 | - // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 879 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 878 | + // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 879 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 880 | 880 | |
| 881 | - // Create an instance of the User service. |
|
| 882 | - $this->user_service = new Wordlift_User_Service(); |
|
| 881 | + // Create an instance of the User service. |
|
| 882 | + $this->user_service = new Wordlift_User_Service(); |
|
| 883 | 883 | |
| 884 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 885 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 884 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 885 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 886 | 886 | |
| 887 | - // Create a new instance of the Redirect service. |
|
| 888 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 887 | + // Create a new instance of the Redirect service. |
|
| 888 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 889 | 889 | |
| 890 | - // Initialize the shortcodes. |
|
| 891 | - new Wordlift_Navigator_Shortcode(); |
|
| 892 | - new Wordlift_Chord_Shortcode(); |
|
| 893 | - new Wordlift_Geomap_Shortcode(); |
|
| 894 | - new Wordlift_Timeline_Shortcode(); |
|
| 895 | - new Wordlift_Related_Entities_Cloud_Shortcode(); |
|
| 890 | + // Initialize the shortcodes. |
|
| 891 | + new Wordlift_Navigator_Shortcode(); |
|
| 892 | + new Wordlift_Chord_Shortcode(); |
|
| 893 | + new Wordlift_Geomap_Shortcode(); |
|
| 894 | + new Wordlift_Timeline_Shortcode(); |
|
| 895 | + new Wordlift_Related_Entities_Cloud_Shortcode(); |
|
| 896 | 896 | |
| 897 | - // Initialize the SEO service. |
|
| 898 | - new Wordlift_Seo_Service(); |
|
| 897 | + // Initialize the SEO service. |
|
| 898 | + new Wordlift_Seo_Service(); |
|
| 899 | 899 | |
| 900 | - // Initialize the AMP service. |
|
| 901 | - new Wordlift_AMP_Service(); |
|
| 900 | + // Initialize the AMP service. |
|
| 901 | + new Wordlift_AMP_Service(); |
|
| 902 | 902 | |
| 903 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 903 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 904 | 904 | |
| 905 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 905 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 906 | 906 | |
| 907 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 908 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 907 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 908 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 909 | 909 | |
| 910 | - // Create an instance of the PrimaShop adapter. |
|
| 911 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 910 | + // Create an instance of the PrimaShop adapter. |
|
| 911 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 912 | 912 | |
| 913 | - // Create an import service instance to hook later to WP's import function. |
|
| 914 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 913 | + // Create an import service instance to hook later to WP's import function. |
|
| 914 | + $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 915 | 915 | |
| 916 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 916 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 917 | 917 | |
| 918 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 919 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 918 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 919 | + $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 920 | 920 | |
| 921 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 921 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 922 | 922 | |
| 923 | - // Create the entity rating service. |
|
| 924 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 923 | + // Create the entity rating service. |
|
| 924 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 925 | 925 | |
| 926 | - // Create entity list customization (wp-admin/edit.php) |
|
| 927 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 926 | + // Create entity list customization (wp-admin/edit.php) |
|
| 927 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 928 | 928 | |
| 929 | - // Create a new instance of the Redirect service. |
|
| 930 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 929 | + // Create a new instance of the Redirect service. |
|
| 930 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 931 | 931 | |
| 932 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 933 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 932 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 933 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 934 | 934 | |
| 935 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 935 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 936 | 936 | |
| 937 | - // Instantiate the JSON-LD service. |
|
| 938 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 939 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter ); |
|
| 940 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 941 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 942 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter ); |
|
| 937 | + // Instantiate the JSON-LD service. |
|
| 938 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 939 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter ); |
|
| 940 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 941 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 942 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter ); |
|
| 943 | 943 | |
| 944 | - // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 945 | - $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 944 | + // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 945 | + $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 946 | 946 | |
| 947 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 948 | - $publisher_service = new Wordlift_Publisher_Service(); |
|
| 949 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 947 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 948 | + $publisher_service = new Wordlift_Publisher_Service(); |
|
| 949 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 950 | 950 | |
| 951 | - /** Adapters. */ |
|
| 952 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 951 | + /** Adapters. */ |
|
| 952 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 953 | 953 | |
| 954 | - /** Async Tasks. */ |
|
| 955 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 954 | + /** Async Tasks. */ |
|
| 955 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 956 | 956 | |
| 957 | - /** WordPress Admin UI. */ |
|
| 957 | + /** WordPress Admin UI. */ |
|
| 958 | 958 | |
| 959 | - // UI elements. |
|
| 960 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 961 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 962 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 963 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 964 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 965 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 959 | + // UI elements. |
|
| 960 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 961 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 962 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 963 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 964 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 965 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 966 | 966 | |
| 967 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 968 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 969 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 967 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 968 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 969 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 970 | 970 | |
| 971 | - // Pages. |
|
| 972 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 971 | + // Pages. |
|
| 972 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 973 | 973 | |
| 974 | - // create an instance of the entity type list admin page controller. |
|
| 975 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 974 | + // create an instance of the entity type list admin page controller. |
|
| 975 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 976 | 976 | |
| 977 | - // create an instance of the entity type etting admin page controller. |
|
| 978 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 977 | + // create an instance of the entity type etting admin page controller. |
|
| 978 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 979 | 979 | |
| 980 | - /** Widgets */ |
|
| 981 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 980 | + /** Widgets */ |
|
| 981 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 982 | 982 | |
| 983 | - //** WordPress Admin */ |
|
| 984 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 985 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 983 | + //** WordPress Admin */ |
|
| 984 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 985 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 986 | 986 | |
| 987 | - // Create an instance of the install wizard. |
|
| 988 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 987 | + // Create an instance of the install wizard. |
|
| 988 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 989 | 989 | |
| 990 | - // Create an instance of the content filter service. |
|
| 991 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service ); |
|
| 990 | + // Create an instance of the content filter service. |
|
| 991 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service ); |
|
| 992 | 992 | |
| 993 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 993 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 994 | 994 | |
| 995 | - $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
|
| 995 | + $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
|
| 996 | 996 | |
| 997 | - // Load the debug service if WP is in debug mode. |
|
| 998 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1000 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1001 | - } |
|
| 997 | + // Load the debug service if WP is in debug mode. |
|
| 998 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1000 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1001 | + } |
|
| 1002 | 1002 | |
| 1003 | - } |
|
| 1003 | + } |
|
| 1004 | 1004 | |
| 1005 | - /** |
|
| 1006 | - * Define the locale for this plugin for internationalization. |
|
| 1007 | - * |
|
| 1008 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1009 | - * with WordPress. |
|
| 1010 | - * |
|
| 1011 | - * @since 1.0.0 |
|
| 1012 | - * @access private |
|
| 1013 | - */ |
|
| 1014 | - private function set_locale() { |
|
| 1005 | + /** |
|
| 1006 | + * Define the locale for this plugin for internationalization. |
|
| 1007 | + * |
|
| 1008 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1009 | + * with WordPress. |
|
| 1010 | + * |
|
| 1011 | + * @since 1.0.0 |
|
| 1012 | + * @access private |
|
| 1013 | + */ |
|
| 1014 | + private function set_locale() { |
|
| 1015 | 1015 | |
| 1016 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1017 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1016 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1017 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1018 | 1018 | |
| 1019 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1019 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1020 | 1020 | |
| 1021 | - } |
|
| 1021 | + } |
|
| 1022 | 1022 | |
| 1023 | - /** |
|
| 1024 | - * Register all of the hooks related to the admin area functionality |
|
| 1025 | - * of the plugin. |
|
| 1026 | - * |
|
| 1027 | - * @since 1.0.0 |
|
| 1028 | - * @access private |
|
| 1029 | - */ |
|
| 1030 | - private function define_admin_hooks() { |
|
| 1023 | + /** |
|
| 1024 | + * Register all of the hooks related to the admin area functionality |
|
| 1025 | + * of the plugin. |
|
| 1026 | + * |
|
| 1027 | + * @since 1.0.0 |
|
| 1028 | + * @access private |
|
| 1029 | + */ |
|
| 1030 | + private function define_admin_hooks() { |
|
| 1031 | 1031 | |
| 1032 | - $plugin_admin = new Wordlift_Admin( |
|
| 1033 | - $this->get_plugin_name(), |
|
| 1034 | - $this->get_version(), |
|
| 1035 | - $this->configuration_service, |
|
| 1036 | - $this->notice_service |
|
| 1037 | - ); |
|
| 1032 | + $plugin_admin = new Wordlift_Admin( |
|
| 1033 | + $this->get_plugin_name(), |
|
| 1034 | + $this->get_version(), |
|
| 1035 | + $this->configuration_service, |
|
| 1036 | + $this->notice_service |
|
| 1037 | + ); |
|
| 1038 | 1038 | |
| 1039 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1040 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1039 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1040 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1041 | 1041 | |
| 1042 | - // Hook the init action to the Topic Taxonomy service. |
|
| 1043 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1042 | + // Hook the init action to the Topic Taxonomy service. |
|
| 1043 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1044 | 1044 | |
| 1045 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1046 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1045 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1046 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1047 | 1047 | |
| 1048 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1049 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1048 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1049 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1050 | 1050 | |
| 1051 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1052 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1051 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1052 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1053 | 1053 | |
| 1054 | - // Hook posts inserts (or updates) to the user service. |
|
| 1055 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1054 | + // Hook posts inserts (or updates) to the user service. |
|
| 1055 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1056 | 1056 | |
| 1057 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1058 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1057 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1058 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1059 | 1059 | |
| 1060 | - // Register custom allowed redirect hosts. |
|
| 1061 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1062 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1063 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1064 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1065 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1066 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1067 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1060 | + // Register custom allowed redirect hosts. |
|
| 1061 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1062 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1063 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1064 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1065 | + $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1066 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1067 | + $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1068 | 1068 | |
| 1069 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1070 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1071 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1072 | - $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1069 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1070 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1071 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1072 | + $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1073 | 1073 | |
| 1074 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1075 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1074 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1075 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1076 | 1076 | |
| 1077 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1078 | - // Add custom columns |
|
| 1079 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1080 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1081 | - // Add 4W selection |
|
| 1082 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1083 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1077 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1078 | + // Add custom columns |
|
| 1079 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1080 | + $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1081 | + // Add 4W selection |
|
| 1082 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1083 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1084 | 1084 | |
| 1085 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1085 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1086 | 1086 | |
| 1087 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1088 | - // entities. |
|
| 1089 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1087 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1088 | + // entities. |
|
| 1089 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1090 | 1090 | |
| 1091 | - // Filter imported post meta. |
|
| 1092 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1091 | + // Filter imported post meta. |
|
| 1092 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1093 | 1093 | |
| 1094 | - // Notify the import service when an import starts and ends. |
|
| 1095 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1096 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1097 | - |
|
| 1098 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1099 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1094 | + // Notify the import service when an import starts and ends. |
|
| 1095 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1096 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1097 | + |
|
| 1098 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1099 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1100 | 1100 | |
| 1101 | - // Hook the menu to the Download Your Data page. |
|
| 1102 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1103 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1104 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1105 | - |
|
| 1106 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1107 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1101 | + // Hook the menu to the Download Your Data page. |
|
| 1102 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1103 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1104 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1105 | + |
|
| 1106 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1107 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1108 | 1108 | |
| 1109 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1110 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1109 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1110 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1111 | 1111 | |
| 1112 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1113 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1112 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1113 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1114 | 1114 | |
| 1115 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1116 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1115 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1116 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1117 | 1117 | |
| 1118 | - // Hook the admin_init to the settings page. |
|
| 1119 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1118 | + // Hook the admin_init to the settings page. |
|
| 1119 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1120 | 1120 | |
| 1121 | - // Hook the menu creation on the general wordlift menu creation |
|
| 1122 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1121 | + // Hook the menu creation on the general wordlift menu creation |
|
| 1122 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1123 | 1123 | |
| 1124 | - // Hook key update. |
|
| 1125 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1126 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1124 | + // Hook key update. |
|
| 1125 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1126 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1127 | 1127 | |
| 1128 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1129 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1128 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1129 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1130 | 1130 | |
| 1131 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1132 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1131 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1132 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1133 | 1133 | |
| 1134 | - // Hook row actions for the entity type list admin. |
|
| 1135 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1134 | + // Hook row actions for the entity type list admin. |
|
| 1135 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1136 | 1136 | |
| 1137 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1138 | - // page on wordpress versions before 4.7. |
|
| 1139 | - global $wp_version; |
|
| 1140 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1141 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1142 | - } |
|
| 1137 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1138 | + // page on wordpress versions before 4.7. |
|
| 1139 | + global $wp_version; |
|
| 1140 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1141 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1142 | + } |
|
| 1143 | 1143 | |
| 1144 | - /** Adapters. */ |
|
| 1145 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1144 | + /** Adapters. */ |
|
| 1145 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1146 | 1146 | |
| 1147 | - $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1147 | + $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1148 | 1148 | |
| 1149 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1150 | - if ( is_multisite() ) { |
|
| 1151 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1152 | - } |
|
| 1153 | - } |
|
| 1149 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1150 | + if ( is_multisite() ) { |
|
| 1151 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1152 | + } |
|
| 1153 | + } |
|
| 1154 | 1154 | |
| 1155 | - /** |
|
| 1156 | - * Register all of the hooks related to the public-facing functionality |
|
| 1157 | - * of the plugin. |
|
| 1158 | - * |
|
| 1159 | - * @since 1.0.0 |
|
| 1160 | - * @access private |
|
| 1161 | - */ |
|
| 1162 | - private function define_public_hooks() { |
|
| 1155 | + /** |
|
| 1156 | + * Register all of the hooks related to the public-facing functionality |
|
| 1157 | + * of the plugin. |
|
| 1158 | + * |
|
| 1159 | + * @since 1.0.0 |
|
| 1160 | + * @access private |
|
| 1161 | + */ |
|
| 1162 | + private function define_public_hooks() { |
|
| 1163 | 1163 | |
| 1164 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1164 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1165 | 1165 | |
| 1166 | - // Register the entity post type. |
|
| 1167 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1166 | + // Register the entity post type. |
|
| 1167 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1168 | 1168 | |
| 1169 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1170 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1171 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1172 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1173 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1169 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1170 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1171 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1172 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1173 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1174 | 1174 | |
| 1175 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1176 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1175 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1176 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1177 | 1177 | |
| 1178 | - // Hook the content filter service to add entity links. |
|
| 1179 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1178 | + // Hook the content filter service to add entity links. |
|
| 1179 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1180 | 1180 | |
| 1181 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1182 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1181 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1182 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1183 | 1183 | |
| 1184 | - // Hook the ShareThis service. |
|
| 1185 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1186 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1184 | + // Hook the ShareThis service. |
|
| 1185 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1186 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1187 | 1187 | |
| 1188 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1189 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1188 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1189 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1190 | 1190 | |
| 1191 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1192 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1193 | - // to categories. |
|
| 1194 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1191 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1192 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1193 | + // to categories. |
|
| 1194 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1195 | 1195 | |
| 1196 | - /* |
|
| 1196 | + /* |
|
| 1197 | 1197 | * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service` |
| 1198 | 1198 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1199 | 1199 | * order of start time. |
| 1200 | 1200 | */ |
| 1201 | - $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1202 | - |
|
| 1203 | - $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1204 | - |
|
| 1205 | - } |
|
| 1206 | - |
|
| 1207 | - /** |
|
| 1208 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1209 | - * |
|
| 1210 | - * @since 1.0.0 |
|
| 1211 | - */ |
|
| 1212 | - public function run() { |
|
| 1213 | - $this->loader->run(); |
|
| 1214 | - } |
|
| 1215 | - |
|
| 1216 | - /** |
|
| 1217 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1218 | - * WordPress and to define internationalization functionality. |
|
| 1219 | - * |
|
| 1220 | - * @since 1.0.0 |
|
| 1221 | - * @return string The name of the plugin. |
|
| 1222 | - */ |
|
| 1223 | - public function get_plugin_name() { |
|
| 1224 | - return $this->plugin_name; |
|
| 1225 | - } |
|
| 1226 | - |
|
| 1227 | - /** |
|
| 1228 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1229 | - * |
|
| 1230 | - * @since 1.0.0 |
|
| 1231 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1232 | - */ |
|
| 1233 | - public function get_loader() { |
|
| 1234 | - return $this->loader; |
|
| 1235 | - } |
|
| 1236 | - |
|
| 1237 | - /** |
|
| 1238 | - * Retrieve the version number of the plugin. |
|
| 1239 | - * |
|
| 1240 | - * @since 1.0.0 |
|
| 1241 | - * @return string The version number of the plugin. |
|
| 1242 | - */ |
|
| 1243 | - public function get_version() { |
|
| 1244 | - return $this->version; |
|
| 1245 | - } |
|
| 1201 | + $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1202 | + |
|
| 1203 | + $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1204 | + |
|
| 1205 | + } |
|
| 1206 | + |
|
| 1207 | + /** |
|
| 1208 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1209 | + * |
|
| 1210 | + * @since 1.0.0 |
|
| 1211 | + */ |
|
| 1212 | + public function run() { |
|
| 1213 | + $this->loader->run(); |
|
| 1214 | + } |
|
| 1215 | + |
|
| 1216 | + /** |
|
| 1217 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1218 | + * WordPress and to define internationalization functionality. |
|
| 1219 | + * |
|
| 1220 | + * @since 1.0.0 |
|
| 1221 | + * @return string The name of the plugin. |
|
| 1222 | + */ |
|
| 1223 | + public function get_plugin_name() { |
|
| 1224 | + return $this->plugin_name; |
|
| 1225 | + } |
|
| 1226 | + |
|
| 1227 | + /** |
|
| 1228 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1229 | + * |
|
| 1230 | + * @since 1.0.0 |
|
| 1231 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1232 | + */ |
|
| 1233 | + public function get_loader() { |
|
| 1234 | + return $this->loader; |
|
| 1235 | + } |
|
| 1236 | + |
|
| 1237 | + /** |
|
| 1238 | + * Retrieve the version number of the plugin. |
|
| 1239 | + * |
|
| 1240 | + * @since 1.0.0 |
|
| 1241 | + * @return string The version number of the plugin. |
|
| 1242 | + */ |
|
| 1243 | + public function get_version() { |
|
| 1244 | + return $this->version; |
|
| 1245 | + } |
|
| 1246 | 1246 | |
| 1247 | 1247 | } |