function getEvalPhpCode() { if (func_num_args() == 0) { return array('description' => t('Insert php code'), 'customonclick' => ExtendedContentParseInput::getTextInput(t('Insert php code below (without starting and ending tags, even if you can use them to put plain text)'))); } return eval(func_get_arg(0)); }
function getPostValue() { if (func_num_args() == 0) { return array('description' => t('Get POST value'), 'customonclick' => ExtendedContentParseInput::getTextInput(t('Insert post key name below'))); } return isset($_POST[func_get_arg(0)]) ? htmlentities($_POST[func_get_arg(0)], ENT_QUOTES) : ''; }
function getPageCustomAttribute() { if (func_num_args() == 0) { return array('description' => t('Page custom text attribute'), 'customonclick' => ExtendedContentParseInput::getTextInput(t('Insert attribute handle below'))); } $page = Page::getCurrentPage(); return $page->getCollectionAttributeValue(func_get_arg(0)); }
function getLastPageEditDate() { if (func_num_args() == 0) { return array('description' => t('Last site modification date'), 'customonclick' => ExtendedContentParseInput::getDateInput()); } Loader::model('page_statistics'); $time = strtotime(PageStatistics::getSiteLastEdit()); return strftime(func_get_arg(0), $time); }
function getPageCustomAttribute() { if (func_num_args() == 0) { return array('description' => t('Page custom text attribute'), 'customonclick' => ExtendedContentParseInput::getTextAndPageInput(t('Select desired page and insert attribute handle below'))); } $arg = func_get_arg(0); $split = split(",", $arg); $page = Page::getByID($split[1]); $page = Page::getCurrentPage(); return $page->getCollectionAttributeValue($split[0]); }
function getUserLastLogin() { if (func_num_args() == 0) { return array('description' => t('Last user login date'), 'customonclick' => ExtendedContentParseInput::getDateInput()); } Loader::model('user'); Loader::model('userinfo'); $u = new User(); if (empty($u->uID)) { return; } $time = UserInfo::getByID($u->uID)->uLastLogin; return strftime(func_get_arg(0), $time); }
function getGoogleLikeCustomPageButton() { if (func_num_args() == 0) { return array('description' => t('Get google +1 button for custom page'), 'customonclick' => ExtendedContentParseInput::getPageInput()); } global $c; $page = Page::getByID(func_get_arg(0)); $nh = Loader::helper('navigation'); $cpl = $nh->getCollectionURL($page); $language = 'en'; $package = Package::getByHandle('multilingual'); if ($package) { $lh = Loader::helper('section', 'multilingual'); $language = $lh->getLanguage(); } else { if (defined('LOCALE')) { $language = substr(LOCALE, 0, strpos(LOCALE, '_')); } } return ' <g:plusone size="medium" annotation="inline" href="' . $cpl . '"></g:plusone> <script type="text/javascript"> window.___gcfg = {lang: \'' . $language . '\'}; (function() { var po = document.createElement(\'script\'); po.type = \'text/javascript\'; po.async = true; po.src = \'https://apis.google.com/js/plusone.js\'; var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(po, s); })(); </script> '; }