| @@ -1,42 +1,35 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | - * Admin side controller | |
| 4 | + * admin side controller | |
| 8 | 5 | * accessible in $polylang global object |
| 9 | 6 | * |
| 10 | - * Properties: | |
| 11 | - * options => inherited, reference to Polylang options array | |
| 12 | - * model => inherited, reference to PLL_Model object | |
| 13 | - * links_model => inherited, reference to PLL_Links_Model object | |
| 14 | - * links => inherited, reference to PLL_Admin_Links object | |
| 15 | - * static_pages => inherited, reference to PLL_Admin_Static_Pages object | |
| 16 | - * filters_links => inherited, reference to PLL_Filters_Links object | |
| 17 | - * curlang => inherited, optional, current language used to filter the content (language of the post or term being edited, equal to filter_lang otherwise) | |
| 18 | - * filter_lang => inherited, optional, current status of the admin languages filter (in the admin bar) | |
| 19 | - * pref_lang => inherited, preferred language used as default when saving posts or terms | |
| 20 | - * posts => reference to PLL_CRUD_Posts object | |
| 21 | - * terms => reference to PLL_CRUD_Terms object | |
| 22 | - * filters => reference to PLL_Admin_Filters object | |
| 23 | - * filters_columns => reference to PLL_Admin_Filters_Columns object | |
| 24 | - * filters_post => reference to PLL_Admin_Filters_Post object | |
| 25 | - * filters_term => reference to PLL_Admin_filters_Term object | |
| 26 | - * nav_menu => reference to PLL_Admin_Nav_Menu object | |
| 27 | - * block_editor => reference to PLL_Admin_Block_Editor object | |
| 28 | - * classic_editor => reference to PLL_Admin_Classic_Editor object | |
| 29 | - * filters_media => optional, reference to PLL_Admin_Filters_Media object | |
| 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 => inherited, reference to PLL_Admin_Links object | |
| 12 | + * static_pages => inherited, reference to PLL_Admin_Static_Pages object | |
| 13 | + * filters_links => inherited, reference to PLL_Filters_Links object | |
| 14 | + * curlang => inherited, optional, current language used to filter the content (language of the post or term being edited, equal to filter_lang otherwise) | |
| 15 | + * filter_lang => inherited, optional, current status of the admin languages filter (in the admin bar) | |
| 16 | + * pref_lang => inherited, preferred language used as default when saving posts or terms | |
| 17 | + * filters => reference to PLL_Filters object | |
| 18 | + * filters_columns => reference to PLL_Admin_Filters_Columns object | |
| 19 | + * filters_post => reference to PLL_Admin_Filters_Post object | |
| 20 | + * filters_term => reference to PLL_Admin_filters_Term object | |
| 21 | + * nav_menu => reference to PLL_Admin_Nav_Menu object | |
| 22 | + * filters_media => optional, reference to PLL_Admin_Filters_Media object | |
| 30 | 23 | * |
| 31 | 24 | * @since 1.2 |
| 32 | 25 | */ |
| 33 | 26 | class PLL_Admin extends PLL_Admin_Base { |
| 34 | - public $filters, $filters_columns, $filters_post, $filters_term, $nav_menu, $filters_media; | |
| 27 | + public $filters, $filters_columns, $filters_post, $filters_term, $nav_menu, $sync, $filters_media; | |
| 35 | 28 | |
| 36 | 29 | /** |
| 37 | - * Loads the polylang text domain | |
| 38 | - * Setups filters and action needed on all admin pages and on plugins page | |
| 30 | + * loads the polylang text domain | |
| 31 | + * setups filters and action needed on all admin pages and on plugins page | |
| 39 | 32 | * |
| 40 | 33 | * @since 1.2 |
| 41 | 34 | * |
| 42 | 35 | * @param object $links_model |
| @@ -43,16 +36,16 @@ | ||
| 43 | 36 | */ |
| 44 | 37 | public function __construct( &$links_model ) { |
| 45 | 38 | parent::__construct( $links_model ); |
| 46 | 39 | |
| 47 | - // Adds a 'settings' link in the plugins table | |
| 40 | + // adds a 'settings' link in the plugins table | |
| 48 | 41 | add_filter( 'plugin_action_links_' . POLYLANG_BASENAME, array( $this, 'plugin_action_links' ) ); |
| 49 | 42 | add_action( 'in_plugin_update_message-' . POLYLANG_BASENAME, array( $this, 'plugin_update_message' ), 10, 2 ); |
| 50 | 43 | } |
| 51 | 44 | |
| 52 | 45 | /** |
| 53 | - * Setups filters and action needed on all admin pages and on plugins page | |
| 54 | - * Loads the settings pages or the filters base on the request | |
| 46 | + * setups filters and action needed on all admin pages and on plugins page | |
| 47 | + * loads the settings pages or the filters base on the request | |
| 55 | 48 | * |
| 56 | 49 | * @since 1.2 |
| 57 | 50 | */ |
| 58 | 51 | public function init() { |
| @@ -57,10 +50,10 @@ | ||
| 57 | 50 | */ |
| 58 | 51 | public function init() { |
| 59 | 52 | parent::init(); |
| 60 | 53 | |
| 61 | - // Setup filters for admin pages | |
| 62 | - // Priority 5 to make sure filters are there before customize_register is fired | |
| 54 | + // setup filters for admin pages | |
| 55 | + // priority 5 to make sure filters are there before customize_register is fired | |
| 63 | 56 | if ( $this->model->get_languages_list() ) { |
| 64 | 57 | add_action( 'wp_loaded', array( $this, 'add_filters' ), 5 ); |
| 65 | 58 | } |
| 66 | 59 | } |
| @@ -65,9 +58,9 @@ | ||
| 65 | 58 | } |
| 66 | 59 | } |
| 67 | 60 | |
| 68 | 61 | /** |
| 69 | - * Adds a 'settings' link in the plugins table | |
| 62 | + * adds a 'settings' link in the plugins table | |
| 70 | 63 | * |
| 71 | 64 | * @since 0.1 |
| 72 | 65 | * |
| 73 | 66 | * @param array $links list of links associated to the plugin |
| @@ -78,9 +71,9 @@ | ||
| 78 | 71 | return $links; |
| 79 | 72 | } |
| 80 | 73 | |
| 81 | 74 | /** |
| 82 | - * Adds the upgrade notice in plugins table | |
| 75 | + * adds the upgrade notice in plugins table | |
| 83 | 76 | * |
| 84 | 77 | * @since 1.1.6 |
| 85 | 78 | * |
| 86 | 79 | * @param array $plugin_data Not used |
| @@ -85,9 +78,9 @@ | ||
| 85 | 78 | * |
| 86 | 79 | * @param array $plugin_data Not used |
| 87 | 80 | * @param object $r Plugin update data |
| 88 | 81 | */ |
| 89 | - public function plugin_update_message( $plugin_data, $r ) { | |
| 82 | + function plugin_update_message( $plugin_data, $r ) { | |
| 90 | 83 | if ( isset( $r->upgrade_notice ) ) { |
| 91 | 84 | printf( '<p style="margin: 3px 0 0 0; border-top: 1px solid #ddd; padding-top: 3px">%s</p>', esc_html( $r->upgrade_notice ) ); |
| 92 | 85 | } |
| 93 | 86 | } |
| @@ -92,18 +85,17 @@ | ||
| 92 | 85 | } |
| 93 | 86 | } |
| 94 | 87 | |
| 95 | 88 | /** |
| 96 | - * Setup filters for admin pages | |
| 89 | + * setup filters for admin pages | |
| 97 | 90 | * |
| 98 | 91 | * @since 1.2 |
| 99 | - * @since 2.7 instantiate a PLL_Bulk_Translate instance. | |
| 100 | 92 | */ |
| 101 | 93 | public function add_filters() { |
| 102 | - // All these are separated just for convenience and maintainability | |
| 103 | - $classes = array( 'Filters', 'Filters_Columns', 'Filters_Post', 'Filters_Term', 'Nav_Menu', 'Classic_Editor', 'Block_Editor' ); | |
| 94 | + // all these are separated just for convenience and maintainability | |
| 95 | + $classes = array( 'Filters', 'Filters_Columns', 'Filters_Post', 'Filters_Term', 'Nav_Menu', 'Sync' ); | |
| 104 | 96 | |
| 105 | - // Don't load media filters if option is disabled or if user has no right | |
| 97 | + // don't load media filters if option is disabled or if user has no right | |
| 106 | 98 | if ( $this->options['media_support'] && ( $obj = get_post_type_object( 'attachment' ) ) && ( current_user_can( $obj->cap->edit_posts ) || current_user_can( $obj->cap->create_posts ) ) ) { |
| 107 | 99 | $classes[] = 'Filters_Media'; |
| 108 | 100 | } |
| 109 | 101 | |
| @@ -110,9 +102,9 @@ | ||
| 110 | 102 | foreach ( $classes as $class ) { |
| 111 | 103 | $obj = strtolower( $class ); |
| 112 | 104 | |
| 113 | 105 | /** |
| 114 | - * Filter the class to instantiate when loading admin filters | |
| 106 | + * Filter the class to instantiate when loding admin filters | |
| 115 | 107 | * |
| 116 | 108 | * @since 1.5 |
| 117 | 109 | * |
| 118 | 110 | * @param string $class class name |