@@ -29,702 +29,702 @@ |
||
| 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 Thumbnail service. |
|
| 62 | - * |
|
| 63 | - * @since 3.1.5 |
|
| 64 | - * @access private |
|
| 65 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 66 | - */ |
|
| 67 | - private $thumbnail_service; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The UI service. |
|
| 71 | - * |
|
| 72 | - * @since 3.2.0 |
|
| 73 | - * @access private |
|
| 74 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 75 | - */ |
|
| 76 | - private $ui_service; |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * The Schema service. |
|
| 80 | - * |
|
| 81 | - * @since 3.3.0 |
|
| 82 | - * @access private |
|
| 83 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 84 | - */ |
|
| 85 | - private $schema_service; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * The Entity service. |
|
| 89 | - * |
|
| 90 | - * @since 3.1.0 |
|
| 91 | - * @access private |
|
| 92 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 93 | - */ |
|
| 94 | - private $entity_service; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * The Topic Taxonomy service. |
|
| 98 | - * |
|
| 99 | - * @since 3.5.0 |
|
| 100 | - * @access private |
|
| 101 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 102 | - */ |
|
| 103 | - private $topic_taxonomy_service; |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * The User service. |
|
| 107 | - * |
|
| 108 | - * @since 3.1.7 |
|
| 109 | - * @access private |
|
| 110 | - * @var \Wordlift_User_Service $user_service The User service. |
|
| 111 | - */ |
|
| 112 | - private $user_service; |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * The Timeline service. |
|
| 116 | - * |
|
| 117 | - * @since 3.1.0 |
|
| 118 | - * @access private |
|
| 119 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 120 | - */ |
|
| 121 | - private $timeline_service; |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * The Redirect service. |
|
| 125 | - * |
|
| 126 | - * @since 3.2.0 |
|
| 127 | - * @access private |
|
| 128 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 129 | - */ |
|
| 130 | - private $redirect_service; |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * The Notice service. |
|
| 134 | - * |
|
| 135 | - * @since 3.3.0 |
|
| 136 | - * @access private |
|
| 137 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 138 | - */ |
|
| 139 | - private $notice_service; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * The Entity list customization. |
|
| 143 | - * |
|
| 144 | - * @since 3.3.0 |
|
| 145 | - * @access private |
|
| 146 | - * @var \Wordlift_List_Service $entity_list_service The Entity list service. |
|
| 147 | - */ |
|
| 148 | - private $entity_list_service; |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * The Entity Types Taxonomy Walker. |
|
| 152 | - * |
|
| 153 | - * @since 3.1.0 |
|
| 154 | - * @access private |
|
| 155 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 156 | - */ |
|
| 157 | - private $entity_types_taxonomy_walker; |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * The ShareThis service. |
|
| 161 | - * |
|
| 162 | - * @since 3.2.0 |
|
| 163 | - * @access private |
|
| 164 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 165 | - */ |
|
| 166 | - private $sharethis_service; |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * The PrimaShop adapter. |
|
| 170 | - * |
|
| 171 | - * @since 3.2.3 |
|
| 172 | - * @access private |
|
| 173 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 174 | - */ |
|
| 175 | - private $primashop_adapter; |
|
| 176 | - |
|
| 177 | - /** |
|
| 178 | - * The WordLift Dashboard adapter. |
|
| 179 | - * |
|
| 180 | - * @since 3.4.0 |
|
| 181 | - * @access private |
|
| 182 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 183 | - */ |
|
| 184 | - private $dashboard_service; |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * The entity type service. |
|
| 188 | - * |
|
| 189 | - * @since 3.6.0 |
|
| 190 | - * @access private |
|
| 191 | - * @var \Wordlift_Entity_Type_Service |
|
| 192 | - */ |
|
| 193 | - private $entity_type_service; |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 197 | - * |
|
| 198 | - * @since 3.6.0 |
|
| 199 | - * @access private |
|
| 200 | - * @var \Wordlift_Entity_Link_Service |
|
| 201 | - */ |
|
| 202 | - private $entity_link_service; |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * The page service instance which processes the page output in order to insert schema.org microdata to export the |
|
| 206 | - * correct page title to Google+. |
|
| 207 | - * |
|
| 208 | - * @since 3.5.3 |
|
| 209 | - * @access private |
|
| 210 | - * @var \Wordlift_Page_Service |
|
| 211 | - */ |
|
| 212 | - private $page_service; |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * A {@link Wordlift_Sparql_Service} instance. |
|
| 216 | - * |
|
| 217 | - * @var 3.6.0 |
|
| 218 | - * @access private |
|
| 219 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 220 | - */ |
|
| 221 | - private $sparql_service; |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * A {@link Wordlift_Import_Service} instance. |
|
| 225 | - * |
|
| 226 | - * @since 3.6.0 |
|
| 227 | - * @access private |
|
| 228 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 229 | - */ |
|
| 230 | - private $import_service; |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
| 234 | - * |
|
| 235 | - * @since 3.6.0 |
|
| 236 | - * @access private |
|
| 237 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 238 | - */ |
|
| 239 | - private $rebuild_service; |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * The 'Download Your Data' page. |
|
| 243 | - * |
|
| 244 | - * @since 3.6.0 |
|
| 245 | - * @access private |
|
| 246 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 247 | - */ |
|
| 248 | - private $download_your_data_page; |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * Define the core functionality of the plugin. |
|
| 252 | - * |
|
| 253 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 254 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 255 | - * the public-facing side of the site. |
|
| 256 | - * |
|
| 257 | - * @since 1.0.0 |
|
| 258 | - */ |
|
| 259 | - public function __construct() { |
|
| 260 | - |
|
| 261 | - $this->plugin_name = 'wordlift'; |
|
| 262 | - $this->version = '3.6.0-dev'; |
|
| 263 | - $this->load_dependencies(); |
|
| 264 | - $this->set_locale(); |
|
| 265 | - $this->define_admin_hooks(); |
|
| 266 | - $this->define_public_hooks(); |
|
| 267 | - |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - /** |
|
| 271 | - * Load the required dependencies for this plugin. |
|
| 272 | - * |
|
| 273 | - * Include the following files that make up the plugin: |
|
| 274 | - * |
|
| 275 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 276 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
| 277 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 278 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 279 | - * |
|
| 280 | - * Create an instance of the loader which will be used to register the hooks |
|
| 281 | - * with WordPress. |
|
| 282 | - * |
|
| 283 | - * @since 1.0.0 |
|
| 284 | - * @access private |
|
| 285 | - */ |
|
| 286 | - private function load_dependencies() { |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * The class responsible for orchestrating the actions and filters of the |
|
| 290 | - * core plugin. |
|
| 291 | - */ |
|
| 292 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 293 | - |
|
| 294 | - /** |
|
| 295 | - * The class responsible for defining internationalization functionality |
|
| 296 | - * of the plugin. |
|
| 297 | - */ |
|
| 298 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 299 | - |
|
| 300 | - /** |
|
| 301 | - * Provide support functions to sanitize data. |
|
| 302 | - */ |
|
| 303 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 304 | - |
|
| 305 | - /** |
|
| 306 | - * The Redirect service. |
|
| 307 | - */ |
|
| 308 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 309 | - |
|
| 310 | - /** |
|
| 311 | - * The Log service. |
|
| 312 | - */ |
|
| 313 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 314 | - |
|
| 315 | - /** |
|
| 316 | - * The configuration service. |
|
| 317 | - */ |
|
| 318 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * The entity post type service. |
|
| 322 | - */ |
|
| 323 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 324 | - |
|
| 325 | - /** |
|
| 326 | - * The entity link service. |
|
| 327 | - */ |
|
| 328 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * The Query builder. |
|
| 332 | - */ |
|
| 333 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * The Schema service. |
|
| 337 | - */ |
|
| 338 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * The schema:url property service. |
|
| 342 | - */ |
|
| 343 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 344 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 345 | - |
|
| 346 | - /** |
|
| 347 | - * The UI service. |
|
| 348 | - */ |
|
| 349 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 350 | - |
|
| 351 | - /** |
|
| 352 | - * The Thumbnail service. |
|
| 353 | - */ |
|
| 354 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 355 | - |
|
| 356 | - /** |
|
| 357 | - * The Entity Types Taxonomy service. |
|
| 358 | - */ |
|
| 359 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 360 | - |
|
| 361 | - /** |
|
| 362 | - * The Entity service. |
|
| 363 | - */ |
|
| 364 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * The User service. |
|
| 368 | - */ |
|
| 369 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 370 | - |
|
| 371 | - /** |
|
| 372 | - * The Timeline service. |
|
| 373 | - */ |
|
| 374 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 375 | - |
|
| 376 | - /** |
|
| 377 | - * The Topic Taxonomy service. |
|
| 378 | - */ |
|
| 379 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 380 | - |
|
| 381 | - |
|
| 382 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php'; |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * The SPARQL service. |
|
| 386 | - */ |
|
| 387 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * The WordLift import service. |
|
| 391 | - */ |
|
| 392 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * The WordLift URI service. |
|
| 396 | - */ |
|
| 397 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 398 | - |
|
| 399 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 400 | - |
|
| 401 | - /** |
|
| 402 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 403 | - */ |
|
| 404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * The class responsible for defining all actions that occur in the admin area. |
|
| 408 | - */ |
|
| 409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 410 | - |
|
| 411 | - /** |
|
| 412 | - * The class to customize the entity list admin page. |
|
| 413 | - */ |
|
| 414 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 415 | - |
|
| 416 | - /** |
|
| 417 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 418 | - */ |
|
| 419 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 420 | - |
|
| 421 | - /** |
|
| 422 | - * The Notice service. |
|
| 423 | - */ |
|
| 424 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 425 | - |
|
| 426 | - /** |
|
| 427 | - * The PrimaShop adapter. |
|
| 428 | - */ |
|
| 429 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * The WordLift Dashboard service. |
|
| 433 | - */ |
|
| 434 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * The admin 'Download Your Data' page. |
|
| 438 | - */ |
|
| 439 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 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 Thumbnail service. |
|
| 62 | + * |
|
| 63 | + * @since 3.1.5 |
|
| 64 | + * @access private |
|
| 65 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
| 66 | + */ |
|
| 67 | + private $thumbnail_service; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The UI service. |
|
| 71 | + * |
|
| 72 | + * @since 3.2.0 |
|
| 73 | + * @access private |
|
| 74 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
| 75 | + */ |
|
| 76 | + private $ui_service; |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * The Schema service. |
|
| 80 | + * |
|
| 81 | + * @since 3.3.0 |
|
| 82 | + * @access private |
|
| 83 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
| 84 | + */ |
|
| 85 | + private $schema_service; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * The Entity service. |
|
| 89 | + * |
|
| 90 | + * @since 3.1.0 |
|
| 91 | + * @access private |
|
| 92 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
| 93 | + */ |
|
| 94 | + private $entity_service; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * The Topic Taxonomy service. |
|
| 98 | + * |
|
| 99 | + * @since 3.5.0 |
|
| 100 | + * @access private |
|
| 101 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
| 102 | + */ |
|
| 103 | + private $topic_taxonomy_service; |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * The User service. |
|
| 107 | + * |
|
| 108 | + * @since 3.1.7 |
|
| 109 | + * @access private |
|
| 110 | + * @var \Wordlift_User_Service $user_service The User service. |
|
| 111 | + */ |
|
| 112 | + private $user_service; |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * The Timeline service. |
|
| 116 | + * |
|
| 117 | + * @since 3.1.0 |
|
| 118 | + * @access private |
|
| 119 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
| 120 | + */ |
|
| 121 | + private $timeline_service; |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * The Redirect service. |
|
| 125 | + * |
|
| 126 | + * @since 3.2.0 |
|
| 127 | + * @access private |
|
| 128 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
| 129 | + */ |
|
| 130 | + private $redirect_service; |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * The Notice service. |
|
| 134 | + * |
|
| 135 | + * @since 3.3.0 |
|
| 136 | + * @access private |
|
| 137 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
| 138 | + */ |
|
| 139 | + private $notice_service; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * The Entity list customization. |
|
| 143 | + * |
|
| 144 | + * @since 3.3.0 |
|
| 145 | + * @access private |
|
| 146 | + * @var \Wordlift_List_Service $entity_list_service The Entity list service. |
|
| 147 | + */ |
|
| 148 | + private $entity_list_service; |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * The Entity Types Taxonomy Walker. |
|
| 152 | + * |
|
| 153 | + * @since 3.1.0 |
|
| 154 | + * @access private |
|
| 155 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
| 156 | + */ |
|
| 157 | + private $entity_types_taxonomy_walker; |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * The ShareThis service. |
|
| 161 | + * |
|
| 162 | + * @since 3.2.0 |
|
| 163 | + * @access private |
|
| 164 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
| 165 | + */ |
|
| 166 | + private $sharethis_service; |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * The PrimaShop adapter. |
|
| 170 | + * |
|
| 171 | + * @since 3.2.3 |
|
| 172 | + * @access private |
|
| 173 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
| 174 | + */ |
|
| 175 | + private $primashop_adapter; |
|
| 176 | + |
|
| 177 | + /** |
|
| 178 | + * The WordLift Dashboard adapter. |
|
| 179 | + * |
|
| 180 | + * @since 3.4.0 |
|
| 181 | + * @access private |
|
| 182 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
| 183 | + */ |
|
| 184 | + private $dashboard_service; |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * The entity type service. |
|
| 188 | + * |
|
| 189 | + * @since 3.6.0 |
|
| 190 | + * @access private |
|
| 191 | + * @var \Wordlift_Entity_Type_Service |
|
| 192 | + */ |
|
| 193 | + private $entity_type_service; |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
| 197 | + * |
|
| 198 | + * @since 3.6.0 |
|
| 199 | + * @access private |
|
| 200 | + * @var \Wordlift_Entity_Link_Service |
|
| 201 | + */ |
|
| 202 | + private $entity_link_service; |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * The page service instance which processes the page output in order to insert schema.org microdata to export the |
|
| 206 | + * correct page title to Google+. |
|
| 207 | + * |
|
| 208 | + * @since 3.5.3 |
|
| 209 | + * @access private |
|
| 210 | + * @var \Wordlift_Page_Service |
|
| 211 | + */ |
|
| 212 | + private $page_service; |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * A {@link Wordlift_Sparql_Service} instance. |
|
| 216 | + * |
|
| 217 | + * @var 3.6.0 |
|
| 218 | + * @access private |
|
| 219 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
| 220 | + */ |
|
| 221 | + private $sparql_service; |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * A {@link Wordlift_Import_Service} instance. |
|
| 225 | + * |
|
| 226 | + * @since 3.6.0 |
|
| 227 | + * @access private |
|
| 228 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
| 229 | + */ |
|
| 230 | + private $import_service; |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
| 234 | + * |
|
| 235 | + * @since 3.6.0 |
|
| 236 | + * @access private |
|
| 237 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
| 238 | + */ |
|
| 239 | + private $rebuild_service; |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * The 'Download Your Data' page. |
|
| 243 | + * |
|
| 244 | + * @since 3.6.0 |
|
| 245 | + * @access private |
|
| 246 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
| 247 | + */ |
|
| 248 | + private $download_your_data_page; |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * Define the core functionality of the plugin. |
|
| 252 | + * |
|
| 253 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
| 254 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
| 255 | + * the public-facing side of the site. |
|
| 256 | + * |
|
| 257 | + * @since 1.0.0 |
|
| 258 | + */ |
|
| 259 | + public function __construct() { |
|
| 260 | + |
|
| 261 | + $this->plugin_name = 'wordlift'; |
|
| 262 | + $this->version = '3.6.0-dev'; |
|
| 263 | + $this->load_dependencies(); |
|
| 264 | + $this->set_locale(); |
|
| 265 | + $this->define_admin_hooks(); |
|
| 266 | + $this->define_public_hooks(); |
|
| 267 | + |
|
| 268 | + } |
|
| 269 | + |
|
| 270 | + /** |
|
| 271 | + * Load the required dependencies for this plugin. |
|
| 272 | + * |
|
| 273 | + * Include the following files that make up the plugin: |
|
| 274 | + * |
|
| 275 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
| 276 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
| 277 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
| 278 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
| 279 | + * |
|
| 280 | + * Create an instance of the loader which will be used to register the hooks |
|
| 281 | + * with WordPress. |
|
| 282 | + * |
|
| 283 | + * @since 1.0.0 |
|
| 284 | + * @access private |
|
| 285 | + */ |
|
| 286 | + private function load_dependencies() { |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * The class responsible for orchestrating the actions and filters of the |
|
| 290 | + * core plugin. |
|
| 291 | + */ |
|
| 292 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 293 | + |
|
| 294 | + /** |
|
| 295 | + * The class responsible for defining internationalization functionality |
|
| 296 | + * of the plugin. |
|
| 297 | + */ |
|
| 298 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 299 | + |
|
| 300 | + /** |
|
| 301 | + * Provide support functions to sanitize data. |
|
| 302 | + */ |
|
| 303 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 304 | + |
|
| 305 | + /** |
|
| 306 | + * The Redirect service. |
|
| 307 | + */ |
|
| 308 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * The Log service. |
|
| 312 | + */ |
|
| 313 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 314 | + |
|
| 315 | + /** |
|
| 316 | + * The configuration service. |
|
| 317 | + */ |
|
| 318 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * The entity post type service. |
|
| 322 | + */ |
|
| 323 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 324 | + |
|
| 325 | + /** |
|
| 326 | + * The entity link service. |
|
| 327 | + */ |
|
| 328 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * The Query builder. |
|
| 332 | + */ |
|
| 333 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * The Schema service. |
|
| 337 | + */ |
|
| 338 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * The schema:url property service. |
|
| 342 | + */ |
|
| 343 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 344 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 345 | + |
|
| 346 | + /** |
|
| 347 | + * The UI service. |
|
| 348 | + */ |
|
| 349 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 350 | + |
|
| 351 | + /** |
|
| 352 | + * The Thumbnail service. |
|
| 353 | + */ |
|
| 354 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 355 | + |
|
| 356 | + /** |
|
| 357 | + * The Entity Types Taxonomy service. |
|
| 358 | + */ |
|
| 359 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 360 | + |
|
| 361 | + /** |
|
| 362 | + * The Entity service. |
|
| 363 | + */ |
|
| 364 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * The User service. |
|
| 368 | + */ |
|
| 369 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 370 | + |
|
| 371 | + /** |
|
| 372 | + * The Timeline service. |
|
| 373 | + */ |
|
| 374 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 375 | + |
|
| 376 | + /** |
|
| 377 | + * The Topic Taxonomy service. |
|
| 378 | + */ |
|
| 379 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 380 | + |
|
| 381 | + |
|
| 382 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php'; |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * The SPARQL service. |
|
| 386 | + */ |
|
| 387 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * The WordLift import service. |
|
| 391 | + */ |
|
| 392 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * The WordLift URI service. |
|
| 396 | + */ |
|
| 397 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 398 | + |
|
| 399 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 400 | + |
|
| 401 | + /** |
|
| 402 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
| 403 | + */ |
|
| 404 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * The class responsible for defining all actions that occur in the admin area. |
|
| 408 | + */ |
|
| 409 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 410 | + |
|
| 411 | + /** |
|
| 412 | + * The class to customize the entity list admin page. |
|
| 413 | + */ |
|
| 414 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 415 | + |
|
| 416 | + /** |
|
| 417 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
| 418 | + */ |
|
| 419 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 420 | + |
|
| 421 | + /** |
|
| 422 | + * The Notice service. |
|
| 423 | + */ |
|
| 424 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 425 | + |
|
| 426 | + /** |
|
| 427 | + * The PrimaShop adapter. |
|
| 428 | + */ |
|
| 429 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * The WordLift Dashboard service. |
|
| 433 | + */ |
|
| 434 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * The admin 'Download Your Data' page. |
|
| 438 | + */ |
|
| 439 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 440 | 440 | |
| 441 | - /** |
|
| 442 | - * The class responsible for defining all actions that occur in the public-facing |
|
| 443 | - * side of the site. |
|
| 444 | - */ |
|
| 445 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 441 | + /** |
|
| 442 | + * The class responsible for defining all actions that occur in the public-facing |
|
| 443 | + * side of the site. |
|
| 444 | + */ |
|
| 445 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 446 | 446 | |
| 447 | - /** |
|
| 448 | - * The shortcode abstract class. |
|
| 449 | - */ |
|
| 450 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 447 | + /** |
|
| 448 | + * The shortcode abstract class. |
|
| 449 | + */ |
|
| 450 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 451 | 451 | |
| 452 | - /** |
|
| 453 | - * The Timeline shortcode. |
|
| 454 | - */ |
|
| 455 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 452 | + /** |
|
| 453 | + * The Timeline shortcode. |
|
| 454 | + */ |
|
| 455 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 456 | 456 | |
| 457 | - /** |
|
| 458 | - * The Navigator shortcode. |
|
| 459 | - */ |
|
| 460 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 457 | + /** |
|
| 458 | + * The Navigator shortcode. |
|
| 459 | + */ |
|
| 460 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 461 | 461 | |
| 462 | - /** |
|
| 463 | - * The chord shortcode. |
|
| 464 | - */ |
|
| 465 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 462 | + /** |
|
| 463 | + * The chord shortcode. |
|
| 464 | + */ |
|
| 465 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 466 | 466 | |
| 467 | - /** |
|
| 468 | - * The geomap shortcode. |
|
| 469 | - */ |
|
| 470 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 467 | + /** |
|
| 468 | + * The geomap shortcode. |
|
| 469 | + */ |
|
| 470 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 471 | 471 | |
| 472 | - /** |
|
| 473 | - * The ShareThis service. |
|
| 474 | - */ |
|
| 475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 472 | + /** |
|
| 473 | + * The ShareThis service. |
|
| 474 | + */ |
|
| 475 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 476 | 476 | |
| 477 | - $this->loader = new Wordlift_Loader(); |
|
| 477 | + $this->loader = new Wordlift_Loader(); |
|
| 478 | 478 | |
| 479 | - // Instantiate a global logger. |
|
| 480 | - global $wl_logger; |
|
| 481 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 479 | + // Instantiate a global logger. |
|
| 480 | + global $wl_logger; |
|
| 481 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 482 | 482 | |
| 483 | - // Create the configuration service. |
|
| 484 | - $configuration_service = new Wordlift_Configuration_Service(); |
|
| 483 | + // Create the configuration service. |
|
| 484 | + $configuration_service = new Wordlift_Configuration_Service(); |
|
| 485 | 485 | |
| 486 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
| 487 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $configuration_service->get_entity_base_path() ); |
|
| 486 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
| 487 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $configuration_service->get_entity_base_path() ); |
|
| 488 | 488 | |
| 489 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 490 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_type_service, $configuration_service->get_entity_base_path() ); |
|
| 489 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
| 490 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_type_service, $configuration_service->get_entity_base_path() ); |
|
| 491 | 491 | |
| 492 | - // Create an instance of the UI service. |
|
| 493 | - $this->ui_service = new Wordlift_UI_Service(); |
|
| 492 | + // Create an instance of the UI service. |
|
| 493 | + $this->ui_service = new Wordlift_UI_Service(); |
|
| 494 | 494 | |
| 495 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 496 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 495 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
| 496 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
| 497 | 497 | |
| 498 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 498 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
| 499 | 499 | |
| 500 | - // Create an instance of the Schema service. |
|
| 501 | - new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 502 | - $this->schema_service = new Wordlift_Schema_Service(); |
|
| 500 | + // Create an instance of the Schema service. |
|
| 501 | + new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 502 | + $this->schema_service = new Wordlift_Schema_Service(); |
|
| 503 | 503 | |
| 504 | - // Create an instance of the Notice service. |
|
| 505 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
| 504 | + // Create an instance of the Notice service. |
|
| 505 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
| 506 | 506 | |
| 507 | - // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 508 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service ); |
|
| 507 | + // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
|
| 508 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service ); |
|
| 509 | 509 | |
| 510 | - // Create an instance of the User service. |
|
| 511 | - $this->user_service = new Wordlift_User_Service(); |
|
| 510 | + // Create an instance of the User service. |
|
| 511 | + $this->user_service = new Wordlift_User_Service(); |
|
| 512 | 512 | |
| 513 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 514 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 513 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
| 514 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 515 | 515 | |
| 516 | - // Create a new instance of the Redirect service. |
|
| 517 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 516 | + // Create a new instance of the Redirect service. |
|
| 517 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 518 | 518 | |
| 519 | - // Create a new instance of the Redirect service. |
|
| 520 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service ); |
|
| 519 | + // Create a new instance of the Redirect service. |
|
| 520 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service ); |
|
| 521 | 521 | |
| 522 | - // Initialize the shortcodes. |
|
| 523 | - new Wordlift_Navigator_Shortcode(); |
|
| 524 | - new Wordlift_Chord_Shortcode(); |
|
| 525 | - new Wordlift_Geomap_Shortcode(); |
|
| 526 | - new Wordlift_Timeline_Shortcode(); |
|
| 522 | + // Initialize the shortcodes. |
|
| 523 | + new Wordlift_Navigator_Shortcode(); |
|
| 524 | + new Wordlift_Chord_Shortcode(); |
|
| 525 | + new Wordlift_Geomap_Shortcode(); |
|
| 526 | + new Wordlift_Timeline_Shortcode(); |
|
| 527 | 527 | |
| 528 | - // Create entity list customization (wp-admin/edit.php) |
|
| 529 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service ); |
|
| 528 | + // Create entity list customization (wp-admin/edit.php) |
|
| 529 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service ); |
|
| 530 | 530 | |
| 531 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 531 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
| 532 | 532 | |
| 533 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 533 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
| 534 | 534 | |
| 535 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 536 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 535 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
| 536 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
| 537 | 537 | |
| 538 | - // Create an instance of the PrimaShop adapter. |
|
| 539 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 538 | + // Create an instance of the PrimaShop adapter. |
|
| 539 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
| 540 | 540 | |
| 541 | - $this->page_service = new Wordlift_Page_Service(); |
|
| 541 | + $this->page_service = new Wordlift_Page_Service(); |
|
| 542 | 542 | |
| 543 | - // Create an import service instance to hook later to WP's import function. |
|
| 544 | - $this->import_service = new Wordlift_Import_Service( $this->entity_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, wl_configuration_get_redlink_dataset_uri() ); |
|
| 543 | + // Create an import service instance to hook later to WP's import function. |
|
| 544 | + $this->import_service = new Wordlift_Import_Service( $this->entity_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, wl_configuration_get_redlink_dataset_uri() ); |
|
| 545 | 545 | |
| 546 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 546 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 547 | 547 | |
| 548 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 549 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 548 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
| 549 | + $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 550 | 550 | |
| 551 | - //** WordPress Admin */ |
|
| 552 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
| 551 | + //** WordPress Admin */ |
|
| 552 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
| 553 | 553 | |
| 554 | - } |
|
| 554 | + } |
|
| 555 | 555 | |
| 556 | - /** |
|
| 557 | - * Define the locale for this plugin for internationalization. |
|
| 558 | - * |
|
| 559 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 560 | - * with WordPress. |
|
| 561 | - * |
|
| 562 | - * @since 1.0.0 |
|
| 563 | - * @access private |
|
| 564 | - */ |
|
| 565 | - private function set_locale() { |
|
| 556 | + /** |
|
| 557 | + * Define the locale for this plugin for internationalization. |
|
| 558 | + * |
|
| 559 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
| 560 | + * with WordPress. |
|
| 561 | + * |
|
| 562 | + * @since 1.0.0 |
|
| 563 | + * @access private |
|
| 564 | + */ |
|
| 565 | + private function set_locale() { |
|
| 566 | 566 | |
| 567 | - $plugin_i18n = new Wordlift_i18n(); |
|
| 568 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 567 | + $plugin_i18n = new Wordlift_i18n(); |
|
| 568 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 569 | 569 | |
| 570 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 570 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 571 | 571 | |
| 572 | - } |
|
| 572 | + } |
|
| 573 | 573 | |
| 574 | - /** |
|
| 575 | - * Register all of the hooks related to the admin area functionality |
|
| 576 | - * of the plugin. |
|
| 577 | - * |
|
| 578 | - * @since 1.0.0 |
|
| 579 | - * @access private |
|
| 580 | - */ |
|
| 581 | - private function define_admin_hooks() { |
|
| 574 | + /** |
|
| 575 | + * Register all of the hooks related to the admin area functionality |
|
| 576 | + * of the plugin. |
|
| 577 | + * |
|
| 578 | + * @since 1.0.0 |
|
| 579 | + * @access private |
|
| 580 | + */ |
|
| 581 | + private function define_admin_hooks() { |
|
| 582 | 582 | |
| 583 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 583 | + $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 584 | 584 | |
| 585 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 586 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 585 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 586 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 587 | 587 | |
| 588 | - // Hook the init action to the Topic Taxonomy service. |
|
| 589 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 588 | + // Hook the init action to the Topic Taxonomy service. |
|
| 589 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 590 | 590 | |
| 591 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 592 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 591 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
| 592 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 593 | 593 | |
| 594 | - // Hook the added_post_meta action to the Thumbnail service. |
|
| 595 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 594 | + // Hook the added_post_meta action to the Thumbnail service. |
|
| 595 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 596 | 596 | |
| 597 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
| 598 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 597 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
| 598 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 599 | 599 | |
| 600 | - // Hook posts inserts (or updates) to the user service. |
|
| 601 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 600 | + // Hook posts inserts (or updates) to the user service. |
|
| 601 | + $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 602 | 602 | |
| 603 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 604 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 603 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 604 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 605 | 605 | |
| 606 | - // Register custom allowed redirect hosts. |
|
| 607 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 608 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 609 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 610 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 611 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 612 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 613 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 606 | + // Register custom allowed redirect hosts. |
|
| 607 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 608 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 609 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 610 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 611 | + $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 612 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
| 613 | + $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 614 | 614 | |
| 615 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 616 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 617 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 618 | - $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 ); |
|
| 615 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
| 616 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
| 617 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 618 | + $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 ); |
|
| 619 | 619 | |
| 620 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 621 | - $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' ); |
|
| 622 | - |
|
| 623 | - // Entity listing customization (wp-admin/edit.php) |
|
| 624 | - // Add custom columns |
|
| 625 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 626 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 627 | - // Add 4W selection |
|
| 628 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 629 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 630 | - |
|
| 631 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 632 | - |
|
| 633 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 634 | - // entities. |
|
| 635 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 636 | - |
|
| 637 | - // Filter imported post meta. |
|
| 638 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 639 | - |
|
| 640 | - // Notify the import service when an import starts and ends. |
|
| 641 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 642 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 643 | - |
|
| 644 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 645 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 646 | - |
|
| 647 | - // Hook the menu to the Download Your Data page. |
|
| 648 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 649 | - |
|
| 650 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 651 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 652 | - |
|
| 653 | - } |
|
| 654 | - |
|
| 655 | - /** |
|
| 656 | - * Register all of the hooks related to the public-facing functionality |
|
| 657 | - * of the plugin. |
|
| 658 | - * |
|
| 659 | - * @since 1.0.0 |
|
| 660 | - * @access private |
|
| 661 | - */ |
|
| 662 | - private function define_public_hooks() { |
|
| 663 | - |
|
| 664 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 665 | - |
|
| 666 | - // Register the entity post type. |
|
| 667 | - $this->loader->add_action( 'init', $this->entity_type_service, 'register' ); |
|
| 668 | - |
|
| 669 | - // Bind the link generation and handling hooks to the entity link service. |
|
| 670 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 671 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 672 | - $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 ); |
|
| 673 | - $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 ); |
|
| 674 | - |
|
| 675 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 676 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 677 | - |
|
| 678 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 679 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 680 | - |
|
| 681 | - // Hook the ShareThis service. |
|
| 682 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 683 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 684 | - |
|
| 685 | - $this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX ); |
|
| 686 | - $this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX ); |
|
| 687 | - |
|
| 688 | - } |
|
| 689 | - |
|
| 690 | - /** |
|
| 691 | - * Run the loader to execute all of the hooks with WordPress. |
|
| 692 | - * |
|
| 693 | - * @since 1.0.0 |
|
| 694 | - */ |
|
| 695 | - public function run() { |
|
| 696 | - $this->loader->run(); |
|
| 697 | - } |
|
| 698 | - |
|
| 699 | - /** |
|
| 700 | - * The name of the plugin used to uniquely identify it within the context of |
|
| 701 | - * WordPress and to define internationalization functionality. |
|
| 702 | - * |
|
| 703 | - * @since 1.0.0 |
|
| 704 | - * @return string The name of the plugin. |
|
| 705 | - */ |
|
| 706 | - public function get_plugin_name() { |
|
| 707 | - return $this->plugin_name; |
|
| 708 | - } |
|
| 709 | - |
|
| 710 | - /** |
|
| 711 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
| 712 | - * |
|
| 713 | - * @since 1.0.0 |
|
| 714 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 715 | - */ |
|
| 716 | - public function get_loader() { |
|
| 717 | - return $this->loader; |
|
| 718 | - } |
|
| 719 | - |
|
| 720 | - /** |
|
| 721 | - * Retrieve the version number of the plugin. |
|
| 722 | - * |
|
| 723 | - * @since 1.0.0 |
|
| 724 | - * @return string The version number of the plugin. |
|
| 725 | - */ |
|
| 726 | - public function get_version() { |
|
| 727 | - return $this->version; |
|
| 728 | - } |
|
| 620 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 621 | + $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' ); |
|
| 622 | + |
|
| 623 | + // Entity listing customization (wp-admin/edit.php) |
|
| 624 | + // Add custom columns |
|
| 625 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 626 | + $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 627 | + // Add 4W selection |
|
| 628 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 629 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 630 | + |
|
| 631 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 632 | + |
|
| 633 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
| 634 | + // entities. |
|
| 635 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 636 | + |
|
| 637 | + // Filter imported post meta. |
|
| 638 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 639 | + |
|
| 640 | + // Notify the import service when an import starts and ends. |
|
| 641 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 642 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 643 | + |
|
| 644 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
| 645 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 646 | + |
|
| 647 | + // Hook the menu to the Download Your Data page. |
|
| 648 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 649 | + |
|
| 650 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
| 651 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 652 | + |
|
| 653 | + } |
|
| 654 | + |
|
| 655 | + /** |
|
| 656 | + * Register all of the hooks related to the public-facing functionality |
|
| 657 | + * of the plugin. |
|
| 658 | + * |
|
| 659 | + * @since 1.0.0 |
|
| 660 | + * @access private |
|
| 661 | + */ |
|
| 662 | + private function define_public_hooks() { |
|
| 663 | + |
|
| 664 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 665 | + |
|
| 666 | + // Register the entity post type. |
|
| 667 | + $this->loader->add_action( 'init', $this->entity_type_service, 'register' ); |
|
| 668 | + |
|
| 669 | + // Bind the link generation and handling hooks to the entity link service. |
|
| 670 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 671 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 672 | + $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 ); |
|
| 673 | + $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 ); |
|
| 674 | + |
|
| 675 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 676 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 677 | + |
|
| 678 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
| 679 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 680 | + |
|
| 681 | + // Hook the ShareThis service. |
|
| 682 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 683 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 684 | + |
|
| 685 | + $this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX ); |
|
| 686 | + $this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX ); |
|
| 687 | + |
|
| 688 | + } |
|
| 689 | + |
|
| 690 | + /** |
|
| 691 | + * Run the loader to execute all of the hooks with WordPress. |
|
| 692 | + * |
|
| 693 | + * @since 1.0.0 |
|
| 694 | + */ |
|
| 695 | + public function run() { |
|
| 696 | + $this->loader->run(); |
|
| 697 | + } |
|
| 698 | + |
|
| 699 | + /** |
|
| 700 | + * The name of the plugin used to uniquely identify it within the context of |
|
| 701 | + * WordPress and to define internationalization functionality. |
|
| 702 | + * |
|
| 703 | + * @since 1.0.0 |
|
| 704 | + * @return string The name of the plugin. |
|
| 705 | + */ |
|
| 706 | + public function get_plugin_name() { |
|
| 707 | + return $this->plugin_name; |
|
| 708 | + } |
|
| 709 | + |
|
| 710 | + /** |
|
| 711 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
| 712 | + * |
|
| 713 | + * @since 1.0.0 |
|
| 714 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
| 715 | + */ |
|
| 716 | + public function get_loader() { |
|
| 717 | + return $this->loader; |
|
| 718 | + } |
|
| 719 | + |
|
| 720 | + /** |
|
| 721 | + * Retrieve the version number of the plugin. |
|
| 722 | + * |
|
| 723 | + * @since 1.0.0 |
|
| 724 | + * @return string The version number of the plugin. |
|
| 725 | + */ |
|
| 726 | + public function get_version() { |
|
| 727 | + return $this->version; |
|
| 728 | + } |
|
| 729 | 729 | |
| 730 | 730 | } |
@@ -289,205 +289,205 @@ discard block |
||
| 289 | 289 | * The class responsible for orchestrating the actions and filters of the |
| 290 | 290 | * core plugin. |
| 291 | 291 | */ |
| 292 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
| 292 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
| 293 | 293 | |
| 294 | 294 | /** |
| 295 | 295 | * The class responsible for defining internationalization functionality |
| 296 | 296 | * of the plugin. |
| 297 | 297 | */ |
| 298 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
| 298 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
| 299 | 299 | |
| 300 | 300 | /** |
| 301 | 301 | * Provide support functions to sanitize data. |
| 302 | 302 | */ |
| 303 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
| 303 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | 306 | * The Redirect service. |
| 307 | 307 | */ |
| 308 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
| 308 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | 311 | * The Log service. |
| 312 | 312 | */ |
| 313 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
| 313 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | 316 | * The configuration service. |
| 317 | 317 | */ |
| 318 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
| 318 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * The entity post type service. |
| 322 | 322 | */ |
| 323 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
| 323 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
| 324 | 324 | |
| 325 | 325 | /** |
| 326 | 326 | * The entity link service. |
| 327 | 327 | */ |
| 328 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
| 328 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
| 329 | 329 | |
| 330 | 330 | /** |
| 331 | 331 | * The Query builder. |
| 332 | 332 | */ |
| 333 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
| 333 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | 336 | * The Schema service. |
| 337 | 337 | */ |
| 338 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
| 338 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | 341 | * The schema:url property service. |
| 342 | 342 | */ |
| 343 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
| 344 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
| 343 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
| 344 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
| 345 | 345 | |
| 346 | 346 | /** |
| 347 | 347 | * The UI service. |
| 348 | 348 | */ |
| 349 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
| 349 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | 352 | * The Thumbnail service. |
| 353 | 353 | */ |
| 354 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
| 354 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | 357 | * The Entity Types Taxonomy service. |
| 358 | 358 | */ |
| 359 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 359 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php'; |
|
| 360 | 360 | |
| 361 | 361 | /** |
| 362 | 362 | * The Entity service. |
| 363 | 363 | */ |
| 364 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
| 364 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
| 365 | 365 | |
| 366 | 366 | /** |
| 367 | 367 | * The User service. |
| 368 | 368 | */ |
| 369 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
| 369 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
| 370 | 370 | |
| 371 | 371 | /** |
| 372 | 372 | * The Timeline service. |
| 373 | 373 | */ |
| 374 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
| 374 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
| 375 | 375 | |
| 376 | 376 | /** |
| 377 | 377 | * The Topic Taxonomy service. |
| 378 | 378 | */ |
| 379 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 379 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
| 380 | 380 | |
| 381 | 381 | |
| 382 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php'; |
|
| 382 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-page-service.php'; |
|
| 383 | 383 | |
| 384 | 384 | /** |
| 385 | 385 | * The SPARQL service. |
| 386 | 386 | */ |
| 387 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
| 387 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
| 388 | 388 | |
| 389 | 389 | /** |
| 390 | 390 | * The WordLift import service. |
| 391 | 391 | */ |
| 392 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
| 392 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | 395 | * The WordLift URI service. |
| 396 | 396 | */ |
| 397 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
| 397 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
| 398 | 398 | |
| 399 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php'; |
|
| 399 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php'; |
|
| 400 | 400 | |
| 401 | 401 | /** |
| 402 | 402 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
| 403 | 403 | */ |
| 404 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php'; |
|
| 404 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php'; |
|
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | 407 | * The class responsible for defining all actions that occur in the admin area. |
| 408 | 408 | */ |
| 409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
| 409 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | 412 | * The class to customize the entity list admin page. |
| 413 | 413 | */ |
| 414 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
| 414 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
| 415 | 415 | |
| 416 | 416 | /** |
| 417 | 417 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
| 418 | 418 | */ |
| 419 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 419 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | 422 | * The Notice service. |
| 423 | 423 | */ |
| 424 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
| 424 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
| 425 | 425 | |
| 426 | 426 | /** |
| 427 | 427 | * The PrimaShop adapter. |
| 428 | 428 | */ |
| 429 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
| 429 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * The WordLift Dashboard service. |
| 433 | 433 | */ |
| 434 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
| 434 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | 437 | * The admin 'Download Your Data' page. |
| 438 | 438 | */ |
| 439 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
| 439 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
| 440 | 440 | |
| 441 | 441 | /** |
| 442 | 442 | * The class responsible for defining all actions that occur in the public-facing |
| 443 | 443 | * side of the site. |
| 444 | 444 | */ |
| 445 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
| 445 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
| 446 | 446 | |
| 447 | 447 | /** |
| 448 | 448 | * The shortcode abstract class. |
| 449 | 449 | */ |
| 450 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
| 450 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
| 451 | 451 | |
| 452 | 452 | /** |
| 453 | 453 | * The Timeline shortcode. |
| 454 | 454 | */ |
| 455 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
| 455 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
| 456 | 456 | |
| 457 | 457 | /** |
| 458 | 458 | * The Navigator shortcode. |
| 459 | 459 | */ |
| 460 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
| 460 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
| 461 | 461 | |
| 462 | 462 | /** |
| 463 | 463 | * The chord shortcode. |
| 464 | 464 | */ |
| 465 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
| 465 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
| 466 | 466 | |
| 467 | 467 | /** |
| 468 | 468 | * The geomap shortcode. |
| 469 | 469 | */ |
| 470 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
| 470 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
| 471 | 471 | |
| 472 | 472 | /** |
| 473 | 473 | * The ShareThis service. |
| 474 | 474 | */ |
| 475 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
| 475 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
| 476 | 476 | |
| 477 | 477 | $this->loader = new Wordlift_Loader(); |
| 478 | 478 | |
| 479 | 479 | // Instantiate a global logger. |
| 480 | 480 | global $wl_logger; |
| 481 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
| 481 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
| 482 | 482 | |
| 483 | 483 | // Create the configuration service. |
| 484 | 484 | $configuration_service = new Wordlift_Configuration_Service(); |
| 485 | 485 | |
| 486 | 486 | // Create an entity type service instance. It'll be later bound to the init action. |
| 487 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $configuration_service->get_entity_base_path() ); |
|
| 487 | + $this->entity_type_service = new Wordlift_Entity_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $configuration_service->get_entity_base_path()); |
|
| 488 | 488 | |
| 489 | 489 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
| 490 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_type_service, $configuration_service->get_entity_base_path() ); |
|
| 490 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_type_service, $configuration_service->get_entity_base_path()); |
|
| 491 | 491 | |
| 492 | 492 | // Create an instance of the UI service. |
| 493 | 493 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -498,26 +498,26 @@ discard block |
||
| 498 | 498 | $this->sparql_service = new Wordlift_Sparql_Service(); |
| 499 | 499 | |
| 500 | 500 | // Create an instance of the Schema service. |
| 501 | - new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
| 501 | + new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
| 502 | 502 | $this->schema_service = new Wordlift_Schema_Service(); |
| 503 | 503 | |
| 504 | 504 | // Create an instance of the Notice service. |
| 505 | 505 | $this->notice_service = new Wordlift_Notice_Service(); |
| 506 | 506 | |
| 507 | 507 | // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page. |
| 508 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service ); |
|
| 508 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->schema_service, $this->notice_service); |
|
| 509 | 509 | |
| 510 | 510 | // Create an instance of the User service. |
| 511 | 511 | $this->user_service = new Wordlift_User_Service(); |
| 512 | 512 | |
| 513 | 513 | // Create a new instance of the Timeline service and Timeline shortcode. |
| 514 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service ); |
|
| 514 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service); |
|
| 515 | 515 | |
| 516 | 516 | // Create a new instance of the Redirect service. |
| 517 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
| 517 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_service); |
|
| 518 | 518 | |
| 519 | 519 | // Create a new instance of the Redirect service. |
| 520 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service ); |
|
| 520 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->entity_service); |
|
| 521 | 521 | |
| 522 | 522 | // Initialize the shortcodes. |
| 523 | 523 | new Wordlift_Navigator_Shortcode(); |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | new Wordlift_Timeline_Shortcode(); |
| 527 | 527 | |
| 528 | 528 | // Create entity list customization (wp-admin/edit.php) |
| 529 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service ); |
|
| 529 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->entity_service); |
|
| 530 | 530 | |
| 531 | 531 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
| 532 | 532 | |
@@ -541,12 +541,12 @@ discard block |
||
| 541 | 541 | $this->page_service = new Wordlift_Page_Service(); |
| 542 | 542 | |
| 543 | 543 | // Create an import service instance to hook later to WP's import function. |
| 544 | - $this->import_service = new Wordlift_Import_Service( $this->entity_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, wl_configuration_get_redlink_dataset_uri() ); |
|
| 544 | + $this->import_service = new Wordlift_Import_Service($this->entity_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, wl_configuration_get_redlink_dataset_uri()); |
|
| 545 | 545 | |
| 546 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
| 546 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
| 547 | 547 | |
| 548 | 548 | // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
| 549 | - $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service ); |
|
| 549 | + $this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service); |
|
| 550 | 550 | |
| 551 | 551 | //** WordPress Admin */ |
| 552 | 552 | $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
@@ -565,9 +565,9 @@ discard block |
||
| 565 | 565 | private function set_locale() { |
| 566 | 566 | |
| 567 | 567 | $plugin_i18n = new Wordlift_i18n(); |
| 568 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
| 568 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
| 569 | 569 | |
| 570 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
| 570 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
| 571 | 571 | |
| 572 | 572 | } |
| 573 | 573 | |
@@ -580,75 +580,75 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | private function define_admin_hooks() { |
| 582 | 582 | |
| 583 | - $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() ); |
|
| 583 | + $plugin_admin = new Wordlift_Admin($this->get_plugin_name(), $this->get_version()); |
|
| 584 | 584 | |
| 585 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
| 586 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); |
|
| 585 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
| 586 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts'); |
|
| 587 | 587 | |
| 588 | 588 | // Hook the init action to the Topic Taxonomy service. |
| 589 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
| 589 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
| 590 | 590 | |
| 591 | 591 | // Hook the deleted_post_meta action to the Thumbnail service. |
| 592 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
| 592 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
| 593 | 593 | |
| 594 | 594 | // Hook the added_post_meta action to the Thumbnail service. |
| 595 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 595 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 596 | 596 | |
| 597 | 597 | // Hook the updated_post_meta action to the Thumbnail service. |
| 598 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
| 598 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
| 599 | 599 | |
| 600 | 600 | // Hook posts inserts (or updates) to the user service. |
| 601 | - $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 ); |
|
| 601 | + $this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3); |
|
| 602 | 602 | |
| 603 | 603 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 604 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 604 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 605 | 605 | |
| 606 | 606 | // Register custom allowed redirect hosts. |
| 607 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
| 607 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
| 608 | 608 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 609 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
| 609 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
| 610 | 610 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 611 | - $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
| 611 | + $this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats'); |
|
| 612 | 612 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
| 613 | - $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
| 613 | + $this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets'); |
|
| 614 | 614 | |
| 615 | 615 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
| 616 | 616 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
| 617 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
| 618 | - $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 ); |
|
| 617 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
| 618 | + $this->loader->add_action('save_post_entity', $this->entity_service, 'set_rating_for', 10, 1); |
|
| 619 | 619 | |
| 620 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
| 621 | - $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' ); |
|
| 620 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
| 621 | + $this->loader->add_action('in_admin_header', $this->entity_service, 'in_admin_header'); |
|
| 622 | 622 | |
| 623 | 623 | // Entity listing customization (wp-admin/edit.php) |
| 624 | 624 | // Add custom columns |
| 625 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
| 626 | - $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
| 625 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
| 626 | + $this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
| 627 | 627 | // Add 4W selection |
| 628 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
| 629 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
| 628 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
| 629 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
| 630 | 630 | |
| 631 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
| 631 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
| 632 | 632 | |
| 633 | 633 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
| 634 | 634 | // entities. |
| 635 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
| 635 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
| 636 | 636 | |
| 637 | 637 | // Filter imported post meta. |
| 638 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
| 638 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
| 639 | 639 | |
| 640 | 640 | // Notify the import service when an import starts and ends. |
| 641 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
| 642 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
| 641 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
| 642 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
| 643 | 643 | |
| 644 | 644 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
| 645 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
| 645 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
| 646 | 646 | |
| 647 | 647 | // Hook the menu to the Download Your Data page. |
| 648 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
| 648 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
| 649 | 649 | |
| 650 | 650 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
| 651 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
| 651 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
| 652 | 652 | |
| 653 | 653 | } |
| 654 | 654 | |
@@ -661,29 +661,29 @@ discard block |
||
| 661 | 661 | */ |
| 662 | 662 | private function define_public_hooks() { |
| 663 | 663 | |
| 664 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
| 664 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
| 665 | 665 | |
| 666 | 666 | // Register the entity post type. |
| 667 | - $this->loader->add_action( 'init', $this->entity_type_service, 'register' ); |
|
| 667 | + $this->loader->add_action('init', $this->entity_type_service, 'register'); |
|
| 668 | 668 | |
| 669 | 669 | // Bind the link generation and handling hooks to the entity link service. |
| 670 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
| 671 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 ); |
|
| 672 | - $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 ); |
|
| 673 | - $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 ); |
|
| 670 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
| 671 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1); |
|
| 672 | + $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); |
|
| 673 | + $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); |
|
| 674 | 674 | |
| 675 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
| 676 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
| 675 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
| 676 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
| 677 | 677 | |
| 678 | 678 | // Hook the AJAX wl_timeline action to the Timeline service. |
| 679 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
| 679 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
| 680 | 680 | |
| 681 | 681 | // Hook the ShareThis service. |
| 682 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
| 683 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
| 682 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
| 683 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
| 684 | 684 | |
| 685 | - $this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX ); |
|
| 686 | - $this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX ); |
|
| 685 | + $this->loader->add_action('wp_head', $this->page_service, 'wp_head', PHP_INT_MAX); |
|
| 686 | + $this->loader->add_action('wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX); |
|
| 687 | 687 | |
| 688 | 688 | } |
| 689 | 689 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @param string $uri Uri of the entity to search in the post content. |
| 11 | 11 | */ |
| 12 | 12 | function wl_content_embed_build_regex_from_uri( $uri ) { |
| 13 | - return '|<(\\w+)[^<]* itemid=\"' . esc_attr( $uri ) . '\"[^>]*>([^<]*)<\\/\\1>|i'; |
|
| 13 | + return '|<(\\w+)[^<]* itemid=\"' . esc_attr( $uri ) . '\"[^>]*>([^<]*)<\\/\\1>|i'; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | function wl_content_embed_microdata( $content ) { |
| 24 | 24 | |
| 25 | - // Apply microdata only to single pages. |
|
| 26 | - /*if ( ! is_single() ) { |
|
| 25 | + // Apply microdata only to single pages. |
|
| 26 | + /*if ( ! is_single() ) { |
|
| 27 | 27 | wl_write_log( "wl_content_embed_microdata : is not single" ); |
| 28 | 28 | |
| 29 | 29 | return $content; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | global $post; |
| 33 | 33 | */ |
| 34 | - return _wl_content_embed_microdata( get_the_ID(), $content ); |
|
| 34 | + return _wl_content_embed_microdata( get_the_ID(), $content ); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -44,31 +44,31 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | function _wl_content_embed_microdata( $post_id, $content ) { |
| 46 | 46 | |
| 47 | - // If it is an entity, add its own microdata to the content. |
|
| 48 | - if ( get_post_type( $post_id ) == Wordlift_Entity_Service::TYPE_NAME ) { |
|
| 49 | - $own_uri = wl_get_entity_uri( $post_id ); |
|
| 50 | - $content .= '<span itemid="' . $own_uri . '"></span>'; |
|
| 51 | - } |
|
| 47 | + // If it is an entity, add its own microdata to the content. |
|
| 48 | + if ( get_post_type( $post_id ) == Wordlift_Entity_Service::TYPE_NAME ) { |
|
| 49 | + $own_uri = wl_get_entity_uri( $post_id ); |
|
| 50 | + $content .= '<span itemid="' . $own_uri . '"></span>'; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - // Now search in the text entity mentions |
|
| 54 | - $regex = '/<(\\w+)[^<]* itemid=\"([^"]+)\"[^>]*>([^<]*)<\\/\\1>/i'; |
|
| 55 | - $matches = array(); |
|
| 53 | + // Now search in the text entity mentions |
|
| 54 | + $regex = '/<(\\w+)[^<]* itemid=\"([^"]+)\"[^>]*>([^<]*)<\\/\\1>/i'; |
|
| 55 | + $matches = array(); |
|
| 56 | 56 | |
| 57 | - // Return the content if not item IDs have been found. |
|
| 58 | - if ( FALSE === preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) { |
|
| 59 | - return $content; |
|
| 60 | - } |
|
| 57 | + // Return the content if not item IDs have been found. |
|
| 58 | + if ( FALSE === preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) { |
|
| 59 | + return $content; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - // TODO: Retrieve here just one time entities type structure to avoid multiple queries. |
|
| 63 | - foreach ( $matches as $match ) { |
|
| 64 | - $item_id = $match[2]; |
|
| 62 | + // TODO: Retrieve here just one time entities type structure to avoid multiple queries. |
|
| 63 | + foreach ( $matches as $match ) { |
|
| 64 | + $item_id = $match[2]; |
|
| 65 | 65 | |
| 66 | - // wl_write_log( "_wl_content_embed_microdata [ item ID :: $item_id ]" ); |
|
| 66 | + // wl_write_log( "_wl_content_embed_microdata [ item ID :: $item_id ]" ); |
|
| 67 | 67 | |
| 68 | - $content = wl_content_embed_item_microdata( $content, $item_id ); |
|
| 69 | - } |
|
| 68 | + $content = wl_content_embed_item_microdata( $content, $item_id ); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - return $content; |
|
| 71 | + return $content; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -82,80 +82,80 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | function wl_content_embed_item_microdata( $content, $uri, $itemprop = NULL, $recursion_level = 0 ) { |
| 84 | 84 | |
| 85 | - // The recursion level is set by `wl_content_embed_compile_microdata_template` |
|
| 86 | - // which is loading referenced entities and calling again this function to print |
|
| 87 | - // additional properties. By default WordLift doesn't print more than 3 nested |
|
| 88 | - // entities. |
|
| 89 | - if ( $recursion_level > wl_config_get_recursion_depth() ) { |
|
| 90 | - wl_write_log( "recursion depth limit exceeded [ level :: $recursion_level ][ max :: " . wl_config_get_recursion_depth() . " ]" ); |
|
| 85 | + // The recursion level is set by `wl_content_embed_compile_microdata_template` |
|
| 86 | + // which is loading referenced entities and calling again this function to print |
|
| 87 | + // additional properties. By default WordLift doesn't print more than 3 nested |
|
| 88 | + // entities. |
|
| 89 | + if ( $recursion_level > wl_config_get_recursion_depth() ) { |
|
| 90 | + wl_write_log( "recursion depth limit exceeded [ level :: $recursion_level ][ max :: " . wl_config_get_recursion_depth() . " ]" ); |
|
| 91 | 91 | |
| 92 | - return ''; |
|
| 93 | - } |
|
| 92 | + return ''; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - $post = Wordlift_Entity_Service::get_instance() |
|
| 96 | - ->get_entity_post_by_uri( $uri ); |
|
| 95 | + $post = Wordlift_Entity_Service::get_instance() |
|
| 96 | + ->get_entity_post_by_uri( $uri ); |
|
| 97 | 97 | |
| 98 | - // Entity not found or not published. Delete <span> tags but leave their content on page. |
|
| 99 | - if ( NULL === $post || $post->post_status !== 'publish' ) { |
|
| 98 | + // Entity not found or not published. Delete <span> tags but leave their content on page. |
|
| 99 | + if ( NULL === $post || $post->post_status !== 'publish' ) { |
|
| 100 | 100 | |
| 101 | - // wl_write_log( "wl_content_embed_item_microdata : entity not found or not published [ uri :: $uri ]" ); |
|
| 101 | + // wl_write_log( "wl_content_embed_item_microdata : entity not found or not published [ uri :: $uri ]" ); |
|
| 102 | 102 | |
| 103 | - // Replace the original tagging with the new tagging. |
|
| 104 | - $regex = wl_content_embed_build_regex_from_uri( $uri ); |
|
| 105 | - $content = preg_replace( $regex, '$2', $content ); |
|
| 103 | + // Replace the original tagging with the new tagging. |
|
| 104 | + $regex = wl_content_embed_build_regex_from_uri( $uri ); |
|
| 105 | + $content = preg_replace( $regex, '$2', $content ); |
|
| 106 | 106 | |
| 107 | - return $content; |
|
| 108 | - } |
|
| 107 | + return $content; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - // Get the entity URI and its escaped version for the regex. |
|
| 111 | - $entity_uri = wl_get_entity_uri( $post->ID ); |
|
| 112 | - // Get the main type. |
|
| 113 | - $main_type = wl_entity_type_taxonomy_get_type( $post->ID ); |
|
| 110 | + // Get the entity URI and its escaped version for the regex. |
|
| 111 | + $entity_uri = wl_get_entity_uri( $post->ID ); |
|
| 112 | + // Get the main type. |
|
| 113 | + $main_type = wl_entity_type_taxonomy_get_type( $post->ID ); |
|
| 114 | 114 | |
| 115 | - // Set the item type if available. |
|
| 116 | - $item_type = ( NULL === $main_type ? '' : ' itemtype="' . esc_attr( $main_type['uri'] ) . '"' ); |
|
| 115 | + // Set the item type if available. |
|
| 116 | + $item_type = ( NULL === $main_type ? '' : ' itemtype="' . esc_attr( $main_type['uri'] ) . '"' ); |
|
| 117 | 117 | |
| 118 | - // Define attribute itemprop if this entity is nested. |
|
| 119 | - if ( ! is_null( $itemprop ) ) { |
|
| 120 | - $itemprop = ' itemprop="' . $itemprop . '"'; |
|
| 121 | - } |
|
| 118 | + // Define attribute itemprop if this entity is nested. |
|
| 119 | + if ( ! is_null( $itemprop ) ) { |
|
| 120 | + $itemprop = ' itemprop="' . $itemprop . '"'; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - // Get additional properties (this may imply a recursion of this method on a sub-entity). |
|
| 124 | - $additional_properties = wl_content_embed_compile_microdata_template( $post->ID, $main_type, $recursion_level ); |
|
| 123 | + // Get additional properties (this may imply a recursion of this method on a sub-entity). |
|
| 124 | + $additional_properties = wl_content_embed_compile_microdata_template( $post->ID, $main_type, $recursion_level ); |
|
| 125 | 125 | |
| 126 | - $same_as = ''; |
|
| 127 | - // Get the array of sameAs uris. |
|
| 128 | - $same_as_uris = wl_schema_get_value( $post->ID, 'sameAs' ); |
|
| 129 | - // Prepare the sameAs fragment. |
|
| 130 | - foreach ( $same_as_uris as $same_as_uri ) { |
|
| 131 | - $same_as .= "<link itemprop=\"sameAs\" href=\"$same_as_uri\">"; |
|
| 132 | - } |
|
| 126 | + $same_as = ''; |
|
| 127 | + // Get the array of sameAs uris. |
|
| 128 | + $same_as_uris = wl_schema_get_value( $post->ID, 'sameAs' ); |
|
| 129 | + // Prepare the sameAs fragment. |
|
| 130 | + foreach ( $same_as_uris as $same_as_uri ) { |
|
| 131 | + $same_as .= "<link itemprop=\"sameAs\" href=\"$same_as_uri\">"; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - // Get the entity URL. |
|
| 135 | - $permalink = get_permalink( $post->ID ); |
|
| 136 | - $url = '<link itemprop="url" href="' . $permalink . '" />'; |
|
| 134 | + // Get the entity URL. |
|
| 135 | + $permalink = get_permalink( $post->ID ); |
|
| 136 | + $url = '<link itemprop="url" href="' . $permalink . '" />'; |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | - // If entity is nested, we do not show a link, but a hidden meta. |
|
| 140 | - // See https://github.com/insideout10/wordlift-plugin/issues/348 |
|
| 141 | - $name = ! is_null( $itemprop ) |
|
| 142 | - ? "<meta itemprop='name' content='$post->post_title' /></$1>" |
|
| 143 | - : '<a class="wl-entity-page-link" href="' . $permalink . '" itemprop="name" content="' . $post->post_title . '">' . ( is_null( $itemprop ) ? '$2' : '' ) . '</a></$1>'; |
|
| 139 | + // If entity is nested, we do not show a link, but a hidden meta. |
|
| 140 | + // See https://github.com/insideout10/wordlift-plugin/issues/348 |
|
| 141 | + $name = ! is_null( $itemprop ) |
|
| 142 | + ? "<meta itemprop='name' content='$post->post_title' /></$1>" |
|
| 143 | + : '<a class="wl-entity-page-link" href="' . $permalink . '" itemprop="name" content="' . $post->post_title . '">' . ( is_null( $itemprop ) ? '$2' : '' ) . '</a></$1>'; |
|
| 144 | 144 | |
| 145 | - // Replace the original tagging with the new tagging. |
|
| 146 | - $regex = wl_content_embed_build_regex_from_uri( $uri ); |
|
| 147 | - $content = preg_replace( $regex, |
|
| 148 | - '<$1' . $itemprop . ' itemscope' . $item_type . ' itemid="' . esc_attr( $entity_uri ) . '">' |
|
| 149 | - . $same_as |
|
| 150 | - . $additional_properties |
|
| 151 | - . $url |
|
| 152 | - . $name, |
|
| 153 | - $content |
|
| 154 | - ); |
|
| 145 | + // Replace the original tagging with the new tagging. |
|
| 146 | + $regex = wl_content_embed_build_regex_from_uri( $uri ); |
|
| 147 | + $content = preg_replace( $regex, |
|
| 148 | + '<$1' . $itemprop . ' itemscope' . $item_type . ' itemid="' . esc_attr( $entity_uri ) . '">' |
|
| 149 | + . $same_as |
|
| 150 | + . $additional_properties |
|
| 151 | + . $url |
|
| 152 | + . $name, |
|
| 153 | + $content |
|
| 154 | + ); |
|
| 155 | 155 | |
| 156 | - // wl_write_log( "wl_content_embed_item_microdata [ uri :: $uri ][ regex :: $regex ]" ); |
|
| 156 | + // wl_write_log( "wl_content_embed_item_microdata [ uri :: $uri ][ regex :: $regex ]" ); |
|
| 157 | 157 | |
| 158 | - return $content; |
|
| 158 | + return $content; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | add_filter( 'the_content', 'wl_content_embed_microdata' ); |
@@ -170,94 +170,94 @@ discard block |
||
| 170 | 170 | * @return string The content with embedded microdata. |
| 171 | 171 | */ |
| 172 | 172 | function wl_content_embed_compile_microdata_template( $entity_id, $entity_type, $recursion_level = 0 ) { |
| 173 | - global $wl_logger; |
|
| 174 | - |
|
| 175 | - if ( WP_DEBUG ) { |
|
| 176 | - $wl_logger->trace( "Embedding microdata [ entity id :: $entity_id ][ recursion level :: $recursion_level ]" ); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - $regex = '/{{(.*?)}}/'; |
|
| 180 | - $matches = array(); |
|
| 181 | - |
|
| 182 | - if ( NULL === $entity_type ) { |
|
| 183 | - return ''; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - $template = $entity_type['microdata_template']; |
|
| 187 | - // Return empty string if template fields have not been found. |
|
| 188 | - if ( FALSE === preg_match_all( $regex, $template, $matches, PREG_SET_ORDER ) ) { |
|
| 189 | - return ''; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - foreach ( $matches as $match ) { |
|
| 193 | - |
|
| 194 | - $placeholder = $match[0]; |
|
| 195 | - $field_name = $match[1]; |
|
| 196 | - |
|
| 197 | - // Get property value. |
|
| 198 | - $meta_collection = wl_schema_get_value( $entity_id, $field_name ); |
|
| 199 | - |
|
| 200 | - // If no value is given, just remove the placeholder from the template |
|
| 201 | - if ( NULL == $meta_collection ) { |
|
| 202 | - $template = str_replace( $placeholder, '', $template ); |
|
| 203 | - continue; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - // What kind of value is it? |
|
| 207 | - // TODO: Performance issue here: meta type retrieving should be centralized |
|
| 208 | - $expected_type = wl_get_meta_type( $field_name ); |
|
| 209 | - |
|
| 210 | - if ( WP_DEBUG ) { |
|
| 211 | - $wl_logger->trace( "Embedding microdata [ placeholder :: $placeholder ][ field name :: $field_name ][ meta collection :: " . ( is_array( $meta_collection ) ? var_export( $meta_collection, TRUE ) : $meta_collection ) . " ][ expected type :: $expected_type ]" ); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - foreach ( $meta_collection as $field_value ) { |
|
| 215 | - |
|
| 216 | - // Quick and dirty patch for #163: |
|
| 217 | - // - only apply to URIs, i.e. to properties pointing to another post ( $field_value should be a post ID ), |
|
| 218 | - // - check that $field_value is actually a number, |
|
| 219 | - // - check that the referenced post is published. |
|
| 220 | - // OR |
|
| 221 | - // - if the value is empty then we don't display it. |
|
| 222 | - if ( Wordlift_Schema_Service::DATA_TYPE_URI === $expected_type && is_numeric( $field_value ) && 'publish' !== ( $post_status = get_post_status( $field_value ) ) |
|
| 223 | - || empty( $field_value ) |
|
| 224 | - ) { |
|
| 225 | - |
|
| 226 | - if ( WP_DEBUG ) { |
|
| 227 | - $wl_logger->trace( "Microdata refers to a non-published post [ field value :: $field_value ][ post status :: $post_status ]" ); |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - // Remove the placeholder. |
|
| 231 | - $template = str_replace( $placeholder, '', $template ); |
|
| 232 | - continue; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - if ( Wordlift_Schema_Service::DATA_TYPE_URI == $expected_type ) { |
|
| 236 | - // If is a numeric value we assume it is an ID referencing for an internal entity. |
|
| 237 | - if ( is_numeric( $field_value ) ) { |
|
| 238 | - // Found id, get uri. |
|
| 239 | - $field_value = wl_get_entity_uri( $field_value ); |
|
| 240 | - } |
|
| 241 | - // Just if the linked entity does exist I can go further with template compiling |
|
| 242 | - $nested_entity = Wordlift_Entity_Service::get_instance() |
|
| 243 | - ->get_entity_post_by_uri( $field_value ); |
|
| 244 | - if ( ! is_null( $nested_entity ) ) { |
|
| 245 | - $content = '<span itemid="' . esc_attr( $field_value ) . '">' . $nested_entity->post_title . '</span>'; |
|
| 246 | - $compiled_template = wl_content_embed_item_microdata( $content, $field_value, $field_name, ++ $recursion_level ); |
|
| 247 | - $template = str_replace( $placeholder, $compiled_template, $template ); |
|
| 248 | - } else { |
|
| 249 | - $template = str_replace( $placeholder, '', $template ); |
|
| 250 | - } |
|
| 251 | - continue; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - // Standard condition: field containing a raw value |
|
| 255 | - // For non visible test, schema.org dictates to use the *meta* tag. |
|
| 256 | - // see http://schema.org/docs/gs.html#advanced_missing |
|
| 257 | - $value = '<meta itemprop="' . esc_attr( $field_name ) . '" content="' . esc_attr( $field_value ) . '" />'; |
|
| 258 | - $template = str_replace( $placeholder, $value, $template ); |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - return $template; |
|
| 173 | + global $wl_logger; |
|
| 174 | + |
|
| 175 | + if ( WP_DEBUG ) { |
|
| 176 | + $wl_logger->trace( "Embedding microdata [ entity id :: $entity_id ][ recursion level :: $recursion_level ]" ); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + $regex = '/{{(.*?)}}/'; |
|
| 180 | + $matches = array(); |
|
| 181 | + |
|
| 182 | + if ( NULL === $entity_type ) { |
|
| 183 | + return ''; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + $template = $entity_type['microdata_template']; |
|
| 187 | + // Return empty string if template fields have not been found. |
|
| 188 | + if ( FALSE === preg_match_all( $regex, $template, $matches, PREG_SET_ORDER ) ) { |
|
| 189 | + return ''; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + foreach ( $matches as $match ) { |
|
| 193 | + |
|
| 194 | + $placeholder = $match[0]; |
|
| 195 | + $field_name = $match[1]; |
|
| 196 | + |
|
| 197 | + // Get property value. |
|
| 198 | + $meta_collection = wl_schema_get_value( $entity_id, $field_name ); |
|
| 199 | + |
|
| 200 | + // If no value is given, just remove the placeholder from the template |
|
| 201 | + if ( NULL == $meta_collection ) { |
|
| 202 | + $template = str_replace( $placeholder, '', $template ); |
|
| 203 | + continue; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + // What kind of value is it? |
|
| 207 | + // TODO: Performance issue here: meta type retrieving should be centralized |
|
| 208 | + $expected_type = wl_get_meta_type( $field_name ); |
|
| 209 | + |
|
| 210 | + if ( WP_DEBUG ) { |
|
| 211 | + $wl_logger->trace( "Embedding microdata [ placeholder :: $placeholder ][ field name :: $field_name ][ meta collection :: " . ( is_array( $meta_collection ) ? var_export( $meta_collection, TRUE ) : $meta_collection ) . " ][ expected type :: $expected_type ]" ); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + foreach ( $meta_collection as $field_value ) { |
|
| 215 | + |
|
| 216 | + // Quick and dirty patch for #163: |
|
| 217 | + // - only apply to URIs, i.e. to properties pointing to another post ( $field_value should be a post ID ), |
|
| 218 | + // - check that $field_value is actually a number, |
|
| 219 | + // - check that the referenced post is published. |
|
| 220 | + // OR |
|
| 221 | + // - if the value is empty then we don't display it. |
|
| 222 | + if ( Wordlift_Schema_Service::DATA_TYPE_URI === $expected_type && is_numeric( $field_value ) && 'publish' !== ( $post_status = get_post_status( $field_value ) ) |
|
| 223 | + || empty( $field_value ) |
|
| 224 | + ) { |
|
| 225 | + |
|
| 226 | + if ( WP_DEBUG ) { |
|
| 227 | + $wl_logger->trace( "Microdata refers to a non-published post [ field value :: $field_value ][ post status :: $post_status ]" ); |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + // Remove the placeholder. |
|
| 231 | + $template = str_replace( $placeholder, '', $template ); |
|
| 232 | + continue; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + if ( Wordlift_Schema_Service::DATA_TYPE_URI == $expected_type ) { |
|
| 236 | + // If is a numeric value we assume it is an ID referencing for an internal entity. |
|
| 237 | + if ( is_numeric( $field_value ) ) { |
|
| 238 | + // Found id, get uri. |
|
| 239 | + $field_value = wl_get_entity_uri( $field_value ); |
|
| 240 | + } |
|
| 241 | + // Just if the linked entity does exist I can go further with template compiling |
|
| 242 | + $nested_entity = Wordlift_Entity_Service::get_instance() |
|
| 243 | + ->get_entity_post_by_uri( $field_value ); |
|
| 244 | + if ( ! is_null( $nested_entity ) ) { |
|
| 245 | + $content = '<span itemid="' . esc_attr( $field_value ) . '">' . $nested_entity->post_title . '</span>'; |
|
| 246 | + $compiled_template = wl_content_embed_item_microdata( $content, $field_value, $field_name, ++ $recursion_level ); |
|
| 247 | + $template = str_replace( $placeholder, $compiled_template, $template ); |
|
| 248 | + } else { |
|
| 249 | + $template = str_replace( $placeholder, '', $template ); |
|
| 250 | + } |
|
| 251 | + continue; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + // Standard condition: field containing a raw value |
|
| 255 | + // For non visible test, schema.org dictates to use the *meta* tag. |
|
| 256 | + // see http://schema.org/docs/gs.html#advanced_missing |
|
| 257 | + $value = '<meta itemprop="' . esc_attr( $field_name ) . '" content="' . esc_attr( $field_value ) . '" />'; |
|
| 258 | + $template = str_replace( $placeholder, $value, $template ); |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + return $template; |
|
| 263 | 263 | } |
| 264 | 264 | \ No newline at end of file |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | * |
| 10 | 10 | * @param string $uri Uri of the entity to search in the post content. |
| 11 | 11 | */ |
| 12 | -function wl_content_embed_build_regex_from_uri( $uri ) { |
|
| 13 | - return '|<(\\w+)[^<]* itemid=\"' . esc_attr( $uri ) . '\"[^>]*>([^<]*)<\\/\\1>|i'; |
|
| 12 | +function wl_content_embed_build_regex_from_uri($uri) { |
|
| 13 | + return '|<(\\w+)[^<]* itemid=\"'.esc_attr($uri).'\"[^>]*>([^<]*)<\\/\\1>|i'; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return string The updated post content. |
| 22 | 22 | */ |
| 23 | -function wl_content_embed_microdata( $content ) { |
|
| 23 | +function wl_content_embed_microdata($content) { |
|
| 24 | 24 | |
| 25 | 25 | // Apply microdata only to single pages. |
| 26 | 26 | /*if ( ! is_single() ) { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | global $post; |
| 33 | 33 | */ |
| 34 | - return _wl_content_embed_microdata( get_the_ID(), $content ); |
|
| 34 | + return _wl_content_embed_microdata(get_the_ID(), $content); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return string The updated post content. |
| 44 | 44 | */ |
| 45 | -function _wl_content_embed_microdata( $post_id, $content ) { |
|
| 45 | +function _wl_content_embed_microdata($post_id, $content) { |
|
| 46 | 46 | |
| 47 | 47 | // If it is an entity, add its own microdata to the content. |
| 48 | - if ( get_post_type( $post_id ) == Wordlift_Entity_Service::TYPE_NAME ) { |
|
| 49 | - $own_uri = wl_get_entity_uri( $post_id ); |
|
| 50 | - $content .= '<span itemid="' . $own_uri . '"></span>'; |
|
| 48 | + if (get_post_type($post_id) == Wordlift_Entity_Service::TYPE_NAME) { |
|
| 49 | + $own_uri = wl_get_entity_uri($post_id); |
|
| 50 | + $content .= '<span itemid="'.$own_uri.'"></span>'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Now search in the text entity mentions |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | $matches = array(); |
| 56 | 56 | |
| 57 | 57 | // Return the content if not item IDs have been found. |
| 58 | - if ( FALSE === preg_match_all( $regex, $content, $matches, PREG_SET_ORDER ) ) { |
|
| 58 | + if (FALSE === preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) { |
|
| 59 | 59 | return $content; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // TODO: Retrieve here just one time entities type structure to avoid multiple queries. |
| 63 | - foreach ( $matches as $match ) { |
|
| 63 | + foreach ($matches as $match) { |
|
| 64 | 64 | $item_id = $match[2]; |
| 65 | 65 | |
| 66 | 66 | // wl_write_log( "_wl_content_embed_microdata [ item ID :: $item_id ]" ); |
| 67 | 67 | |
| 68 | - $content = wl_content_embed_item_microdata( $content, $item_id ); |
|
| 68 | + $content = wl_content_embed_item_microdata($content, $item_id); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return $content; |
@@ -80,72 +80,72 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return string The content with embedded microdata. |
| 82 | 82 | */ |
| 83 | -function wl_content_embed_item_microdata( $content, $uri, $itemprop = NULL, $recursion_level = 0 ) { |
|
| 83 | +function wl_content_embed_item_microdata($content, $uri, $itemprop = NULL, $recursion_level = 0) { |
|
| 84 | 84 | |
| 85 | 85 | // The recursion level is set by `wl_content_embed_compile_microdata_template` |
| 86 | 86 | // which is loading referenced entities and calling again this function to print |
| 87 | 87 | // additional properties. By default WordLift doesn't print more than 3 nested |
| 88 | 88 | // entities. |
| 89 | - if ( $recursion_level > wl_config_get_recursion_depth() ) { |
|
| 90 | - wl_write_log( "recursion depth limit exceeded [ level :: $recursion_level ][ max :: " . wl_config_get_recursion_depth() . " ]" ); |
|
| 89 | + if ($recursion_level > wl_config_get_recursion_depth()) { |
|
| 90 | + wl_write_log("recursion depth limit exceeded [ level :: $recursion_level ][ max :: ".wl_config_get_recursion_depth()." ]"); |
|
| 91 | 91 | |
| 92 | 92 | return ''; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $post = Wordlift_Entity_Service::get_instance() |
| 96 | - ->get_entity_post_by_uri( $uri ); |
|
| 96 | + ->get_entity_post_by_uri($uri); |
|
| 97 | 97 | |
| 98 | 98 | // Entity not found or not published. Delete <span> tags but leave their content on page. |
| 99 | - if ( NULL === $post || $post->post_status !== 'publish' ) { |
|
| 99 | + if (NULL === $post || $post->post_status !== 'publish') { |
|
| 100 | 100 | |
| 101 | 101 | // wl_write_log( "wl_content_embed_item_microdata : entity not found or not published [ uri :: $uri ]" ); |
| 102 | 102 | |
| 103 | 103 | // Replace the original tagging with the new tagging. |
| 104 | - $regex = wl_content_embed_build_regex_from_uri( $uri ); |
|
| 105 | - $content = preg_replace( $regex, '$2', $content ); |
|
| 104 | + $regex = wl_content_embed_build_regex_from_uri($uri); |
|
| 105 | + $content = preg_replace($regex, '$2', $content); |
|
| 106 | 106 | |
| 107 | 107 | return $content; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Get the entity URI and its escaped version for the regex. |
| 111 | - $entity_uri = wl_get_entity_uri( $post->ID ); |
|
| 111 | + $entity_uri = wl_get_entity_uri($post->ID); |
|
| 112 | 112 | // Get the main type. |
| 113 | - $main_type = wl_entity_type_taxonomy_get_type( $post->ID ); |
|
| 113 | + $main_type = wl_entity_type_taxonomy_get_type($post->ID); |
|
| 114 | 114 | |
| 115 | 115 | // Set the item type if available. |
| 116 | - $item_type = ( NULL === $main_type ? '' : ' itemtype="' . esc_attr( $main_type['uri'] ) . '"' ); |
|
| 116 | + $item_type = (NULL === $main_type ? '' : ' itemtype="'.esc_attr($main_type['uri']).'"'); |
|
| 117 | 117 | |
| 118 | 118 | // Define attribute itemprop if this entity is nested. |
| 119 | - if ( ! is_null( $itemprop ) ) { |
|
| 120 | - $itemprop = ' itemprop="' . $itemprop . '"'; |
|
| 119 | + if ( ! is_null($itemprop)) { |
|
| 120 | + $itemprop = ' itemprop="'.$itemprop.'"'; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // Get additional properties (this may imply a recursion of this method on a sub-entity). |
| 124 | - $additional_properties = wl_content_embed_compile_microdata_template( $post->ID, $main_type, $recursion_level ); |
|
| 124 | + $additional_properties = wl_content_embed_compile_microdata_template($post->ID, $main_type, $recursion_level); |
|
| 125 | 125 | |
| 126 | 126 | $same_as = ''; |
| 127 | 127 | // Get the array of sameAs uris. |
| 128 | - $same_as_uris = wl_schema_get_value( $post->ID, 'sameAs' ); |
|
| 128 | + $same_as_uris = wl_schema_get_value($post->ID, 'sameAs'); |
|
| 129 | 129 | // Prepare the sameAs fragment. |
| 130 | - foreach ( $same_as_uris as $same_as_uri ) { |
|
| 130 | + foreach ($same_as_uris as $same_as_uri) { |
|
| 131 | 131 | $same_as .= "<link itemprop=\"sameAs\" href=\"$same_as_uri\">"; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Get the entity URL. |
| 135 | - $permalink = get_permalink( $post->ID ); |
|
| 136 | - $url = '<link itemprop="url" href="' . $permalink . '" />'; |
|
| 135 | + $permalink = get_permalink($post->ID); |
|
| 136 | + $url = '<link itemprop="url" href="'.$permalink.'" />'; |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | // If entity is nested, we do not show a link, but a hidden meta. |
| 140 | 140 | // See https://github.com/insideout10/wordlift-plugin/issues/348 |
| 141 | - $name = ! is_null( $itemprop ) |
|
| 141 | + $name = ! is_null($itemprop) |
|
| 142 | 142 | ? "<meta itemprop='name' content='$post->post_title' /></$1>" |
| 143 | - : '<a class="wl-entity-page-link" href="' . $permalink . '" itemprop="name" content="' . $post->post_title . '">' . ( is_null( $itemprop ) ? '$2' : '' ) . '</a></$1>'; |
|
| 143 | + : '<a class="wl-entity-page-link" href="'.$permalink.'" itemprop="name" content="'.$post->post_title.'">'.(is_null($itemprop) ? '$2' : '').'</a></$1>'; |
|
| 144 | 144 | |
| 145 | 145 | // Replace the original tagging with the new tagging. |
| 146 | - $regex = wl_content_embed_build_regex_from_uri( $uri ); |
|
| 147 | - $content = preg_replace( $regex, |
|
| 148 | - '<$1' . $itemprop . ' itemscope' . $item_type . ' itemid="' . esc_attr( $entity_uri ) . '">' |
|
| 146 | + $regex = wl_content_embed_build_regex_from_uri($uri); |
|
| 147 | + $content = preg_replace($regex, |
|
| 148 | + '<$1'.$itemprop.' itemscope'.$item_type.' itemid="'.esc_attr($entity_uri).'">' |
|
| 149 | 149 | . $same_as |
| 150 | 150 | . $additional_properties |
| 151 | 151 | . $url |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | return $content; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | -add_filter( 'the_content', 'wl_content_embed_microdata' ); |
|
| 161 | +add_filter('the_content', 'wl_content_embed_microdata'); |
|
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Fills up the microdata_template with entity's values. |
@@ -169,49 +169,49 @@ discard block |
||
| 169 | 169 | * |
| 170 | 170 | * @return string The content with embedded microdata. |
| 171 | 171 | */ |
| 172 | -function wl_content_embed_compile_microdata_template( $entity_id, $entity_type, $recursion_level = 0 ) { |
|
| 172 | +function wl_content_embed_compile_microdata_template($entity_id, $entity_type, $recursion_level = 0) { |
|
| 173 | 173 | global $wl_logger; |
| 174 | 174 | |
| 175 | - if ( WP_DEBUG ) { |
|
| 176 | - $wl_logger->trace( "Embedding microdata [ entity id :: $entity_id ][ recursion level :: $recursion_level ]" ); |
|
| 175 | + if (WP_DEBUG) { |
|
| 176 | + $wl_logger->trace("Embedding microdata [ entity id :: $entity_id ][ recursion level :: $recursion_level ]"); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $regex = '/{{(.*?)}}/'; |
| 180 | 180 | $matches = array(); |
| 181 | 181 | |
| 182 | - if ( NULL === $entity_type ) { |
|
| 182 | + if (NULL === $entity_type) { |
|
| 183 | 183 | return ''; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $template = $entity_type['microdata_template']; |
| 187 | 187 | // Return empty string if template fields have not been found. |
| 188 | - if ( FALSE === preg_match_all( $regex, $template, $matches, PREG_SET_ORDER ) ) { |
|
| 188 | + if (FALSE === preg_match_all($regex, $template, $matches, PREG_SET_ORDER)) { |
|
| 189 | 189 | return ''; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - foreach ( $matches as $match ) { |
|
| 192 | + foreach ($matches as $match) { |
|
| 193 | 193 | |
| 194 | 194 | $placeholder = $match[0]; |
| 195 | 195 | $field_name = $match[1]; |
| 196 | 196 | |
| 197 | 197 | // Get property value. |
| 198 | - $meta_collection = wl_schema_get_value( $entity_id, $field_name ); |
|
| 198 | + $meta_collection = wl_schema_get_value($entity_id, $field_name); |
|
| 199 | 199 | |
| 200 | 200 | // If no value is given, just remove the placeholder from the template |
| 201 | - if ( NULL == $meta_collection ) { |
|
| 202 | - $template = str_replace( $placeholder, '', $template ); |
|
| 201 | + if (NULL == $meta_collection) { |
|
| 202 | + $template = str_replace($placeholder, '', $template); |
|
| 203 | 203 | continue; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // What kind of value is it? |
| 207 | 207 | // TODO: Performance issue here: meta type retrieving should be centralized |
| 208 | - $expected_type = wl_get_meta_type( $field_name ); |
|
| 208 | + $expected_type = wl_get_meta_type($field_name); |
|
| 209 | 209 | |
| 210 | - if ( WP_DEBUG ) { |
|
| 211 | - $wl_logger->trace( "Embedding microdata [ placeholder :: $placeholder ][ field name :: $field_name ][ meta collection :: " . ( is_array( $meta_collection ) ? var_export( $meta_collection, TRUE ) : $meta_collection ) . " ][ expected type :: $expected_type ]" ); |
|
| 210 | + if (WP_DEBUG) { |
|
| 211 | + $wl_logger->trace("Embedding microdata [ placeholder :: $placeholder ][ field name :: $field_name ][ meta collection :: ".(is_array($meta_collection) ? var_export($meta_collection, TRUE) : $meta_collection)." ][ expected type :: $expected_type ]"); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - foreach ( $meta_collection as $field_value ) { |
|
| 214 | + foreach ($meta_collection as $field_value) { |
|
| 215 | 215 | |
| 216 | 216 | // Quick and dirty patch for #163: |
| 217 | 217 | // - only apply to URIs, i.e. to properties pointing to another post ( $field_value should be a post ID ), |
@@ -219,34 +219,34 @@ discard block |
||
| 219 | 219 | // - check that the referenced post is published. |
| 220 | 220 | // OR |
| 221 | 221 | // - if the value is empty then we don't display it. |
| 222 | - if ( Wordlift_Schema_Service::DATA_TYPE_URI === $expected_type && is_numeric( $field_value ) && 'publish' !== ( $post_status = get_post_status( $field_value ) ) |
|
| 223 | - || empty( $field_value ) |
|
| 222 | + if (Wordlift_Schema_Service::DATA_TYPE_URI === $expected_type && is_numeric($field_value) && 'publish' !== ($post_status = get_post_status($field_value)) |
|
| 223 | + || empty($field_value) |
|
| 224 | 224 | ) { |
| 225 | 225 | |
| 226 | - if ( WP_DEBUG ) { |
|
| 227 | - $wl_logger->trace( "Microdata refers to a non-published post [ field value :: $field_value ][ post status :: $post_status ]" ); |
|
| 226 | + if (WP_DEBUG) { |
|
| 227 | + $wl_logger->trace("Microdata refers to a non-published post [ field value :: $field_value ][ post status :: $post_status ]"); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | // Remove the placeholder. |
| 231 | - $template = str_replace( $placeholder, '', $template ); |
|
| 231 | + $template = str_replace($placeholder, '', $template); |
|
| 232 | 232 | continue; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - if ( Wordlift_Schema_Service::DATA_TYPE_URI == $expected_type ) { |
|
| 235 | + if (Wordlift_Schema_Service::DATA_TYPE_URI == $expected_type) { |
|
| 236 | 236 | // If is a numeric value we assume it is an ID referencing for an internal entity. |
| 237 | - if ( is_numeric( $field_value ) ) { |
|
| 237 | + if (is_numeric($field_value)) { |
|
| 238 | 238 | // Found id, get uri. |
| 239 | - $field_value = wl_get_entity_uri( $field_value ); |
|
| 239 | + $field_value = wl_get_entity_uri($field_value); |
|
| 240 | 240 | } |
| 241 | 241 | // Just if the linked entity does exist I can go further with template compiling |
| 242 | 242 | $nested_entity = Wordlift_Entity_Service::get_instance() |
| 243 | - ->get_entity_post_by_uri( $field_value ); |
|
| 244 | - if ( ! is_null( $nested_entity ) ) { |
|
| 245 | - $content = '<span itemid="' . esc_attr( $field_value ) . '">' . $nested_entity->post_title . '</span>'; |
|
| 246 | - $compiled_template = wl_content_embed_item_microdata( $content, $field_value, $field_name, ++ $recursion_level ); |
|
| 247 | - $template = str_replace( $placeholder, $compiled_template, $template ); |
|
| 243 | + ->get_entity_post_by_uri($field_value); |
|
| 244 | + if ( ! is_null($nested_entity)) { |
|
| 245 | + $content = '<span itemid="'.esc_attr($field_value).'">'.$nested_entity->post_title.'</span>'; |
|
| 246 | + $compiled_template = wl_content_embed_item_microdata($content, $field_value, $field_name, ++ $recursion_level); |
|
| 247 | + $template = str_replace($placeholder, $compiled_template, $template); |
|
| 248 | 248 | } else { |
| 249 | - $template = str_replace( $placeholder, '', $template ); |
|
| 249 | + $template = str_replace($placeholder, '', $template); |
|
| 250 | 250 | } |
| 251 | 251 | continue; |
| 252 | 252 | } |
@@ -254,8 +254,8 @@ discard block |
||
| 254 | 254 | // Standard condition: field containing a raw value |
| 255 | 255 | // For non visible test, schema.org dictates to use the *meta* tag. |
| 256 | 256 | // see http://schema.org/docs/gs.html#advanced_missing |
| 257 | - $value = '<meta itemprop="' . esc_attr( $field_name ) . '" content="' . esc_attr( $field_value ) . '" />'; |
|
| 258 | - $template = str_replace( $placeholder, $value, $template ); |
|
| 257 | + $value = '<meta itemprop="'.esc_attr($field_name).'" content="'.esc_attr($field_value).'" />'; |
|
| 258 | + $template = str_replace($placeholder, $value, $template); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -22,94 +22,94 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Wordlift_Admin { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * The ID of this plugin. |
|
| 27 | - * |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - * @access private |
|
| 30 | - * @var string $plugin_name The ID of this plugin. |
|
| 31 | - */ |
|
| 32 | - private $plugin_name; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * The version of this plugin. |
|
| 36 | - * |
|
| 37 | - * @since 1.0.0 |
|
| 38 | - * @access private |
|
| 39 | - * @var string $version The current version of this plugin. |
|
| 40 | - */ |
|
| 41 | - private $version; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Initialize the class and set its properties. |
|
| 45 | - * |
|
| 46 | - * @since 1.0.0 |
|
| 47 | - * |
|
| 48 | - * @param string $plugin_name The name of this plugin. |
|
| 49 | - * @param string $version The version of this plugin. |
|
| 50 | - */ |
|
| 51 | - public function __construct( $plugin_name, $version ) { |
|
| 52 | - |
|
| 53 | - $this->plugin_name = $plugin_name; |
|
| 54 | - $this->version = $version; |
|
| 55 | - |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Register the stylesheets for the admin area. |
|
| 60 | - * |
|
| 61 | - * @since 1.0.0 |
|
| 62 | - */ |
|
| 63 | - public function enqueue_styles() { |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * This function is provided for demonstration purposes only. |
|
| 67 | - * |
|
| 68 | - * An instance of this class should be passed to the run() function |
|
| 69 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 70 | - * in that particular class. |
|
| 71 | - * |
|
| 72 | - * The Wordlift_Loader will then create the relationship |
|
| 73 | - * between the defined hooks and the functions defined in this |
|
| 74 | - * class. |
|
| 75 | - */ |
|
| 76 | - |
|
| 77 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 78 | - |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Register the JavaScript for the admin area. |
|
| 83 | - * |
|
| 84 | - * @since 1.0.0 |
|
| 85 | - */ |
|
| 86 | - public function enqueue_scripts() { |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * This function is provided for demonstration purposes only. |
|
| 90 | - * |
|
| 91 | - * An instance of this class should be passed to the run() function |
|
| 92 | - * defined in Wordlift_Loader as all of the hooks are defined |
|
| 93 | - * in that particular class. |
|
| 94 | - * |
|
| 95 | - * The Wordlift_Loader will then create the relationship |
|
| 96 | - * between the defined hooks and the functions defined in this |
|
| 97 | - * class. |
|
| 98 | - */ |
|
| 99 | - |
|
| 100 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.js', array( 'jquery' ), $this->version, FALSE ); |
|
| 101 | - |
|
| 102 | - // Add WL api endpoint to retrieve entities based on their title. We only load it on the entity edit page. |
|
| 103 | - $entity_being_edited = get_post(); |
|
| 104 | - if ( isset( $entity_being_edited->post_type ) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric( get_the_ID() ) ) { |
|
| 105 | - |
|
| 106 | - wp_localize_script( $this->plugin_name, 'wlEntityTitleLiveSearchParams', array( |
|
| 107 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 108 | - 'action' => 'entity_by_title', |
|
| 109 | - 'post_id' => get_the_ID() |
|
| 110 | - ) |
|
| 111 | - ); |
|
| 112 | - } |
|
| 113 | - } |
|
| 25 | + /** |
|
| 26 | + * The ID of this plugin. |
|
| 27 | + * |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + * @access private |
|
| 30 | + * @var string $plugin_name The ID of this plugin. |
|
| 31 | + */ |
|
| 32 | + private $plugin_name; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * The version of this plugin. |
|
| 36 | + * |
|
| 37 | + * @since 1.0.0 |
|
| 38 | + * @access private |
|
| 39 | + * @var string $version The current version of this plugin. |
|
| 40 | + */ |
|
| 41 | + private $version; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Initialize the class and set its properties. |
|
| 45 | + * |
|
| 46 | + * @since 1.0.0 |
|
| 47 | + * |
|
| 48 | + * @param string $plugin_name The name of this plugin. |
|
| 49 | + * @param string $version The version of this plugin. |
|
| 50 | + */ |
|
| 51 | + public function __construct( $plugin_name, $version ) { |
|
| 52 | + |
|
| 53 | + $this->plugin_name = $plugin_name; |
|
| 54 | + $this->version = $version; |
|
| 55 | + |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Register the stylesheets for the admin area. |
|
| 60 | + * |
|
| 61 | + * @since 1.0.0 |
|
| 62 | + */ |
|
| 63 | + public function enqueue_styles() { |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * This function is provided for demonstration purposes only. |
|
| 67 | + * |
|
| 68 | + * An instance of this class should be passed to the run() function |
|
| 69 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 70 | + * in that particular class. |
|
| 71 | + * |
|
| 72 | + * The Wordlift_Loader will then create the relationship |
|
| 73 | + * between the defined hooks and the functions defined in this |
|
| 74 | + * class. |
|
| 75 | + */ |
|
| 76 | + |
|
| 77 | + wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 78 | + |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Register the JavaScript for the admin area. |
|
| 83 | + * |
|
| 84 | + * @since 1.0.0 |
|
| 85 | + */ |
|
| 86 | + public function enqueue_scripts() { |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * This function is provided for demonstration purposes only. |
|
| 90 | + * |
|
| 91 | + * An instance of this class should be passed to the run() function |
|
| 92 | + * defined in Wordlift_Loader as all of the hooks are defined |
|
| 93 | + * in that particular class. |
|
| 94 | + * |
|
| 95 | + * The Wordlift_Loader will then create the relationship |
|
| 96 | + * between the defined hooks and the functions defined in this |
|
| 97 | + * class. |
|
| 98 | + */ |
|
| 99 | + |
|
| 100 | + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.js', array( 'jquery' ), $this->version, FALSE ); |
|
| 101 | + |
|
| 102 | + // Add WL api endpoint to retrieve entities based on their title. We only load it on the entity edit page. |
|
| 103 | + $entity_being_edited = get_post(); |
|
| 104 | + if ( isset( $entity_being_edited->post_type ) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric( get_the_ID() ) ) { |
|
| 105 | + |
|
| 106 | + wp_localize_script( $this->plugin_name, 'wlEntityTitleLiveSearchParams', array( |
|
| 107 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 108 | + 'action' => 'entity_by_title', |
|
| 109 | + 'post_id' => get_the_ID() |
|
| 110 | + ) |
|
| 111 | + ); |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param string $plugin_name The name of this plugin. |
| 49 | 49 | * @param string $version The version of this plugin. |
| 50 | 50 | */ |
| 51 | - public function __construct( $plugin_name, $version ) { |
|
| 51 | + public function __construct($plugin_name, $version) { |
|
| 52 | 52 | |
| 53 | 53 | $this->plugin_name = $plugin_name; |
| 54 | 54 | $this->version = $version; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * class. |
| 75 | 75 | */ |
| 76 | 76 | |
| 77 | - wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' ); |
|
| 77 | + wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all'); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | * class. |
| 98 | 98 | */ |
| 99 | 99 | |
| 100 | - wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.js', array( 'jquery' ), $this->version, FALSE ); |
|
| 100 | + wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-admin.js', array('jquery'), $this->version, FALSE); |
|
| 101 | 101 | |
| 102 | 102 | // Add WL api endpoint to retrieve entities based on their title. We only load it on the entity edit page. |
| 103 | 103 | $entity_being_edited = get_post(); |
| 104 | - if ( isset( $entity_being_edited->post_type ) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric( get_the_ID() ) ) { |
|
| 104 | + if (isset($entity_being_edited->post_type) && $entity_being_edited->post_type == Wordlift_Entity_Service::TYPE_NAME && is_numeric(get_the_ID())) { |
|
| 105 | 105 | |
| 106 | - wp_localize_script( $this->plugin_name, 'wlEntityTitleLiveSearchParams', array( |
|
| 107 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 106 | + wp_localize_script($this->plugin_name, 'wlEntityTitleLiveSearchParams', array( |
|
| 107 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 108 | 108 | 'action' => 'entity_by_title', |
| 109 | 109 | 'post_id' => get_the_ID() |
| 110 | 110 | ) |
@@ -16,51 +16,51 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class Wordlift_Admin_Download_Your_Data_Page { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Hook to 'admin_menu' to add the 'Download Your Data' page. |
|
| 21 | - * |
|
| 22 | - * @since 3.6.0 |
|
| 23 | - */ |
|
| 24 | - public function admin_menu() { |
|
| 19 | + /** |
|
| 20 | + * Hook to 'admin_menu' to add the 'Download Your Data' page. |
|
| 21 | + * |
|
| 22 | + * @since 3.6.0 |
|
| 23 | + */ |
|
| 24 | + public function admin_menu() { |
|
| 25 | 25 | |
| 26 | - // Add a callback to our 'page' function. |
|
| 27 | - add_submenu_page( 'wl_admin_menu', _x( 'Download Your Data', 'Page title', 'wordlift' ), _x( 'Download Your Data', 'Menu title', 'wordlift' ), 'manage_options', 'wl_download_your_data', array( |
|
| 28 | - $this, |
|
| 29 | - 'page' |
|
| 30 | - ) ); |
|
| 26 | + // Add a callback to our 'page' function. |
|
| 27 | + add_submenu_page( 'wl_admin_menu', _x( 'Download Your Data', 'Page title', 'wordlift' ), _x( 'Download Your Data', 'Menu title', 'wordlift' ), 'manage_options', 'wl_download_your_data', array( |
|
| 28 | + $this, |
|
| 29 | + 'page' |
|
| 30 | + ) ); |
|
| 31 | 31 | |
| 32 | - } |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * The admin menu callback to render the page. |
|
| 36 | - * |
|
| 37 | - * @since 3.6.0 |
|
| 38 | - */ |
|
| 39 | - public function page() { |
|
| 34 | + /** |
|
| 35 | + * The admin menu callback to render the page. |
|
| 36 | + * |
|
| 37 | + * @since 3.6.0 |
|
| 38 | + */ |
|
| 39 | + public function page() { |
|
| 40 | 40 | |
| 41 | - // Include the partial. |
|
| 42 | - include( 'partials/wordlift-admin-download-your-data.php' ); |
|
| 41 | + // Include the partial. |
|
| 42 | + include( 'partials/wordlift-admin-download-your-data.php' ); |
|
| 43 | 43 | |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Ajax call to redirect to a download URL. |
|
| 48 | - * |
|
| 49 | - * @since 3.6.0 |
|
| 50 | - */ |
|
| 51 | - public function download_your_data() { |
|
| 46 | + /** |
|
| 47 | + * Ajax call to redirect to a download URL. |
|
| 48 | + * |
|
| 49 | + * @since 3.6.0 |
|
| 50 | + */ |
|
| 51 | + public function download_your_data() { |
|
| 52 | 52 | |
| 53 | - ob_end_clean(); |
|
| 53 | + ob_end_clean(); |
|
| 54 | 54 | |
| 55 | - // Get WL's key. |
|
| 56 | - $key = wl_configuration_get_key(); |
|
| 55 | + // Get WL's key. |
|
| 56 | + $key = wl_configuration_get_key(); |
|
| 57 | 57 | |
| 58 | - // Get the suffix or use json by default. |
|
| 59 | - $suffix = $_GET['out'] ?: 'json'; |
|
| 58 | + // Get the suffix or use json by default. |
|
| 59 | + $suffix = $_GET['out'] ?: 'json'; |
|
| 60 | 60 | |
| 61 | - // Redirect. |
|
| 62 | - wp_redirect( WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/dataset.$suffix" ); |
|
| 61 | + // Redirect. |
|
| 62 | + wp_redirect( WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/dataset.$suffix" ); |
|
| 63 | 63 | |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | } |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | public function admin_menu() { |
| 25 | 25 | |
| 26 | 26 | // Add a callback to our 'page' function. |
| 27 | - add_submenu_page( 'wl_admin_menu', _x( 'Download Your Data', 'Page title', 'wordlift' ), _x( 'Download Your Data', 'Menu title', 'wordlift' ), 'manage_options', 'wl_download_your_data', array( |
|
| 27 | + add_submenu_page('wl_admin_menu', _x('Download Your Data', 'Page title', 'wordlift'), _x('Download Your Data', 'Menu title', 'wordlift'), 'manage_options', 'wl_download_your_data', array( |
|
| 28 | 28 | $this, |
| 29 | 29 | 'page' |
| 30 | - ) ); |
|
| 30 | + )); |
|
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | public function page() { |
| 40 | 40 | |
| 41 | 41 | // Include the partial. |
| 42 | - include( 'partials/wordlift-admin-download-your-data.php' ); |
|
| 42 | + include('partials/wordlift-admin-download-your-data.php'); |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $suffix = $_GET['out'] ?: 'json'; |
| 60 | 60 | |
| 61 | 61 | // Redirect. |
| 62 | - wp_redirect( WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "datasets/key=$key/dataset.$suffix" ); |
|
| 62 | + wp_redirect(WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."datasets/key=$key/dataset.$suffix"); |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -14,15 +14,15 @@ |
||
| 14 | 14 | <!-- This file should primarily consist of HTML with a little bit of PHP. --> |
| 15 | 15 | |
| 16 | 16 | <div class="wrap"> |
| 17 | - <h2><?php _ex( 'Download Your Data', 'Page title', 'wordlift' ); ?></h2> |
|
| 18 | - <p><?php _e( 'Choose the format to download your data:', 'wordlift' ); ?></p> |
|
| 17 | + <h2><?php _ex('Download Your Data', 'Page title', 'wordlift'); ?></h2> |
|
| 18 | + <p><?php _e('Choose the format to download your data:', 'wordlift'); ?></p> |
|
| 19 | 19 | |
| 20 | - <a href="<?php echo admin_url( 'admin-ajax.php?action=wl_download_your_data&out=json' ); ?>" |
|
| 21 | - class="button wl-add-input wl-button"><?php _e( 'JSON-LD', 'wordlift' ); ?></a> |
|
| 22 | - <a href="<?php echo admin_url( 'admin-ajax.php?action=wl_download_your_data&out=rdf' ); ?>" |
|
| 23 | - class="button wl-add-input wl-button"><?php _e( 'RDF/XML', 'wordlift' ); ?></a> |
|
| 24 | - <a href="<?php echo admin_url( 'admin-ajax.php?action=wl_download_your_data&out=ttl' ); ?>" |
|
| 25 | - class="button wl-add-input wl-button"><?php _ex( 'Turtle', 'File format, not the animal', 'wordlift' ); ?></a> |
|
| 26 | - <a href="<?php echo admin_url( 'admin-ajax.php?action=wl_download_your_data&out=n3' ); ?>" |
|
| 27 | - class="button wl-add-input wl-button"><?php _e( 'N3', 'wordlift' ); ?></a> |
|
| 20 | + <a href="<?php echo admin_url('admin-ajax.php?action=wl_download_your_data&out=json'); ?>" |
|
| 21 | + class="button wl-add-input wl-button"><?php _e('JSON-LD', 'wordlift'); ?></a> |
|
| 22 | + <a href="<?php echo admin_url('admin-ajax.php?action=wl_download_your_data&out=rdf'); ?>" |
|
| 23 | + class="button wl-add-input wl-button"><?php _e('RDF/XML', 'wordlift'); ?></a> |
|
| 24 | + <a href="<?php echo admin_url('admin-ajax.php?action=wl_download_your_data&out=ttl'); ?>" |
|
| 25 | + class="button wl-add-input wl-button"><?php _ex('Turtle', 'File format, not the animal', 'wordlift'); ?></a> |
|
| 26 | + <a href="<?php echo admin_url('admin-ajax.php?action=wl_download_your_data&out=n3'); ?>" |
|
| 27 | + class="button wl-add-input wl-button"><?php _e('N3', 'wordlift'); ?></a> |
|
| 28 | 28 | </div> |
| 29 | 29 | \ No newline at end of file |