本文整理汇总了PHP中XoopsTpl::clear_compiled_tpl方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsTpl::clear_compiled_tpl方法的具体用法?PHP XoopsTpl::clear_compiled_tpl怎么用?PHP XoopsTpl::clear_compiled_tpl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsTpl
的用法示例。
在下文中一共展示了XoopsTpl::clear_compiled_tpl方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeViewSuccess
function executeViewSuccess(&$controller, &$xoopsUser, &$render)
{
require_once XOOPS_ROOT_PATH . "/class/template.php";
$xoopsTpl = new XoopsTpl();
$xoopsTpl->clear_cache('db:' . $this->mObject->get('tpl_file'));
$xoopsTpl->clear_compiled_tpl('db:' . $this->mObject->get('tpl_file'));
$tplset = $this->mObject->get('tpl_tplset');
$module = $this->mObject->get('tpl_module');
$controller->executeForward("./index.php?action=TplfileList&tpl_tplset={$tplset}&tpl_module={$module}");
}
示例2: cacheClear
function cacheClear(&$module)
{
$handler =& xoops_getmodulehandler('tplfile', 'legacyRender');
$criteria = new Criteria('tpl_module', $module->get('dirname'));
$tplfileArr = $handler->getObjects($criteria);
$xoopsTpl = new XoopsTpl();
foreach (array_keys($tplfileArr) as $key) {
$xoopsTpl->clear_cache('db:' . $tplfileArr[$key]->get('tpl_file'));
$xoopsTpl->clear_compiled_tpl('db:' . $tplfileArr[$key]->get('tpl_file'));
}
}
示例3: pico_xoopstpl
function pico_xoopstpl($mydirname, $text, $content4assign)
{
global $xoopsTpl;
$tpl = new XoopsTpl();
//$tpl->plugins_dir[] = dirname(dirname(__FILE__)).'/smarty_plugins' ;
array_unshift($tpl->plugins_dir, dirname(dirname(__FILE__)) . '/smarty_plugins');
// pico plugin has the first priority
if (is_object(@$xoopsTpl)) {
$tpl->assign($xoopsTpl->get_template_vars());
if (defined('XOOPS_CUBE_LEGACY')) {
$root =& XCube_Root::getSingleton();
$context =& $root->getContext();
$themeName = $context->getThemeName();
$tpl->assign('xoops_theme', $themeName);
$tpl->assign('xoops_imageurl', XOOPS_THEME_URL . "/{$themeName}/");
$tpl->assign('xoops_themecss', xoops_getcss($themeName));
}
}
$tpl->assign('mydirname', $mydirname);
$tpl->assign('mod_url', XOOPS_URL . '/modules/' . $mydirname);
$tpl->assign('content', $content4assign);
// assign special session
$session_prefix = $mydirname . '_' . @$content4assign['id'] . '_';
$session4assign = array();
foreach (array_keys(@$_SESSION) as $index) {
if (strncmp($index, $session_prefix, strlen($session_prefix)) === 0) {
$session4assign[substr($index, strlen($session_prefix))] = $_SESSION[$index];
}
}
$tpl->assign('session', $session4assign);
$temp_file = XOOPS_COMPILE_PATH . '/' . substr(md5(XOOPS_DB_PREFIX . @$content4assign['id']), 16) . $mydirname . '_temp_resource';
if (!$text || $text != @file_get_contents($temp_file)) {
$fw = fopen($temp_file, 'wb');
fwrite($fw, $text);
fclose($fw);
$tpl->clear_compiled_tpl('file:' . $temp_file);
}
$text = $tpl->fetch('file:' . $temp_file);
// unlink( $temp_file ) ;
return $text;
}
示例4: count
$csscount = count($css);
for ($i = 0; $i < $csscount; $i++) {
$dummylayout .= "\n" . $css[$i]->getVar('tpl_source');
}
$dummylayout .= "\n" . '</style></head><body><{$content}></body></html>';
if ($tplfile->getVar('tpl_type') == 'block') {
include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
$block = new XoopsBlock($tplfile->getVar('tpl_refid'));
$xoopsTpl->assign('block', $block->buildBlock());
}
$dummytpl = '_dummytpl_' . time() . '.html';
$fp = fopen(XOOPS_CACHE_PATH . '/' . $dummytpl, 'w');
fwrite($fp, $html);
fclose($fp);
$xoopsTpl->assign('content', $xoopsTpl->fetch('file:' . XOOPS_CACHE_PATH . '/' . $dummytpl));
$xoopsTpl->clear_compiled_tpl('file:' . XOOPS_CACHE_PATH . '/' . $dummytpl);
unlink(XOOPS_CACHE_PATH . '/' . $dummytpl);
$dummyfile = '_dummy_' . time() . '.html';
$fp = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w');
fwrite($fp, $dummylayout);
fclose($fp);
$tplset = $tplfile->getVar('tpl_tplset');
$tform = array('tpl_tplset' => $tplset, 'tpl_id' => $id, 'tpl_file' => $tplfile->getVar('tpl_file'), 'tpl_desc' => $tplfile->getVar('tpl_desc'), 'tpl_lastmodified' => $tplfile->getVar('tpl_lastmodified'), 'tpl_source' => htmlspecialchars($html, ENT_QUOTES), 'tpl_module' => $moddir);
include_once XOOPS_ROOT_PATH . '/modules/system/admin/tplsets/tplform.php';
xoops_cp_header();
echo '<a href="admin.php?fct=tplsets">' . _MD_TPLMAIN . '</a> <span style="font-weight:bold;">»»</span> <a href="./admin.php?fct=tplsets&op=listtpl&moddir=' . $moddir . '&tplset=' . $tplset . '">' . $tplset . '</a> <span style="font-weight:bold;">»»</span> ' . _MD_EDITTEMPLATE . '<br /><br />';
$form->display();
xoops_cp_footer();
echo '<script type="text/javascript">
<!--//
preview_window = openWithSelfMain("", "popup", 680, 450, true);
示例5: count
xoops_module_write_admin_menu(xoops_module_get_admin_menu());
$lang_updated = true;
}
// if default theme has been changed
if (!$theme_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'theme_set') {
$member_handler =& xoops_gethandler('member');
$member_handler->updateUsersByField('theme', $_POST[$config->getVar('conf_name')]);
$theme_updated = true;
}
// if default template set has been changed
if (!$tpl_updated && $config->getVar('conf_catid') == XOOPS_CONF && $config->getVar('conf_name') == 'template_set') {
// clear cached/compiled files and regenerate them if default theme has been changed
if ($xoopsConfig['template_set'] != $_POST[$config->getVar('conf_name')]) {
$newtplset = $_POST[$config->getVar('conf_name')];
// clear all compiled and cachedfiles
$xoopsTpl->clear_compiled_tpl();
// generate compiled files for the new theme
// block files only for now..
$tplfile_handler =& xoops_gethandler('tplfile');
$dtemplates =& $tplfile_handler->find('default', 'block');
$dcount = count($dtemplates);
// need to do this to pass to xoops_template_touch function
$GLOBALS['xoopsConfig']['template_set'] = $newtplset;
for ($i = 0; $i < $dcount; $i++) {
$found =& $tplfile_handler->find($newtplset, 'block', $dtemplates[$i]->getVar('tpl_refid'), null);
if (count($found) > 0) {
// template for the new theme found, compile it
xoops_template_touch($found[0]->getVar('tpl_id'));
} else {
// not found, so compile 'default' template file
xoops_template_touch($dtemplates[$i]->getVar('tpl_id'));
示例6: xoops_template_touch
/**
* function to update compiled template file in templates_c folder
*
* @param string $tpl_id
* @param boolean $clear_old
* @return boolean
**/
function xoops_template_touch($tpl_id, $clear_old = true)
{
$result = null;
// RaiseEvent 'Legacy.XoopsTpl.TemplateTouch'
// Delegate may define new template touch logic (with XC21, only for clear cache & compiled template)
// varArgs :
// 'xoopsTpl' [I/O] : $this
//
XCube_DelegateUtils::call('Legacy.XoopsTpl.TemplateTouch', $tpl_id, $clear_old, new XCube_Ref($result));
if ($result === null) {
$tpl = new XoopsTpl();
$tpl->force_compile = true;
$tplfile_handler =& xoops_gethandler('tplfile');
$tplfile =& $tplfile_handler->get($tpl_id);
if (is_object($tplfile)) {
$file = $tplfile->getVar('tpl_file');
if ($clear_old) {
$tpl->clear_cache('db:' . $file);
$tpl->clear_compiled_tpl('db:' . $file);
}
// $tpl->fetch('db:'.$file);
return true;
}
return false;
} else {
return $result;
}
}
示例7: xoops_template_touch
/**
* function to update compiled template file in templates_c folder
*
* @param string $tpl_id
* @param boolean $clear_old
* @return boolean
**/
function xoops_template_touch($tpl_id, $clear_old = true)
{
$tpl = new XoopsTpl();
$tpl->force_compile = true;
$tplfile_handler =& xoops_gethandler('tplfile');
$tplfile =& $tplfile_handler->get($tpl_id);
if (is_object($tplfile)) {
$file = $tplfile->getVar('tpl_file');
if ($clear_old) {
$tpl->clear_cache('db:' . $file);
$tpl->clear_compiled_tpl('db:' . $file);
}
$tpl->fetch('db:' . $file);
return true;
}
return false;
}
示例8: XoopsTpl
$tpl = new XoopsTpl();
$tpl->force_compile = true;
foreach ($_POST["{$tplset_from}_check"] as $tplfile_tmp => $val) {
if (empty($val)) {
continue;
}
$tplfile = $myts->stripSlashesGPC($tplfile_tmp);
$result = $db->query("SELECT tpl_id FROM " . $db->prefix("tplfile") . " WHERE tpl_tplset='" . addslashes($tplset_from) . "' AND tpl_file='" . addslashes($tplfile) . "'");
while (list($tpl_id) = $db->fetchRow($result)) {
$tpl_id = intval($tpl_id);
$db->query("DELETE FROM " . $db->prefix("tplfile") . " WHERE tpl_id={$tpl_id}");
$db->query("DELETE FROM " . $db->prefix("tplsource") . " WHERE tpl_id={$tpl_id}");
}
// remove templates_c
$tpl->clear_cache('db:' . $tplfile);
$tpl->clear_compiled_tpl('db:' . $tplfile);
}
redirect_header('?mode=admin&lib=altsys&page=mytplsadmin&dirname=' . $target_dirname, 1, _MYTPLSADMIN_DBUPDATED);
exit;
}
}
}
//************//
// GET stage //
//************//
// get tplsets
$tplset_handler =& xoops_gethandler('tplset');
$tplsets = array_keys($tplset_handler->getList());
$sql = "SELECT distinct tpl_tplset FROM " . $db->prefix("tplfile") . " ORDER BY tpl_tplset='default' DESC,tpl_tplset";
$srs = $db->query($sql);
while (list($tplset) = $db->fetchRow($srs)) {
示例9: execute
/**
* This member function processes the uploaded file.
*/
function execute(&$controller, &$xoopsUser)
{
require_once XOOPS_ROOT_PATH . "/class/template.php";
$this->mActionForm->fetch();
$this->mActionForm->validate();
if ($this->mActionForm->hasError()) {
return $this->getDefaultView($controller, $xoopsUser);
}
$formFileArr = $this->mActionForm->get('upload');
//
// Set tpl_module and tpl_tplset of the last object to the following variable for redirect.
//
$last_tplset = null;
$last_module = null;
$handler =& xoops_getmodulehandler('tplfile');
$successFlag = true;
foreach (array_keys($formFileArr) as $key) {
$formFile =& $formFileArr[$key];
$obj =& $handler->get($key);
if ($obj == null) {
continue;
}
//
// If $obj belongs to 'default' template-set, kick!
//
if ($obj->get('tpl_tplset') == 'default') {
continue;
}
$obj->loadSource();
$last_tplset = $obj->get('tpl_tplset');
$last_module = $obj->get('tpl_module');
//
// [Warning] Access to a private property of XCube_FormFile.
//
if ($formFile != null) {
$source = file_get_contents($formFile->_mTmpFileName);
$obj->Source->set('tpl_source', $source);
$obj->set('tpl_lastmodified', time());
$obj->set('tpl_lastimported', time());
$successFlag &= $handler->insert($obj);
$xoopsTpl = new XoopsTpl();
$xoopsTpl->clear_cache('db:' . $obj->get('tpl_file'));
$xoopsTpl->clear_compiled_tpl('db:' . $obj->get('tpl_file'));
}
unset($obj);
unset($formFile);
}
$errorMessage = $successFlag ? _AD_LEGACYRENDER_MESSAGE_UPLOAD_TEMPLATE_SUCCESS : _AD_LEGACYRENDER_ERROR_DBUPDATE_FAILED;
//
// No good exmaple ;)
// Because some local variables are used, jump directly without the return value of view status.
//
$controller->executeRedirect("index.php?action=TplfileList&tpl_tplset={$last_tplset}&tpl_module={$last_module}", 1, $errorMessage);
}