var
*/
function parse_ifblogsetting($name,$value=1) {
$this->_addIfCondition(($this->blog->getSetting($name) == $value));
}
function parse_ifitemproperty($name,$value=1) {
$this->_addIfCondition(($this->variables[$name] == $value));
}
function parse_ifautosave($name,$value=1) {
global $member;
$this->_addIfCondition($member->getAutosave() == $value);
}
function parse_helplink($topic) {
help($topic);
}
// for future items
function parse_currenttime($what) {
$nu = getdate($this->blog->getCorrectTime());
echo $nu[$what];
}
// date change on edit item
function parse_itemtime($what) {
$itemtime = getdate($this->variables['timestamp']);
echo $itemtime[$what];
}
// some init stuff for all forms
function parse_init() {
$authorid = ($this->method == 'edit') ? $this->variables['authorid'] : '';
$this->blog->insertJavaScriptInfo($authorid);
}
// on bookmarklets only: insert extra html header information (by plugins)
function parse_extrahead() {
global $manager;
$extrahead = '';
$manager->notify(
'BookmarkletExtraHead',
array(
'extrahead' => &$extrahead
)
);
echo $extrahead;
}
// inserts some localized text
function parse_text($which) {
// constant($which) only available from 4.0.4 :(
if (defined($which)) {
eval("echo $which;");
} else {
echo $which; // this way we see where definitions are missing
}
}
function parse_contents($which) {
echo htmlspecialchars($this->variables[$which],ENT_QUOTES);
}
function parse_checkedonval($value, $name) {
if ($this->variables[$name] == $value)
echo 'checked="checked"';
}
// extra javascript for input and textarea fields
function parse_jsinput($which) {
global $CONF;
$out = 'name="' . $which . '" id="input' . $which . '"';
if ($CONF['DisableJsTools'] != 1) {
$out .= 'onkeyup="storeCaret(this); updPreview(' . $which . '); doMonitor();"'
. 'onclick="storeCaret(this);"'
. 'onselect="storeCaret(this);"';
} elseif ($CONF['DisableJsTools'] == 0) {
$out .= ' onkeyup="doMonitor();" onkeypress="shortCuts();"';
} else {
$out .= ' onkeyup="doMonitor();"';
}
echo $out;
}
// shows the javascript button bar
function parse_jsbuttonbar($extrabuttons = "") {
global $CONF;
switch($CONF['DisableJsTools']) {
case "0":
echo '';
$this->_jsbutton('cut','cutThis()',_ADD_CUT_TT . " (Ctrl + X)");
$this->_jsbutton('copy','copyThis()',_ADD_COPY_TT . " (Ctrl + C)");
$this->_jsbutton('paste','pasteThis()',_ADD_PASTE_TT . " (Ctrl + V)");
$this->_jsbuttonspacer();
$this->_jsbutton('bold',"boldThis()",_ADD_BOLD_TT ." (Ctrl + Shift + B)");
$this->_jsbutton('italic',"italicThis()",_ADD_ITALIC_TT ." (Ctrl + Shift + I)");
$this->_jsbutton('link',"ahrefThis()",_ADD_HREF_TT ." (Ctrl + Shift + A)");
$this->_jsbuttonspacer();
$this->_jsbutton('alignleft',"alignleftThis()",_ADD_ALIGNLEFT_TT);
$this->_jsbutton('alignright',"alignrightThis()",_ADD_ALIGNRIGHT_TT);
$this->_jsbutton('aligncenter',"aligncenterThis()",_ADD_ALIGNCENTER_TT);
$this->_jsbuttonspacer();
$this->_jsbutton('left',"leftThis()",_ADD_LEFT_TT);
$this->_jsbutton('right',"rightThis()",_ADD_RIGHT_TT);
if ($extrabuttons) {
$btns = explode('+',$extrabuttons);
$this->_jsbuttonspacer();
foreach ($btns as $button) {
switch($button) {
case "media":
$this->_jsbutton('media',"addMedia()",_ADD_MEDIA_TT . " (Ctrl + Shift + M)");
break;
case "preview":
$this->_jsbutton('preview',"showedit()",_ADD_PREVIEW_TT);
break;
}
}
}
echo '
';
break;
case "2":
echo '';
$this->_jsbutton('bold',"boldThis()",_ADD_BOLD_TT);
$this->_jsbutton('italic',"italicThis()",_ADD_ITALIC_TT);
$this->_jsbutton('link',"ahrefThis()",_ADD_HREF_TT);
$this->_jsbuttonspacer();
$this->_jsbutton('alignleft',"alignleftThis()",_ADD_ALIGNLEFT_TT);
$this->_jsbutton('alignright',"alignrightThis()",_ADD_ALIGNRIGHT_TT);
$this->_jsbutton('aligncenter',"aligncenterThis()",_ADD_ALIGNCENTER_TT);
$this->_jsbuttonspacer();
$this->_jsbutton('left',"leftThis()",_ADD_LEFT_TT);
$this->_jsbutton('right',"rightThis()",_ADD_RIGHT_TT);
if ($extrabuttons) {
$btns = explode('+',$extrabuttons);
$this->_jsbuttonspacer();
foreach ($btns as $button) {
switch($button) {
case "media":
$this->_jsbutton('media',"addMedia()",_ADD_MEDIA_TT);
break;
}
}
}
echo '
';
break;
}
}
/**
* Allows plugins to add their own custom fields
*/
function parse_pluginextras() {
global $manager;
switch ($this->method) {
case 'add':
$manager->notify('AddItemFormExtras',
array(
'blog' => &$this->blog
)
);
break;
case 'edit':
$manager->notify('EditItemFormExtras',
array(
'variables' => $this->variables,
'blog' => &$this->blog,
'itemid' => $this->variables['itemid']
)
);
break;
}
}
/**
* Adds the itemOptions of a plugin to a page
* @author TeRanEX
*/
function parse_itemoptions() {
global $itemid;
ADMIN::_insertPluginOptions('item', $itemid);
}
function parse_ticket() {
global $manager;
$manager->addTicketHidden();
}
/**
* convenience method
*/
function _jsbutton($type, $code ,$tooltip) {
echo <<<__JSBUTTON__
__JSBUTTON__;
}
function _jsbuttonspacer() {
echo ' ';
}
}
?>