mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
Change shortcode handler so you can use a non-registered shortcode class or array, without the shortcodes getting registered, and without having to permit other registered shortcodes. Modify event calendar to use this method (gets rid of callScFunc() )
This commit is contained in:
parent
b8f183f46b
commit
13f51c79c3
@ -45,7 +45,7 @@ function setScVar($className, $scVarName, $value)
|
||||
}
|
||||
|
||||
/**
|
||||
* FIXME: to be removed
|
||||
* FIXME: to be removed (once event calendar changed)
|
||||
*/
|
||||
function callScFunc($className, $scFuncName, $param = '')
|
||||
{
|
||||
@ -64,7 +64,7 @@ class e_parse_shortcode
|
||||
{
|
||||
protected $scList = array(); // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
|
||||
protected $parseSCFiles; // True if individual shortcode files are to be used
|
||||
protected $addedCodes; // Apparently not used
|
||||
protected $addedCodes = NULL; // Pointer to a class or array to be used on a single call
|
||||
protected $registered_codes = array(); // Shortcodes added by plugins TODO make it private
|
||||
protected $scClasses = array(); // Batch shortcode classes - TODO make it private
|
||||
protected $scOverride = array(); // Array of codes found in override/ dir
|
||||
@ -487,43 +487,71 @@ class e_parse_shortcode
|
||||
return in_array($code, $this->scOverride);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Parse the shortcodes in some text
|
||||
*
|
||||
* @param string $text - the text containing the shortcodes
|
||||
* @param boolean $useSCFiles - if TRUE, all currently registered shortcodes can be used.
|
||||
* - if FALSE, only those passed are used.
|
||||
* @param array|object|null $extraCodes - if passed, defines additional shortcodes:
|
||||
* - if an object or an array, the shortcodes defined by the class of the object are available for this parsing only.
|
||||
* @param array|null $eVars - if defined, details values to be substituted for shortcodes. Array key (lower case) is shortcode name (upper case)
|
||||
*
|
||||
* @return string with shortcodes substituted
|
||||
*/
|
||||
function parseCodes($text, $useSCFiles = true, $extraCodes = null, $eVars = null)
|
||||
{
|
||||
$saveParseSCFiles = $this->parseSCFiles; // In case of nested call
|
||||
$this->parseSCFiles = $useSCFiles;
|
||||
$saveVars = $this->eVars; // In case of nested call
|
||||
$saveCodes = $this->addedCodes;
|
||||
$this->eVars = $eVars;
|
||||
$this->addedCodes = NULL;
|
||||
|
||||
//object support
|
||||
if (is_object($extraCodes))
|
||||
{
|
||||
$this->addedCodes = &$extraCodes;
|
||||
/*
|
||||
$classname = get_class($extraCodes);
|
||||
|
||||
//register once
|
||||
if (!$this->isScClass($classname))
|
||||
{
|
||||
$this->registerShortcode($extraCodes, true);
|
||||
$this->registerShortcode($extraCodes, true); // Register class if not already registered
|
||||
}
|
||||
|
||||
//always overwrite object
|
||||
$this->scClasses[$classname] = $extraCodes;
|
||||
*/
|
||||
|
||||
// auto-register eVars if possible - call it manually?
|
||||
// $this->callScFunc($classname, 'setParserVars', $this->eVars);
|
||||
}
|
||||
elseif (is_array($extraCodes))
|
||||
{
|
||||
$this->addedCodes = &$extraCodes;
|
||||
/*
|
||||
foreach ($extraCodes as $sc => $code)
|
||||
{
|
||||
$this->scList[$sc] = $code;
|
||||
}
|
||||
*/
|
||||
}
|
||||
$ret = preg_replace_callback('#\{(\S[^\x02]*?\S)\}#', array(&$this, 'doCode'), $text);
|
||||
$this->parseSCFiles = $saveParseSCFiles; // Restore previous value
|
||||
$this->addedCodes = $saveCodes;
|
||||
$this->eVars = $saveVars; // restore eVars
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback looks up and substitutes a shortcode
|
||||
*/
|
||||
function doCode($matches)
|
||||
{
|
||||
global $pref, $e107cache, $menu_pref, $sc_style, $parm, $sql;
|
||||
@ -583,8 +611,20 @@ class e_parse_shortcode
|
||||
|
||||
$scCode = '';
|
||||
$scFile = '';
|
||||
$ret = '';
|
||||
$_method = 'sc_'.strtolower($code);
|
||||
if (is_object($this->addedCodes) && method_exists($this->addedCodes, $_method))
|
||||
{
|
||||
//It is class-based batch shortcode. Class already loaded; call the method
|
||||
$ret = $this->addedCodes->$_method($parm, $sc_mode);
|
||||
}
|
||||
elseif (is_array($this->addedCodes) && array_key_exists($code, $this->addedCodes))
|
||||
{
|
||||
// Its array-based shortcode. Load the code for evaluation later.
|
||||
$scCode = $this->addedCodes[$code];
|
||||
}
|
||||
// Check to see if we've already loaded the .sc file contents
|
||||
if (array_key_exists($code, $this->scList))
|
||||
elseif (array_key_exists($code, $this->scList))
|
||||
{
|
||||
$scCode = $this->scList[$code];
|
||||
}
|
||||
@ -717,7 +757,7 @@ class e_parse_shortcode
|
||||
{
|
||||
// echo (isset($scFile)) ? "<br />sc_file= ".str_replace(e_CORE.'shortcodes/single/', '', $scFile).'<br />' : '';
|
||||
// echo "<br />sc= <b>$code</b>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($scCode)
|
||||
|
@ -47,8 +47,9 @@ if (isset($_POST['printlists']))
|
||||
exit();
|
||||
}
|
||||
|
||||
e107::getScParser();
|
||||
//e107::getScParser();
|
||||
require_once(e_PLUGIN.'calendar_menu/calendar_shortcodes.php');
|
||||
$calSc = new event_calendar_shortcodes();
|
||||
|
||||
include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'.php');
|
||||
define('PAGE_NAME', EC_LAN_121);
|
||||
@ -96,9 +97,14 @@ $nowday = $ecal_class->cal_date['mday'];
|
||||
$monthstart = mktime(0, 0, 0, $month, 1, $year); // Start of month to be shown
|
||||
$monthend = mktime(0, 0, 0, $month + 1, 1, $year) - 1; // End of month to be shown
|
||||
|
||||
setScVar('event_calendar_shortcodes', 'ecalClass', &$ecal_class); // Give shortcodes a pointer to calendar class
|
||||
callScFunc('event_calendar_shortcodes','setCalDate', $dateArray); // Tell shortcodes the date to display
|
||||
setScVar('event_calendar_shortcodes', 'catFilter', $cat_filter); // Category filter
|
||||
|
||||
$calSc->ecalClass = &$ecal_class;
|
||||
$calSc->setCalDate($dateArray);
|
||||
$calSc->catFilter = $cat_filter;
|
||||
|
||||
//setScVar('event_calendar_shortcodes', 'ecalClass', &$ecal_class); // Give shortcodes a pointer to calendar class
|
||||
//callScFunc('event_calendar_shortcodes','setCalDate', $dateArray); // Tell shortcodes the date to display
|
||||
//setScVar('event_calendar_shortcodes', 'catFilter', $cat_filter); // Category filter
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -106,10 +112,10 @@ setScVar('event_calendar_shortcodes', 'catFilter', $cat_filter); // Category f
|
||||
//-------------------------------------------------
|
||||
|
||||
// time switch buttons
|
||||
$cal_text = $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, TRUE);
|
||||
$cal_text = $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc);
|
||||
|
||||
// navigation buttons
|
||||
$nav_text = $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, TRUE);
|
||||
$nav_text = $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc);
|
||||
|
||||
// We'll need virtually all of the event-related fields, so get them regardless. Just cut back on category fields
|
||||
$ev_list = $ecal_class->get_events($monthstart, $monthend, FALSE, $cat_filter, TRUE, '*', 'event_cat_name,event_cat_icon');
|
||||
@ -172,16 +178,17 @@ $start = $monthstart;
|
||||
$numberdays = date('t', $start); // number of days in this month
|
||||
|
||||
$text = "";
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_START, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_START, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_START, FALSE, $calSc);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_START, FALSE, $calSc);
|
||||
|
||||
// Display the column headers
|
||||
for ($i = 0; $i < 7; $i++)
|
||||
{
|
||||
setScVar('event_calendar_shortcodes', 'headerDay', $ecal_class->day_offset_string($i));
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER, TRUE);
|
||||
$calSc->headerDay = $ecal_class->day_offset_string($i);
|
||||
//setScVar('event_calendar_shortcodes', 'headerDay', $ecal_class->day_offset_string($i));
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER, FALSE, $calSc);
|
||||
}
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_END, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_HEADER_END, FALSE, $calSc);
|
||||
|
||||
|
||||
// Calculate number of days to skip before 'real' days on first line of calendar
|
||||
@ -190,30 +197,32 @@ if ($firstdayoffset < 0) $firstdayoffset+= 7;
|
||||
|
||||
for ($i=0; $i<$firstdayoffset; $i++)
|
||||
{
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calSc);
|
||||
}
|
||||
|
||||
$loop = $firstdayoffset;
|
||||
|
||||
for ($c = 1; $c <= $numberdays; $c++)
|
||||
{ // Loop through the number of days in this month
|
||||
setScVar('event_calendar_shortcodes', 'todayStart', $start); // Start of current day
|
||||
setScVar('event_calendar_shortcodes', 'curDay', $c); // Current day of month
|
||||
$calSc->todayStart = $start; // Start of current day
|
||||
$calSc->curDay = $c; // Current day of month
|
||||
//setScVar('event_calendar_shortcodes', 'todayStart', $start); // Start of current day
|
||||
//setScVar('event_calendar_shortcodes', 'curDay', $c); // Current day of month
|
||||
|
||||
$got_ev = array_key_exists($c, $events) && is_array($events[$c]) && count($events[$c]) > 0; // Flag set if events on this day
|
||||
|
||||
// Highlight the current day.
|
||||
if ($nowday == $c && $month == $nowmonth && $year == $nowyear)
|
||||
{ //today
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_TODAY, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_TODAY, FALSE, $calSc);
|
||||
}
|
||||
elseif ($got_ev)
|
||||
{ //day has events
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_EVENT, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_EVENT, FALSE, $calSc);
|
||||
}
|
||||
else
|
||||
{ // no events and not today
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_EMPTY, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_EMPTY, FALSE, $calSc);
|
||||
}
|
||||
if ($got_ev)
|
||||
{
|
||||
@ -231,11 +240,12 @@ for ($c = 1; $c <= $numberdays; $c++)
|
||||
$ev['imagesize'] = '4';
|
||||
$ev['fulltopic'] = FALSE;
|
||||
}
|
||||
setScVar('event_calendar_shortcodes', 'event', $ev); // Give shortcodes the event data
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_SHOWEVENT, TRUE);
|
||||
//setScVar('event_calendar_shortcodes', 'event', $ev); // Give shortcodes the event data
|
||||
$calSc->event = $ev;
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_SHOWEVENT, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_END, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_END, FALSE, $calSc);
|
||||
|
||||
$loop++;
|
||||
if ($loop == 7)
|
||||
@ -243,7 +253,7 @@ for ($c = 1; $c <= $numberdays; $c++)
|
||||
$loop = 0;
|
||||
if($c != $numberdays)
|
||||
{
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_WEEKSWITCH, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_WEEKSWITCH, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
$start += 86400;
|
||||
@ -254,10 +264,10 @@ if($loop!=0)
|
||||
{
|
||||
for ($c=$loop; $c<7; $c++)
|
||||
{
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_DAY_NON, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_END, TRUE);
|
||||
$text .= $e107->tp->parseTemplate($CALENDAR_CALENDAR_END, FALSE, $calSc);
|
||||
|
||||
$e107->ns->tablerender(EC_LAN_79, $cal_text . $nav_text . $text);
|
||||
|
||||
|
@ -28,13 +28,14 @@ TODO:
|
||||
1. Good way of reading categories
|
||||
2. Have 'currentMonth' flag (means 'current day' if $ds == 'one') ?
|
||||
3. Check whether $prop should be calculated better
|
||||
4. Get rid of global on $pref
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'.php');
|
||||
register_shortcode('event_calendar_shortcodes', true);
|
||||
initShortcodeClass('event_calendar_shortcodes');
|
||||
//register_shortcode('event_calendar_shortcodes', true);
|
||||
//initShortcodeClass('event_calendar_shortcodes');
|
||||
|
||||
/*
|
||||
Navigation Shortcodes
|
||||
@ -157,17 +158,17 @@ class event_calendar_shortcodes
|
||||
{
|
||||
protected $e107;
|
||||
|
||||
public $event; // Current event being displayed
|
||||
public $ecalClass; // Pointer to event calendar class
|
||||
public $headerDay = 0; // Day number for header
|
||||
public $todayStart; // Start of current day
|
||||
public $curDay; // Current day of month (1..31)
|
||||
public $numEvents = 0; // Number of events to be expected in certain list formats
|
||||
public $catFilter = '*'; // Event category filter
|
||||
public $event; // Current event being displayed
|
||||
public $ecalClass; // Pointer to event calendar class
|
||||
public $headerDay = 0; // Day number for header
|
||||
public $todayStart; // Start of current day
|
||||
public $curDay; // Current day of month (1..31)
|
||||
public $numEvents = 0; // Number of events to be expected in certain list formats
|
||||
public $catFilter = '*'; // Event category filter
|
||||
public $eventDisplayCodes = ''; // Set to be an array of options
|
||||
public $ecOutputType = ''; // Used by printing routines
|
||||
public $changeFlags = array(); // Used by printing routines
|
||||
public $printVars = array(); // USed by printing routine
|
||||
public $ecOutputType = ''; // Used by printing routines
|
||||
public $changeFlags = array(); // Used by printing routines
|
||||
public $printVars = array(); // USed by printing routine
|
||||
|
||||
private $months = array(EC_LAN_0, EC_LAN_1, EC_LAN_2, EC_LAN_3, EC_LAN_4, EC_LAN_5, EC_LAN_6,
|
||||
EC_LAN_7, EC_LAN_8, EC_LAN_9, EC_LAN_10, EC_LAN_11); // 'Long' month names
|
||||
@ -371,7 +372,7 @@ class event_calendar_shortcodes
|
||||
global $pref;
|
||||
if ($this->ourDB == NULL)
|
||||
{
|
||||
$this->ourDB = new db;
|
||||
$this->ourDB = new db; // @todo use new method
|
||||
}
|
||||
($parm == 'nosubmit') ? $insert = '' : $insert = "onchange='this.form.submit()'";
|
||||
$ret = "<select name='event_cat_ids' class='tbox' style='width:140px;' {$insert} >\n<option value='all'>".EC_LAN_97."</option>\n";
|
||||
@ -409,14 +410,14 @@ class event_calendar_shortcodes
|
||||
{
|
||||
if (!$this->event['event_allday']) return '';
|
||||
if (trim($parm) == '') return '';
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_ifnot_allday($parm= '')
|
||||
{
|
||||
if ($this->event['event_allday']) return '';
|
||||
if (trim($parm) == '') return '';
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_ifnot_sameday($parm= '')
|
||||
@ -424,7 +425,7 @@ class event_calendar_shortcodes
|
||||
if (intval($this->event['event_end']/86400) == intval($this->event['event_start']/86400)) return '';
|
||||
if (!$this->event['event_allday']) return '';
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_if_sameday($parm= '')
|
||||
@ -432,7 +433,7 @@ class event_calendar_shortcodes
|
||||
if (intval($this->event['event_end']/86400) != intval($this->event['event_start']/86400)) return '';
|
||||
if (!$this->event['event_allday']) return '';
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
|
||||
@ -845,7 +846,7 @@ class event_calendar_shortcodes
|
||||
if ($this->event['event_allday']) $et += 2;
|
||||
if (is_array($this->eventDisplayCodes))
|
||||
{
|
||||
return $this->e107->tp->parseTemplate($this->eventDisplayCodes[$et]);
|
||||
return $this->e107->tp->parseTemplate($this->eventDisplayCodes[$et], FALSE, $this);
|
||||
}
|
||||
return '--** No template set **--';
|
||||
}
|
||||
@ -1063,42 +1064,42 @@ class event_calendar_shortcodes
|
||||
{
|
||||
if ($this->printVars['ot'] != 'print') return;
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_ifnot_print($parm = '')
|
||||
{
|
||||
if ($this->printVars['ot'] == 'print') return;
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_if_display($parm = '')
|
||||
{
|
||||
if ($this->printVars['ot'] != 'display') return;
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_ifnot_display($parm = '')
|
||||
{
|
||||
if ($this->printVars['ot'] == 'display') return;
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_if_pdf($parm = '')
|
||||
{
|
||||
if ($this->printVars['ot'] != 'pdf') return;
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
public function sc_ec_ifnot_pdf($parm = '')
|
||||
{
|
||||
if ($this->printVars['ot'] == 'pdf') return;
|
||||
if (trim($parm) == '') return;
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}');
|
||||
return $this->e107->tp->parseTemplate('{'.$parm.'}', FALSE, $this);
|
||||
}
|
||||
|
||||
} // END - shortcode class
|
||||
|
@ -145,20 +145,20 @@ $sc_style['EC_EVENT_THREAD']['post'] = "</span></td></tr>\n";
|
||||
$sc_style['EC_EVENT_CATEGORY']['pre'] = "<b>".EC_LAN_30."</b> ";
|
||||
$sc_style['EC_EVENT_CATEGORY']['post'] = " ";
|
||||
|
||||
$sc_style['EC_EVENT_DATE_START']['pre'] = "";
|
||||
$sc_style['EC_EVENT_DATE_START']['post'] = "";
|
||||
$sc_style['EC_EVENT_DATE_START']['pre'] = '';
|
||||
$sc_style['EC_EVENT_DATE_START']['post'] = '';
|
||||
|
||||
$sc_style['EC_EVENT_TIME_START']['pre'] = "";
|
||||
$sc_style['EC_EVENT_TIME_START']['post'] = "";
|
||||
$sc_style['EC_EVENT_TIME_START']['pre'] = '';
|
||||
$sc_style['EC_EVENT_TIME_START']['post'] = '';
|
||||
|
||||
$sc_style['EC_EVENT_DATE_END']['pre'] = "";
|
||||
$sc_style['EC_EVENT_DATE_END']['post'] = "";
|
||||
$sc_style['EC_EVENT_DATE_END']['pre'] = '';
|
||||
$sc_style['EC_EVENT_DATE_END']['post'] = '';
|
||||
|
||||
$sc_style['EC_EVENT_TIME_END']['pre'] = "";
|
||||
$sc_style['EC_EVENT_TIME_END']['post'] = "";
|
||||
$sc_style['EC_EVENT_TIME_END']['pre'] = '';
|
||||
$sc_style['EC_EVENT_TIME_END']['post'] = '';
|
||||
|
||||
$sc_style['EC_EVENT_EVENT_DATE_TIME']['pre'] = "<b>".EC_LAN_29."</b> ";
|
||||
$sc_style['EC_EVENT_EVENT_DATE_TIME']['post'] = "";
|
||||
$sc_style['EC_EVENT_EVENT_DATE_TIME']['post'] = '';
|
||||
|
||||
$sc_style['EC_IFNOT_ALLDAY']['pre'] = EC_LAN_144;
|
||||
$sc_style['EC_IFNOT_ALLDAY']['post'] = "";
|
||||
|
@ -62,8 +62,11 @@ global $ecal_class;
|
||||
if (!is_object($ecal_class)) $ecal_class = new ecal_class;
|
||||
$cal_super = $ecal_class->cal_super;
|
||||
|
||||
e107::getScParser();
|
||||
|
||||
//e107::getScParser();
|
||||
require_once(e_PLUGIN.'calendar_menu/calendar_shortcodes.php');
|
||||
$calSc = new event_calendar_shortcodes();
|
||||
|
||||
require_once(e_HANDLER.'calendar/calendar_class.php');
|
||||
$cal = new DHTML_Calendar(true);
|
||||
|
||||
@ -72,8 +75,6 @@ if ($cat_filter == -1) $cat_filter = '*';
|
||||
$mult_count = 0;
|
||||
|
||||
|
||||
// $e_wysiwyg = $pref['eventpost_editmode'] == 2 ? 'ne_event' : '';
|
||||
|
||||
|
||||
// Array links db field names to internal variables
|
||||
$ev_fields = array(
|
||||
@ -759,7 +760,7 @@ if ($action == 'ne' || $action == 'ed')
|
||||
}
|
||||
else
|
||||
{
|
||||
header("location:".e_PLUGIN."calendar_menu/event.php");
|
||||
header('location:'.e_PLUGIN.'calendar_menu/event.php');
|
||||
exit;
|
||||
}
|
||||
} // End of "Enter New Event"
|
||||
@ -771,17 +772,17 @@ if ($action == 'ne' || $action == 'ed')
|
||||
//-----------------------------------------------
|
||||
if (is_readable(THEME.'calendar_template.php'))
|
||||
{ // Has to be require
|
||||
require(THEME.'calendar_template.php');
|
||||
require(THEME.'calendar_template.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
require(e_PLUGIN.'calendar_menu/calendar_template.php');
|
||||
require(e_PLUGIN.'calendar_menu/calendar_template.php');
|
||||
}
|
||||
|
||||
setScVar('event_calendar_shortcodes', 'ecalClass', &$ecal_class); // Give shortcodes a pointer to calendar class
|
||||
callScFunc('event_calendar_shortcodes','setCalDate', $dateArray); // Tell shortcodes the date to display
|
||||
setScVar('event_calendar_shortcodes', 'catFilter', $cat_filter); // Category filter
|
||||
setScVar('event_calendar_shortcodes', 'eventDisplayCodes', $EVENT_EVENT_DATETIME); // Templates for different event types
|
||||
$calSc->ecalClass = &$ecal_class; // Give shortcodes a pointer to calendar class
|
||||
$calSc->setCalDate($dateArray); // Tell shortcodes the date to display
|
||||
$calSc->catFilter = $cat_filter; // Category filter
|
||||
$calSc->eventDisplayCodes = $EVENT_EVENT_DATETIME; // Templates for different event types
|
||||
|
||||
$monthstart = mktime(0, 0, 0, $month, 1, $year);
|
||||
$monthend = mktime(0, 0, 0, $month + 1, 1, $year) -1 ;
|
||||
@ -792,10 +793,10 @@ $nowyear = $ecal_class->cal_date['year'];
|
||||
|
||||
$text2 = "";
|
||||
// time switch buttons
|
||||
$text2 .= $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($CALENDAR_TIME_TABLE, FALSE, $calSc);
|
||||
|
||||
// navigation buttons
|
||||
$text2 .= $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($CALENDAR_NAVIGATION_TABLE, FALSE, $calSc);
|
||||
|
||||
|
||||
// ****** CAUTION - the category dropdown also used $sql object - take care to avoid interference!
|
||||
@ -830,10 +831,10 @@ if ($ds == 'event')
|
||||
}
|
||||
}
|
||||
$next10_start = $thisEvent['event_start'] +1;
|
||||
setScVar('event_calendar_shortcodes', 'event', $thisEvent); // Give shortcodes the event data
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE_START, TRUE);
|
||||
if ($ec_err) $text2.= "Software Error<br />"; else $text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE_END, TRUE);
|
||||
$calSc->event = $thisEvent; // Give shortcodes the event data
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE_START, FALSE, $calSc);
|
||||
if ($ec_err) $text2.= "Software Error<br />"; else $text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE, FALSE, $calSc);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE_END, FALSE, $calSc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -881,16 +882,14 @@ else
|
||||
// display event list for current month
|
||||
if(count($tim_arr))
|
||||
{
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENTLIST_TABLE_START, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENTLIST_TABLE_START, FALSE, $calSc);
|
||||
foreach ($tim_arr as $tim => $ptr)
|
||||
{
|
||||
$ev_list[$ptr]['event_start'] = $tim;
|
||||
// $text2 .= show_event($ev_list[$ptr]);
|
||||
//$thisevent = $ev_list[$ptr];
|
||||
setScVar('event_calendar_shortcodes', 'event', $ev_list[$ptr]); // Give shortcodes the event data
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE, TRUE);
|
||||
$calSc->event = $ev_list[$ptr]; // Give shortcodes the event data
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENT_TABLE, FALSE, $calSc);
|
||||
}
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENTLIST_TABLE_END, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_EVENTLIST_TABLE_END, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -904,25 +903,25 @@ $ev_list = $ecal_class->get_n_events(10, $next10_start, $next10_start+86400000,
|
||||
$num = count($ev_list);
|
||||
if ($num != 0)
|
||||
{
|
||||
setScVar('event_calendar_shortcodes', 'numEvents', $num); // Give shortcodes the number of events to expect
|
||||
$calSc->numEvents = $num; // Give shortcodes the number of events to expect
|
||||
$archive_events = '';
|
||||
foreach ($ev_list as $thisEvent)
|
||||
{
|
||||
setScVar('event_calendar_shortcodes', 'event', $thisEvent); // Give shortcodes the event data
|
||||
$archive_events .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE, TRUE);
|
||||
$calSc->event = $thisEvent; // Give shortcodes the event data
|
||||
$archive_events .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE, FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$archive_events = $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_EMPTY, TRUE);
|
||||
$archive_events = $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_EMPTY, FALSE, $calSc);
|
||||
}
|
||||
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_START, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_START, FALSE, $calSc);
|
||||
$text2 .= $archive_events;
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_END, TRUE);
|
||||
$text2 .= $e107->tp->parseTemplate($EVENT_ARCHIVE_TABLE_END, FALSE, $calSc);
|
||||
|
||||
|
||||
$e107->ns->tablerender($e107->tp->ParseTemplate('{EC_EVENT_PAGE_TITLE}'), $text2);
|
||||
$e107->ns->tablerender($e107->tp->ParseTemplate('{EC_EVENT_PAGE_TITLE}', FALSE, $calSc), $text2);
|
||||
|
||||
// Claim back memory no longer required
|
||||
unset($ev_list);
|
||||
|
@ -28,7 +28,7 @@ $e107 = e107::getInstance();
|
||||
if (!$e107->isInstalled('calendar_menu')) return '';
|
||||
|
||||
|
||||
if (!isset($scal_class) || !is_object($ecal_class))
|
||||
if (!isset($ecal_class) || !is_object($ecal_class))
|
||||
{
|
||||
require_once(e_PLUGIN.'calendar_menu/ecal_class.php');
|
||||
$ecal_class = new ecal_class;
|
||||
@ -45,8 +45,9 @@ if($cacheData = $e107->ecache->retrieve($cache_tag, $ecal_class->max_cache_time)
|
||||
|
||||
include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'.php');
|
||||
|
||||
e107::getScParser();
|
||||
require_once(e_PLUGIN.'calendar_menu/calendar_shortcodes.php');
|
||||
$calSc = new event_calendar_shortcodes();
|
||||
|
||||
if (is_readable(THEME.'calendar_template.php'))
|
||||
{ // Has to be require
|
||||
require(THEME.'calendar_template.php');
|
||||
@ -72,9 +73,7 @@ $end_time = $start_time + (86400 * $days_ahead) - 1;
|
||||
|
||||
$cal_text = '';
|
||||
|
||||
setScVar('event_calendar_shortcodes', 'ecalClass', &$ecal_class); // Give shortcodes a pointer to calendar class
|
||||
//callScFunc('event_calendar_shortcodes','setCalDate', $dateArray); // Tell shortcodes the date to display
|
||||
//setScVar('event_calendar_shortcodes', 'catFilter', $cat_filter); // Category filter
|
||||
$calSc->ecalClass = &$ecal_class; // Give shortcodes a pointer to calendar class
|
||||
|
||||
$ev_list = $ecal_class->get_n_events($show_count, $start_time, $end_time, varset($pref['eventpost_fe_set'],FALSE), $show_recurring,
|
||||
'event_id,event_start, event_thread, event_title, event_recurring, event_allday, event_category', 'event_cat_icon');
|
||||
@ -85,9 +84,9 @@ if ($cal_totev > 0)
|
||||
foreach ($ev_list as $thisEvent)
|
||||
{
|
||||
$cal_totev --; // Can use this to modify inter-event gap
|
||||
setScVar('event_calendar_shortcodes', 'numEvents', $cal_totev); // Number of events to display
|
||||
setScVar('event_calendar_shortcodes', 'event', $thisEvent); // Give shortcodes the event data
|
||||
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_FE_LINE,TRUE);
|
||||
$calSc->numEvents = $cal_totev; // Number of events to display
|
||||
$calSc->event = $thisEvent; // Give shortcodes the event data
|
||||
$cal_text .= $e107->tp->parseTemplate($EVENT_CAL_FE_LINE,FALSE, $calSc);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -25,7 +25,12 @@
|
||||
require_once('../../class2.php');
|
||||
$e107 = e107::getInstance();
|
||||
|
||||
if (!$e107->isInstalled('calendar_menu')) header('Location: '.e_BASE.'index.php');
|
||||
if (!$e107->isInstalled('calendar_menu'))
|
||||
{
|
||||
header('Location: '.e_BASE.'index.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
include_lan(e_PLUGIN .'calendar_menu/languages/'.e_LANGUAGE.'.php');
|
||||
global $pref;
|
||||
define('PAGE_NAME', EC_LAN_80);
|
||||
|
Loading…
x
Reference in New Issue
Block a user