PluginProbe
Polylang / 2.9
Polylang v2.9
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | include/base.php +46 -20 2.72.9 View file →
@@ -1,5 +1,8 @@
1 1 <?php
2 +/**
3 + * @package Polylang
4 + */
2 5
3 6 /**
4 7 * Base class for both admin and frontend
5 8 *
@@ -5,11 +8,44 @@
5 8 *
6 9 * @since 1.2
7 10 */
8 11 abstract class PLL_Base {
9 - public $links_model, $model, $options;
12 + /**
13 + * Stores the plugin options.
14 + *
15 + * @var array
16 + */
17 + public $options;
10 18
11 19 /**
20 + * Instance of PLL_Model.
21 + *
22 + * @var PLL_Model
23 + */
24 + public $model;
25 +
26 + /**
27 + * Instance of a child class of PLL_Links_Model.
28 + *
29 + * @var PLL_Links_Model
30 + */
31 + public $links_model;
32 +
33 + /**
34 + * Registers hooks on insert / update post related actions and filters.
35 + *
36 + * @var PLL_CRUD_Posts
37 + */
38 + public $posts;
39 +
40 + /**
41 + * Registers hooks on insert / update term related action and filters.
42 + *
43 + * @var PLL_CRUD_Terms
44 + */
45 + public $terms;
46 +
47 + /**
12 48 * Constructor
13 49 *
14 50 * @since 1.2
15 51 *
@@ -32,33 +68,23 @@
32 68 add_action( 'switch_blog', array( $this, 'switch_blog' ), 10, 2 );
33 69 }
34 70
35 71 /**
36 - * Instantiate classes always needed
72 + * Instantiates classes reacting to CRUD operations on posts and terms,
73 + * only when at least one language is defined.
37 74 *
38 75 * @since 2.6
39 76 */
40 77 public function init() {
41 - // REST API
42 - if ( class_exists( 'PLL_REST_API' ) ) {
43 - $this->rest_api = new PLL_REST_API( $this );
44 - }
45 -
46 78 if ( $this->model->get_languages_list() ) {
47 - // Used by content duplicate and post synchronization
48 - if ( class_exists( 'PLL_Sync_Content' ) ) {
49 - $this->sync_content = new PLL_Sync_Content( $this );
50 - }
79 + $this->posts = new PLL_CRUD_Posts( $this );
80 + $this->terms = new PLL_CRUD_Terms( $this );
51 81
52 - // Active languages
53 - if ( class_exists( 'PLL_Active_Languages' ) ) {
54 - $this->active_languages = new PLL_Active_Languages( $this );
55 - }
56 -
57 - // Share post slugs
58 - if ( get_option( 'permalink_structure' ) && $this->options['force_lang'] && class_exists( 'PLL_Share_Post_Slug' ) ) {
59 - $this->share_post_slug = new PLL_Share_Post_Slug( $this );
60 - }
82 + // WordPress options.
83 + new PLL_Translate_Option( 'blogname', array(), array( 'context' => 'WorPress' ) );
84 + new PLL_Translate_Option( 'blogdescription', array(), array( 'context' => 'WorPress' ) );
85 + new PLL_Translate_Option( 'date_format', array(), array( 'context' => 'WorPress' ) );
86 + new PLL_Translate_Option( 'time_format', array(), array( 'context' => 'WorPress' ) );
61 87 }
62 88 }
63 89
64 90 /**