| @@ -1,31 +1,52 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * @package Polylang | |
| 4 | + */ | |
| 2 | 5 | |
| 3 | 6 | /** |
| 4 | - * REST API controller | |
| 5 | - * accessible as $polylang global object | |
| 7 | + * Main Polylang class for REST API requrests, accessible from @see PLL(). | |
| 6 | 8 | * |
| 7 | - * Properties: | |
| 8 | - * options => inherited, reference to Polylang options array | |
| 9 | - * model => inherited, reference to PLL_Model object | |
| 10 | - * links_model => inherited, reference to PLL_Links_Model object | |
| 11 | - * links => reference to PLL_Admin_Links object | |
| 12 | - * static_pages => reference to PLL_Static_Pages object | |
| 13 | - * filters => reference to PLL_Frontend_Filters object | |
| 14 | - * filters_links => reference to PLL_Filters_Links object | |
| 15 | - * posts => reference to PLL_CRUD_Posts object | |
| 16 | - * terms => reference to PLL_CRUD_Terms object | |
| 17 | - * sync => reference to PLL_Sync object | |
| 18 | - * | |
| 19 | 9 | * @since 2.6 |
| 20 | 10 | */ |
| 21 | 11 | class PLL_REST_Request extends PLL_Base { |
| 22 | - public $links, $static_pages, $posts, $terms, $filters, $filters_links, $sync; | |
| 23 | 12 | |
| 24 | 13 | /** |
| 25 | - * Setup filters | |
| 14 | + * @var PLL_Filters | |
| 15 | + */ | |
| 16 | + public $filters; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * @var PLL_Filters_Links | |
| 20 | + */ | |
| 21 | + public $filters_links; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * @var PLL_Admin_Links | |
| 25 | + */ | |
| 26 | + public $links; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * @var PLL_Nav_Menu | |
| 30 | + */ | |
| 31 | + public $nav_menu; | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * @var PLL_Static_Pages | |
| 35 | + */ | |
| 36 | + public $static_pages; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * @var PLL_Filters_Widgets_Options | |
| 40 | + */ | |
| 41 | + public $filters_widgets_options; | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * Setup filters. | |
| 26 | 45 | * |
| 27 | 46 | * @since 2.6 |
| 47 | + * | |
| 48 | + * @return void | |
| 28 | 49 | */ |
| 29 | 50 | public function init() { |
| 30 | 51 | parent::init(); |
| 31 | 52 | |
| @@ -35,43 +56,17 @@ | ||
| 35 | 56 | do_action( 'pll_no_language_defined' ); // To load overridden textdomains. |
| 36 | 57 | |
| 37 | 58 | $this->filters_links = new PLL_Filters_Links( $this ); |
| 38 | 59 | $this->filters = new PLL_Filters( $this ); |
| 60 | + $this->filters_widgets_options = new PLL_Filters_Widgets_Options( $this ); | |
| 39 | 61 | |
| 40 | - // Static front page and page for posts | |
| 62 | + // Static front page and page for posts. | |
| 41 | 63 | if ( 'page' === get_option( 'show_on_front' ) ) { |
| 42 | 64 | $this->static_pages = new PLL_Static_Pages( $this ); |
| 43 | 65 | } |
| 44 | 66 | |
| 45 | 67 | $this->links = new PLL_Admin_Links( $this ); |
| 46 | - $this->posts = new PLL_CRUD_Posts( $this ); | |
| 47 | - $this->terms = new PLL_CRUD_Terms( $this ); | |
| 48 | - $this->sync = new PLL_Sync( $this ); | |
| 49 | 68 | |
| 50 | - $this->nav_menu = new PLL_Nav_Menu( $this ); // For auto added pages to menu | |
| 51 | - | |
| 52 | - // Share term slugs | |
| 53 | - if ( get_option( 'permalink_structure' ) && $this->options['force_lang'] && class_exists( 'PLL_Share_Term_Slug' ) ) { | |
| 54 | - $this->share_term_slug = new PLL_Share_Term_Slug( $this ); | |
| 55 | - } | |
| 56 | - | |
| 57 | - // Translate slugs, only for pretty permalinks | |
| 58 | - if ( get_option( 'permalink_structure' ) && class_exists( 'PLL_Translate_Slugs' ) ) { | |
| 59 | - $curlang = null; | |
| 60 | - $slugs_model = new PLL_Translate_Slugs_Model( $this ); | |
| 61 | - $this->translate_slugs = new PLL_Translate_Slugs( $slugs_model, $curlang ); | |
| 62 | - } | |
| 63 | - | |
| 64 | - if ( class_exists( 'PLL_Sync_Post_Model' ) ) { | |
| 65 | - $this->sync_post_model = new PLL_Sync_Post_Model( $this ); | |
| 66 | - } | |
| 67 | - | |
| 68 | - if ( class_exists( 'PLL_Sync_Post_REST' ) ) { | |
| 69 | - $this->sync_post = new PLL_Sync_Post_REST( $this ); | |
| 70 | - } | |
| 71 | - | |
| 72 | - if ( class_exists( 'PLL_Duplicate_REST' ) ) { | |
| 73 | - $this->duplicate_rest = new PLL_Duplicate_REST(); | |
| 74 | - } | |
| 69 | + $this->nav_menu = new PLL_Nav_Menu( $this ); // For auto added pages to menu. | |
| 75 | 70 | } |
| 76 | 71 | } |
| 77 | 72 | } |