mirror of
https://github.com/e107inc/e107.git
synced 2025-08-04 21:57:51 +02:00
Plugin category 'menu' added - for menu only installs. (while supporting e_xxxx). siteinfo_shortcodes.php moved to siteinfo plugin: e_shortcode.php
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/plugin.php,v $
|
||||
| $Revision: 1.43 $
|
||||
| $Date: 2009-09-10 15:39:09 $
|
||||
| $Revision: 1.44 $
|
||||
| $Date: 2009-09-19 17:43:18 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -754,6 +754,7 @@ class pluginManager{
|
||||
global $tp, $plugin, $frm;
|
||||
|
||||
if (empty($pluginList)) return '';
|
||||
|
||||
|
||||
$text = "";
|
||||
|
||||
@@ -770,6 +771,12 @@ class pluginManager{
|
||||
{
|
||||
$plug_vars = $plugin->plug_vars;
|
||||
}
|
||||
|
||||
if(varset($plug['plugin_category']) == "menu") // Hide "Menu Only" plugins.
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if($plug_vars)
|
||||
{
|
||||
|
||||
|
@@ -1,92 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: siteinfo_shortcodes.php,v 1.5 2009-07-25 07:54:34 marj_nl_fr Exp $
|
||||
*
|
||||
* Siteinfo shortcode batch
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
$codes = array('sitebutton', 'sitedisclaimer', 'sitename', 'sitedescription', 'sitetag', 'logo', 'theme_disclaimer');
|
||||
register_shortcode('siteinfo_shortcodes', $codes);
|
||||
|
||||
class siteinfo_shortcodes
|
||||
{
|
||||
function sc_sitebutton()
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $e107->tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON);
|
||||
//TODO use CSS class?
|
||||
return '<a href="'.SITEURL.'"><img src="'.$path.'" alt="'.SITENAME.'" /></a>';
|
||||
}
|
||||
|
||||
function sc_sitedisclaimer()
|
||||
{
|
||||
$e107 = e107::getInstance();
|
||||
return $e107->tp->toHtml(SITEDISCLAIMER, true, 'constants defs');
|
||||
}
|
||||
|
||||
function sc_sitename($parm)
|
||||
{
|
||||
return ($parm == 'link') ? "<a href='".SITEURL."' title=\"".SITENAME."\">".SITENAME."</a>" : SITENAME;
|
||||
}
|
||||
|
||||
function sc_sitedescription()
|
||||
{
|
||||
global $pref;
|
||||
return SITEDESCRIPTION.(defined('THEME_DESCRIPTION') && $pref['displaythemeinfo'] ? THEME_DESCRIPTION : '');
|
||||
}
|
||||
|
||||
function sc_sitetag()
|
||||
{
|
||||
return SITETAG;
|
||||
}
|
||||
|
||||
function sc_logo($parm)
|
||||
{
|
||||
parse_str($parm); // Optional {LOGO=file=file_name} or {LOGO=link=url} or {LOGO=file=file_name&link=url}
|
||||
// Paths to image file, link are relative to site base
|
||||
|
||||
if (isset($file) && $file && is_readable($file))
|
||||
{
|
||||
$logo = e_HTTP.$file; // HTML path
|
||||
$path = e_BASE.$file; // PHP path
|
||||
}
|
||||
else if (is_readable(THEME.'images/e_logo.png'))
|
||||
{
|
||||
$logo = THEME_ABS.'images/e_logo.png'; // HTML path
|
||||
$path = THEME.'images/e_logo.png'; // PHP path
|
||||
}
|
||||
else
|
||||
{
|
||||
$logo = e_IMAGE_ABS.'logo.png'; // HTML path
|
||||
$path = e_IMAGE.'logo.png'; // PHP path
|
||||
}
|
||||
|
||||
$dimensions = getimagesize($path);
|
||||
|
||||
$image = "<img class='logo' src='".$logo."' style='width: ".$dimensions[0]."px; height: ".$dimensions[1]."px' alt='".SITENAME."' />\n";
|
||||
|
||||
if (isset($link) && $link)
|
||||
{
|
||||
if ($link == 'index')
|
||||
{
|
||||
$image = "<a href='".e_HTTP."index.php'>".$image."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$image = "<a href='".e_HTTP.$link."'>".$image."</a>";
|
||||
}
|
||||
}
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
function sc_theme_disclaimer($parm)
|
||||
{
|
||||
global $pref;
|
||||
return (defined('THEME_DISCLAIMER') && $pref['displaythemeinfo'] ? THEME_DISCLAIMER : '');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
@@ -10,9 +10,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/menumanager_class.php,v $
|
||||
| $Revision: 1.7 $
|
||||
| $Date: 2009-08-25 08:29:47 $
|
||||
| $Author: secretr $
|
||||
| $Revision: 1.8 $
|
||||
| $Date: 2009-09-19 17:43:19 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@@ -355,6 +355,7 @@ class e_menuManager {
|
||||
$efile = new e_file;
|
||||
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
|
||||
$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
|
||||
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
|
||||
@@ -365,7 +366,7 @@ class e_menuManager {
|
||||
$existing_menu = $sql->db_Count("menus", "(*)", "WHERE menu_name='{$file['fname']}'");
|
||||
if (file_exists(e_PLUGIN.$parent_dir.'/plugin.xml') || file_exists(e_PLUGIN.$parent_dir.'/plugin.php'))
|
||||
{
|
||||
if (plugInstalled($parent_dir))
|
||||
if (e107::isInstalled($parent_dir))
|
||||
{ // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
|
||||
$valid_menu = TRUE; // Whether new or existing, include in list
|
||||
// echo "Include {$parent_dir}:{$file['fname']}<br />";
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||
| $Revision: 1.89 $
|
||||
| $Date: 2009-09-18 23:14:00 $
|
||||
| $Revision: 1.90 $
|
||||
| $Date: 2009-09-19 17:43:19 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ class e107plugin
|
||||
'plugin_category' // Plugin Category: settings, users, content, management, tools, misc, about
|
||||
);
|
||||
|
||||
var $accepted_categories = array('settings', 'users', 'content', 'tools', 'manage', 'misc', 'about');
|
||||
var $accepted_categories = array('settings', 'users', 'content', 'tools', 'manage', 'misc', 'menu', 'about');
|
||||
|
||||
var $plug_vars;
|
||||
var $current_plug;
|
||||
|
@@ -9,8 +9,8 @@
|
||||
* e107 Shortcode handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||
* $Revision: 1.30 $
|
||||
* $Date: 2009-09-18 22:20:39 $
|
||||
* $Revision: 1.31 $
|
||||
* $Date: 2009-09-19 17:43:19 $
|
||||
* $Author: e107coders $
|
||||
*/
|
||||
|
||||
@@ -129,11 +129,25 @@ class e_shortcode
|
||||
|
||||
function e_shortcode($noload=false)
|
||||
{
|
||||
global $pref, $register_sc;
|
||||
global $pref;
|
||||
|
||||
$this->parseSCFiles = true; // Default probably never used, but make sure its defined.
|
||||
$this->parseSCFiles = true; // Default probably never used, but make sure its defined.
|
||||
|
||||
//Register any shortcode from the shortcode/override/ directory
|
||||
$this->loadOverrideShortcodes();
|
||||
$this->loadThemeShortcodes();
|
||||
$this->loadPluginShortcodes();
|
||||
$this->loadPluginSCFiles();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any shortcode from the shortcode/override/ directory
|
||||
* @return
|
||||
*/
|
||||
protected function loadOverrideShortcodes()
|
||||
{
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
if(varset($pref['sc_override']))
|
||||
{
|
||||
$tmp = explode(',', $pref['sc_override']);
|
||||
@@ -143,10 +157,18 @@ class e_shortcode
|
||||
$this->registered_codes[$code]['type'] = 'override';
|
||||
$this->scOverride[] = $code;
|
||||
}
|
||||
}
|
||||
|
||||
// Register any shortcodes that were registered by the theme
|
||||
// $register_sc[] = 'MY_THEME_CODE'
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any shortcodes that were registered by the theme
|
||||
* $register_sc[] = 'MY_THEME_CODE'
|
||||
* @return
|
||||
*/
|
||||
protected function loadThemeShortcodes()
|
||||
{
|
||||
global $register_sc;
|
||||
|
||||
if(isset($register_sc) && is_array($register_sc))
|
||||
{
|
||||
foreach($register_sc as $code)
|
||||
@@ -157,12 +179,18 @@ class e_shortcode
|
||||
$this->registered_codes[$code]['type'] = 'theme';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->loadPluginShortcodes();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register all .sc files found in plugin directories (via pref)
|
||||
* @return
|
||||
*/
|
||||
protected function loadPluginSCFiles()
|
||||
{
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
// Register all .sc files found in plugin directories (via pref)
|
||||
if(varset($pref['shortcode_list'], '') != '')
|
||||
{
|
||||
foreach($pref['shortcode_list'] as $path => $namearray)
|
||||
@@ -185,14 +213,17 @@ class e_shortcode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load Plugin Shortcode Batch files (e_shortcode.php) for use site-wide.
|
||||
* Register Plugin Shortcode Batch files (e_shortcode.php) for use site-wide.
|
||||
* Equivalent to multiple .sc files in the plugin's folder.
|
||||
* @return
|
||||
*/
|
||||
function loadPluginShortcodes()
|
||||
protected function loadPluginShortcodes()
|
||||
{
|
||||
$pref = e107::getConfig('core')->getPref();
|
||||
|
||||
@@ -203,7 +234,7 @@ class e_shortcode
|
||||
|
||||
foreach($pref['e_shortcode_list'] as $key=>$val)
|
||||
{
|
||||
if(!e107::isInstalled($key) || !include_once(e_PLUGIN.$key.'/e_shortcode.php'))
|
||||
if(!include_once(e_PLUGIN.$key.'/e_shortcode.php'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -227,9 +258,13 @@ class e_shortcode
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Core Shortcode Batches.
|
||||
* @return
|
||||
*/
|
||||
function loadCoreShortcodes()
|
||||
{
|
||||
$coreBatchList = array('siteinfo_shortcodes.php', 'admin_shortcodes.php');
|
||||
$coreBatchList = array('admin_shortcodes.php');
|
||||
foreach($coreBatchList as $cb)
|
||||
{
|
||||
include_once(e_FILE.'shortcode/batch/'.$cb);
|
||||
|
Reference in New Issue
Block a user