/** * @global string $status * @global int $page * @global string $s * @global array $totals * @param WP_Theme $theme */ public function single_row($theme) { $status = 'all'; $stylesheet = $theme->get_stylesheet(); remove_action("after_theme_row_{$stylesheet}", 'wp_theme_update_row', 10, 2); $theme_key = urlencode($stylesheet); /** * Filter the action links that show up under each theme row. * * @since 5.0.0 * * @param array Array of action links * @param WP_Theme $theme WP_Theme object * @param string $status Status of the theme. */ $actions = apply_filters('mpsum_theme_action_links', array(), $theme, 'all'); $checkbox_id = "checkbox_" . md5($theme->get('Name')); $checkbox = "<input type='checkbox' name='checked[]' value='" . esc_attr($stylesheet) . "' id='" . $checkbox_id . "' /><label class='screen-reader-text' for='" . $checkbox_id . "' >" . __('Select', 'stops-core-theme-and-plugin-updates') . " " . $theme->display('Name') . "</label>"; $id = sanitize_html_class($theme->get_stylesheet()); $class = 'active'; $theme_options = MPSUM_Updates_Manager::get_options('themes'); if (false !== ($key = array_search($stylesheet, $theme_options))) { $class = 'inactive'; } echo "<tr id='{$id}' class='{$class}'>"; list($columns, $hidden) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } switch ($column_name) { case 'cb': echo "<th scope='row' class='check-column'>{$checkbox}</th>"; break; case 'name': echo "<td class='theme-title'{$style}><strong>" . $theme->display('Name') . "</strong>"; echo $this->row_actions($actions, true); echo "</td>"; break; case 'description': echo "<td class='column-description desc'{$style}>"; if ($theme->errors()) { $pre = $status == 'broken' ? __('Broken Theme:', 'stops-core-theme-and-plugin-updates') . ' ' : ''; echo '<p><strong class="attention">' . $pre . $theme->errors()->get_error_message() . '</strong></p>'; } echo "<div class='theme-description'><p>" . $theme->display('Description') . "</p></div>\n\t\t\t\t\t\t<div class='second theme-version-author-uri'>"; $theme_meta = array(); if ($theme->get('Version')) { $theme_meta[] = sprintf(__('Version %s', 'stops-core-theme-and-plugin-updates'), $theme->display('Version')); } $theme_meta[] = sprintf(__('By %s', 'stops-core-theme-and-plugin-updates'), $theme->display('Author')); if ($theme->get('ThemeURI')) { $theme_meta[] = '<a href="' . $theme->display('ThemeURI') . '" title="' . esc_attr__('Visit theme homepage', 'stops-core-theme-and-plugin-updates') . '">' . __('Visit Theme Site', 'stops-core-theme-and-plugin-updates') . '</a>'; } /** * Filter the array of row meta for each theme in the Multisite themes * list table. * * @since 3.1.0 * * @param array $theme_meta An array of the theme's metadata, * including the version, author, and * theme URI. * @param string $stylesheet Directory name of the theme. * @param WP_Theme $theme WP_Theme object. * @param string $status Status of the theme. */ $theme_meta = apply_filters('theme_row_meta', $theme_meta, $stylesheet, $theme, $status); echo implode(' | ', $theme_meta); echo "</div></td>"; break; default: echo "<td class='{$column_name} column-{$column_name}'{$style}>"; /** * Fires inside each custom column of the Multisite themes list table. * * @since 3.1.0 * * @param string $column_name Name of the column. * @param string $stylesheet Directory name of the theme. * @param WP_Theme $theme Current WP_Theme object. */ do_action('manage_themes_custom_column', $column_name, $stylesheet, $theme); echo "</td>"; } } echo "</tr>"; if ($this->is_site_themes) { remove_action("after_theme_row_{$stylesheet}", 'wp_theme_update_row'); } /** * Fires after each row in the Multisite themes list table. * * @since 3.1.0 * * @param string $stylesheet Directory name of the theme. * @param WP_Theme $theme Current WP_Theme object. * @param string $status Status of the theme. */ do_action('after_theme_row', $stylesheet, $theme, $status); /** * Fires after each specific row in the Multisite themes list table. * * The dynamic portion of the hook name, `$stylesheet`, refers to the * directory name of the theme, most often synonymous with the template * name of the theme. * * @since 3.5.0 * * @param string $stylesheet Directory name of the theme. * @param WP_Theme $theme Current WP_Theme object. * @param string $status Status of the theme. */ do_action("after_theme_row_{$stylesheet}", $stylesheet, $theme, $status); }
/** * Disables theme and plugin http requests on an individual basis. * * Disables theme and plugin http requests on an individual basis. * * @since 5.0.0 * @access public * @see __construct * @internal uses http_request_args filter * * @param array $r Request array * @param string $url URL requested * @return array Updated Request array */ public function http_request_args_remove_plugins_themes($r, $url) { if (0 !== strpos($url, 'https://api.wordpress.org/plugins/update-check/1.1/')) { return $r; } if (isset($r['body']['plugins'])) { $r_plugins = json_decode($r['body']['plugins'], true); $plugin_options = MPSUM_Updates_Manager::get_options('plugins'); foreach ($plugin_options as $plugin) { unset($r_plugins[$plugin]); if (false !== ($key = array_search($plugin, $r_plugins['active']))) { unset($r_plugins['active'][$key]); $r_plugins['active'] = array_values($r_plugins['active']); } } $r['body']['plugins'] = json_encode($r_plugins); } if (isset($r['body']['themes'])) { $r_themes = json_decode($r['body']['themes'], true); $theme_options = MPSUM_Updates_Manager::get_options('themes'); foreach ($theme_options as $theme) { unset($r_themes[$theme]); } $r['body']['themes'] = json_encode($r_themes); } return $r; }
/** * Output the HTML interface for the main tab. * * Output the HTML interface for the main tab. * * @since 5.0.0 * @access public * @see __construct * @internal Uses the mpsum_admin_tab_main action */ public function tab_output() { $options = MPSUM_Updates_Manager::get_options('core'); $options = wp_parse_args($options, MPSUM_Admin_Core::get_defaults()); ?> <form id="dashboard-form" method="post"> <?php wp_nonce_field('mpsum_options_save', '_mpsum'); ?> <div id="dashboard-main-outputs"> <div id="dashboard-main-columns"> <div class="dashboard-main-wrapper"> <div class="dashboard-main-header"><?php esc_html_e('WordPress Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-main-header --> <div class="dashboard-item-wrapper"> <div class="dashboard-item <?php if ('on' == $options['all_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('All Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $disable_core_options = false; if ('off' == $options['all_updates']) { $disable_core_options = true; $options['core_updates'] = 'off'; $options['plugin_updates'] = 'off'; $options['theme_updates'] = 'off'; $options['translation_updates'] = 'off'; } ?> <input type="checkbox" name="options[all_updates]" value="off" /> <input type="checkbox" data-context="core" data-action="all_updates" class="dashboard-hide" name="options[all_updates]" value="on" id="all_updates_on" <?php checked('on', $options['all_updates']); ?> /> <label for="all_updates_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['core_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('WordPress Core Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $checked_value = 'checked'; if (checked('off', $options['core_updates'], false)) { $checked_value = ''; } ?> <input id="core-updates-check_before" type="hidden" value="<?php echo esc_attr($checked_value); ?> " /> <input type="hidden" name="options[core_updates]" value="on" /> <input id="core_updates_off" data-context="core" data-action="core_updates" type="checkbox" class="dashboard-hide update-option" name="options[core_updates]" value="off" <?php checked('on', $options['core_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="core_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['plugin_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('All Plugin Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $checked_value = 'checked'; if (checked('off', $options['plugin_updates'], false)) { $checked_value = ''; } ?> <input id="core-plugin-check_before" type="hidden" value="<?php echo esc_attr($checked_value); ?> " /> <input type="hidden" name="options[plugin_updates]" value="on" /> <input type="checkbox" data-context="core" data-action="plugin_updates" class="dashboard-hide update-option" name="options[plugin_updates]" value="off" id="plugin_updates_off" <?php checked('on', $options['plugin_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="plugin_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['theme_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('All Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $checked_value = 'checked'; if (checked('off', $options['theme_updates'], false)) { $checked_value = ''; } ?> <input id="core-theme-check_before" type="hidden" value="<?php echo esc_attr($checked_value); ?> " /> <input type="hidden" name="options[theme_updates]" value="on" /> <input type="checkbox" data-context="core" data-action="theme_updates"class="dashboard-hide update-option" name="options[theme_updates]" value="off" id="theme_updates_off" <?php checked('on', $options['theme_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="theme_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['translation_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('All Translation Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $checked_value = 'checked'; if (checked('off', $options['translation_updates'], false)) { $checked_value = ''; } ?> <input id="core-translation-check_before" type="hidden" value="<?php echo esc_attr($checked_value); ?> " /> <input type="hidden" name="options[translation_updates]" value="on" /> <input id="translation_updates_off" data-context="core" data-action="translation_updates" type="checkbox" class="dashboard-hide update-option" name="options[translation_updates]" value="off" <?php checked('on', $options['translation_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="translation_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> </div><!-- .dashboard-item-wrapper --> </div><!--- .dashboard-main-wrapper --> <div class="dashboard-main-wrapper"> <div class="dashboard-main-header"><?php esc_html_e('Automatic Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-main-header --> <div class="dashboard-item-wrapper"> <div class="dashboard-item <?php if ('on' == $options['automatic_major_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Major Releases', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="checkbox" name="options[automatic_major_updates]" value="off" /> <input type="checkbox" data-context="core" data-action="automatic_major_updates" class="dashboard-hide" name="options[all_updates]" value="on" id="automatic_major_on" <?php checked('on', $options['automatic_major_updates']); ?> /> <label for="automatic_major_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['automatic_minor_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Minor Releases', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input id="core-updates-check_before" type="hidden" value="<?php echo esc_attr($checked_value); ?> " /> <input type="hidden" name="options[automatic_minor_updates]" value="on" /> <input id="automatic_minor_on" data-context="core" data-action="automatic_minor_updates" type="checkbox" class="dashboard-hide update-option" name="options[core_updates]" value="off" <?php checked('on', $options['automatic_minor_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="automatic_minor_on"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['automatic_development_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Development Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="hidden" name="options[automatic_development_updates]" value="on" /> <input id="automatic_dev_on" type="checkbox" data-context="core" data-action="automatic_development_updates" class="dashboard-hide update-option" name="options[automatic_development_updates]" value="off" id="plugin_updates_off" <?php checked('on', $options['automatic_development_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="automatic_dev_on"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('on' == $options['automatic_translation_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Translation Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input id="core-theme-check_before" type="hidden" value="<?php echo esc_attr($checked_value); ?> " /> <input type="hidden" name="options[automatic_translation_updates]" value="on" /> <input type="checkbox" data-context="core" data-action="automatic_translation_updates" class="dashboard-hide update-option" name="options[automatic_translation_updates]" value="off" id="automatic_translation_updates_on" <?php checked('on', $options['automatic_translation_updates']); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="automatic_translation_updates_on"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if ('off' != $options['automatic_plugin_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Automatic Plugin Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="multi-choice"> <input type="radio" data-context="core" data-action="automatic_plugin_updates" name="options[automatic_plugin_updates]" value="on" id="automatic_plugin_on" <?php checked('on', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" data-context="core" data-action="automatic_plugin_updates" name="options[automatic_plugin_updates]" value="off" id="automatic_plugin_off" <?php checked('off', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" data-context="core" data-action="automatic_plugin_updates" name="options[automatic_plugin_updates]" value="default" id="automatic_plugin_default" <?php checked('default', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_default"><?php esc_html_e('Default', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" data-context="core" data-action="automatic_plugin_updates" name="options[automatic_plugin_updates]" value="individual" id="automatic_plugin_individual" <?php checked('individual', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_individual"><?php esc_html_e('Select Individually', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!--multi-choice--> </div><!-- .dashboard-item --> <div class="dashboard-item <?php if ('off' != $options['automatic_theme_updates']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Automatic Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="multi-choice"> <input type="radio" data-context="core" data-action="automatic_theme_updates" name="options[automatic_theme_updates]" value="on" id="automatic_theme_on" <?php checked('on', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" data-context="core" data-action="automatic_theme_updates" name="options[automatic_theme_updates]" value="off" id="automatic_theme_off" <?php checked('off', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" data-context="core" data-action="automatic_theme_updates" name="options[automatic_theme_updates]" value="default" id="automatic_theme_default" <?php checked('default', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_default"><?php esc_html_e('Default', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" data-context="core" data-action="automatic_theme_updates" name="options[automatic_theme_updates]" value="individual" id="automatic_theme_individual" <?php checked('individual', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_individual"><?php esc_html_e('Select Individually', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!--multi-choice--> </div><!-- .dashboard-item --> </div> </div> <!-- Plugin / Theme Updates --> <div class="dashboard-main-wrapper dashboard-plugin-theme-updates"> <div class="dashboard-main-header"><?php esc_html_e('Plugin and Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-main-header --> <div class="dashboard-tab"> <div class="dashboard-tab-header-plugin dashboard-tab-item active" ><a href="#" data-tab-action="plugins" ><?php esc_html_e('Plugin Updates', 'stops-core-theme-and-plugin-updates'); ?> </a></div> <div class="dashboard-tab-header-theme dashboard-tab-item" data-tab-plugins="plugins"><a href="#" data-tab-action="themes" ><?php esc_html_e('Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </a></div> </div><!- .dashboard-tab --> <div class="dashboard-tab-plugins dashboard-tab-content active"> <div class="dashboard-item-wrapper"> <?php $can_show_plugins = $can_show_themes = false; if ('on' == $options['theme_updates']) { $can_show_themes = true; } if ('on' == $options['plugin_updates']) { $can_show_plugins = true; } ?> <?php if ($can_show_plugins) { $options = MPSUM_Updates_Manager::get_options('plugins'); $plugins = get_plugins(); foreach ($plugins as $plugin_slug => $plugin_data) { $is_plugin_active = true; if (in_array($plugin_slug, $options)) { $is_plugin_active = false; } $plugin_name = $plugin_data['Name']; ?> <div class="dashboard-item <?php echo $is_plugin_active ? 'active' : ''; ?> "> <div class="dashboard-item-header input-radio"><?php echo esc_html($plugin_name); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="hidden" name="options[plugins]" value="<?php echo esc_attr($plugin_slug); ?> " /> <input id="<?php echo esc_attr($plugin_slug); ?> -check" type="checkbox" data-context="plugins" data-action="<?php echo esc_attr($plugin_slug); ?> " class="dashboard-hide update-option" name="options[plugins]" value="<?php echo esc_attr($plugin_slug); ?> " id="<?php echo esc_attr($plugin_slug); ?> _off" <?php checked(true, $is_plugin_active); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="<?php echo esc_attr($plugin_slug); ?> -check"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <?php } } else { ?> <p><?php esc_html_e('All plugin updates have been disabled.', 'stops-core-theme-and-plugin-updates'); } ?> </p> </div><!-- .dashboard-item-wrapper --> </div><!-- .dashboard-tab-plugins --> <div class="dashboard-tab-themes dashboard-tab-content"> <div class="dashboard-item-wrapper"> <?php if ($can_show_themes) { $options = MPSUM_Updates_Manager::get_options('themes'); $themes = wp_get_themes(); foreach ($themes as $theme_slug => $theme_data) { $is_theme_active = true; if (in_array($theme_slug, $options)) { $is_theme_active = false; } $theme_name = $theme_data->Name; ?> <div class="dashboard-item <?php echo $is_theme_active ? 'active' : ''; ?> "> <div class="dashboard-item-header input-radio"><?php echo esc_html($theme_name); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $checked_value = 'checked'; if (in_array($theme_slug, $options)) { $checked_value = ''; } else { } ?> <input type="hidden" name="options[themes]" value="<?php echo esc_attr($theme_slug); ?> " /> <input id="<?php echo esc_attr($theme_slug); ?> -check" type="checkbox" data-context="themes" data-action="<?php echo esc_attr($theme_slug); ?> " class="dashboard-hide update-option" name="options[themes]" value="<?php echo esc_attr($theme_slug); ?> " id="<?php echo esc_attr($theme_slug); ?> _off" <?php checked(true, $is_theme_active); ?> <?php disabled(true, false); ?> /> <label for="<?php echo esc_attr($theme_slug); ?> -check"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <?php } } else { ?> <p><?php esc_html_e('All theme updates have been disabled.', 'stops-core-theme-and-plugin-updates'); ?> <?php } ?> </div><!-- .dashboard-item-wrapper --> </div><!-- .dashboard-tab-plugins --> </div><!--- .dashboard-main-wrapper --> </div><!-- #dashboard-main-columns --> <div id="dashboard-child-columns"> <!-- Plugin / Theme Updates --> <div class="dashboard-main-wrapper dashboard-plugin-theme-auto-updates"> <div class="dashboard-main-header"><?php esc_html_e('Plugin and Theme Automatic Updates', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-main-header --> <div class="dashboard-tab"> <div class="dashboard-tab-header-plugin dashboard-tab-item active" ><a href="#" data-tab-action="plugins" ><?php esc_html_e('Plugin Updates', 'stops-core-theme-and-plugin-updates'); ?> </a></div> <div class="dashboard-tab-header-theme dashboard-tab-item" data-tab-plugins="plugins"><a href="#" data-tab-action="themes" ><?php esc_html_e('Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </a></div> </div><!- .dashboard-tab --> <div class="dashboard-tab-plugins dashboard-tab-content active"> <div class="dashboard-item-wrapper"> <?php $can_show_plugins = false; $options = MPSUM_Updates_Manager::get_options('core'); if (!isset($options['automatic_plugin_updates'])) { $options['automatic_plugin_updates'] = 'default'; $can_show_plugins = $options['automatic_plugin_updates']; } else { $can_show_plugins = $options['automatic_plugin_updates']; } if (isset($options['plugin_updates']) && 'off' == $options['plugin_updates']) { $can_show_plugins = 'off'; } $error = ''; if ('default' == $can_show_plugins) { $can_show_plugins = false; $error = __('WordPress defaults control which updates are automatic or not.', 'stops-core-theme-and-plugin-updates'); } elseif ('on' == $can_show_plugins) { $can_show_plugins = false; $error = __('Automatic updates are on for all plugins', 'stops-core-theme-and-plugin-updates'); } elseif ('off' == $can_show_plugins) { $can_show_plugins = false; $error = __('Automatic updates are disabled for all plugins', 'stops-core-theme-and-plugin-updates'); } else { $can_show_plugins = true; } ?> <?php if ($can_show_plugins) { $options = MPSUM_Updates_Manager::get_options('plugins_automatic'); $plugins = get_plugins(); foreach ($plugins as $plugin_slug => $plugin_data) { $is_plugin_active = false; if (in_array($plugin_slug, $options)) { $is_plugin_active = true; } $plugin_name = $plugin_data['Name']; ?> <div class="dashboard-item"> <div class="dashboard-item-header input-radio"><?php echo esc_html($plugin_name); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="hidden" name="options[plugins_automatic]" value="<?php echo esc_attr($plugin_slug); ?> " /> <input id="update_<?php echo esc_attr($plugin_slug); ?> -check" type="checkbox" data-context="plugins_automatic" data-action="<?php echo esc_attr($plugin_slug); ?> " class="dashboard-hide update-option" name="options[plugins_automatic]" value="<?php echo esc_attr($plugin_slug); ?> " id="<?php echo esc_attr($plugin_slug); ?> _off" <?php checked(true, $is_plugin_active); ?> <?php disabled(true, $disable_core_options); ?> /> <label for="update_<?php echo esc_attr($plugin_slug); ?> -check"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <?php } } else { ?> <p><?php echo esc_html($error); ?> </p> <?php } ?> </div><!-- .dashboard-item-wrapper --> </div><!-- .dashboard-tab-plugins --> <div class="dashboard-tab-themes dashboard-tab-content"> <div class="dashboard-item-wrapper"> <?php $can_show_themes = false; $options = MPSUM_Updates_Manager::get_options('core'); if (!isset($options['automatic_theme_updates'])) { $options['automatic_theme_updates'] = 'default'; $auto_theme_updates = $options['automatic_theme_updates']; } else { $auto_theme_updates = $options['automatic_theme_updates']; } if (isset($options['theme_updates']) && 'off' == $options['theme_updates']) { $can_show_plugins = 'off'; $auto_theme_updates = 'off'; } $error = ''; if ('default' == $auto_theme_updates) { $can_show_themes = false; $error = __('WordPress defaults control which updates are automatic or not.', 'stops-core-theme-and-plugin-updates'); } elseif ('on' == $auto_theme_updates) { $can_show_themes = false; $error = __('Automatic updates are on for all themes', 'stops-core-theme-and-plugin-updates'); } elseif ('off' == $auto_theme_updates) { $can_show_themes = false; $error = __('Automatic updates are disabled for all themes', 'stops-core-theme-and-plugin-updates'); } else { $can_show_themes = true; } if ($can_show_themes) { $options = MPSUM_Updates_Manager::get_options('themes_automatic'); $themes = wp_get_themes(); foreach ($themes as $theme_slug => $theme_data) { $is_theme_active = false; if (in_array($theme_slug, $options)) { $is_theme_active = true; } $theme_name = $theme_data->Name; ?> <div class="dashboard-item"> <div class="dashboard-item-header input-radio"><?php echo esc_html($theme_name); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <?php $checked_value = 'checked'; if (in_array($theme_slug, $options)) { $checked_value = ''; } else { } ?> <input type="hidden" name="options[themes_automatic]" value="<?php echo esc_attr($theme_slug); ?> " /> <input id="themes_automatic_on_<?php echo $theme_slug; ?> " type="checkbox" data-context="themes_automatic" data-action="<?php echo esc_attr($theme_slug); ?> " class="dashboard-hide update-option" name="options[themes_automatic]" value="<?php echo esc_attr($theme_slug); ?> " id="<?php echo esc_attr($theme_slug); ?> _off" <?php checked(true, $is_theme_active); ?> <?php disabled(true, false); ?> /> <label for="themes_automatic_on_<?php echo $theme_slug; ?> "><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <?php } } else { ?> <p><?php echo esc_html($error); ?> </p> <?php } ?> </div><!-- .dashboard-item-wrapper --> </div><!-- .dashboard-tab-plugins --> </div><!--- .dashboard-main-wrapper --> <div class="dashboard-main-wrapper"> <div class="dashboard-main-header"> <?php $options = MPSUM_Updates_Manager::get_options('core'); $options = wp_parse_args($options, MPSUM_Admin_Core::get_defaults()); ?> <?php esc_html_e('WordPress Notifications', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-main-header --> <div class="dashboard-item-wrapper"> <div class="dashboard-item <?php if ('on' == $options['notification_core_update_emails']) { echo 'active'; } ?> "> <div class="dashboard-item-header input-radio"><?php esc_html_e('Core E-mails', 'stops-core-theme-and-plugin-updates'); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="checkbox" name="options[notification_core_update_emails]" value="off" /> <input type="checkbox" data-context="core" data-action="notification_core_update_emails" class="dashboard-hide" name="options[notification_core_update_emails]" value="off" id="notification_core_update_emails_on" <?php checked('on', $options['notification_core_update_emails']); ?> /> <label for="notification_core_update_emails_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <?php /* To be added pre 4.5 assuming filter is in place */ /* <div class="dashboard-item <?php if( 'on' == $options[ 'notification_core_update_emails_plugins' ] ) { echo 'active'; }?>"> <div class="dashboard-item-header input-radio"><?php esc_html_e( 'Core Plugin Emails', 'stops-core-theme-and-plugin-updates' ); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="checkbox" name="options[notification_core_update_emails_plugins]" value="off" /> <input type="checkbox" data-context="core" data-action="notification_core_update_emails_plugins" class="dashboard-hide" name="options[all_updates]" value="on" id="notification_core_update_emails_plugins_on" <?php checked( 'on', $options[ 'notification_core_update_emails_plugins' ] ); ?> /> <label for="notification_core_update_emails_plugins_on"><?php esc_html_e( 'Enabled', 'stops-core-theme-and-plugin-updates' ); ?></label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if( 'on' == $options[ 'notification_core_update_emails_themes' ] ) { echo 'active'; }?>"> <div class="dashboard-item-header input-radio"><?php esc_html_e( 'Core Theme Emails', 'stops-core-theme-and-plugin-updates' ); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="checkbox" name="options[notification_core_update_emails_themes]" value="off" /> <input type="checkbox" data-context="core" data-action="notification_core_update_emails_themes" class="dashboard-hide" name="options[notification_core_update_emails_themes]" value="on" id="notification_core_update_emails_themes_on" <?php checked( 'on', $options[ 'notification_core_update_emails_themes' ] ); ?> /> <label for="notification_core_update_emails_themes_on"><?php esc_html_e( 'Enabled', 'stops-core-theme-and-plugin-updates' ); ?></label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> <div class="dashboard-item <?php if( 'on' == $options[ 'notification_core_update_emails_translations' ] ) { echo 'active'; }?>"> <div class="dashboard-item-header input-radio"><?php esc_html_e( 'Core Translation Emails', 'stops-core-theme-and-plugin-updates' ); ?> </div><!-- .dashboard-item-header --> <div class="dashboard-item-choice"> <input type="checkbox" name="options[notification_core_update_emails_translations]" value="off" /> <input type="checkbox" data-context="core" data-action="notification_core_update_emails_translations" class="dashboard-hide" name="options[notification_core_update_emails_translations]" value="on" id="notification_core_update_emails_translations_on" <?php checked( 'on', $options[ 'notification_core_update_emails_translations' ] ); ?> /> <label for="notification_core_update_emails_translations_on"><?php esc_html_e( 'Enabled', 'stops-core-theme-and-plugin-updates' ); ?></label> </div><!-- .dashboard-item-choice --> </div><!-- dashboard-item--> */ ?> </div><!-- .dashboard-item-wrapper --> </div><!--- .dashboard-main-wrapper --> </div><!-- #dashboard-child-columns --> </div><!-- #dashboard-main-outputs --> </form> <?php return; }
/** * Outputs the theme action links beneath each theme row. * * Outputs the theme action links beneath each theme row. * * @since 5.0.0 * @access public * @see __construct * @internal uses mpsum_theme_action_links filter * * @param array $settings Array of settings to output. * @param WP_Theme $theme The theme object to take action on. */ public function theme_action_links($settings, $theme) { $stylesheet = $theme->get_stylesheet(); $theme_options = MPSUM_Updates_Manager::get_options('themes'); if (false !== ($key = array_search($stylesheet, $theme_options))) { $enable_url = add_query_arg(array('action' => 'allow-update-selected', '_mpsum' => wp_create_nonce('mpsum_theme_update'), 'checked' => array($stylesheet))); $enable_url = remove_query_arg('disabled', $enable_url); $settings[] = sprintf('<a href="%s">%s</a>', esc_url($enable_url), esc_html__('Allow Updates', 'stops-core-theme-and-plugin-updates')); } else { //Disable Link $disable_url = add_query_arg(array('action' => 'disallow-update-selected', '_mpsum' => wp_create_nonce('mpsum_theme_update'), 'checked' => array($stylesheet))); $disable_url = remove_query_arg('disabled', $disable_url); $settings[] = sprintf('<a href="%s">%s</a>', esc_url($disable_url), esc_html__('Disallow Updates', 'stops-core-theme-and-plugin-updates')); //Automatic Link $theme_automatic_options = MPSUM_Updates_Manager::get_options('themes_automatic'); $core_options = MPSUM_Updates_Manager::get_options('core'); if (isset($core_options['automatic_theme_updates']) && 'individual' == $core_options['automatic_theme_updates']) { if (in_array($stylesheet, $theme_automatic_options)) { //Disable Link $disable_automatic_url = add_query_arg(array('action' => 'disallow-automatic-selected', '_mpsum' => wp_create_nonce('mpsum_theme_update'), 'checked' => array($stylesheet))); $settings[] = sprintf('<a href="%s">%s</a>', esc_url($disable_automatic_url), esc_html__('Disallow Automatic Updates', 'stops-core-theme-and-plugin-updates')); } else { //Enable Link $enable_automatic_url = add_query_arg(array('action' => 'allow-automatic-selected', '_mpsum' => wp_create_nonce('mpsum_theme_update'), 'checked' => array($stylesheet))); $settings[] = sprintf('<a href="%s">%s</a>', esc_url($enable_automatic_url), esc_html__('Enable Automatic Updates', 'stops-core-theme-and-plugin-updates')); } } } return $settings; }
/** * @global string $status * @global int $page * @global string $s * @global array $totals * @param array $item */ public function single_row($item) { global $status, $page, $s, $totals; list($plugin_file, $plugin_data) = $item; $context = 'all'; $screen = $this->screen; /** * Filter the action links that show up under each plugin row. * * @since 5.0.0 * * @param string Relative plugin file path * @param array $plugin_data An array of plugin data. * @param string $status Status of the plugin. */ $actions = apply_filters('mpsum_plugin_action_links', array(), $plugin_file, $plugin_data, $status); $class = 'active'; $plugin_options = MPSUM_Updates_Manager::get_options('plugins'); if (false !== ($key = array_search($plugin_file, $plugin_options))) { $class = 'inactive'; } $checkbox_id = "checkbox_" . md5($plugin_data['Name']); $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf(__('Select %s', 'stops-core-theme-and-plugin-updates'), $plugin_data['Name']) . "</label>" . "<input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' id='" . $checkbox_id . "' />"; $description = '<p>' . ($plugin_data['Description'] ? $plugin_data['Description'] : ' ') . '</p>'; $plugin_name = $plugin_data['Name']; $id = sanitize_title($plugin_name); echo "<tr id='{$id}' class='{$class}'>"; list($columns, $hidden) = $this->get_column_info(); foreach ($columns as $column_name => $column_display_name) { $style = ''; if (in_array($column_name, $hidden)) { $style = ' style="display:none;"'; } switch ($column_name) { case 'cb': echo "<th scope='row' class='check-column'>{$checkbox}</th>"; break; case 'name': echo "<td class='plugin-title'{$style}><strong>{$plugin_name}</strong>"; echo $this->row_actions($actions, true); echo "</td>"; break; case 'description': echo "<td class='column-description desc'{$style}>\n\t\t\t\t\t\t<div class='plugin-description'>{$description}</div>\n\t\t\t\t\t\t<div class='{$class} second plugin-version-author-uri'>"; $plugin_meta = array(); if (!empty($plugin_data['Version'])) { $plugin_meta[] = sprintf(__('Version %s', 'stops-core-theme-and-plugin-updates'), $plugin_data['Version']); } if (!empty($plugin_data['Author'])) { $author = $plugin_data['Author']; if (!empty($plugin_data['AuthorURI'])) { $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; } $plugin_meta[] = sprintf(__('By %s', 'stops-core-theme-and-plugin-updates'), $author); } // Details link using API info, if available if (isset($plugin_data['slug']) && current_user_can('install_plugins')) { $plugin_meta[] = sprintf('<a href="%s" class="thickbox" aria-label="%s" data-title="%s">%s</a>', esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . '&TB_iframe=true&width=600&height=550')), esc_attr(sprintf(__('More information about %s', 'stops-core-theme-and-plugin-updates'), $plugin_name)), esc_attr($plugin_name), __('View details', 'stops-core-theme-and-plugin-updates')); } elseif (!empty($plugin_data['PluginURI'])) { $plugin_meta[] = sprintf('<a href="%s">%s</a>', esc_url($plugin_data['PluginURI']), __('Visit plugin site', 'stops-core-theme-and-plugin-updates')); } /** * Filter the array of row meta for each plugin in the Plugins list table. * * @since 2.8.0 * * @param array $plugin_meta An array of the plugin's metadata, * including the version, author, * author URI, and plugin URI. * @param string $plugin_file Path to the plugin file, relative to the plugins directory. * @param array $plugin_data An array of plugin data. * @param string $status Status of the plugin. Defaults are 'All', 'Active', * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', * 'Drop-ins', 'Search'. */ $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status); echo implode(' | ', $plugin_meta); echo "</div></td>"; break; default: echo "<td class='{$column_name} column-{$column_name}'{$style}>"; /** * Fires inside each custom column of the Plugins list table. * * @since 3.1.0 * * @param string $column_name Name of the column. * @param string $plugin_file Path to the plugin file. * @param array $plugin_data An array of plugin data. */ do_action('manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data); echo "</td>"; } } echo "</tr>"; /** * Fires after each row in the Plugins list table. * * @since 2.3.0 * * @param string $plugin_file Path to the plugin file, relative to the plugins directory. * @param array $plugin_data An array of plugin data. * @param string $status Status of the plugin. Defaults are 'All', 'Active', * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', * 'Drop-ins', 'Search'. */ do_action('after_plugin_row', $plugin_file, $plugin_data, $status); /** * Fires after each specific row in the Plugins list table. * * The dynamic portion of the hook name, `$plugin_file`, refers to the path * to the plugin file, relative to the plugins directory. * * @since 2.7.0 * * @param string $plugin_file Path to the plugin file, relative to the plugins directory. * @param array $plugin_data An array of plugin data. * @param string $status Status of the plugin. Defaults are 'All', 'Active', * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', * 'Drop-ins', 'Search'. */ do_action("after_plugin_row_{$plugin_file}", $plugin_file, $plugin_data, $status); }
/** * Save plugin options. * * Saves the plugin options based on context. If no context is provided, updates all options. * * @since 5.0.0 * @access static * * @param array $options Associative array of plugin options. * @param string $context Array key of which options to update */ public static function update_options($options = array(), $context = '') { $options_to_save = self::get_options(); if (!empty($context) && is_string($context)) { $options_to_save[$context] = $options; } else { $options_to_save = $options; } self::$options = $options_to_save; update_site_option('MPSUM', $options_to_save); }
/** * Output the HTML interface for the main tab. * * Output the HTML interface for the main tab. * * @since 5.0.0 * @access public * @see __construct * @internal Uses the mpsum_admin_tab_main action */ public function tab_output() { $options = MPSUM_Updates_Manager::get_options('core'); $options = wp_parse_args($options, $this->get_defaults()); if (isset($_GET['updated'])) { $message = __('Options saved.', 'stops-core-theme-and-plugin-updates'); ?> <br /> <div class="updated"><p><strong><?php echo esc_html($message); ?> </strong></p></div> <?php } ?> <form action="<?php echo esc_url(add_query_arg(array())); ?> " method="post"> <h3><?php esc_html_e('Global Settings', 'stops-core-theme-and-plugin-updates'); ?> </h3> <table class="form-table"> <tr> <th scope="row"><?php esc_html_e('All Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[all_updates]" value="on" id="all_updates_on" <?php checked('on', $options['all_updates']); ?> /> <label for="all_updates_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[all_updates]" value="off" id="all_updates_off" <?php checked('off', $options['all_updates']); ?> /> <label for="all_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('If this option is disabled, this will override all settings.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('WordPress Core Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[core_updates]" value="on" id="core_updates_on" <?php checked('on', $options['core_updates']); ?> /> <label for="core_updates_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[core_updates]" value="off" id="core_updates_off" <?php checked('off', $options['core_updates']); ?> /> <label for="core_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Prevents WordPress from showing it needs to be updated.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('All Plugin Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[plugin_updates]" value="on" id="plugin_updates_on" <?php checked('on', $options['plugin_updates']); ?> /> <label for="plugin_updates_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[plugin_updates]" value="off" id="plugin_updates_off" <?php checked('off', $options['plugin_updates']); ?> /> <label for="plugin_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </td> </tr> <tr> <th scope="row"><?php esc_html_e('All Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[theme_updates]" value="on" id="theme_updates_on" <?php checked('on', $options['theme_updates']); ?> /> <label for="theme_updates_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[theme_updates]" value="off" id="theme_updates_off" <?php checked('off', $options['theme_updates']); ?> /> <label for="theme_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </td> </tr> <tr> <th scope="row"><?php esc_html_e('All Translation Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[translation_updates]" value="on" id="translation_updates_on" <?php checked('on', $options['translation_updates']); ?> /> <label for="translation_updates_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[translation_updates]" value="off" id="translation_updates_off" <?php checked('off', $options['translation_updates']); ?> /> <label for="translation_updates_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> </td> </tr> </table> <h3><?php esc_html_e('Automatic Updates', 'stops-core-theme-and-plugin-updates'); ?> </h3> <p><?php esc_html_e('These options will enable or disable automatic updates (background updates) of certain parts of WordPress.', 'stops-core-theme-and-plugin-updates'); ?> </p> <table class="form-table"> <tr> <th scope="row"><?php esc_html_e('Major Releases', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[automatic_major_updates]" value="on" id="automatic_major_on" <?php checked('on', $options['automatic_major_updates']); ?> /> <label for="automatic_major_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_major_updates]" value="off" id="automatic_major_off" <?php checked('off', $options['automatic_major_updates']); ?> /> <label for="automatic_major_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Automatically update to major releases (e.g., 4.1, 4.2, 4.3).', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('Minor Releases', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[automatic_minor_updates]" value="on" id="automatic_minor_on" <?php checked('on', $options['automatic_minor_updates']); ?> /> <label for="automatic_minor_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_minor_updates]" value="off" id="automatic_minor_off" <?php checked('off', $options['automatic_minor_updates']); ?> /> <label for="automatic_minor_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Automatically update to minor releases (e.g., 4.1.1, 4.1.2, 4.1.3).', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('Development Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[automatic_development_updates]" value="on" id="automatic_dev_on" <?php checked('on', $options['automatic_development_updates']); ?> /> <label for="automatic_dev_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_development_updates]" value="off" id="automatic_dev_off" <?php checked('off', $options['automatic_development_updates']); ?> /> <label for="automatic_dev_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Update automatically to Bleeding Edge releases.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('Automatic Plugin Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[automatic_plugin_updates]" value="on" id="automatic_plugin_on" <?php checked('on', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_plugin_updates]" value="off" id="automatic_plugin_off" <?php checked('off', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_plugin_updates]" value="default" id="automatic_plugin_default" <?php checked('default', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_default"><?php esc_html_e('Default', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_plugin_updates]" value="individual" id="automatic_plugin_individual" <?php checked('individual', $options['automatic_plugin_updates']); ?> /> <label for="automatic_plugin_individual"><?php esc_html_e('Select Individually', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Automatically update your plugins. Select always on, always off, the WordPress default, or select plugins individually.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('Automatic Theme Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[automatic_theme_updates]" value="on" id="automatic_theme_on" <?php checked('on', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_theme_updates]" value="off" id="automatic_theme_off" <?php checked('off', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_theme_updates]" value="default" id="automatic_theme_default" <?php checked('default', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_default"><?php esc_html_e('Default', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_theme_updates]" value="individual" id="automatic_theme_individual" <?php checked('individual', $options['automatic_theme_updates']); ?> /> <label for="automatic_theme_individual"><?php esc_html_e('Select Individually', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Automatically update your themes. Select always on, always off, the WordPress default, or select themes individually.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('Translation Updates', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[automatic_translation_updates]" value="on" id="automatic_translation_on" <?php checked('on', $options['automatic_translation_updates']); ?> /> <label for="automatic_translation_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[automatic_translation_updates]" value="off" id="automatic_translation_off" <?php checked('off', $options['automatic_translation_updates']); ?> /> <label for="automatic_translation_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Automatically update your translations.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> </table> <h3><?php esc_html_e('Notifications', 'stops-core-theme-and-plugin-updates'); ?> </h3> <table class="form-table"> <tr> <th scope="row"><?php esc_html_e('Core Update E-mails', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[notification_core_update_emails]" value="on" id="notification_core_update_emails_on" <?php checked('on', $options['notification_core_update_emails']); ?> /> <label for="notification_core_update_emails_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[notification_core_update_emails]" value="off" id="notification_core_update_emails_off" <?php checked('off', $options['notification_core_update_emails']); ?> /> <label for="notification_core_update_emails_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Disable e-mails that are sent when your site has been upgraded automatically.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> </table> <h3><?php esc_html_e('Miscellaneous', 'stops-core-theme-and-plugin-updates'); ?> </h3> <table class="form-table"> <tr> <th scope="row"><?php esc_html_e('Browser Nag', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[misc_browser_nag]" value="on" id="misc_browser_nag_on" <?php checked('on', $options['misc_browser_nag']); ?> /> <label for="misc_browser_nag_on"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[misc_browser_nag]" value="off" id="misc_browser_nag_off" <?php checked('off', $options['misc_browser_nag']); ?> /> <label for="misc_browser_nag_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Removes the browser nag for people using older browsers.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> <tr> <th scope="row"><?php esc_html_e('WordPress Version in Footer', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <input type="radio" name="options[misc_wp_footer]" value="on" id="misc_wp_footer_on" <?php checked('on', $options['misc_wp_footer']); ?> /> <label for="misc_wp_footer_off"><?php esc_html_e('Enabled', 'stops-core-theme-and-plugin-updates'); ?> </label><br /> <input type="radio" name="options[misc_wp_footer]" value="off" id="misc_wp_footer_off" <?php checked('off', $options['misc_wp_footer']); ?> /> <label for="misc_wp_footer_off"><?php esc_html_e('Disabled', 'stops-core-theme-and-plugin-updates'); ?> </label> <p class="description"><?php esc_html_e('Removes the WordPress version in the footer.', 'stops-core-theme-and-plugin-updates'); ?> </p> </td> </tr> </table> <input type="hidden" name="action" value='mpsum_save_core_options' /> <?php wp_nonce_field('mpsum_main_update', '_mpsum'); echo '<p class="submit">'; submit_button(__('Save Changes', 'stops-core-theme-and-plugin-updates'), 'primary', 'submit', false); echo ' '; submit_button(__('Reset to Defaults', 'stops-core-theme-and-plugin-updates'), 'secondary', 'reset', false); echo '</p>'; ?> </form> <?php }
/** * Output the HTML interface for the advanced tab. * * Output the HTML interface for the advanced tab. * * @since 5.0.0 * @access public * @see __construct * @internal Uses the mpsum_admin_tab_main action */ public function tab_output() { if (isset($_GET['updated'])) { $action = isset($_GET['mpaction']) ? $_GET['mpaction'] : ''; switch ($action) { case 'mpsum_save_excluded_users': $message = __('The exclusion of users option has been updated.', 'stops-core-theme-and-plugin-updates'); break; case 'mpsum_reset_options': $message = __('The plugin settings have now been reset.', 'stops-core-theme-and-plugin-updates'); break; case 'mpsum_force_updates': $message = __('Force update checks have been initialized. Please check your site in 90 seconds, and refresh to test automatic updates.', 'stops-core-theme-and-plugin-updates'); break; default: $message = __('Options saved.', 'stops-core-theme-and-plugin-updates'); return; } ?> <br /> <div class="updated"><p><strong><?php echo esc_html($message); ?> </strong></p></div> <?php } ?> <form action="<?php echo esc_url(add_query_arg(array())); ?> " method="post"> <h3><?php esc_html_e('Exclude Users', 'stops-core-theme-and-plugin-updates'); ?> </h3> <p><?php esc_html_e('Select which users to be excluded from the settings of this plugin. Default WordPress behavior will be used.', 'stops-core-theme-and-plugin-updates'); ?> </p> <p><?php esc_html_e('This option is useful if, for example, you would like to disable updates, but have a user account that can still update WordPress.', 'stops-core-theme-and-plugin-updates'); ?> </p> <table class="form-table"> <tr> <th scope="row"><?php esc_html_e('Users to be Excluded', 'stops-core-theme-and-plugin-updates'); ?> </th> <td> <?php //Code from wp-admin/includes/class-wp-ms-users-list-table $users = array(); if (is_multisite()) { global $wpdb; $logins = implode("', '", get_super_admins()); $users = $wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE user_login IN ('{$logins}')"); } else { /** * Determine which role gets queried for admin users. * * Determine which role gets queried for admin users. * * @since 5.0.0 * * @param string $var administrator. */ $role = apply_filters('mpsum_admin_role', 'administrator'); $users = get_users(array('role' => $role, 'orderby' => 'display_name', 'order' => 'ASC', 'fields' => 'ID')); } if (is_array($users) && !empty($users)) { echo '<input type="hidden" value="0" name="mpsum_excluded_users[]" />'; $excluded_users = MPSUM_Updates_Manager::get_options('excluded_users'); foreach ($users as $index => $user_id) { $user = get_userdata($user_id); printf('<input type="checkbox" name="mpsum_excluded_users[]" id="mpsum_user_%1$d" value="%1$d" %3$s /> <label for="mpsum_user_%1$d">%2$s</label><br />', esc_attr($user_id), esc_html($user->display_name), checked(true, in_array($user_id, $excluded_users), false)); } } ?> </td> </tr> </table> <input type="hidden" name="action" value='mpsum_save_excluded_users' /> <?php wp_nonce_field('mpsum_exclude_users', '_mpsum'); echo '<p class="submit">'; submit_button(__('Save Users', 'stops-core-theme-and-plugin-updates'), 'primary', 'submit', false); echo '</p>'; ?> </form> <form action="<?php echo esc_url(add_query_arg(array())); ?> " method="post"> <h3><?php esc_html_e('Reset Options', 'stops-core-theme-and-plugin-updates'); ?> </h3> <p><?php esc_html_e('This will reset all options to as if you have just installed the plugin.', 'stops-core-theme-and-plugin-updates'); ?> </p> <input type="hidden" name="action" value='mpsum_reset_options' /> <?php wp_nonce_field('mpsum_reset_options', '_mpsum'); echo '<p class="submit">'; submit_button(__('Reset All Options', 'stops-core-theme-and-plugin-updates'), 'primary', 'submit', false); echo '</p>'; ?> </form> <form action="<?php echo esc_url(add_query_arg(array())); ?> " method="post"> <h3><?php esc_html_e('Force Automatic Updates', 'stops-core-theme-and-plugin-updates'); ?> </h3> <p><?php esc_html_e('This will attempt to force automatic updates. This is useful for debugging.', 'stops-core-theme-and-plugin-updates'); ?> </p> <input type="hidden" name="action" value='mpsum_force_updates' /> <?php wp_nonce_field('mpsum_force_updates', '_mpsum'); echo '<p class="submit">'; submit_button(__('Force Updates', 'stops-core-theme-and-plugin-updates'), 'primary', 'submit', false); echo '</p>'; ?> </form> <?php }
public function enqueue_scripts() { $pagenow = isset($_GET['page']) ? $_GET['page'] : false; $is_active_tab = isset($_GET['tab']) ? $_GET['tab'] : false; //Check to make sure we're on the mpsum admin page if ($pagenow != 'mpsum-update-options') { return; } else { if (count($_GET) == 1 && $_GET['page'] == 'mpsum-update-options') { $is_active_tab = 'dashboard'; } } //Return of now active tabs if ($is_active_tab == false || $is_active_tab != 'dashboard') { return; } wp_enqueue_script('mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url('/js/admin.js'), array('jquery'), '20151125', true); wp_enqueue_style('mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url('/css/style.css'), array(), '20151125'); }
/** * Initialize the admin menu. * * Initialize the admin menu. * * @since 5.0.0 * @access public * @see __construct * @internal Uses init action * */ public function init() { //Plugin and Theme actions if (is_multisite()) { add_action('network_admin_menu', array($this, 'init_network_admin_menus')); } else { add_action('admin_menu', array($this, 'init_single_site_admin_menus')); } //Add settings link to plugins screen $prefix = is_multisite() ? 'network_admin_' : ''; add_action($prefix . 'plugin_action_links_' . MPSUM_Updates_Manager::get_plugin_basename(), array($this, 'plugin_settings_link')); //todo - maybe load these conditionally based on $_REQUEST[ 'tab' ] param new MPSUM_Admin_Plugins(self::get_slug()); new MPSUM_Admin_Themes(self::get_slug()); new MPSUM_Admin_Core(self::get_slug()); new MPSUM_Admin_Advanced(self::get_slug()); }
/** * Output the HTML interface for the plugins tab. * * Output the HTML interface for the plugins tab. * * @since 5.0.0 * @access public * @see __construct * @internal Uses the mpsum_admin_tab_plugins action */ public function tab_output_plugins() { if (isset($_GET['action'])) { $message = __('Settings have been updated.', 'stops-core-theme-and-plugin-updates'); if ('allow-automatic-selected' == $_GET['action']) { $message = __('The selected plugins have had automatic updates enabled.', 'stops-core-theme-and-plugin-updates'); } elseif ('disallow-automatic-selected' == $_GET['action']) { $message = __('The selected plugins have had automatic updates disabled.', 'stops-core-theme-and-plugin-updates'); } elseif ('disallow-update-selected' == $_GET['action']) { $message = __('The selected plugin updates have been disabled.', 'stops-core-theme-and-plugin-updates'); } elseif ('allow-update-selected' == $_GET['action']) { $message = __('The selected plugin updates have been enabled.', 'stops-core-theme-and-plugin-updates'); } ?> <div class="updated"><p><strong><?php echo esc_html($message); ?> </strong></p></div> <?php } ?> <form action="<?php echo esc_url(add_query_arg(array())); ?> " method="post"> <?php $plugin_status = isset($_GET['plugin_status']) ? $_GET['plugin_status'] : false; if (false !== $plugin_status) { printf('<input type="hidden" name="plugin_status" value="%s" />', esc_attr($plugin_status)); } wp_nonce_field('mpsum_plugin_update', '_mpsum'); ?> <h3><?php esc_html_e('Plugin Update Options', 'stops-core-theme-and-plugin-updates'); ?> </h3> <?php $core_options = MPSUM_Updates_Manager::get_options('core'); if (false === $this->can_update()) { printf('<div class="error"><p><strong>%s</strong></p></div>', esc_html__('All plugin updates have been disabled.', 'stops-core-theme-and-plugin-updates')); } $plugin_table = new MPSUM_Plugins_List_Table($args = array('screen' => $this->slug, 'tab' => $this->tab)); $plugin_table->prepare_items(); $plugin_table->views(); $plugin_table->display(); ?> </form> <?php }
public function enqueue_scripts() { wp_enqueue_script('mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url('/js/admin.js', array('jquery'))); wp_enqueue_style('mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url('/css/style.css')); }