/**
  * Updates a single module according to the data in the request.
  *
  * @param string $id Module ID.
  *
  * @return void
  */
 private function update_module($id)
 {
     if (empty($_POST['multilingualpress_modules'][$id])) {
         $this->module_manager->deactivate_module($id);
     } else {
         $this->module_manager->activate_module($id);
     }
 }
 /**
  * Registers the module at the module manager.
  *
  * @since 3.0.0
  *
  * @param ModuleManager $module_manager Module manager object.
  *
  * @return bool Whether or not the module was registerd successfully AND has been activated.
  */
 public function register_module(ModuleManager $module_manager)
 {
     global $wp_version;
     if (version_compare($wp_version, '4.7.0', '>=')) {
         return false;
     }
     return $module_manager->register_module(new Module('user_admin_language', ['description' => __('Let each user choose a preferred language for the back end of all connected sites. This does not affect the front end.', 'multilingual-press'), 'name' => __('User Admin Language', 'multilingual-press'), 'active' => false]));
 }
Esempio n. 3
0
    /**
     * Renders the markup.
     *
     * @since 3.0.0
     *
     * @return void
     */
    public function render()
    {
        $this->asset_manager->enqueue_style('multilingualpress-admin');
        $action = PluginSettingsUpdater::ACTION;
        ?>
		<div class="wrap">
			<h1><?php 
        echo esc_html(get_admin_page_title());
        ?>
</h1>
			<form method="post" action="<?php 
        echo admin_url("admin-post.php?action={$action}");
        ?>
"
				id="multilingualpress-modules">
				<?php 
        echo \Inpsyde\MultilingualPress\nonce_field($this->nonce);
        ?>
				<table class="mlp-module-list">
					<?php 
        foreach ($this->module_manager->get_modules() as $id => $module) {
            /**
             * Filters if the module should be listed on the settings page.
             *
             * @since 3.0.0
             *
             * @param bool $show_module Whether or not the module should be listed on the settings page.
             */
            if (apply_filters("multilingualpress.show_module_{$id}", true)) {
                $this->render_module($module);
            }
        }
        /**
         * Fires at the end of but still inside the module list on the settings page.
         *
         * @since 3.0.0
         */
        do_action('multilingualpress.in_module_list');
        ?>
				</table>
				<?php 
        /**
         * Fires right after after the module list on the settings page.
         *
         * @since 3.0.0
         */
        do_action('multilingualpress.after_module_list');
        submit_button(__('Save Changes', 'multilingual-press'));
        ?>
			</form>
		</div>
		<?php 
    }
 /**
  * Registers the module at the module manager.
  *
  * @since 3.0.0
  *
  * @param ModuleManager $module_manager Module manager object.
  *
  * @return bool Whether or not the module was registerd successfully AND has been activated.
  */
 public function register_module(ModuleManager $module_manager)
 {
     return $module_manager->register_module(new Module('trasher', ['description' => __('This module provides a new post meta and checkbox to trash the posts. If you enable the checkbox and move a post to the trash MultilingualPress also will trash the linked posts.', 'multilingual-press'), 'name' => __('Trasher', 'multilingual-press'), 'active' => false]));
 }
 /**
  * Registers the module.
  *
  * @return bool
  */
 private function register_setting()
 {
     return $this->module_manager->register_module(new Module('quicklinks', ['description' => __('Show link to translations in post content.', 'multilingual-press'), 'name' => __('Quicklinks', 'multilingual-press'), 'active' => false]));
 }
 /**
  * Register the feature.
  *
  * @return bool Feature is active or not.
  */
 public function setup()
 {
     return $this->module_manager->register_module(new Module('redirect', ['description' => __('Redirect visitors according to browser language settings.', 'multilingual-press'), 'name' => __('HTTP Redirect', 'multilingual-press'), 'active' => false]));
 }
 /**
  * Registers the module at the module manager.
  *
  * @since 3.0.0
  *
  * @param ModuleManager $module_manager Module manager object.
  *
  * @return bool Whether or not the module was registerd successfully AND has been activated.
  */
 public function register_module(ModuleManager $module_manager)
 {
     return $module_manager->register_module(new Module('custom_post_type_support', ['description' => __('Enable translation of custom post types. Creates a second settings box below this. The post types must be activated for the whole network or on the main site.', 'multilingual-press'), 'name' => __('Custom Post Type Support', 'multilingual-press'), 'active' => false]));
 }
 /**
  * Registers the module at the module manager.
  *
  * @since 3.0.0
  *
  * @param ModuleManager $module_manager Module manager object.
  *
  * @return bool Whether or not the module was registerd successfully AND has been activated.
  */
 public function register_module(ModuleManager $module_manager)
 {
     return $module_manager->register_module(new Module('alternative_language_title', ['description' => __('Show sites with their alternative language title in the admin bar.', 'multilingual-press'), 'name' => __('Alternative Language Title', 'multilingual-press'), 'active' => false]));
 }