Skip to content

Commit

Permalink
#1019: Move forum_list_plugins to common_admin.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Quy Ton authored and franzliedke committed Jun 16, 2016
1 parent 99df923 commit b6e1f91
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
27 changes: 27 additions & 0 deletions include/common_admin.php
Expand Up @@ -21,6 +21,33 @@
// Attempt to load the admin_common language file
require PUN_ROOT.'lang/'.$admin_language.'/admin_common.php';

//
// Fetch a list of available admin plugins
//
function forum_list_plugins($is_admin)
{
$plugins = array();

$d = dir(PUN_ROOT.'plugins');
while (($entry = $d->read()) !== false)
{
if ($entry{0} == '.')
continue;

$prefix = substr($entry, 0, strpos($entry, '_'));
$suffix = substr($entry, strlen($entry) - 4);

if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP'))))
$plugins[$entry] = substr($entry, strpos($entry, '_') + 1, -4);
}
$d->close();

natcasesort($plugins);

return $plugins;
}


//
// Display the admin navigation menu
//
Expand Down
27 changes: 0 additions & 27 deletions include/functions.php
Expand Up @@ -1853,33 +1853,6 @@ function generate_stopwords_cache_id()
}


//
// Fetch a list of available admin plugins
//
function forum_list_plugins($is_admin)
{
$plugins = array();

$d = dir(PUN_ROOT.'plugins');
while (($entry = $d->read()) !== false)
{
if ($entry{0} == '.')
continue;

$prefix = substr($entry, 0, strpos($entry, '_'));
$suffix = substr($entry, strlen($entry) - 4);

if ($suffix == '.php' && ((!$is_admin && $prefix == 'AMP') || ($is_admin && ($prefix == 'AP' || $prefix == 'AMP'))))
$plugins[$entry] = substr($entry, strpos($entry, '_') + 1, -4);
}
$d->close();

natcasesort($plugins);

return $plugins;
}


//
// Split text into chunks ($inside contains all text inside $start and $end, and $outside contains all text outside)
//
Expand Down

0 comments on commit b6e1f91

Please sign in to comment.