Skip to content

Commit

Permalink
3rd party plugin tab
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillard committed Nov 6, 2014
1 parent ac9fe4a commit 5de5d9d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions plugins/cacheHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
* any caching agent in the path.
*
* @author Stephen Billard (sbillard)
*
*
* @package plugins
* @subpackage example
* @category package
*/
$plugin_is_filter = 9 | ADMIN_PLUGIN | THEME_PLUGIN;
$plugin_description = gettext('Outputs a "Cache-control" header with selected caching options for all class-page pages.');
$plugin_description = gettext('Outputs a "Cache-control" header with selected caching options.');
$plugin_author = "Stephen Billard (sbillard)";
$option_interface = 'cacheHeader_options';

Expand Down
30 changes: 21 additions & 9 deletions zp-core/admin-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4620,6 +4620,7 @@ function getPluginTabs() {

$classXlate = array(
'all' => gettext('all'),
'thirdparty' => gettext('3rd party'),
'enabled' => gettext('enabled'),
'admin' => gettext('admin'),
'demo' => gettext('demo'),
Expand All @@ -4635,20 +4636,27 @@ function getPluginTabs() {
);
zp_apply_filter('plugin_tabs', $classXlate);

$classes = $member = array();
$classes = $member = $thirdparty = array();
foreach ($paths as $plugin => $path) {
$p = file_get_contents($path);
$i = strpos($p, '* @subpackage');
if (($key = $i) !== false) {
$key = strtolower(trim(substr($p, $i + 13, strpos($p, "\n", $i) - $i - 13)));
}
if (empty($key)) {
$key = 'misc';
$key = 'misc';
if ($str = isolate('@subpackage', $p)) {
preg_match('|@subpackage\s+(.*)\s|', $str, $matches);
if (isset($matches[1])) {
$key = strtolower(trim($matches[1]));
}
}
$classes[$key]['list'][] = $plugin;

$classes[$key][] = $plugin;
if (extensionEnabled($plugin)) {
$active[$plugin] = $path;
}
if ($str = isolate('@category', $p)) {
preg_match('|@category\s+(.*)\s|', $str, $matches);
if (!isset($matches[1]) || $matches[1] != 'package')
$thirdparty[$plugin] = $path;
}

if (array_key_exists($key, $classXlate)) {
$local = $classXlate[$key];
} else {
Expand All @@ -4659,6 +4667,7 @@ function getPluginTabs() {

ksort($classes);
$tabs[$classXlate['all']] = 'admin-plugins.php?page=plugins&tab=all';
$tabs[$classXlate['thirdparty']] = 'admin-plugins.php?page=plugins&tab=thirdparty';
$tabs[$classXlate['enabled']] = 'admin-plugins.php?page=plugins&tab=active';
switch ($default) {
case 'all':
Expand All @@ -4667,6 +4676,9 @@ function getPluginTabs() {
case 'active':
$currentlist = array_keys($active);
break;
case'thirdparty':
$currentlist = array_keys($thirdparty);
break;
default:
$currentlist = array();
break;
Expand All @@ -4676,7 +4688,7 @@ function getPluginTabs() {
foreach ($classes as $class => $list) {
$tabs[$classXlate[$class]] = 'admin-plugins.php?page=plugins&tab=' . $class;
if ($class == $default) {
$currentlist = $list['list'];
$currentlist = $list;
}
}
return array($tabs, $default, $currentlist, $paths, $member);
Expand Down

0 comments on commit 5de5d9d

Please sign in to comment.