public static function Initialise() { utopia::RegisterAjax('fileManagerAjax', 'uUploads::ajax'); utopia::AddInputType(itFILEMANAGER, 'uUploads::show_fileman'); jqFileManager::SetDocRoot(PATH_ABS_ROOT); jqFileManager::SetRelRoot(PATH_REL_ROOT); uJavascript::IncludeFile(jqFileManager::GetPathJS()); uCSS::IncludeFile(jqFileManager::GetPathCSS()); }
public static function AddItem($menu = FALSE, $body = FALSE, $order = null, $class = '') { if ($order === null) { $order = count(self::$items); } uCSS::LinkFile(dirname(__FILE__) . '/adminbar.css', 999); uJavascript::LinkFile(dirname(__FILE__) . '/adminbar.js'); self::$items[] = array('menu' => $menu, 'body' => $body, 'order' => $order, 'class' => $class); }
public static function Initialise() { uCSS::IncludeFile(dirname(__FILE__) . '/toggleSwitch.css'); uJavascript::IncludeFile(dirname(__FILE__) . '/toggleSwitch.js'); uJavascript::IncludeText(<<<FIN utopia.Initialise.add(function () { \$(".inputtype-itONOFF:not(.switched)").addClass("switched").toggleSwitch('onoff');}); utopia.Initialise.add(function () { \$(".inputtype-itYESNO:not(.switched)").addClass("switched").toggleSwitch('yesno');}); FIN ); }
public static function Initialise() { uCSS::IncludeFile(utopia::GetRelativePath(dirname(__FILE__) . '/cms.css')); $nTemplates = utopia::GetTemplates(false, true); $dTemplate = '/' . basename(PATH_REL_CORE) . '/themes/default'; modOpts::AddOption('default_template', 'Default Template', NULL, $dTemplate, itCOMBO, $nTemplates); utopia::RegisterAjax('reorderCMS', 'uCMS_List::reorderCMS'); uUserRoles::LinkRoles('Page Editor', array('uCMS_List', 'uCMS_Edit')); self::AddParent('/'); }
public static function Initialise() { utopia::AddTemplateParser('login_user', 'uUserLogin::GetLoginUserBox', ''); utopia::AddTemplateParser('login_pass', 'uUserLogin::GetLoginPassBox', ''); utopia::AddTemplateParser('login_status', 'uUserLogin::GetLoginStatus', ''); utopia::AddTemplateParser('login', 'uUserLogin::LoginForm', '', true); uEvents::AddCallback('BeforeRunModule', 'uUserLogin::checkLogin'); uCSS::IncludeFile(dirname(__FILE__) . '/login.css'); uEvents::AddCallback('AfterInit', 'uUserLogin::CheckSession'); }
public static function Initialise() { utopia::AddInputType(itRICHTEXT, 'module_CKEditor::drti_func'); utopia::AddInputType(itHTML, 'module_CKEditor::drti_func'); uJavascript::IncludeFile(dirname(__FILE__) . '/lib/ckeditor.js', 1000); uJavascript::IncludeFile(dirname(__FILE__) . '/ckeditor.js', 1005); uCSS::IncludeFile(dirname(__FILE__) . '/ckeditor.css'); uEvents::AddCallback('AfterRunModule', 'module_CKEditor::MediaScript', 'fileManager'); $basepath = utopia::GetRelativePath(dirname(__FILE__) . '/lib/'); uJavascript::IncludeText(<<<FIN var CKEDITOR_BASEPATH = '{$basepath}/'; var FILE_BROWSE_URL = PATH_REL_CORE+'index.php?__ajax=media'; FIN ); }
public static function Init() { uCSS::IncludeFile(dirname(__FILE__) . '/notices.css'); uJavascript::IncludeFile(dirname(__FILE__) . '/notices.js'); }
public static function OutputTemplate() { uEvents::TriggerEvent('BeforeOutputTemplate'); if (!self::UsingTemplate()) { ob_end_clean(); echo utopia::GetVar('content'); return; } if (isset($_GET['inline']) && !is_numeric($_GET['inline'])) { $_GET['inline'] = 0; } if (self::UsingTemplate(TEMPLATE_BLANK) || isset($_GET['inline']) && $_GET['inline'] == 0) { $template = utopia::GetVar('content'); } else { $tCount = -1; // do all by default if (isset($_GET['inline'])) { $tCount = $_GET['inline'] - 1; } $template = ''; $css = self::GetTemplateCSS(); foreach ($css as $cssfile) { uCSS::LinkFile($cssfile); } // first get list of parents $templates = array(); $templateDir = utopia::GetTemplateDir(true); if (!file_exists($templateDir)) { $templateDir = utopia::GetAbsolutePath($templateDir); } if (file_exists($templateDir)) { $templates[] = $templateDir; } while ($tCount-- && file_exists($templateDir . '/template.ini')) { $inifile = parse_ini_file($templateDir . '/template.ini'); if (!isset($inifile['parent'])) { break; } if (file_exists(PATH_ABS_ROOT . $inifile['parent'])) { $templateDir = PATH_ABS_ROOT . $inifile['parent']; } else { $templateDir = dirname($templateDir) . '/' . $inifile['parent']; } $templates[] = $templateDir; } foreach ($templates as $templateDir) { // set templatedir self::SetVar('templatedir', self::GetRelativePath($templateDir)); $templatePath = $templateDir . '/template.php'; $template = get_include_contents($templatePath); // mergevars while (self::MergeVars($template)) { } // setvar self::SetVar('content', $template); } if (!$template) { $template = '{utopia.content}'; } } ob_end_clean(); while (self::MergeVars($template)) { } $template = str_replace('<head>', '<head>' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>', $template); // Make all resources secure if (self::IsRequestSecure()) { $template = str_replace('http://' . self::GetDomainName(), 'https://' . self::GetDomainName(), $template); } do { if (self::UsingTemplate() && class_exists('DOMDocument')) { libxml_use_internal_errors(true); $doc = new DOMDocument(); $doc->formatOutput = false; $doc->preserveWhiteSpace = true; $doc->validateOnParse = true; if (!$doc->loadHTML('<?xml encoding="UTF-8">' . utf8_decode($template))) { break; } $isSnip = stripos($template, '<html') === false; $doc->encoding = 'UTF-8'; // no html tag? break out. if (!$doc->getElementsByTagName('html')->length) { break; } // remove multiple xmlns attributes $doc->documentElement->removeAttributeNS(NULL, 'xmlns'); // assert BODY tag if (!$doc->getElementsByTagName('body')->length) { $node = $doc->createElement("body"); $doc->getElementsByTagName('html')->item(0)->appendChild($node); } // assert HEAD tag if (!$doc->getElementsByTagName('head')->length) { // create head node $node = $doc->createElement("head"); $body = $doc->getElementsByTagName('body')->item(0); $newnode = $body->parentNode->insertBefore($node, $body); } // add HEAD children $head = $doc->getElementsByTagName('head')->item(0); // set title if (!$head->getElementsByTagName('title')->length) { $node = $doc->createElement('title'); $node->appendChild($doc->createTextNode(utopia::GetTitle(true))); $head->appendChild($node); } if (utopia::GetDescription(true)) { $node = $doc->createElement('meta'); $node->setAttribute('name', 'description'); $node->setAttribute('content', utopia::GetDescription(true)); $head->appendChild($node); } if (utopia::GetKeywords(true)) { $node = $doc->createElement('meta'); $node->setAttribute('name', 'keywords'); $node->setAttribute('content', utopia::GetKeywords(true)); $head->appendChild($node); } $node = $doc->createElement('meta'); $node->setAttribute('name', 'generator'); $node->setAttribute('content', 'uCore PHP Framework'); $head->appendChild($node); // template is all done, now lets run a post process event try { uEvents::TriggerEvent('ProcessDomDocument', null, array(&$doc)); } catch (Exception $e) { uErrorHandler::EchoException($e); } $ctNode = null; foreach ($head->getElementsByTagName('meta') as $meta) { if ($meta->hasAttribute('http-equiv') && strtolower($meta->getAttribute('http-equiv')) == 'content-type') { $ctNode = $meta; break; } } if (!$ctNode) { $ctNode = $doc->createElement('meta'); $head->appendChild($ctNode); } $ctNode->setAttribute('http-equiv', 'content-type'); $ctNode->setAttribute('content', 'text/html;charset=' . CHARSET_ENCODING); if ($ctNode !== $head->firstChild) { $head->insertBefore($ctNode, $head->firstChild); } $doc->normalizeDocument(); if (strpos(strtolower($doc->doctype->publicId), ' xhtml ')) { $template = $doc->saveXML(); } else { $template = $doc->saveHTML(); } $template = preg_replace('/<\\?xml encoding="UTF-8"\\??>\\n?/i', '', $template); if ($isSnip && !self::$noSnip) { $template = preg_replace('/.*<body[^>]*>\\s*/ims', '', $template); // remove everything up to and including the body open tag $template = preg_replace('/\\s*<\\/body>.*/ims', '', $template); // remove everything after and including the body close tag } } } while (false); while (self::MergeVars($template)) { } if (isset($_GET['callback'])) { $output = json_encode(array('title' => self::GetTitle(true), 'content' => $template)); header('Content-Type: application/javascript'); echo $_GET['callback'] . '(' . $output . ')'; return; } echo $template; }
function SetupParents() { $this->SetRewrite(array('{adv}', '{q}')); uCSS::IncludeFile(dirname(__FILE__) . '/search.css'); }
<?php uJavascript::IncludeFile(dirname(__FILE__) . '/lib/plupload.full.js'); uJavascript::IncludeFile(dirname(__FILE__) . '/lib/jquery.ui.plupload/jquery.ui.plupload.js'); uCSS::IncludeFile(dirname(__FILE__) . '/lib/jquery.ui.plupload/css/jquery.ui.plupload.css'); class uPlupload { static function Init($jsVarName, $uploadPath) { $pathCore = PATH_REL_CORE; uJavascript::AddText(<<<FIN var {$jsVarName} = { runtimes : 'html5,flash,browserplus,html4', chunk_size : '1mb', url : '{$uploadPath}', flash_swf_url : '{$pathCore}modules/plupload/lib/plupload.flash.swf' }; FIN ); } }
function initialiseTreesort() { uJavascript::IncludeFile(utopia::GetRelativePath(dirname(__FILE__) . '/jquery.treeSort.js')); uCSS::IncludeFile(utopia::GetRelativePath(dirname(__FILE__) . '/jquery.treeSort.css')); }
public function RunModule() { utopia::CancelTemplate(); clearstatcache(); $uStr = ''; self::$includeFiles = array_unique(self::$includeFiles); foreach (self::$includeFiles as $filename) { //does it exist? if (!file_exists($filename)) { continue; } $uStr .= $filename . filemtime($filename) . '-' . filesize($filename); } $identifiers = array($_SERVER['REQUEST_URI'], $uStr, count(self::$includeFiles), PATH_REL_CORE); $etag = utopia::checksum($identifiers); utopia::Cache_Check($etag, 'text/css', $this->GetUUID()); $out = uCache::retrieve($identifiers); if ($out) { $out = file_get_contents($out); } else { $out = self::BuildCSS(true); uCache::store($identifiers, $out); } utopia::Cache_Output($out, $etag, 'text/css', $this->GetUUID()); }
static function AddStyles() { uCSS::IncludeFile(dirname(__FILE__) . '/menu.css'); uJavascript::IncludeFile(dirname(__FILE__) . '/menu.js'); }