public static function error_notice($err) { global $pp_plugin_page; $is_pp_plugin_page = !empty($pp_plugin_page) || isset($_REQUEST['page']) && 0 === strpos($_REQUEST['page'], 'pp-'); switch ($err) { case 'multiple_pp': global $pagenow; if (is_admin() && 'plugins.php' == $pagenow && !strpos(urldecode($_SERVER['REQUEST_URI']), 'deactivate')) { $message = sprintf('<strong>Error:</strong> Multiple copies of %1$s activated. Only the copy in folder "%2$s" is functional.', 'Press Permit', PPC_FOLDER); add_action('all_admin_notices', create_function('', 'echo \'<div id="message" class="error fade" style="color: black">' . $message . '</div>\';')); } break; case 'rs_active': define('PP_DISABLE_QUERYFILTERS', true); $message = sprintf('<strong>Note:</strong> Press Permit is running in configuration only mode. Access filtering will not be applied until Role Scoper is deactivated.'); $style = $is_pp_plugin_page ? 'margin-top:30px;color:black' : 'color:black'; add_action('all_admin_notices', create_function('', 'echo \'<div id="message" class="error fade" style="' . $style . '">' . $message . '</div>\';')); define('PP_CONFIG_ONLY', true); define('PP_DISABLE_MENU_TWEAK', true); return false; break; case 'pp_legacy_active': ppc_notice('Press Permit Core 2 cannot operate with an older version of Press Permit active.'); break; case 'old_php': ppc_notice('Sorry, Press Permit requires PHP 5.2 or higher. Please upgrade your server or deactivate Press Permit.'); break; default: } return true; }
public static function update_watch() { global $pp_extensions; if (empty($_REQUEST['action']) || in_array($_REQUEST['action'], array('edit', 'trash', 'delete')) && empty($_REQUEST['action2'])) { return; } $pp_update_info = pp_get_all_updates_info(); $action = isset($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : ''; if (-1 == $action || !$action) { $action = isset($_REQUEST['action2']) ? sanitize_key($_REQUEST['action2']) : ''; } if (isset($pp_extensions[$action])) { add_action("update-custom_{$action}", array('PP_UpdateWatch', 'plugin_update')); } elseif (!empty($_REQUEST['pp_install']) && isset($pp_update_info[$action])) { add_action("update-custom_{$action}", array('PP_UpdateWatch', 'plugin_install')); } elseif (in_array($action, array('update-selected', 'do-plugin-upgrade')) && (!empty($_REQUEST['checked']) || !empty($_REQUEST['plugins']))) { $slug_by_basename = array(); foreach ($pp_extensions as $slug => $ext) { $slug_by_basename[$ext->basename] = $slug; } $arr_checked = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : (array) $_REQUEST['plugins']; $msg = sprintf(__('Bulk Update is not currently supported for Press Permit. Please use individual plugin update links in the %1$splugins list%2$s or %3$sPP Install tab%4$s instead.', 'pp'), '<a href="plugins.php?plugin_status=upgrade">', '</a>', '<a href="admin.php?page=pp-settings&pp-tab=install">', '</a>'); $any_pp_updates = false; foreach ($arr_checked as $basename) { if (isset($slug_by_basename[$basename])) { $any_pp_updates = true; ppc_notice($msg); break; } } // for now, just remove PP and extensions from bulk update $any_other_updates = false; foreach (array('checked', 'plugins') as $varname) { if (isset($_REQUEST[$varname])) { if (is_array($_REQUEST[$varname])) { $_REQUEST[$varname] = @array_diff($_REQUEST[$varname], array_keys($slug_by_basename)); $_POST[$varname] = @array_diff($_POST[$varname], array_keys($slug_by_basename)); if (count($_REQUEST[$varname])) { $any_other_updates = true; } } else { $arr_selected = explode(',', $_REQUEST[$varname]); $arr_selected = @array_diff($arr_selected, array_keys($slug_by_basename)); if (count($arr_selected)) { $any_other_updates = true; } $_REQUEST[$varname] = implode(',', $arr_selected); $_POST[$varname] = implode(',', $arr_selected); } } } if ($any_pp_updates && !$any_other_updates) { wp_die($msg); } } }
function activation_notice() { $types_vals = get_option('pp_enabled_post_types'); if (!is_array($types_vals)) { $txs_val = get_option('pp_enabled_taxonomies'); } if (!$this->type_usage_stored() && !is_network_admin()) { $url = admin_url('admin.php?page=pp-settings'); ppc_notice(sprintf(__('Thanks for activating Press Permit Core. Please go to %1$sPermissions > Settings%2$s and indicate which Post Types and Taxonomies should be filtered.', 'pp'), '<a href="' . $url . '">', '</a>'), 'updated', false, true); } }