本文整理汇总了PHP中XenForo_Template_Compiler::resetPhraseCache方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Compiler::resetPhraseCache方法的具体用法?PHP XenForo_Template_Compiler::resetPhraseCache怎么用?PHP XenForo_Template_Compiler::resetPhraseCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Compiler
的用法示例。
在下文中一共展示了XenForo_Template_Compiler::resetPhraseCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importPhrasesXml
/**
* Internal function to import phrase XML. This does not remove any phrases
* that may conflict; that is the responsibility of the caller.
*
* @param SimpleXMLElement $xml Root XML node; must have "phrase" children
* @param integer $languageId Target language ID
* @param string|null $addOnId Add-on the phrases belong to; if null, read from xml
* @param array $existingPhrases Existing phrases; used to detect and resolve conflicts
* @param integer $maxExecution Maximum run time in seconds
* @param integer $offset Number of elements to skip
*/
public function importPhrasesXml(SimpleXMLElement $xml, $languageId, $addOnId = null, array $existingPhrases = array(), $maxExecution = 0, $offset = 0)
{
$startTime = microtime(true);
$phrases = XenForo_Helper_DevelopmentXml::fixPhpBug50670($xml->phrase);
$current = 0;
$restartOffset = false;
foreach ($phrases as $phrase) {
$current++;
if ($current <= $offset) {
continue;
}
$title = (string) $phrase['title'];
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Phrase');
if (isset($existingPhrases[$title])) {
if ($languageId == 0 && $existingPhrases[$title]['addon_id'] == 'XenForo' && $addOnId != 'XenForo') {
// trying to overwrite a built in phrase - don't let it
continue;
}
$dw->setExistingData($existingPhrases[$title], true);
}
$dw->setOption(XenForo_DataWriter_Phrase::OPTION_DEV_OUTPUT_DIR, '');
$dw->setOption(XenForo_DataWriter_Phrase::OPTION_REBUILD_LANGUAGE_CACHE, false);
$dw->setOption(XenForo_DataWriter_Phrase::OPTION_FULL_RECOMPILE, false);
$dw->setOption(XenForo_DataWriter_Phrase::OPTION_REBUILD_PHRASE_MAP, false);
$dw->setOption(XenForo_DataWriter_Phrase::OPTION_CHECK_DUPLICATE, false);
$dw->bulkSet(array('title' => $title, 'phrase_text' => (string) $phrase, 'global_cache' => (int) $phrase['global_cache'], 'version_id' => (int) $phrase['version_id'], 'version_string' => (string) $phrase['version_string'], 'language_id' => $languageId, 'addon_id' => $addOnId === null ? (string) $phrase['addon_id'] : $addOnId));
$dw->save();
if ($maxExecution && microtime(true) - $startTime > $maxExecution) {
$restartOffset = $current;
break;
}
}
XenForo_Template_Compiler::resetPhraseCache();
if (!$restartOffset) {
$this->_getLanguageModel()->rebuildLanguageCaches();
}
return $restartOffset ? $restartOffset : true;
}
示例2: _recompileTemplatesIncludingPhrase
/**
* Recompiles all templates (admin and public) that include this phrase.
*/
protected function _recompileTemplatesIncludingPhrase()
{
XenForo_Template_Compiler::resetPhraseCache();
$templateModel = $this->_getTemplateModel();
$adminTemplateModel = $this->_getAdminTemplateModel();
$emailTemplateModel = $this->_getEmailTemplateModel();
$title = $this->get('title');
$templateModel->compileTemplatesThatIncludePhrase($title);
$adminTemplateModel->compileAdminTemplatesThatIncludePhrase($title);
$emailTemplateModel->compileEmailTemplatesThatIncludePhrase($title);
if ($this->isChanged('title') && $this->isUpdate()) {
$existingTitle = $this->getExisting('title');
$templateModel->compileTemplatesThatIncludePhrase($existingTitle);
$adminTemplateModel->compileAdminTemplatesThatIncludePhrase($existingTitle);
$emailTemplateModel->compileEmailTemplatesThatIncludePhrase($existingTitle);
}
}