@@ -22,101 +22,101 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Wordlift_Public { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The ID of this plugin. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var string $plugin_name The ID of this plugin. |
|
| 31 | - */ |
|
| 32 | - private $plugin_name; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * The version of this plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access private |
|
| 39 | - * @var string $version The current version of this plugin. |
|
| 40 | - */ |
|
| 41 | - private $version; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Initialize the class and set its properties. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * |
|
| 48 | - * @param string $plugin_name The name of the plugin. |
|
| 49 | - * @param string $version The version of this plugin. |
|
| 50 | - */ |
|
| 51 | - public function __construct( $plugin_name, $version ) { |
|
| 52 | - |
|
| 53 | - $this->plugin_name = $plugin_name; |
|
| 54 | - $this->version = $version; |
|
| 55 | - |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Register the stylesheets for the public-facing side of the site. |
|
| 60 | - * |
|
| 61 | - * @since 1.0.0 |
|
| 62 | - */ |
|
| 63 | - public function enqueue_styles() { |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * This function is provided for demonstration purposes only. |
|
| 67 | - * |
|
| 68 | - * An instance of this class should be passed to the run() function |
|
| 69 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 70 | - * in that particular class. |
|
| 71 | - * |
|
| 72 | - * The Wordlift_Loader will then create the relationship |
|
| 73 | - * between the defined hooks and the functions defined in this |
|
| 74 | - * class. |
|
| 75 | - */ |
|
| 76 | - |
|
| 77 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' ); |
|
| 78 | - |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Register the stylesheets for the public-facing side of the site. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - */ |
|
| 86 | - public function enqueue_scripts() { |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * This function is provided for demonstration purposes only. |
|
| 90 | - * |
|
| 91 | - * An instance of this class should be passed to the run() function |
|
| 92 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 93 | - * in that particular class. |
|
| 94 | - * |
|
| 95 | - * The Wordlift_Loader will then create the relationship |
|
| 96 | - * between the defined hooks and the functions defined in this |
|
| 97 | - * class. |
|
| 98 | - */ |
|
| 99 | - |
|
| 100 | - // Prepare a settings array for client-side functions. |
|
| 101 | - $settings = array( |
|
| 102 | - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
|
| 103 | - ); |
|
| 104 | - |
|
| 105 | - // If we're in a single page, then print out the post id. |
|
| 106 | - if ( is_singular() ) { |
|
| 107 | - $settings['postId'] = get_the_ID(); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - // Add flag that we are on home/blog page. |
|
| 111 | - if ( is_home() || is_front_page() ) { |
|
| 112 | - $settings['isHome'] = true; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // Note that we switched the js to be loaded in footer, since it is loading |
|
| 116 | - // the json-ld representation. |
|
| 117 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-public.js', array( 'jquery' ), $this->version, true ); |
|
| 118 | - wp_localize_script( $this->plugin_name, 'wlSettings', $settings ); |
|
| 119 | - |
|
| 120 | - } |
|
| 25 | + /** |
|
| 26 | + * The ID of this plugin. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var string $plugin_name The ID of this plugin. |
|
| 31 | + */ |
|
| 32 | + private $plugin_name; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * The version of this plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access private |
|
| 39 | + * @var string $version The current version of this plugin. |
|
| 40 | + */ |
|
| 41 | + private $version; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Initialize the class and set its properties. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * |
|
| 48 | + * @param string $plugin_name The name of the plugin. |
|
| 49 | + * @param string $version The version of this plugin. |
|
| 50 | + */ |
|
| 51 | + public function __construct( $plugin_name, $version ) { |
|
| 52 | + |
|
| 53 | + $this->plugin_name = $plugin_name; |
|
| 54 | + $this->version = $version; |
|
| 55 | + |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Register the stylesheets for the public-facing side of the site. |
|
| 60 | + * |
|
| 61 | + * @since 1.0.0 |
|
| 62 | + */ |
|
| 63 | + public function enqueue_styles() { |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * This function is provided for demonstration purposes only. |
|
| 67 | + * |
|
| 68 | + * An instance of this class should be passed to the run() function |
|
| 69 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 70 | + * in that particular class. |
|
| 71 | + * |
|
| 72 | + * The Wordlift_Loader will then create the relationship |
|
| 73 | + * between the defined hooks and the functions defined in this |
|
| 74 | + * class. |
|
| 75 | + */ |
|
| 76 | + |
|
| 77 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' ); |
|
| 78 | + |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Register the stylesheets for the public-facing side of the site. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + */ |
|
| 86 | + public function enqueue_scripts() { |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * This function is provided for demonstration purposes only. |
|
| 90 | + * |
|
| 91 | + * An instance of this class should be passed to the run() function |
|
| 92 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 93 | + * in that particular class. |
|
| 94 | + * |
|
| 95 | + * The Wordlift_Loader will then create the relationship |
|
| 96 | + * between the defined hooks and the functions defined in this |
|
| 97 | + * class. |
|
| 98 | + */ |
|
| 99 | + |
|
| 100 | + // Prepare a settings array for client-side functions. |
|
| 101 | + $settings = array( |
|
| 102 | + 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
|
| 103 | + ); |
|
| 104 | + |
|
| 105 | + // If we're in a single page, then print out the post id. |
|
| 106 | + if ( is_singular() ) { |
|
| 107 | + $settings['postId'] = get_the_ID(); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + // Add flag that we are on home/blog page. |
|
| 111 | + if ( is_home() || is_front_page() ) { |
|
| 112 | + $settings['isHome'] = true; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // Note that we switched the js to be loaded in footer, since it is loading |
|
| 116 | + // the json-ld representation. |
|
| 117 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-public.js', array( 'jquery' ), $this->version, true ); |
|
| 118 | + wp_localize_script( $this->plugin_name, 'wlSettings', $settings ); |
|
| 119 | + |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $plugin_name The name of the plugin. |
| 49 | 49 | * @param string $version The version of this plugin. |
| 50 | 50 | */ |
| 51 | - public function __construct( $plugin_name, $version ) { |
|
| 51 | + public function __construct($plugin_name, $version) { |
|
| 52 | 52 | |
| 53 | 53 | $this->plugin_name = $plugin_name; |
| 54 | 54 | $this->version = $version; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * class. |
| 75 | 75 | */ |
| 76 | 76 | |
| 77 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' ); |
|
| 77 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-public.css', array(), $this->version, 'all'); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -99,23 +99,23 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | // Prepare a settings array for client-side functions. |
| 101 | 101 | $settings = array( |
| 102 | - 'ajaxUrl' => admin_url( 'admin-ajax.php' ), |
|
| 102 | + 'ajaxUrl' => admin_url('admin-ajax.php'), |
|
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | 105 | // If we're in a single page, then print out the post id. |
| 106 | - if ( is_singular() ) { |
|
| 106 | + if (is_singular()) { |
|
| 107 | 107 | $settings['postId'] = get_the_ID(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Add flag that we are on home/blog page. |
| 111 | - if ( is_home() || is_front_page() ) { |
|
| 111 | + if (is_home() || is_front_page()) { |
|
| 112 | 112 | $settings['isHome'] = true; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Note that we switched the js to be loaded in footer, since it is loading |
| 116 | 116 | // the json-ld representation. |
| 117 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-public.js', array( 'jquery' ), $this->version, true ); |
|
| 118 | - wp_localize_script( $this->plugin_name, 'wlSettings', $settings ); |
|
| 117 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-public.js', array('jquery'), $this->version, true); |
|
| 118 | + wp_localize_script($this->plugin_name, 'wlSettings', $settings); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -15,242 +15,242 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Wordlift_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 20 | - * |
|
| 21 | - * @since 3.10.0 |
|
| 22 | - * @access private |
|
| 23 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 24 | - */ |
|
| 25 | - private $configuration_service; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var Wordlift_Entity_Post_To_Jsonld_Converter |
|
| 29 | - */ |
|
| 30 | - private $entity_post_to_jsonld_converter; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * A {@link Wordlift_Log_Service} instance. |
|
| 34 | - * |
|
| 35 | - * @since 3.10.0 |
|
| 36 | - * @access private |
|
| 37 | - * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 38 | - */ |
|
| 39 | - private $log; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * Wordlift_Post_To_Jsonld_Converter constructor. |
|
| 43 | - * |
|
| 44 | - * @since 3.10.0 |
|
| 45 | - * |
|
| 46 | - * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 47 | - * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 48 | - * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 49 | - * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 50 | - * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 51 | - * @param \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter |
|
| 52 | - */ |
|
| 53 | - public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter ) { |
|
| 54 | - parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 55 | - |
|
| 56 | - $this->configuration_service = $configuration_service; |
|
| 57 | - $this->entity_post_to_jsonld_converter = $entity_post_to_jsonld_converter; |
|
| 58 | - |
|
| 59 | - // Set a reference to the logger. |
|
| 60 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 65 | - * found while processing the post is set in the $references array. |
|
| 66 | - * |
|
| 67 | - * @since 3.10.0 |
|
| 68 | - * |
|
| 69 | - * |
|
| 70 | - * @param int $post_id The post id. |
|
| 71 | - * @param array $references An array of entity references. |
|
| 72 | - * |
|
| 73 | - * @return array A JSON-LD array. |
|
| 74 | - */ |
|
| 75 | - public function convert( $post_id, &$references = array() ) { |
|
| 76 | - |
|
| 77 | - // Get the post instance. |
|
| 78 | - if ( null === $post = get_post( $post_id ) ) { |
|
| 79 | - // Post not found. |
|
| 80 | - return null; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 84 | - $jsonld = parent::convert( $post_id, $references ); |
|
| 85 | - |
|
| 86 | - // Get the entity name. |
|
| 87 | - $jsonld['headline'] = $post->post_title; |
|
| 88 | - |
|
| 89 | - // Get the author. |
|
| 90 | - $jsonld['author'] = $this->get_author( $post->post_author ); |
|
| 91 | - |
|
| 92 | - // Set the published and modified dates. |
|
| 93 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 94 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 95 | - |
|
| 96 | - // Get the word count for the post. |
|
| 97 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 98 | - $jsonld['wordCount'] = $post_adapter->word_count(); |
|
| 99 | - |
|
| 100 | - // Set the publisher. |
|
| 101 | - $this->set_publisher( $jsonld ); |
|
| 102 | - |
|
| 103 | - // Process the references if any. |
|
| 104 | - if ( 0 < sizeof( $references ) ) { |
|
| 105 | - |
|
| 106 | - // Prepare the `about` and `mentions` array. |
|
| 107 | - $about = $mentions = array(); |
|
| 108 | - |
|
| 109 | - // If the entity is in the title, then it should be an `about`. |
|
| 110 | - foreach ( $references as $reference ) { |
|
| 111 | - |
|
| 112 | - // Get the entity labels. |
|
| 113 | - $labels = $this->entity_service->get_labels( $reference ); |
|
| 114 | - |
|
| 115 | - // Get the entity URI. |
|
| 116 | - $item = array( '@id' => $this->entity_service->get_uri( $reference ) ); |
|
| 117 | - |
|
| 118 | - // Check if the labels match any part of the title. |
|
| 119 | - $matches = 1 === preg_match( '/' . implode( '|', $labels ) . '/', $post->post_title ); |
|
| 120 | - |
|
| 121 | - // If the title matches, assign the entity to the about, otherwise to the mentions. |
|
| 122 | - if ( $matches ) { |
|
| 123 | - $about[] = $item; |
|
| 124 | - } else { |
|
| 125 | - $mentions[] = $item; |
|
| 126 | - } |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - // If we have abouts, assign them to the JSON-LD. |
|
| 130 | - if ( 0 < sizeof( $about ) ) { |
|
| 131 | - $jsonld['about'] = $about; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - // If we have mentions, assign them to the JSON-LD. |
|
| 135 | - if ( 0 < sizeof( $mentions ) ) { |
|
| 136 | - $jsonld['mentions'] = $mentions; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Call the `wl_post_jsonld` filter. |
|
| 143 | - * |
|
| 144 | - * @api |
|
| 145 | - * |
|
| 146 | - * @since 3.14.0 |
|
| 147 | - * |
|
| 148 | - * @param array $jsonld The JSON-LD structure. |
|
| 149 | - * @param int $post_id The {@link WP_Post} `id`. |
|
| 150 | - * @param array $references The array of referenced entities. |
|
| 151 | - */ |
|
| 152 | - return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Get the author's JSON-LD fragment. |
|
| 157 | - * |
|
| 158 | - * The JSON-LD fragment is generated using the {@link WP_User}'s data or |
|
| 159 | - * the referenced entity if configured for the {@link WP_User}. |
|
| 160 | - * |
|
| 161 | - * @since 3.14.0 |
|
| 162 | - * |
|
| 163 | - * @param int $author_id The author {@link WP_User}'s `id`. |
|
| 164 | - * |
|
| 165 | - * @return array A JSON-LD structure. |
|
| 166 | - */ |
|
| 167 | - private function get_author( $author_id ) { |
|
| 168 | - |
|
| 169 | - // Get the entity bound to this user. |
|
| 170 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 171 | - |
|
| 172 | - // If there's no entity bound return a simple author structure. |
|
| 173 | - if ( empty( $entity_id ) ) { |
|
| 174 | - |
|
| 175 | - $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 176 | - $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 177 | - |
|
| 178 | - return array( |
|
| 179 | - '@type' => 'Person', |
|
| 180 | - '@id' => $author_uri, |
|
| 181 | - 'name' => $author, |
|
| 182 | - ); |
|
| 183 | - } |
|
| 184 | - |
|
| 185 | - // Return the JSON-LD for the referenced entity. |
|
| 186 | - return $this->entity_post_to_jsonld_converter->convert( $entity_id ); |
|
| 187 | - } |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * Enrich the provided params array with publisher data, if available. |
|
| 191 | - * |
|
| 192 | - * @since 3.10.0 |
|
| 193 | - * |
|
| 194 | - * @param array $params The parameters array. |
|
| 195 | - */ |
|
| 196 | - protected function set_publisher( &$params ) { |
|
| 197 | - |
|
| 198 | - // If the publisher id isn't set don't do anything. |
|
| 199 | - if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 200 | - return; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - // Get the post instance. |
|
| 204 | - if ( null === $post = get_post( $publisher_id ) ) { |
|
| 205 | - // Publisher not found. |
|
| 206 | - return; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - // Get the item id |
|
| 210 | - $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 211 | - |
|
| 212 | - // Get the type. |
|
| 213 | - $type = $this->entity_type_service->get( $publisher_id ); |
|
| 214 | - |
|
| 215 | - // Get the name. |
|
| 216 | - $name = $post->post_title; |
|
| 217 | - |
|
| 218 | - // Set the publisher data. |
|
| 219 | - $params['publisher'] = array( |
|
| 220 | - '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 221 | - '@id' => $id, |
|
| 222 | - 'name' => $name, |
|
| 223 | - ); |
|
| 224 | - |
|
| 225 | - // Set the logo, only for http://schema.org/Organization as Person doesn't |
|
| 226 | - // support the logo property. |
|
| 227 | - // |
|
| 228 | - // See http://schema.org/logo |
|
| 229 | - if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 230 | - return; |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - // Get the logo, WP < 4.4 way: only post ID accepted here. |
|
| 234 | - if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) { |
|
| 235 | - return; |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - // Get the image URL. |
|
| 239 | - if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, 'full' ) ) { |
|
| 240 | - return; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - // Copy over some useful properties. |
|
| 244 | - // |
|
| 245 | - // See https://developers.google.com/search/docs/data-types/articles |
|
| 246 | - $params['publisher']['logo']['@type'] = 'ImageObject'; |
|
| 247 | - $params['publisher']['logo']['url'] = $attachment[0]; |
|
| 248 | - // If you specify a "width" or "height" value you should leave out |
|
| 249 | - // 'px'. For example: "width":"4608px" should be "width":"4608". |
|
| 250 | - // |
|
| 251 | - // See https://github.com/insideout10/wordlift-plugin/issues/451 |
|
| 252 | - $params['publisher']['logo']['width'] = $attachment[1]; |
|
| 253 | - $params['publisher']['logo']['height'] = $attachment[2]; |
|
| 254 | - |
|
| 255 | - } |
|
| 18 | + /** |
|
| 19 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 20 | + * |
|
| 21 | + * @since 3.10.0 |
|
| 22 | + * @access private |
|
| 23 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 24 | + */ |
|
| 25 | + private $configuration_service; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var Wordlift_Entity_Post_To_Jsonld_Converter |
|
| 29 | + */ |
|
| 30 | + private $entity_post_to_jsonld_converter; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * A {@link Wordlift_Log_Service} instance. |
|
| 34 | + * |
|
| 35 | + * @since 3.10.0 |
|
| 36 | + * @access private |
|
| 37 | + * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 38 | + */ |
|
| 39 | + private $log; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * Wordlift_Post_To_Jsonld_Converter constructor. |
|
| 43 | + * |
|
| 44 | + * @since 3.10.0 |
|
| 45 | + * |
|
| 46 | + * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 47 | + * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 48 | + * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance. |
|
| 49 | + * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance. |
|
| 50 | + * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 51 | + * @param \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter |
|
| 52 | + */ |
|
| 53 | + public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter ) { |
|
| 54 | + parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 55 | + |
|
| 56 | + $this->configuration_service = $configuration_service; |
|
| 57 | + $this->entity_post_to_jsonld_converter = $entity_post_to_jsonld_converter; |
|
| 58 | + |
|
| 59 | + // Set a reference to the logger. |
|
| 60 | + $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference |
|
| 65 | + * found while processing the post is set in the $references array. |
|
| 66 | + * |
|
| 67 | + * @since 3.10.0 |
|
| 68 | + * |
|
| 69 | + * |
|
| 70 | + * @param int $post_id The post id. |
|
| 71 | + * @param array $references An array of entity references. |
|
| 72 | + * |
|
| 73 | + * @return array A JSON-LD array. |
|
| 74 | + */ |
|
| 75 | + public function convert( $post_id, &$references = array() ) { |
|
| 76 | + |
|
| 77 | + // Get the post instance. |
|
| 78 | + if ( null === $post = get_post( $post_id ) ) { |
|
| 79 | + // Post not found. |
|
| 80 | + return null; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + // Get the base JSON-LD and the list of entities referenced by this entity. |
|
| 84 | + $jsonld = parent::convert( $post_id, $references ); |
|
| 85 | + |
|
| 86 | + // Get the entity name. |
|
| 87 | + $jsonld['headline'] = $post->post_title; |
|
| 88 | + |
|
| 89 | + // Get the author. |
|
| 90 | + $jsonld['author'] = $this->get_author( $post->post_author ); |
|
| 91 | + |
|
| 92 | + // Set the published and modified dates. |
|
| 93 | + $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 94 | + $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 95 | + |
|
| 96 | + // Get the word count for the post. |
|
| 97 | + $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 98 | + $jsonld['wordCount'] = $post_adapter->word_count(); |
|
| 99 | + |
|
| 100 | + // Set the publisher. |
|
| 101 | + $this->set_publisher( $jsonld ); |
|
| 102 | + |
|
| 103 | + // Process the references if any. |
|
| 104 | + if ( 0 < sizeof( $references ) ) { |
|
| 105 | + |
|
| 106 | + // Prepare the `about` and `mentions` array. |
|
| 107 | + $about = $mentions = array(); |
|
| 108 | + |
|
| 109 | + // If the entity is in the title, then it should be an `about`. |
|
| 110 | + foreach ( $references as $reference ) { |
|
| 111 | + |
|
| 112 | + // Get the entity labels. |
|
| 113 | + $labels = $this->entity_service->get_labels( $reference ); |
|
| 114 | + |
|
| 115 | + // Get the entity URI. |
|
| 116 | + $item = array( '@id' => $this->entity_service->get_uri( $reference ) ); |
|
| 117 | + |
|
| 118 | + // Check if the labels match any part of the title. |
|
| 119 | + $matches = 1 === preg_match( '/' . implode( '|', $labels ) . '/', $post->post_title ); |
|
| 120 | + |
|
| 121 | + // If the title matches, assign the entity to the about, otherwise to the mentions. |
|
| 122 | + if ( $matches ) { |
|
| 123 | + $about[] = $item; |
|
| 124 | + } else { |
|
| 125 | + $mentions[] = $item; |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + // If we have abouts, assign them to the JSON-LD. |
|
| 130 | + if ( 0 < sizeof( $about ) ) { |
|
| 131 | + $jsonld['about'] = $about; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + // If we have mentions, assign them to the JSON-LD. |
|
| 135 | + if ( 0 < sizeof( $mentions ) ) { |
|
| 136 | + $jsonld['mentions'] = $mentions; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Call the `wl_post_jsonld` filter. |
|
| 143 | + * |
|
| 144 | + * @api |
|
| 145 | + * |
|
| 146 | + * @since 3.14.0 |
|
| 147 | + * |
|
| 148 | + * @param array $jsonld The JSON-LD structure. |
|
| 149 | + * @param int $post_id The {@link WP_Post} `id`. |
|
| 150 | + * @param array $references The array of referenced entities. |
|
| 151 | + */ |
|
| 152 | + return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Get the author's JSON-LD fragment. |
|
| 157 | + * |
|
| 158 | + * The JSON-LD fragment is generated using the {@link WP_User}'s data or |
|
| 159 | + * the referenced entity if configured for the {@link WP_User}. |
|
| 160 | + * |
|
| 161 | + * @since 3.14.0 |
|
| 162 | + * |
|
| 163 | + * @param int $author_id The author {@link WP_User}'s `id`. |
|
| 164 | + * |
|
| 165 | + * @return array A JSON-LD structure. |
|
| 166 | + */ |
|
| 167 | + private function get_author( $author_id ) { |
|
| 168 | + |
|
| 169 | + // Get the entity bound to this user. |
|
| 170 | + $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 171 | + |
|
| 172 | + // If there's no entity bound return a simple author structure. |
|
| 173 | + if ( empty( $entity_id ) ) { |
|
| 174 | + |
|
| 175 | + $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 176 | + $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 177 | + |
|
| 178 | + return array( |
|
| 179 | + '@type' => 'Person', |
|
| 180 | + '@id' => $author_uri, |
|
| 181 | + 'name' => $author, |
|
| 182 | + ); |
|
| 183 | + } |
|
| 184 | + |
|
| 185 | + // Return the JSON-LD for the referenced entity. |
|
| 186 | + return $this->entity_post_to_jsonld_converter->convert( $entity_id ); |
|
| 187 | + } |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * Enrich the provided params array with publisher data, if available. |
|
| 191 | + * |
|
| 192 | + * @since 3.10.0 |
|
| 193 | + * |
|
| 194 | + * @param array $params The parameters array. |
|
| 195 | + */ |
|
| 196 | + protected function set_publisher( &$params ) { |
|
| 197 | + |
|
| 198 | + // If the publisher id isn't set don't do anything. |
|
| 199 | + if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 200 | + return; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + // Get the post instance. |
|
| 204 | + if ( null === $post = get_post( $publisher_id ) ) { |
|
| 205 | + // Publisher not found. |
|
| 206 | + return; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + // Get the item id |
|
| 210 | + $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 211 | + |
|
| 212 | + // Get the type. |
|
| 213 | + $type = $this->entity_type_service->get( $publisher_id ); |
|
| 214 | + |
|
| 215 | + // Get the name. |
|
| 216 | + $name = $post->post_title; |
|
| 217 | + |
|
| 218 | + // Set the publisher data. |
|
| 219 | + $params['publisher'] = array( |
|
| 220 | + '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 221 | + '@id' => $id, |
|
| 222 | + 'name' => $name, |
|
| 223 | + ); |
|
| 224 | + |
|
| 225 | + // Set the logo, only for http://schema.org/Organization as Person doesn't |
|
| 226 | + // support the logo property. |
|
| 227 | + // |
|
| 228 | + // See http://schema.org/logo |
|
| 229 | + if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 230 | + return; |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + // Get the logo, WP < 4.4 way: only post ID accepted here. |
|
| 234 | + if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) { |
|
| 235 | + return; |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + // Get the image URL. |
|
| 239 | + if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, 'full' ) ) { |
|
| 240 | + return; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + // Copy over some useful properties. |
|
| 244 | + // |
|
| 245 | + // See https://developers.google.com/search/docs/data-types/articles |
|
| 246 | + $params['publisher']['logo']['@type'] = 'ImageObject'; |
|
| 247 | + $params['publisher']['logo']['url'] = $attachment[0]; |
|
| 248 | + // If you specify a "width" or "height" value you should leave out |
|
| 249 | + // 'px'. For example: "width":"4608px" should be "width":"4608". |
|
| 250 | + // |
|
| 251 | + // See https://github.com/insideout10/wordlift-plugin/issues/451 |
|
| 252 | + $params['publisher']['logo']['width'] = $attachment[1]; |
|
| 253 | + $params['publisher']['logo']['height'] = $attachment[2]; |
|
| 254 | + |
|
| 255 | + } |
|
| 256 | 256 | } |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
| 51 | 51 | * @param \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter |
| 52 | 52 | */ |
| 53 | - public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter ) { |
|
| 54 | - parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service ); |
|
| 53 | + public function __construct($entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter) { |
|
| 54 | + parent::__construct($entity_type_service, $entity_service, $user_service, $attachment_service); |
|
| 55 | 55 | |
| 56 | 56 | $this->configuration_service = $configuration_service; |
| 57 | 57 | $this->entity_post_to_jsonld_converter = $entity_post_to_jsonld_converter; |
| 58 | 58 | |
| 59 | 59 | // Set a reference to the logger. |
| 60 | - $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' ); |
|
| 60 | + $this->log = Wordlift_Log_Service::get_logger('Wordlift_Post_To_Jsonld_Converter'); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -72,54 +72,54 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return array A JSON-LD array. |
| 74 | 74 | */ |
| 75 | - public function convert( $post_id, &$references = array() ) { |
|
| 75 | + public function convert($post_id, &$references = array()) { |
|
| 76 | 76 | |
| 77 | 77 | // Get the post instance. |
| 78 | - if ( null === $post = get_post( $post_id ) ) { |
|
| 78 | + if (null === $post = get_post($post_id)) { |
|
| 79 | 79 | // Post not found. |
| 80 | 80 | return null; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Get the base JSON-LD and the list of entities referenced by this entity. |
| 84 | - $jsonld = parent::convert( $post_id, $references ); |
|
| 84 | + $jsonld = parent::convert($post_id, $references); |
|
| 85 | 85 | |
| 86 | 86 | // Get the entity name. |
| 87 | 87 | $jsonld['headline'] = $post->post_title; |
| 88 | 88 | |
| 89 | 89 | // Get the author. |
| 90 | - $jsonld['author'] = $this->get_author( $post->post_author ); |
|
| 90 | + $jsonld['author'] = $this->get_author($post->post_author); |
|
| 91 | 91 | |
| 92 | 92 | // Set the published and modified dates. |
| 93 | - $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 94 | - $jsonld['dateModified'] = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false ); |
|
| 93 | + $jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false); |
|
| 94 | + $jsonld['dateModified'] = get_post_modified_time('Y-m-d\TH:i', true, $post, false); |
|
| 95 | 95 | |
| 96 | 96 | // Get the word count for the post. |
| 97 | - $post_adapter = new Wordlift_Post_Adapter( $post_id ); |
|
| 97 | + $post_adapter = new Wordlift_Post_Adapter($post_id); |
|
| 98 | 98 | $jsonld['wordCount'] = $post_adapter->word_count(); |
| 99 | 99 | |
| 100 | 100 | // Set the publisher. |
| 101 | - $this->set_publisher( $jsonld ); |
|
| 101 | + $this->set_publisher($jsonld); |
|
| 102 | 102 | |
| 103 | 103 | // Process the references if any. |
| 104 | - if ( 0 < sizeof( $references ) ) { |
|
| 104 | + if (0 < sizeof($references)) { |
|
| 105 | 105 | |
| 106 | 106 | // Prepare the `about` and `mentions` array. |
| 107 | 107 | $about = $mentions = array(); |
| 108 | 108 | |
| 109 | 109 | // If the entity is in the title, then it should be an `about`. |
| 110 | - foreach ( $references as $reference ) { |
|
| 110 | + foreach ($references as $reference) { |
|
| 111 | 111 | |
| 112 | 112 | // Get the entity labels. |
| 113 | - $labels = $this->entity_service->get_labels( $reference ); |
|
| 113 | + $labels = $this->entity_service->get_labels($reference); |
|
| 114 | 114 | |
| 115 | 115 | // Get the entity URI. |
| 116 | - $item = array( '@id' => $this->entity_service->get_uri( $reference ) ); |
|
| 116 | + $item = array('@id' => $this->entity_service->get_uri($reference)); |
|
| 117 | 117 | |
| 118 | 118 | // Check if the labels match any part of the title. |
| 119 | - $matches = 1 === preg_match( '/' . implode( '|', $labels ) . '/', $post->post_title ); |
|
| 119 | + $matches = 1 === preg_match('/'.implode('|', $labels).'/', $post->post_title); |
|
| 120 | 120 | |
| 121 | 121 | // If the title matches, assign the entity to the about, otherwise to the mentions. |
| 122 | - if ( $matches ) { |
|
| 122 | + if ($matches) { |
|
| 123 | 123 | $about[] = $item; |
| 124 | 124 | } else { |
| 125 | 125 | $mentions[] = $item; |
@@ -127,12 +127,12 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // If we have abouts, assign them to the JSON-LD. |
| 130 | - if ( 0 < sizeof( $about ) ) { |
|
| 130 | + if (0 < sizeof($about)) { |
|
| 131 | 131 | $jsonld['about'] = $about; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // If we have mentions, assign them to the JSON-LD. |
| 135 | - if ( 0 < sizeof( $mentions ) ) { |
|
| 135 | + if (0 < sizeof($mentions)) { |
|
| 136 | 136 | $jsonld['mentions'] = $mentions; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @param int $post_id The {@link WP_Post} `id`. |
| 150 | 150 | * @param array $references The array of referenced entities. |
| 151 | 151 | */ |
| 152 | - return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references ); |
|
| 152 | + return apply_filters('wl_post_jsonld', $jsonld, $post_id, $references); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -164,16 +164,16 @@ discard block |
||
| 164 | 164 | * |
| 165 | 165 | * @return array A JSON-LD structure. |
| 166 | 166 | */ |
| 167 | - private function get_author( $author_id ) { |
|
| 167 | + private function get_author($author_id) { |
|
| 168 | 168 | |
| 169 | 169 | // Get the entity bound to this user. |
| 170 | - $entity_id = $this->user_service->get_entity( $author_id ); |
|
| 170 | + $entity_id = $this->user_service->get_entity($author_id); |
|
| 171 | 171 | |
| 172 | 172 | // If there's no entity bound return a simple author structure. |
| 173 | - if ( empty( $entity_id ) ) { |
|
| 173 | + if (empty($entity_id)) { |
|
| 174 | 174 | |
| 175 | - $author = get_the_author_meta( 'display_name', $author_id ); |
|
| 176 | - $author_uri = $this->user_service->get_uri( $author_id ); |
|
| 175 | + $author = get_the_author_meta('display_name', $author_id); |
|
| 176 | + $author_uri = $this->user_service->get_uri($author_id); |
|
| 177 | 177 | |
| 178 | 178 | return array( |
| 179 | 179 | '@type' => 'Person', |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // Return the JSON-LD for the referenced entity. |
| 186 | - return $this->entity_post_to_jsonld_converter->convert( $entity_id ); |
|
| 186 | + return $this->entity_post_to_jsonld_converter->convert($entity_id); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -193,31 +193,31 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @param array $params The parameters array. |
| 195 | 195 | */ |
| 196 | - protected function set_publisher( &$params ) { |
|
| 196 | + protected function set_publisher(&$params) { |
|
| 197 | 197 | |
| 198 | 198 | // If the publisher id isn't set don't do anything. |
| 199 | - if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) { |
|
| 199 | + if (null === $publisher_id = $this->configuration_service->get_publisher_id()) { |
|
| 200 | 200 | return; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | // Get the post instance. |
| 204 | - if ( null === $post = get_post( $publisher_id ) ) { |
|
| 204 | + if (null === $post = get_post($publisher_id)) { |
|
| 205 | 205 | // Publisher not found. |
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | // Get the item id |
| 210 | - $id = $this->entity_service->get_uri( $publisher_id ); |
|
| 210 | + $id = $this->entity_service->get_uri($publisher_id); |
|
| 211 | 211 | |
| 212 | 212 | // Get the type. |
| 213 | - $type = $this->entity_type_service->get( $publisher_id ); |
|
| 213 | + $type = $this->entity_type_service->get($publisher_id); |
|
| 214 | 214 | |
| 215 | 215 | // Get the name. |
| 216 | 216 | $name = $post->post_title; |
| 217 | 217 | |
| 218 | 218 | // Set the publisher data. |
| 219 | 219 | $params['publisher'] = array( |
| 220 | - '@type' => $this->relative_to_context( $type['uri'] ), |
|
| 220 | + '@type' => $this->relative_to_context($type['uri']), |
|
| 221 | 221 | '@id' => $id, |
| 222 | 222 | 'name' => $name, |
| 223 | 223 | ); |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | // support the logo property. |
| 227 | 227 | // |
| 228 | 228 | // See http://schema.org/logo |
| 229 | - if ( 'http://schema.org/Organization' !== $type['uri'] ) { |
|
| 229 | + if ('http://schema.org/Organization' !== $type['uri']) { |
|
| 230 | 230 | return; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // Get the logo, WP < 4.4 way: only post ID accepted here. |
| 234 | - if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) { |
|
| 234 | + if ('' === $thumbnail_id = get_post_thumbnail_id($post->ID)) { |
|
| 235 | 235 | return; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Get the image URL. |
| 239 | - if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, 'full' ) ) { |
|
| 239 | + if (false === $attachment = wp_get_attachment_image_src($thumbnail_id, 'full')) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -29,1248 +29,1248 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | class Wordlift { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | - * the plugin. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * @access protected |
|
| 38 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | - */ |
|
| 40 | - protected $loader; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * The unique identifier of this plugin. |
|
| 44 | - * |
|
| 45 | - * @since 1.0.0 |
|
| 46 | - * @access protected |
|
| 47 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | - */ |
|
| 49 | - protected $plugin_name; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * The current version of the plugin. |
|
| 53 | - * |
|
| 54 | - * @since 1.0.0 |
|
| 55 | - * @access protected |
|
| 56 | - * @var string $version The current version of the plugin. |
|
| 57 | - */ |
|
| 58 | - protected $version; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 62 | - * |
|
| 63 | - * @since 3.12.0 |
|
| 64 | - * @access protected |
|
| 65 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 66 | - */ |
|
| 67 | - protected $tinymce_adapter; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The Thumbnail service. |
|
| 71 | - * |
|
| 72 | - * @since 3.1.5 |
|
| 73 | - * @access private |
|
| 74 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 75 | - */ |
|
| 76 | - private $thumbnail_service; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * The UI service. |
|
| 80 | - * |
|
| 81 | - * @since 3.2.0 |
|
| 82 | - * @access private |
|
| 83 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 84 | - */ |
|
| 85 | - private $ui_service; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The Schema service. |
|
| 89 | - * |
|
| 90 | - * @since 3.3.0 |
|
| 91 | - * @access private |
|
| 92 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 93 | - */ |
|
| 94 | - private $schema_service; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The Entity service. |
|
| 98 | - * |
|
| 99 | - * @since 3.1.0 |
|
| 100 | - * @access protected |
|
| 101 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 102 | - */ |
|
| 103 | - protected $entity_service; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The Topic Taxonomy service. |
|
| 107 | - * |
|
| 108 | - * @since 3.5.0 |
|
| 109 | - * @access private |
|
| 110 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 111 | - */ |
|
| 112 | - private $topic_taxonomy_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The User service. |
|
| 116 | - * |
|
| 117 | - * @since 3.1.7 |
|
| 118 | - * @access protected |
|
| 119 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 120 | - */ |
|
| 121 | - protected $user_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The Timeline service. |
|
| 125 | - * |
|
| 126 | - * @since 3.1.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 129 | - */ |
|
| 130 | - private $timeline_service; |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * The Redirect service. |
|
| 134 | - * |
|
| 135 | - * @since 3.2.0 |
|
| 136 | - * @access private |
|
| 137 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 138 | - */ |
|
| 139 | - private $redirect_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Notice service. |
|
| 143 | - * |
|
| 144 | - * @since 3.3.0 |
|
| 145 | - * @access private |
|
| 146 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 147 | - */ |
|
| 148 | - private $notice_service; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The Entity list customization. |
|
| 152 | - * |
|
| 153 | - * @since 3.3.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 156 | - */ |
|
| 157 | - private $entity_list_service; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The Entity Types Taxonomy Walker. |
|
| 161 | - * |
|
| 162 | - * @since 3.1.0 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 165 | - */ |
|
| 166 | - private $entity_types_taxonomy_walker; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * The ShareThis service. |
|
| 170 | - * |
|
| 171 | - * @since 3.2.0 |
|
| 172 | - * @access private |
|
| 173 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 174 | - */ |
|
| 175 | - private $sharethis_service; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * The PrimaShop adapter. |
|
| 179 | - * |
|
| 180 | - * @since 3.2.3 |
|
| 181 | - * @access private |
|
| 182 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 183 | - */ |
|
| 184 | - private $primashop_adapter; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The WordLift Dashboard adapter. |
|
| 188 | - * |
|
| 189 | - * @since 3.4.0 |
|
| 190 | - * @access private |
|
| 191 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 192 | - */ |
|
| 193 | - private $dashboard_service; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The entity type service. |
|
| 197 | - * |
|
| 198 | - * @since 3.6.0 |
|
| 199 | - * @access private |
|
| 200 | - * @var \Wordlift_Entity_Post_Type_Service |
|
| 201 | - */ |
|
| 202 | - private $entity_post_type_service; |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 206 | - * |
|
| 207 | - * @since 3.6.0 |
|
| 208 | - * @access private |
|
| 209 | - * @var \Wordlift_Entity_Link_Service |
|
| 210 | - */ |
|
| 211 | - private $entity_link_service; |
|
| 212 | - |
|
| 213 | - /** |
|
| 214 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 215 | - * |
|
| 216 | - * @var 3.6.0 |
|
| 217 | - * @access protected |
|
| 218 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 219 | - */ |
|
| 220 | - protected $sparql_service; |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * A {@link Wordlift_Import_Service} instance. |
|
| 224 | - * |
|
| 225 | - * @since 3.6.0 |
|
| 226 | - * @access private |
|
| 227 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 228 | - */ |
|
| 229 | - private $import_service; |
|
| 230 | - |
|
| 231 | - /** |
|
| 232 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 233 | - * |
|
| 234 | - * @since 3.6.0 |
|
| 235 | - * @access private |
|
| 236 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 237 | - */ |
|
| 238 | - private $rebuild_service; |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
| 242 | - * |
|
| 243 | - * @since 3.7.0 |
|
| 244 | - * @access protected |
|
| 245 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 246 | - */ |
|
| 247 | - protected $jsonld_service; |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 251 | - * |
|
| 252 | - * @since 3.14.0 |
|
| 253 | - * @access protected |
|
| 254 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 255 | - */ |
|
| 256 | - protected $jsonld_website_converter; |
|
| 257 | - |
|
| 258 | - /** |
|
| 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 | - private $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 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 305 | - * |
|
| 306 | - * @since 3.9.0 |
|
| 307 | - * @access private |
|
| 308 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 309 | - */ |
|
| 310 | - private $key_validation_service; |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * A {@link Wordlift_Rating_Service} instance. |
|
| 314 | - * |
|
| 315 | - * @since 3.10.0 |
|
| 316 | - * @access private |
|
| 317 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 318 | - */ |
|
| 319 | - private $rating_service; |
|
| 320 | - |
|
| 321 | - /** |
|
| 322 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 323 | - * |
|
| 324 | - * @since 3.10.0 |
|
| 325 | - * @access protected |
|
| 326 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 327 | - */ |
|
| 328 | - protected $post_to_jsonld_converter; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * A {@link Wordlift_Configuration_Service} instance. |
|
| 332 | - * |
|
| 333 | - * @since 3.10.0 |
|
| 334 | - * @access protected |
|
| 335 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 336 | - */ |
|
| 337 | - protected $configuration_service; |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 341 | - * |
|
| 342 | - * @since 3.10.0 |
|
| 343 | - * @access protected |
|
| 344 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 345 | - */ |
|
| 346 | - protected $entity_type_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_Admin_Status_Page} class. |
|
| 368 | - * |
|
| 369 | - * @since 3.9.8 |
|
| 370 | - * @access private |
|
| 371 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 372 | - */ |
|
| 373 | - private $status_page; |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 377 | - * |
|
| 378 | - * @since 3.11.0 |
|
| 379 | - * @access protected |
|
| 380 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 381 | - */ |
|
| 382 | - protected $category_taxonomy_service; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 386 | - * |
|
| 387 | - * @since 3.11.0 |
|
| 388 | - * @access protected |
|
| 389 | - * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 390 | - */ |
|
| 391 | - protected $event_entity_page_service; |
|
| 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 $settings_page_action_link; |
|
| 401 | - |
|
| 402 | - /** |
|
| 403 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 404 | - * |
|
| 405 | - * @since 3.11.0 |
|
| 406 | - * @access protected |
|
| 407 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 408 | - */ |
|
| 409 | - protected $publisher_ajax_adapter; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 413 | - * |
|
| 414 | - * @since 3.11.0 |
|
| 415 | - * @access protected |
|
| 416 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 417 | - */ |
|
| 418 | - protected $input_element; |
|
| 419 | - |
|
| 420 | - /** |
|
| 421 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 422 | - * |
|
| 423 | - * @since 3.13.0 |
|
| 424 | - * @access protected |
|
| 425 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 426 | - */ |
|
| 427 | - protected $radio_input_element; |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 431 | - * |
|
| 432 | - * @since 3.11.0 |
|
| 433 | - * @access protected |
|
| 434 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 435 | - */ |
|
| 436 | - protected $language_select_element; |
|
| 437 | - |
|
| 438 | - /** |
|
| 439 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 440 | - * |
|
| 441 | - * @since 3.11.0 |
|
| 442 | - * @access protected |
|
| 443 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 444 | - */ |
|
| 445 | - protected $publisher_element; |
|
| 446 | - |
|
| 447 | - /** |
|
| 448 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 449 | - * |
|
| 450 | - * @since 3.11.0 |
|
| 451 | - * @access protected |
|
| 452 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 453 | - */ |
|
| 454 | - protected $select2_element; |
|
| 455 | - |
|
| 456 | - /** |
|
| 457 | - * The controller for the entity type list admin page |
|
| 458 | - * |
|
| 459 | - * @since 3.11.0 |
|
| 460 | - * @access private |
|
| 461 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 462 | - */ |
|
| 463 | - private $entity_type_admin_page; |
|
| 464 | - |
|
| 465 | - /** |
|
| 466 | - * The controller for the entity type settings admin page |
|
| 467 | - * |
|
| 468 | - * @since 3.11.0 |
|
| 469 | - * @access private |
|
| 470 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 471 | - */ |
|
| 472 | - private $entity_type_settings_admin_page; |
|
| 473 | - |
|
| 474 | - /** |
|
| 475 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 476 | - * |
|
| 477 | - * @since 3.11.0 |
|
| 478 | - * @access protected |
|
| 479 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 480 | - */ |
|
| 481 | - protected $related_entities_cloud_widget; |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 485 | - * |
|
| 486 | - * @since 3.14.0 |
|
| 487 | - * @access protected |
|
| 488 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 489 | - */ |
|
| 490 | - protected $author_element; |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * {@link Wordlift}'s singleton instance. |
|
| 494 | - * |
|
| 495 | - * @since 3.11.2 |
|
| 496 | - * |
|
| 497 | - * @since 3.11.2 |
|
| 498 | - * @access private |
|
| 499 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 500 | - */ |
|
| 501 | - private static $instance; |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * Define the core functionality of the plugin. |
|
| 505 | - * |
|
| 506 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 507 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 508 | - * the public-facing side of the site. |
|
| 509 | - * |
|
| 510 | - * @since 1.0.0 |
|
| 511 | - */ |
|
| 512 | - public function __construct() { |
|
| 513 | - |
|
| 514 | - $this->plugin_name = 'wordlift'; |
|
| 515 | - $this->version = '3.14.0-dev'; |
|
| 516 | - $this->load_dependencies(); |
|
| 517 | - $this->set_locale(); |
|
| 518 | - $this->define_admin_hooks(); |
|
| 519 | - $this->define_public_hooks(); |
|
| 520 | - |
|
| 521 | - self::$instance = $this; |
|
| 522 | - |
|
| 523 | - } |
|
| 524 | - |
|
| 525 | - /** |
|
| 526 | - * Get the singleton instance. |
|
| 527 | - * |
|
| 528 | - * @since 3.11.2 |
|
| 529 | - * |
|
| 530 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 531 | - */ |
|
| 532 | - public static function get_instance() { |
|
| 533 | - |
|
| 534 | - return self::$instance; |
|
| 535 | - } |
|
| 536 | - |
|
| 537 | - /** |
|
| 538 | - * Load the required dependencies for this plugin. |
|
| 539 | - * |
|
| 540 | - * Include the following files that make up the plugin: |
|
| 541 | - * |
|
| 542 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 543 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 544 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 545 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 546 | - * |
|
| 547 | - * Create an instance of the loader which will be used to register the hooks |
|
| 548 | - * with WordPress. |
|
| 549 | - * |
|
| 550 | - * @since 1.0.0 |
|
| 551 | - * @access private |
|
| 552 | - */ |
|
| 553 | - private function load_dependencies() { |
|
| 554 | - |
|
| 555 | - /** |
|
| 556 | - * The class responsible for orchestrating the actions and filters of the |
|
| 557 | - * core plugin. |
|
| 558 | - */ |
|
| 559 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 560 | - |
|
| 561 | - /** |
|
| 562 | - * The class responsible for defining internationalization functionality |
|
| 563 | - * of the plugin. |
|
| 564 | - */ |
|
| 565 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 566 | - |
|
| 567 | - /** |
|
| 568 | - * WordLift's supported languages. |
|
| 569 | - */ |
|
| 570 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 571 | - |
|
| 572 | - /** |
|
| 573 | - * Provide support functions to sanitize data. |
|
| 574 | - */ |
|
| 575 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 576 | - |
|
| 577 | - /** |
|
| 578 | - * The Redirect service. |
|
| 579 | - */ |
|
| 580 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 581 | - |
|
| 582 | - /** |
|
| 583 | - * The Log service. |
|
| 584 | - */ |
|
| 585 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 586 | - |
|
| 587 | - /** |
|
| 588 | - * The configuration service. |
|
| 589 | - */ |
|
| 590 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 591 | - |
|
| 592 | - /** |
|
| 593 | - * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 594 | - */ |
|
| 595 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 596 | - |
|
| 597 | - /** |
|
| 598 | - * The entity type service (i.e. the schema type). |
|
| 599 | - */ |
|
| 600 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 601 | - |
|
| 602 | - /** |
|
| 603 | - * The entity link service. |
|
| 604 | - */ |
|
| 605 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 606 | - |
|
| 607 | - /** |
|
| 608 | - * The Query builder. |
|
| 609 | - */ |
|
| 610 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 611 | - |
|
| 612 | - /** |
|
| 613 | - * The Schema service. |
|
| 614 | - */ |
|
| 615 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 616 | - |
|
| 617 | - /** |
|
| 618 | - * The schema:url property service. |
|
| 619 | - */ |
|
| 620 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 621 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 622 | - |
|
| 623 | - /** |
|
| 624 | - * The UI service. |
|
| 625 | - */ |
|
| 626 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 627 | - |
|
| 628 | - /** |
|
| 629 | - * The Thumbnail service. |
|
| 630 | - */ |
|
| 631 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 632 | - |
|
| 633 | - /** |
|
| 634 | - * The Entity Types Taxonomy service. |
|
| 635 | - */ |
|
| 636 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * The Entity service. |
|
| 640 | - */ |
|
| 641 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 642 | - |
|
| 643 | - // Add the entity rating service. |
|
| 644 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 645 | - |
|
| 646 | - /** |
|
| 647 | - * The User service. |
|
| 648 | - */ |
|
| 649 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 650 | - |
|
| 651 | - /** |
|
| 652 | - * The Timeline service. |
|
| 653 | - */ |
|
| 654 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 655 | - |
|
| 656 | - /** |
|
| 657 | - * The Topic Taxonomy service. |
|
| 658 | - */ |
|
| 659 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 660 | - |
|
| 661 | - /** |
|
| 662 | - * The SPARQL service. |
|
| 663 | - */ |
|
| 664 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 665 | - |
|
| 666 | - /** |
|
| 667 | - * The WordLift import service. |
|
| 668 | - */ |
|
| 669 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 670 | - |
|
| 671 | - /** |
|
| 672 | - * The WordLift URI service. |
|
| 673 | - */ |
|
| 674 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 675 | - |
|
| 676 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 677 | - |
|
| 678 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 679 | - |
|
| 680 | - /** |
|
| 681 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 682 | - */ |
|
| 683 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 684 | - |
|
| 685 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 686 | - |
|
| 687 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 688 | - |
|
| 689 | - /** |
|
| 690 | - * Load the converters. |
|
| 691 | - */ |
|
| 692 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 693 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 694 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 695 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 696 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 697 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 698 | - |
|
| 699 | - /** |
|
| 700 | - * Load the content filter. |
|
| 701 | - */ |
|
| 702 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 703 | - |
|
| 704 | - /* |
|
| 32 | + /** |
|
| 33 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
| 34 | + * the plugin. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * @access protected |
|
| 38 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
| 39 | + */ |
|
| 40 | + protected $loader; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * The unique identifier of this plugin. |
|
| 44 | + * |
|
| 45 | + * @since 1.0.0 |
|
| 46 | + * @access protected |
|
| 47 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
| 48 | + */ |
|
| 49 | + protected $plugin_name; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * The current version of the plugin. |
|
| 53 | + * |
|
| 54 | + * @since 1.0.0 |
|
| 55 | + * @access protected |
|
| 56 | + * @var string $version The current version of the plugin. |
|
| 57 | + */ |
|
| 58 | + protected $version; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 62 | + * |
|
| 63 | + * @since 3.12.0 |
|
| 64 | + * @access protected |
|
| 65 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
| 66 | + */ |
|
| 67 | + protected $tinymce_adapter; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The Thumbnail service. |
|
| 71 | + * |
|
| 72 | + * @since 3.1.5 |
|
| 73 | + * @access private |
|
| 74 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 75 | + */ |
|
| 76 | + private $thumbnail_service; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * The UI service. |
|
| 80 | + * |
|
| 81 | + * @since 3.2.0 |
|
| 82 | + * @access private |
|
| 83 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 84 | + */ |
|
| 85 | + private $ui_service; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The Schema service. |
|
| 89 | + * |
|
| 90 | + * @since 3.3.0 |
|
| 91 | + * @access private |
|
| 92 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 93 | + */ |
|
| 94 | + private $schema_service; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The Entity service. |
|
| 98 | + * |
|
| 99 | + * @since 3.1.0 |
|
| 100 | + * @access protected |
|
| 101 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 102 | + */ |
|
| 103 | + protected $entity_service; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The Topic Taxonomy service. |
|
| 107 | + * |
|
| 108 | + * @since 3.5.0 |
|
| 109 | + * @access private |
|
| 110 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 111 | + */ |
|
| 112 | + private $topic_taxonomy_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The User service. |
|
| 116 | + * |
|
| 117 | + * @since 3.1.7 |
|
| 118 | + * @access protected |
|
| 119 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 120 | + */ |
|
| 121 | + protected $user_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The Timeline service. |
|
| 125 | + * |
|
| 126 | + * @since 3.1.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 129 | + */ |
|
| 130 | + private $timeline_service; |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * The Redirect service. |
|
| 134 | + * |
|
| 135 | + * @since 3.2.0 |
|
| 136 | + * @access private |
|
| 137 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 138 | + */ |
|
| 139 | + private $redirect_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Notice service. |
|
| 143 | + * |
|
| 144 | + * @since 3.3.0 |
|
| 145 | + * @access private |
|
| 146 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 147 | + */ |
|
| 148 | + private $notice_service; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The Entity list customization. |
|
| 152 | + * |
|
| 153 | + * @since 3.3.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
| 156 | + */ |
|
| 157 | + private $entity_list_service; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The Entity Types Taxonomy Walker. |
|
| 161 | + * |
|
| 162 | + * @since 3.1.0 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 165 | + */ |
|
| 166 | + private $entity_types_taxonomy_walker; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * The ShareThis service. |
|
| 170 | + * |
|
| 171 | + * @since 3.2.0 |
|
| 172 | + * @access private |
|
| 173 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 174 | + */ |
|
| 175 | + private $sharethis_service; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * The PrimaShop adapter. |
|
| 179 | + * |
|
| 180 | + * @since 3.2.3 |
|
| 181 | + * @access private |
|
| 182 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 183 | + */ |
|
| 184 | + private $primashop_adapter; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The WordLift Dashboard adapter. |
|
| 188 | + * |
|
| 189 | + * @since 3.4.0 |
|
| 190 | + * @access private |
|
| 191 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 192 | + */ |
|
| 193 | + private $dashboard_service; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The entity type service. |
|
| 197 | + * |
|
| 198 | + * @since 3.6.0 |
|
| 199 | + * @access private |
|
| 200 | + * @var \Wordlift_Entity_Post_Type_Service |
|
| 201 | + */ |
|
| 202 | + private $entity_post_type_service; |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 206 | + * |
|
| 207 | + * @since 3.6.0 |
|
| 208 | + * @access private |
|
| 209 | + * @var \Wordlift_Entity_Link_Service |
|
| 210 | + */ |
|
| 211 | + private $entity_link_service; |
|
| 212 | + |
|
| 213 | + /** |
|
| 214 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 215 | + * |
|
| 216 | + * @var 3.6.0 |
|
| 217 | + * @access protected |
|
| 218 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 219 | + */ |
|
| 220 | + protected $sparql_service; |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * A {@link Wordlift_Import_Service} instance. |
|
| 224 | + * |
|
| 225 | + * @since 3.6.0 |
|
| 226 | + * @access private |
|
| 227 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 228 | + */ |
|
| 229 | + private $import_service; |
|
| 230 | + |
|
| 231 | + /** |
|
| 232 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 233 | + * |
|
| 234 | + * @since 3.6.0 |
|
| 235 | + * @access private |
|
| 236 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 237 | + */ |
|
| 238 | + private $rebuild_service; |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
| 242 | + * |
|
| 243 | + * @since 3.7.0 |
|
| 244 | + * @access protected |
|
| 245 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
| 246 | + */ |
|
| 247 | + protected $jsonld_service; |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 251 | + * |
|
| 252 | + * @since 3.14.0 |
|
| 253 | + * @access protected |
|
| 254 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 255 | + */ |
|
| 256 | + protected $jsonld_website_converter; |
|
| 257 | + |
|
| 258 | + /** |
|
| 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 | + private $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 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
| 305 | + * |
|
| 306 | + * @since 3.9.0 |
|
| 307 | + * @access private |
|
| 308 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
| 309 | + */ |
|
| 310 | + private $key_validation_service; |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * A {@link Wordlift_Rating_Service} instance. |
|
| 314 | + * |
|
| 315 | + * @since 3.10.0 |
|
| 316 | + * @access private |
|
| 317 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
| 318 | + */ |
|
| 319 | + private $rating_service; |
|
| 320 | + |
|
| 321 | + /** |
|
| 322 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 323 | + * |
|
| 324 | + * @since 3.10.0 |
|
| 325 | + * @access protected |
|
| 326 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
| 327 | + */ |
|
| 328 | + protected $post_to_jsonld_converter; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * A {@link Wordlift_Configuration_Service} instance. |
|
| 332 | + * |
|
| 333 | + * @since 3.10.0 |
|
| 334 | + * @access protected |
|
| 335 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
| 336 | + */ |
|
| 337 | + protected $configuration_service; |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
| 341 | + * |
|
| 342 | + * @since 3.10.0 |
|
| 343 | + * @access protected |
|
| 344 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
| 345 | + */ |
|
| 346 | + protected $entity_type_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_Admin_Status_Page} class. |
|
| 368 | + * |
|
| 369 | + * @since 3.9.8 |
|
| 370 | + * @access private |
|
| 371 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
| 372 | + */ |
|
| 373 | + private $status_page; |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 377 | + * |
|
| 378 | + * @since 3.11.0 |
|
| 379 | + * @access protected |
|
| 380 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
| 381 | + */ |
|
| 382 | + protected $category_taxonomy_service; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 386 | + * |
|
| 387 | + * @since 3.11.0 |
|
| 388 | + * @access protected |
|
| 389 | + * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance. |
|
| 390 | + */ |
|
| 391 | + protected $event_entity_page_service; |
|
| 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 $settings_page_action_link; |
|
| 401 | + |
|
| 402 | + /** |
|
| 403 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 404 | + * |
|
| 405 | + * @since 3.11.0 |
|
| 406 | + * @access protected |
|
| 407 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
| 408 | + */ |
|
| 409 | + protected $publisher_ajax_adapter; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 413 | + * |
|
| 414 | + * @since 3.11.0 |
|
| 415 | + * @access protected |
|
| 416 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
| 417 | + */ |
|
| 418 | + protected $input_element; |
|
| 419 | + |
|
| 420 | + /** |
|
| 421 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 422 | + * |
|
| 423 | + * @since 3.13.0 |
|
| 424 | + * @access protected |
|
| 425 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
| 426 | + */ |
|
| 427 | + protected $radio_input_element; |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 431 | + * |
|
| 432 | + * @since 3.11.0 |
|
| 433 | + * @access protected |
|
| 434 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
| 435 | + */ |
|
| 436 | + protected $language_select_element; |
|
| 437 | + |
|
| 438 | + /** |
|
| 439 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 440 | + * |
|
| 441 | + * @since 3.11.0 |
|
| 442 | + * @access protected |
|
| 443 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
| 444 | + */ |
|
| 445 | + protected $publisher_element; |
|
| 446 | + |
|
| 447 | + /** |
|
| 448 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 449 | + * |
|
| 450 | + * @since 3.11.0 |
|
| 451 | + * @access protected |
|
| 452 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
| 453 | + */ |
|
| 454 | + protected $select2_element; |
|
| 455 | + |
|
| 456 | + /** |
|
| 457 | + * The controller for the entity type list admin page |
|
| 458 | + * |
|
| 459 | + * @since 3.11.0 |
|
| 460 | + * @access private |
|
| 461 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
| 462 | + */ |
|
| 463 | + private $entity_type_admin_page; |
|
| 464 | + |
|
| 465 | + /** |
|
| 466 | + * The controller for the entity type settings admin page |
|
| 467 | + * |
|
| 468 | + * @since 3.11.0 |
|
| 469 | + * @access private |
|
| 470 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
| 471 | + */ |
|
| 472 | + private $entity_type_settings_admin_page; |
|
| 473 | + |
|
| 474 | + /** |
|
| 475 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 476 | + * |
|
| 477 | + * @since 3.11.0 |
|
| 478 | + * @access protected |
|
| 479 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
| 480 | + */ |
|
| 481 | + protected $related_entities_cloud_widget; |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
| 485 | + * |
|
| 486 | + * @since 3.14.0 |
|
| 487 | + * @access protected |
|
| 488 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
| 489 | + */ |
|
| 490 | + protected $author_element; |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * {@link Wordlift}'s singleton instance. |
|
| 494 | + * |
|
| 495 | + * @since 3.11.2 |
|
| 496 | + * |
|
| 497 | + * @since 3.11.2 |
|
| 498 | + * @access private |
|
| 499 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
| 500 | + */ |
|
| 501 | + private static $instance; |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * Define the core functionality of the plugin. |
|
| 505 | + * |
|
| 506 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 507 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 508 | + * the public-facing side of the site. |
|
| 509 | + * |
|
| 510 | + * @since 1.0.0 |
|
| 511 | + */ |
|
| 512 | + public function __construct() { |
|
| 513 | + |
|
| 514 | + $this->plugin_name = 'wordlift'; |
|
| 515 | + $this->version = '3.14.0-dev'; |
|
| 516 | + $this->load_dependencies(); |
|
| 517 | + $this->set_locale(); |
|
| 518 | + $this->define_admin_hooks(); |
|
| 519 | + $this->define_public_hooks(); |
|
| 520 | + |
|
| 521 | + self::$instance = $this; |
|
| 522 | + |
|
| 523 | + } |
|
| 524 | + |
|
| 525 | + /** |
|
| 526 | + * Get the singleton instance. |
|
| 527 | + * |
|
| 528 | + * @since 3.11.2 |
|
| 529 | + * |
|
| 530 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
| 531 | + */ |
|
| 532 | + public static function get_instance() { |
|
| 533 | + |
|
| 534 | + return self::$instance; |
|
| 535 | + } |
|
| 536 | + |
|
| 537 | + /** |
|
| 538 | + * Load the required dependencies for this plugin. |
|
| 539 | + * |
|
| 540 | + * Include the following files that make up the plugin: |
|
| 541 | + * |
|
| 542 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 543 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 544 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 545 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 546 | + * |
|
| 547 | + * Create an instance of the loader which will be used to register the hooks |
|
| 548 | + * with WordPress. |
|
| 549 | + * |
|
| 550 | + * @since 1.0.0 |
|
| 551 | + * @access private |
|
| 552 | + */ |
|
| 553 | + private function load_dependencies() { |
|
| 554 | + |
|
| 555 | + /** |
|
| 556 | + * The class responsible for orchestrating the actions and filters of the |
|
| 557 | + * core plugin. |
|
| 558 | + */ |
|
| 559 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 560 | + |
|
| 561 | + /** |
|
| 562 | + * The class responsible for defining internationalization functionality |
|
| 563 | + * of the plugin. |
|
| 564 | + */ |
|
| 565 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 566 | + |
|
| 567 | + /** |
|
| 568 | + * WordLift's supported languages. |
|
| 569 | + */ |
|
| 570 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 571 | + |
|
| 572 | + /** |
|
| 573 | + * Provide support functions to sanitize data. |
|
| 574 | + */ |
|
| 575 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 576 | + |
|
| 577 | + /** |
|
| 578 | + * The Redirect service. |
|
| 579 | + */ |
|
| 580 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 581 | + |
|
| 582 | + /** |
|
| 583 | + * The Log service. |
|
| 584 | + */ |
|
| 585 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 586 | + |
|
| 587 | + /** |
|
| 588 | + * The configuration service. |
|
| 589 | + */ |
|
| 590 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 591 | + |
|
| 592 | + /** |
|
| 593 | + * The entity post type service (this is the WordPress post type, not the entity schema type). |
|
| 594 | + */ |
|
| 595 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 596 | + |
|
| 597 | + /** |
|
| 598 | + * The entity type service (i.e. the schema type). |
|
| 599 | + */ |
|
| 600 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * The entity link service. |
|
| 604 | + */ |
|
| 605 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 606 | + |
|
| 607 | + /** |
|
| 608 | + * The Query builder. |
|
| 609 | + */ |
|
| 610 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 611 | + |
|
| 612 | + /** |
|
| 613 | + * The Schema service. |
|
| 614 | + */ |
|
| 615 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 616 | + |
|
| 617 | + /** |
|
| 618 | + * The schema:url property service. |
|
| 619 | + */ |
|
| 620 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 621 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 622 | + |
|
| 623 | + /** |
|
| 624 | + * The UI service. |
|
| 625 | + */ |
|
| 626 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 627 | + |
|
| 628 | + /** |
|
| 629 | + * The Thumbnail service. |
|
| 630 | + */ |
|
| 631 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 632 | + |
|
| 633 | + /** |
|
| 634 | + * The Entity Types Taxonomy service. |
|
| 635 | + */ |
|
| 636 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * The Entity service. |
|
| 640 | + */ |
|
| 641 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 642 | + |
|
| 643 | + // Add the entity rating service. |
|
| 644 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 645 | + |
|
| 646 | + /** |
|
| 647 | + * The User service. |
|
| 648 | + */ |
|
| 649 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 650 | + |
|
| 651 | + /** |
|
| 652 | + * The Timeline service. |
|
| 653 | + */ |
|
| 654 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 655 | + |
|
| 656 | + /** |
|
| 657 | + * The Topic Taxonomy service. |
|
| 658 | + */ |
|
| 659 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 660 | + |
|
| 661 | + /** |
|
| 662 | + * The SPARQL service. |
|
| 663 | + */ |
|
| 664 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 665 | + |
|
| 666 | + /** |
|
| 667 | + * The WordLift import service. |
|
| 668 | + */ |
|
| 669 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 670 | + |
|
| 671 | + /** |
|
| 672 | + * The WordLift URI service. |
|
| 673 | + */ |
|
| 674 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 675 | + |
|
| 676 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 677 | + |
|
| 678 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 679 | + |
|
| 680 | + /** |
|
| 681 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 682 | + */ |
|
| 683 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 684 | + |
|
| 685 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 686 | + |
|
| 687 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 688 | + |
|
| 689 | + /** |
|
| 690 | + * Load the converters. |
|
| 691 | + */ |
|
| 692 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 693 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 694 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 695 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 696 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 697 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 698 | + |
|
| 699 | + /** |
|
| 700 | + * Load the content filter. |
|
| 701 | + */ |
|
| 702 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 703 | + |
|
| 704 | + /* |
|
| 705 | 705 | * Load the excerpt helper. |
| 706 | 706 | */ |
| 707 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 708 | - |
|
| 709 | - /** |
|
| 710 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 711 | - * |
|
| 712 | - * @since 3.8.0 |
|
| 713 | - */ |
|
| 714 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 715 | - |
|
| 716 | - // The Publisher Service and the AJAX adapter. |
|
| 717 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 718 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 719 | - |
|
| 720 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 721 | - |
|
| 722 | - /** |
|
| 723 | - * Load the WordLift key validation service. |
|
| 724 | - */ |
|
| 725 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 726 | - |
|
| 727 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 728 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 729 | - |
|
| 730 | - // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
|
| 731 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 732 | - |
|
| 733 | - /** Adapters. */ |
|
| 734 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 735 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 736 | - |
|
| 737 | - /** Async Tasks. */ |
|
| 738 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php'; |
|
| 739 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 740 | - |
|
| 741 | - /** |
|
| 742 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 743 | - */ |
|
| 744 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 745 | - |
|
| 746 | - /** |
|
| 747 | - * The class to customize the entity list admin page. |
|
| 748 | - */ |
|
| 749 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 750 | - |
|
| 751 | - /** |
|
| 752 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 753 | - */ |
|
| 754 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 755 | - |
|
| 756 | - /** |
|
| 757 | - * The Notice service. |
|
| 758 | - */ |
|
| 759 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 760 | - |
|
| 761 | - /** |
|
| 762 | - * The PrimaShop adapter. |
|
| 763 | - */ |
|
| 764 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 765 | - |
|
| 766 | - /** |
|
| 767 | - * The WordLift Dashboard service. |
|
| 768 | - */ |
|
| 769 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 770 | - |
|
| 771 | - /** |
|
| 772 | - * The admin 'Install wizard' page. |
|
| 773 | - */ |
|
| 774 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 775 | - |
|
| 776 | - /** |
|
| 777 | - * The WordLift entity type list admin page controller. |
|
| 778 | - */ |
|
| 779 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 780 | - |
|
| 781 | - /** |
|
| 782 | - * The WordLift entity type settings admin page controller. |
|
| 783 | - */ |
|
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 785 | - |
|
| 786 | - /** |
|
| 787 | - * The admin 'Download Your Data' page. |
|
| 788 | - */ |
|
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 790 | - |
|
| 791 | - /** |
|
| 792 | - * The admin 'Download Your Data' page. |
|
| 793 | - */ |
|
| 794 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 795 | - |
|
| 796 | - /** |
|
| 797 | - * The admin 'WordLift Settings' page. |
|
| 798 | - */ |
|
| 799 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 802 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 804 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 805 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php'; |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 807 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 808 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 809 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 810 | - |
|
| 811 | - /** Admin Pages */ |
|
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 813 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 815 | - |
|
| 816 | - /** |
|
| 817 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 818 | - * side of the site. |
|
| 819 | - */ |
|
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 821 | - |
|
| 822 | - /** |
|
| 823 | - * The shortcode abstract class. |
|
| 824 | - */ |
|
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 826 | - |
|
| 827 | - /** |
|
| 828 | - * The Timeline shortcode. |
|
| 829 | - */ |
|
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 831 | - |
|
| 832 | - /** |
|
| 833 | - * The Navigator shortcode. |
|
| 834 | - */ |
|
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 836 | - |
|
| 837 | - /** |
|
| 838 | - * The chord shortcode. |
|
| 839 | - */ |
|
| 840 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 841 | - |
|
| 842 | - /** |
|
| 843 | - * The geomap shortcode. |
|
| 844 | - */ |
|
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 846 | - |
|
| 847 | - /** |
|
| 848 | - * The entity cloud shortcode. |
|
| 849 | - */ |
|
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 851 | - |
|
| 852 | - /** |
|
| 853 | - * The ShareThis service. |
|
| 854 | - */ |
|
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 856 | - |
|
| 857 | - /** |
|
| 858 | - * The SEO service. |
|
| 859 | - */ |
|
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 861 | - |
|
| 862 | - /** |
|
| 863 | - * The AMP service. |
|
| 864 | - */ |
|
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 707 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 708 | + |
|
| 709 | + /** |
|
| 710 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
| 711 | + * |
|
| 712 | + * @since 3.8.0 |
|
| 713 | + */ |
|
| 714 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 715 | + |
|
| 716 | + // The Publisher Service and the AJAX adapter. |
|
| 717 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 718 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 719 | + |
|
| 720 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 721 | + |
|
| 722 | + /** |
|
| 723 | + * Load the WordLift key validation service. |
|
| 724 | + */ |
|
| 725 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 726 | + |
|
| 727 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
| 728 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 729 | + |
|
| 730 | + // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
|
| 731 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 732 | + |
|
| 733 | + /** Adapters. */ |
|
| 734 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 735 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 736 | + |
|
| 737 | + /** Async Tasks. */ |
|
| 738 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php'; |
|
| 739 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 740 | + |
|
| 741 | + /** |
|
| 742 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 743 | + */ |
|
| 744 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 745 | + |
|
| 746 | + /** |
|
| 747 | + * The class to customize the entity list admin page. |
|
| 748 | + */ |
|
| 749 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 750 | + |
|
| 751 | + /** |
|
| 752 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 753 | + */ |
|
| 754 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 755 | + |
|
| 756 | + /** |
|
| 757 | + * The Notice service. |
|
| 758 | + */ |
|
| 759 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 760 | + |
|
| 761 | + /** |
|
| 762 | + * The PrimaShop adapter. |
|
| 763 | + */ |
|
| 764 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 765 | + |
|
| 766 | + /** |
|
| 767 | + * The WordLift Dashboard service. |
|
| 768 | + */ |
|
| 769 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 770 | + |
|
| 771 | + /** |
|
| 772 | + * The admin 'Install wizard' page. |
|
| 773 | + */ |
|
| 774 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 775 | + |
|
| 776 | + /** |
|
| 777 | + * The WordLift entity type list admin page controller. |
|
| 778 | + */ |
|
| 779 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 780 | + |
|
| 781 | + /** |
|
| 782 | + * The WordLift entity type settings admin page controller. |
|
| 783 | + */ |
|
| 784 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 785 | + |
|
| 786 | + /** |
|
| 787 | + * The admin 'Download Your Data' page. |
|
| 788 | + */ |
|
| 789 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 790 | + |
|
| 791 | + /** |
|
| 792 | + * The admin 'Download Your Data' page. |
|
| 793 | + */ |
|
| 794 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 795 | + |
|
| 796 | + /** |
|
| 797 | + * The admin 'WordLift Settings' page. |
|
| 798 | + */ |
|
| 799 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 800 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 802 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 803 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 804 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 805 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php'; |
|
| 806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 807 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 808 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 809 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 810 | + |
|
| 811 | + /** Admin Pages */ |
|
| 812 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 813 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 814 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 815 | + |
|
| 816 | + /** |
|
| 817 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 818 | + * side of the site. |
|
| 819 | + */ |
|
| 820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 821 | + |
|
| 822 | + /** |
|
| 823 | + * The shortcode abstract class. |
|
| 824 | + */ |
|
| 825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 826 | + |
|
| 827 | + /** |
|
| 828 | + * The Timeline shortcode. |
|
| 829 | + */ |
|
| 830 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 831 | + |
|
| 832 | + /** |
|
| 833 | + * The Navigator shortcode. |
|
| 834 | + */ |
|
| 835 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 836 | + |
|
| 837 | + /** |
|
| 838 | + * The chord shortcode. |
|
| 839 | + */ |
|
| 840 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 841 | + |
|
| 842 | + /** |
|
| 843 | + * The geomap shortcode. |
|
| 844 | + */ |
|
| 845 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 846 | + |
|
| 847 | + /** |
|
| 848 | + * The entity cloud shortcode. |
|
| 849 | + */ |
|
| 850 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 851 | + |
|
| 852 | + /** |
|
| 853 | + * The ShareThis service. |
|
| 854 | + */ |
|
| 855 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 856 | + |
|
| 857 | + /** |
|
| 858 | + * The SEO service. |
|
| 859 | + */ |
|
| 860 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 866 | 861 | |
| 867 | - /** Widgets */ |
|
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 869 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 862 | + /** |
|
| 863 | + * The AMP service. |
|
| 864 | + */ |
|
| 865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 866 | + |
|
| 867 | + /** Widgets */ |
|
| 868 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 869 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 870 | 870 | |
| 871 | - $this->loader = new Wordlift_Loader(); |
|
| 871 | + $this->loader = new Wordlift_Loader(); |
|
| 872 | 872 | |
| 873 | - // Instantiate a global logger. |
|
| 874 | - global $wl_logger; |
|
| 875 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 873 | + // Instantiate a global logger. |
|
| 874 | + global $wl_logger; |
|
| 875 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 876 | 876 | |
| 877 | - // Create the configuration service. |
|
| 878 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 877 | + // Create the configuration service. |
|
| 878 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
| 879 | 879 | |
| 880 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 881 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 880 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 881 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 882 | 882 | |
| 883 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 884 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 883 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 884 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 885 | 885 | |
| 886 | - // Create an instance of the UI service. |
|
| 887 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 886 | + // Create an instance of the UI service. |
|
| 887 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 888 | 888 | |
| 889 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 890 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 889 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 890 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 891 | 891 | |
| 892 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 892 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 893 | 893 | |
| 894 | - // Create an instance of the Schema service. |
|
| 895 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 896 | - $this->schema_service = new Wordlift_Schema_Service(); |
|
| 894 | + // Create an instance of the Schema service. |
|
| 895 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 896 | + $this->schema_service = new Wordlift_Schema_Service(); |
|
| 897 | 897 | |
| 898 | - // Create an instance of the Notice service. |
|
| 899 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 898 | + // Create an instance of the Notice service. |
|
| 899 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 900 | 900 | |
| 901 | - // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 902 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 901 | + // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 902 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 903 | 903 | |
| 904 | - // Create an instance of the User service. |
|
| 905 | - $this->user_service = new Wordlift_User_Service(); |
|
| 904 | + // Create an instance of the User service. |
|
| 905 | + $this->user_service = new Wordlift_User_Service(); |
|
| 906 | 906 | |
| 907 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 908 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 907 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 908 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 909 | 909 | |
| 910 | - // Create a new instance of the Redirect service. |
|
| 911 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 910 | + // Create a new instance of the Redirect service. |
|
| 911 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 912 | 912 | |
| 913 | - // Initialize the shortcodes. |
|
| 914 | - new Wordlift_Navigator_Shortcode(); |
|
| 915 | - new Wordlift_Chord_Shortcode(); |
|
| 916 | - new Wordlift_Geomap_Shortcode(); |
|
| 917 | - new Wordlift_Timeline_Shortcode(); |
|
| 918 | - new Wordlift_Related_Entities_Cloud_Shortcode(); |
|
| 913 | + // Initialize the shortcodes. |
|
| 914 | + new Wordlift_Navigator_Shortcode(); |
|
| 915 | + new Wordlift_Chord_Shortcode(); |
|
| 916 | + new Wordlift_Geomap_Shortcode(); |
|
| 917 | + new Wordlift_Timeline_Shortcode(); |
|
| 918 | + new Wordlift_Related_Entities_Cloud_Shortcode(); |
|
| 919 | 919 | |
| 920 | - // Initialize the SEO service. |
|
| 921 | - new Wordlift_Seo_Service(); |
|
| 920 | + // Initialize the SEO service. |
|
| 921 | + new Wordlift_Seo_Service(); |
|
| 922 | 922 | |
| 923 | - // Initialize the AMP service. |
|
| 924 | - new Wordlift_AMP_Service(); |
|
| 923 | + // Initialize the AMP service. |
|
| 924 | + new Wordlift_AMP_Service(); |
|
| 925 | 925 | |
| 926 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 926 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 927 | 927 | |
| 928 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 928 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 929 | 929 | |
| 930 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 931 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 930 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 931 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 932 | 932 | |
| 933 | - // Create an instance of the PrimaShop adapter. |
|
| 934 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 933 | + // Create an instance of the PrimaShop adapter. |
|
| 934 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 935 | 935 | |
| 936 | - // Create an import service instance to hook later to WP's import function. |
|
| 937 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 936 | + // Create an import service instance to hook later to WP's import function. |
|
| 937 | + $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 938 | 938 | |
| 939 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 939 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 940 | 940 | |
| 941 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 942 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 941 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 942 | + $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 943 | 943 | |
| 944 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 944 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 945 | 945 | |
| 946 | - // Create the entity rating service. |
|
| 947 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 946 | + // Create the entity rating service. |
|
| 947 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 948 | 948 | |
| 949 | - // Create entity list customization (wp-admin/edit.php) |
|
| 950 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 949 | + // Create entity list customization (wp-admin/edit.php) |
|
| 950 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 951 | 951 | |
| 952 | - // Create a new instance of the Redirect service. |
|
| 953 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 952 | + // Create a new instance of the Redirect service. |
|
| 953 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 954 | 954 | |
| 955 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 956 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 955 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 956 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 957 | 957 | |
| 958 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
| 958 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
| 959 | 959 | |
| 960 | - // Instantiate the JSON-LD service. |
|
| 961 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 962 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter ); |
|
| 963 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter ); |
|
| 964 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 965 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 966 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 960 | + // Instantiate the JSON-LD service. |
|
| 961 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 962 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter ); |
|
| 963 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter ); |
|
| 964 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 965 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 966 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 967 | 967 | |
| 968 | - // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 969 | - $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 968 | + // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
|
| 969 | + $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
| 970 | 970 | |
| 971 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 972 | - $publisher_service = new Wordlift_Publisher_Service(); |
|
| 973 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 971 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
| 972 | + $publisher_service = new Wordlift_Publisher_Service(); |
|
| 973 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 974 | 974 | |
| 975 | - /** Adapters. */ |
|
| 976 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 975 | + /** Adapters. */ |
|
| 976 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 977 | 977 | |
| 978 | - /** Async Tasks. */ |
|
| 979 | - new Wordlift_Sparql_Query_Async_Task(); |
|
| 978 | + /** Async Tasks. */ |
|
| 979 | + new Wordlift_Sparql_Query_Async_Task(); |
|
| 980 | 980 | |
| 981 | - /** WordPress Admin UI. */ |
|
| 981 | + /** WordPress Admin UI. */ |
|
| 982 | 982 | |
| 983 | - // UI elements. |
|
| 984 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 985 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 986 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 987 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 988 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 989 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 990 | - $this->author_element = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element ); |
|
| 983 | + // UI elements. |
|
| 984 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
| 985 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
| 986 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
| 987 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
| 988 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
| 989 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 990 | + $this->author_element = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element ); |
|
| 991 | 991 | |
| 992 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 993 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 994 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 992 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 993 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 994 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 995 | 995 | |
| 996 | - // Pages. |
|
| 997 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 996 | + // Pages. |
|
| 997 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 998 | 998 | |
| 999 | - // create an instance of the entity type list admin page controller. |
|
| 1000 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 999 | + // create an instance of the entity type list admin page controller. |
|
| 1000 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
| 1001 | 1001 | |
| 1002 | - // create an instance of the entity type etting admin page controller. |
|
| 1003 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1002 | + // create an instance of the entity type etting admin page controller. |
|
| 1003 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
| 1004 | 1004 | |
| 1005 | - /** Widgets */ |
|
| 1006 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1005 | + /** Widgets */ |
|
| 1006 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
| 1007 | 1007 | |
| 1008 | - //** WordPress Admin */ |
|
| 1009 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1010 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1008 | + //** WordPress Admin */ |
|
| 1009 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1010 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1011 | 1011 | |
| 1012 | - // Create an instance of the install wizard. |
|
| 1013 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 1012 | + // Create an instance of the install wizard. |
|
| 1013 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 1014 | 1014 | |
| 1015 | - // Create an instance of the content filter service. |
|
| 1016 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service ); |
|
| 1015 | + // Create an instance of the content filter service. |
|
| 1016 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service ); |
|
| 1017 | 1017 | |
| 1018 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1018 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1019 | 1019 | |
| 1020 | - // User Profile. |
|
| 1021 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1020 | + // User Profile. |
|
| 1021 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1022 | 1022 | |
| 1023 | - $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
|
| 1023 | + $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
|
| 1024 | 1024 | |
| 1025 | - // Load the debug service if WP is in debug mode. |
|
| 1026 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1028 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1029 | - } |
|
| 1025 | + // Load the debug service if WP is in debug mode. |
|
| 1026 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1027 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1028 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1029 | + } |
|
| 1030 | 1030 | |
| 1031 | - } |
|
| 1031 | + } |
|
| 1032 | 1032 | |
| 1033 | - /** |
|
| 1034 | - * Define the locale for this plugin for internationalization. |
|
| 1035 | - * |
|
| 1036 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1037 | - * with WordPress. |
|
| 1038 | - * |
|
| 1039 | - * @since 1.0.0 |
|
| 1040 | - * @access private |
|
| 1041 | - */ |
|
| 1042 | - private function set_locale() { |
|
| 1033 | + /** |
|
| 1034 | + * Define the locale for this plugin for internationalization. |
|
| 1035 | + * |
|
| 1036 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 1037 | + * with WordPress. |
|
| 1038 | + * |
|
| 1039 | + * @since 1.0.0 |
|
| 1040 | + * @access private |
|
| 1041 | + */ |
|
| 1042 | + private function set_locale() { |
|
| 1043 | 1043 | |
| 1044 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 1045 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1044 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 1045 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1046 | 1046 | |
| 1047 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1047 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1048 | 1048 | |
| 1049 | - } |
|
| 1049 | + } |
|
| 1050 | 1050 | |
| 1051 | - /** |
|
| 1052 | - * Register all of the hooks related to the admin area functionality |
|
| 1053 | - * of the plugin. |
|
| 1054 | - * |
|
| 1055 | - * @since 1.0.0 |
|
| 1056 | - * @access private |
|
| 1057 | - */ |
|
| 1058 | - private function define_admin_hooks() { |
|
| 1051 | + /** |
|
| 1052 | + * Register all of the hooks related to the admin area functionality |
|
| 1053 | + * of the plugin. |
|
| 1054 | + * |
|
| 1055 | + * @since 1.0.0 |
|
| 1056 | + * @access private |
|
| 1057 | + */ |
|
| 1058 | + private function define_admin_hooks() { |
|
| 1059 | 1059 | |
| 1060 | - $plugin_admin = new Wordlift_Admin( |
|
| 1061 | - $this->get_plugin_name(), |
|
| 1062 | - $this->get_version(), |
|
| 1063 | - $this->configuration_service, |
|
| 1064 | - $this->notice_service, |
|
| 1065 | - $this->user_service |
|
| 1066 | - ); |
|
| 1060 | + $plugin_admin = new Wordlift_Admin( |
|
| 1061 | + $this->get_plugin_name(), |
|
| 1062 | + $this->get_version(), |
|
| 1063 | + $this->configuration_service, |
|
| 1064 | + $this->notice_service, |
|
| 1065 | + $this->user_service |
|
| 1066 | + ); |
|
| 1067 | 1067 | |
| 1068 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1069 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1068 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1069 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1070 | 1070 | |
| 1071 | - // Hook the init action to the Topic Taxonomy service. |
|
| 1072 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1071 | + // Hook the init action to the Topic Taxonomy service. |
|
| 1072 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1073 | 1073 | |
| 1074 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1075 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1074 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 1075 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1076 | 1076 | |
| 1077 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 1078 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1077 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 1078 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1079 | 1079 | |
| 1080 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1081 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1080 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 1081 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1082 | 1082 | |
| 1083 | - // Hook posts inserts (or updates) to the user service. |
|
| 1084 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1083 | + // Hook posts inserts (or updates) to the user service. |
|
| 1084 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1085 | 1085 | |
| 1086 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1087 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1086 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1087 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1088 | 1088 | |
| 1089 | - // Register custom allowed redirect hosts. |
|
| 1090 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1091 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1092 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1093 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1094 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1095 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1096 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1089 | + // Register custom allowed redirect hosts. |
|
| 1090 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1091 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1092 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1093 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1094 | + $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1095 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 1096 | + $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1097 | 1097 | |
| 1098 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1099 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1100 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1101 | - $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1098 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 1099 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 1100 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1101 | + $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1102 | 1102 | |
| 1103 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1104 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1103 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1104 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1105 | 1105 | |
| 1106 | - // Entity listing customization (wp-admin/edit.php) |
|
| 1107 | - // Add custom columns |
|
| 1108 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1109 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1110 | - // Add 4W selection |
|
| 1111 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1112 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1106 | + // Entity listing customization (wp-admin/edit.php) |
|
| 1107 | + // Add custom columns |
|
| 1108 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1109 | + $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1110 | + // Add 4W selection |
|
| 1111 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1112 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1113 | 1113 | |
| 1114 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1114 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1115 | 1115 | |
| 1116 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1117 | - // entities. |
|
| 1118 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1116 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 1117 | + // entities. |
|
| 1118 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1119 | 1119 | |
| 1120 | - // Filter imported post meta. |
|
| 1121 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1120 | + // Filter imported post meta. |
|
| 1121 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1122 | 1122 | |
| 1123 | - // Notify the import service when an import starts and ends. |
|
| 1124 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1125 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1126 | - |
|
| 1127 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1128 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1123 | + // Notify the import service when an import starts and ends. |
|
| 1124 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1125 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1126 | + |
|
| 1127 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 1128 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1129 | 1129 | |
| 1130 | - // Hook the menu to the Download Your Data page. |
|
| 1131 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1132 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1133 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1134 | - |
|
| 1135 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1136 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1130 | + // Hook the menu to the Download Your Data page. |
|
| 1131 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1132 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1133 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1134 | + |
|
| 1135 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 1136 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1137 | 1137 | |
| 1138 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1139 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1138 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1139 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1140 | 1140 | |
| 1141 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1142 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1141 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
| 1142 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1143 | 1143 | |
| 1144 | - // Hook the `admin_init` function to the Admin Setup. |
|
| 1145 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1144 | + // Hook the `admin_init` function to the Admin Setup. |
|
| 1145 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1146 | 1146 | |
| 1147 | - // Hook the admin_init to the settings page. |
|
| 1148 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1147 | + // Hook the admin_init to the settings page. |
|
| 1148 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1149 | 1149 | |
| 1150 | - // Hook the menu creation on the general wordlift menu creation |
|
| 1151 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1150 | + // Hook the menu creation on the general wordlift menu creation |
|
| 1151 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1152 | 1152 | |
| 1153 | - // Hook key update. |
|
| 1154 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1155 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1153 | + // Hook key update. |
|
| 1154 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1155 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1156 | 1156 | |
| 1157 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1158 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1157 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
| 1158 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1159 | 1159 | |
| 1160 | - // Hook the AJAX `wl_publisher` action name. |
|
| 1161 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1160 | + // Hook the AJAX `wl_publisher` action name. |
|
| 1161 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1162 | 1162 | |
| 1163 | - // Hook row actions for the entity type list admin. |
|
| 1164 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1163 | + // Hook row actions for the entity type list admin. |
|
| 1164 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1165 | 1165 | |
| 1166 | - // Hook capabilities manipulation to allow access to entity type admin |
|
| 1167 | - // page on wordpress versions before 4.7. |
|
| 1168 | - global $wp_version; |
|
| 1169 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1170 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1171 | - } |
|
| 1166 | + // Hook capabilities manipulation to allow access to entity type admin |
|
| 1167 | + // page on wordpress versions before 4.7. |
|
| 1168 | + global $wp_version; |
|
| 1169 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1170 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1171 | + } |
|
| 1172 | 1172 | |
| 1173 | - /** Adapters. */ |
|
| 1174 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1173 | + /** Adapters. */ |
|
| 1174 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1175 | 1175 | |
| 1176 | - $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1176 | + $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1177 | 1177 | |
| 1178 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1179 | - if ( is_multisite() ) { |
|
| 1180 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1181 | - } |
|
| 1182 | - } |
|
| 1178 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
| 1179 | + if ( is_multisite() ) { |
|
| 1180 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1181 | + } |
|
| 1182 | + } |
|
| 1183 | 1183 | |
| 1184 | - /** |
|
| 1185 | - * Register all of the hooks related to the public-facing functionality |
|
| 1186 | - * of the plugin. |
|
| 1187 | - * |
|
| 1188 | - * @since 1.0.0 |
|
| 1189 | - * @access private |
|
| 1190 | - */ |
|
| 1191 | - private function define_public_hooks() { |
|
| 1184 | + /** |
|
| 1185 | + * Register all of the hooks related to the public-facing functionality |
|
| 1186 | + * of the plugin. |
|
| 1187 | + * |
|
| 1188 | + * @since 1.0.0 |
|
| 1189 | + * @access private |
|
| 1190 | + */ |
|
| 1191 | + private function define_public_hooks() { |
|
| 1192 | 1192 | |
| 1193 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1193 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1194 | 1194 | |
| 1195 | - // Register the entity post type. |
|
| 1196 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1195 | + // Register the entity post type. |
|
| 1196 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1197 | 1197 | |
| 1198 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 1199 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1200 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1201 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1202 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1198 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 1199 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1200 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1201 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1202 | + $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1203 | 1203 | |
| 1204 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1205 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1204 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1205 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1206 | 1206 | |
| 1207 | - // Hook the content filter service to add entity links. |
|
| 1208 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1207 | + // Hook the content filter service to add entity links. |
|
| 1208 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1209 | 1209 | |
| 1210 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1211 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1210 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 1211 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1212 | 1212 | |
| 1213 | - // Hook the ShareThis service. |
|
| 1214 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1215 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1213 | + // Hook the ShareThis service. |
|
| 1214 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1215 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1216 | 1216 | |
| 1217 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1218 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1217 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
| 1218 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1219 | 1219 | |
| 1220 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1221 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1222 | - // to categories. |
|
| 1223 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1220 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
| 1221 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
| 1222 | + // to categories. |
|
| 1223 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1224 | 1224 | |
| 1225 | - /* |
|
| 1225 | + /* |
|
| 1226 | 1226 | * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service` |
| 1227 | 1227 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1228 | 1228 | * order of start time. |
| 1229 | 1229 | */ |
| 1230 | - $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1231 | - |
|
| 1232 | - $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1233 | - |
|
| 1234 | - } |
|
| 1235 | - |
|
| 1236 | - /** |
|
| 1237 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 1238 | - * |
|
| 1239 | - * @since 1.0.0 |
|
| 1240 | - */ |
|
| 1241 | - public function run() { |
|
| 1242 | - $this->loader->run(); |
|
| 1243 | - } |
|
| 1244 | - |
|
| 1245 | - /** |
|
| 1246 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 1247 | - * WordPress and to define internationalization functionality. |
|
| 1248 | - * |
|
| 1249 | - * @since 1.0.0 |
|
| 1250 | - * @return string The name of the plugin. |
|
| 1251 | - */ |
|
| 1252 | - public function get_plugin_name() { |
|
| 1253 | - return $this->plugin_name; |
|
| 1254 | - } |
|
| 1255 | - |
|
| 1256 | - /** |
|
| 1257 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1258 | - * |
|
| 1259 | - * @since 1.0.0 |
|
| 1260 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1261 | - */ |
|
| 1262 | - public function get_loader() { |
|
| 1263 | - return $this->loader; |
|
| 1264 | - } |
|
| 1265 | - |
|
| 1266 | - /** |
|
| 1267 | - * Retrieve the version number of the plugin. |
|
| 1268 | - * |
|
| 1269 | - * @since 1.0.0 |
|
| 1270 | - * @return string The version number of the plugin. |
|
| 1271 | - */ |
|
| 1272 | - public function get_version() { |
|
| 1273 | - return $this->version; |
|
| 1274 | - } |
|
| 1230 | + $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1231 | + |
|
| 1232 | + $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1233 | + |
|
| 1234 | + } |
|
| 1235 | + |
|
| 1236 | + /** |
|
| 1237 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 1238 | + * |
|
| 1239 | + * @since 1.0.0 |
|
| 1240 | + */ |
|
| 1241 | + public function run() { |
|
| 1242 | + $this->loader->run(); |
|
| 1243 | + } |
|
| 1244 | + |
|
| 1245 | + /** |
|
| 1246 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 1247 | + * WordPress and to define internationalization functionality. |
|
| 1248 | + * |
|
| 1249 | + * @since 1.0.0 |
|
| 1250 | + * @return string The name of the plugin. |
|
| 1251 | + */ |
|
| 1252 | + public function get_plugin_name() { |
|
| 1253 | + return $this->plugin_name; |
|
| 1254 | + } |
|
| 1255 | + |
|
| 1256 | + /** |
|
| 1257 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 1258 | + * |
|
| 1259 | + * @since 1.0.0 |
|
| 1260 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 1261 | + */ |
|
| 1262 | + public function get_loader() { |
|
| 1263 | + return $this->loader; |
|
| 1264 | + } |
|
| 1265 | + |
|
| 1266 | + /** |
|
| 1267 | + * Retrieve the version number of the plugin. |
|
| 1268 | + * |
|
| 1269 | + * @since 1.0.0 |
|
| 1270 | + * @return string The version number of the plugin. |
|
| 1271 | + */ |
|
| 1272 | + public function get_version() { |
|
| 1273 | + return $this->version; |
|
| 1274 | + } |
|
| 1275 | 1275 | |
| 1276 | 1276 | } |
@@ -556,332 +556,332 @@ discard block |
||
| 556 | 556 | * The class responsible for orchestrating the actions and filters of the |
| 557 | 557 | * core plugin. |
| 558 | 558 | */ |
| 559 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 559 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 560 | 560 | |
| 561 | 561 | /** |
| 562 | 562 | * The class responsible for defining internationalization functionality |
| 563 | 563 | * of the plugin. |
| 564 | 564 | */ |
| 565 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 565 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 566 | 566 | |
| 567 | 567 | /** |
| 568 | 568 | * WordLift's supported languages. |
| 569 | 569 | */ |
| 570 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
| 570 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
| 571 | 571 | |
| 572 | 572 | /** |
| 573 | 573 | * Provide support functions to sanitize data. |
| 574 | 574 | */ |
| 575 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 575 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 576 | 576 | |
| 577 | 577 | /** |
| 578 | 578 | * The Redirect service. |
| 579 | 579 | */ |
| 580 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 580 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 581 | 581 | |
| 582 | 582 | /** |
| 583 | 583 | * The Log service. |
| 584 | 584 | */ |
| 585 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 585 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 586 | 586 | |
| 587 | 587 | /** |
| 588 | 588 | * The configuration service. |
| 589 | 589 | */ |
| 590 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 590 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 591 | 591 | |
| 592 | 592 | /** |
| 593 | 593 | * The entity post type service (this is the WordPress post type, not the entity schema type). |
| 594 | 594 | */ |
| 595 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
| 595 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
| 596 | 596 | |
| 597 | 597 | /** |
| 598 | 598 | * The entity type service (i.e. the schema type). |
| 599 | 599 | */ |
| 600 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 600 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 601 | 601 | |
| 602 | 602 | /** |
| 603 | 603 | * The entity link service. |
| 604 | 604 | */ |
| 605 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 605 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 606 | 606 | |
| 607 | 607 | /** |
| 608 | 608 | * The Query builder. |
| 609 | 609 | */ |
| 610 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 610 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 611 | 611 | |
| 612 | 612 | /** |
| 613 | 613 | * The Schema service. |
| 614 | 614 | */ |
| 615 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 615 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 616 | 616 | |
| 617 | 617 | /** |
| 618 | 618 | * The schema:url property service. |
| 619 | 619 | */ |
| 620 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 621 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 620 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 621 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 622 | 622 | |
| 623 | 623 | /** |
| 624 | 624 | * The UI service. |
| 625 | 625 | */ |
| 626 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 626 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 627 | 627 | |
| 628 | 628 | /** |
| 629 | 629 | * The Thumbnail service. |
| 630 | 630 | */ |
| 631 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 631 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 632 | 632 | |
| 633 | 633 | /** |
| 634 | 634 | * The Entity Types Taxonomy service. |
| 635 | 635 | */ |
| 636 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 636 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 637 | 637 | |
| 638 | 638 | /** |
| 639 | 639 | * The Entity service. |
| 640 | 640 | */ |
| 641 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 641 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 642 | 642 | |
| 643 | 643 | // Add the entity rating service. |
| 644 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
| 644 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
| 645 | 645 | |
| 646 | 646 | /** |
| 647 | 647 | * The User service. |
| 648 | 648 | */ |
| 649 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 649 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 650 | 650 | |
| 651 | 651 | /** |
| 652 | 652 | * The Timeline service. |
| 653 | 653 | */ |
| 654 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 654 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 655 | 655 | |
| 656 | 656 | /** |
| 657 | 657 | * The Topic Taxonomy service. |
| 658 | 658 | */ |
| 659 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 659 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 660 | 660 | |
| 661 | 661 | /** |
| 662 | 662 | * The SPARQL service. |
| 663 | 663 | */ |
| 664 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 664 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 665 | 665 | |
| 666 | 666 | /** |
| 667 | 667 | * The WordLift import service. |
| 668 | 668 | */ |
| 669 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 669 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 670 | 670 | |
| 671 | 671 | /** |
| 672 | 672 | * The WordLift URI service. |
| 673 | 673 | */ |
| 674 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 674 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 675 | 675 | |
| 676 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 676 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php'; |
|
| 677 | 677 | |
| 678 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
| 678 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
| 679 | 679 | |
| 680 | 680 | /** |
| 681 | 681 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 682 | 682 | */ |
| 683 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 683 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php'; |
|
| 684 | 684 | |
| 685 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 685 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
| 686 | 686 | |
| 687 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
| 687 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
| 688 | 688 | |
| 689 | 689 | /** |
| 690 | 690 | * Load the converters. |
| 691 | 691 | */ |
| 692 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
| 693 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 694 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 695 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 696 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 697 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 692 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
| 693 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
| 694 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
| 695 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
| 696 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
| 697 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
| 698 | 698 | |
| 699 | 699 | /** |
| 700 | 700 | * Load the content filter. |
| 701 | 701 | */ |
| 702 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
| 702 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
| 703 | 703 | |
| 704 | 704 | /* |
| 705 | 705 | * Load the excerpt helper. |
| 706 | 706 | */ |
| 707 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 707 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
| 708 | 708 | |
| 709 | 709 | /** |
| 710 | 710 | * Load the JSON-LD service to publish entities using JSON-LD.s |
| 711 | 711 | * |
| 712 | 712 | * @since 3.8.0 |
| 713 | 713 | */ |
| 714 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
| 714 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
| 715 | 715 | |
| 716 | 716 | // The Publisher Service and the AJAX adapter. |
| 717 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
| 718 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 717 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
| 718 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
| 719 | 719 | |
| 720 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
| 720 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
| 721 | 721 | |
| 722 | 722 | /** |
| 723 | 723 | * Load the WordLift key validation service. |
| 724 | 724 | */ |
| 725 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
| 725 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
| 726 | 726 | |
| 727 | 727 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
| 728 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 728 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
| 729 | 729 | |
| 730 | 730 | // Load the `Wordlift_Event_Entity_Page_Service` class definition. |
| 731 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php'; |
|
| 731 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-event-entity-page-service.php'; |
|
| 732 | 732 | |
| 733 | 733 | /** Adapters. */ |
| 734 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
| 735 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
| 734 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
| 735 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
| 736 | 736 | |
| 737 | 737 | /** Async Tasks. */ |
| 738 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php'; |
|
| 739 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 738 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/wp-async-task.php'; |
|
| 739 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
| 740 | 740 | |
| 741 | 741 | /** |
| 742 | 742 | * The class responsible for defining all actions that occur in the admin area. |
| 743 | 743 | */ |
| 744 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 744 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 745 | 745 | |
| 746 | 746 | /** |
| 747 | 747 | * The class to customize the entity list admin page. |
| 748 | 748 | */ |
| 749 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 749 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | 752 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 753 | 753 | */ |
| 754 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 754 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 755 | 755 | |
| 756 | 756 | /** |
| 757 | 757 | * The Notice service. |
| 758 | 758 | */ |
| 759 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 759 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 760 | 760 | |
| 761 | 761 | /** |
| 762 | 762 | * The PrimaShop adapter. |
| 763 | 763 | */ |
| 764 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 764 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 765 | 765 | |
| 766 | 766 | /** |
| 767 | 767 | * The WordLift Dashboard service. |
| 768 | 768 | */ |
| 769 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 769 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 770 | 770 | |
| 771 | 771 | /** |
| 772 | 772 | * The admin 'Install wizard' page. |
| 773 | 773 | */ |
| 774 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
| 774 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
| 775 | 775 | |
| 776 | 776 | /** |
| 777 | 777 | * The WordLift entity type list admin page controller. |
| 778 | 778 | */ |
| 779 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 779 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | 782 | * The WordLift entity type settings admin page controller. |
| 783 | 783 | */ |
| 784 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
| 784 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
| 785 | 785 | |
| 786 | 786 | /** |
| 787 | 787 | * The admin 'Download Your Data' page. |
| 788 | 788 | */ |
| 789 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 789 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 790 | 790 | |
| 791 | 791 | /** |
| 792 | 792 | * The admin 'Download Your Data' page. |
| 793 | 793 | */ |
| 794 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 794 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 795 | 795 | |
| 796 | 796 | /** |
| 797 | 797 | * The admin 'WordLift Settings' page. |
| 798 | 798 | */ |
| 799 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php'; |
|
| 800 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php'; |
|
| 801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 802 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php'; |
|
| 803 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php'; |
|
| 804 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php'; |
|
| 805 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php'; |
|
| 806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php'; |
|
| 807 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
| 808 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
| 809 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 799 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php'; |
|
| 800 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php'; |
|
| 801 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php'; |
|
| 802 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php'; |
|
| 803 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php'; |
|
| 804 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php'; |
|
| 805 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php'; |
|
| 806 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php'; |
|
| 807 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
| 808 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
| 809 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
| 810 | 810 | |
| 811 | 811 | /** Admin Pages */ |
| 812 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 813 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 814 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
| 812 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
| 813 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
| 814 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
| 815 | 815 | |
| 816 | 816 | /** |
| 817 | 817 | * The class responsible for defining all actions that occur in the public-facing |
| 818 | 818 | * side of the site. |
| 819 | 819 | */ |
| 820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 820 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 821 | 821 | |
| 822 | 822 | /** |
| 823 | 823 | * The shortcode abstract class. |
| 824 | 824 | */ |
| 825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 825 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 826 | 826 | |
| 827 | 827 | /** |
| 828 | 828 | * The Timeline shortcode. |
| 829 | 829 | */ |
| 830 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 830 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 831 | 831 | |
| 832 | 832 | /** |
| 833 | 833 | * The Navigator shortcode. |
| 834 | 834 | */ |
| 835 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 835 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 836 | 836 | |
| 837 | 837 | /** |
| 838 | 838 | * The chord shortcode. |
| 839 | 839 | */ |
| 840 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 840 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 841 | 841 | |
| 842 | 842 | /** |
| 843 | 843 | * The geomap shortcode. |
| 844 | 844 | */ |
| 845 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 845 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 846 | 846 | |
| 847 | 847 | /** |
| 848 | 848 | * The entity cloud shortcode. |
| 849 | 849 | */ |
| 850 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 850 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
| 851 | 851 | |
| 852 | 852 | /** |
| 853 | 853 | * The ShareThis service. |
| 854 | 854 | */ |
| 855 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 855 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | 858 | * The SEO service. |
| 859 | 859 | */ |
| 860 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
| 860 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * The AMP service. |
| 864 | 864 | */ |
| 865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
| 865 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
| 866 | 866 | |
| 867 | 867 | /** Widgets */ |
| 868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
| 869 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 868 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
| 869 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
| 870 | 870 | |
| 871 | 871 | $this->loader = new Wordlift_Loader(); |
| 872 | 872 | |
| 873 | 873 | // Instantiate a global logger. |
| 874 | 874 | global $wl_logger; |
| 875 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 875 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 876 | 876 | |
| 877 | 877 | // Create the configuration service. |
| 878 | 878 | $this->configuration_service = new Wordlift_Configuration_Service(); |
| 879 | 879 | |
| 880 | 880 | // Create an entity type service instance. It'll be later bound to the init action. |
| 881 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
| 881 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
| 882 | 882 | |
| 883 | 883 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 884 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
| 884 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
| 885 | 885 | |
| 886 | 886 | // Create an instance of the UI service. |
| 887 | 887 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -892,23 +892,23 @@ discard block |
||
| 892 | 892 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 893 | 893 | |
| 894 | 894 | // Create an instance of the Schema service. |
| 895 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 895 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 896 | 896 | $this->schema_service = new Wordlift_Schema_Service(); |
| 897 | 897 | |
| 898 | 898 | // Create an instance of the Notice service. |
| 899 | 899 | $this->notice_service = new Wordlift_Notice_Service(); |
| 900 | 900 | |
| 901 | 901 | // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
| 902 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service ); |
|
| 902 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service); |
|
| 903 | 903 | |
| 904 | 904 | // Create an instance of the User service. |
| 905 | 905 | $this->user_service = new Wordlift_User_Service(); |
| 906 | 906 | |
| 907 | 907 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 908 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 908 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service); |
|
| 909 | 909 | |
| 910 | 910 | // Create a new instance of the Redirect service. |
| 911 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 911 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_service); |
|
| 912 | 912 | |
| 913 | 913 | // Initialize the shortcodes. |
| 914 | 914 | new Wordlift_Navigator_Shortcode(); |
@@ -934,46 +934,46 @@ discard block |
||
| 934 | 934 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
| 935 | 935 | |
| 936 | 936 | // Create an import service instance to hook later to WP's import function. |
| 937 | - $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() ); |
|
| 937 | + $this->import_service = new Wordlift_Import_Service($this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri()); |
|
| 938 | 938 | |
| 939 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 939 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 940 | 940 | |
| 941 | 941 | // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
| 942 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 942 | + $this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service); |
|
| 943 | 943 | |
| 944 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
| 944 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
| 945 | 945 | |
| 946 | 946 | // Create the entity rating service. |
| 947 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
| 947 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
| 948 | 948 | |
| 949 | 949 | // Create entity list customization (wp-admin/edit.php) |
| 950 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
| 950 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
| 951 | 951 | |
| 952 | 952 | // Create a new instance of the Redirect service. |
| 953 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service ); |
|
| 953 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service); |
|
| 954 | 954 | |
| 955 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
| 956 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
| 955 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
| 956 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
| 957 | 957 | |
| 958 | 958 | $attachment_service = new Wordlift_Attachment_Service(); |
| 959 | 959 | |
| 960 | 960 | // Instantiate the JSON-LD service. |
| 961 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
| 962 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter ); |
|
| 963 | - $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter ); |
|
| 964 | - $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter ); |
|
| 965 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
| 966 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
| 961 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
| 962 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter); |
|
| 963 | + $this->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter); |
|
| 964 | + $this->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter($this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter); |
|
| 965 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
| 966 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
| 967 | 967 | |
| 968 | 968 | // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins). |
| 969 | 969 | $this->key_validation_service = new Wordlift_Key_Validation_Service(); |
| 970 | 970 | |
| 971 | 971 | // Create an instance of the Publisher Service and the AJAX Adapter. |
| 972 | 972 | $publisher_service = new Wordlift_Publisher_Service(); |
| 973 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service ); |
|
| 973 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($publisher_service); |
|
| 974 | 974 | |
| 975 | 975 | /** Adapters. */ |
| 976 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
| 976 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
| 977 | 977 | |
| 978 | 978 | /** Async Tasks. */ |
| 979 | 979 | new Wordlift_Sparql_Query_Async_Task(); |
@@ -986,15 +986,15 @@ discard block |
||
| 986 | 986 | $this->select2_element = new Wordlift_Admin_Select2_Element(); |
| 987 | 987 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
| 988 | 988 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
| 989 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element ); |
|
| 990 | - $this->author_element = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element ); |
|
| 989 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element); |
|
| 990 | + $this->author_element = new Wordlift_Admin_Author_Element($publisher_service, $this->select2_element); |
|
| 991 | 991 | |
| 992 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 993 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element ); |
|
| 994 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
| 992 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 993 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element); |
|
| 994 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
| 995 | 995 | |
| 996 | 996 | // Pages. |
| 997 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
| 997 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
| 998 | 998 | |
| 999 | 999 | // create an instance of the entity type list admin page controller. |
| 1000 | 1000 | $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
@@ -1006,26 +1006,26 @@ discard block |
||
| 1006 | 1006 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
| 1007 | 1007 | |
| 1008 | 1008 | //** WordPress Admin */ |
| 1009 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
| 1010 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
| 1009 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
| 1010 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
| 1011 | 1011 | |
| 1012 | 1012 | // Create an instance of the install wizard. |
| 1013 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service ); |
|
| 1013 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service); |
|
| 1014 | 1014 | |
| 1015 | 1015 | // Create an instance of the content filter service. |
| 1016 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service ); |
|
| 1016 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service); |
|
| 1017 | 1017 | |
| 1018 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
| 1018 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
| 1019 | 1019 | |
| 1020 | 1020 | // User Profile. |
| 1021 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
| 1021 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
| 1022 | 1022 | |
| 1023 | 1023 | $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service(); |
| 1024 | 1024 | |
| 1025 | 1025 | // Load the debug service if WP is in debug mode. |
| 1026 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
| 1027 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
| 1028 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
| 1026 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 1027 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
| 1028 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | } |
@@ -1042,9 +1042,9 @@ discard block |
||
| 1042 | 1042 | private function set_locale() { |
| 1043 | 1043 | |
| 1044 | 1044 | $plugin_i18n = new Wordlift_i18n(); |
| 1045 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 1045 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 1046 | 1046 | |
| 1047 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 1047 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 1048 | 1048 | |
| 1049 | 1049 | } |
| 1050 | 1050 | |
@@ -1065,119 +1065,119 @@ discard block |
||
| 1065 | 1065 | $this->user_service |
| 1066 | 1066 | ); |
| 1067 | 1067 | |
| 1068 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 1069 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 1068 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 1069 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 1070 | 1070 | |
| 1071 | 1071 | // Hook the init action to the Topic Taxonomy service. |
| 1072 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 1072 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 1073 | 1073 | |
| 1074 | 1074 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 1075 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 1075 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 1076 | 1076 | |
| 1077 | 1077 | // Hook the added_post_meta action to the Thumbnail service. |
| 1078 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1078 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1079 | 1079 | |
| 1080 | 1080 | // Hook the updated_post_meta action to the Thumbnail service. |
| 1081 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 1081 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 1082 | 1082 | |
| 1083 | 1083 | // Hook posts inserts (or updates) to the user service. |
| 1084 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 1084 | + $this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3); |
|
| 1085 | 1085 | |
| 1086 | 1086 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1087 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1087 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1088 | 1088 | |
| 1089 | 1089 | // Register custom allowed redirect hosts. |
| 1090 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 1090 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 1091 | 1091 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1092 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 1092 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 1093 | 1093 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1094 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 1094 | + $this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats'); |
|
| 1095 | 1095 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 1096 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 1096 | + $this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets'); |
|
| 1097 | 1097 | |
| 1098 | 1098 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 1099 | 1099 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 1100 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 1101 | - $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 ); |
|
| 1100 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 1101 | + $this->loader->add_action('save_post_entity', $this->rating_service, 'set_rating_for', 10, 1); |
|
| 1102 | 1102 | |
| 1103 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 1104 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
| 1103 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 1104 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
| 1105 | 1105 | |
| 1106 | 1106 | // Entity listing customization (wp-admin/edit.php) |
| 1107 | 1107 | // Add custom columns |
| 1108 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 1109 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 1108 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 1109 | + $this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 1110 | 1110 | // Add 4W selection |
| 1111 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 1112 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 1111 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 1112 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 1113 | 1113 | |
| 1114 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 1114 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 1115 | 1115 | |
| 1116 | 1116 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 1117 | 1117 | // entities. |
| 1118 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 1118 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 1119 | 1119 | |
| 1120 | 1120 | // Filter imported post meta. |
| 1121 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 1121 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 1122 | 1122 | |
| 1123 | 1123 | // Notify the import service when an import starts and ends. |
| 1124 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 1125 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 1124 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 1125 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 1126 | 1126 | |
| 1127 | 1127 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 1128 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 1128 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 1129 | 1129 | |
| 1130 | 1130 | // Hook the menu to the Download Your Data page. |
| 1131 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 1132 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
| 1133 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
| 1131 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 1132 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
| 1133 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
| 1134 | 1134 | |
| 1135 | 1135 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 1136 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 1136 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 1137 | 1137 | |
| 1138 | 1138 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1139 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1139 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1140 | 1140 | |
| 1141 | 1141 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
| 1142 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
| 1142 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
| 1143 | 1143 | |
| 1144 | 1144 | // Hook the `admin_init` function to the Admin Setup. |
| 1145 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
| 1145 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
| 1146 | 1146 | |
| 1147 | 1147 | // Hook the admin_init to the settings page. |
| 1148 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
| 1148 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
| 1149 | 1149 | |
| 1150 | 1150 | // Hook the menu creation on the general wordlift menu creation |
| 1151 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
| 1151 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
| 1152 | 1152 | |
| 1153 | 1153 | // Hook key update. |
| 1154 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
| 1155 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
| 1154 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
| 1155 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
| 1156 | 1156 | |
| 1157 | 1157 | // Add additional action links to the WordLift plugin in the plugins page. |
| 1158 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
| 1158 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
| 1159 | 1159 | |
| 1160 | 1160 | // Hook the AJAX `wl_publisher` action name. |
| 1161 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
| 1161 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
| 1162 | 1162 | |
| 1163 | 1163 | // Hook row actions for the entity type list admin. |
| 1164 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
| 1164 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
| 1165 | 1165 | |
| 1166 | 1166 | // Hook capabilities manipulation to allow access to entity type admin |
| 1167 | 1167 | // page on wordpress versions before 4.7. |
| 1168 | 1168 | global $wp_version; |
| 1169 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
| 1170 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
| 1169 | + if (version_compare($wp_version, '4.7', '<')) { |
|
| 1170 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | 1173 | /** Adapters. */ |
| 1174 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
| 1174 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
| 1175 | 1175 | |
| 1176 | - $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1176 | + $this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1177 | 1177 | |
| 1178 | 1178 | // Hooks to restrict multisite super admin from manipulating entity types. |
| 1179 | - if ( is_multisite() ) { |
|
| 1180 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
| 1179 | + if (is_multisite()) { |
|
| 1180 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | 1183 | |
@@ -1190,46 +1190,46 @@ discard block |
||
| 1190 | 1190 | */ |
| 1191 | 1191 | private function define_public_hooks() { |
| 1192 | 1192 | |
| 1193 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 1193 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 1194 | 1194 | |
| 1195 | 1195 | // Register the entity post type. |
| 1196 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
| 1196 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
| 1197 | 1197 | |
| 1198 | 1198 | // Bind the link generation and handling hooks to the entity link service. |
| 1199 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 1200 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
| 1201 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 ); |
|
| 1202 | - $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 ); |
|
| 1199 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 1200 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
| 1201 | + $this->loader->add_filter('wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3); |
|
| 1202 | + $this->loader->add_filter('wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4); |
|
| 1203 | 1203 | |
| 1204 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 1205 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 1204 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 1205 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 1206 | 1206 | |
| 1207 | 1207 | // Hook the content filter service to add entity links. |
| 1208 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
| 1208 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
| 1209 | 1209 | |
| 1210 | 1210 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 1211 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 1211 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 1212 | 1212 | |
| 1213 | 1213 | // Hook the ShareThis service. |
| 1214 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 1215 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 1214 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 1215 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 1216 | 1216 | |
| 1217 | 1217 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
| 1218 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
| 1218 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
| 1219 | 1219 | |
| 1220 | 1220 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
| 1221 | 1221 | // in order to tweak WP's `WP_Query` to include entities in queries related |
| 1222 | 1222 | // to categories. |
| 1223 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
| 1223 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
| 1224 | 1224 | |
| 1225 | 1225 | /* |
| 1226 | 1226 | * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service` |
| 1227 | 1227 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
| 1228 | 1228 | * order of start time. |
| 1229 | 1229 | */ |
| 1230 | - $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 ); |
|
| 1230 | + $this->loader->add_action('pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1); |
|
| 1231 | 1231 | |
| 1232 | - $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
| 1232 | + $this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
| 1233 | 1233 | |
| 1234 | 1234 | } |
| 1235 | 1235 | |
@@ -13,119 +13,119 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class Wordlift_Jsonld_Service { |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * A {@link Wordlift_Entity_Service} instance. |
|
| 18 | - * |
|
| 19 | - * @since 3.8.0 |
|
| 20 | - * @access private |
|
| 21 | - * @var Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 22 | - */ |
|
| 23 | - private $entity_service; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * A {@link Wordlift_Post_Converter} instance. |
|
| 27 | - * |
|
| 28 | - * @since 3.8.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var \Wordlift_Post_Converter A {@link Wordlift_Post_Converter} instance. |
|
| 31 | - */ |
|
| 32 | - private $converter; |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 37 | - * |
|
| 38 | - * @since 3.14.0 |
|
| 39 | - * @access private |
|
| 40 | - * @var \Wordlift_Website_Jsonld_Converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 41 | - */ |
|
| 42 | - private $website_converter; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Create a JSON-LD service. |
|
| 46 | - * |
|
| 47 | - * @since 3.8.0 |
|
| 48 | - * |
|
| 49 | - * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 50 | - * @param \Wordlift_Post_Converter $converter A {@link Wordlift_Uri_To_Jsonld_Converter} instance. |
|
| 51 | - * @param \Wordlift_Website_Jsonld_Converter $website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 52 | - */ |
|
| 53 | - public function __construct( $entity_service, $converter, $website_converter ) { |
|
| 54 | - |
|
| 55 | - $this->entity_service = $entity_service; |
|
| 56 | - $this->converter = $converter; |
|
| 57 | - $this->website_converter = $website_converter; |
|
| 58 | - |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Process calls to the AJAX 'wl_jsonld' endpoint. |
|
| 63 | - * |
|
| 64 | - * @since 3.8.0 |
|
| 65 | - */ |
|
| 66 | - public function get() { |
|
| 67 | - |
|
| 68 | - // Tell NewRelic to ignore us, otherwise NewRelic customers might receive |
|
| 69 | - // e-mails with a low apdex score. |
|
| 70 | - // |
|
| 71 | - // See https://github.com/insideout10/wordlift-plugin/issues/521 |
|
| 72 | - Wordlift_NewRelic_Adapter::ignore_apdex(); |
|
| 73 | - |
|
| 74 | - // Clear the buffer to be sure someone doesn't mess with our response. |
|
| 75 | - // |
|
| 76 | - // See https://github.com/insideout10/wordlift-plugin/issues/406. |
|
| 77 | - // See https://codex.wordpress.org/AJAX_in_Plugins. |
|
| 78 | - ob_clean(); |
|
| 79 | - |
|
| 80 | - // Switch to Website converter if is home page. |
|
| 81 | - if ( isset( $_REQUEST['homepage'] ) ) { |
|
| 82 | - /** |
|
| 83 | - * Filter: 'wordlift_disable_website_json_ld' - Allow disabling of the json+ld output. |
|
| 84 | - * |
|
| 85 | - * @since 3.14.0 |
|
| 86 | - * @api bool $display_search Whether or not to display json+ld search on the frontend. |
|
| 87 | - */ |
|
| 88 | - if ( ! apply_filters( 'wordlift_disable_website_json_ld', false ) ) { |
|
| 89 | - // Set a reference to the website_converter. |
|
| 90 | - $website_converter = $this->website_converter; |
|
| 91 | - |
|
| 92 | - // Send JSON-LD. |
|
| 93 | - wp_send_json( $website_converter->create_schema() ); |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - // If no id has been provided return an empty array. |
|
| 98 | - if ( ! isset( $_REQUEST['id'] ) ) { |
|
| 99 | - wp_send_json( array() ); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - // Get the id. |
|
| 103 | - $id = $_REQUEST['id']; |
|
| 104 | - |
|
| 105 | - // An array of references which is captured when converting an URI to a |
|
| 106 | - // json which we gather to further expand our json-ld. |
|
| 107 | - $references = array(); |
|
| 108 | - |
|
| 109 | - // Set a reference to the entity_to_jsonld_converter to use in the closures. |
|
| 110 | - $entity_to_jsonld_converter = $this->converter; |
|
| 111 | - |
|
| 112 | - // Convert each URI to a JSON-LD array, while gathering referenced entities. |
|
| 113 | - // in the references array. |
|
| 114 | - $jsonld = array_merge( |
|
| 115 | - array( $entity_to_jsonld_converter->convert( $id, $references ) ), |
|
| 116 | - // Convert each URI in the references array to JSON-LD. We don't output |
|
| 117 | - // entities already output above (hence the array_diff). |
|
| 118 | - array_map( function ( $item ) use ( $entity_to_jsonld_converter, $references ) { |
|
| 119 | - |
|
| 120 | - // "2nd level properties" may not output here, e.g. a post |
|
| 121 | - // mentioning an event, located in a place: the place is referenced |
|
| 122 | - // via the `@id` but no other properties are loaded. |
|
| 123 | - return $entity_to_jsonld_converter->convert( $item, $references ); |
|
| 124 | - }, $references ) ); |
|
| 125 | - |
|
| 126 | - // Finally send the JSON-LD. |
|
| 127 | - wp_send_json( $jsonld ); |
|
| 128 | - |
|
| 129 | - } |
|
| 16 | + /** |
|
| 17 | + * A {@link Wordlift_Entity_Service} instance. |
|
| 18 | + * |
|
| 19 | + * @since 3.8.0 |
|
| 20 | + * @access private |
|
| 21 | + * @var Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 22 | + */ |
|
| 23 | + private $entity_service; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * A {@link Wordlift_Post_Converter} instance. |
|
| 27 | + * |
|
| 28 | + * @since 3.8.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var \Wordlift_Post_Converter A {@link Wordlift_Post_Converter} instance. |
|
| 31 | + */ |
|
| 32 | + private $converter; |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 37 | + * |
|
| 38 | + * @since 3.14.0 |
|
| 39 | + * @access private |
|
| 40 | + * @var \Wordlift_Website_Jsonld_Converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 41 | + */ |
|
| 42 | + private $website_converter; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Create a JSON-LD service. |
|
| 46 | + * |
|
| 47 | + * @since 3.8.0 |
|
| 48 | + * |
|
| 49 | + * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance. |
|
| 50 | + * @param \Wordlift_Post_Converter $converter A {@link Wordlift_Uri_To_Jsonld_Converter} instance. |
|
| 51 | + * @param \Wordlift_Website_Jsonld_Converter $website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
| 52 | + */ |
|
| 53 | + public function __construct( $entity_service, $converter, $website_converter ) { |
|
| 54 | + |
|
| 55 | + $this->entity_service = $entity_service; |
|
| 56 | + $this->converter = $converter; |
|
| 57 | + $this->website_converter = $website_converter; |
|
| 58 | + |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Process calls to the AJAX 'wl_jsonld' endpoint. |
|
| 63 | + * |
|
| 64 | + * @since 3.8.0 |
|
| 65 | + */ |
|
| 66 | + public function get() { |
|
| 67 | + |
|
| 68 | + // Tell NewRelic to ignore us, otherwise NewRelic customers might receive |
|
| 69 | + // e-mails with a low apdex score. |
|
| 70 | + // |
|
| 71 | + // See https://github.com/insideout10/wordlift-plugin/issues/521 |
|
| 72 | + Wordlift_NewRelic_Adapter::ignore_apdex(); |
|
| 73 | + |
|
| 74 | + // Clear the buffer to be sure someone doesn't mess with our response. |
|
| 75 | + // |
|
| 76 | + // See https://github.com/insideout10/wordlift-plugin/issues/406. |
|
| 77 | + // See https://codex.wordpress.org/AJAX_in_Plugins. |
|
| 78 | + ob_clean(); |
|
| 79 | + |
|
| 80 | + // Switch to Website converter if is home page. |
|
| 81 | + if ( isset( $_REQUEST['homepage'] ) ) { |
|
| 82 | + /** |
|
| 83 | + * Filter: 'wordlift_disable_website_json_ld' - Allow disabling of the json+ld output. |
|
| 84 | + * |
|
| 85 | + * @since 3.14.0 |
|
| 86 | + * @api bool $display_search Whether or not to display json+ld search on the frontend. |
|
| 87 | + */ |
|
| 88 | + if ( ! apply_filters( 'wordlift_disable_website_json_ld', false ) ) { |
|
| 89 | + // Set a reference to the website_converter. |
|
| 90 | + $website_converter = $this->website_converter; |
|
| 91 | + |
|
| 92 | + // Send JSON-LD. |
|
| 93 | + wp_send_json( $website_converter->create_schema() ); |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + // If no id has been provided return an empty array. |
|
| 98 | + if ( ! isset( $_REQUEST['id'] ) ) { |
|
| 99 | + wp_send_json( array() ); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + // Get the id. |
|
| 103 | + $id = $_REQUEST['id']; |
|
| 104 | + |
|
| 105 | + // An array of references which is captured when converting an URI to a |
|
| 106 | + // json which we gather to further expand our json-ld. |
|
| 107 | + $references = array(); |
|
| 108 | + |
|
| 109 | + // Set a reference to the entity_to_jsonld_converter to use in the closures. |
|
| 110 | + $entity_to_jsonld_converter = $this->converter; |
|
| 111 | + |
|
| 112 | + // Convert each URI to a JSON-LD array, while gathering referenced entities. |
|
| 113 | + // in the references array. |
|
| 114 | + $jsonld = array_merge( |
|
| 115 | + array( $entity_to_jsonld_converter->convert( $id, $references ) ), |
|
| 116 | + // Convert each URI in the references array to JSON-LD. We don't output |
|
| 117 | + // entities already output above (hence the array_diff). |
|
| 118 | + array_map( function ( $item ) use ( $entity_to_jsonld_converter, $references ) { |
|
| 119 | + |
|
| 120 | + // "2nd level properties" may not output here, e.g. a post |
|
| 121 | + // mentioning an event, located in a place: the place is referenced |
|
| 122 | + // via the `@id` but no other properties are loaded. |
|
| 123 | + return $entity_to_jsonld_converter->convert( $item, $references ); |
|
| 124 | + }, $references ) ); |
|
| 125 | + |
|
| 126 | + // Finally send the JSON-LD. |
|
| 127 | + wp_send_json( $jsonld ); |
|
| 128 | + |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | 131 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @param \Wordlift_Post_Converter $converter A {@link Wordlift_Uri_To_Jsonld_Converter} instance. |
| 51 | 51 | * @param \Wordlift_Website_Jsonld_Converter $website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
| 52 | 52 | */ |
| 53 | - public function __construct( $entity_service, $converter, $website_converter ) { |
|
| 53 | + public function __construct($entity_service, $converter, $website_converter) { |
|
| 54 | 54 | |
| 55 | 55 | $this->entity_service = $entity_service; |
| 56 | 56 | $this->converter = $converter; |
@@ -78,25 +78,25 @@ discard block |
||
| 78 | 78 | ob_clean(); |
| 79 | 79 | |
| 80 | 80 | // Switch to Website converter if is home page. |
| 81 | - if ( isset( $_REQUEST['homepage'] ) ) { |
|
| 81 | + if (isset($_REQUEST['homepage'])) { |
|
| 82 | 82 | /** |
| 83 | 83 | * Filter: 'wordlift_disable_website_json_ld' - Allow disabling of the json+ld output. |
| 84 | 84 | * |
| 85 | 85 | * @since 3.14.0 |
| 86 | 86 | * @api bool $display_search Whether or not to display json+ld search on the frontend. |
| 87 | 87 | */ |
| 88 | - if ( ! apply_filters( 'wordlift_disable_website_json_ld', false ) ) { |
|
| 88 | + if ( ! apply_filters('wordlift_disable_website_json_ld', false)) { |
|
| 89 | 89 | // Set a reference to the website_converter. |
| 90 | 90 | $website_converter = $this->website_converter; |
| 91 | 91 | |
| 92 | 92 | // Send JSON-LD. |
| 93 | - wp_send_json( $website_converter->create_schema() ); |
|
| 93 | + wp_send_json($website_converter->create_schema()); |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // If no id has been provided return an empty array. |
| 98 | - if ( ! isset( $_REQUEST['id'] ) ) { |
|
| 99 | - wp_send_json( array() ); |
|
| 98 | + if ( ! isset($_REQUEST['id'])) { |
|
| 99 | + wp_send_json(array()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // Get the id. |
@@ -112,19 +112,19 @@ discard block |
||
| 112 | 112 | // Convert each URI to a JSON-LD array, while gathering referenced entities. |
| 113 | 113 | // in the references array. |
| 114 | 114 | $jsonld = array_merge( |
| 115 | - array( $entity_to_jsonld_converter->convert( $id, $references ) ), |
|
| 115 | + array($entity_to_jsonld_converter->convert($id, $references)), |
|
| 116 | 116 | // Convert each URI in the references array to JSON-LD. We don't output |
| 117 | 117 | // entities already output above (hence the array_diff). |
| 118 | - array_map( function ( $item ) use ( $entity_to_jsonld_converter, $references ) { |
|
| 118 | + array_map(function($item) use ($entity_to_jsonld_converter, $references) { |
|
| 119 | 119 | |
| 120 | 120 | // "2nd level properties" may not output here, e.g. a post |
| 121 | 121 | // mentioning an event, located in a place: the place is referenced |
| 122 | 122 | // via the `@id` but no other properties are loaded. |
| 123 | - return $entity_to_jsonld_converter->convert( $item, $references ); |
|
| 124 | - }, $references ) ); |
|
| 123 | + return $entity_to_jsonld_converter->convert($item, $references); |
|
| 124 | + }, $references) ); |
|
| 125 | 125 | |
| 126 | 126 | // Finally send the JSON-LD. |
| 127 | - wp_send_json( $jsonld ); |
|
| 127 | + wp_send_json($jsonld); |
|
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
@@ -15,57 +15,57 @@ |
||
| 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 | - * @since 3.14.0 |
|
| 22 | - * |
|
| 23 | - * @return array A JSON-LD array. |
|
| 24 | - */ |
|
| 25 | - public function create_schema() { |
|
| 18 | + /** |
|
| 19 | + * Convert the home/blog page to a JSON-LD array. |
|
| 20 | + * |
|
| 21 | + * @since 3.14.0 |
|
| 22 | + * |
|
| 23 | + * @return array A JSON-LD array. |
|
| 24 | + */ |
|
| 25 | + public function create_schema() { |
|
| 26 | 26 | |
| 27 | - // Create new jsonld. |
|
| 28 | - $jsonld = array( |
|
| 29 | - '@context' => 'http://schema.org', |
|
| 30 | - '@type' => 'WebSite', |
|
| 31 | - 'name' => get_bloginfo( 'name' ), |
|
| 32 | - 'alternateName' => get_bloginfo( 'description' ), |
|
| 33 | - 'url' => home_url( '/' ), |
|
| 34 | - ); |
|
| 27 | + // Create new jsonld. |
|
| 28 | + $jsonld = array( |
|
| 29 | + '@context' => 'http://schema.org', |
|
| 30 | + '@type' => 'WebSite', |
|
| 31 | + 'name' => get_bloginfo( 'name' ), |
|
| 32 | + 'alternateName' => get_bloginfo( 'description' ), |
|
| 33 | + 'url' => home_url( '/' ), |
|
| 34 | + ); |
|
| 35 | 35 | |
| 36 | - // Add publisher information. |
|
| 37 | - $this->set_publisher( $jsonld ); |
|
| 36 | + // Add publisher information. |
|
| 37 | + $this->set_publisher( $jsonld ); |
|
| 38 | 38 | |
| 39 | - // Add search action. |
|
| 40 | - $this->set_search_action( $jsonld ); |
|
| 39 | + // Add search action. |
|
| 40 | + $this->set_search_action( $jsonld ); |
|
| 41 | 41 | |
| 42 | - // Return the jsonld schema. |
|
| 43 | - return $jsonld; |
|
| 44 | - } |
|
| 42 | + // Return the jsonld schema. |
|
| 43 | + return $jsonld; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Add SearchAction part to the schema |
|
| 48 | - * |
|
| 49 | - * @since 3.14.0 |
|
| 50 | - * |
|
| 51 | - * @param array $params The parameters array. |
|
| 52 | - */ |
|
| 53 | - private function set_search_action( &$params ) { |
|
| 54 | - /** |
|
| 55 | - * Filter: 'wordlift_json_ld_search_url' - Allows filtering of the search URL. |
|
| 56 | - * |
|
| 57 | - * @since 3.14.0 |
|
| 58 | - * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
|
| 59 | - */ |
|
| 60 | - $search_url = apply_filters( 'wordlift_json_ld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 46 | + /** |
|
| 47 | + * Add SearchAction part to the schema |
|
| 48 | + * |
|
| 49 | + * @since 3.14.0 |
|
| 50 | + * |
|
| 51 | + * @param array $params The parameters array. |
|
| 52 | + */ |
|
| 53 | + private function set_search_action( &$params ) { |
|
| 54 | + /** |
|
| 55 | + * Filter: 'wordlift_json_ld_search_url' - Allows filtering of the search URL. |
|
| 56 | + * |
|
| 57 | + * @since 3.14.0 |
|
| 58 | + * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
|
| 59 | + */ |
|
| 60 | + $search_url = apply_filters( 'wordlift_json_ld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 61 | 61 | |
| 62 | - // Add search action |
|
| 63 | - $params['potentialAction'] = array( |
|
| 64 | - '@type' => 'SearchAction', |
|
| 65 | - 'target' => $search_url, |
|
| 66 | - 'query-input' => 'required name=search_term_string', |
|
| 67 | - ); |
|
| 62 | + // Add search action |
|
| 63 | + $params['potentialAction'] = array( |
|
| 64 | + '@type' => 'SearchAction', |
|
| 65 | + 'target' => $search_url, |
|
| 66 | + 'query-input' => 'required name=search_term_string', |
|
| 67 | + ); |
|
| 68 | 68 | |
| 69 | - } |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | } |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | $jsonld = array( |
| 29 | 29 | '@context' => 'http://schema.org', |
| 30 | 30 | '@type' => 'WebSite', |
| 31 | - 'name' => get_bloginfo( 'name' ), |
|
| 32 | - 'alternateName' => get_bloginfo( 'description' ), |
|
| 33 | - 'url' => home_url( '/' ), |
|
| 31 | + 'name' => get_bloginfo('name'), |
|
| 32 | + 'alternateName' => get_bloginfo('description'), |
|
| 33 | + 'url' => home_url('/'), |
|
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | // Add publisher information. |
| 37 | - $this->set_publisher( $jsonld ); |
|
| 37 | + $this->set_publisher($jsonld); |
|
| 38 | 38 | |
| 39 | 39 | // Add search action. |
| 40 | - $this->set_search_action( $jsonld ); |
|
| 40 | + $this->set_search_action($jsonld); |
|
| 41 | 41 | |
| 42 | 42 | // Return the jsonld schema. |
| 43 | 43 | return $jsonld; |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @param array $params The parameters array. |
| 52 | 52 | */ |
| 53 | - private function set_search_action( &$params ) { |
|
| 53 | + private function set_search_action(&$params) { |
|
| 54 | 54 | /** |
| 55 | 55 | * Filter: 'wordlift_json_ld_search_url' - Allows filtering of the search URL. |
| 56 | 56 | * |
| 57 | 57 | * @since 3.14.0 |
| 58 | 58 | * @api string $search_url The search URL for this site with a `{search_term_string}` variable. |
| 59 | 59 | */ |
| 60 | - $search_url = apply_filters( 'wordlift_json_ld_search_url', home_url( '/' ) . '?s={search_term_string}' ); |
|
| 60 | + $search_url = apply_filters('wordlift_json_ld_search_url', home_url('/').'?s={search_term_string}'); |
|
| 61 | 61 | |
| 62 | 62 | // Add search action |
| 63 | 63 | $params['potentialAction'] = array( |