mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Converting related core shortcodes to use batch class->method functionality.
This commit is contained in:
46
e107_files/shortcode/batch/siteinfo_shortcodes.php
Normal file
46
e107_files/shortcode/batch/siteinfo_shortcodes.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
* $Id: siteinfo_shortcodes.php,v 1.1 2009-01-08 21:47:44 mcfly_e107 Exp $
|
||||||
|
*
|
||||||
|
* News shortcode batch
|
||||||
|
*/
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
//include_once(e_HANDLER.'shortcode_handler.php');
|
||||||
|
|
||||||
|
$codes = array('sitebutton', 'sitedisclaimer', 'sitename', 'sitedescription', 'sitetag');
|
||||||
|
register_shortcode('siteinfo_shortcodes', $codes);
|
||||||
|
|
||||||
|
class siteinfo_shortcodes
|
||||||
|
{
|
||||||
|
function get_sitebutton()
|
||||||
|
{
|
||||||
|
$e107 = e107::getInstance();
|
||||||
|
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $e107->tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, 'http:') ? SITEBUTTON : e_IMAGE.SITEBUTTON);
|
||||||
|
return "<a href='".SITEURL."'><img src='".$path."' alt=\"".SITENAME."\" style='border: 0px; width: 88px; height: 31px' /></a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sitedisclaimer()
|
||||||
|
{
|
||||||
|
$e107 = e107::getInstance();
|
||||||
|
return $e107->tp->toHtml(SITEDISCLAIMER, true, 'constants defs');
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sitename($parm)
|
||||||
|
{
|
||||||
|
return ($parm == 'link') ? "<a href='".SITEURL."' title=\"".SITENAME."\">".SITENAME."</a>" : SITENAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sitedescription()
|
||||||
|
{
|
||||||
|
global $pref;
|
||||||
|
return SITEDESCRIPTION.(defined('THEME_DESCRIPTION') && $pref['displaythemeinfo'] ? THEME_DESCRIPTION : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_sitetag()
|
||||||
|
{
|
||||||
|
return SITETAG;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
@@ -1,3 +0,0 @@
|
|||||||
global $tp;
|
|
||||||
$path = ($_POST['sitebutton'] && $_POST['ajax_used']) ? $tp->replaceConstants($_POST['sitebutton']) : (strstr(SITEBUTTON, "http:") ? SITEBUTTON : e_IMAGE.SITEBUTTON);
|
|
||||||
return "<a href='".SITEURL."'><img src='".$path."' alt=\"".SITENAME."\" style='border: 0px; width: 88px; height: 31px' /></a>";
|
|
@@ -1 +0,0 @@
|
|||||||
return SITECONTACTINFO;
|
|
@@ -1 +0,0 @@
|
|||||||
return SITEDESCRIPTION.(defined("THEME_DESCRIPTION") && $pref['displaythemeinfo'] ? THEME_DESCRIPTION : "");
|
|
@@ -1,3 +0,0 @@
|
|||||||
global $tp;
|
|
||||||
$ret = $tp->toHtml(SITEDISCLAIMER,TRUE,"constants defs");
|
|
||||||
return $ret;
|
|
@@ -1,2 +0,0 @@
|
|||||||
return ($parm == "link") ? "<a href='".SITEURL."' title=\"".SITENAME."\">".SITENAME."</a>" : SITENAME;
|
|
||||||
|
|
@@ -1 +0,0 @@
|
|||||||
return SITETAG;
|
|
@@ -9,9 +9,9 @@
|
|||||||
* Text processing and parsing functions
|
* Text processing and parsing functions
|
||||||
*
|
*
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
|
||||||
* $Revision: 1.48 $
|
* $Revision: 1.49 $
|
||||||
* $Date: 2009-01-03 22:32:54 $
|
* $Date: 2009-01-08 21:47:44 $
|
||||||
* $Author: e107steved $
|
* $Author: mcfly_e107 $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
@@ -270,12 +270,16 @@ class e_parse
|
|||||||
|
|
||||||
|
|
||||||
// Initialise the shortcode handler - has to be done when $prefs valid, so can't be done in constructor ATM
|
// Initialise the shortcode handler - has to be done when $prefs valid, so can't be done in constructor ATM
|
||||||
function sch_load()
|
function sch_load($noCore=false)
|
||||||
{
|
{
|
||||||
if (!is_object($this->e_sc))
|
if (!is_object($this->e_sc))
|
||||||
{
|
{
|
||||||
require_once(e_HANDLER."shortcode_handler.php");
|
require_once(e_HANDLER."shortcode_handler.php");
|
||||||
$this->e_sc = new e_shortcode;
|
$this->e_sc = new e_shortcode;
|
||||||
|
if(!$noCore)
|
||||||
|
{
|
||||||
|
$this->e_sc->loadCoreShortcodes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/shortcode_handler.php,v $
|
||||||
| $Revision: 1.17 $
|
| $Revision: 1.18 $
|
||||||
| $Date: 2009-01-08 20:16:47 $
|
| $Date: 2009-01-08 21:47:44 $
|
||||||
| $Author: mcfly_e107 $
|
| $Author: mcfly_e107 $
|
||||||
+----------------------------------------------------------------------------+
|
+----------------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
@@ -56,7 +56,7 @@ class e_shortcode
|
|||||||
var $registered_codes = array(); // Shortcodes added by plugins
|
var $registered_codes = array(); // Shortcodes added by plugins
|
||||||
var $scClasses = array(); // Batch shortcode classes
|
var $scClasses = array(); // Batch shortcode classes
|
||||||
|
|
||||||
function e_shortcode()
|
function e_shortcode($noload=false)
|
||||||
{
|
{
|
||||||
global $pref, $register_sc;
|
global $pref, $register_sc;
|
||||||
|
|
||||||
@@ -97,6 +97,16 @@ class e_shortcode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadCoreShortcodes()
|
||||||
|
{
|
||||||
|
$coreBatchList = array('siteinfo_shortcodes.php');
|
||||||
|
foreach($coreBatchList as $cb)
|
||||||
|
{
|
||||||
|
include_once(e_FILE.'shortcode/batch/'.$cb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRegistered($code)
|
function isRegistered($code)
|
||||||
|
Reference in New Issue
Block a user