@@ -4,42 +4,42 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Single_Call_Task implements Task { |
| 6 | 6 | |
| 7 | - private $callable; |
|
| 8 | - |
|
| 9 | - /** |
|
| 10 | - * @var string|null |
|
| 11 | - */ |
|
| 12 | - private $id; |
|
| 13 | - |
|
| 14 | - public function __construct( $callable, $id = null ) { |
|
| 15 | - $this->callable = $callable; |
|
| 16 | - $this->id = $id; |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - public function get_id() { |
|
| 20 | - return isset( $this->id ) ? $this->id : hash( 'sha256', get_class( $this ) ); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function starting() { |
|
| 24 | - return 1; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @param $value mixed The incoming value. |
|
| 29 | - * @param $args { |
|
| 30 | - * |
|
| 31 | - * @type int $offset The index of the current item. |
|
| 32 | - * @type int $count The total number of items as provided by the `starting` function. |
|
| 33 | - * @type int $batch_size The number of items to process within this call. |
|
| 34 | - * } |
|
| 35 | - * |
|
| 36 | - * @return void |
|
| 37 | - */ |
|
| 38 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
| 39 | - public function tick( $value, $args ) { |
|
| 40 | - |
|
| 41 | - call_user_func( $this->callable, 1 ); |
|
| 42 | - |
|
| 43 | - } |
|
| 7 | + private $callable; |
|
| 8 | + |
|
| 9 | + /** |
|
| 10 | + * @var string|null |
|
| 11 | + */ |
|
| 12 | + private $id; |
|
| 13 | + |
|
| 14 | + public function __construct( $callable, $id = null ) { |
|
| 15 | + $this->callable = $callable; |
|
| 16 | + $this->id = $id; |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + public function get_id() { |
|
| 20 | + return isset( $this->id ) ? $this->id : hash( 'sha256', get_class( $this ) ); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function starting() { |
|
| 24 | + return 1; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @param $value mixed The incoming value. |
|
| 29 | + * @param $args { |
|
| 30 | + * |
|
| 31 | + * @type int $offset The index of the current item. |
|
| 32 | + * @type int $count The total number of items as provided by the `starting` function. |
|
| 33 | + * @type int $batch_size The number of items to process within this call. |
|
| 34 | + * } |
|
| 35 | + * |
|
| 36 | + * @return void |
|
| 37 | + */ |
|
| 38 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
| 39 | + public function tick( $value, $args ) { |
|
| 40 | + |
|
| 41 | + call_user_func( $this->callable, 1 ); |
|
| 42 | + |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | 45 | } |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | private $id; |
| 13 | 13 | |
| 14 | - public function __construct( $callable, $id = null ) { |
|
| 14 | + public function __construct($callable, $id = null) { |
|
| 15 | 15 | $this->callable = $callable; |
| 16 | 16 | $this->id = $id; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function get_id() { |
| 20 | - return isset( $this->id ) ? $this->id : hash( 'sha256', get_class( $this ) ); |
|
| 20 | + return isset($this->id) ? $this->id : hash('sha256', get_class($this)); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function starting() { |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @return void |
| 37 | 37 | */ |
| 38 | 38 | // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 39 | - public function tick( $value, $args ) { |
|
| 39 | + public function tick($value, $args) { |
|
| 40 | 40 | |
| 41 | - call_user_func( $this->callable, 1 ); |
|
| 41 | + call_user_func($this->callable, 1); |
|
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | |
@@ -15,67 +15,67 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Wordlift_Website_Jsonld_Converter extends Wordlift_Post_To_Jsonld_Converter { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Convert the home/blog page to a JSON-LD array. |
|
| 20 | - * |
|
| 21 | - * @return array A JSON-LD array. |
|
| 22 | - * @since 3.14.0 |
|
| 23 | - */ |
|
| 24 | - public function create_schema() { |
|
| 18 | + /** |
|
| 19 | + * Convert the home/blog page to a JSON-LD array. |
|
| 20 | + * |
|
| 21 | + * @return array A JSON-LD array. |
|
| 22 | + * @since 3.14.0 |
|
| 23 | + */ |
|
| 24 | + public function create_schema() { |
|
| 25 | 25 | |
| 26 | - // Create new jsonld. |
|
| 27 | - $home_url = home_url( '/' ); |
|
| 26 | + // Create new jsonld. |
|
| 27 | + $home_url = home_url( '/' ); |
|
| 28 | 28 | |
| 29 | - $jsonld = array( |
|
| 30 | - '@context' => 'http://schema.org', |
|
| 31 | - '@type' => 'WebSite', |
|
| 32 | - '@id' => "$home_url#website", |
|
| 33 | - 'name' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), |
|
| 34 | - 'alternateName' => Wordlift_Configuration_Service::get_instance()->get_alternate_name(), |
|
| 35 | - 'url' => $home_url, |
|
| 36 | - ); |
|
| 29 | + $jsonld = array( |
|
| 30 | + '@context' => 'http://schema.org', |
|
| 31 | + '@type' => 'WebSite', |
|
| 32 | + '@id' => "$home_url#website", |
|
| 33 | + 'name' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), |
|
| 34 | + 'alternateName' => Wordlift_Configuration_Service::get_instance()->get_alternate_name(), |
|
| 35 | + 'url' => $home_url, |
|
| 36 | + ); |
|
| 37 | 37 | |
| 38 | - // Add publisher information. |
|
| 39 | - $this->set_publisher( $jsonld ); |
|
| 38 | + // Add publisher information. |
|
| 39 | + $this->set_publisher( $jsonld ); |
|
| 40 | 40 | |
| 41 | - // Add search action. |
|
| 42 | - $this->set_search_action( $jsonld ); |
|
| 41 | + // Add search action. |
|
| 42 | + $this->set_search_action( $jsonld ); |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Call the `wl_website_jsonld` filter. |
|
| 46 | - * |
|
| 47 | - * @param array $jsonld The JSON-LD structure. |
|
| 48 | - * |
|
| 49 | - * @since 3.14.0 |
|
| 50 | - * |
|
| 51 | - * @api |
|
| 52 | - */ |
|
| 53 | - return apply_filters( 'wl_website_jsonld', $jsonld ); |
|
| 54 | - } |
|
| 44 | + /** |
|
| 45 | + * Call the `wl_website_jsonld` filter. |
|
| 46 | + * |
|
| 47 | + * @param array $jsonld The JSON-LD structure. |
|
| 48 | + * |
|
| 49 | + * @since 3.14.0 |
|
| 50 | + * |
|
| 51 | + * @api |
|
| 52 | + */ |
|
| 53 | + return apply_filters( 'wl_website_jsonld', $jsonld ); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Add SearchAction part to the schema |
|
| 58 | - * |
|
| 59 | - * @param array $params The parameters array. |
|
| 60 | - * |
|
| 61 | - * @since 3.14.0 |
|
| 62 | - */ |
|
| 63 | - private function set_search_action( &$params ) { |
|
| 64 | - /** |
|
| 65 | - * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL. |
|
| 66 | - * |
|
| 67 | - * @since 3.14.0 |
|
| 68 | - * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
|
| 69 | - */ |
|
| 70 | - $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 56 | + /** |
|
| 57 | + * Add SearchAction part to the schema |
|
| 58 | + * |
|
| 59 | + * @param array $params The parameters array. |
|
| 60 | + * |
|
| 61 | + * @since 3.14.0 |
|
| 62 | + */ |
|
| 63 | + private function set_search_action( &$params ) { |
|
| 64 | + /** |
|
| 65 | + * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL. |
|
| 66 | + * |
|
| 67 | + * @since 3.14.0 |
|
| 68 | + * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
|
| 69 | + */ |
|
| 70 | + $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 71 | 71 | |
| 72 | - // Add search action |
|
| 73 | - $params['potentialAction'] = array( |
|
| 74 | - '@type' => 'SearchAction', |
|
| 75 | - 'target' => $search_url, |
|
| 76 | - 'query-input' => 'required name=search_term_string', |
|
| 77 | - ); |
|
| 72 | + // Add search action |
|
| 73 | + $params['potentialAction'] = array( |
|
| 74 | + '@type' => 'SearchAction', |
|
| 75 | + 'target' => $search_url, |
|
| 76 | + 'query-input' => 'required name=search_term_string', |
|
| 77 | + ); |
|
| 78 | 78 | |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | } |
@@ -24,22 +24,22 @@ discard block |
||
| 24 | 24 | public function create_schema() { |
| 25 | 25 | |
| 26 | 26 | // Create new jsonld. |
| 27 | - $home_url = home_url( '/' ); |
|
| 27 | + $home_url = home_url('/'); |
|
| 28 | 28 | |
| 29 | 29 | $jsonld = array( |
| 30 | 30 | '@context' => 'http://schema.org', |
| 31 | 31 | '@type' => 'WebSite', |
| 32 | 32 | '@id' => "$home_url#website", |
| 33 | - 'name' => html_entity_decode( get_bloginfo( 'name' ), ENT_QUOTES ), |
|
| 33 | + 'name' => html_entity_decode(get_bloginfo('name'), ENT_QUOTES), |
|
| 34 | 34 | 'alternateName' => Wordlift_Configuration_Service::get_instance()->get_alternate_name(), |
| 35 | 35 | 'url' => $home_url, |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | // Add publisher information. |
| 39 | - $this->set_publisher( $jsonld ); |
|
| 39 | + $this->set_publisher($jsonld); |
|
| 40 | 40 | |
| 41 | 41 | // Add search action. |
| 42 | - $this->set_search_action( $jsonld ); |
|
| 42 | + $this->set_search_action($jsonld); |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Call the `wl_website_jsonld` filter. |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @api |
| 52 | 52 | */ |
| 53 | - return apply_filters( 'wl_website_jsonld', $jsonld ); |
|
| 53 | + return apply_filters('wl_website_jsonld', $jsonld); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @since 3.14.0 |
| 62 | 62 | */ |
| 63 | - private function set_search_action( &$params ) { |
|
| 63 | + private function set_search_action(&$params) { |
|
| 64 | 64 | /** |
| 65 | 65 | * Filter: 'wl_jsonld_search_url' - Allows filtering of the search URL. |
| 66 | 66 | * |
| 67 | 67 | * @since 3.14.0 |
| 68 | 68 | * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
| 69 | 69 | */ |
| 70 | - $search_url = apply_filters( 'wl_jsonld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 70 | + $search_url = apply_filters('wl_jsonld_search_url', home_url('/').'?s={search_term_string}'); |
|
| 71 | 71 | |
| 72 | 72 | // Add search action |
| 73 | 73 | $params['potentialAction'] = array( |
@@ -18,175 +18,175 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Install_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * A {@link Wordlift_Log_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.18.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $log; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * The singleton instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.18.0 |
|
| 34 | - * @access private |
|
| 35 | - * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private static $instance; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var array |
|
| 41 | - */ |
|
| 42 | - private $installs; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Wordlift_Install_Service constructor. |
|
| 46 | - * |
|
| 47 | - * @since 3.18.0 |
|
| 48 | - */ |
|
| 49 | - public function __construct() { |
|
| 50 | - |
|
| 51 | - /** Installs. */ |
|
| 52 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
| 53 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
| 71 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
| 72 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
| 73 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
| 74 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-0.php'; |
|
| 75 | - |
|
| 76 | - // Get the install services. |
|
| 77 | - $this->installs = array( |
|
| 78 | - new Wordlift_Install_1_0_0(), |
|
| 79 | - new Wordlift_Install_3_10_0(), |
|
| 80 | - new Wordlift_Install_3_12_0(), |
|
| 81 | - new Wordlift_Install_3_14_0(), |
|
| 82 | - new Wordlift_Install_3_15_0(), |
|
| 83 | - new Wordlift_Install_3_18_0(), |
|
| 84 | - new Wordlift_Install_3_18_3(), |
|
| 85 | - new Wordlift_Install_3_19_5(), |
|
| 86 | - new Wordlift_Install_3_20_0(), |
|
| 87 | - |
|
| 88 | - /* |
|
| 21 | + /** |
|
| 22 | + * A {@link Wordlift_Log_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.18.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $log; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * The singleton instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.18.0 |
|
| 34 | + * @access private |
|
| 35 | + * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private static $instance; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var array |
|
| 41 | + */ |
|
| 42 | + private $installs; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Wordlift_Install_Service constructor. |
|
| 46 | + * |
|
| 47 | + * @since 3.18.0 |
|
| 48 | + */ |
|
| 49 | + public function __construct() { |
|
| 50 | + |
|
| 51 | + /** Installs. */ |
|
| 52 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
| 53 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
| 71 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
| 72 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
| 73 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
| 74 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-0.php'; |
|
| 75 | + |
|
| 76 | + // Get the install services. |
|
| 77 | + $this->installs = array( |
|
| 78 | + new Wordlift_Install_1_0_0(), |
|
| 79 | + new Wordlift_Install_3_10_0(), |
|
| 80 | + new Wordlift_Install_3_12_0(), |
|
| 81 | + new Wordlift_Install_3_14_0(), |
|
| 82 | + new Wordlift_Install_3_15_0(), |
|
| 83 | + new Wordlift_Install_3_18_0(), |
|
| 84 | + new Wordlift_Install_3_18_3(), |
|
| 85 | + new Wordlift_Install_3_19_5(), |
|
| 86 | + new Wordlift_Install_3_20_0(), |
|
| 87 | + |
|
| 88 | + /* |
|
| 89 | 89 | * This should be enabled with #852. |
| 90 | 90 | */ |
| 91 | - new Wordlift_Install_Package_Type(), |
|
| 92 | - new Wordlift_Install_3_23_4(), |
|
| 93 | - new Wordlift_Install_3_24_2(), |
|
| 94 | - new Wordlift_Install_3_25_0(), |
|
| 95 | - new Wordlift_Install_3_27_0(), |
|
| 96 | - new Wordlift_Install_3_27_1(), |
|
| 97 | - new Wordlift_Install_3_28_0(), |
|
| 98 | - // Add column to represent term |
|
| 99 | - new Wordlift_Install_3_32_0(), |
|
| 100 | - // Add the entities table. |
|
| 101 | - new Wordlift_Install_3_33_9(), |
|
| 102 | - // When woocommerce extension installed, acf4so should be installed automatically. |
|
| 103 | - new Wordlift_Install_3_36_0(), |
|
| 104 | - |
|
| 105 | - new Wordlift_Install_3_38_5(), |
|
| 106 | - new Wordlift_Install_3_39_0(), |
|
| 107 | - ); |
|
| 108 | - self::$instance = $this; |
|
| 109 | - |
|
| 110 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 111 | - |
|
| 112 | - add_action( 'init', array( $this, 'install' ) ); |
|
| 113 | - |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Get the singleton instance. |
|
| 118 | - * |
|
| 119 | - * @since 3.18.0 |
|
| 120 | - */ |
|
| 121 | - public static function get_instance() { |
|
| 122 | - |
|
| 123 | - return self::$instance; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Loop thought all versions and install the updates. |
|
| 128 | - * |
|
| 129 | - * @return void |
|
| 130 | - * @since 3.18.0 |
|
| 131 | - * |
|
| 132 | - * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
| 133 | - */ |
|
| 134 | - public function install() { |
|
| 135 | - |
|
| 136 | - $version = null; |
|
| 137 | - |
|
| 138 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 139 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 140 | - /** @var Wordlift_Install $install */ |
|
| 141 | - foreach ( $this->installs as $install ) { |
|
| 142 | - // Get the install version. |
|
| 143 | - $version = $install->get_version(); |
|
| 144 | - |
|
| 145 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 146 | - || $install->must_install() ) { |
|
| 147 | - $class_name = get_class( $install ); |
|
| 148 | - |
|
| 149 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 150 | - // Install version. |
|
| 151 | - $install->install(); |
|
| 152 | - |
|
| 153 | - $this->log->info( "$class_name installed." ); |
|
| 154 | - |
|
| 155 | - // Bump the version. |
|
| 156 | - update_option( 'wl_db_version', $version ); |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
| 161 | - @delete_transient( '_wl_installing' ); |
|
| 162 | - |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - private function install_required() { |
|
| 168 | - |
|
| 169 | - /** @var Wordlift_Install $install */ |
|
| 170 | - foreach ( $this->installs as $install ) { |
|
| 171 | - // Get the install version. |
|
| 172 | - $version = $install->get_version(); |
|
| 173 | - |
|
| 174 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 175 | - || $install->must_install() ) { |
|
| 176 | - return true; |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - return false; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Retrieve the current db version. |
|
| 185 | - * |
|
| 186 | - * @return type |
|
| 187 | - */ |
|
| 188 | - private function get_current_version() { |
|
| 189 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
| 190 | - } |
|
| 91 | + new Wordlift_Install_Package_Type(), |
|
| 92 | + new Wordlift_Install_3_23_4(), |
|
| 93 | + new Wordlift_Install_3_24_2(), |
|
| 94 | + new Wordlift_Install_3_25_0(), |
|
| 95 | + new Wordlift_Install_3_27_0(), |
|
| 96 | + new Wordlift_Install_3_27_1(), |
|
| 97 | + new Wordlift_Install_3_28_0(), |
|
| 98 | + // Add column to represent term |
|
| 99 | + new Wordlift_Install_3_32_0(), |
|
| 100 | + // Add the entities table. |
|
| 101 | + new Wordlift_Install_3_33_9(), |
|
| 102 | + // When woocommerce extension installed, acf4so should be installed automatically. |
|
| 103 | + new Wordlift_Install_3_36_0(), |
|
| 104 | + |
|
| 105 | + new Wordlift_Install_3_38_5(), |
|
| 106 | + new Wordlift_Install_3_39_0(), |
|
| 107 | + ); |
|
| 108 | + self::$instance = $this; |
|
| 109 | + |
|
| 110 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 111 | + |
|
| 112 | + add_action( 'init', array( $this, 'install' ) ); |
|
| 113 | + |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Get the singleton instance. |
|
| 118 | + * |
|
| 119 | + * @since 3.18.0 |
|
| 120 | + */ |
|
| 121 | + public static function get_instance() { |
|
| 122 | + |
|
| 123 | + return self::$instance; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Loop thought all versions and install the updates. |
|
| 128 | + * |
|
| 129 | + * @return void |
|
| 130 | + * @since 3.18.0 |
|
| 131 | + * |
|
| 132 | + * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
| 133 | + */ |
|
| 134 | + public function install() { |
|
| 135 | + |
|
| 136 | + $version = null; |
|
| 137 | + |
|
| 138 | + if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 139 | + set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 140 | + /** @var Wordlift_Install $install */ |
|
| 141 | + foreach ( $this->installs as $install ) { |
|
| 142 | + // Get the install version. |
|
| 143 | + $version = $install->get_version(); |
|
| 144 | + |
|
| 145 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 146 | + || $install->must_install() ) { |
|
| 147 | + $class_name = get_class( $install ); |
|
| 148 | + |
|
| 149 | + $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 150 | + // Install version. |
|
| 151 | + $install->install(); |
|
| 152 | + |
|
| 153 | + $this->log->info( "$class_name installed." ); |
|
| 154 | + |
|
| 155 | + // Bump the version. |
|
| 156 | + update_option( 'wl_db_version', $version ); |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
|
| 161 | + @delete_transient( '_wl_installing' ); |
|
| 162 | + |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + private function install_required() { |
|
| 168 | + |
|
| 169 | + /** @var Wordlift_Install $install */ |
|
| 170 | + foreach ( $this->installs as $install ) { |
|
| 171 | + // Get the install version. |
|
| 172 | + $version = $install->get_version(); |
|
| 173 | + |
|
| 174 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 175 | + || $install->must_install() ) { |
|
| 176 | + return true; |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + return false; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Retrieve the current db version. |
|
| 185 | + * |
|
| 186 | + * @return type |
|
| 187 | + */ |
|
| 188 | + private function get_current_version() { |
|
| 189 | + return get_option( 'wl_db_version', '0.0.0' ); |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | 192 | } |
@@ -49,29 +49,29 @@ discard block |
||
| 49 | 49 | public function __construct() { |
| 50 | 50 | |
| 51 | 51 | /** Installs. */ |
| 52 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install.php'; |
|
| 53 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-32-0.php'; |
|
| 71 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-33-9.php'; |
|
| 72 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-36-0.php'; |
|
| 73 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-38-5.php'; |
|
| 74 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-39-0.php'; |
|
| 52 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install.php'; |
|
| 53 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-package-type.php'; |
|
| 66 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-32-0.php'; |
|
| 71 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-33-9.php'; |
|
| 72 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-36-0.php'; |
|
| 73 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-38-5.php'; |
|
| 74 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-3-39-0.php'; |
|
| 75 | 75 | |
| 76 | 76 | // Get the install services. |
| 77 | 77 | $this->installs = array( |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | ); |
| 108 | 108 | self::$instance = $this; |
| 109 | 109 | |
| 110 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 110 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 111 | 111 | |
| 112 | - add_action( 'init', array( $this, 'install' ) ); |
|
| 112 | + add_action('init', array($this, 'install')); |
|
| 113 | 113 | |
| 114 | 114 | } |
| 115 | 115 | |
@@ -135,30 +135,30 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $version = null; |
| 137 | 137 | |
| 138 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 139 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 138 | + if ($this->install_required() && false === get_transient('_wl_installing')) { |
|
| 139 | + set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS); |
|
| 140 | 140 | /** @var Wordlift_Install $install */ |
| 141 | - foreach ( $this->installs as $install ) { |
|
| 141 | + foreach ($this->installs as $install) { |
|
| 142 | 142 | // Get the install version. |
| 143 | 143 | $version = $install->get_version(); |
| 144 | 144 | |
| 145 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 146 | - || $install->must_install() ) { |
|
| 147 | - $class_name = get_class( $install ); |
|
| 145 | + if (version_compare($version, $this->get_current_version(), '>') |
|
| 146 | + || $install->must_install()) { |
|
| 147 | + $class_name = get_class($install); |
|
| 148 | 148 | |
| 149 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 149 | + $this->log->info("Current version is {$this->get_current_version()}, installing $class_name..."); |
|
| 150 | 150 | // Install version. |
| 151 | 151 | $install->install(); |
| 152 | 152 | |
| 153 | - $this->log->info( "$class_name installed." ); |
|
| 153 | + $this->log->info("$class_name installed."); |
|
| 154 | 154 | |
| 155 | 155 | // Bump the version. |
| 156 | - update_option( 'wl_db_version', $version ); |
|
| 156 | + update_option('wl_db_version', $version); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged |
| 161 | - @delete_transient( '_wl_installing' ); |
|
| 161 | + @delete_transient('_wl_installing'); |
|
| 162 | 162 | |
| 163 | 163 | } |
| 164 | 164 | |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | private function install_required() { |
| 168 | 168 | |
| 169 | 169 | /** @var Wordlift_Install $install */ |
| 170 | - foreach ( $this->installs as $install ) { |
|
| 170 | + foreach ($this->installs as $install) { |
|
| 171 | 171 | // Get the install version. |
| 172 | 172 | $version = $install->get_version(); |
| 173 | 173 | |
| 174 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 175 | - || $install->must_install() ) { |
|
| 174 | + if (version_compare($version, $this->get_current_version(), '>') |
|
| 175 | + || $install->must_install()) { |
|
| 176 | 176 | return true; |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | * @return type |
| 187 | 187 | */ |
| 188 | 188 | private function get_current_version() { |
| 189 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
| 189 | + return get_option('wl_db_version', '0.0.0'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | } |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class Wordlift_Install_3_39_0 extends Wordlift_Install { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * {@inheritdoc} |
|
| 12 | - */ |
|
| 13 | - protected static $version = '3.39.0'; |
|
| 10 | + /** |
|
| 11 | + * {@inheritdoc} |
|
| 12 | + */ |
|
| 13 | + protected static $version = '3.39.0'; |
|
| 14 | 14 | |
| 15 | - public function install() { |
|
| 15 | + public function install() { |
|
| 16 | 16 | |
| 17 | - Wordlift_Configuration_Service::get_instance()->set_alternate_name( |
|
| 18 | - wp_strip_all_tags( get_bloginfo( 'description' ) ) |
|
| 19 | - ); |
|
| 17 | + Wordlift_Configuration_Service::get_instance()->set_alternate_name( |
|
| 18 | + wp_strip_all_tags( get_bloginfo( 'description' ) ) |
|
| 19 | + ); |
|
| 20 | 20 | |
| 21 | - } |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | 23 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function install() { |
| 16 | 16 | |
| 17 | 17 | Wordlift_Configuration_Service::get_instance()->set_alternate_name( |
| 18 | - wp_strip_all_tags( get_bloginfo( 'description' ) ) |
|
| 18 | + wp_strip_all_tags(get_bloginfo('description')) |
|
| 19 | 19 | ); |
| 20 | 20 | |
| 21 | 21 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | use Wordlift\Api\Default_Api_Service; |
| 14 | 14 | |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | - exit; |
|
| 16 | + exit; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -23,768 +23,768 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | class Wordlift_Configuration_Service { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * The entity base path option name. |
|
| 28 | - * |
|
| 29 | - * @since 3.6.0 |
|
| 30 | - */ |
|
| 31 | - const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * The skip wizard (admin installation wizard) option name. |
|
| 35 | - * |
|
| 36 | - * @since 3.9.0 |
|
| 37 | - */ |
|
| 38 | - const SKIP_WIZARD = 'wl_skip_wizard'; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * WordLift's key option name. |
|
| 42 | - * |
|
| 43 | - * @since 3.9.0 |
|
| 44 | - */ |
|
| 45 | - const KEY = 'key'; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * WordLift's configured language option name. |
|
| 49 | - * |
|
| 50 | - * @since 3.9.0 |
|
| 51 | - */ |
|
| 52 | - const LANGUAGE = 'site_language'; |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * WordLift's configured country code. |
|
| 56 | - * |
|
| 57 | - * @since 3.18.0 |
|
| 58 | - */ |
|
| 59 | - const COUNTRY_CODE = 'country_code'; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * The alternateName option name. |
|
| 63 | - * |
|
| 64 | - * @since 3.38.6 |
|
| 65 | - */ |
|
| 66 | - const ALTERNATE_NAME = 'wl-alternate-name'; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * The publisher entity post ID option name. |
|
| 70 | - * |
|
| 71 | - * @since 3.9.0 |
|
| 72 | - */ |
|
| 73 | - const PUBLISHER_ID = 'publisher_id'; |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * The dataset URI option name |
|
| 77 | - * |
|
| 78 | - * @since 3.10.0 |
|
| 79 | - */ |
|
| 80 | - const DATASET_URI = 'redlink_dataset_uri'; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * The link by default option name. |
|
| 84 | - * |
|
| 85 | - * @since 3.11.0 |
|
| 86 | - */ |
|
| 87 | - const LINK_BY_DEFAULT = 'link_by_default'; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * The analytics enable option. |
|
| 91 | - * |
|
| 92 | - * @since 3.21.0 |
|
| 93 | - */ |
|
| 94 | - const ANALYTICS_ENABLE = 'analytics_enable'; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The analytics entity uri dimension option. |
|
| 98 | - * |
|
| 99 | - * @since 3.21.0 |
|
| 100 | - */ |
|
| 101 | - const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * The analytics entity type dimension option. |
|
| 105 | - * |
|
| 106 | - * @since 3.21.0 |
|
| 107 | - */ |
|
| 108 | - const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * The user preferences about sharing data option. |
|
| 112 | - * |
|
| 113 | - * @since 3.19.0 |
|
| 114 | - */ |
|
| 115 | - const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * The package type configuration key. |
|
| 119 | - * |
|
| 120 | - * @since 3.20.0 |
|
| 121 | - */ |
|
| 122 | - const PACKAGE_TYPE = 'package_type'; |
|
| 123 | - /** |
|
| 124 | - * The dataset ids connected to the current key |
|
| 125 | - * |
|
| 126 | - * @since 3.38.5 |
|
| 127 | - */ |
|
| 128 | - const NETWORK_DATASET_IDS = 'network_dataset_ids'; |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * The {@link Wordlift_Log_Service} instance. |
|
| 132 | - * |
|
| 133 | - * @since 3.16.0 |
|
| 134 | - * |
|
| 135 | - * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
| 136 | - */ |
|
| 137 | - private $log; |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Create a Wordlift_Configuration_Service's instance. |
|
| 141 | - * |
|
| 142 | - * @since 3.6.0 |
|
| 143 | - */ |
|
| 144 | - protected function __construct() { |
|
| 145 | - |
|
| 146 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 147 | - |
|
| 148 | - // Sync some configuration properties when key is validated. |
|
| 149 | - add_action( 'wl_key_validation_response', array( $this, 'sync' ) ); |
|
| 150 | - |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * @param $response \Wordlift\Api\Response |
|
| 155 | - * |
|
| 156 | - * @return void |
|
| 157 | - */ |
|
| 158 | - public function sync( $response ) { |
|
| 159 | - if ( ! $response->is_success() ) { |
|
| 160 | - return; |
|
| 161 | - } |
|
| 162 | - $data = json_decode( $response->get_body(), true ); |
|
| 163 | - if ( ! is_array( $data ) || ! array_key_exists( 'networkDatasetId', $data ) ) { |
|
| 164 | - return; |
|
| 165 | - } |
|
| 166 | - $this->set_network_dataset_ids( $data['networkDatasetId'] ); |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * The Wordlift_Configuration_Service's singleton instance. |
|
| 171 | - * |
|
| 172 | - * @since 3.6.0 |
|
| 173 | - * |
|
| 174 | - * @access private |
|
| 175 | - * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
| 176 | - */ |
|
| 177 | - private static $instance = null; |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * Get the singleton instance. |
|
| 181 | - * |
|
| 182 | - * @return \Wordlift_Configuration_Service |
|
| 183 | - * @since 3.6.0 |
|
| 184 | - */ |
|
| 185 | - public static function get_instance() { |
|
| 186 | - |
|
| 187 | - if ( ! isset( self::$instance ) ) { |
|
| 188 | - self::$instance = new self(); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - return self::$instance; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Get a configuration given the option name and a key. The option value is |
|
| 196 | - * expected to be an array. |
|
| 197 | - * |
|
| 198 | - * @param string $option The option name. |
|
| 199 | - * @param string $key A key in the option value array. |
|
| 200 | - * @param string $default The default value in case the key is not found (by default an empty string). |
|
| 201 | - * |
|
| 202 | - * @return mixed The configuration value or the default value if not found. |
|
| 203 | - * @since 3.6.0 |
|
| 204 | - */ |
|
| 205 | - private function get( $option, $key, $default = '' ) { |
|
| 206 | - |
|
| 207 | - $options = get_option( $option, array() ); |
|
| 208 | - |
|
| 209 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * Set a configuration parameter. |
|
| 214 | - * |
|
| 215 | - * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
| 216 | - * @param string $key The value key. |
|
| 217 | - * @param mixed $value The value. |
|
| 218 | - * |
|
| 219 | - * @since 3.9.0 |
|
| 220 | - */ |
|
| 221 | - private function set( $option, $key, $value ) { |
|
| 222 | - |
|
| 223 | - $values = get_option( $option ); |
|
| 224 | - $values = isset( $values ) ? $values : array(); |
|
| 225 | - $values[ $key ] = $value; |
|
| 226 | - update_option( $option, $values ); |
|
| 227 | - |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * Get the entity base path, by default 'entity'. |
|
| 232 | - * |
|
| 233 | - * @return string The entity base path. |
|
| 234 | - * @since 3.6.0 |
|
| 235 | - */ |
|
| 236 | - public function get_entity_base_path() { |
|
| 237 | - |
|
| 238 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * Get the entity base path. |
|
| 243 | - * |
|
| 244 | - * @param string $value The entity base path. |
|
| 245 | - * |
|
| 246 | - * @since 3.9.0 |
|
| 247 | - */ |
|
| 248 | - public function set_entity_base_path( $value ) { |
|
| 249 | - |
|
| 250 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
| 251 | - |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - /** |
|
| 255 | - * Whether the installation skip wizard should be skipped. |
|
| 256 | - * |
|
| 257 | - * @return bool True if it should be skipped otherwise false. |
|
| 258 | - * @since 3.9.0 |
|
| 259 | - */ |
|
| 260 | - public function is_skip_wizard() { |
|
| 261 | - |
|
| 262 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - /** |
|
| 266 | - * Set the skip wizard parameter. |
|
| 267 | - * |
|
| 268 | - * @param bool $value True to skip the wizard. We expect a boolean value. |
|
| 269 | - * |
|
| 270 | - * @since 3.9.0 |
|
| 271 | - */ |
|
| 272 | - public function set_skip_wizard( $value ) { |
|
| 273 | - |
|
| 274 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
| 275 | - |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Get WordLift's key. |
|
| 280 | - * |
|
| 281 | - * @return string WordLift's key or an empty string if not set. |
|
| 282 | - * @since 3.9.0 |
|
| 283 | - */ |
|
| 284 | - public function get_key() { |
|
| 285 | - |
|
| 286 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * Set WordLift's key. |
|
| 291 | - * |
|
| 292 | - * @param string $value WordLift's key. |
|
| 293 | - * |
|
| 294 | - * @since 3.9.0 |
|
| 295 | - */ |
|
| 296 | - public function set_key( $value ) { |
|
| 297 | - |
|
| 298 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - /** |
|
| 302 | - * Get WordLift's configured language, by default 'en'. |
|
| 303 | - * |
|
| 304 | - * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
| 305 | - * |
|
| 306 | - * @return string WordLift's configured language code ('en' by default). |
|
| 307 | - * @since 3.9.0 |
|
| 308 | - */ |
|
| 309 | - public function get_language_code() { |
|
| 310 | - |
|
| 311 | - $language = get_locale(); |
|
| 312 | - if ( ! $language ) { |
|
| 313 | - return 'en'; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - return substr( $language, 0, 2 ); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - /** |
|
| 320 | - * @param string $value WordLift's language code. |
|
| 321 | - * |
|
| 322 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1466 |
|
| 323 | - * |
|
| 324 | - * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
| 325 | - * |
|
| 326 | - * @deprecated As of 3.32.7 this below method has no effect on setting the language, we use the |
|
| 327 | - * language code form WordPress directly. |
|
| 328 | - * |
|
| 329 | - * @since 3.9.0 |
|
| 330 | - */ |
|
| 331 | - public function set_language_code( $value ) { |
|
| 332 | - |
|
| 333 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
| 334 | - |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - /** |
|
| 338 | - * Set the user preferences about sharing diagnostic with us. |
|
| 339 | - * |
|
| 340 | - * @param string $value The user preferences(yes/no). |
|
| 341 | - * |
|
| 342 | - * @since 3.19.0 |
|
| 343 | - */ |
|
| 344 | - public function set_diagnostic_preferences( $value ) { |
|
| 345 | - |
|
| 346 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
| 347 | - |
|
| 348 | - } |
|
| 349 | - |
|
| 350 | - /** |
|
| 351 | - * Get the user preferences about sharing diagnostic. |
|
| 352 | - * |
|
| 353 | - * @since 3.19.0 |
|
| 354 | - */ |
|
| 355 | - public function get_diagnostic_preferences() { |
|
| 356 | - |
|
| 357 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
| 358 | - } |
|
| 359 | - |
|
| 360 | - /** |
|
| 361 | - * Get WordLift's configured country code, by default 'us'. |
|
| 362 | - * |
|
| 363 | - * @return string WordLift's configured country code ('us' by default). |
|
| 364 | - * @since 3.18.0 |
|
| 365 | - */ |
|
| 366 | - public function get_country_code() { |
|
| 367 | - |
|
| 368 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * Set WordLift's country code. |
|
| 373 | - * |
|
| 374 | - * @param string $value WordLift's country code. |
|
| 375 | - * |
|
| 376 | - * @since 3.18.0 |
|
| 377 | - */ |
|
| 378 | - public function set_country_code( $value ) { |
|
| 379 | - |
|
| 380 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
| 381 | - |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * Get the alternateName. |
|
| 386 | - * |
|
| 387 | - * Website markup alternateName |
|
| 388 | - * |
|
| 389 | - * @return string|NULL alternateName or NULL if not set. |
|
| 390 | - * @since 3.38.6 |
|
| 391 | - */ |
|
| 392 | - public function get_alternate_name() { |
|
| 393 | - return $this->get( 'wl_general_settings', self::ALTERNATE_NAME ); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - /** |
|
| 397 | - * Set the alternateName. |
|
| 398 | - * |
|
| 399 | - * @param int $value The alternateName value. |
|
| 400 | - * |
|
| 401 | - * @since 3.38.6 |
|
| 402 | - */ |
|
| 403 | - public function set_alternate_name( $value ) { |
|
| 404 | - |
|
| 405 | - $this->set( 'wl_general_settings', self::ALTERNATE_NAME, wp_strip_all_tags( $value ) ); |
|
| 406 | - |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - /** |
|
| 410 | - * Get the publisher entity post id. |
|
| 411 | - * |
|
| 412 | - * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
| 413 | - * Article markup. |
|
| 414 | - * |
|
| 415 | - * @return int|NULL The publisher entity post id or NULL if not set. |
|
| 416 | - * @since 3.9.0 |
|
| 417 | - */ |
|
| 418 | - public function get_publisher_id() { |
|
| 419 | - |
|
| 420 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - /** |
|
| 424 | - * Set the publisher entity post id. |
|
| 425 | - * |
|
| 426 | - * @param int $value The publisher entity post id. |
|
| 427 | - * |
|
| 428 | - * @since 3.9.0 |
|
| 429 | - */ |
|
| 430 | - public function set_publisher_id( $value ) { |
|
| 431 | - |
|
| 432 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
| 433 | - |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * Get the dataset URI. |
|
| 438 | - * |
|
| 439 | - * @return string The dataset URI or an empty string if not set. |
|
| 440 | - * @since 3.10.0 |
|
| 441 | - * @since 3.27.7 Always return null if `wl_features__enable__dataset` is disabled. |
|
| 442 | - */ |
|
| 443 | - public function get_dataset_uri() { |
|
| 444 | - |
|
| 445 | - if ( apply_filters( 'wl_feature__enable__dataset', true ) ) { |
|
| 446 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
| 447 | - } else { |
|
| 448 | - return null; |
|
| 449 | - } |
|
| 450 | - } |
|
| 451 | - |
|
| 452 | - /** |
|
| 453 | - * Set the dataset URI. |
|
| 454 | - * |
|
| 455 | - * @param string $value The dataset URI. |
|
| 456 | - * |
|
| 457 | - * @since 3.10.0 |
|
| 458 | - */ |
|
| 459 | - public function set_dataset_uri( $value ) { |
|
| 460 | - |
|
| 461 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - /** |
|
| 465 | - * Get the package type. |
|
| 466 | - * |
|
| 467 | - * @return string The package type or an empty string if not set. |
|
| 468 | - * @since 3.20.0 |
|
| 469 | - */ |
|
| 470 | - public function get_package_type() { |
|
| 471 | - |
|
| 472 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
| 473 | - } |
|
| 474 | - |
|
| 475 | - /** |
|
| 476 | - * Set the package type. |
|
| 477 | - * |
|
| 478 | - * @param string $value The package type. |
|
| 479 | - * |
|
| 480 | - * @since 3.20.0 |
|
| 481 | - */ |
|
| 482 | - public function set_package_type( $value ) { |
|
| 483 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - /** |
|
| 487 | - * Intercept the change of the WordLift key in order to set the dataset URI. |
|
| 488 | - * |
|
| 489 | - * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
| 490 | - * store the configuration parameters such as country or language. |
|
| 491 | - * @since 3.11.0 |
|
| 492 | - * |
|
| 493 | - * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
| 494 | - * |
|
| 495 | - * @param array $old_value The old settings. |
|
| 496 | - * @param array $new_value The new settings. |
|
| 497 | - */ |
|
| 498 | - public function update_key( $old_value, $new_value ) { |
|
| 499 | - |
|
| 500 | - // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
| 501 | - // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 502 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 503 | - |
|
| 504 | - // If the key hasn't changed, don't do anything. |
|
| 505 | - // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
| 506 | - // if ( $old_key === $new_key ) { |
|
| 507 | - // return; |
|
| 508 | - // } |
|
| 509 | - |
|
| 510 | - // If the key is empty, empty the dataset URI. |
|
| 511 | - if ( '' === $new_key ) { |
|
| 512 | - $this->set_dataset_uri( '' ); |
|
| 513 | - } |
|
| 514 | - |
|
| 515 | - // make the request to the remote server. |
|
| 516 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 517 | - |
|
| 518 | - do_action( 'wl_key_updated' ); |
|
| 519 | - |
|
| 520 | - } |
|
| 521 | - |
|
| 522 | - /** |
|
| 523 | - * Handle retrieving the dataset uri from the remote server. |
|
| 524 | - * |
|
| 525 | - * If a valid dataset uri is returned it is stored in the appropriate option, |
|
| 526 | - * otherwise the option is set to empty string. |
|
| 527 | - * |
|
| 528 | - * @param string $key The key to be used. |
|
| 529 | - * |
|
| 530 | - * @since 3.12.0 |
|
| 531 | - * |
|
| 532 | - * @since 3.17.0 send the site URL and get the dataset URI. |
|
| 533 | - */ |
|
| 534 | - public function get_remote_dataset_uri( $key ) { |
|
| 535 | - |
|
| 536 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
| 537 | - |
|
| 538 | - if ( empty( $key ) ) { |
|
| 539 | - $this->log->warn( 'Key set to empty value.' ); |
|
| 540 | - |
|
| 541 | - $this->set_dataset_uri( '' ); |
|
| 542 | - $this->set_package_type( null ); |
|
| 543 | - |
|
| 544 | - return; |
|
| 545 | - } |
|
| 546 | - |
|
| 547 | - /** |
|
| 548 | - * Allow 3rd parties to change the site_url. |
|
| 549 | - * |
|
| 550 | - * @param string $site_url The site url. |
|
| 551 | - * |
|
| 552 | - * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
| 553 | - * |
|
| 554 | - * @since 3.20.0 |
|
| 555 | - */ |
|
| 556 | - $home_url = get_option( 'home' ); |
|
| 557 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
| 558 | - |
|
| 559 | - // Build the URL. |
|
| 560 | - $url = '/accounts' |
|
| 561 | - . '?key=' . rawurlencode( $key ) |
|
| 562 | - . '&url=' . rawurlencode( $site_url ) |
|
| 563 | - . '&country=' . $this->get_country_code() |
|
| 564 | - . '&language=' . $this->get_language_code(); |
|
| 565 | - |
|
| 566 | - $api_service = Default_Api_Service::get_instance(); |
|
| 567 | - /** |
|
| 568 | - * @since 3.27.7.1 |
|
| 569 | - * The Key should be passed to headers, otherwise api would return null. |
|
| 570 | - */ |
|
| 571 | - $headers = array( |
|
| 572 | - 'Authorization' => "Key $key", |
|
| 573 | - ); |
|
| 574 | - $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
| 575 | - |
|
| 576 | - // The response is an error. |
|
| 577 | - if ( is_wp_error( $response ) ) { |
|
| 578 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
| 579 | - |
|
| 580 | - $this->set_dataset_uri( '' ); |
|
| 581 | - $this->set_package_type( null ); |
|
| 582 | - |
|
| 583 | - return; |
|
| 584 | - } |
|
| 585 | - |
|
| 586 | - // The response is not OK. |
|
| 587 | - if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
| 588 | - $base_url = $api_service->get_base_url(); |
|
| 589 | - |
|
| 590 | - if ( ! is_array( $response ) ) { |
|
| 591 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
| 592 | - $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
| 593 | - } else { |
|
| 594 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
| 595 | - $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
| 596 | - } |
|
| 597 | - |
|
| 598 | - $this->set_dataset_uri( '' ); |
|
| 599 | - $this->set_package_type( null ); |
|
| 600 | - |
|
| 601 | - return; |
|
| 602 | - } |
|
| 603 | - |
|
| 604 | - /* |
|
| 26 | + /** |
|
| 27 | + * The entity base path option name. |
|
| 28 | + * |
|
| 29 | + * @since 3.6.0 |
|
| 30 | + */ |
|
| 31 | + const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * The skip wizard (admin installation wizard) option name. |
|
| 35 | + * |
|
| 36 | + * @since 3.9.0 |
|
| 37 | + */ |
|
| 38 | + const SKIP_WIZARD = 'wl_skip_wizard'; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * WordLift's key option name. |
|
| 42 | + * |
|
| 43 | + * @since 3.9.0 |
|
| 44 | + */ |
|
| 45 | + const KEY = 'key'; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * WordLift's configured language option name. |
|
| 49 | + * |
|
| 50 | + * @since 3.9.0 |
|
| 51 | + */ |
|
| 52 | + const LANGUAGE = 'site_language'; |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * WordLift's configured country code. |
|
| 56 | + * |
|
| 57 | + * @since 3.18.0 |
|
| 58 | + */ |
|
| 59 | + const COUNTRY_CODE = 'country_code'; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * The alternateName option name. |
|
| 63 | + * |
|
| 64 | + * @since 3.38.6 |
|
| 65 | + */ |
|
| 66 | + const ALTERNATE_NAME = 'wl-alternate-name'; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * The publisher entity post ID option name. |
|
| 70 | + * |
|
| 71 | + * @since 3.9.0 |
|
| 72 | + */ |
|
| 73 | + const PUBLISHER_ID = 'publisher_id'; |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * The dataset URI option name |
|
| 77 | + * |
|
| 78 | + * @since 3.10.0 |
|
| 79 | + */ |
|
| 80 | + const DATASET_URI = 'redlink_dataset_uri'; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * The link by default option name. |
|
| 84 | + * |
|
| 85 | + * @since 3.11.0 |
|
| 86 | + */ |
|
| 87 | + const LINK_BY_DEFAULT = 'link_by_default'; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * The analytics enable option. |
|
| 91 | + * |
|
| 92 | + * @since 3.21.0 |
|
| 93 | + */ |
|
| 94 | + const ANALYTICS_ENABLE = 'analytics_enable'; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The analytics entity uri dimension option. |
|
| 98 | + * |
|
| 99 | + * @since 3.21.0 |
|
| 100 | + */ |
|
| 101 | + const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * The analytics entity type dimension option. |
|
| 105 | + * |
|
| 106 | + * @since 3.21.0 |
|
| 107 | + */ |
|
| 108 | + const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * The user preferences about sharing data option. |
|
| 112 | + * |
|
| 113 | + * @since 3.19.0 |
|
| 114 | + */ |
|
| 115 | + const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * The package type configuration key. |
|
| 119 | + * |
|
| 120 | + * @since 3.20.0 |
|
| 121 | + */ |
|
| 122 | + const PACKAGE_TYPE = 'package_type'; |
|
| 123 | + /** |
|
| 124 | + * The dataset ids connected to the current key |
|
| 125 | + * |
|
| 126 | + * @since 3.38.5 |
|
| 127 | + */ |
|
| 128 | + const NETWORK_DATASET_IDS = 'network_dataset_ids'; |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * The {@link Wordlift_Log_Service} instance. |
|
| 132 | + * |
|
| 133 | + * @since 3.16.0 |
|
| 134 | + * |
|
| 135 | + * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
| 136 | + */ |
|
| 137 | + private $log; |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Create a Wordlift_Configuration_Service's instance. |
|
| 141 | + * |
|
| 142 | + * @since 3.6.0 |
|
| 143 | + */ |
|
| 144 | + protected function __construct() { |
|
| 145 | + |
|
| 146 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 147 | + |
|
| 148 | + // Sync some configuration properties when key is validated. |
|
| 149 | + add_action( 'wl_key_validation_response', array( $this, 'sync' ) ); |
|
| 150 | + |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * @param $response \Wordlift\Api\Response |
|
| 155 | + * |
|
| 156 | + * @return void |
|
| 157 | + */ |
|
| 158 | + public function sync( $response ) { |
|
| 159 | + if ( ! $response->is_success() ) { |
|
| 160 | + return; |
|
| 161 | + } |
|
| 162 | + $data = json_decode( $response->get_body(), true ); |
|
| 163 | + if ( ! is_array( $data ) || ! array_key_exists( 'networkDatasetId', $data ) ) { |
|
| 164 | + return; |
|
| 165 | + } |
|
| 166 | + $this->set_network_dataset_ids( $data['networkDatasetId'] ); |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * The Wordlift_Configuration_Service's singleton instance. |
|
| 171 | + * |
|
| 172 | + * @since 3.6.0 |
|
| 173 | + * |
|
| 174 | + * @access private |
|
| 175 | + * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
| 176 | + */ |
|
| 177 | + private static $instance = null; |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * Get the singleton instance. |
|
| 181 | + * |
|
| 182 | + * @return \Wordlift_Configuration_Service |
|
| 183 | + * @since 3.6.0 |
|
| 184 | + */ |
|
| 185 | + public static function get_instance() { |
|
| 186 | + |
|
| 187 | + if ( ! isset( self::$instance ) ) { |
|
| 188 | + self::$instance = new self(); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + return self::$instance; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Get a configuration given the option name and a key. The option value is |
|
| 196 | + * expected to be an array. |
|
| 197 | + * |
|
| 198 | + * @param string $option The option name. |
|
| 199 | + * @param string $key A key in the option value array. |
|
| 200 | + * @param string $default The default value in case the key is not found (by default an empty string). |
|
| 201 | + * |
|
| 202 | + * @return mixed The configuration value or the default value if not found. |
|
| 203 | + * @since 3.6.0 |
|
| 204 | + */ |
|
| 205 | + private function get( $option, $key, $default = '' ) { |
|
| 206 | + |
|
| 207 | + $options = get_option( $option, array() ); |
|
| 208 | + |
|
| 209 | + return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * Set a configuration parameter. |
|
| 214 | + * |
|
| 215 | + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
| 216 | + * @param string $key The value key. |
|
| 217 | + * @param mixed $value The value. |
|
| 218 | + * |
|
| 219 | + * @since 3.9.0 |
|
| 220 | + */ |
|
| 221 | + private function set( $option, $key, $value ) { |
|
| 222 | + |
|
| 223 | + $values = get_option( $option ); |
|
| 224 | + $values = isset( $values ) ? $values : array(); |
|
| 225 | + $values[ $key ] = $value; |
|
| 226 | + update_option( $option, $values ); |
|
| 227 | + |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * Get the entity base path, by default 'entity'. |
|
| 232 | + * |
|
| 233 | + * @return string The entity base path. |
|
| 234 | + * @since 3.6.0 |
|
| 235 | + */ |
|
| 236 | + public function get_entity_base_path() { |
|
| 237 | + |
|
| 238 | + return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * Get the entity base path. |
|
| 243 | + * |
|
| 244 | + * @param string $value The entity base path. |
|
| 245 | + * |
|
| 246 | + * @since 3.9.0 |
|
| 247 | + */ |
|
| 248 | + public function set_entity_base_path( $value ) { |
|
| 249 | + |
|
| 250 | + $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
| 251 | + |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + /** |
|
| 255 | + * Whether the installation skip wizard should be skipped. |
|
| 256 | + * |
|
| 257 | + * @return bool True if it should be skipped otherwise false. |
|
| 258 | + * @since 3.9.0 |
|
| 259 | + */ |
|
| 260 | + public function is_skip_wizard() { |
|
| 261 | + |
|
| 262 | + return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + /** |
|
| 266 | + * Set the skip wizard parameter. |
|
| 267 | + * |
|
| 268 | + * @param bool $value True to skip the wizard. We expect a boolean value. |
|
| 269 | + * |
|
| 270 | + * @since 3.9.0 |
|
| 271 | + */ |
|
| 272 | + public function set_skip_wizard( $value ) { |
|
| 273 | + |
|
| 274 | + $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
| 275 | + |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Get WordLift's key. |
|
| 280 | + * |
|
| 281 | + * @return string WordLift's key or an empty string if not set. |
|
| 282 | + * @since 3.9.0 |
|
| 283 | + */ |
|
| 284 | + public function get_key() { |
|
| 285 | + |
|
| 286 | + return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * Set WordLift's key. |
|
| 291 | + * |
|
| 292 | + * @param string $value WordLift's key. |
|
| 293 | + * |
|
| 294 | + * @since 3.9.0 |
|
| 295 | + */ |
|
| 296 | + public function set_key( $value ) { |
|
| 297 | + |
|
| 298 | + $this->set( 'wl_general_settings', self::KEY, $value ); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + /** |
|
| 302 | + * Get WordLift's configured language, by default 'en'. |
|
| 303 | + * |
|
| 304 | + * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
| 305 | + * |
|
| 306 | + * @return string WordLift's configured language code ('en' by default). |
|
| 307 | + * @since 3.9.0 |
|
| 308 | + */ |
|
| 309 | + public function get_language_code() { |
|
| 310 | + |
|
| 311 | + $language = get_locale(); |
|
| 312 | + if ( ! $language ) { |
|
| 313 | + return 'en'; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + return substr( $language, 0, 2 ); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + /** |
|
| 320 | + * @param string $value WordLift's language code. |
|
| 321 | + * |
|
| 322 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1466 |
|
| 323 | + * |
|
| 324 | + * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
| 325 | + * |
|
| 326 | + * @deprecated As of 3.32.7 this below method has no effect on setting the language, we use the |
|
| 327 | + * language code form WordPress directly. |
|
| 328 | + * |
|
| 329 | + * @since 3.9.0 |
|
| 330 | + */ |
|
| 331 | + public function set_language_code( $value ) { |
|
| 332 | + |
|
| 333 | + $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
| 334 | + |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + /** |
|
| 338 | + * Set the user preferences about sharing diagnostic with us. |
|
| 339 | + * |
|
| 340 | + * @param string $value The user preferences(yes/no). |
|
| 341 | + * |
|
| 342 | + * @since 3.19.0 |
|
| 343 | + */ |
|
| 344 | + public function set_diagnostic_preferences( $value ) { |
|
| 345 | + |
|
| 346 | + $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
| 347 | + |
|
| 348 | + } |
|
| 349 | + |
|
| 350 | + /** |
|
| 351 | + * Get the user preferences about sharing diagnostic. |
|
| 352 | + * |
|
| 353 | + * @since 3.19.0 |
|
| 354 | + */ |
|
| 355 | + public function get_diagnostic_preferences() { |
|
| 356 | + |
|
| 357 | + return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
| 358 | + } |
|
| 359 | + |
|
| 360 | + /** |
|
| 361 | + * Get WordLift's configured country code, by default 'us'. |
|
| 362 | + * |
|
| 363 | + * @return string WordLift's configured country code ('us' by default). |
|
| 364 | + * @since 3.18.0 |
|
| 365 | + */ |
|
| 366 | + public function get_country_code() { |
|
| 367 | + |
|
| 368 | + return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * Set WordLift's country code. |
|
| 373 | + * |
|
| 374 | + * @param string $value WordLift's country code. |
|
| 375 | + * |
|
| 376 | + * @since 3.18.0 |
|
| 377 | + */ |
|
| 378 | + public function set_country_code( $value ) { |
|
| 379 | + |
|
| 380 | + $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
| 381 | + |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * Get the alternateName. |
|
| 386 | + * |
|
| 387 | + * Website markup alternateName |
|
| 388 | + * |
|
| 389 | + * @return string|NULL alternateName or NULL if not set. |
|
| 390 | + * @since 3.38.6 |
|
| 391 | + */ |
|
| 392 | + public function get_alternate_name() { |
|
| 393 | + return $this->get( 'wl_general_settings', self::ALTERNATE_NAME ); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + /** |
|
| 397 | + * Set the alternateName. |
|
| 398 | + * |
|
| 399 | + * @param int $value The alternateName value. |
|
| 400 | + * |
|
| 401 | + * @since 3.38.6 |
|
| 402 | + */ |
|
| 403 | + public function set_alternate_name( $value ) { |
|
| 404 | + |
|
| 405 | + $this->set( 'wl_general_settings', self::ALTERNATE_NAME, wp_strip_all_tags( $value ) ); |
|
| 406 | + |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + /** |
|
| 410 | + * Get the publisher entity post id. |
|
| 411 | + * |
|
| 412 | + * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
| 413 | + * Article markup. |
|
| 414 | + * |
|
| 415 | + * @return int|NULL The publisher entity post id or NULL if not set. |
|
| 416 | + * @since 3.9.0 |
|
| 417 | + */ |
|
| 418 | + public function get_publisher_id() { |
|
| 419 | + |
|
| 420 | + return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + /** |
|
| 424 | + * Set the publisher entity post id. |
|
| 425 | + * |
|
| 426 | + * @param int $value The publisher entity post id. |
|
| 427 | + * |
|
| 428 | + * @since 3.9.0 |
|
| 429 | + */ |
|
| 430 | + public function set_publisher_id( $value ) { |
|
| 431 | + |
|
| 432 | + $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
| 433 | + |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * Get the dataset URI. |
|
| 438 | + * |
|
| 439 | + * @return string The dataset URI or an empty string if not set. |
|
| 440 | + * @since 3.10.0 |
|
| 441 | + * @since 3.27.7 Always return null if `wl_features__enable__dataset` is disabled. |
|
| 442 | + */ |
|
| 443 | + public function get_dataset_uri() { |
|
| 444 | + |
|
| 445 | + if ( apply_filters( 'wl_feature__enable__dataset', true ) ) { |
|
| 446 | + return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
| 447 | + } else { |
|
| 448 | + return null; |
|
| 449 | + } |
|
| 450 | + } |
|
| 451 | + |
|
| 452 | + /** |
|
| 453 | + * Set the dataset URI. |
|
| 454 | + * |
|
| 455 | + * @param string $value The dataset URI. |
|
| 456 | + * |
|
| 457 | + * @since 3.10.0 |
|
| 458 | + */ |
|
| 459 | + public function set_dataset_uri( $value ) { |
|
| 460 | + |
|
| 461 | + $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + /** |
|
| 465 | + * Get the package type. |
|
| 466 | + * |
|
| 467 | + * @return string The package type or an empty string if not set. |
|
| 468 | + * @since 3.20.0 |
|
| 469 | + */ |
|
| 470 | + public function get_package_type() { |
|
| 471 | + |
|
| 472 | + return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
| 473 | + } |
|
| 474 | + |
|
| 475 | + /** |
|
| 476 | + * Set the package type. |
|
| 477 | + * |
|
| 478 | + * @param string $value The package type. |
|
| 479 | + * |
|
| 480 | + * @since 3.20.0 |
|
| 481 | + */ |
|
| 482 | + public function set_package_type( $value ) { |
|
| 483 | + $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + /** |
|
| 487 | + * Intercept the change of the WordLift key in order to set the dataset URI. |
|
| 488 | + * |
|
| 489 | + * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
| 490 | + * store the configuration parameters such as country or language. |
|
| 491 | + * @since 3.11.0 |
|
| 492 | + * |
|
| 493 | + * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
| 494 | + * |
|
| 495 | + * @param array $old_value The old settings. |
|
| 496 | + * @param array $new_value The new settings. |
|
| 497 | + */ |
|
| 498 | + public function update_key( $old_value, $new_value ) { |
|
| 499 | + |
|
| 500 | + // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
| 501 | + // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 502 | + $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 503 | + |
|
| 504 | + // If the key hasn't changed, don't do anything. |
|
| 505 | + // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
| 506 | + // if ( $old_key === $new_key ) { |
|
| 507 | + // return; |
|
| 508 | + // } |
|
| 509 | + |
|
| 510 | + // If the key is empty, empty the dataset URI. |
|
| 511 | + if ( '' === $new_key ) { |
|
| 512 | + $this->set_dataset_uri( '' ); |
|
| 513 | + } |
|
| 514 | + |
|
| 515 | + // make the request to the remote server. |
|
| 516 | + $this->get_remote_dataset_uri( $new_key ); |
|
| 517 | + |
|
| 518 | + do_action( 'wl_key_updated' ); |
|
| 519 | + |
|
| 520 | + } |
|
| 521 | + |
|
| 522 | + /** |
|
| 523 | + * Handle retrieving the dataset uri from the remote server. |
|
| 524 | + * |
|
| 525 | + * If a valid dataset uri is returned it is stored in the appropriate option, |
|
| 526 | + * otherwise the option is set to empty string. |
|
| 527 | + * |
|
| 528 | + * @param string $key The key to be used. |
|
| 529 | + * |
|
| 530 | + * @since 3.12.0 |
|
| 531 | + * |
|
| 532 | + * @since 3.17.0 send the site URL and get the dataset URI. |
|
| 533 | + */ |
|
| 534 | + public function get_remote_dataset_uri( $key ) { |
|
| 535 | + |
|
| 536 | + $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
| 537 | + |
|
| 538 | + if ( empty( $key ) ) { |
|
| 539 | + $this->log->warn( 'Key set to empty value.' ); |
|
| 540 | + |
|
| 541 | + $this->set_dataset_uri( '' ); |
|
| 542 | + $this->set_package_type( null ); |
|
| 543 | + |
|
| 544 | + return; |
|
| 545 | + } |
|
| 546 | + |
|
| 547 | + /** |
|
| 548 | + * Allow 3rd parties to change the site_url. |
|
| 549 | + * |
|
| 550 | + * @param string $site_url The site url. |
|
| 551 | + * |
|
| 552 | + * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
| 553 | + * |
|
| 554 | + * @since 3.20.0 |
|
| 555 | + */ |
|
| 556 | + $home_url = get_option( 'home' ); |
|
| 557 | + $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
| 558 | + |
|
| 559 | + // Build the URL. |
|
| 560 | + $url = '/accounts' |
|
| 561 | + . '?key=' . rawurlencode( $key ) |
|
| 562 | + . '&url=' . rawurlencode( $site_url ) |
|
| 563 | + . '&country=' . $this->get_country_code() |
|
| 564 | + . '&language=' . $this->get_language_code(); |
|
| 565 | + |
|
| 566 | + $api_service = Default_Api_Service::get_instance(); |
|
| 567 | + /** |
|
| 568 | + * @since 3.27.7.1 |
|
| 569 | + * The Key should be passed to headers, otherwise api would return null. |
|
| 570 | + */ |
|
| 571 | + $headers = array( |
|
| 572 | + 'Authorization' => "Key $key", |
|
| 573 | + ); |
|
| 574 | + $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
| 575 | + |
|
| 576 | + // The response is an error. |
|
| 577 | + if ( is_wp_error( $response ) ) { |
|
| 578 | + $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
| 579 | + |
|
| 580 | + $this->set_dataset_uri( '' ); |
|
| 581 | + $this->set_package_type( null ); |
|
| 582 | + |
|
| 583 | + return; |
|
| 584 | + } |
|
| 585 | + |
|
| 586 | + // The response is not OK. |
|
| 587 | + if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
| 588 | + $base_url = $api_service->get_base_url(); |
|
| 589 | + |
|
| 590 | + if ( ! is_array( $response ) ) { |
|
| 591 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
| 592 | + $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
| 593 | + } else { |
|
| 594 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
| 595 | + $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
| 596 | + } |
|
| 597 | + |
|
| 598 | + $this->set_dataset_uri( '' ); |
|
| 599 | + $this->set_package_type( null ); |
|
| 600 | + |
|
| 601 | + return; |
|
| 602 | + } |
|
| 603 | + |
|
| 604 | + /* |
|
| 605 | 605 | * We also store the package type. |
| 606 | 606 | * |
| 607 | 607 | * @since 3.20.0 |
| 608 | 608 | */ |
| 609 | - $json = json_decode( $response['body'] ); |
|
| 610 | - /** |
|
| 611 | - * @since 3.27.7 |
|
| 612 | - * Remove the trailing slash returned from the new platform api. |
|
| 613 | - */ |
|
| 614 | - // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 615 | - $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
| 616 | - // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 617 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
| 618 | - |
|
| 619 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
| 620 | - |
|
| 621 | - $this->set_dataset_uri( $dataset_uri ); |
|
| 622 | - $this->set_package_type( $package_type ); |
|
| 623 | - } |
|
| 624 | - |
|
| 625 | - /** |
|
| 626 | - * Handle the edge case where a user submits the same key again |
|
| 627 | - * when he does not have the dataset uri to regain it. |
|
| 628 | - * |
|
| 629 | - * This can not be handled in the normal option update hook because |
|
| 630 | - * it is not being triggered when the save value equals to the one already |
|
| 631 | - * in the DB. |
|
| 632 | - * |
|
| 633 | - * @param mixed $value The new, unserialized option value. |
|
| 634 | - * @param mixed $old_value The old option value. |
|
| 635 | - * |
|
| 636 | - * @return mixed The same value in the $value parameter |
|
| 637 | - * @since 3.12.0 |
|
| 638 | - */ |
|
| 639 | - public function maybe_update_dataset_uri( $value, $old_value ) { |
|
| 640 | - |
|
| 641 | - // Check the old key value and the new one. Here we're only handling the |
|
| 642 | - // case where the key hasn't changed and the dataset URI isn't set. The |
|
| 643 | - // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
| 644 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 645 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
| 646 | - |
|
| 647 | - $dataset_uri = $this->get_dataset_uri(); |
|
| 648 | - |
|
| 649 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
| 650 | - |
|
| 651 | - // make the request to the remote server to try to get the dataset uri. |
|
| 652 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 653 | - } |
|
| 654 | - |
|
| 655 | - return $value; |
|
| 656 | - } |
|
| 657 | - |
|
| 658 | - /** |
|
| 659 | - * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
| 660 | - * |
|
| 661 | - * @param string $key The WordLift key to use. |
|
| 662 | - * |
|
| 663 | - * @return string The API URI. |
|
| 664 | - * @since 3.11.0 |
|
| 665 | - */ |
|
| 666 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
| 667 | - |
|
| 668 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
| 669 | - } |
|
| 670 | - |
|
| 671 | - /** |
|
| 672 | - * Get the `accounts` end point. |
|
| 673 | - * |
|
| 674 | - * @return string The `accounts` end point. |
|
| 675 | - * @since 3.16.0 |
|
| 676 | - */ |
|
| 677 | - public function get_accounts() { |
|
| 678 | - |
|
| 679 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
| 680 | - } |
|
| 681 | - |
|
| 682 | - /** |
|
| 683 | - * Get the `link by default` option. |
|
| 684 | - * |
|
| 685 | - * @return bool True if entities must be linked by default otherwise false. |
|
| 686 | - * @since 3.13.0 |
|
| 687 | - */ |
|
| 688 | - public function is_link_by_default() { |
|
| 689 | - |
|
| 690 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
| 691 | - } |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * Set the `link by default` option. |
|
| 695 | - * |
|
| 696 | - * @param bool $value True to enabling linking by default, otherwise false. |
|
| 697 | - * |
|
| 698 | - * @since 3.13.0 |
|
| 699 | - */ |
|
| 700 | - public function set_link_by_default( $value ) { |
|
| 701 | - |
|
| 702 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
| 703 | - } |
|
| 704 | - |
|
| 705 | - /** |
|
| 706 | - * Get the 'analytics-enable' option. |
|
| 707 | - * |
|
| 708 | - * @return string 'no' or 'yes' representing bool. |
|
| 709 | - * @since 3.21.0 |
|
| 710 | - */ |
|
| 711 | - public function is_analytics_enable() { |
|
| 712 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
| 713 | - } |
|
| 714 | - |
|
| 715 | - /** |
|
| 716 | - * Set the `analytics-enable` option. |
|
| 717 | - * |
|
| 718 | - * @param bool $value True to enabling analytics, otherwise false. |
|
| 719 | - * |
|
| 720 | - * @since 3.21.0 |
|
| 721 | - */ |
|
| 722 | - public function set_is_analytics_enable( $value ) { |
|
| 723 | - |
|
| 724 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
| 725 | - } |
|
| 726 | - |
|
| 727 | - /** |
|
| 728 | - * Get the 'analytics-entity-uri-dimention' option. |
|
| 729 | - * |
|
| 730 | - * @return int |
|
| 731 | - * @since 3.21.0 |
|
| 732 | - */ |
|
| 733 | - public function get_analytics_entity_uri_dimension() { |
|
| 734 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
| 735 | - } |
|
| 736 | - |
|
| 737 | - /** |
|
| 738 | - * Get the 'analytics-entity-type-dimension' option. |
|
| 739 | - * |
|
| 740 | - * @return int |
|
| 741 | - * @since 3.21.0 |
|
| 742 | - */ |
|
| 743 | - public function get_analytics_entity_type_dimension() { |
|
| 744 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
| 745 | - } |
|
| 746 | - |
|
| 747 | - /** |
|
| 748 | - * Get the URL to perform autocomplete request. |
|
| 749 | - * |
|
| 750 | - * @return string The URL to call to perform the autocomplete request. |
|
| 751 | - * @since 3.15.0 |
|
| 752 | - */ |
|
| 753 | - public function get_autocomplete_url() { |
|
| 754 | - |
|
| 755 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
| 756 | - |
|
| 757 | - } |
|
| 758 | - |
|
| 759 | - /** |
|
| 760 | - * Get the URL to perform feedback deactivation request. |
|
| 761 | - * |
|
| 762 | - * @return string The URL to call to perform the feedback deactivation request. |
|
| 763 | - * @since 3.19.0 |
|
| 764 | - */ |
|
| 765 | - public function get_deactivation_feedback_url() { |
|
| 766 | - |
|
| 767 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
| 768 | - |
|
| 769 | - } |
|
| 770 | - |
|
| 771 | - /** |
|
| 772 | - * Get the base API URL. |
|
| 773 | - * |
|
| 774 | - * @return string The base API URL. |
|
| 775 | - * @since 3.20.0 |
|
| 776 | - */ |
|
| 777 | - public function get_api_url() { |
|
| 778 | - |
|
| 779 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
| 780 | - } |
|
| 781 | - |
|
| 782 | - public function get_network_dataset_ids() { |
|
| 783 | - return $this->get( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, array() ); |
|
| 784 | - } |
|
| 785 | - |
|
| 786 | - public function set_network_dataset_ids( $network_dataset_ids ) { |
|
| 787 | - $this->set( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, $network_dataset_ids ); |
|
| 788 | - } |
|
| 609 | + $json = json_decode( $response['body'] ); |
|
| 610 | + /** |
|
| 611 | + * @since 3.27.7 |
|
| 612 | + * Remove the trailing slash returned from the new platform api. |
|
| 613 | + */ |
|
| 614 | + // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 615 | + $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
| 616 | + // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 617 | + $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
| 618 | + |
|
| 619 | + $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
| 620 | + |
|
| 621 | + $this->set_dataset_uri( $dataset_uri ); |
|
| 622 | + $this->set_package_type( $package_type ); |
|
| 623 | + } |
|
| 624 | + |
|
| 625 | + /** |
|
| 626 | + * Handle the edge case where a user submits the same key again |
|
| 627 | + * when he does not have the dataset uri to regain it. |
|
| 628 | + * |
|
| 629 | + * This can not be handled in the normal option update hook because |
|
| 630 | + * it is not being triggered when the save value equals to the one already |
|
| 631 | + * in the DB. |
|
| 632 | + * |
|
| 633 | + * @param mixed $value The new, unserialized option value. |
|
| 634 | + * @param mixed $old_value The old option value. |
|
| 635 | + * |
|
| 636 | + * @return mixed The same value in the $value parameter |
|
| 637 | + * @since 3.12.0 |
|
| 638 | + */ |
|
| 639 | + public function maybe_update_dataset_uri( $value, $old_value ) { |
|
| 640 | + |
|
| 641 | + // Check the old key value and the new one. Here we're only handling the |
|
| 642 | + // case where the key hasn't changed and the dataset URI isn't set. The |
|
| 643 | + // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
| 644 | + $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 645 | + $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
| 646 | + |
|
| 647 | + $dataset_uri = $this->get_dataset_uri(); |
|
| 648 | + |
|
| 649 | + if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
| 650 | + |
|
| 651 | + // make the request to the remote server to try to get the dataset uri. |
|
| 652 | + $this->get_remote_dataset_uri( $new_key ); |
|
| 653 | + } |
|
| 654 | + |
|
| 655 | + return $value; |
|
| 656 | + } |
|
| 657 | + |
|
| 658 | + /** |
|
| 659 | + * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
| 660 | + * |
|
| 661 | + * @param string $key The WordLift key to use. |
|
| 662 | + * |
|
| 663 | + * @return string The API URI. |
|
| 664 | + * @since 3.11.0 |
|
| 665 | + */ |
|
| 666 | + public function get_accounts_by_key_dataset_uri( $key ) { |
|
| 667 | + |
|
| 668 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
| 669 | + } |
|
| 670 | + |
|
| 671 | + /** |
|
| 672 | + * Get the `accounts` end point. |
|
| 673 | + * |
|
| 674 | + * @return string The `accounts` end point. |
|
| 675 | + * @since 3.16.0 |
|
| 676 | + */ |
|
| 677 | + public function get_accounts() { |
|
| 678 | + |
|
| 679 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
| 680 | + } |
|
| 681 | + |
|
| 682 | + /** |
|
| 683 | + * Get the `link by default` option. |
|
| 684 | + * |
|
| 685 | + * @return bool True if entities must be linked by default otherwise false. |
|
| 686 | + * @since 3.13.0 |
|
| 687 | + */ |
|
| 688 | + public function is_link_by_default() { |
|
| 689 | + |
|
| 690 | + return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
| 691 | + } |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * Set the `link by default` option. |
|
| 695 | + * |
|
| 696 | + * @param bool $value True to enabling linking by default, otherwise false. |
|
| 697 | + * |
|
| 698 | + * @since 3.13.0 |
|
| 699 | + */ |
|
| 700 | + public function set_link_by_default( $value ) { |
|
| 701 | + |
|
| 702 | + $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
| 703 | + } |
|
| 704 | + |
|
| 705 | + /** |
|
| 706 | + * Get the 'analytics-enable' option. |
|
| 707 | + * |
|
| 708 | + * @return string 'no' or 'yes' representing bool. |
|
| 709 | + * @since 3.21.0 |
|
| 710 | + */ |
|
| 711 | + public function is_analytics_enable() { |
|
| 712 | + return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
| 713 | + } |
|
| 714 | + |
|
| 715 | + /** |
|
| 716 | + * Set the `analytics-enable` option. |
|
| 717 | + * |
|
| 718 | + * @param bool $value True to enabling analytics, otherwise false. |
|
| 719 | + * |
|
| 720 | + * @since 3.21.0 |
|
| 721 | + */ |
|
| 722 | + public function set_is_analytics_enable( $value ) { |
|
| 723 | + |
|
| 724 | + $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
| 725 | + } |
|
| 726 | + |
|
| 727 | + /** |
|
| 728 | + * Get the 'analytics-entity-uri-dimention' option. |
|
| 729 | + * |
|
| 730 | + * @return int |
|
| 731 | + * @since 3.21.0 |
|
| 732 | + */ |
|
| 733 | + public function get_analytics_entity_uri_dimension() { |
|
| 734 | + return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
| 735 | + } |
|
| 736 | + |
|
| 737 | + /** |
|
| 738 | + * Get the 'analytics-entity-type-dimension' option. |
|
| 739 | + * |
|
| 740 | + * @return int |
|
| 741 | + * @since 3.21.0 |
|
| 742 | + */ |
|
| 743 | + public function get_analytics_entity_type_dimension() { |
|
| 744 | + return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
| 745 | + } |
|
| 746 | + |
|
| 747 | + /** |
|
| 748 | + * Get the URL to perform autocomplete request. |
|
| 749 | + * |
|
| 750 | + * @return string The URL to call to perform the autocomplete request. |
|
| 751 | + * @since 3.15.0 |
|
| 752 | + */ |
|
| 753 | + public function get_autocomplete_url() { |
|
| 754 | + |
|
| 755 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
| 756 | + |
|
| 757 | + } |
|
| 758 | + |
|
| 759 | + /** |
|
| 760 | + * Get the URL to perform feedback deactivation request. |
|
| 761 | + * |
|
| 762 | + * @return string The URL to call to perform the feedback deactivation request. |
|
| 763 | + * @since 3.19.0 |
|
| 764 | + */ |
|
| 765 | + public function get_deactivation_feedback_url() { |
|
| 766 | + |
|
| 767 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
| 768 | + |
|
| 769 | + } |
|
| 770 | + |
|
| 771 | + /** |
|
| 772 | + * Get the base API URL. |
|
| 773 | + * |
|
| 774 | + * @return string The base API URL. |
|
| 775 | + * @since 3.20.0 |
|
| 776 | + */ |
|
| 777 | + public function get_api_url() { |
|
| 778 | + |
|
| 779 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
| 780 | + } |
|
| 781 | + |
|
| 782 | + public function get_network_dataset_ids() { |
|
| 783 | + return $this->get( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, array() ); |
|
| 784 | + } |
|
| 785 | + |
|
| 786 | + public function set_network_dataset_ids( $network_dataset_ids ) { |
|
| 787 | + $this->set( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, $network_dataset_ids ); |
|
| 788 | + } |
|
| 789 | 789 | |
| 790 | 790 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | use Wordlift\Api\Default_Api_Service; |
| 14 | 14 | |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | protected function __construct() { |
| 145 | 145 | |
| 146 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 146 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 147 | 147 | |
| 148 | 148 | // Sync some configuration properties when key is validated. |
| 149 | - add_action( 'wl_key_validation_response', array( $this, 'sync' ) ); |
|
| 149 | + add_action('wl_key_validation_response', array($this, 'sync')); |
|
| 150 | 150 | |
| 151 | 151 | } |
| 152 | 152 | |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | - public function sync( $response ) { |
|
| 159 | - if ( ! $response->is_success() ) { |
|
| 158 | + public function sync($response) { |
|
| 159 | + if ( ! $response->is_success()) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | - $data = json_decode( $response->get_body(), true ); |
|
| 163 | - if ( ! is_array( $data ) || ! array_key_exists( 'networkDatasetId', $data ) ) { |
|
| 162 | + $data = json_decode($response->get_body(), true); |
|
| 163 | + if ( ! is_array($data) || ! array_key_exists('networkDatasetId', $data)) { |
|
| 164 | 164 | return; |
| 165 | 165 | } |
| 166 | - $this->set_network_dataset_ids( $data['networkDatasetId'] ); |
|
| 166 | + $this->set_network_dataset_ids($data['networkDatasetId']); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public static function get_instance() { |
| 186 | 186 | |
| 187 | - if ( ! isset( self::$instance ) ) { |
|
| 187 | + if ( ! isset(self::$instance)) { |
|
| 188 | 188 | self::$instance = new self(); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | * @return mixed The configuration value or the default value if not found. |
| 203 | 203 | * @since 3.6.0 |
| 204 | 204 | */ |
| 205 | - private function get( $option, $key, $default = '' ) { |
|
| 205 | + private function get($option, $key, $default = '') { |
|
| 206 | 206 | |
| 207 | - $options = get_option( $option, array() ); |
|
| 207 | + $options = get_option($option, array()); |
|
| 208 | 208 | |
| 209 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
| 209 | + return isset($options[$key]) ? $options[$key] : $default; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @since 3.9.0 |
| 220 | 220 | */ |
| 221 | - private function set( $option, $key, $value ) { |
|
| 221 | + private function set($option, $key, $value) { |
|
| 222 | 222 | |
| 223 | - $values = get_option( $option ); |
|
| 224 | - $values = isset( $values ) ? $values : array(); |
|
| 225 | - $values[ $key ] = $value; |
|
| 226 | - update_option( $option, $values ); |
|
| 223 | + $values = get_option($option); |
|
| 224 | + $values = isset($values) ? $values : array(); |
|
| 225 | + $values[$key] = $value; |
|
| 226 | + update_option($option, $values); |
|
| 227 | 227 | |
| 228 | 228 | } |
| 229 | 229 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function get_entity_base_path() { |
| 237 | 237 | |
| 238 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
| 238 | + return $this->get('wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity'); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -245,9 +245,9 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @since 3.9.0 |
| 247 | 247 | */ |
| 248 | - public function set_entity_base_path( $value ) { |
|
| 248 | + public function set_entity_base_path($value) { |
|
| 249 | 249 | |
| 250 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
| 250 | + $this->set('wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value); |
|
| 251 | 251 | |
| 252 | 252 | } |
| 253 | 253 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function is_skip_wizard() { |
| 261 | 261 | |
| 262 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
| 262 | + return $this->get('wl_general_settings', self::SKIP_WIZARD, false); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @since 3.9.0 |
| 271 | 271 | */ |
| 272 | - public function set_skip_wizard( $value ) { |
|
| 272 | + public function set_skip_wizard($value) { |
|
| 273 | 273 | |
| 274 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
| 274 | + $this->set('wl_general_settings', self::SKIP_WIZARD, true === $value); |
|
| 275 | 275 | |
| 276 | 276 | } |
| 277 | 277 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function get_key() { |
| 285 | 285 | |
| 286 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
| 286 | + return $this->get('wl_general_settings', self::KEY, ''); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | * |
| 294 | 294 | * @since 3.9.0 |
| 295 | 295 | */ |
| 296 | - public function set_key( $value ) { |
|
| 296 | + public function set_key($value) { |
|
| 297 | 297 | |
| 298 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
| 298 | + $this->set('wl_general_settings', self::KEY, $value); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -309,11 +309,11 @@ discard block |
||
| 309 | 309 | public function get_language_code() { |
| 310 | 310 | |
| 311 | 311 | $language = get_locale(); |
| 312 | - if ( ! $language ) { |
|
| 312 | + if ( ! $language) { |
|
| 313 | 313 | return 'en'; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - return substr( $language, 0, 2 ); |
|
| 316 | + return substr($language, 0, 2); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -328,9 +328,9 @@ discard block |
||
| 328 | 328 | * |
| 329 | 329 | * @since 3.9.0 |
| 330 | 330 | */ |
| 331 | - public function set_language_code( $value ) { |
|
| 331 | + public function set_language_code($value) { |
|
| 332 | 332 | |
| 333 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
| 333 | + $this->set('wl_general_settings', self::LANGUAGE, $value); |
|
| 334 | 334 | |
| 335 | 335 | } |
| 336 | 336 | |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | * |
| 342 | 342 | * @since 3.19.0 |
| 343 | 343 | */ |
| 344 | - public function set_diagnostic_preferences( $value ) { |
|
| 344 | + public function set_diagnostic_preferences($value) { |
|
| 345 | 345 | |
| 346 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
| 346 | + $this->set('wl_general_settings', self::SEND_DIAGNOSTIC, $value); |
|
| 347 | 347 | |
| 348 | 348 | } |
| 349 | 349 | |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public function get_diagnostic_preferences() { |
| 356 | 356 | |
| 357 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
| 357 | + return $this->get('wl_general_settings', self::SEND_DIAGNOSTIC, 'no'); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function get_country_code() { |
| 367 | 367 | |
| 368 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
| 368 | + return $this->get('wl_general_settings', self::COUNTRY_CODE, 'us'); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -375,9 +375,9 @@ discard block |
||
| 375 | 375 | * |
| 376 | 376 | * @since 3.18.0 |
| 377 | 377 | */ |
| 378 | - public function set_country_code( $value ) { |
|
| 378 | + public function set_country_code($value) { |
|
| 379 | 379 | |
| 380 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
| 380 | + $this->set('wl_general_settings', self::COUNTRY_CODE, $value); |
|
| 381 | 381 | |
| 382 | 382 | } |
| 383 | 383 | |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | * @since 3.38.6 |
| 391 | 391 | */ |
| 392 | 392 | public function get_alternate_name() { |
| 393 | - return $this->get( 'wl_general_settings', self::ALTERNATE_NAME ); |
|
| 393 | + return $this->get('wl_general_settings', self::ALTERNATE_NAME); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @since 3.38.6 |
| 402 | 402 | */ |
| 403 | - public function set_alternate_name( $value ) { |
|
| 403 | + public function set_alternate_name($value) { |
|
| 404 | 404 | |
| 405 | - $this->set( 'wl_general_settings', self::ALTERNATE_NAME, wp_strip_all_tags( $value ) ); |
|
| 405 | + $this->set('wl_general_settings', self::ALTERNATE_NAME, wp_strip_all_tags($value)); |
|
| 406 | 406 | |
| 407 | 407 | } |
| 408 | 408 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | */ |
| 418 | 418 | public function get_publisher_id() { |
| 419 | 419 | |
| 420 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
| 420 | + return $this->get('wl_general_settings', self::PUBLISHER_ID, null); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @since 3.9.0 |
| 429 | 429 | */ |
| 430 | - public function set_publisher_id( $value ) { |
|
| 430 | + public function set_publisher_id($value) { |
|
| 431 | 431 | |
| 432 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
| 432 | + $this->set('wl_general_settings', self::PUBLISHER_ID, $value); |
|
| 433 | 433 | |
| 434 | 434 | } |
| 435 | 435 | |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | */ |
| 443 | 443 | public function get_dataset_uri() { |
| 444 | 444 | |
| 445 | - if ( apply_filters( 'wl_feature__enable__dataset', true ) ) { |
|
| 446 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
| 445 | + if (apply_filters('wl_feature__enable__dataset', true)) { |
|
| 446 | + return $this->get('wl_advanced_settings', self::DATASET_URI, null); |
|
| 447 | 447 | } else { |
| 448 | 448 | return null; |
| 449 | 449 | } |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | * |
| 457 | 457 | * @since 3.10.0 |
| 458 | 458 | */ |
| 459 | - public function set_dataset_uri( $value ) { |
|
| 459 | + public function set_dataset_uri($value) { |
|
| 460 | 460 | |
| 461 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
| 461 | + $this->set('wl_advanced_settings', self::DATASET_URI, $value); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | */ |
| 470 | 470 | public function get_package_type() { |
| 471 | 471 | |
| 472 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
| 472 | + return $this->get('wl_advanced_settings', self::PACKAGE_TYPE, null); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | * |
| 480 | 480 | * @since 3.20.0 |
| 481 | 481 | */ |
| 482 | - public function set_package_type( $value ) { |
|
| 483 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
| 482 | + public function set_package_type($value) { |
|
| 483 | + $this->set('wl_advanced_settings', self::PACKAGE_TYPE, $value); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
@@ -495,11 +495,11 @@ discard block |
||
| 495 | 495 | * @param array $old_value The old settings. |
| 496 | 496 | * @param array $new_value The new settings. |
| 497 | 497 | */ |
| 498 | - public function update_key( $old_value, $new_value ) { |
|
| 498 | + public function update_key($old_value, $new_value) { |
|
| 499 | 499 | |
| 500 | 500 | // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
| 501 | 501 | // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
| 502 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
| 502 | + $new_key = isset($new_value['key']) ? $new_value['key'] : ''; |
|
| 503 | 503 | |
| 504 | 504 | // If the key hasn't changed, don't do anything. |
| 505 | 505 | // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
@@ -508,14 +508,14 @@ discard block |
||
| 508 | 508 | // } |
| 509 | 509 | |
| 510 | 510 | // If the key is empty, empty the dataset URI. |
| 511 | - if ( '' === $new_key ) { |
|
| 512 | - $this->set_dataset_uri( '' ); |
|
| 511 | + if ('' === $new_key) { |
|
| 512 | + $this->set_dataset_uri(''); |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | // make the request to the remote server. |
| 516 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 516 | + $this->get_remote_dataset_uri($new_key); |
|
| 517 | 517 | |
| 518 | - do_action( 'wl_key_updated' ); |
|
| 518 | + do_action('wl_key_updated'); |
|
| 519 | 519 | |
| 520 | 520 | } |
| 521 | 521 | |
@@ -531,15 +531,15 @@ discard block |
||
| 531 | 531 | * |
| 532 | 532 | * @since 3.17.0 send the site URL and get the dataset URI. |
| 533 | 533 | */ |
| 534 | - public function get_remote_dataset_uri( $key ) { |
|
| 534 | + public function get_remote_dataset_uri($key) { |
|
| 535 | 535 | |
| 536 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
| 536 | + $this->log->trace('Getting the remote dataset URI and package type...'); |
|
| 537 | 537 | |
| 538 | - if ( empty( $key ) ) { |
|
| 539 | - $this->log->warn( 'Key set to empty value.' ); |
|
| 538 | + if (empty($key)) { |
|
| 539 | + $this->log->warn('Key set to empty value.'); |
|
| 540 | 540 | |
| 541 | - $this->set_dataset_uri( '' ); |
|
| 542 | - $this->set_package_type( null ); |
|
| 541 | + $this->set_dataset_uri(''); |
|
| 542 | + $this->set_package_type(null); |
|
| 543 | 543 | |
| 544 | 544 | return; |
| 545 | 545 | } |
@@ -553,15 +553,15 @@ discard block |
||
| 553 | 553 | * |
| 554 | 554 | * @since 3.20.0 |
| 555 | 555 | */ |
| 556 | - $home_url = get_option( 'home' ); |
|
| 557 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
| 556 | + $home_url = get_option('home'); |
|
| 557 | + $site_url = apply_filters('wl_production_site_url', untrailingslashit($home_url)); |
|
| 558 | 558 | |
| 559 | 559 | // Build the URL. |
| 560 | 560 | $url = '/accounts' |
| 561 | - . '?key=' . rawurlencode( $key ) |
|
| 562 | - . '&url=' . rawurlencode( $site_url ) |
|
| 563 | - . '&country=' . $this->get_country_code() |
|
| 564 | - . '&language=' . $this->get_language_code(); |
|
| 561 | + . '?key='.rawurlencode($key) |
|
| 562 | + . '&url='.rawurlencode($site_url) |
|
| 563 | + . '&country='.$this->get_country_code() |
|
| 564 | + . '&language='.$this->get_language_code(); |
|
| 565 | 565 | |
| 566 | 566 | $api_service = Default_Api_Service::get_instance(); |
| 567 | 567 | /** |
@@ -571,32 +571,32 @@ discard block |
||
| 571 | 571 | $headers = array( |
| 572 | 572 | 'Authorization' => "Key $key", |
| 573 | 573 | ); |
| 574 | - $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
| 574 | + $response = $api_service->request('PUT', $url, $headers)->get_response(); |
|
| 575 | 575 | |
| 576 | 576 | // The response is an error. |
| 577 | - if ( is_wp_error( $response ) ) { |
|
| 578 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
| 577 | + if (is_wp_error($response)) { |
|
| 578 | + $this->log->error('An error occurred setting the dataset URI: '.$response->get_error_message()); |
|
| 579 | 579 | |
| 580 | - $this->set_dataset_uri( '' ); |
|
| 581 | - $this->set_package_type( null ); |
|
| 580 | + $this->set_dataset_uri(''); |
|
| 581 | + $this->set_package_type(null); |
|
| 582 | 582 | |
| 583 | 583 | return; |
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | // The response is not OK. |
| 587 | - if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
| 587 | + if ( ! is_array($response) || 200 !== (int) $response['response']['code']) { |
|
| 588 | 588 | $base_url = $api_service->get_base_url(); |
| 589 | 589 | |
| 590 | - if ( ! is_array( $response ) ) { |
|
| 590 | + if ( ! is_array($response)) { |
|
| 591 | 591 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
| 592 | - $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
| 592 | + $this->log->error("Unexpected response when opening URL $base_url$url: ".var_export($response, true)); |
|
| 593 | 593 | } else { |
| 594 | 594 | // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
| 595 | - $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
| 595 | + $this->log->error("Unexpected status code when opening URL $base_url$url: ".$response['response']['code']."\n".var_export($response, true)); |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - $this->set_dataset_uri( '' ); |
|
| 599 | - $this->set_package_type( null ); |
|
| 598 | + $this->set_dataset_uri(''); |
|
| 599 | + $this->set_package_type(null); |
|
| 600 | 600 | |
| 601 | 601 | return; |
| 602 | 602 | } |
@@ -606,20 +606,20 @@ discard block |
||
| 606 | 606 | * |
| 607 | 607 | * @since 3.20.0 |
| 608 | 608 | */ |
| 609 | - $json = json_decode( $response['body'] ); |
|
| 609 | + $json = json_decode($response['body']); |
|
| 610 | 610 | /** |
| 611 | 611 | * @since 3.27.7 |
| 612 | 612 | * Remove the trailing slash returned from the new platform api. |
| 613 | 613 | */ |
| 614 | 614 | // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
| 615 | - $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
| 615 | + $dataset_uri = untrailingslashit($json->datasetURI); |
|
| 616 | 616 | // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
| 617 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
| 617 | + $package_type = isset($json->packageType) ? $json->packageType : null; |
|
| 618 | 618 | |
| 619 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
| 619 | + $this->log->info("Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..."); |
|
| 620 | 620 | |
| 621 | - $this->set_dataset_uri( $dataset_uri ); |
|
| 622 | - $this->set_package_type( $package_type ); |
|
| 621 | + $this->set_dataset_uri($dataset_uri); |
|
| 622 | + $this->set_package_type($package_type); |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | /** |
@@ -636,20 +636,20 @@ discard block |
||
| 636 | 636 | * @return mixed The same value in the $value parameter |
| 637 | 637 | * @since 3.12.0 |
| 638 | 638 | */ |
| 639 | - public function maybe_update_dataset_uri( $value, $old_value ) { |
|
| 639 | + public function maybe_update_dataset_uri($value, $old_value) { |
|
| 640 | 640 | |
| 641 | 641 | // Check the old key value and the new one. Here we're only handling the |
| 642 | 642 | // case where the key hasn't changed and the dataset URI isn't set. The |
| 643 | 643 | // other case, i.e. a new key is inserted, is handled at `update_key`. |
| 644 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
| 645 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
| 644 | + $old_key = isset($old_value['key']) ? $old_value['key'] : ''; |
|
| 645 | + $new_key = isset($value['key']) ? $value['key'] : ''; |
|
| 646 | 646 | |
| 647 | 647 | $dataset_uri = $this->get_dataset_uri(); |
| 648 | 648 | |
| 649 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
| 649 | + if ( ! empty($new_key) && $new_key === $old_key && empty($dataset_uri)) { |
|
| 650 | 650 | |
| 651 | 651 | // make the request to the remote server to try to get the dataset uri. |
| 652 | - $this->get_remote_dataset_uri( $new_key ); |
|
| 652 | + $this->get_remote_dataset_uri($new_key); |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | return $value; |
@@ -663,9 +663,9 @@ discard block |
||
| 663 | 663 | * @return string The API URI. |
| 664 | 664 | * @since 3.11.0 |
| 665 | 665 | */ |
| 666 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
| 666 | + public function get_accounts_by_key_dataset_uri($key) { |
|
| 667 | 667 | |
| 668 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
| 668 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."accounts/key=$key/dataset_uri"; |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | /** |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | */ |
| 677 | 677 | public function get_accounts() { |
| 678 | 678 | |
| 679 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
| 679 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'accounts'; |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | */ |
| 688 | 688 | public function is_link_by_default() { |
| 689 | 689 | |
| 690 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
| 690 | + return 'yes' === $this->get('wl_general_settings', self::LINK_BY_DEFAULT, 'yes'); |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | /** |
@@ -697,9 +697,9 @@ discard block |
||
| 697 | 697 | * |
| 698 | 698 | * @since 3.13.0 |
| 699 | 699 | */ |
| 700 | - public function set_link_by_default( $value ) { |
|
| 700 | + public function set_link_by_default($value) { |
|
| 701 | 701 | |
| 702 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
| 702 | + $this->set('wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no'); |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | /** |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | * @since 3.21.0 |
| 710 | 710 | */ |
| 711 | 711 | public function is_analytics_enable() { |
| 712 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
| 712 | + return 'yes' === $this->get('wl_analytics_settings', self::ANALYTICS_ENABLE, 'no'); |
|
| 713 | 713 | } |
| 714 | 714 | |
| 715 | 715 | /** |
@@ -719,9 +719,9 @@ discard block |
||
| 719 | 719 | * |
| 720 | 720 | * @since 3.21.0 |
| 721 | 721 | */ |
| 722 | - public function set_is_analytics_enable( $value ) { |
|
| 722 | + public function set_is_analytics_enable($value) { |
|
| 723 | 723 | |
| 724 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
| 724 | + $this->set('wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no'); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | /** |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | * @since 3.21.0 |
| 732 | 732 | */ |
| 733 | 733 | public function get_analytics_entity_uri_dimension() { |
| 734 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
| 734 | + return (int) $this->get('wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1); |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /** |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | * @since 3.21.0 |
| 742 | 742 | */ |
| 743 | 743 | public function get_analytics_entity_type_dimension() { |
| 744 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
| 744 | + return $this->get('wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2); |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | /** |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | */ |
| 753 | 753 | public function get_autocomplete_url() { |
| 754 | 754 | |
| 755 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
| 755 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'autocomplete'; |
|
| 756 | 756 | |
| 757 | 757 | } |
| 758 | 758 | |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | */ |
| 765 | 765 | public function get_deactivation_feedback_url() { |
| 766 | 766 | |
| 767 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
| 767 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'feedbacks'; |
|
| 768 | 768 | |
| 769 | 769 | } |
| 770 | 770 | |
@@ -780,11 +780,11 @@ discard block |
||
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | public function get_network_dataset_ids() { |
| 783 | - return $this->get( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, array() ); |
|
| 783 | + return $this->get('wl_advanced_settings', self::NETWORK_DATASET_IDS, array()); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | - public function set_network_dataset_ids( $network_dataset_ids ) { |
|
| 787 | - $this->set( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, $network_dataset_ids ); |
|
| 786 | + public function set_network_dataset_ids($network_dataset_ids) { |
|
| 787 | + $this->set('wl_advanced_settings', self::NETWORK_DATASET_IDS, $network_dataset_ids); |
|
| 788 | 788 | } |
| 789 | 789 | |
| 790 | 790 | } |
@@ -4,58 +4,58 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Page { |
| 6 | 6 | |
| 7 | - /** |
|
| 8 | - * @var Page_Delegate |
|
| 9 | - */ |
|
| 10 | - private $delegate; |
|
| 11 | - private $menu_slug; |
|
| 12 | - private $page_title; |
|
| 13 | - private $menu_title; |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * @param Page_Delegate $full_page_delegate |
|
| 17 | - * @param Page_Delegate $modal_page_delegate |
|
| 18 | - */ |
|
| 19 | - public function __construct( $full_page_delegate, $modal_page_delegate, $menu_slug, $page_title, $menu_title ) { |
|
| 20 | - $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 21 | - $this->menu_slug = $menu_slug; |
|
| 22 | - $this->page_title = $page_title; |
|
| 23 | - $this->menu_title = $menu_title; |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - public function register_hooks() { |
|
| 27 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 28 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 29 | - if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 30 | - add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 ); |
|
| 31 | - } |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Remove notices from ingredients modal. |
|
| 36 | - */ |
|
| 37 | - public function remove_notices() { |
|
| 38 | - remove_all_actions( 'admin_notices' ); |
|
| 39 | - remove_all_actions( 'all_admin_notices' ); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - public function admin_menu() { |
|
| 43 | - add_submenu_page( |
|
| 44 | - 'wl_admin_menu', |
|
| 45 | - $this->page_title, |
|
| 46 | - $this->menu_title, |
|
| 47 | - 'manage_options', |
|
| 48 | - $this->menu_slug, |
|
| 49 | - array( $this, 'render' ) |
|
| 50 | - ); |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function render() { |
|
| 54 | - $this->delegate->render(); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - public function admin_enqueue_scripts() { |
|
| 58 | - $this->delegate->admin_enqueue_scripts(); |
|
| 59 | - } |
|
| 7 | + /** |
|
| 8 | + * @var Page_Delegate |
|
| 9 | + */ |
|
| 10 | + private $delegate; |
|
| 11 | + private $menu_slug; |
|
| 12 | + private $page_title; |
|
| 13 | + private $menu_title; |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * @param Page_Delegate $full_page_delegate |
|
| 17 | + * @param Page_Delegate $modal_page_delegate |
|
| 18 | + */ |
|
| 19 | + public function __construct( $full_page_delegate, $modal_page_delegate, $menu_slug, $page_title, $menu_title ) { |
|
| 20 | + $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 21 | + $this->menu_slug = $menu_slug; |
|
| 22 | + $this->page_title = $page_title; |
|
| 23 | + $this->menu_title = $menu_title; |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + public function register_hooks() { |
|
| 27 | + add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 28 | + add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 29 | + if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 30 | + add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 ); |
|
| 31 | + } |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Remove notices from ingredients modal. |
|
| 36 | + */ |
|
| 37 | + public function remove_notices() { |
|
| 38 | + remove_all_actions( 'admin_notices' ); |
|
| 39 | + remove_all_actions( 'all_admin_notices' ); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + public function admin_menu() { |
|
| 43 | + add_submenu_page( |
|
| 44 | + 'wl_admin_menu', |
|
| 45 | + $this->page_title, |
|
| 46 | + $this->menu_title, |
|
| 47 | + 'manage_options', |
|
| 48 | + $this->menu_slug, |
|
| 49 | + array( $this, 'render' ) |
|
| 50 | + ); |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function render() { |
|
| 54 | + $this->delegate->render(); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + public function admin_enqueue_scripts() { |
|
| 58 | + $this->delegate->admin_enqueue_scripts(); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | } |
@@ -16,18 +16,18 @@ discard block |
||
| 16 | 16 | * @param Page_Delegate $full_page_delegate |
| 17 | 17 | * @param Page_Delegate $modal_page_delegate |
| 18 | 18 | */ |
| 19 | - public function __construct( $full_page_delegate, $modal_page_delegate, $menu_slug, $page_title, $menu_title ) { |
|
| 20 | - $this->delegate = isset( $_GET['modal_window'] ) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 19 | + public function __construct($full_page_delegate, $modal_page_delegate, $menu_slug, $page_title, $menu_title) { |
|
| 20 | + $this->delegate = isset($_GET['modal_window']) ? $modal_page_delegate : $full_page_delegate; //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 21 | 21 | $this->menu_slug = $menu_slug; |
| 22 | 22 | $this->page_title = $page_title; |
| 23 | 23 | $this->menu_title = $menu_title; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function register_hooks() { |
| 27 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 28 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); |
|
| 29 | - if ( isset( $_GET['modal_window'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 30 | - add_action( 'in_admin_header', array( $this, 'remove_notices' ), 99 ); |
|
| 27 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
| 28 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
| 29 | + if (isset($_GET['modal_window'])) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended |
|
| 30 | + add_action('in_admin_header', array($this, 'remove_notices'), 99); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * Remove notices from ingredients modal. |
| 36 | 36 | */ |
| 37 | 37 | public function remove_notices() { |
| 38 | - remove_all_actions( 'admin_notices' ); |
|
| 39 | - remove_all_actions( 'all_admin_notices' ); |
|
| 38 | + remove_all_actions('admin_notices'); |
|
| 39 | + remove_all_actions('all_admin_notices'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function admin_menu() { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->menu_title, |
| 47 | 47 | 'manage_options', |
| 48 | 48 | $this->menu_slug, |
| 49 | - array( $this, 'render' ) |
|
| 49 | + array($this, 'render') |
|
| 50 | 50 | ); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -3,43 +3,43 @@ discard block |
||
| 3 | 3 | namespace Wordlift\Modules\Food_Kg\Admin; |
| 4 | 4 | |
| 5 | 5 | if ( ! class_exists( 'WP_List_Table' ) ) { |
| 6 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 6 | + require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | use WP_List_Table; |
| 10 | 10 | |
| 11 | 11 | class Main_Ingredient_List_Table extends WP_List_Table { |
| 12 | 12 | |
| 13 | - public function prepare_items() { |
|
| 14 | - global $wpdb; // This is used only if making any database queries |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * REQUIRED. Now we need to define our column headers. This includes a complete |
|
| 18 | - * array of columns to be displayed (slugs & titles), a list of columns |
|
| 19 | - * to keep hidden, and a list of columns that are sortable. Each of these |
|
| 20 | - * can be defined in another method (as we've done here) before being |
|
| 21 | - * used to build the value for our _column_headers property. |
|
| 22 | - */ |
|
| 23 | - $columns = $this->get_columns(); |
|
| 24 | - $hidden = array(); |
|
| 25 | - $sortable = $this->get_sortable_columns(); |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * REQUIRED. Finally, we build an array to be used by the class for column |
|
| 29 | - * headers. The $this->_column_headers property takes an array which contains |
|
| 30 | - * 3 other arrays. One for all columns, one for hidden columns, and one |
|
| 31 | - * for sortable columns. |
|
| 32 | - */ |
|
| 33 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 34 | - |
|
| 35 | - // Pagination. |
|
| 36 | - $per_page = 20; |
|
| 37 | - $current_page = $this->get_pagenum(); |
|
| 38 | - $total_items = $this->count(); |
|
| 39 | - |
|
| 40 | - $this->items = $wpdb->get_results( |
|
| 41 | - $wpdb->prepare( |
|
| 42 | - "SELECT p1.ID AS recipe_ID, |
|
| 13 | + public function prepare_items() { |
|
| 14 | + global $wpdb; // This is used only if making any database queries |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * REQUIRED. Now we need to define our column headers. This includes a complete |
|
| 18 | + * array of columns to be displayed (slugs & titles), a list of columns |
|
| 19 | + * to keep hidden, and a list of columns that are sortable. Each of these |
|
| 20 | + * can be defined in another method (as we've done here) before being |
|
| 21 | + * used to build the value for our _column_headers property. |
|
| 22 | + */ |
|
| 23 | + $columns = $this->get_columns(); |
|
| 24 | + $hidden = array(); |
|
| 25 | + $sortable = $this->get_sortable_columns(); |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * REQUIRED. Finally, we build an array to be used by the class for column |
|
| 29 | + * headers. The $this->_column_headers property takes an array which contains |
|
| 30 | + * 3 other arrays. One for all columns, one for hidden columns, and one |
|
| 31 | + * for sortable columns. |
|
| 32 | + */ |
|
| 33 | + $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 34 | + |
|
| 35 | + // Pagination. |
|
| 36 | + $per_page = 20; |
|
| 37 | + $current_page = $this->get_pagenum(); |
|
| 38 | + $total_items = $this->count(); |
|
| 39 | + |
|
| 40 | + $this->items = $wpdb->get_results( |
|
| 41 | + $wpdb->prepare( |
|
| 42 | + "SELECT p1.ID AS recipe_ID, |
|
| 43 | 43 | p1.post_title AS recipe_name, |
| 44 | 44 | p2.ID AS post_ID, |
| 45 | 45 | p2.post_title |
@@ -49,99 +49,99 @@ discard block |
||
| 49 | 49 | INNER JOIN $wpdb->postmeta pm2 |
| 50 | 50 | ON pm2.post_ID = pm1.post_ID AND pm2.meta_key = 'wprm_parent_post_id' |
| 51 | 51 | INNER JOIN $wpdb->posts p2" |
| 52 | - // The following ignore rule is used against the `LIKE CONCAT`. We only have const values. |
|
| 53 | - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery |
|
| 54 | - . " ON p2.post_status = 'publish' AND p2.ID = pm2.meta_value |
|
| 52 | + // The following ignore rule is used against the `LIKE CONCAT`. We only have const values. |
|
| 53 | + // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery |
|
| 54 | + . " ON p2.post_status = 'publish' AND p2.ID = pm2.meta_value |
|
| 55 | 55 | WHERE pm1.meta_key = '_wl_main_ingredient_jsonld' |
| 56 | 56 | LIMIT %d |
| 57 | 57 | OFFSET %d", |
| 58 | - $per_page, |
|
| 59 | - ( $current_page - 1 ) * $per_page |
|
| 60 | - ) |
|
| 61 | - ); |
|
| 58 | + $per_page, |
|
| 59 | + ( $current_page - 1 ) * $per_page |
|
| 60 | + ) |
|
| 61 | + ); |
|
| 62 | 62 | |
| 63 | - $this->set_pagination_args( |
|
| 64 | - array( |
|
| 65 | - 'total_items' => $total_items, |
|
| 66 | - 'per_page' => $per_page, |
|
| 67 | - 'total_pages' => ceil( $total_items / $per_page ), |
|
| 68 | - ) |
|
| 69 | - ); |
|
| 70 | - } |
|
| 63 | + $this->set_pagination_args( |
|
| 64 | + array( |
|
| 65 | + 'total_items' => $total_items, |
|
| 66 | + 'per_page' => $per_page, |
|
| 67 | + 'total_pages' => ceil( $total_items / $per_page ), |
|
| 68 | + ) |
|
| 69 | + ); |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - private function count() { |
|
| 73 | - global $wpdb; |
|
| 72 | + private function count() { |
|
| 73 | + global $wpdb; |
|
| 74 | 74 | |
| 75 | - $count = get_transient( '_wl_main_ingredient_list_table__count' ); |
|
| 75 | + $count = get_transient( '_wl_main_ingredient_list_table__count' ); |
|
| 76 | 76 | |
| 77 | - if ( ! $count ) { |
|
| 77 | + if ( ! $count ) { |
|
| 78 | 78 | |
| 79 | - $count = $wpdb->get_var( |
|
| 80 | - "SELECT COUNT(1) |
|
| 79 | + $count = $wpdb->get_var( |
|
| 80 | + "SELECT COUNT(1) |
|
| 81 | 81 | FROM $wpdb->postmeta pm1 |
| 82 | 82 | INNER JOIN $wpdb->posts p1 |
| 83 | 83 | ON p1.ID = pm1.post_ID AND p1.post_type = 'wprm_recipe' |
| 84 | 84 | INNER JOIN $wpdb->postmeta pm2 |
| 85 | 85 | ON pm2.post_ID = pm1.post_ID AND pm2.meta_key = 'wprm_parent_post_id' |
| 86 | 86 | INNER JOIN $wpdb->posts p2" |
| 87 | - // The following ignore rule is used against the `LIKE CONCAT`. We only have const values. |
|
| 88 | - // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery |
|
| 89 | - . " ON p2.post_status = 'publish' AND p2.ID = pm2.post_ID |
|
| 87 | + // The following ignore rule is used against the `LIKE CONCAT`. We only have const values. |
|
| 88 | + // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.LikeWildcardsInQuery |
|
| 89 | + . " ON p2.post_status = 'publish' AND p2.ID = pm2.post_ID |
|
| 90 | 90 | WHERE pm1.meta_key = '_wl_main_ingredient_jsonld'" |
| 91 | - ); |
|
| 92 | - |
|
| 93 | - set_transient( '_wl_main_ingredient_list_table__count', $count, 60 ); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - return $count; |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - public function no_items() { |
|
| 100 | - esc_html_e( 'No main ingredients found.', 'wordlift' ); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - public function get_columns() { |
|
| 104 | - return array( |
|
| 105 | - 'ingredient_name' => __( 'Ingredient Name', 'wordlift' ), |
|
| 106 | - 'recipe_name' => __( 'Recipe Name', 'wordlift' ), |
|
| 107 | - 'post_title' => __( 'Post Title', 'wordlift' ), |
|
| 108 | - 'url' => __( 'Post URL', 'wordlift' ), |
|
| 109 | - 'actions' => '', |
|
| 110 | - ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - public function column_ingredient_name( $item ) { |
|
| 114 | - $recipe_json_ld = get_post_meta( $item->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 115 | - $recipe = json_decode( $recipe_json_ld, true ); |
|
| 116 | - |
|
| 117 | - return $recipe ? $recipe['name'] : 'null'; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - public function column_recipe_name( $item ) { |
|
| 121 | - return $item->recipe_name; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - public function column_post_title( $item ) { |
|
| 125 | - return sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->post_ID ), $item->post_title ); |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - public function column_url( $item ) { |
|
| 129 | - return get_permalink( $item->post_ID ); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - public function column_actions( $item ) { |
|
| 133 | - |
|
| 134 | - $url = admin_url( |
|
| 135 | - sprintf( 'admin.php?page=wl_main_ingredients&modal_window=true&id=%d&TB_iframe=true', $item->recipe_ID ) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 136 | - ); |
|
| 137 | - |
|
| 138 | - return sprintf( |
|
| 139 | - '<a href="%s" class="button alignright thickbox open-plugin-details-modal" data-title="%s" type="button">%s</a>', |
|
| 140 | - $url, |
|
| 141 | - esc_attr( $item->post_title ), |
|
| 142 | - esc_html__( 'JSON-LD', 'wordlift' ) |
|
| 143 | - ); |
|
| 144 | - } |
|
| 91 | + ); |
|
| 92 | + |
|
| 93 | + set_transient( '_wl_main_ingredient_list_table__count', $count, 60 ); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + return $count; |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + public function no_items() { |
|
| 100 | + esc_html_e( 'No main ingredients found.', 'wordlift' ); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + public function get_columns() { |
|
| 104 | + return array( |
|
| 105 | + 'ingredient_name' => __( 'Ingredient Name', 'wordlift' ), |
|
| 106 | + 'recipe_name' => __( 'Recipe Name', 'wordlift' ), |
|
| 107 | + 'post_title' => __( 'Post Title', 'wordlift' ), |
|
| 108 | + 'url' => __( 'Post URL', 'wordlift' ), |
|
| 109 | + 'actions' => '', |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + public function column_ingredient_name( $item ) { |
|
| 114 | + $recipe_json_ld = get_post_meta( $item->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 115 | + $recipe = json_decode( $recipe_json_ld, true ); |
|
| 116 | + |
|
| 117 | + return $recipe ? $recipe['name'] : 'null'; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + public function column_recipe_name( $item ) { |
|
| 121 | + return $item->recipe_name; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + public function column_post_title( $item ) { |
|
| 125 | + return sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->post_ID ), $item->post_title ); |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + public function column_url( $item ) { |
|
| 129 | + return get_permalink( $item->post_ID ); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + public function column_actions( $item ) { |
|
| 133 | + |
|
| 134 | + $url = admin_url( |
|
| 135 | + sprintf( 'admin.php?page=wl_main_ingredients&modal_window=true&id=%d&TB_iframe=true', $item->recipe_ID ) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 136 | + ); |
|
| 137 | + |
|
| 138 | + return sprintf( |
|
| 139 | + '<a href="%s" class="button alignright thickbox open-plugin-details-modal" data-title="%s" type="button">%s</a>', |
|
| 140 | + $url, |
|
| 141 | + esc_attr( $item->post_title ), |
|
| 142 | + esc_html__( 'JSON-LD', 'wordlift' ) |
|
| 143 | + ); |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Wordlift\Modules\Food_Kg\Admin; |
| 4 | 4 | |
| 5 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 6 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 5 | +if ( ! class_exists('WP_List_Table')) { |
|
| 6 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | use WP_List_Table; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * 3 other arrays. One for all columns, one for hidden columns, and one |
| 31 | 31 | * for sortable columns. |
| 32 | 32 | */ |
| 33 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 33 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 34 | 34 | |
| 35 | 35 | // Pagination. |
| 36 | 36 | $per_page = 20; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | LIMIT %d |
| 57 | 57 | OFFSET %d", |
| 58 | 58 | $per_page, |
| 59 | - ( $current_page - 1 ) * $per_page |
|
| 59 | + ($current_page - 1) * $per_page |
|
| 60 | 60 | ) |
| 61 | 61 | ); |
| 62 | 62 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | array( |
| 65 | 65 | 'total_items' => $total_items, |
| 66 | 66 | 'per_page' => $per_page, |
| 67 | - 'total_pages' => ceil( $total_items / $per_page ), |
|
| 67 | + 'total_pages' => ceil($total_items / $per_page), |
|
| 68 | 68 | ) |
| 69 | 69 | ); |
| 70 | 70 | } |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | private function count() { |
| 73 | 73 | global $wpdb; |
| 74 | 74 | |
| 75 | - $count = get_transient( '_wl_main_ingredient_list_table__count' ); |
|
| 75 | + $count = get_transient('_wl_main_ingredient_list_table__count'); |
|
| 76 | 76 | |
| 77 | - if ( ! $count ) { |
|
| 77 | + if ( ! $count) { |
|
| 78 | 78 | |
| 79 | 79 | $count = $wpdb->get_var( |
| 80 | 80 | "SELECT COUNT(1) |
@@ -90,56 +90,56 @@ discard block |
||
| 90 | 90 | WHERE pm1.meta_key = '_wl_main_ingredient_jsonld'" |
| 91 | 91 | ); |
| 92 | 92 | |
| 93 | - set_transient( '_wl_main_ingredient_list_table__count', $count, 60 ); |
|
| 93 | + set_transient('_wl_main_ingredient_list_table__count', $count, 60); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return $count; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function no_items() { |
| 100 | - esc_html_e( 'No main ingredients found.', 'wordlift' ); |
|
| 100 | + esc_html_e('No main ingredients found.', 'wordlift'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | public function get_columns() { |
| 104 | 104 | return array( |
| 105 | - 'ingredient_name' => __( 'Ingredient Name', 'wordlift' ), |
|
| 106 | - 'recipe_name' => __( 'Recipe Name', 'wordlift' ), |
|
| 107 | - 'post_title' => __( 'Post Title', 'wordlift' ), |
|
| 108 | - 'url' => __( 'Post URL', 'wordlift' ), |
|
| 105 | + 'ingredient_name' => __('Ingredient Name', 'wordlift'), |
|
| 106 | + 'recipe_name' => __('Recipe Name', 'wordlift'), |
|
| 107 | + 'post_title' => __('Post Title', 'wordlift'), |
|
| 108 | + 'url' => __('Post URL', 'wordlift'), |
|
| 109 | 109 | 'actions' => '', |
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function column_ingredient_name( $item ) { |
|
| 114 | - $recipe_json_ld = get_post_meta( $item->recipe_ID, '_wl_main_ingredient_jsonld', true ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 115 | - $recipe = json_decode( $recipe_json_ld, true ); |
|
| 113 | + public function column_ingredient_name($item) { |
|
| 114 | + $recipe_json_ld = get_post_meta($item->recipe_ID, '_wl_main_ingredient_jsonld', true); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 115 | + $recipe = json_decode($recipe_json_ld, true); |
|
| 116 | 116 | |
| 117 | 117 | return $recipe ? $recipe['name'] : 'null'; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - public function column_recipe_name( $item ) { |
|
| 120 | + public function column_recipe_name($item) { |
|
| 121 | 121 | return $item->recipe_name; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function column_post_title( $item ) { |
|
| 125 | - return sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->post_ID ), $item->post_title ); |
|
| 124 | + public function column_post_title($item) { |
|
| 125 | + return sprintf('<a href="%s">%s</a>', get_edit_post_link($item->post_ID), $item->post_title); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public function column_url( $item ) { |
|
| 129 | - return get_permalink( $item->post_ID ); |
|
| 128 | + public function column_url($item) { |
|
| 129 | + return get_permalink($item->post_ID); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public function column_actions( $item ) { |
|
| 132 | + public function column_actions($item) { |
|
| 133 | 133 | |
| 134 | 134 | $url = admin_url( |
| 135 | - sprintf( 'admin.php?page=wl_main_ingredients&modal_window=true&id=%d&TB_iframe=true', $item->recipe_ID ) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 135 | + sprintf('admin.php?page=wl_main_ingredients&modal_window=true&id=%d&TB_iframe=true', $item->recipe_ID) // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | 138 | return sprintf( |
| 139 | 139 | '<a href="%s" class="button alignright thickbox open-plugin-details-modal" data-title="%s" type="button">%s</a>', |
| 140 | 140 | $url, |
| 141 | - esc_attr( $item->post_title ), |
|
| 142 | - esc_html__( 'JSON-LD', 'wordlift' ) |
|
| 141 | + esc_attr($item->post_title), |
|
| 142 | + esc_html__('JSON-LD', 'wordlift') |
|
| 143 | 143 | ); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Ingredients_Full_Page_Delegate implements Page_Delegate { |
| 6 | 6 | |
| 7 | - public function render() { |
|
| 8 | - include_once WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/ingredients.php'; |
|
| 9 | - } |
|
| 7 | + public function render() { |
|
| 8 | + include_once WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/ingredients.php'; |
|
| 9 | + } |
|
| 10 | 10 | |
| 11 | - public function admin_enqueue_scripts() { |
|
| 12 | - wp_enqueue_style( 'thickbox' ); |
|
| 13 | - wp_enqueue_script( 'plugin-install' ); |
|
| 14 | - } |
|
| 11 | + public function admin_enqueue_scripts() { |
|
| 12 | + wp_enqueue_style( 'thickbox' ); |
|
| 13 | + wp_enqueue_script( 'plugin-install' ); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | 16 | } |
@@ -5,12 +5,12 @@ |
||
| 5 | 5 | class Ingredients_Full_Page_Delegate implements Page_Delegate { |
| 6 | 6 | |
| 7 | 7 | public function render() { |
| 8 | - include_once WL_FOOD_KG_DIR_PATH . '/includes/admin/partials/ingredients.php'; |
|
| 8 | + include_once WL_FOOD_KG_DIR_PATH.'/includes/admin/partials/ingredients.php'; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | public function admin_enqueue_scripts() { |
| 12 | - wp_enqueue_style( 'thickbox' ); |
|
| 13 | - wp_enqueue_script( 'plugin-install' ); |
|
| 12 | + wp_enqueue_style('thickbox'); |
|
| 13 | + wp_enqueue_script('plugin-install'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | } |
@@ -82,1802 +82,1802 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | class Wordlift { |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 87 | - * the plugin. |
|
| 88 | - * |
|
| 89 | - * @since 1.0.0 |
|
| 90 | - * @access protected |
|
| 91 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 92 | - */ |
|
| 93 | - protected $loader; |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * The unique identifier of this plugin. |
|
| 97 | - * |
|
| 98 | - * @since 1.0.0 |
|
| 99 | - * @access protected |
|
| 100 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 101 | - */ |
|
| 102 | - protected $plugin_name; |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * The current version of the plugin. |
|
| 106 | - * |
|
| 107 | - * @since 1.0.0 |
|
| 108 | - * @access protected |
|
| 109 | - * @var string $version The current version of the plugin. |
|
| 110 | - */ |
|
| 111 | - protected $version; |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 115 | - * |
|
| 116 | - * @since 3.12.0 |
|
| 117 | - * @access protected |
|
| 118 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 119 | - */ |
|
| 120 | - protected $tinymce_adapter; |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * The Schema service. |
|
| 124 | - * |
|
| 125 | - * @since 3.3.0 |
|
| 126 | - * @access protected |
|
| 127 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 128 | - */ |
|
| 129 | - protected $schema_service; |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * The Topic Taxonomy service. |
|
| 133 | - * |
|
| 134 | - * @since 3.5.0 |
|
| 135 | - * @access private |
|
| 136 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 137 | - */ |
|
| 138 | - private $topic_taxonomy_service; |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * The Entity Types Taxonomy service. |
|
| 142 | - * |
|
| 143 | - * @since 3.18.0 |
|
| 144 | - * @access private |
|
| 145 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 146 | - */ |
|
| 147 | - private $entity_types_taxonomy_service; |
|
| 148 | - |
|
| 149 | - /** |
|
| 150 | - * The User service. |
|
| 151 | - * |
|
| 152 | - * @since 3.1.7 |
|
| 153 | - * @access protected |
|
| 154 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 155 | - */ |
|
| 156 | - protected $user_service; |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * The Timeline service. |
|
| 160 | - * |
|
| 161 | - * @since 3.1.0 |
|
| 162 | - * @access private |
|
| 163 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 164 | - */ |
|
| 165 | - private $timeline_service; |
|
| 166 | - |
|
| 167 | - /** |
|
| 168 | - * The Redirect service. |
|
| 169 | - * |
|
| 170 | - * @since 3.2.0 |
|
| 171 | - * @access private |
|
| 172 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 173 | - */ |
|
| 174 | - private $redirect_service; |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * The Notice service. |
|
| 178 | - * |
|
| 179 | - * @since 3.3.0 |
|
| 180 | - * @access private |
|
| 181 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 182 | - */ |
|
| 183 | - private $notice_service; |
|
| 184 | - |
|
| 185 | - /** |
|
| 186 | - * The Entity list customization. |
|
| 187 | - * |
|
| 188 | - * @since 3.3.0 |
|
| 189 | - * @access protected |
|
| 190 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 191 | - */ |
|
| 192 | - protected $entity_list_service; |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * The Entity Types Taxonomy Walker. |
|
| 196 | - * |
|
| 197 | - * @since 3.1.0 |
|
| 198 | - * @access private |
|
| 199 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 200 | - */ |
|
| 201 | - private $entity_types_taxonomy_walker; |
|
| 202 | - |
|
| 203 | - /** |
|
| 204 | - * The ShareThis service. |
|
| 205 | - * |
|
| 206 | - * @since 3.2.0 |
|
| 207 | - * @access private |
|
| 208 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 209 | - */ |
|
| 210 | - private $sharethis_service; |
|
| 211 | - |
|
| 212 | - /** |
|
| 213 | - * The PrimaShop adapter. |
|
| 214 | - * |
|
| 215 | - * @since 3.2.3 |
|
| 216 | - * @access private |
|
| 217 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 218 | - */ |
|
| 219 | - private $primashop_adapter; |
|
| 220 | - |
|
| 221 | - /** |
|
| 222 | - * The entity type service. |
|
| 223 | - * |
|
| 224 | - * @since 3.6.0 |
|
| 225 | - * @access private |
|
| 226 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 227 | - */ |
|
| 228 | - private $entity_post_type_service; |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 232 | - * |
|
| 233 | - * @since 3.6.0 |
|
| 234 | - * @access private |
|
| 235 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 236 | - */ |
|
| 237 | - private $entity_link_service; |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 241 | - * |
|
| 242 | - * @since 3.7.0 |
|
| 243 | - * @access protected |
|
| 244 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 245 | - */ |
|
| 246 | - protected $jsonld_service; |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 250 | - * |
|
| 251 | - * @since 3.14.0 |
|
| 252 | - * @access protected |
|
| 253 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 254 | - */ |
|
| 255 | - protected $jsonld_website_converter; |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * A {@link Wordlift_Property_Factory} instance. |
|
| 259 | - * |
|
| 260 | - * @since 3.7.0 |
|
| 261 | - * @access private |
|
| 262 | - * @var \Wordlift_Property_Factory $property_factory |
|
| 263 | - */ |
|
| 264 | - private $property_factory; |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * The 'Download Your Data' page. |
|
| 268 | - * |
|
| 269 | - * @since 3.6.0 |
|
| 270 | - * @access private |
|
| 271 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 272 | - */ |
|
| 273 | - private $download_your_data_page; |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * The 'WordLift Settings' page. |
|
| 277 | - * |
|
| 278 | - * @since 3.11.0 |
|
| 279 | - * @access protected |
|
| 280 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 281 | - */ |
|
| 282 | - protected $settings_page; |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * The install wizard page. |
|
| 286 | - * |
|
| 287 | - * @since 3.9.0 |
|
| 288 | - * @access private |
|
| 289 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 290 | - */ |
|
| 291 | - public $admin_setup; |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 295 | - * linking of entities to their pages. |
|
| 296 | - * |
|
| 297 | - * @since 3.8.0 |
|
| 298 | - * @access private |
|
| 299 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 300 | - */ |
|
| 301 | - private $content_filter_service; |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * The Faq Content filter service |
|
| 305 | - * |
|
| 306 | - * @since 3.26.0 |
|
| 307 | - * @access private |
|
| 308 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 309 | - */ |
|
| 310 | - private $faq_content_filter_service; |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 314 | - * |
|
| 315 | - * @since 3.9.0 |
|
| 316 | - * @access private |
|
| 317 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 318 | - */ |
|
| 319 | - private $key_validation_service; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 323 | - * |
|
| 324 | - * @since 3.10.0 |
|
| 325 | - * @access private |
|
| 326 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 327 | - */ |
|
| 328 | - private $rating_service; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 332 | - * |
|
| 333 | - * @since 3.10.0 |
|
| 334 | - * @access protected |
|
| 335 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 336 | - */ |
|
| 337 | - protected $post_to_jsonld_converter; |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * A {@link Wordlift_Install_Service} instance. |
|
| 341 | - * |
|
| 342 | - * @since 3.18.0 |
|
| 343 | - * @access protected |
|
| 344 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 345 | - */ |
|
| 346 | - protected $install_service; |
|
| 347 | - |
|
| 348 | - /** |
|
| 349 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 350 | - * |
|
| 351 | - * @since 3.10.0 |
|
| 352 | - * @access protected |
|
| 353 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 354 | - */ |
|
| 355 | - protected $entity_post_to_jsonld_converter; |
|
| 356 | - |
|
| 357 | - /** |
|
| 358 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 359 | - * |
|
| 360 | - * @since 3.10.0 |
|
| 361 | - * @access protected |
|
| 362 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 363 | - */ |
|
| 364 | - protected $postid_to_jsonld_converter; |
|
| 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_Entity_Page_Service} instance. |
|
| 377 | - * |
|
| 378 | - * @since 3.11.0 |
|
| 379 | - * @access protected |
|
| 380 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 381 | - */ |
|
| 382 | - protected $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_Admin_Settings_Page_Action_Link} class. |
|
| 395 | - * |
|
| 396 | - * @since 3.11.0 |
|
| 397 | - * @access protected |
|
| 398 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 399 | - */ |
|
| 400 | - protected $analytics_settings_page_action_link; |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * The {@link Wordlift_Analytics_Connect} class. |
|
| 404 | - * |
|
| 405 | - * @since 3.11.0 |
|
| 406 | - * @access protected |
|
| 407 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 408 | - */ |
|
| 409 | - protected $analytics_connect; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 413 | - * |
|
| 414 | - * @since 3.11.0 |
|
| 415 | - * @access protected |
|
| 416 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 417 | - */ |
|
| 418 | - protected $publisher_ajax_adapter; |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 422 | - * |
|
| 423 | - * @since 3.11.0 |
|
| 424 | - * @access protected |
|
| 425 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 426 | - */ |
|
| 427 | - protected $input_element; |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 431 | - * |
|
| 432 | - * @since 3.13.0 |
|
| 433 | - * @access protected |
|
| 434 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 435 | - */ |
|
| 436 | - protected $radio_input_element; |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 440 | - * |
|
| 441 | - * @since 3.11.0 |
|
| 442 | - * @access protected |
|
| 443 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 444 | - */ |
|
| 445 | - protected $language_select_element; |
|
| 446 | - |
|
| 447 | - /** |
|
| 448 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 449 | - * |
|
| 450 | - * @since 3.18.0 |
|
| 451 | - * @access protected |
|
| 452 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 453 | - */ |
|
| 454 | - protected $country_select_element; |
|
| 455 | - |
|
| 456 | - /** |
|
| 457 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 458 | - * |
|
| 459 | - * @since 3.11.0 |
|
| 460 | - * @access protected |
|
| 461 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 462 | - */ |
|
| 463 | - protected $publisher_element; |
|
| 464 | - |
|
| 465 | - /** |
|
| 466 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 467 | - * |
|
| 468 | - * @since 3.11.0 |
|
| 469 | - * @access protected |
|
| 470 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 471 | - */ |
|
| 472 | - protected $select2_element; |
|
| 473 | - |
|
| 474 | - /** |
|
| 475 | - * The controller for the entity type list admin page |
|
| 476 | - * |
|
| 477 | - * @since 3.11.0 |
|
| 478 | - * @access private |
|
| 479 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 480 | - */ |
|
| 481 | - private $entity_type_admin_page; |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * The controller for the entity type settings admin page |
|
| 485 | - * |
|
| 486 | - * @since 3.11.0 |
|
| 487 | - * @access private |
|
| 488 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 489 | - */ |
|
| 490 | - private $entity_type_settings_admin_page; |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 494 | - * |
|
| 495 | - * @since 3.11.0 |
|
| 496 | - * @access protected |
|
| 497 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 498 | - */ |
|
| 499 | - protected $related_entities_cloud_widget; |
|
| 500 | - |
|
| 501 | - /** |
|
| 502 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 503 | - * |
|
| 504 | - * @since 3.14.0 |
|
| 505 | - * @access protected |
|
| 506 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 507 | - */ |
|
| 508 | - protected $author_element; |
|
| 509 | - |
|
| 510 | - /** |
|
| 511 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 512 | - * |
|
| 513 | - * @since 3.12.0 |
|
| 514 | - * @access protected |
|
| 515 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 516 | - */ |
|
| 517 | - protected $sample_data_service; |
|
| 518 | - |
|
| 519 | - /** |
|
| 520 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 521 | - * |
|
| 522 | - * @since 3.12.0 |
|
| 523 | - * @access protected |
|
| 524 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 525 | - */ |
|
| 526 | - protected $sample_data_ajax_adapter; |
|
| 527 | - |
|
| 528 | - /** |
|
| 529 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 530 | - * |
|
| 531 | - * @since 3.16.0 |
|
| 532 | - * @access protected |
|
| 533 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 534 | - */ |
|
| 535 | - protected $google_analytics_export_service; |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * {@link Wordlift}'s singleton instance. |
|
| 539 | - * |
|
| 540 | - * @since 3.15.0 |
|
| 541 | - * @access protected |
|
| 542 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 543 | - */ |
|
| 544 | - protected $entity_type_adapter; |
|
| 545 | - |
|
| 546 | - /** |
|
| 547 | - * The {@link Wordlift_Storage_Factory} instance. |
|
| 548 | - * |
|
| 549 | - * @since 3.15.0 |
|
| 550 | - * @access protected |
|
| 551 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 552 | - */ |
|
| 553 | - protected $storage_factory; |
|
| 554 | - |
|
| 555 | - /** |
|
| 556 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 557 | - * |
|
| 558 | - * @since 3.15.0 |
|
| 559 | - * @access private |
|
| 560 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 561 | - */ |
|
| 562 | - private $autocomplete_adapter; |
|
| 563 | - |
|
| 564 | - /** |
|
| 565 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 566 | - * |
|
| 567 | - * @since 3.16.0 |
|
| 568 | - * @access protected |
|
| 569 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 570 | - */ |
|
| 571 | - protected $cached_postid_to_jsonld_converter; |
|
| 572 | - |
|
| 573 | - /** |
|
| 574 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 575 | - * |
|
| 576 | - * @since 3.16.3 |
|
| 577 | - * @access protected |
|
| 578 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 579 | - */ |
|
| 580 | - protected $entity_uri_service; |
|
| 581 | - |
|
| 582 | - /** |
|
| 583 | - * The {@link Wordlift_Publisher_Service} instance. |
|
| 584 | - * |
|
| 585 | - * @since 3.19.0 |
|
| 586 | - * @access protected |
|
| 587 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 588 | - */ |
|
| 589 | - protected $publisher_service; |
|
| 590 | - |
|
| 591 | - /** |
|
| 592 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 593 | - * |
|
| 594 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 595 | - */ |
|
| 596 | - protected $context_cards_service; |
|
| 597 | - |
|
| 598 | - /** |
|
| 599 | - * {@link Wordlift}'s singleton instance. |
|
| 600 | - * |
|
| 601 | - * @since 3.11.2 |
|
| 602 | - * @access private |
|
| 603 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 604 | - */ |
|
| 605 | - private static $instance; |
|
| 606 | - |
|
| 607 | - /** |
|
| 608 | - * A singleton instance of features registry. |
|
| 609 | - * |
|
| 610 | - * @since 3.30.0 |
|
| 611 | - * @var Features_Registry |
|
| 612 | - */ |
|
| 613 | - private $features_registry; |
|
| 614 | - |
|
| 615 | - private $analytics_settings_page; |
|
| 616 | - |
|
| 617 | - private $webhook_loader; |
|
| 618 | - |
|
| 619 | - /** |
|
| 620 | - * Define the core functionality of the plugin. |
|
| 621 | - * |
|
| 622 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 623 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 624 | - * the public-facing side of the site. |
|
| 625 | - * |
|
| 626 | - * @since 1.0.0 |
|
| 627 | - */ |
|
| 628 | - public function __construct() { |
|
| 629 | - |
|
| 630 | - self::$instance = $this; |
|
| 631 | - |
|
| 632 | - $this->plugin_name = 'wordlift'; |
|
| 633 | - $this->version = '3.39.0'; |
|
| 634 | - $this->load_dependencies(); |
|
| 635 | - $this->set_locale(); |
|
| 636 | - |
|
| 637 | - $that = $this; |
|
| 638 | - add_action( |
|
| 639 | - 'plugins_loaded', |
|
| 640 | - function () use ( $that ) { |
|
| 641 | - $that->define_admin_hooks( $that ); |
|
| 642 | - $that->define_public_hooks( $that ); |
|
| 643 | - }, |
|
| 644 | - 4 |
|
| 645 | - ); |
|
| 646 | - |
|
| 647 | - // If we're in `WP_CLI` load the related files. |
|
| 648 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 649 | - $this->load_cli_dependencies(); |
|
| 650 | - } |
|
| 651 | - |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - /** |
|
| 655 | - * Get the singleton instance. |
|
| 656 | - * |
|
| 657 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 658 | - * @since 3.11.2 |
|
| 659 | - */ |
|
| 660 | - public static function get_instance() { |
|
| 661 | - |
|
| 662 | - return self::$instance; |
|
| 663 | - } |
|
| 664 | - |
|
| 665 | - /** |
|
| 666 | - * Load the required dependencies for this plugin. |
|
| 667 | - * |
|
| 668 | - * Include the following files that make up the plugin: |
|
| 669 | - * |
|
| 670 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 671 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 672 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 673 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 674 | - * |
|
| 675 | - * Create an instance of the loader which will be used to register the hooks |
|
| 676 | - * with WordPress. |
|
| 677 | - * |
|
| 678 | - * @throws Exception when an error occurs. |
|
| 679 | - * @since 1.0.0 |
|
| 680 | - * @access private |
|
| 681 | - */ |
|
| 682 | - private function load_dependencies() { |
|
| 683 | - |
|
| 684 | - /** |
|
| 685 | - * The class responsible for orchestrating the actions and filters of the |
|
| 686 | - * core plugin. |
|
| 687 | - */ |
|
| 688 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
| 689 | - |
|
| 690 | - // The class responsible for plugin uninstall. |
|
| 691 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 692 | - |
|
| 693 | - /** |
|
| 694 | - * The class responsible for defining internationalization functionality |
|
| 695 | - * of the plugin. |
|
| 696 | - */ |
|
| 697 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
| 698 | - |
|
| 699 | - /** |
|
| 700 | - * WordLift's supported languages. |
|
| 701 | - */ |
|
| 702 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
| 703 | - |
|
| 704 | - /** |
|
| 705 | - * WordLift's supported countries. |
|
| 706 | - */ |
|
| 707 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
| 708 | - |
|
| 709 | - /** |
|
| 710 | - * Provide support functions to sanitize data. |
|
| 711 | - */ |
|
| 712 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 713 | - |
|
| 714 | - /** Services. */ |
|
| 715 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
| 716 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
| 717 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 718 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 719 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 720 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 721 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 722 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
| 723 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
| 724 | - |
|
| 725 | - /** |
|
| 726 | - * The Schema service. |
|
| 727 | - */ |
|
| 728 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
| 729 | - |
|
| 730 | - /** |
|
| 731 | - * The schema:url property service. |
|
| 732 | - */ |
|
| 733 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
| 734 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 735 | - |
|
| 736 | - /** |
|
| 737 | - * The UI service. |
|
| 738 | - */ |
|
| 739 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
| 740 | - |
|
| 741 | - /** |
|
| 742 | - * The Entity Types Taxonomy service. |
|
| 743 | - */ |
|
| 744 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 745 | - |
|
| 746 | - /** |
|
| 747 | - * The Entity service. |
|
| 748 | - */ |
|
| 749 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 750 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
| 751 | - |
|
| 752 | - // Add the entity rating service. |
|
| 753 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
| 754 | - |
|
| 755 | - /** |
|
| 756 | - * The User service. |
|
| 757 | - */ |
|
| 758 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
| 759 | - |
|
| 760 | - /** |
|
| 761 | - * The Timeline service. |
|
| 762 | - */ |
|
| 763 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 764 | - |
|
| 765 | - /** |
|
| 766 | - * The Topic Taxonomy service. |
|
| 767 | - */ |
|
| 768 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * The WordLift URI service. |
|
| 772 | - */ |
|
| 773 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
| 774 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
| 775 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 776 | - |
|
| 777 | - require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 778 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 779 | - |
|
| 780 | - /** |
|
| 781 | - * Load the converters. |
|
| 782 | - */ |
|
| 783 | - require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 784 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 785 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 786 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 787 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 788 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
| 789 | - |
|
| 790 | - /** |
|
| 791 | - * Load cache-related files. |
|
| 792 | - */ |
|
| 793 | - require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
| 794 | - |
|
| 795 | - /** |
|
| 796 | - * Load the content filter. |
|
| 797 | - */ |
|
| 798 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 799 | - |
|
| 800 | - /* |
|
| 85 | + /** |
|
| 86 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 87 | + * the plugin. |
|
| 88 | + * |
|
| 89 | + * @since 1.0.0 |
|
| 90 | + * @access protected |
|
| 91 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 92 | + */ |
|
| 93 | + protected $loader; |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * The unique identifier of this plugin. |
|
| 97 | + * |
|
| 98 | + * @since 1.0.0 |
|
| 99 | + * @access protected |
|
| 100 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 101 | + */ |
|
| 102 | + protected $plugin_name; |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * The current version of the plugin. |
|
| 106 | + * |
|
| 107 | + * @since 1.0.0 |
|
| 108 | + * @access protected |
|
| 109 | + * @var string $version The current version of the plugin. |
|
| 110 | + */ |
|
| 111 | + protected $version; |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 115 | + * |
|
| 116 | + * @since 3.12.0 |
|
| 117 | + * @access protected |
|
| 118 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 119 | + */ |
|
| 120 | + protected $tinymce_adapter; |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * The Schema service. |
|
| 124 | + * |
|
| 125 | + * @since 3.3.0 |
|
| 126 | + * @access protected |
|
| 127 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 128 | + */ |
|
| 129 | + protected $schema_service; |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * The Topic Taxonomy service. |
|
| 133 | + * |
|
| 134 | + * @since 3.5.0 |
|
| 135 | + * @access private |
|
| 136 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 137 | + */ |
|
| 138 | + private $topic_taxonomy_service; |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * The Entity Types Taxonomy service. |
|
| 142 | + * |
|
| 143 | + * @since 3.18.0 |
|
| 144 | + * @access private |
|
| 145 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
| 146 | + */ |
|
| 147 | + private $entity_types_taxonomy_service; |
|
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * The User service. |
|
| 151 | + * |
|
| 152 | + * @since 3.1.7 |
|
| 153 | + * @access protected |
|
| 154 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 155 | + */ |
|
| 156 | + protected $user_service; |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * The Timeline service. |
|
| 160 | + * |
|
| 161 | + * @since 3.1.0 |
|
| 162 | + * @access private |
|
| 163 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 164 | + */ |
|
| 165 | + private $timeline_service; |
|
| 166 | + |
|
| 167 | + /** |
|
| 168 | + * The Redirect service. |
|
| 169 | + * |
|
| 170 | + * @since 3.2.0 |
|
| 171 | + * @access private |
|
| 172 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 173 | + */ |
|
| 174 | + private $redirect_service; |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * The Notice service. |
|
| 178 | + * |
|
| 179 | + * @since 3.3.0 |
|
| 180 | + * @access private |
|
| 181 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 182 | + */ |
|
| 183 | + private $notice_service; |
|
| 184 | + |
|
| 185 | + /** |
|
| 186 | + * The Entity list customization. |
|
| 187 | + * |
|
| 188 | + * @since 3.3.0 |
|
| 189 | + * @access protected |
|
| 190 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 191 | + */ |
|
| 192 | + protected $entity_list_service; |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * The Entity Types Taxonomy Walker. |
|
| 196 | + * |
|
| 197 | + * @since 3.1.0 |
|
| 198 | + * @access private |
|
| 199 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 200 | + */ |
|
| 201 | + private $entity_types_taxonomy_walker; |
|
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * The ShareThis service. |
|
| 205 | + * |
|
| 206 | + * @since 3.2.0 |
|
| 207 | + * @access private |
|
| 208 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 209 | + */ |
|
| 210 | + private $sharethis_service; |
|
| 211 | + |
|
| 212 | + /** |
|
| 213 | + * The PrimaShop adapter. |
|
| 214 | + * |
|
| 215 | + * @since 3.2.3 |
|
| 216 | + * @access private |
|
| 217 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 218 | + */ |
|
| 219 | + private $primashop_adapter; |
|
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * The entity type service. |
|
| 223 | + * |
|
| 224 | + * @since 3.6.0 |
|
| 225 | + * @access private |
|
| 226 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 227 | + */ |
|
| 228 | + private $entity_post_type_service; |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 232 | + * |
|
| 233 | + * @since 3.6.0 |
|
| 234 | + * @access private |
|
| 235 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
| 236 | + */ |
|
| 237 | + private $entity_link_service; |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 241 | + * |
|
| 242 | + * @since 3.7.0 |
|
| 243 | + * @access protected |
|
| 244 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 245 | + */ |
|
| 246 | + protected $jsonld_service; |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 250 | + * |
|
| 251 | + * @since 3.14.0 |
|
| 252 | + * @access protected |
|
| 253 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 254 | + */ |
|
| 255 | + protected $jsonld_website_converter; |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * A {@link Wordlift_Property_Factory} instance. |
|
| 259 | + * |
|
| 260 | + * @since 3.7.0 |
|
| 261 | + * @access private |
|
| 262 | + * @var \Wordlift_Property_Factory $property_factory |
|
| 263 | + */ |
|
| 264 | + private $property_factory; |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * The 'Download Your Data' page. |
|
| 268 | + * |
|
| 269 | + * @since 3.6.0 |
|
| 270 | + * @access private |
|
| 271 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 272 | + */ |
|
| 273 | + private $download_your_data_page; |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * The 'WordLift Settings' page. |
|
| 277 | + * |
|
| 278 | + * @since 3.11.0 |
|
| 279 | + * @access protected |
|
| 280 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
| 281 | + */ |
|
| 282 | + protected $settings_page; |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * The install wizard page. |
|
| 286 | + * |
|
| 287 | + * @since 3.9.0 |
|
| 288 | + * @access private |
|
| 289 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
| 290 | + */ |
|
| 291 | + public $admin_setup; |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
| 295 | + * linking of entities to their pages. |
|
| 296 | + * |
|
| 297 | + * @since 3.8.0 |
|
| 298 | + * @access private |
|
| 299 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
| 300 | + */ |
|
| 301 | + private $content_filter_service; |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * The Faq Content filter service |
|
| 305 | + * |
|
| 306 | + * @since 3.26.0 |
|
| 307 | + * @access private |
|
| 308 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
| 309 | + */ |
|
| 310 | + private $faq_content_filter_service; |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 314 | + * |
|
| 315 | + * @since 3.9.0 |
|
| 316 | + * @access private |
|
| 317 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 318 | + */ |
|
| 319 | + private $key_validation_service; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 323 | + * |
|
| 324 | + * @since 3.10.0 |
|
| 325 | + * @access private |
|
| 326 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 327 | + */ |
|
| 328 | + private $rating_service; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 332 | + * |
|
| 333 | + * @since 3.10.0 |
|
| 334 | + * @access protected |
|
| 335 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 336 | + */ |
|
| 337 | + protected $post_to_jsonld_converter; |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * A {@link Wordlift_Install_Service} instance. |
|
| 341 | + * |
|
| 342 | + * @since 3.18.0 |
|
| 343 | + * @access protected |
|
| 344 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
| 345 | + */ |
|
| 346 | + protected $install_service; |
|
| 347 | + |
|
| 348 | + /** |
|
| 349 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 350 | + * |
|
| 351 | + * @since 3.10.0 |
|
| 352 | + * @access protected |
|
| 353 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
| 354 | + */ |
|
| 355 | + protected $entity_post_to_jsonld_converter; |
|
| 356 | + |
|
| 357 | + /** |
|
| 358 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 359 | + * |
|
| 360 | + * @since 3.10.0 |
|
| 361 | + * @access protected |
|
| 362 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
| 363 | + */ |
|
| 364 | + protected $postid_to_jsonld_converter; |
|
| 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_Entity_Page_Service} instance. |
|
| 377 | + * |
|
| 378 | + * @since 3.11.0 |
|
| 379 | + * @access protected |
|
| 380 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
| 381 | + */ |
|
| 382 | + protected $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_Admin_Settings_Page_Action_Link} class. |
|
| 395 | + * |
|
| 396 | + * @since 3.11.0 |
|
| 397 | + * @access protected |
|
| 398 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
| 399 | + */ |
|
| 400 | + protected $analytics_settings_page_action_link; |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * The {@link Wordlift_Analytics_Connect} class. |
|
| 404 | + * |
|
| 405 | + * @since 3.11.0 |
|
| 406 | + * @access protected |
|
| 407 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
| 408 | + */ |
|
| 409 | + protected $analytics_connect; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 413 | + * |
|
| 414 | + * @since 3.11.0 |
|
| 415 | + * @access protected |
|
| 416 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 417 | + */ |
|
| 418 | + protected $publisher_ajax_adapter; |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 422 | + * |
|
| 423 | + * @since 3.11.0 |
|
| 424 | + * @access protected |
|
| 425 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 426 | + */ |
|
| 427 | + protected $input_element; |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 431 | + * |
|
| 432 | + * @since 3.13.0 |
|
| 433 | + * @access protected |
|
| 434 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 435 | + */ |
|
| 436 | + protected $radio_input_element; |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 440 | + * |
|
| 441 | + * @since 3.11.0 |
|
| 442 | + * @access protected |
|
| 443 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 444 | + */ |
|
| 445 | + protected $language_select_element; |
|
| 446 | + |
|
| 447 | + /** |
|
| 448 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 449 | + * |
|
| 450 | + * @since 3.18.0 |
|
| 451 | + * @access protected |
|
| 452 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
| 453 | + */ |
|
| 454 | + protected $country_select_element; |
|
| 455 | + |
|
| 456 | + /** |
|
| 457 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 458 | + * |
|
| 459 | + * @since 3.11.0 |
|
| 460 | + * @access protected |
|
| 461 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 462 | + */ |
|
| 463 | + protected $publisher_element; |
|
| 464 | + |
|
| 465 | + /** |
|
| 466 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 467 | + * |
|
| 468 | + * @since 3.11.0 |
|
| 469 | + * @access protected |
|
| 470 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 471 | + */ |
|
| 472 | + protected $select2_element; |
|
| 473 | + |
|
| 474 | + /** |
|
| 475 | + * The controller for the entity type list admin page |
|
| 476 | + * |
|
| 477 | + * @since 3.11.0 |
|
| 478 | + * @access private |
|
| 479 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 480 | + */ |
|
| 481 | + private $entity_type_admin_page; |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * The controller for the entity type settings admin page |
|
| 485 | + * |
|
| 486 | + * @since 3.11.0 |
|
| 487 | + * @access private |
|
| 488 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 489 | + */ |
|
| 490 | + private $entity_type_settings_admin_page; |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 494 | + * |
|
| 495 | + * @since 3.11.0 |
|
| 496 | + * @access protected |
|
| 497 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 498 | + */ |
|
| 499 | + protected $related_entities_cloud_widget; |
|
| 500 | + |
|
| 501 | + /** |
|
| 502 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 503 | + * |
|
| 504 | + * @since 3.14.0 |
|
| 505 | + * @access protected |
|
| 506 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 507 | + */ |
|
| 508 | + protected $author_element; |
|
| 509 | + |
|
| 510 | + /** |
|
| 511 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
| 512 | + * |
|
| 513 | + * @since 3.12.0 |
|
| 514 | + * @access protected |
|
| 515 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
| 516 | + */ |
|
| 517 | + protected $sample_data_service; |
|
| 518 | + |
|
| 519 | + /** |
|
| 520 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 521 | + * |
|
| 522 | + * @since 3.12.0 |
|
| 523 | + * @access protected |
|
| 524 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
| 525 | + */ |
|
| 526 | + protected $sample_data_ajax_adapter; |
|
| 527 | + |
|
| 528 | + /** |
|
| 529 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 530 | + * |
|
| 531 | + * @since 3.16.0 |
|
| 532 | + * @access protected |
|
| 533 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
| 534 | + */ |
|
| 535 | + protected $google_analytics_export_service; |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * {@link Wordlift}'s singleton instance. |
|
| 539 | + * |
|
| 540 | + * @since 3.15.0 |
|
| 541 | + * @access protected |
|
| 542 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
| 543 | + */ |
|
| 544 | + protected $entity_type_adapter; |
|
| 545 | + |
|
| 546 | + /** |
|
| 547 | + * The {@link Wordlift_Storage_Factory} instance. |
|
| 548 | + * |
|
| 549 | + * @since 3.15.0 |
|
| 550 | + * @access protected |
|
| 551 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
| 552 | + */ |
|
| 553 | + protected $storage_factory; |
|
| 554 | + |
|
| 555 | + /** |
|
| 556 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 557 | + * |
|
| 558 | + * @since 3.15.0 |
|
| 559 | + * @access private |
|
| 560 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
| 561 | + */ |
|
| 562 | + private $autocomplete_adapter; |
|
| 563 | + |
|
| 564 | + /** |
|
| 565 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 566 | + * |
|
| 567 | + * @since 3.16.0 |
|
| 568 | + * @access protected |
|
| 569 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
| 570 | + */ |
|
| 571 | + protected $cached_postid_to_jsonld_converter; |
|
| 572 | + |
|
| 573 | + /** |
|
| 574 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 575 | + * |
|
| 576 | + * @since 3.16.3 |
|
| 577 | + * @access protected |
|
| 578 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
| 579 | + */ |
|
| 580 | + protected $entity_uri_service; |
|
| 581 | + |
|
| 582 | + /** |
|
| 583 | + * The {@link Wordlift_Publisher_Service} instance. |
|
| 584 | + * |
|
| 585 | + * @since 3.19.0 |
|
| 586 | + * @access protected |
|
| 587 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
| 588 | + */ |
|
| 589 | + protected $publisher_service; |
|
| 590 | + |
|
| 591 | + /** |
|
| 592 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
| 593 | + * |
|
| 594 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
| 595 | + */ |
|
| 596 | + protected $context_cards_service; |
|
| 597 | + |
|
| 598 | + /** |
|
| 599 | + * {@link Wordlift}'s singleton instance. |
|
| 600 | + * |
|
| 601 | + * @since 3.11.2 |
|
| 602 | + * @access private |
|
| 603 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 604 | + */ |
|
| 605 | + private static $instance; |
|
| 606 | + |
|
| 607 | + /** |
|
| 608 | + * A singleton instance of features registry. |
|
| 609 | + * |
|
| 610 | + * @since 3.30.0 |
|
| 611 | + * @var Features_Registry |
|
| 612 | + */ |
|
| 613 | + private $features_registry; |
|
| 614 | + |
|
| 615 | + private $analytics_settings_page; |
|
| 616 | + |
|
| 617 | + private $webhook_loader; |
|
| 618 | + |
|
| 619 | + /** |
|
| 620 | + * Define the core functionality of the plugin. |
|
| 621 | + * |
|
| 622 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 623 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 624 | + * the public-facing side of the site. |
|
| 625 | + * |
|
| 626 | + * @since 1.0.0 |
|
| 627 | + */ |
|
| 628 | + public function __construct() { |
|
| 629 | + |
|
| 630 | + self::$instance = $this; |
|
| 631 | + |
|
| 632 | + $this->plugin_name = 'wordlift'; |
|
| 633 | + $this->version = '3.39.0'; |
|
| 634 | + $this->load_dependencies(); |
|
| 635 | + $this->set_locale(); |
|
| 636 | + |
|
| 637 | + $that = $this; |
|
| 638 | + add_action( |
|
| 639 | + 'plugins_loaded', |
|
| 640 | + function () use ( $that ) { |
|
| 641 | + $that->define_admin_hooks( $that ); |
|
| 642 | + $that->define_public_hooks( $that ); |
|
| 643 | + }, |
|
| 644 | + 4 |
|
| 645 | + ); |
|
| 646 | + |
|
| 647 | + // If we're in `WP_CLI` load the related files. |
|
| 648 | + if ( class_exists( 'WP_CLI' ) ) { |
|
| 649 | + $this->load_cli_dependencies(); |
|
| 650 | + } |
|
| 651 | + |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + /** |
|
| 655 | + * Get the singleton instance. |
|
| 656 | + * |
|
| 657 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 658 | + * @since 3.11.2 |
|
| 659 | + */ |
|
| 660 | + public static function get_instance() { |
|
| 661 | + |
|
| 662 | + return self::$instance; |
|
| 663 | + } |
|
| 664 | + |
|
| 665 | + /** |
|
| 666 | + * Load the required dependencies for this plugin. |
|
| 667 | + * |
|
| 668 | + * Include the following files that make up the plugin: |
|
| 669 | + * |
|
| 670 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 671 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 672 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 673 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 674 | + * |
|
| 675 | + * Create an instance of the loader which will be used to register the hooks |
|
| 676 | + * with WordPress. |
|
| 677 | + * |
|
| 678 | + * @throws Exception when an error occurs. |
|
| 679 | + * @since 1.0.0 |
|
| 680 | + * @access private |
|
| 681 | + */ |
|
| 682 | + private function load_dependencies() { |
|
| 683 | + |
|
| 684 | + /** |
|
| 685 | + * The class responsible for orchestrating the actions and filters of the |
|
| 686 | + * core plugin. |
|
| 687 | + */ |
|
| 688 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
| 689 | + |
|
| 690 | + // The class responsible for plugin uninstall. |
|
| 691 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 692 | + |
|
| 693 | + /** |
|
| 694 | + * The class responsible for defining internationalization functionality |
|
| 695 | + * of the plugin. |
|
| 696 | + */ |
|
| 697 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
| 698 | + |
|
| 699 | + /** |
|
| 700 | + * WordLift's supported languages. |
|
| 701 | + */ |
|
| 702 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
| 703 | + |
|
| 704 | + /** |
|
| 705 | + * WordLift's supported countries. |
|
| 706 | + */ |
|
| 707 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
| 708 | + |
|
| 709 | + /** |
|
| 710 | + * Provide support functions to sanitize data. |
|
| 711 | + */ |
|
| 712 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 713 | + |
|
| 714 | + /** Services. */ |
|
| 715 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
| 716 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
| 717 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 718 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 719 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 720 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 721 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 722 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
| 723 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
| 724 | + |
|
| 725 | + /** |
|
| 726 | + * The Schema service. |
|
| 727 | + */ |
|
| 728 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
| 729 | + |
|
| 730 | + /** |
|
| 731 | + * The schema:url property service. |
|
| 732 | + */ |
|
| 733 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
| 734 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 735 | + |
|
| 736 | + /** |
|
| 737 | + * The UI service. |
|
| 738 | + */ |
|
| 739 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
| 740 | + |
|
| 741 | + /** |
|
| 742 | + * The Entity Types Taxonomy service. |
|
| 743 | + */ |
|
| 744 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 745 | + |
|
| 746 | + /** |
|
| 747 | + * The Entity service. |
|
| 748 | + */ |
|
| 749 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 750 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
| 751 | + |
|
| 752 | + // Add the entity rating service. |
|
| 753 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
| 754 | + |
|
| 755 | + /** |
|
| 756 | + * The User service. |
|
| 757 | + */ |
|
| 758 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
| 759 | + |
|
| 760 | + /** |
|
| 761 | + * The Timeline service. |
|
| 762 | + */ |
|
| 763 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 764 | + |
|
| 765 | + /** |
|
| 766 | + * The Topic Taxonomy service. |
|
| 767 | + */ |
|
| 768 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * The WordLift URI service. |
|
| 772 | + */ |
|
| 773 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
| 774 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
| 775 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 776 | + |
|
| 777 | + require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 778 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 779 | + |
|
| 780 | + /** |
|
| 781 | + * Load the converters. |
|
| 782 | + */ |
|
| 783 | + require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 784 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 785 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 786 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 787 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 788 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
| 789 | + |
|
| 790 | + /** |
|
| 791 | + * Load cache-related files. |
|
| 792 | + */ |
|
| 793 | + require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
| 794 | + |
|
| 795 | + /** |
|
| 796 | + * Load the content filter. |
|
| 797 | + */ |
|
| 798 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 799 | + |
|
| 800 | + /* |
|
| 801 | 801 | * Load the excerpt helper. |
| 802 | 802 | */ |
| 803 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 804 | - |
|
| 805 | - /** |
|
| 806 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 807 | - * |
|
| 808 | - * @since 3.8.0 |
|
| 809 | - */ |
|
| 810 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 811 | - |
|
| 812 | - // The Publisher Service and the AJAX adapter. |
|
| 813 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 814 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 815 | - |
|
| 816 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 817 | - |
|
| 818 | - /** |
|
| 819 | - * Load the WordLift key validation service. |
|
| 820 | - */ |
|
| 821 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 822 | - |
|
| 823 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 824 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 825 | - |
|
| 826 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 827 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 828 | - |
|
| 829 | - /** Linked Data. */ |
|
| 830 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 831 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 832 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 833 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 834 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 835 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 836 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 837 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 838 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 839 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 840 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 841 | - |
|
| 842 | - /** Services. */ |
|
| 843 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 844 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
| 845 | - |
|
| 846 | - /** Adapters. */ |
|
| 847 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 848 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 849 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 850 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 851 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 852 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
| 853 | - |
|
| 854 | - /** Autocomplete. */ |
|
| 855 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 856 | - |
|
| 857 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 858 | - |
|
| 859 | - /** Analytics */ |
|
| 860 | - require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
| 866 | - |
|
| 867 | - /** |
|
| 868 | - * The class to customize the entity list admin page. |
|
| 869 | - */ |
|
| 870 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
| 871 | - |
|
| 872 | - /** |
|
| 873 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 874 | - */ |
|
| 875 | - global $wp_version; |
|
| 876 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 877 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 878 | - } else { |
|
| 879 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 880 | - } |
|
| 881 | - |
|
| 882 | - /** |
|
| 883 | - * The Notice service. |
|
| 884 | - */ |
|
| 885 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
| 886 | - |
|
| 887 | - /** |
|
| 888 | - * The PrimaShop adapter. |
|
| 889 | - */ |
|
| 890 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 891 | - |
|
| 892 | - /** |
|
| 893 | - * The WordLift Dashboard service. |
|
| 894 | - */ |
|
| 895 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
| 896 | - |
|
| 897 | - /** |
|
| 898 | - * The admin 'Install wizard' page. |
|
| 899 | - */ |
|
| 900 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 901 | - |
|
| 902 | - /** |
|
| 903 | - * The WordLift entity type list admin page controller. |
|
| 904 | - */ |
|
| 905 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 906 | - |
|
| 907 | - /** |
|
| 908 | - * The WordLift entity type settings admin page controller. |
|
| 909 | - */ |
|
| 910 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
| 911 | - |
|
| 912 | - /** |
|
| 913 | - * The admin 'Download Your Data' page. |
|
| 914 | - */ |
|
| 915 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
| 916 | - |
|
| 917 | - /** |
|
| 918 | - * The admin 'WordLift Settings' page. |
|
| 919 | - */ |
|
| 920 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
| 923 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
| 931 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 935 | - |
|
| 936 | - /** Admin Pages */ |
|
| 937 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 939 | - |
|
| 940 | - /** |
|
| 941 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 942 | - * side of the site. |
|
| 943 | - */ |
|
| 944 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
| 945 | - |
|
| 946 | - /** |
|
| 947 | - * The shortcode abstract class. |
|
| 948 | - */ |
|
| 949 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
| 950 | - |
|
| 951 | - /** |
|
| 952 | - * The Timeline shortcode. |
|
| 953 | - */ |
|
| 954 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 955 | - |
|
| 956 | - /** |
|
| 957 | - * The Navigator shortcode. |
|
| 958 | - */ |
|
| 959 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 960 | - |
|
| 961 | - /** |
|
| 962 | - * The Products Navigator shortcode. |
|
| 963 | - */ |
|
| 964 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 965 | - |
|
| 966 | - /** |
|
| 967 | - * The chord shortcode. |
|
| 968 | - */ |
|
| 969 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 970 | - |
|
| 971 | - /** |
|
| 972 | - * The geomap shortcode. |
|
| 973 | - */ |
|
| 974 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 975 | - |
|
| 976 | - /** |
|
| 977 | - * The entity cloud shortcode. |
|
| 978 | - */ |
|
| 979 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 980 | - |
|
| 981 | - /** |
|
| 982 | - * The entity glossary shortcode. |
|
| 983 | - */ |
|
| 984 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 986 | - |
|
| 987 | - /** |
|
| 988 | - * Faceted Search shortcode. |
|
| 989 | - */ |
|
| 990 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 991 | - |
|
| 992 | - /** |
|
| 993 | - * The ShareThis service. |
|
| 994 | - */ |
|
| 995 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 996 | - |
|
| 997 | - /** |
|
| 998 | - * The SEO service. |
|
| 999 | - */ |
|
| 1000 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
| 1001 | - |
|
| 1002 | - /** |
|
| 1003 | - * The AMP service. |
|
| 1004 | - */ |
|
| 1005 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
| 1006 | - |
|
| 1007 | - /** Widgets */ |
|
| 1008 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
| 1009 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
| 1011 | - |
|
| 1012 | - /* |
|
| 803 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 804 | + |
|
| 805 | + /** |
|
| 806 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 807 | + * |
|
| 808 | + * @since 3.8.0 |
|
| 809 | + */ |
|
| 810 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 811 | + |
|
| 812 | + // The Publisher Service and the AJAX adapter. |
|
| 813 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 814 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 815 | + |
|
| 816 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 817 | + |
|
| 818 | + /** |
|
| 819 | + * Load the WordLift key validation service. |
|
| 820 | + */ |
|
| 821 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 822 | + |
|
| 823 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 824 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 825 | + |
|
| 826 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
| 827 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 828 | + |
|
| 829 | + /** Linked Data. */ |
|
| 830 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 831 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 832 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 833 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 834 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 835 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 836 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 837 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 838 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 839 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 840 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 841 | + |
|
| 842 | + /** Services. */ |
|
| 843 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 844 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
| 845 | + |
|
| 846 | + /** Adapters. */ |
|
| 847 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 848 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 849 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 850 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 851 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 852 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
| 853 | + |
|
| 854 | + /** Autocomplete. */ |
|
| 855 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 856 | + |
|
| 857 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 858 | + |
|
| 859 | + /** Analytics */ |
|
| 860 | + require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 861 | + |
|
| 862 | + /** |
|
| 863 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
| 866 | + |
|
| 867 | + /** |
|
| 868 | + * The class to customize the entity list admin page. |
|
| 869 | + */ |
|
| 870 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
| 871 | + |
|
| 872 | + /** |
|
| 873 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 874 | + */ |
|
| 875 | + global $wp_version; |
|
| 876 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 877 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 878 | + } else { |
|
| 879 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 880 | + } |
|
| 881 | + |
|
| 882 | + /** |
|
| 883 | + * The Notice service. |
|
| 884 | + */ |
|
| 885 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
| 886 | + |
|
| 887 | + /** |
|
| 888 | + * The PrimaShop adapter. |
|
| 889 | + */ |
|
| 890 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 891 | + |
|
| 892 | + /** |
|
| 893 | + * The WordLift Dashboard service. |
|
| 894 | + */ |
|
| 895 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
| 896 | + |
|
| 897 | + /** |
|
| 898 | + * The admin 'Install wizard' page. |
|
| 899 | + */ |
|
| 900 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 901 | + |
|
| 902 | + /** |
|
| 903 | + * The WordLift entity type list admin page controller. |
|
| 904 | + */ |
|
| 905 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 906 | + |
|
| 907 | + /** |
|
| 908 | + * The WordLift entity type settings admin page controller. |
|
| 909 | + */ |
|
| 910 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
| 911 | + |
|
| 912 | + /** |
|
| 913 | + * The admin 'Download Your Data' page. |
|
| 914 | + */ |
|
| 915 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
| 916 | + |
|
| 917 | + /** |
|
| 918 | + * The admin 'WordLift Settings' page. |
|
| 919 | + */ |
|
| 920 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
| 923 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
| 931 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 935 | + |
|
| 936 | + /** Admin Pages */ |
|
| 937 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 939 | + |
|
| 940 | + /** |
|
| 941 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 942 | + * side of the site. |
|
| 943 | + */ |
|
| 944 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
| 945 | + |
|
| 946 | + /** |
|
| 947 | + * The shortcode abstract class. |
|
| 948 | + */ |
|
| 949 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
| 950 | + |
|
| 951 | + /** |
|
| 952 | + * The Timeline shortcode. |
|
| 953 | + */ |
|
| 954 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 955 | + |
|
| 956 | + /** |
|
| 957 | + * The Navigator shortcode. |
|
| 958 | + */ |
|
| 959 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 960 | + |
|
| 961 | + /** |
|
| 962 | + * The Products Navigator shortcode. |
|
| 963 | + */ |
|
| 964 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 965 | + |
|
| 966 | + /** |
|
| 967 | + * The chord shortcode. |
|
| 968 | + */ |
|
| 969 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 970 | + |
|
| 971 | + /** |
|
| 972 | + * The geomap shortcode. |
|
| 973 | + */ |
|
| 974 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 975 | + |
|
| 976 | + /** |
|
| 977 | + * The entity cloud shortcode. |
|
| 978 | + */ |
|
| 979 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 980 | + |
|
| 981 | + /** |
|
| 982 | + * The entity glossary shortcode. |
|
| 983 | + */ |
|
| 984 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 986 | + |
|
| 987 | + /** |
|
| 988 | + * Faceted Search shortcode. |
|
| 989 | + */ |
|
| 990 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 991 | + |
|
| 992 | + /** |
|
| 993 | + * The ShareThis service. |
|
| 994 | + */ |
|
| 995 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 996 | + |
|
| 997 | + /** |
|
| 998 | + * The SEO service. |
|
| 999 | + */ |
|
| 1000 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
| 1001 | + |
|
| 1002 | + /** |
|
| 1003 | + * The AMP service. |
|
| 1004 | + */ |
|
| 1005 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
| 1006 | + |
|
| 1007 | + /** Widgets */ |
|
| 1008 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
| 1009 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
| 1011 | + |
|
| 1012 | + /* |
|
| 1013 | 1013 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
| 1014 | 1014 | * |
| 1015 | 1015 | * Eventually Batch Actions will become Batch Operations. |
| 1016 | 1016 | * |
| 1017 | 1017 | * @since 3.20.0 |
| 1018 | 1018 | */ |
| 1019 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1019 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1021 | 1021 | |
| 1022 | - /* |
|
| 1022 | + /* |
|
| 1023 | 1023 | * Schema.org Services. |
| 1024 | 1024 | * |
| 1025 | 1025 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1026 | 1026 | */ |
| 1027 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1028 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1029 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1030 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1031 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1032 | - new Wordlift_Schemaorg_Sync_Service(); |
|
| 1033 | - $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
| 1034 | - new Wordlift_Schemaorg_Class_Service(); |
|
| 1035 | - } else { |
|
| 1036 | - $schemaorg_property_service = null; |
|
| 1037 | - } |
|
| 1038 | - |
|
| 1039 | - $this->loader = new Wordlift_Loader(); |
|
| 1040 | - /** |
|
| 1041 | - * @since 3.30.0 |
|
| 1042 | - */ |
|
| 1043 | - $this->features_registry = Features_Registry::get_instance(); |
|
| 1044 | - |
|
| 1045 | - // Instantiate a global logger. |
|
| 1046 | - global $wl_logger; |
|
| 1047 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1048 | - |
|
| 1049 | - // Load the `wl-api` end-point. |
|
| 1050 | - new Wordlift_Http_Api(); |
|
| 1051 | - |
|
| 1052 | - // Load the Install Service. |
|
| 1053 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
| 1054 | - $this->install_service = new Wordlift_Install_Service(); |
|
| 1055 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1056 | - $this->user_service = Wordlift_User_Service::get_instance(); |
|
| 1057 | - // create an instance of the entity type list admin page controller. |
|
| 1058 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1059 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1060 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1061 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1062 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
| 1063 | - Wordlift_Entity_Service::TYPE_NAME, |
|
| 1064 | - Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
| 1065 | - ); |
|
| 1066 | - /* WordPress Admin. */ |
|
| 1067 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
| 1068 | - // create an instance of the entity type setting admin page controller. |
|
| 1069 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1070 | - |
|
| 1071 | - $that = $this; |
|
| 1072 | - add_action( |
|
| 1073 | - 'plugins_loaded', |
|
| 1074 | - // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
| 1075 | - function () use ( &$that, $schemaorg_property_service ) { |
|
| 1076 | - |
|
| 1077 | - /** Services. */ |
|
| 1078 | - // Create the configuration service. |
|
| 1079 | - new Wordlift_Api_Service(); |
|
| 1080 | - |
|
| 1081 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1082 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1083 | - |
|
| 1084 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
| 1085 | - |
|
| 1086 | - $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
| 1087 | - |
|
| 1088 | - // Create a new instance of the Redirect service. |
|
| 1089 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
| 1090 | - |
|
| 1091 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1092 | - $that->timeline_service = new Wordlift_Timeline_Service(); |
|
| 1093 | - |
|
| 1094 | - $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1095 | - |
|
| 1096 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1097 | - $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1098 | - |
|
| 1099 | - // Create an instance of the PrimaShop adapter. |
|
| 1100 | - $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1101 | - |
|
| 1102 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1103 | - |
|
| 1104 | - // Create the entity rating service. |
|
| 1105 | - $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
| 1106 | - |
|
| 1107 | - // Create entity list customization (wp-admin/edit.php). |
|
| 1108 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
| 1109 | - |
|
| 1110 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1111 | - $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
| 1112 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1113 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1114 | - |
|
| 1115 | - $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
| 1116 | - |
|
| 1117 | - // Instantiate the JSON-LD service. |
|
| 1118 | - $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
| 1119 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1120 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
| 1121 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
| 1122 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1123 | - |
|
| 1124 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1125 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
| 1126 | - /* |
|
| 1027 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1028 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1029 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1030 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1031 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1032 | + new Wordlift_Schemaorg_Sync_Service(); |
|
| 1033 | + $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
| 1034 | + new Wordlift_Schemaorg_Class_Service(); |
|
| 1035 | + } else { |
|
| 1036 | + $schemaorg_property_service = null; |
|
| 1037 | + } |
|
| 1038 | + |
|
| 1039 | + $this->loader = new Wordlift_Loader(); |
|
| 1040 | + /** |
|
| 1041 | + * @since 3.30.0 |
|
| 1042 | + */ |
|
| 1043 | + $this->features_registry = Features_Registry::get_instance(); |
|
| 1044 | + |
|
| 1045 | + // Instantiate a global logger. |
|
| 1046 | + global $wl_logger; |
|
| 1047 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1048 | + |
|
| 1049 | + // Load the `wl-api` end-point. |
|
| 1050 | + new Wordlift_Http_Api(); |
|
| 1051 | + |
|
| 1052 | + // Load the Install Service. |
|
| 1053 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
| 1054 | + $this->install_service = new Wordlift_Install_Service(); |
|
| 1055 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 1056 | + $this->user_service = Wordlift_User_Service::get_instance(); |
|
| 1057 | + // create an instance of the entity type list admin page controller. |
|
| 1058 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1059 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 1060 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
| 1061 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 1062 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
| 1063 | + Wordlift_Entity_Service::TYPE_NAME, |
|
| 1064 | + Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
| 1065 | + ); |
|
| 1066 | + /* WordPress Admin. */ |
|
| 1067 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
| 1068 | + // create an instance of the entity type setting admin page controller. |
|
| 1069 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1070 | + |
|
| 1071 | + $that = $this; |
|
| 1072 | + add_action( |
|
| 1073 | + 'plugins_loaded', |
|
| 1074 | + // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
| 1075 | + function () use ( &$that, $schemaorg_property_service ) { |
|
| 1076 | + |
|
| 1077 | + /** Services. */ |
|
| 1078 | + // Create the configuration service. |
|
| 1079 | + new Wordlift_Api_Service(); |
|
| 1080 | + |
|
| 1081 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 1082 | + $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1083 | + |
|
| 1084 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
| 1085 | + |
|
| 1086 | + $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
| 1087 | + |
|
| 1088 | + // Create a new instance of the Redirect service. |
|
| 1089 | + $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
| 1090 | + |
|
| 1091 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 1092 | + $that->timeline_service = new Wordlift_Timeline_Service(); |
|
| 1093 | + |
|
| 1094 | + $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 1095 | + |
|
| 1096 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 1097 | + $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 1098 | + |
|
| 1099 | + // Create an instance of the PrimaShop adapter. |
|
| 1100 | + $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 1101 | + |
|
| 1102 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1103 | + |
|
| 1104 | + // Create the entity rating service. |
|
| 1105 | + $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
| 1106 | + |
|
| 1107 | + // Create entity list customization (wp-admin/edit.php). |
|
| 1108 | + $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
| 1109 | + |
|
| 1110 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 1111 | + $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
| 1112 | + $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1113 | + $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1114 | + |
|
| 1115 | + $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
| 1116 | + |
|
| 1117 | + // Instantiate the JSON-LD service. |
|
| 1118 | + $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
| 1119 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1120 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
| 1121 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
| 1122 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1123 | + |
|
| 1124 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1125 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
| 1126 | + /* |
|
| 1127 | 1127 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1128 | 1128 | * |
| 1129 | 1129 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
| 1130 | 1130 | * |
| 1131 | 1131 | * @since 3.20.0 |
| 1132 | 1132 | */ |
| 1133 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1134 | - |
|
| 1135 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
| 1136 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
| 1137 | - |
|
| 1138 | - $jsonld_service = new Jsonld_Service( |
|
| 1139 | - $that->jsonld_service, |
|
| 1140 | - $term_jsonld_adapter, |
|
| 1141 | - new Jsonld_User_Service( $that->user_service ) |
|
| 1142 | - ); |
|
| 1143 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
| 1144 | - |
|
| 1145 | - // Prints the JSON-LD in the head. |
|
| 1146 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
| 1147 | - |
|
| 1148 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
| 1149 | - |
|
| 1150 | - /** |
|
| 1151 | - * @since 3.37.1 |
|
| 1152 | - * Add mentions property to the entity. |
|
| 1153 | - */ |
|
| 1154 | - new Mentions(); |
|
| 1155 | - |
|
| 1156 | - $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 1157 | - $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
| 1158 | - // Creating Faq Content filter service. |
|
| 1159 | - $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1160 | - $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
| 1161 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
| 1162 | - |
|
| 1163 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
| 1164 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
| 1165 | - |
|
| 1166 | - /** |
|
| 1167 | - * Filter: wl_feature__enable__blocks. |
|
| 1168 | - * |
|
| 1169 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1170 | - * |
|
| 1171 | - * @return bool |
|
| 1172 | - * @since 3.27.6 |
|
| 1173 | - */ |
|
| 1174 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1175 | - // Initialize the short-codes. |
|
| 1176 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1177 | - new Wordlift_Chord_Shortcode(); |
|
| 1178 | - new Wordlift_Geomap_Shortcode(); |
|
| 1179 | - new Wordlift_Timeline_Shortcode(); |
|
| 1180 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
| 1181 | - new Wordlift_Vocabulary_Shortcode(); |
|
| 1182 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1183 | - } |
|
| 1184 | - |
|
| 1185 | - new Wordlift_Products_Navigator_Shortcode(); |
|
| 1186 | - |
|
| 1187 | - // Initialize the Context Cards Service |
|
| 1188 | - $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1189 | - |
|
| 1190 | - // Initialize the SEO service. |
|
| 1191 | - new Wordlift_Seo_Service(); |
|
| 1192 | - |
|
| 1193 | - // Initialize the AMP service. |
|
| 1194 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
| 1195 | - |
|
| 1196 | - /** Services. */ |
|
| 1197 | - $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1198 | - new Wordlift_Image_Service(); |
|
| 1199 | - |
|
| 1200 | - /** Adapters. */ |
|
| 1201 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1202 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
| 1203 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
| 1204 | - |
|
| 1205 | - /* |
|
| 1133 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1134 | + |
|
| 1135 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
| 1136 | + $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
| 1137 | + |
|
| 1138 | + $jsonld_service = new Jsonld_Service( |
|
| 1139 | + $that->jsonld_service, |
|
| 1140 | + $term_jsonld_adapter, |
|
| 1141 | + new Jsonld_User_Service( $that->user_service ) |
|
| 1142 | + ); |
|
| 1143 | + new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
| 1144 | + |
|
| 1145 | + // Prints the JSON-LD in the head. |
|
| 1146 | + new Jsonld_Adapter( $that->jsonld_service ); |
|
| 1147 | + |
|
| 1148 | + new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
| 1149 | + |
|
| 1150 | + /** |
|
| 1151 | + * @since 3.37.1 |
|
| 1152 | + * Add mentions property to the entity. |
|
| 1153 | + */ |
|
| 1154 | + new Mentions(); |
|
| 1155 | + |
|
| 1156 | + $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 1157 | + $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
| 1158 | + // Creating Faq Content filter service. |
|
| 1159 | + $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
| 1160 | + $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
| 1161 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
| 1162 | + |
|
| 1163 | + $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
| 1164 | + $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
| 1165 | + |
|
| 1166 | + /** |
|
| 1167 | + * Filter: wl_feature__enable__blocks. |
|
| 1168 | + * |
|
| 1169 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1170 | + * |
|
| 1171 | + * @return bool |
|
| 1172 | + * @since 3.27.6 |
|
| 1173 | + */ |
|
| 1174 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1175 | + // Initialize the short-codes. |
|
| 1176 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1177 | + new Wordlift_Chord_Shortcode(); |
|
| 1178 | + new Wordlift_Geomap_Shortcode(); |
|
| 1179 | + new Wordlift_Timeline_Shortcode(); |
|
| 1180 | + new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
| 1181 | + new Wordlift_Vocabulary_Shortcode(); |
|
| 1182 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1183 | + } |
|
| 1184 | + |
|
| 1185 | + new Wordlift_Products_Navigator_Shortcode(); |
|
| 1186 | + |
|
| 1187 | + // Initialize the Context Cards Service |
|
| 1188 | + $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
| 1189 | + |
|
| 1190 | + // Initialize the SEO service. |
|
| 1191 | + new Wordlift_Seo_Service(); |
|
| 1192 | + |
|
| 1193 | + // Initialize the AMP service. |
|
| 1194 | + new Wordlift_AMP_Service( $that->jsonld_service ); |
|
| 1195 | + |
|
| 1196 | + /** Services. */ |
|
| 1197 | + $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
| 1198 | + new Wordlift_Image_Service(); |
|
| 1199 | + |
|
| 1200 | + /** Adapters. */ |
|
| 1201 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1202 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
| 1203 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
| 1204 | + |
|
| 1205 | + /* |
|
| 1206 | 1206 | * Exclude our public js from WP-Rocket. |
| 1207 | 1207 | * |
| 1208 | 1208 | * @since 3.19.4 |
| 1209 | 1209 | * |
| 1210 | 1210 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
| 1211 | 1211 | */ |
| 1212 | - new Wordlift_WpRocket_Adapter(); |
|
| 1212 | + new Wordlift_WpRocket_Adapter(); |
|
| 1213 | 1213 | |
| 1214 | - // Add support for NitroPack compatibility. |
|
| 1215 | - $nitropack_adapter = new Wordlift_NitroPack_Adapter(); |
|
| 1216 | - $nitropack_adapter->register_hooks(); |
|
| 1214 | + // Add support for NitroPack compatibility. |
|
| 1215 | + $nitropack_adapter = new Wordlift_NitroPack_Adapter(); |
|
| 1216 | + $nitropack_adapter->register_hooks(); |
|
| 1217 | 1217 | |
| 1218 | - /** WordPress Admin UI. */ |
|
| 1218 | + /** WordPress Admin UI. */ |
|
| 1219 | 1219 | |
| 1220 | - // UI elements. |
|
| 1221 | - $that->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1222 | - $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1223 | - $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1224 | - $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1225 | - $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1226 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1227 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
| 1228 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
| 1220 | + // UI elements. |
|
| 1221 | + $that->input_element = new Wordlift_Admin_Input_Element(); |
|
| 1222 | + $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 1223 | + $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 1224 | + $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 1225 | + $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
| 1226 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 1227 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
| 1228 | + $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
| 1229 | 1229 | |
| 1230 | - $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 1231 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
| 1230 | + $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
| 1231 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
| 1232 | 1232 | |
| 1233 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
| 1234 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
| 1235 | - $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1233 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
| 1234 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
| 1235 | + $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
| 1236 | 1236 | |
| 1237 | - // Pages. |
|
| 1238 | - /* |
|
| 1237 | + // Pages. |
|
| 1238 | + /* |
|
| 1239 | 1239 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
| 1240 | 1240 | * |
| 1241 | 1241 | * @since 3.20.3 |
| 1242 | 1242 | * |
| 1243 | 1243 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1244 | 1244 | */ |
| 1245 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1246 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1247 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
| 1248 | - } |
|
| 1249 | - new Wordlift_Entity_Type_Admin_Service(); |
|
| 1245 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1246 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1247 | + new Wordlift_Admin_Post_Edit_Page( $that ); |
|
| 1248 | + } |
|
| 1249 | + new Wordlift_Entity_Type_Admin_Service(); |
|
| 1250 | 1250 | |
| 1251 | - /** Widgets */ |
|
| 1252 | - $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1251 | + /** Widgets */ |
|
| 1252 | + $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1253 | 1253 | |
| 1254 | - // Create an instance of the install wizard. |
|
| 1255 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
| 1254 | + // Create an instance of the install wizard. |
|
| 1255 | + $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
| 1256 | 1256 | |
| 1257 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
| 1257 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
| 1258 | 1258 | |
| 1259 | - // User Profile. |
|
| 1260 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
| 1259 | + // User Profile. |
|
| 1260 | + new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
| 1261 | 1261 | |
| 1262 | - $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1262 | + $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
| 1263 | 1263 | |
| 1264 | - // Load the debug service if WP is in debug mode. |
|
| 1265 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1266 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1267 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
| 1268 | - } |
|
| 1264 | + // Load the debug service if WP is in debug mode. |
|
| 1265 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1266 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1267 | + new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
| 1268 | + } |
|
| 1269 | 1269 | |
| 1270 | - // Remote Image Service. |
|
| 1271 | - new Wordlift_Remote_Image_Service(); |
|
| 1270 | + // Remote Image Service. |
|
| 1271 | + new Wordlift_Remote_Image_Service(); |
|
| 1272 | 1272 | |
| 1273 | - /* |
|
| 1273 | + /* |
|
| 1274 | 1274 | * Provides mappings between post types and entity types. |
| 1275 | 1275 | * |
| 1276 | 1276 | * @since 3.20.0 |
| 1277 | 1277 | * |
| 1278 | 1278 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1279 | 1279 | */ |
| 1280 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1281 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1282 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1280 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1281 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1282 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1283 | 1283 | |
| 1284 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1285 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1284 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
| 1285 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1286 | 1286 | |
| 1287 | - /* |
|
| 1287 | + /* |
|
| 1288 | 1288 | * Load the Mappings JSON-LD post processing. |
| 1289 | 1289 | * |
| 1290 | 1290 | * @since 3.25.0 |
| 1291 | 1291 | */ |
| 1292 | 1292 | |
| 1293 | - $mappings_dbo = new Mappings_DBO(); |
|
| 1294 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1295 | - new Post_Type_Rule_Validator(); |
|
| 1296 | - // Taxonomy term rule validator for validating rules for term pages. |
|
| 1297 | - new Taxonomy_Term_Rule_Validator(); |
|
| 1298 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1299 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1300 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1301 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1302 | - |
|
| 1303 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
| 1304 | - new Taxonomy_To_Terms_Transform_Function(); |
|
| 1305 | - new Post_Id_To_Entity_Transform_Function(); |
|
| 1306 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1307 | - |
|
| 1308 | - /** |
|
| 1309 | - * @since 3.27.1 |
|
| 1310 | - * Intiailize the acf group data formatter. |
|
| 1311 | - */ |
|
| 1312 | - new Acf_Group_Formatter(); |
|
| 1313 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1314 | - |
|
| 1315 | - /** |
|
| 1316 | - * @since 3.26.0 |
|
| 1317 | - * Initialize the Faq JSON LD converter here - disabled. |
|
| 1318 | - */ |
|
| 1319 | - // new Faq_To_Jsonld_Converter(); |
|
| 1320 | - /* |
|
| 1293 | + $mappings_dbo = new Mappings_DBO(); |
|
| 1294 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
| 1295 | + new Post_Type_Rule_Validator(); |
|
| 1296 | + // Taxonomy term rule validator for validating rules for term pages. |
|
| 1297 | + new Taxonomy_Term_Rule_Validator(); |
|
| 1298 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
| 1299 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1300 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1301 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1302 | + |
|
| 1303 | + new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
| 1304 | + new Taxonomy_To_Terms_Transform_Function(); |
|
| 1305 | + new Post_Id_To_Entity_Transform_Function(); |
|
| 1306 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
| 1307 | + |
|
| 1308 | + /** |
|
| 1309 | + * @since 3.27.1 |
|
| 1310 | + * Intiailize the acf group data formatter. |
|
| 1311 | + */ |
|
| 1312 | + new Acf_Group_Formatter(); |
|
| 1313 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1314 | + |
|
| 1315 | + /** |
|
| 1316 | + * @since 3.26.0 |
|
| 1317 | + * Initialize the Faq JSON LD converter here - disabled. |
|
| 1318 | + */ |
|
| 1319 | + // new Faq_To_Jsonld_Converter(); |
|
| 1320 | + /* |
|
| 1321 | 1321 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
| 1322 | 1322 | * end-point. |
| 1323 | 1323 | * |
| 1324 | 1324 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
| 1325 | 1325 | * @since 3.24.4 |
| 1326 | 1326 | */ |
| 1327 | - new Templates_Ajax_Endpoint(); |
|
| 1328 | - // Call this static method to register FAQ routes to rest api - disabled |
|
| 1329 | - // Faq_Rest_Controller::register_routes(); |
|
| 1330 | - |
|
| 1331 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
| 1332 | - |
|
| 1333 | - /** WL Autocomplete. */ |
|
| 1334 | - $autocomplete_service = new All_Autocomplete_Service( |
|
| 1335 | - array( |
|
| 1336 | - new Local_Autocomplete_Service(), |
|
| 1337 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
| 1338 | - ) |
|
| 1339 | - ); |
|
| 1340 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1341 | - |
|
| 1342 | - /** |
|
| 1343 | - * @since 3.27.2 |
|
| 1344 | - * Integrate the recipe maker jsonld & set recipe |
|
| 1345 | - * as default entity type to the wprm_recipe CPT. |
|
| 1346 | - */ |
|
| 1347 | - new Recipe_Maker_Post_Type_Hook(); |
|
| 1348 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1349 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1350 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1351 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
| 1352 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1353 | - |
|
| 1354 | - new Duplicate_Markup_Remover(); |
|
| 1355 | - |
|
| 1356 | - /** |
|
| 1357 | - * @since 3.27.8 |
|
| 1358 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1359 | - */ |
|
| 1360 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
| 1361 | - /** |
|
| 1362 | - * @since 3.28.0 |
|
| 1363 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1364 | - */ |
|
| 1365 | - new Entity_No_Index_Flag(); |
|
| 1366 | - |
|
| 1367 | - /** |
|
| 1368 | - * @since 3.29.0 |
|
| 1369 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1370 | - */ |
|
| 1371 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1372 | - |
|
| 1373 | - /** |
|
| 1374 | - * Expand author in to references. |
|
| 1375 | - * |
|
| 1376 | - * @since 3.30.0 |
|
| 1377 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1378 | - */ |
|
| 1379 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1380 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1381 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1382 | - } |
|
| 1383 | - |
|
| 1384 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1385 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1386 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1387 | - $vocabulary_loader->init_vocabulary(); |
|
| 1388 | - } |
|
| 1389 | - |
|
| 1390 | - /** |
|
| 1391 | - * Added for feature request 1496 (Webhooks) |
|
| 1392 | - */ |
|
| 1393 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
| 1394 | - $that->webhook_loader = new Webhooks_Loader(); |
|
| 1395 | - $that->webhook_loader->init(); |
|
| 1396 | - } |
|
| 1397 | - |
|
| 1398 | - /** |
|
| 1399 | - * @since 3.30.0 |
|
| 1400 | - * Add a checkbox to user option screen for wordlift admin. |
|
| 1401 | - */ |
|
| 1402 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1403 | - $wordlift_admin_checkbox->connect_hook(); |
|
| 1404 | - |
|
| 1405 | - /** |
|
| 1406 | - * @since 3.31.0 |
|
| 1407 | - * Init loader class for videoobject. |
|
| 1408 | - */ |
|
| 1409 | - $videoobject_loader = new Loader(); |
|
| 1410 | - $videoobject_loader->init_feature(); |
|
| 1411 | - |
|
| 1412 | - /** |
|
| 1413 | - * @since 3.35.0 |
|
| 1414 | - */ |
|
| 1415 | - $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
| 1416 | - $google_addon_integration_loader->init_feature(); |
|
| 1417 | - |
|
| 1418 | - /** |
|
| 1419 | - * @since 3.31.5 |
|
| 1420 | - * Create configuration endpoint for webapp to configure. |
|
| 1421 | - */ |
|
| 1422 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
| 1423 | - /** |
|
| 1424 | - * @since 3.31.7 |
|
| 1425 | - * Remove duplicate videoobject. |
|
| 1426 | - */ |
|
| 1427 | - new Videoobject_Duplicate_Remover(); |
|
| 1428 | - $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
| 1429 | - $synonym_loader->init_feature(); |
|
| 1430 | - /** |
|
| 1431 | - * @since 3.32.0 |
|
| 1432 | - * Create loader for vocabulary terms. |
|
| 1433 | - */ |
|
| 1434 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
| 1435 | - $vocabulary_terms_loader->init_feature(); |
|
| 1436 | - |
|
| 1437 | - new Entity_Type_Change_Handler( |
|
| 1438 | - Wordlift_Entity_Service::get_instance(), |
|
| 1439 | - Wordlift_Entity_Type_Service::get_instance() |
|
| 1440 | - ); |
|
| 1441 | - |
|
| 1442 | - }, |
|
| 1443 | - 3 |
|
| 1444 | - ); |
|
| 1445 | - |
|
| 1446 | - new Entity_Type_Setter(); |
|
| 1447 | - $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
| 1448 | - $no_editor_analysis_loader->init_feature(); |
|
| 1449 | - } |
|
| 1450 | - |
|
| 1451 | - /** |
|
| 1452 | - * Define the locale for this plugin for internationalization. |
|
| 1453 | - * |
|
| 1454 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1455 | - * with WordPress. |
|
| 1456 | - * |
|
| 1457 | - * @since 1.0.0 |
|
| 1458 | - * @access private |
|
| 1459 | - */ |
|
| 1460 | - private function set_locale() { |
|
| 1461 | - |
|
| 1462 | - $plugin_i18n = new Wordlift_I18n(); |
|
| 1463 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1464 | - |
|
| 1465 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1466 | - |
|
| 1467 | - } |
|
| 1468 | - |
|
| 1469 | - /** |
|
| 1470 | - * Register all of the hooks related to the admin area functionality |
|
| 1471 | - * of the plugin. |
|
| 1472 | - * |
|
| 1473 | - * @since 1.0.0 |
|
| 1474 | - * @access private |
|
| 1475 | - */ |
|
| 1476 | - private function define_admin_hooks( $that ) { |
|
| 1477 | - $plugin_admin = new Wordlift_Admin( |
|
| 1478 | - $that->get_plugin_name(), |
|
| 1479 | - $that->get_version(), |
|
| 1480 | - $that->notice_service, |
|
| 1481 | - $that->user_service |
|
| 1482 | - ); |
|
| 1483 | - |
|
| 1484 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1486 | - |
|
| 1487 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1488 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
| 1489 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
| 1490 | - |
|
| 1491 | - // Hook the admin_init to the settings page. |
|
| 1492 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
| 1493 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
| 1494 | - |
|
| 1495 | - // Hook the admin_init to the analytics settings page. |
|
| 1496 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
| 1497 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
| 1498 | - |
|
| 1499 | - // Hook the init action to taxonomy services. |
|
| 1500 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
| 1501 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1502 | - |
|
| 1503 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1504 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1505 | - |
|
| 1506 | - // Register custom allowed redirect hosts. |
|
| 1507 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1508 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1509 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
| 1510 | - |
|
| 1511 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1512 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1513 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
| 1514 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1515 | - |
|
| 1516 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
| 1517 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
| 1518 | - |
|
| 1519 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1520 | - // Add custom columns. |
|
| 1521 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
| 1522 | - // no explicit entity as it prevents handling of other post types. |
|
| 1523 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1524 | - // Add 4W selection. |
|
| 1525 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1526 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1527 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
| 1528 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
| 1529 | - |
|
| 1530 | - /* |
|
| 1327 | + new Templates_Ajax_Endpoint(); |
|
| 1328 | + // Call this static method to register FAQ routes to rest api - disabled |
|
| 1329 | + // Faq_Rest_Controller::register_routes(); |
|
| 1330 | + |
|
| 1331 | + $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
| 1332 | + |
|
| 1333 | + /** WL Autocomplete. */ |
|
| 1334 | + $autocomplete_service = new All_Autocomplete_Service( |
|
| 1335 | + array( |
|
| 1336 | + new Local_Autocomplete_Service(), |
|
| 1337 | + new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
| 1338 | + ) |
|
| 1339 | + ); |
|
| 1340 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1341 | + |
|
| 1342 | + /** |
|
| 1343 | + * @since 3.27.2 |
|
| 1344 | + * Integrate the recipe maker jsonld & set recipe |
|
| 1345 | + * as default entity type to the wprm_recipe CPT. |
|
| 1346 | + */ |
|
| 1347 | + new Recipe_Maker_Post_Type_Hook(); |
|
| 1348 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
| 1349 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1350 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1351 | + new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
| 1352 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1353 | + |
|
| 1354 | + new Duplicate_Markup_Remover(); |
|
| 1355 | + |
|
| 1356 | + /** |
|
| 1357 | + * @since 3.27.8 |
|
| 1358 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
| 1359 | + */ |
|
| 1360 | + new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
| 1361 | + /** |
|
| 1362 | + * @since 3.28.0 |
|
| 1363 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
| 1364 | + */ |
|
| 1365 | + new Entity_No_Index_Flag(); |
|
| 1366 | + |
|
| 1367 | + /** |
|
| 1368 | + * @since 3.29.0 |
|
| 1369 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
| 1370 | + */ |
|
| 1371 | + new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1372 | + |
|
| 1373 | + /** |
|
| 1374 | + * Expand author in to references. |
|
| 1375 | + * |
|
| 1376 | + * @since 3.30.0 |
|
| 1377 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
| 1378 | + */ |
|
| 1379 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1380 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1381 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1382 | + } |
|
| 1383 | + |
|
| 1384 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1385 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1386 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
| 1387 | + $vocabulary_loader->init_vocabulary(); |
|
| 1388 | + } |
|
| 1389 | + |
|
| 1390 | + /** |
|
| 1391 | + * Added for feature request 1496 (Webhooks) |
|
| 1392 | + */ |
|
| 1393 | + if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
| 1394 | + $that->webhook_loader = new Webhooks_Loader(); |
|
| 1395 | + $that->webhook_loader->init(); |
|
| 1396 | + } |
|
| 1397 | + |
|
| 1398 | + /** |
|
| 1399 | + * @since 3.30.0 |
|
| 1400 | + * Add a checkbox to user option screen for wordlift admin. |
|
| 1401 | + */ |
|
| 1402 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
| 1403 | + $wordlift_admin_checkbox->connect_hook(); |
|
| 1404 | + |
|
| 1405 | + /** |
|
| 1406 | + * @since 3.31.0 |
|
| 1407 | + * Init loader class for videoobject. |
|
| 1408 | + */ |
|
| 1409 | + $videoobject_loader = new Loader(); |
|
| 1410 | + $videoobject_loader->init_feature(); |
|
| 1411 | + |
|
| 1412 | + /** |
|
| 1413 | + * @since 3.35.0 |
|
| 1414 | + */ |
|
| 1415 | + $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
| 1416 | + $google_addon_integration_loader->init_feature(); |
|
| 1417 | + |
|
| 1418 | + /** |
|
| 1419 | + * @since 3.31.5 |
|
| 1420 | + * Create configuration endpoint for webapp to configure. |
|
| 1421 | + */ |
|
| 1422 | + new Config( $that->admin_setup, $that->key_validation_service ); |
|
| 1423 | + /** |
|
| 1424 | + * @since 3.31.7 |
|
| 1425 | + * Remove duplicate videoobject. |
|
| 1426 | + */ |
|
| 1427 | + new Videoobject_Duplicate_Remover(); |
|
| 1428 | + $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
| 1429 | + $synonym_loader->init_feature(); |
|
| 1430 | + /** |
|
| 1431 | + * @since 3.32.0 |
|
| 1432 | + * Create loader for vocabulary terms. |
|
| 1433 | + */ |
|
| 1434 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
| 1435 | + $vocabulary_terms_loader->init_feature(); |
|
| 1436 | + |
|
| 1437 | + new Entity_Type_Change_Handler( |
|
| 1438 | + Wordlift_Entity_Service::get_instance(), |
|
| 1439 | + Wordlift_Entity_Type_Service::get_instance() |
|
| 1440 | + ); |
|
| 1441 | + |
|
| 1442 | + }, |
|
| 1443 | + 3 |
|
| 1444 | + ); |
|
| 1445 | + |
|
| 1446 | + new Entity_Type_Setter(); |
|
| 1447 | + $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
| 1448 | + $no_editor_analysis_loader->init_feature(); |
|
| 1449 | + } |
|
| 1450 | + |
|
| 1451 | + /** |
|
| 1452 | + * Define the locale for this plugin for internationalization. |
|
| 1453 | + * |
|
| 1454 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1455 | + * with WordPress. |
|
| 1456 | + * |
|
| 1457 | + * @since 1.0.0 |
|
| 1458 | + * @access private |
|
| 1459 | + */ |
|
| 1460 | + private function set_locale() { |
|
| 1461 | + |
|
| 1462 | + $plugin_i18n = new Wordlift_I18n(); |
|
| 1463 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1464 | + |
|
| 1465 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1466 | + |
|
| 1467 | + } |
|
| 1468 | + |
|
| 1469 | + /** |
|
| 1470 | + * Register all of the hooks related to the admin area functionality |
|
| 1471 | + * of the plugin. |
|
| 1472 | + * |
|
| 1473 | + * @since 1.0.0 |
|
| 1474 | + * @access private |
|
| 1475 | + */ |
|
| 1476 | + private function define_admin_hooks( $that ) { |
|
| 1477 | + $plugin_admin = new Wordlift_Admin( |
|
| 1478 | + $that->get_plugin_name(), |
|
| 1479 | + $that->get_version(), |
|
| 1480 | + $that->notice_service, |
|
| 1481 | + $that->user_service |
|
| 1482 | + ); |
|
| 1483 | + |
|
| 1484 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1486 | + |
|
| 1487 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1488 | + Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
| 1489 | + $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
| 1490 | + |
|
| 1491 | + // Hook the admin_init to the settings page. |
|
| 1492 | + Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
| 1493 | + $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
| 1494 | + |
|
| 1495 | + // Hook the admin_init to the analytics settings page. |
|
| 1496 | + Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
| 1497 | + $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
| 1498 | + |
|
| 1499 | + // Hook the init action to taxonomy services. |
|
| 1500 | + $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
| 1501 | + $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1502 | + |
|
| 1503 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1504 | + $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1505 | + |
|
| 1506 | + // Register custom allowed redirect hosts. |
|
| 1507 | + $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1508 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1509 | + $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
| 1510 | + |
|
| 1511 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1512 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1513 | + $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
| 1514 | + $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1515 | + |
|
| 1516 | + $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
| 1517 | + $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
| 1518 | + |
|
| 1519 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1520 | + // Add custom columns. |
|
| 1521 | + $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
| 1522 | + // no explicit entity as it prevents handling of other post types. |
|
| 1523 | + $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1524 | + // Add 4W selection. |
|
| 1525 | + $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1526 | + $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1527 | + $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
| 1528 | + $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
| 1529 | + |
|
| 1530 | + /* |
|
| 1531 | 1531 | * If `All Entity Types` is disable, use the radio button Walker. |
| 1532 | 1532 | * |
| 1533 | 1533 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1534 | 1534 | */ |
| 1535 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1536 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
| 1537 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1538 | - || apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
| 1539 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1540 | - || apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
| 1541 | - ) { |
|
| 1542 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1543 | - } |
|
| 1544 | - |
|
| 1545 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1546 | - // entities. |
|
| 1547 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
| 1548 | - |
|
| 1549 | - /** |
|
| 1550 | - * Filter: wl_feature__enable__settings-download. |
|
| 1551 | - * |
|
| 1552 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1553 | - * |
|
| 1554 | - * @return bool |
|
| 1555 | - * @since 3.27.6 |
|
| 1556 | - */ |
|
| 1557 | - $that->features_registry->register_feature_from_slug( |
|
| 1558 | - 'settings-download', |
|
| 1559 | - true, |
|
| 1560 | - array( |
|
| 1561 | - $that, |
|
| 1562 | - 'register_screens', |
|
| 1563 | - ) |
|
| 1564 | - ); |
|
| 1565 | - |
|
| 1566 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1567 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
| 1568 | - |
|
| 1569 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1570 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1571 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1572 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1573 | - |
|
| 1574 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1575 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
| 1576 | - |
|
| 1577 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1578 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
| 1579 | - |
|
| 1580 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
| 1581 | - |
|
| 1582 | - // Hook the menu creation on the general wordlift menu creation. |
|
| 1583 | - /** |
|
| 1584 | - * Filter: wl_feature__enable__screens. |
|
| 1585 | - * |
|
| 1586 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1587 | - * |
|
| 1588 | - * @return bool |
|
| 1589 | - * @since 3.27.6 |
|
| 1590 | - * |
|
| 1591 | - * Since 3.30.0 this feature is registered using registry. |
|
| 1592 | - */ |
|
| 1593 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1594 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1595 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1596 | - } |
|
| 1597 | - |
|
| 1598 | - // Hook key update. |
|
| 1599 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1600 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
| 1601 | - |
|
| 1602 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1603 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1604 | - |
|
| 1605 | - /* |
|
| 1535 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1536 | + if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
| 1537 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1538 | + || apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
| 1539 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1540 | + || apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
| 1541 | + ) { |
|
| 1542 | + $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1543 | + } |
|
| 1544 | + |
|
| 1545 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1546 | + // entities. |
|
| 1547 | + $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
| 1548 | + |
|
| 1549 | + /** |
|
| 1550 | + * Filter: wl_feature__enable__settings-download. |
|
| 1551 | + * |
|
| 1552 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1553 | + * |
|
| 1554 | + * @return bool |
|
| 1555 | + * @since 3.27.6 |
|
| 1556 | + */ |
|
| 1557 | + $that->features_registry->register_feature_from_slug( |
|
| 1558 | + 'settings-download', |
|
| 1559 | + true, |
|
| 1560 | + array( |
|
| 1561 | + $that, |
|
| 1562 | + 'register_screens', |
|
| 1563 | + ) |
|
| 1564 | + ); |
|
| 1565 | + |
|
| 1566 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1567 | + $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
| 1568 | + |
|
| 1569 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1570 | + $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1571 | + $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1572 | + $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1573 | + |
|
| 1574 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1575 | + $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
| 1576 | + |
|
| 1577 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
| 1578 | + $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
| 1579 | + |
|
| 1580 | + $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
| 1581 | + |
|
| 1582 | + // Hook the menu creation on the general wordlift menu creation. |
|
| 1583 | + /** |
|
| 1584 | + * Filter: wl_feature__enable__screens. |
|
| 1585 | + * |
|
| 1586 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
| 1587 | + * |
|
| 1588 | + * @return bool |
|
| 1589 | + * @since 3.27.6 |
|
| 1590 | + * |
|
| 1591 | + * Since 3.30.0 this feature is registered using registry. |
|
| 1592 | + */ |
|
| 1593 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1594 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1595 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1596 | + } |
|
| 1597 | + |
|
| 1598 | + // Hook key update. |
|
| 1599 | + $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1600 | + $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
| 1601 | + |
|
| 1602 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1603 | + $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1604 | + |
|
| 1605 | + /* |
|
| 1606 | 1606 | * Remove the Analytics Settings link from the plugin page. |
| 1607 | 1607 | * |
| 1608 | 1608 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
| 1609 | 1609 | * @since 3.21.1 |
| 1610 | 1610 | */ |
| 1611 | - // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1612 | - |
|
| 1613 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1614 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
| 1615 | - |
|
| 1616 | - // Hook row actions for the entity type list admin. |
|
| 1617 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1618 | - |
|
| 1619 | - /** Ajax actions. */ |
|
| 1620 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
| 1621 | - |
|
| 1622 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1623 | - // page on WordPress versions before 4.7. |
|
| 1624 | - global $wp_version; |
|
| 1625 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1626 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
| 1627 | - } |
|
| 1628 | - |
|
| 1629 | - /** Adapters. */ |
|
| 1630 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1631 | - /** |
|
| 1632 | - * Disabling Faq temporarily. |
|
| 1633 | - * Load the tinymce editor button on the tool bar. |
|
| 1634 | - * |
|
| 1635 | - * @since 3.26.0 |
|
| 1636 | - */ |
|
| 1637 | - // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1638 | - // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1639 | - // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1640 | - |
|
| 1641 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
| 1642 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
| 1643 | - |
|
| 1644 | - /** |
|
| 1645 | - * @since 3.26.0 |
|
| 1646 | - */ |
|
| 1647 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1648 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1649 | - // Adding Rest route for the post excerpt |
|
| 1650 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1651 | - |
|
| 1652 | - // Handle the autocomplete request. |
|
| 1653 | - add_action( |
|
| 1654 | - 'wp_ajax_wl_autocomplete', |
|
| 1655 | - array( |
|
| 1656 | - $that->autocomplete_adapter, |
|
| 1657 | - 'wl_autocomplete', |
|
| 1658 | - ) |
|
| 1659 | - ); |
|
| 1660 | - add_action( |
|
| 1661 | - 'wp_ajax_nopriv_wl_autocomplete', |
|
| 1662 | - array( |
|
| 1663 | - $that->autocomplete_adapter, |
|
| 1664 | - 'wl_autocomplete', |
|
| 1665 | - ) |
|
| 1666 | - ); |
|
| 1667 | - |
|
| 1668 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1669 | - if ( is_multisite() ) { |
|
| 1670 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
| 1671 | - } |
|
| 1672 | - |
|
| 1673 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
| 1674 | - |
|
| 1675 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1676 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1677 | - add_action( |
|
| 1678 | - 'wp_ajax_wl_deactivation_feedback', |
|
| 1679 | - array( |
|
| 1680 | - $deactivator_feedback, |
|
| 1681 | - 'wl_deactivation_feedback', |
|
| 1682 | - ) |
|
| 1683 | - ); |
|
| 1684 | - |
|
| 1685 | - /** |
|
| 1686 | - * Always allow the `wordlift/classification` block. |
|
| 1687 | - * |
|
| 1688 | - * @since 3.23.0 |
|
| 1689 | - */ |
|
| 1690 | - add_filter( |
|
| 1691 | - 'allowed_block_types', |
|
| 1692 | - function ( $value ) { |
|
| 1693 | - |
|
| 1694 | - if ( true === $value ) { |
|
| 1695 | - return $value; |
|
| 1696 | - } |
|
| 1697 | - |
|
| 1698 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1699 | - }, |
|
| 1700 | - PHP_INT_MAX |
|
| 1701 | - ); |
|
| 1702 | - |
|
| 1703 | - /** |
|
| 1704 | - * @since 3.27.7 |
|
| 1705 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1706 | - */ |
|
| 1707 | - new Top_Entities(); |
|
| 1708 | - |
|
| 1709 | - } |
|
| 1710 | - |
|
| 1711 | - /** |
|
| 1712 | - * Register all of the hooks related to the public-facing functionality |
|
| 1713 | - * of the plugin. |
|
| 1714 | - * |
|
| 1715 | - * @since 1.0.0 |
|
| 1716 | - * @access private |
|
| 1717 | - */ |
|
| 1718 | - private function define_public_hooks( $that ) { |
|
| 1719 | - |
|
| 1720 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
| 1721 | - |
|
| 1722 | - // Register the entity post type. |
|
| 1723 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
| 1724 | - |
|
| 1725 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1726 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
| 1727 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1728 | - |
|
| 1729 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1730 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1731 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
| 1732 | - |
|
| 1733 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1734 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1735 | - // Hook the content filter service to add entity links. |
|
| 1736 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1737 | - // We run before other filters. |
|
| 1738 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
| 1739 | - } |
|
| 1740 | - |
|
| 1741 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1742 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1743 | - |
|
| 1744 | - // Hook the ShareThis service. |
|
| 1745 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
| 1746 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
| 1747 | - |
|
| 1748 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1749 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1750 | - |
|
| 1751 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1752 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1753 | - // to categories. |
|
| 1754 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1755 | - |
|
| 1756 | - /* |
|
| 1611 | + // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1612 | + |
|
| 1613 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1614 | + $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
| 1615 | + |
|
| 1616 | + // Hook row actions for the entity type list admin. |
|
| 1617 | + $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1618 | + |
|
| 1619 | + /** Ajax actions. */ |
|
| 1620 | + $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
| 1621 | + |
|
| 1622 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1623 | + // page on WordPress versions before 4.7. |
|
| 1624 | + global $wp_version; |
|
| 1625 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1626 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
| 1627 | + } |
|
| 1628 | + |
|
| 1629 | + /** Adapters. */ |
|
| 1630 | + $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1631 | + /** |
|
| 1632 | + * Disabling Faq temporarily. |
|
| 1633 | + * Load the tinymce editor button on the tool bar. |
|
| 1634 | + * |
|
| 1635 | + * @since 3.26.0 |
|
| 1636 | + */ |
|
| 1637 | + // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
| 1638 | + // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
| 1639 | + // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
| 1640 | + |
|
| 1641 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
| 1642 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
| 1643 | + |
|
| 1644 | + /** |
|
| 1645 | + * @since 3.26.0 |
|
| 1646 | + */ |
|
| 1647 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
| 1648 | + $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1649 | + // Adding Rest route for the post excerpt |
|
| 1650 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
| 1651 | + |
|
| 1652 | + // Handle the autocomplete request. |
|
| 1653 | + add_action( |
|
| 1654 | + 'wp_ajax_wl_autocomplete', |
|
| 1655 | + array( |
|
| 1656 | + $that->autocomplete_adapter, |
|
| 1657 | + 'wl_autocomplete', |
|
| 1658 | + ) |
|
| 1659 | + ); |
|
| 1660 | + add_action( |
|
| 1661 | + 'wp_ajax_nopriv_wl_autocomplete', |
|
| 1662 | + array( |
|
| 1663 | + $that->autocomplete_adapter, |
|
| 1664 | + 'wl_autocomplete', |
|
| 1665 | + ) |
|
| 1666 | + ); |
|
| 1667 | + |
|
| 1668 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1669 | + if ( is_multisite() ) { |
|
| 1670 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
| 1671 | + } |
|
| 1672 | + |
|
| 1673 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
| 1674 | + |
|
| 1675 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1676 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1677 | + add_action( |
|
| 1678 | + 'wp_ajax_wl_deactivation_feedback', |
|
| 1679 | + array( |
|
| 1680 | + $deactivator_feedback, |
|
| 1681 | + 'wl_deactivation_feedback', |
|
| 1682 | + ) |
|
| 1683 | + ); |
|
| 1684 | + |
|
| 1685 | + /** |
|
| 1686 | + * Always allow the `wordlift/classification` block. |
|
| 1687 | + * |
|
| 1688 | + * @since 3.23.0 |
|
| 1689 | + */ |
|
| 1690 | + add_filter( |
|
| 1691 | + 'allowed_block_types', |
|
| 1692 | + function ( $value ) { |
|
| 1693 | + |
|
| 1694 | + if ( true === $value ) { |
|
| 1695 | + return $value; |
|
| 1696 | + } |
|
| 1697 | + |
|
| 1698 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1699 | + }, |
|
| 1700 | + PHP_INT_MAX |
|
| 1701 | + ); |
|
| 1702 | + |
|
| 1703 | + /** |
|
| 1704 | + * @since 3.27.7 |
|
| 1705 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
| 1706 | + */ |
|
| 1707 | + new Top_Entities(); |
|
| 1708 | + |
|
| 1709 | + } |
|
| 1710 | + |
|
| 1711 | + /** |
|
| 1712 | + * Register all of the hooks related to the public-facing functionality |
|
| 1713 | + * of the plugin. |
|
| 1714 | + * |
|
| 1715 | + * @since 1.0.0 |
|
| 1716 | + * @access private |
|
| 1717 | + */ |
|
| 1718 | + private function define_public_hooks( $that ) { |
|
| 1719 | + |
|
| 1720 | + $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
| 1721 | + |
|
| 1722 | + // Register the entity post type. |
|
| 1723 | + $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
| 1724 | + |
|
| 1725 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1726 | + $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
| 1727 | + $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1728 | + |
|
| 1729 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1730 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1731 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
| 1732 | + |
|
| 1733 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
| 1734 | + $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1735 | + // Hook the content filter service to add entity links. |
|
| 1736 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1737 | + // We run before other filters. |
|
| 1738 | + $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
| 1739 | + } |
|
| 1740 | + |
|
| 1741 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1742 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1743 | + |
|
| 1744 | + // Hook the ShareThis service. |
|
| 1745 | + $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
| 1746 | + $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
| 1747 | + |
|
| 1748 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1749 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1750 | + |
|
| 1751 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1752 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1753 | + // to categories. |
|
| 1754 | + $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1755 | + |
|
| 1756 | + /* |
|
| 1757 | 1757 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1758 | 1758 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1759 | 1759 | * order of start time. |
| 1760 | 1760 | */ |
| 1761 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1762 | - |
|
| 1763 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1764 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
| 1765 | - |
|
| 1766 | - // Analytics Script Frontend. |
|
| 1767 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
| 1768 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1769 | - } |
|
| 1770 | - |
|
| 1771 | - } |
|
| 1772 | - |
|
| 1773 | - /** |
|
| 1774 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1775 | - * |
|
| 1776 | - * @since 1.0.0 |
|
| 1777 | - */ |
|
| 1778 | - public function run() { |
|
| 1779 | - $this->loader->run(); |
|
| 1780 | - } |
|
| 1781 | - |
|
| 1782 | - /** |
|
| 1783 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1784 | - * WordPress and to define internationalization functionality. |
|
| 1785 | - * |
|
| 1786 | - * @return string The name of the plugin. |
|
| 1787 | - * @since 1.0.0 |
|
| 1788 | - */ |
|
| 1789 | - public function get_plugin_name() { |
|
| 1790 | - return $this->plugin_name; |
|
| 1791 | - } |
|
| 1792 | - |
|
| 1793 | - /** |
|
| 1794 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1795 | - * |
|
| 1796 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1797 | - * @since 1.0.0 |
|
| 1798 | - */ |
|
| 1799 | - public function get_loader() { |
|
| 1800 | - return $this->loader; |
|
| 1801 | - } |
|
| 1802 | - |
|
| 1803 | - /** |
|
| 1804 | - * Retrieve the version number of the plugin. |
|
| 1805 | - * |
|
| 1806 | - * @return string The version number of the plugin. |
|
| 1807 | - * @since 1.0.0 |
|
| 1808 | - */ |
|
| 1809 | - public function get_version() { |
|
| 1810 | - return $this->version; |
|
| 1811 | - } |
|
| 1812 | - |
|
| 1813 | - /** |
|
| 1814 | - * Load dependencies for WP-CLI. |
|
| 1815 | - * |
|
| 1816 | - * @throws Exception when an error occurs. |
|
| 1817 | - * @since 3.18.0 |
|
| 1818 | - */ |
|
| 1819 | - private function load_cli_dependencies() { |
|
| 1820 | - |
|
| 1821 | - } |
|
| 1822 | - |
|
| 1823 | - public function add_wl_enabled_blocks() { |
|
| 1824 | - /** |
|
| 1825 | - * Filter: wl_feature__enable__blocks. |
|
| 1826 | - * |
|
| 1827 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1828 | - * |
|
| 1829 | - * @return bool |
|
| 1830 | - * @since 3.27.6 |
|
| 1831 | - */ |
|
| 1832 | - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
| 1833 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1834 | - |
|
| 1835 | - $enabled_blocks = array(); |
|
| 1836 | - |
|
| 1837 | - /** |
|
| 1838 | - * Filter name: wl_feature__enable__product-navigator |
|
| 1839 | - * |
|
| 1840 | - * @since 3.32.3 |
|
| 1841 | - */ |
|
| 1842 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1843 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
| 1844 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 1845 | - } |
|
| 1846 | - |
|
| 1847 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1848 | - // To intimate JS |
|
| 1849 | - $enabled_blocks = array_merge( |
|
| 1850 | - $enabled_blocks, |
|
| 1851 | - array( |
|
| 1852 | - 'wordlift/navigator', |
|
| 1853 | - 'wordlift/chord', |
|
| 1854 | - 'wordlift/geomap', |
|
| 1855 | - 'wordlift/timeline', |
|
| 1856 | - 'wordlift/cloud', |
|
| 1857 | - 'wordlift/vocabulary', |
|
| 1858 | - 'wordlift/faceted-search', |
|
| 1859 | - ) |
|
| 1860 | - ); |
|
| 1861 | - } |
|
| 1862 | - |
|
| 1863 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1864 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1865 | - } |
|
| 1866 | - |
|
| 1867 | - /** |
|
| 1868 | - * Register screens based on the filter. |
|
| 1869 | - */ |
|
| 1870 | - public function register_screens() { |
|
| 1871 | - // Hook the menu to the Download Your Data page. |
|
| 1872 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1873 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 1874 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
| 1875 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 1876 | - } |
|
| 1877 | - |
|
| 1878 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
| 1879 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 1880 | - |
|
| 1881 | - } |
|
| 1761 | + $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1762 | + |
|
| 1763 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
| 1764 | + $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
| 1765 | + |
|
| 1766 | + // Analytics Script Frontend. |
|
| 1767 | + if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
| 1768 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1769 | + } |
|
| 1770 | + |
|
| 1771 | + } |
|
| 1772 | + |
|
| 1773 | + /** |
|
| 1774 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1775 | + * |
|
| 1776 | + * @since 1.0.0 |
|
| 1777 | + */ |
|
| 1778 | + public function run() { |
|
| 1779 | + $this->loader->run(); |
|
| 1780 | + } |
|
| 1781 | + |
|
| 1782 | + /** |
|
| 1783 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1784 | + * WordPress and to define internationalization functionality. |
|
| 1785 | + * |
|
| 1786 | + * @return string The name of the plugin. |
|
| 1787 | + * @since 1.0.0 |
|
| 1788 | + */ |
|
| 1789 | + public function get_plugin_name() { |
|
| 1790 | + return $this->plugin_name; |
|
| 1791 | + } |
|
| 1792 | + |
|
| 1793 | + /** |
|
| 1794 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1795 | + * |
|
| 1796 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1797 | + * @since 1.0.0 |
|
| 1798 | + */ |
|
| 1799 | + public function get_loader() { |
|
| 1800 | + return $this->loader; |
|
| 1801 | + } |
|
| 1802 | + |
|
| 1803 | + /** |
|
| 1804 | + * Retrieve the version number of the plugin. |
|
| 1805 | + * |
|
| 1806 | + * @return string The version number of the plugin. |
|
| 1807 | + * @since 1.0.0 |
|
| 1808 | + */ |
|
| 1809 | + public function get_version() { |
|
| 1810 | + return $this->version; |
|
| 1811 | + } |
|
| 1812 | + |
|
| 1813 | + /** |
|
| 1814 | + * Load dependencies for WP-CLI. |
|
| 1815 | + * |
|
| 1816 | + * @throws Exception when an error occurs. |
|
| 1817 | + * @since 3.18.0 |
|
| 1818 | + */ |
|
| 1819 | + private function load_cli_dependencies() { |
|
| 1820 | + |
|
| 1821 | + } |
|
| 1822 | + |
|
| 1823 | + public function add_wl_enabled_blocks() { |
|
| 1824 | + /** |
|
| 1825 | + * Filter: wl_feature__enable__blocks. |
|
| 1826 | + * |
|
| 1827 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
| 1828 | + * |
|
| 1829 | + * @return bool |
|
| 1830 | + * @since 3.27.6 |
|
| 1831 | + */ |
|
| 1832 | + // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
| 1833 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1834 | + |
|
| 1835 | + $enabled_blocks = array(); |
|
| 1836 | + |
|
| 1837 | + /** |
|
| 1838 | + * Filter name: wl_feature__enable__product-navigator |
|
| 1839 | + * |
|
| 1840 | + * @since 3.32.3 |
|
| 1841 | + */ |
|
| 1842 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1843 | + if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
| 1844 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
| 1845 | + } |
|
| 1846 | + |
|
| 1847 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1848 | + // To intimate JS |
|
| 1849 | + $enabled_blocks = array_merge( |
|
| 1850 | + $enabled_blocks, |
|
| 1851 | + array( |
|
| 1852 | + 'wordlift/navigator', |
|
| 1853 | + 'wordlift/chord', |
|
| 1854 | + 'wordlift/geomap', |
|
| 1855 | + 'wordlift/timeline', |
|
| 1856 | + 'wordlift/cloud', |
|
| 1857 | + 'wordlift/vocabulary', |
|
| 1858 | + 'wordlift/faceted-search', |
|
| 1859 | + ) |
|
| 1860 | + ); |
|
| 1861 | + } |
|
| 1862 | + |
|
| 1863 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1864 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1865 | + } |
|
| 1866 | + |
|
| 1867 | + /** |
|
| 1868 | + * Register screens based on the filter. |
|
| 1869 | + */ |
|
| 1870 | + public function register_screens() { |
|
| 1871 | + // Hook the menu to the Download Your Data page. |
|
| 1872 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
| 1873 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 1874 | + Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
| 1875 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 1876 | + } |
|
| 1877 | + |
|
| 1878 | + Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
| 1879 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 1880 | + |
|
| 1881 | + } |
|
| 1882 | 1882 | |
| 1883 | 1883 | } |
@@ -637,15 +637,15 @@ discard block |
||
| 637 | 637 | $that = $this; |
| 638 | 638 | add_action( |
| 639 | 639 | 'plugins_loaded', |
| 640 | - function () use ( $that ) { |
|
| 641 | - $that->define_admin_hooks( $that ); |
|
| 642 | - $that->define_public_hooks( $that ); |
|
| 640 | + function() use ($that) { |
|
| 641 | + $that->define_admin_hooks($that); |
|
| 642 | + $that->define_public_hooks($that); |
|
| 643 | 643 | }, |
| 644 | 644 | 4 |
| 645 | 645 | ); |
| 646 | 646 | |
| 647 | 647 | // If we're in `WP_CLI` load the related files. |
| 648 | - if ( class_exists( 'WP_CLI' ) ) { |
|
| 648 | + if (class_exists('WP_CLI')) { |
|
| 649 | 649 | $this->load_cli_dependencies(); |
| 650 | 650 | } |
| 651 | 651 | |
@@ -685,329 +685,329 @@ discard block |
||
| 685 | 685 | * The class responsible for orchestrating the actions and filters of the |
| 686 | 686 | * core plugin. |
| 687 | 687 | */ |
| 688 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
| 688 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-loader.php'; |
|
| 689 | 689 | |
| 690 | 690 | // The class responsible for plugin uninstall. |
| 691 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
| 691 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-deactivator-feedback.php'; |
|
| 692 | 692 | |
| 693 | 693 | /** |
| 694 | 694 | * The class responsible for defining internationalization functionality |
| 695 | 695 | * of the plugin. |
| 696 | 696 | */ |
| 697 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
| 697 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-i18n.php'; |
|
| 698 | 698 | |
| 699 | 699 | /** |
| 700 | 700 | * WordLift's supported languages. |
| 701 | 701 | */ |
| 702 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
| 702 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-languages.php'; |
|
| 703 | 703 | |
| 704 | 704 | /** |
| 705 | 705 | * WordLift's supported countries. |
| 706 | 706 | */ |
| 707 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
| 707 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-countries.php'; |
|
| 708 | 708 | |
| 709 | 709 | /** |
| 710 | 710 | * Provide support functions to sanitize data. |
| 711 | 711 | */ |
| 712 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 712 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-sanitizer.php'; |
|
| 713 | 713 | |
| 714 | 714 | /** Services. */ |
| 715 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
| 716 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
| 717 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 718 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 719 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 720 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 721 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 722 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
| 723 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
| 715 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-log-service.php'; |
|
| 716 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-http-api.php'; |
|
| 717 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-redirect-service.php'; |
|
| 718 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-configuration-service.php'; |
|
| 719 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 720 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-type-service.php'; |
|
| 721 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-link-service.php'; |
|
| 722 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-relation-service.php'; |
|
| 723 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-image-service.php'; |
|
| 724 | 724 | |
| 725 | 725 | /** |
| 726 | 726 | * The Schema service. |
| 727 | 727 | */ |
| 728 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
| 728 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-schema-service.php'; |
|
| 729 | 729 | |
| 730 | 730 | /** |
| 731 | 731 | * The schema:url property service. |
| 732 | 732 | */ |
| 733 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
| 734 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 733 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-property-service.php'; |
|
| 734 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 735 | 735 | |
| 736 | 736 | /** |
| 737 | 737 | * The UI service. |
| 738 | 738 | */ |
| 739 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
| 739 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-ui-service.php'; |
|
| 740 | 740 | |
| 741 | 741 | /** |
| 742 | 742 | * The Entity Types Taxonomy service. |
| 743 | 743 | */ |
| 744 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 744 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
| 745 | 745 | |
| 746 | 746 | /** |
| 747 | 747 | * The Entity service. |
| 748 | 748 | */ |
| 749 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
| 750 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
| 749 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-uri-service.php'; |
|
| 750 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-service.php'; |
|
| 751 | 751 | |
| 752 | 752 | // Add the entity rating service. |
| 753 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
| 753 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-rating-service.php'; |
|
| 754 | 754 | |
| 755 | 755 | /** |
| 756 | 756 | * The User service. |
| 757 | 757 | */ |
| 758 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
| 758 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-user-service.php'; |
|
| 759 | 759 | |
| 760 | 760 | /** |
| 761 | 761 | * The Timeline service. |
| 762 | 762 | */ |
| 763 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 763 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-timeline-service.php'; |
|
| 764 | 764 | |
| 765 | 765 | /** |
| 766 | 766 | * The Topic Taxonomy service. |
| 767 | 767 | */ |
| 768 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 768 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 769 | 769 | |
| 770 | 770 | /** |
| 771 | 771 | * The WordLift URI service. |
| 772 | 772 | */ |
| 773 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
| 774 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
| 775 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
| 773 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-uri-service.php'; |
|
| 774 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-property-factory.php'; |
|
| 775 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-sample-data-service.php'; |
|
| 776 | 776 | |
| 777 | - require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 778 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 777 | + require_once plugin_dir_path(__DIR__).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 778 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-attachment-service.php'; |
|
| 779 | 779 | |
| 780 | 780 | /** |
| 781 | 781 | * Load the converters. |
| 782 | 782 | */ |
| 783 | - require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 784 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 785 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 786 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 787 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 788 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
| 783 | + require_once plugin_dir_path(__DIR__).'includes/intf-wordlift-post-converter.php'; |
|
| 784 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 785 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 786 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 787 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 788 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-website-jsonld-converter.php'; |
|
| 789 | 789 | |
| 790 | 790 | /** |
| 791 | 791 | * Load cache-related files. |
| 792 | 792 | */ |
| 793 | - require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
| 793 | + require_once plugin_dir_path(__DIR__).'includes/cache/require.php'; |
|
| 794 | 794 | |
| 795 | 795 | /** |
| 796 | 796 | * Load the content filter. |
| 797 | 797 | */ |
| 798 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 798 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-content-filter-service.php'; |
|
| 799 | 799 | |
| 800 | 800 | /* |
| 801 | 801 | * Load the excerpt helper. |
| 802 | 802 | */ |
| 803 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 803 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 804 | 804 | |
| 805 | 805 | /** |
| 806 | 806 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 807 | 807 | * |
| 808 | 808 | * @since 3.8.0 |
| 809 | 809 | */ |
| 810 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 810 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-jsonld-service.php'; |
|
| 811 | 811 | |
| 812 | 812 | // The Publisher Service and the AJAX adapter. |
| 813 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 814 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 813 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-publisher-service.php'; |
|
| 814 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 815 | 815 | |
| 816 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 816 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-post-adapter.php'; |
|
| 817 | 817 | |
| 818 | 818 | /** |
| 819 | 819 | * Load the WordLift key validation service. |
| 820 | 820 | */ |
| 821 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 821 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-key-validation-service.php'; |
|
| 822 | 822 | |
| 823 | 823 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 824 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 824 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 825 | 825 | |
| 826 | 826 | // Load the `Wordlift_Entity_Page_Service` class definition. |
| 827 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
| 827 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-page-service.php'; |
|
| 828 | 828 | |
| 829 | 829 | /** Linked Data. */ |
| 830 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 831 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 832 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 833 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 834 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 835 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 836 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 837 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 838 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 839 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 840 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 830 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
| 831 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
| 832 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
| 833 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
| 834 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
| 835 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
| 836 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
| 837 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
| 838 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
| 839 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
| 840 | + require_once plugin_dir_path(__DIR__).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
| 841 | 841 | |
| 842 | 842 | /** Services. */ |
| 843 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 844 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
| 843 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-google-analytics-export-service.php'; |
|
| 844 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-api-service.php'; |
|
| 845 | 845 | |
| 846 | 846 | /** Adapters. */ |
| 847 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 848 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 849 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 850 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
| 851 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
| 852 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
| 847 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 848 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 849 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
| 850 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-entity-type-adapter.php'; |
|
| 851 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-wprocket-adapter.php'; |
|
| 852 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-nitropack-adapter.php'; |
|
| 853 | 853 | |
| 854 | 854 | /** Autocomplete. */ |
| 855 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 855 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-autocomplete-adapter.php'; |
|
| 856 | 856 | |
| 857 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
| 857 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-remote-image-service.php'; |
|
| 858 | 858 | |
| 859 | 859 | /** Analytics */ |
| 860 | - require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 860 | + require_once plugin_dir_path(__DIR__).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * The class responsible for defining all actions that occur in the admin area. |
| 864 | 864 | */ |
| 865 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
| 865 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin.php'; |
|
| 866 | 866 | |
| 867 | 867 | /** |
| 868 | 868 | * The class to customize the entity list admin page. |
| 869 | 869 | */ |
| 870 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
| 870 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-list-service.php'; |
|
| 871 | 871 | |
| 872 | 872 | /** |
| 873 | 873 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 874 | 874 | */ |
| 875 | 875 | global $wp_version; |
| 876 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
| 877 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 876 | + if (version_compare($wp_version, '5.3', '<')) { |
|
| 877 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 878 | 878 | } else { |
| 879 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 879 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | /** |
| 883 | 883 | * The Notice service. |
| 884 | 884 | */ |
| 885 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
| 885 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-notice-service.php'; |
|
| 886 | 886 | |
| 887 | 887 | /** |
| 888 | 888 | * The PrimaShop adapter. |
| 889 | 889 | */ |
| 890 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 890 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-primashop-adapter.php'; |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * The WordLift Dashboard service. |
| 894 | 894 | */ |
| 895 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
| 895 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-dashboard-service.php'; |
|
| 896 | 896 | |
| 897 | 897 | /** |
| 898 | 898 | * The admin 'Install wizard' page. |
| 899 | 899 | */ |
| 900 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 900 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-setup.php'; |
|
| 901 | 901 | |
| 902 | 902 | /** |
| 903 | 903 | * The WordLift entity type list admin page controller. |
| 904 | 904 | */ |
| 905 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 905 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 906 | 906 | |
| 907 | 907 | /** |
| 908 | 908 | * The WordLift entity type settings admin page controller. |
| 909 | 909 | */ |
| 910 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
| 910 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-entity-type-settings.php'; |
|
| 911 | 911 | |
| 912 | 912 | /** |
| 913 | 913 | * The admin 'Download Your Data' page. |
| 914 | 914 | */ |
| 915 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
| 915 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-download-your-data-page.php'; |
|
| 916 | 916 | |
| 917 | 917 | /** |
| 918 | 918 | * The admin 'WordLift Settings' page. |
| 919 | 919 | */ |
| 920 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
| 923 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
| 931 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 920 | + require_once plugin_dir_path(__DIR__).'admin/elements/intf-wordlift-admin-element.php'; |
|
| 921 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-input-element.php'; |
|
| 922 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
| 923 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-select-element.php'; |
|
| 924 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
| 925 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
| 926 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
| 927 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
| 928 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-author-element.php'; |
|
| 929 | + require_once plugin_dir_path(__DIR__).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
| 930 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-page.php'; |
|
| 931 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-page.php'; |
|
| 932 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
| 933 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 934 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
| 935 | 935 | |
| 936 | 936 | /** Admin Pages */ |
| 937 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 937 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 938 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-entity-type-admin-service.php'; |
|
| 939 | 939 | |
| 940 | 940 | /** |
| 941 | 941 | * The class responsible for defining all actions that occur in the public-facing |
| 942 | 942 | * side of the site. |
| 943 | 943 | */ |
| 944 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
| 944 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-public.php'; |
|
| 945 | 945 | |
| 946 | 946 | /** |
| 947 | 947 | * The shortcode abstract class. |
| 948 | 948 | */ |
| 949 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
| 949 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-shortcode.php'; |
|
| 950 | 950 | |
| 951 | 951 | /** |
| 952 | 952 | * The Timeline shortcode. |
| 953 | 953 | */ |
| 954 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 954 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-timeline-shortcode.php'; |
|
| 955 | 955 | |
| 956 | 956 | /** |
| 957 | 957 | * The Navigator shortcode. |
| 958 | 958 | */ |
| 959 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 959 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-navigator-shortcode.php'; |
|
| 960 | 960 | |
| 961 | 961 | /** |
| 962 | 962 | * The Products Navigator shortcode. |
| 963 | 963 | */ |
| 964 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 964 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-products-navigator-shortcode.php'; |
|
| 965 | 965 | |
| 966 | 966 | /** |
| 967 | 967 | * The chord shortcode. |
| 968 | 968 | */ |
| 969 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 969 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-chord-shortcode.php'; |
|
| 970 | 970 | |
| 971 | 971 | /** |
| 972 | 972 | * The geomap shortcode. |
| 973 | 973 | */ |
| 974 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 974 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-geomap-shortcode.php'; |
|
| 975 | 975 | |
| 976 | 976 | /** |
| 977 | 977 | * The entity cloud shortcode. |
| 978 | 978 | */ |
| 979 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 979 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 980 | 980 | |
| 981 | 981 | /** |
| 982 | 982 | * The entity glossary shortcode. |
| 983 | 983 | */ |
| 984 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 984 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-alphabet-service.php'; |
|
| 985 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-vocabulary-shortcode.php'; |
|
| 986 | 986 | |
| 987 | 987 | /** |
| 988 | 988 | * Faceted Search shortcode. |
| 989 | 989 | */ |
| 990 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 990 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-faceted-search-shortcode.php'; |
|
| 991 | 991 | |
| 992 | 992 | /** |
| 993 | 993 | * The ShareThis service. |
| 994 | 994 | */ |
| 995 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 995 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-sharethis-service.php'; |
|
| 996 | 996 | |
| 997 | 997 | /** |
| 998 | 998 | * The SEO service. |
| 999 | 999 | */ |
| 1000 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
| 1000 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-seo-service.php'; |
|
| 1001 | 1001 | |
| 1002 | 1002 | /** |
| 1003 | 1003 | * The AMP service. |
| 1004 | 1004 | */ |
| 1005 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
| 1005 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-amp-service.php'; |
|
| 1006 | 1006 | |
| 1007 | 1007 | /** Widgets */ |
| 1008 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
| 1009 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
| 1008 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-widget.php'; |
|
| 1009 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 1010 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-context-cards-service.php'; |
|
| 1011 | 1011 | |
| 1012 | 1012 | /* |
| 1013 | 1013 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1016,8 +1016,8 @@ discard block |
||
| 1016 | 1016 | * |
| 1017 | 1017 | * @since 3.20.0 |
| 1018 | 1018 | */ |
| 1019 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1019 | + require_once plugin_dir_path(__DIR__).'includes/batch/intf-wordlift-batch-operation.php'; |
|
| 1020 | + require_once plugin_dir_path(__DIR__).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
| 1021 | 1021 | |
| 1022 | 1022 | /* |
| 1023 | 1023 | * Schema.org Services. |
@@ -1025,10 +1025,10 @@ discard block |
||
| 1025 | 1025 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1026 | 1026 | */ |
| 1027 | 1027 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1028 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
| 1029 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1030 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1031 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1028 | + if (apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES)) { |
|
| 1029 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
| 1030 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
| 1031 | + require_once plugin_dir_path(__DIR__).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
| 1032 | 1032 | new Wordlift_Schemaorg_Sync_Service(); |
| 1033 | 1033 | $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
| 1034 | 1034 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1044,13 +1044,13 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | // Instantiate a global logger. |
| 1046 | 1046 | global $wl_logger; |
| 1047 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 1047 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 1048 | 1048 | |
| 1049 | 1049 | // Load the `wl-api` end-point. |
| 1050 | 1050 | new Wordlift_Http_Api(); |
| 1051 | 1051 | |
| 1052 | 1052 | // Load the Install Service. |
| 1053 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
| 1053 | + require_once plugin_dir_path(__DIR__).'install/class-wordlift-install-service.php'; |
|
| 1054 | 1054 | $this->install_service = new Wordlift_Install_Service(); |
| 1055 | 1055 | $this->notice_service = new Wordlift_Notice_Service(); |
| 1056 | 1056 | $this->user_service = Wordlift_User_Service::get_instance(); |
@@ -1072,21 +1072,21 @@ discard block |
||
| 1072 | 1072 | add_action( |
| 1073 | 1073 | 'plugins_loaded', |
| 1074 | 1074 | // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
| 1075 | - function () use ( &$that, $schemaorg_property_service ) { |
|
| 1075 | + function() use (&$that, $schemaorg_property_service) { |
|
| 1076 | 1076 | |
| 1077 | 1077 | /** Services. */ |
| 1078 | 1078 | // Create the configuration service. |
| 1079 | 1079 | new Wordlift_Api_Service(); |
| 1080 | 1080 | |
| 1081 | 1081 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 1082 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
| 1082 | + $that->entity_link_service = new Wordlift_Entity_Link_Service($that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path()); |
|
| 1083 | 1083 | |
| 1084 | 1084 | $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
| 1085 | 1085 | |
| 1086 | 1086 | $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
| 1087 | 1087 | |
| 1088 | 1088 | // Create a new instance of the Redirect service. |
| 1089 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
| 1089 | + $that->redirect_service = new Wordlift_Redirect_Service($that->entity_uri_service); |
|
| 1090 | 1090 | |
| 1091 | 1091 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 1092 | 1092 | $that->timeline_service = new Wordlift_Timeline_Service(); |
@@ -1099,30 +1099,30 @@ discard block |
||
| 1099 | 1099 | // Create an instance of the PrimaShop adapter. |
| 1100 | 1100 | $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 1101 | 1101 | |
| 1102 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 1102 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 1103 | 1103 | |
| 1104 | 1104 | // Create the entity rating service. |
| 1105 | 1105 | $that->rating_service = Wordlift_Rating_Service::get_instance(); |
| 1106 | 1106 | |
| 1107 | 1107 | // Create entity list customization (wp-admin/edit.php). |
| 1108 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
| 1108 | + $that->entity_list_service = new Wordlift_Entity_List_Service($that->rating_service); |
|
| 1109 | 1109 | |
| 1110 | 1110 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 1111 | 1111 | $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
| 1112 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 1113 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 1112 | + $that->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 1113 | + $that->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 1114 | 1114 | |
| 1115 | 1115 | $attachment_service = Wordlift_Attachment_Service::get_instance(); |
| 1116 | 1116 | |
| 1117 | 1117 | // Instantiate the JSON-LD service. |
| 1118 | 1118 | $property_getter = Wordlift_Property_Getter_Factory::create(); |
| 1119 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1120 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
| 1121 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
| 1122 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
| 1119 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service); |
|
| 1120 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter); |
|
| 1121 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter($that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter); |
|
| 1122 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter(Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service); |
|
| 1123 | 1123 | |
| 1124 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
| 1125 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
| 1124 | + $jsonld_cache = new Ttl_Cache('jsonld', 86400); |
|
| 1125 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($that->postid_to_jsonld_converter, $jsonld_cache); |
|
| 1126 | 1126 | /* |
| 1127 | 1127 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
| 1128 | 1128 | * |
@@ -1130,22 +1130,22 @@ discard block |
||
| 1130 | 1130 | * |
| 1131 | 1131 | * @since 3.20.0 |
| 1132 | 1132 | */ |
| 1133 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1133 | + require_once plugin_dir_path(__DIR__).'public/class-wordlift-term-jsonld-adapter.php'; |
|
| 1134 | 1134 | |
| 1135 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
| 1136 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
| 1135 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($that->entity_uri_service, $that->cached_postid_to_jsonld_converter); |
|
| 1136 | + $that->jsonld_service = new Wordlift_Jsonld_Service(Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter); |
|
| 1137 | 1137 | |
| 1138 | 1138 | $jsonld_service = new Jsonld_Service( |
| 1139 | 1139 | $that->jsonld_service, |
| 1140 | 1140 | $term_jsonld_adapter, |
| 1141 | - new Jsonld_User_Service( $that->user_service ) |
|
| 1141 | + new Jsonld_User_Service($that->user_service) |
|
| 1142 | 1142 | ); |
| 1143 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
| 1143 | + new Jsonld_Endpoint($jsonld_service, $that->entity_uri_service); |
|
| 1144 | 1144 | |
| 1145 | 1145 | // Prints the JSON-LD in the head. |
| 1146 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
| 1146 | + new Jsonld_Adapter($that->jsonld_service); |
|
| 1147 | 1147 | |
| 1148 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
| 1148 | + new Jsonld_By_Id_Endpoint($that->jsonld_service, $that->entity_uri_service); |
|
| 1149 | 1149 | |
| 1150 | 1150 | /** |
| 1151 | 1151 | * @since 3.37.1 |
@@ -1158,10 +1158,10 @@ discard block |
||
| 1158 | 1158 | // Creating Faq Content filter service. |
| 1159 | 1159 | $that->faq_content_filter_service = new Faq_Content_Filter(); |
| 1160 | 1160 | $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
| 1161 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
| 1161 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($that->sample_data_service); |
|
| 1162 | 1162 | |
| 1163 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
| 1164 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
| 1163 | + $that->loader->add_action('enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks'); |
|
| 1164 | + $that->loader->add_action('admin_enqueue_scripts', $that, 'add_wl_enabled_blocks'); |
|
| 1165 | 1165 | |
| 1166 | 1166 | /** |
| 1167 | 1167 | * Filter: wl_feature__enable__blocks. |
@@ -1171,15 +1171,15 @@ discard block |
||
| 1171 | 1171 | * @return bool |
| 1172 | 1172 | * @since 3.27.6 |
| 1173 | 1173 | */ |
| 1174 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1174 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1175 | 1175 | // Initialize the short-codes. |
| 1176 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
| 1176 | + new Async_Template_Decorator(new Wordlift_Navigator_Shortcode()); |
|
| 1177 | 1177 | new Wordlift_Chord_Shortcode(); |
| 1178 | 1178 | new Wordlift_Geomap_Shortcode(); |
| 1179 | 1179 | new Wordlift_Timeline_Shortcode(); |
| 1180 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
| 1180 | + new Wordlift_Related_Entities_Cloud_Shortcode(Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance()); |
|
| 1181 | 1181 | new Wordlift_Vocabulary_Shortcode(); |
| 1182 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
| 1182 | + new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode()); |
|
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | new Wordlift_Products_Navigator_Shortcode(); |
@@ -1191,16 +1191,16 @@ discard block |
||
| 1191 | 1191 | new Wordlift_Seo_Service(); |
| 1192 | 1192 | |
| 1193 | 1193 | // Initialize the AMP service. |
| 1194 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
| 1194 | + new Wordlift_AMP_Service($that->jsonld_service); |
|
| 1195 | 1195 | |
| 1196 | 1196 | /** Services. */ |
| 1197 | 1197 | $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
| 1198 | 1198 | new Wordlift_Image_Service(); |
| 1199 | 1199 | |
| 1200 | 1200 | /** Adapters. */ |
| 1201 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1202 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
| 1203 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
| 1201 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter(Wordlift_Entity_Type_Service::get_instance()); |
|
| 1202 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($that->publisher_service); |
|
| 1203 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter($that); |
|
| 1204 | 1204 | |
| 1205 | 1205 | /* |
| 1206 | 1206 | * Exclude our public js from WP-Rocket. |
@@ -1224,14 +1224,14 @@ discard block |
||
| 1224 | 1224 | $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 1225 | 1225 | $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
| 1226 | 1226 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 1227 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
| 1228 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
| 1227 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element($that->publisher_service, $tabs_element, $that->select2_element); |
|
| 1228 | + $that->author_element = new Wordlift_Admin_Author_Element($that->publisher_service, $that->select2_element); |
|
| 1229 | 1229 | |
| 1230 | 1230 | $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
| 1231 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
| 1231 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($that->settings_page); |
|
| 1232 | 1232 | |
| 1233 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
| 1234 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
| 1233 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page($that->input_element, $that->radio_input_element); |
|
| 1234 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($that->analytics_settings_page); |
|
| 1235 | 1235 | $that->analytics_connect = new Wordlift_Analytics_Connect(); |
| 1236 | 1236 | |
| 1237 | 1237 | // Pages. |
@@ -1242,9 +1242,9 @@ discard block |
||
| 1242 | 1242 | * |
| 1243 | 1243 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
| 1244 | 1244 | */ |
| 1245 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
| 1246 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1247 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
| 1245 | + if (apply_filters('wl_can_see_classification_box', true)) { |
|
| 1246 | + require_once plugin_dir_path(__DIR__).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 1247 | + new Wordlift_Admin_Post_Edit_Page($that); |
|
| 1248 | 1248 | } |
| 1249 | 1249 | new Wordlift_Entity_Type_Admin_Service(); |
| 1250 | 1250 | |
@@ -1252,19 +1252,19 @@ discard block |
||
| 1252 | 1252 | $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1253 | 1253 | |
| 1254 | 1254 | // Create an instance of the install wizard. |
| 1255 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
| 1255 | + $that->admin_setup = new Wordlift_Admin_Setup($that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element); |
|
| 1256 | 1256 | |
| 1257 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
| 1257 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($that->entity_post_type_service); |
|
| 1258 | 1258 | |
| 1259 | 1259 | // User Profile. |
| 1260 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
| 1260 | + new Wordlift_Admin_User_Profile_Page($that->author_element, $that->user_service); |
|
| 1261 | 1261 | |
| 1262 | 1262 | $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
| 1263 | 1263 | |
| 1264 | 1264 | // Load the debug service if WP is in debug mode. |
| 1265 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1266 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1267 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
| 1265 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1266 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-debug-service.php'; |
|
| 1267 | + new Wordlift_Debug_Service(Wordlift_Entity_Service::get_instance(), $uri_service); |
|
| 1268 | 1268 | } |
| 1269 | 1269 | |
| 1270 | 1270 | // Remote Image Service. |
@@ -1277,12 +1277,12 @@ discard block |
||
| 1277 | 1277 | * |
| 1278 | 1278 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
| 1279 | 1279 | */ |
| 1280 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
| 1281 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1282 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1280 | + require_once plugin_dir_path(__DIR__).'includes/class-wordlift-batch-action.php'; |
|
| 1281 | + require_once plugin_dir_path(__DIR__).'includes/mapping/class-wordlift-mapping-service.php'; |
|
| 1282 | + require_once plugin_dir_path(__DIR__).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
| 1283 | 1283 | |
| 1284 | 1284 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
| 1285 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
| 1285 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
| 1286 | 1286 | |
| 1287 | 1287 | /* |
| 1288 | 1288 | * Load the Mappings JSON-LD post processing. |
@@ -1296,11 +1296,11 @@ discard block |
||
| 1296 | 1296 | // Taxonomy term rule validator for validating rules for term pages. |
| 1297 | 1297 | new Taxonomy_Term_Rule_Validator(); |
| 1298 | 1298 | new Post_Taxonomy_Term_Rule_Validator(); |
| 1299 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
| 1300 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
| 1301 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
| 1299 | + $rule_validators_registry = new Rule_Validators_Registry($default_rule_validator); |
|
| 1300 | + $rule_groups_validator = new Rule_Groups_Validator($rule_validators_registry); |
|
| 1301 | + $mappings_validator = new Mappings_Validator($mappings_dbo, $rule_groups_validator); |
|
| 1302 | 1302 | |
| 1303 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
| 1303 | + new Url_To_Entity_Transform_Function($that->entity_uri_service); |
|
| 1304 | 1304 | new Taxonomy_To_Terms_Transform_Function(); |
| 1305 | 1305 | new Post_Id_To_Entity_Transform_Function(); |
| 1306 | 1306 | $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | * Intiailize the acf group data formatter. |
| 1311 | 1311 | */ |
| 1312 | 1312 | new Acf_Group_Formatter(); |
| 1313 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
| 1313 | + new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry); |
|
| 1314 | 1314 | |
| 1315 | 1315 | /** |
| 1316 | 1316 | * @since 3.26.0 |
@@ -1328,16 +1328,16 @@ discard block |
||
| 1328 | 1328 | // Call this static method to register FAQ routes to rest api - disabled |
| 1329 | 1329 | // Faq_Rest_Controller::register_routes(); |
| 1330 | 1330 | |
| 1331 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
| 1331 | + $that->storage_factory = new Wordlift_Storage_Factory(Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter); |
|
| 1332 | 1332 | |
| 1333 | 1333 | /** WL Autocomplete. */ |
| 1334 | - $autocomplete_service = new All_Autocomplete_Service( |
|
| 1334 | + $autocomplete_service = new All_Autocomplete_Service( |
|
| 1335 | 1335 | array( |
| 1336 | 1336 | new Local_Autocomplete_Service(), |
| 1337 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
| 1337 | + new Linked_Data_Autocomplete_Service(Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance()), |
|
| 1338 | 1338 | ) |
| 1339 | 1339 | ); |
| 1340 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
| 1340 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service); |
|
| 1341 | 1341 | |
| 1342 | 1342 | /** |
| 1343 | 1343 | * @since 3.27.2 |
@@ -1346,10 +1346,10 @@ discard block |
||
| 1346 | 1346 | */ |
| 1347 | 1347 | new Recipe_Maker_Post_Type_Hook(); |
| 1348 | 1348 | $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
| 1349 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
| 1350 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
| 1351 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
| 1352 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
| 1349 | + new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service); |
|
| 1350 | + new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service); |
|
| 1351 | + new Recipe_Maker_Jsonld_Swap($recipe_maker_validation_service, $that->jsonld_service); |
|
| 1352 | + new Recipe_Maker_Warning($recipe_maker_validation_service); |
|
| 1353 | 1353 | |
| 1354 | 1354 | new Duplicate_Markup_Remover(); |
| 1355 | 1355 | |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | * @since 3.27.8 |
| 1358 | 1358 | * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
| 1359 | 1359 | */ |
| 1360 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
| 1360 | + new Key_Validation_Notice($that->key_validation_service, Wordlift_Configuration_Service::get_instance()); |
|
| 1361 | 1361 | /** |
| 1362 | 1362 | * @since 3.28.0 |
| 1363 | 1363 | * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
@@ -1368,7 +1368,7 @@ discard block |
||
| 1368 | 1368 | * @since 3.29.0 |
| 1369 | 1369 | * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
| 1370 | 1370 | */ |
| 1371 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
| 1371 | + new Entity_Rest_Service(Wordlift_Entity_Type_Service::get_instance()); |
|
| 1372 | 1372 | |
| 1373 | 1373 | /** |
| 1374 | 1374 | * Expand author in to references. |
@@ -1377,12 +1377,12 @@ discard block |
||
| 1377 | 1377 | * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
| 1378 | 1378 | */ |
| 1379 | 1379 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1380 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
| 1381 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
| 1380 | + if (apply_filters('wl_feature__enable__article-wrapper', false)) { |
|
| 1381 | + new Jsonld_Article_Wrapper(Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter); |
|
| 1382 | 1382 | } |
| 1383 | 1383 | |
| 1384 | 1384 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1385 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
| 1385 | + if (apply_filters('wl_feature__enable__match-terms', false)) { |
|
| 1386 | 1386 | $vocabulary_loader = new Vocabulary_Loader(); |
| 1387 | 1387 | $vocabulary_loader->init_vocabulary(); |
| 1388 | 1388 | } |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | /** |
| 1391 | 1391 | * Added for feature request 1496 (Webhooks) |
| 1392 | 1392 | */ |
| 1393 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
| 1393 | + if (apply_filters('wl_feature__enable__webhooks', false)) { |
|
| 1394 | 1394 | $that->webhook_loader = new Webhooks_Loader(); |
| 1395 | 1395 | $that->webhook_loader->init(); |
| 1396 | 1396 | } |
@@ -1419,7 +1419,7 @@ discard block |
||
| 1419 | 1419 | * @since 3.31.5 |
| 1420 | 1420 | * Create configuration endpoint for webapp to configure. |
| 1421 | 1421 | */ |
| 1422 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
| 1422 | + new Config($that->admin_setup, $that->key_validation_service); |
|
| 1423 | 1423 | /** |
| 1424 | 1424 | * @since 3.31.7 |
| 1425 | 1425 | * Remove duplicate videoobject. |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | * @since 3.32.0 |
| 1432 | 1432 | * Create loader for vocabulary terms. |
| 1433 | 1433 | */ |
| 1434 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
| 1434 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader(Wordlift_Entity_Type_Service::get_instance(), $property_getter); |
|
| 1435 | 1435 | $vocabulary_terms_loader->init_feature(); |
| 1436 | 1436 | |
| 1437 | 1437 | new Entity_Type_Change_Handler( |
@@ -1460,9 +1460,9 @@ discard block |
||
| 1460 | 1460 | private function set_locale() { |
| 1461 | 1461 | |
| 1462 | 1462 | $plugin_i18n = new Wordlift_I18n(); |
| 1463 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1463 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1464 | 1464 | |
| 1465 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1465 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1466 | 1466 | |
| 1467 | 1467 | } |
| 1468 | 1468 | |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | * @since 1.0.0 |
| 1474 | 1474 | * @access private |
| 1475 | 1475 | */ |
| 1476 | - private function define_admin_hooks( $that ) { |
|
| 1476 | + private function define_admin_hooks($that) { |
|
| 1477 | 1477 | $plugin_admin = new Wordlift_Admin( |
| 1478 | 1478 | $that->get_plugin_name(), |
| 1479 | 1479 | $that->get_version(), |
@@ -1481,51 +1481,51 @@ discard block |
||
| 1481 | 1481 | $that->user_service |
| 1482 | 1482 | ); |
| 1483 | 1483 | |
| 1484 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1485 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
| 1484 | + $that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1485 | + $that->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
| 1486 | 1486 | |
| 1487 | 1487 | // Hook the `admin_init` function to the Admin Setup. |
| 1488 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
| 1489 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
| 1488 | + Assertions::is_set($that->admin_setup, '`admin_setup` must be set'); |
|
| 1489 | + $that->loader->add_action('admin_init', $that->admin_setup, 'admin_init'); |
|
| 1490 | 1490 | |
| 1491 | 1491 | // Hook the admin_init to the settings page. |
| 1492 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
| 1493 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
| 1492 | + Assertions::is_set($that->settings_page, '`setting_page` must be set'); |
|
| 1493 | + $that->loader->add_action('admin_init', $that->settings_page, 'admin_init'); |
|
| 1494 | 1494 | |
| 1495 | 1495 | // Hook the admin_init to the analytics settings page. |
| 1496 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
| 1497 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
| 1496 | + Assertions::is_set($that->analytics_settings_page, '`analytics_setting_page` must be set'); |
|
| 1497 | + $that->loader->add_action('admin_init', $that->analytics_settings_page, 'admin_init'); |
|
| 1498 | 1498 | |
| 1499 | 1499 | // Hook the init action to taxonomy services. |
| 1500 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
| 1501 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
| 1500 | + $that->loader->add_action('init', $that->topic_taxonomy_service, 'init', 0); |
|
| 1501 | + $that->loader->add_action('init', $that->entity_types_taxonomy_service, 'init', 0); |
|
| 1502 | 1502 | |
| 1503 | 1503 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1504 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1504 | + $that->loader->add_action('wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline'); |
|
| 1505 | 1505 | |
| 1506 | 1506 | // Register custom allowed redirect hosts. |
| 1507 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1507 | + $that->loader->add_filter('allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts'); |
|
| 1508 | 1508 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1509 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
| 1509 | + $that->loader->add_action('wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect'); |
|
| 1510 | 1510 | |
| 1511 | 1511 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1512 | 1512 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1513 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
| 1514 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
| 1513 | + $that->loader->add_action('save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2); |
|
| 1514 | + $that->loader->add_action('save_post', $that->rating_service, 'set_rating_for', 20, 1); |
|
| 1515 | 1515 | |
| 1516 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
| 1517 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
| 1516 | + $that->loader->add_action('edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1); |
|
| 1517 | + $that->loader->add_action('in_admin_header', $that->rating_service, 'in_admin_header'); |
|
| 1518 | 1518 | |
| 1519 | 1519 | // Entity listing customization (wp-admin/edit.php) |
| 1520 | 1520 | // Add custom columns. |
| 1521 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
| 1521 | + $that->loader->add_filter('manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns'); |
|
| 1522 | 1522 | // no explicit entity as it prevents handling of other post types. |
| 1523 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1523 | + $that->loader->add_filter('manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1524 | 1524 | // Add 4W selection. |
| 1525 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1526 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1527 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
| 1528 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
| 1525 | + $that->loader->add_action('restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1526 | + $that->loader->add_filter('posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1527 | + $that->loader->add_action('pre_get_posts', $that->entity_list_service, 'pre_get_posts'); |
|
| 1528 | + $that->loader->add_action('load-edit.php', $that->entity_list_service, 'load_edit'); |
|
| 1529 | 1529 | |
| 1530 | 1530 | /* |
| 1531 | 1531 | * If `All Entity Types` is disable, use the radio button Walker. |
@@ -1533,18 +1533,18 @@ discard block |
||
| 1533 | 1533 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
| 1534 | 1534 | */ |
| 1535 | 1535 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1536 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
| 1536 | + if ( ! apply_filters('wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES) |
|
| 1537 | 1537 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1538 | - || apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
| 1538 | + || apply_filters('wl_feature__enable__entity-types-professional', false) |
|
| 1539 | 1539 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1540 | - || apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
| 1540 | + || apply_filters('wl_feature__enable__entity-types-business', false) |
|
| 1541 | 1541 | ) { |
| 1542 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1542 | + $that->loader->add_filter('wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1543 | 1543 | } |
| 1544 | 1544 | |
| 1545 | 1545 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1546 | 1546 | // entities. |
| 1547 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
| 1547 | + $that->loader->add_filter('prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10); |
|
| 1548 | 1548 | |
| 1549 | 1549 | /** |
| 1550 | 1550 | * Filter: wl_feature__enable__settings-download. |
@@ -1564,20 +1564,20 @@ discard block |
||
| 1564 | 1564 | ); |
| 1565 | 1565 | |
| 1566 | 1566 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1567 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
| 1567 | + $that->loader->add_action('wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10); |
|
| 1568 | 1568 | |
| 1569 | 1569 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1570 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1571 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1572 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1570 | + $that->loader->add_action('wp_ajax_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1571 | + $that->loader->add_action('admin_post_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1572 | + $that->loader->add_action('admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1573 | 1573 | |
| 1574 | 1574 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1575 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
| 1575 | + $that->loader->add_action('wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key'); |
|
| 1576 | 1576 | |
| 1577 | 1577 | // Hook the AJAX wl_update_country_options action to the countries. |
| 1578 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
| 1578 | + $that->loader->add_action('wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html'); |
|
| 1579 | 1579 | |
| 1580 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
| 1580 | + $that->loader->add_filter('admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction'); |
|
| 1581 | 1581 | |
| 1582 | 1582 | // Hook the menu creation on the general wordlift menu creation. |
| 1583 | 1583 | /** |
@@ -1591,16 +1591,16 @@ discard block |
||
| 1591 | 1591 | * Since 3.30.0 this feature is registered using registry. |
| 1592 | 1592 | */ |
| 1593 | 1593 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1594 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
| 1595 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
| 1594 | + if (apply_filters('wl_feature__enable__settings-screen', true) || Admin_User_Option::is_wordlift_admin()) { |
|
| 1595 | + add_action('wl_admin_menu', array($that->settings_page, 'admin_menu'), 10, 2); |
|
| 1596 | 1596 | } |
| 1597 | 1597 | |
| 1598 | 1598 | // Hook key update. |
| 1599 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1600 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
| 1599 | + $that->loader->add_action('pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2); |
|
| 1600 | + $that->loader->add_action('update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2); |
|
| 1601 | 1601 | |
| 1602 | 1602 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1603 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1603 | + $that->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1); |
|
| 1604 | 1604 | |
| 1605 | 1605 | /* |
| 1606 | 1606 | * Remove the Analytics Settings link from the plugin page. |
@@ -1611,23 +1611,23 @@ discard block |
||
| 1611 | 1611 | // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
| 1612 | 1612 | |
| 1613 | 1613 | // Hook the AJAX `wl_publisher` action name. |
| 1614 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
| 1614 | + $that->loader->add_action('wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher'); |
|
| 1615 | 1615 | |
| 1616 | 1616 | // Hook row actions for the entity type list admin. |
| 1617 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1617 | + $that->loader->add_filter('wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1618 | 1618 | |
| 1619 | 1619 | /** Ajax actions. */ |
| 1620 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
| 1620 | + $that->loader->add_action('wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export'); |
|
| 1621 | 1621 | |
| 1622 | 1622 | // Hook capabilities manipulation to allow access to entity type admin |
| 1623 | 1623 | // page on WordPress versions before 4.7. |
| 1624 | 1624 | global $wp_version; |
| 1625 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1626 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
| 1625 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1626 | + $that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2); |
|
| 1627 | 1627 | } |
| 1628 | 1628 | |
| 1629 | 1629 | /** Adapters. */ |
| 1630 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1630 | + $that->loader->add_filter('mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1631 | 1631 | /** |
| 1632 | 1632 | * Disabling Faq temporarily. |
| 1633 | 1633 | * Load the tinymce editor button on the tool bar. |
@@ -1638,14 +1638,14 @@ discard block |
||
| 1638 | 1638 | // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
| 1639 | 1639 | // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
| 1640 | 1640 | |
| 1641 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
| 1642 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
| 1641 | + $that->loader->add_action('wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create'); |
|
| 1642 | + $that->loader->add_action('wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete'); |
|
| 1643 | 1643 | |
| 1644 | 1644 | /** |
| 1645 | 1645 | * @since 3.26.0 |
| 1646 | 1646 | */ |
| 1647 | 1647 | $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
| 1648 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
| 1648 | + $that->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box'); |
|
| 1649 | 1649 | // Adding Rest route for the post excerpt |
| 1650 | 1650 | Post_Excerpt_Rest_Controller::register_routes(); |
| 1651 | 1651 | |
@@ -1666,14 +1666,14 @@ discard block |
||
| 1666 | 1666 | ); |
| 1667 | 1667 | |
| 1668 | 1668 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1669 | - if ( is_multisite() ) { |
|
| 1670 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
| 1669 | + if (is_multisite()) { |
|
| 1670 | + $that->loader->add_filter('map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2); |
|
| 1671 | 1671 | } |
| 1672 | 1672 | |
| 1673 | 1673 | $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
| 1674 | 1674 | |
| 1675 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
| 1676 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
| 1675 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
| 1676 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
| 1677 | 1677 | add_action( |
| 1678 | 1678 | 'wp_ajax_wl_deactivation_feedback', |
| 1679 | 1679 | array( |
@@ -1689,13 +1689,13 @@ discard block |
||
| 1689 | 1689 | */ |
| 1690 | 1690 | add_filter( |
| 1691 | 1691 | 'allowed_block_types', |
| 1692 | - function ( $value ) { |
|
| 1692 | + function($value) { |
|
| 1693 | 1693 | |
| 1694 | - if ( true === $value ) { |
|
| 1694 | + if (true === $value) { |
|
| 1695 | 1695 | return $value; |
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
| 1698 | + return array_merge((array) $value, array('wordlift/classification')); |
|
| 1699 | 1699 | }, |
| 1700 | 1700 | PHP_INT_MAX |
| 1701 | 1701 | ); |
@@ -1715,57 +1715,57 @@ discard block |
||
| 1715 | 1715 | * @since 1.0.0 |
| 1716 | 1716 | * @access private |
| 1717 | 1717 | */ |
| 1718 | - private function define_public_hooks( $that ) { |
|
| 1718 | + private function define_public_hooks($that) { |
|
| 1719 | 1719 | |
| 1720 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
| 1720 | + $plugin_public = new Wordlift_Public($that->get_plugin_name(), $that->get_version()); |
|
| 1721 | 1721 | |
| 1722 | 1722 | // Register the entity post type. |
| 1723 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
| 1723 | + $that->loader->add_action('init', $that->entity_post_type_service, 'register'); |
|
| 1724 | 1724 | |
| 1725 | 1725 | // Bind the link generation and handling hooks to the entity link service. |
| 1726 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
| 1727 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1726 | + $that->loader->add_filter('post_type_link', $that->entity_link_service, 'post_type_link', 10, 2); |
|
| 1727 | + $that->loader->add_action('pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1728 | 1728 | |
| 1729 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1730 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1731 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
| 1729 | + $that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1730 | + $that->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1731 | + $that->loader->add_action('wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts'); |
|
| 1732 | 1732 | |
| 1733 | 1733 | // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
| 1734 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
| 1734 | + $that->loader->add_filter('the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags'); |
|
| 1735 | 1735 | // Hook the content filter service to add entity links. |
| 1736 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
| 1736 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
| 1737 | 1737 | // We run before other filters. |
| 1738 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
| 1738 | + $that->loader->add_filter('the_content', $that->content_filter_service, 'the_content', 9); |
|
| 1739 | 1739 | } |
| 1740 | 1740 | |
| 1741 | 1741 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1742 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
| 1742 | + $that->loader->add_action('wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline'); |
|
| 1743 | 1743 | |
| 1744 | 1744 | // Hook the ShareThis service. |
| 1745 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
| 1746 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
| 1745 | + $that->loader->add_filter('the_content', $that->sharethis_service, 'the_content', 99); |
|
| 1746 | + $that->loader->add_filter('the_excerpt', $that->sharethis_service, 'the_excerpt', 99); |
|
| 1747 | 1747 | |
| 1748 | 1748 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1749 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
| 1749 | + $that->loader->add_action('wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get'); |
|
| 1750 | 1750 | |
| 1751 | 1751 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1752 | 1752 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1753 | 1753 | // to categories. |
| 1754 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1754 | + $that->loader->add_action('pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1755 | 1755 | |
| 1756 | 1756 | /* |
| 1757 | 1757 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
| 1758 | 1758 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1759 | 1759 | * order of start time. |
| 1760 | 1760 | */ |
| 1761 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1761 | + $that->loader->add_action('pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1762 | 1762 | |
| 1763 | 1763 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
| 1764 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
| 1764 | + $that->loader->add_action('save_post', $that->entity_type_adapter, 'save_post', 9, 2); |
|
| 1765 | 1765 | |
| 1766 | 1766 | // Analytics Script Frontend. |
| 1767 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
| 1768 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
| 1767 | + if (apply_filters('wl_feature__enable__analytics', true) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable()) { |
|
| 1768 | + $that->loader->add_action('wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10); |
|
| 1769 | 1769 | } |
| 1770 | 1770 | |
| 1771 | 1771 | } |
@@ -1830,7 +1830,7 @@ discard block |
||
| 1830 | 1830 | * @since 3.27.6 |
| 1831 | 1831 | */ |
| 1832 | 1832 | // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
| 1833 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
| 1833 | + wp_register_script('wl_enabled_blocks', false); |
|
| 1834 | 1834 | |
| 1835 | 1835 | $enabled_blocks = array(); |
| 1836 | 1836 | |
@@ -1840,11 +1840,11 @@ discard block |
||
| 1840 | 1840 | * @since 3.32.3 |
| 1841 | 1841 | */ |
| 1842 | 1842 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1843 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
| 1843 | + if (apply_filters('wl_feature__enable__product-navigator', true)) { |
|
| 1844 | 1844 | $enabled_blocks[] = 'wordlift/products-navigator'; |
| 1845 | 1845 | } |
| 1846 | 1846 | |
| 1847 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
| 1847 | + if (apply_filters('wl_feature__enable__blocks', true)) { |
|
| 1848 | 1848 | // To intimate JS |
| 1849 | 1849 | $enabled_blocks = array_merge( |
| 1850 | 1850 | $enabled_blocks, |
@@ -1860,8 +1860,8 @@ discard block |
||
| 1860 | 1860 | ); |
| 1861 | 1861 | } |
| 1862 | 1862 | |
| 1863 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
| 1864 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
| 1863 | + wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks); |
|
| 1864 | + wp_enqueue_script('wl_enabled_blocks'); |
|
| 1865 | 1865 | } |
| 1866 | 1866 | |
| 1867 | 1867 | /** |
@@ -1870,13 +1870,13 @@ discard block |
||
| 1870 | 1870 | public function register_screens() { |
| 1871 | 1871 | // Hook the menu to the Download Your Data page. |
| 1872 | 1872 | // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
| 1873 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
| 1874 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
| 1875 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
| 1873 | + if (apply_filters('wl_feature__enable__settings-download', true)) { |
|
| 1874 | + Assertions::is_set($this->download_your_data_page, "`download_your_data_page` can't be null"); |
|
| 1875 | + add_action('admin_menu', array($this->download_your_data_page, 'admin_menu'), 100, 0); |
|
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
| 1879 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
| 1878 | + Assertions::is_set($this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null"); |
|
| 1879 | + add_action('admin_menu', array($this->entity_type_settings_admin_page, 'admin_menu'), 100, 0); |
|
| 1880 | 1880 | |
| 1881 | 1881 | } |
| 1882 | 1882 | |