本文整理汇总了PHP中Tools::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::clearCache方法的具体用法?PHP Tools::clearCache怎么用?PHP Tools::clearCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::clearCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitHomeFeatured')) {
$nbr = Tools::getValue('HOME_FEATURED_NBR');
if (!Validate::isInt($nbr) || $nbr <= 0) {
$errors[] = $this->l('The number of products is invalid. Please enter a positive number.');
}
$cat = Tools::getValue('HOME_FEATURED_CAT');
if (!Validate::isInt($cat) || $cat <= 0) {
$errors[] = $this->l('The category ID is invalid. Please choose an existing category ID.');
}
$rand = Tools::getValue('HOME_FEATURED_RANDOMIZE');
if (!Validate::isBool($rand)) {
$errors[] = $this->l('Invalid value for the "randomize" flag.');
}
if (isset($errors) && count($errors)) {
$output = $this->displayError(implode('<br />', $errors));
} else {
Configuration::updateValue('HOME_FEATURED_NBR', (int) $nbr);
Configuration::updateValue('HOME_FEATURED_CAT', (int) $cat);
Configuration::updateValue('HOME_FEATURED_RANDOMIZE', (bool) $rand);
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
$output = $this->displayConfirmation($this->l('Your settings have been updated.'));
}
}
return $output . $this->renderForm();
}
示例2: upgrade_module_0_9
function upgrade_module_0_9($module)
{
$module_path = $module->getLocalPath();
$img_folder_path = $module->getLocalPath() . 'img';
$fixture_img_path = $module->getLocalPath() . 'img' . DIRECTORY_SEPARATOR . 'fixtures';
if (!Tools::file_exists_cache($img_folder_path)) {
mkdir($img_folder_path);
}
if (!Tools::file_exists_cache($fixture_img_path)) {
mkdir($fixture_img_path);
}
$files = scandir($module->getLocalPath());
foreach ($files as $file) {
if (strncmp($file, 'advertising', 11) == 0) {
if ($file == 'advertising.jpg') {
copy($module_path . $file, $fixture_img_path . DIRECTORY_SEPARATOR . $file);
} else {
copy($module_path . $file, $img_folder_path . DIRECTORY_SEPARATOR . $file);
}
unlink($module_path . $file);
}
}
Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('blockadvertising.tpl'));
return true;
}
示例3: upgrade_module_1_3_4
function upgrade_module_1_3_4($module)
{
if (Tools::file_exists_cache($module->getLocalPath() . 'img')) {
recurseCopy($module->getLocalPath() . 'img', $module->getLocalPath() . 'images', true);
}
Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('homeslider.tpl'));
return true;
}
示例4: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitSmartBlogAddThis')) {
$api_kay = Tools::getValue('SMARTBBLOG_ADD_THIS_API_KEY');
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('smartblogaddthisbutton.tpl'));
Configuration::updateValue('SMARTBBLOG_ADD_THIS_API_KEY', $api_kay);
$output .= $this->displayConfirmation($this->l('Your settings have been updated.'));
}
return $output . $this->renderForm();
}
示例5: upgrade_module_1_3_8
function upgrade_module_1_3_8($module)
{
// Only img present, just need to rename folder
if (file_exists($module->getLocalPath() . 'img') && !file_exists($module->getLocalPath() . 'images')) {
rename($module->getLocalPath() . 'img', $module->getLocalPath() . 'images');
} else {
if (file_exists($module->getLocalPath() . 'img') && file_exists($module->getLocalPath() . 'images')) {
recurseCopy($module->getLocalPath() . 'img', $module->getLocalPath() . 'images', true);
}
}
Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('homeslider.tpl'));
return true;
}
示例6: getContent
public function getContent()
{
$output = '';
$errors = array();
$languages = Language::getLanguages();
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
$id_lang = $this->context->language->id;
if (Tools::isSubmit('submitGlobal')) {
Configuration::updateValue('DEALS', Tools::getValue('DEALS'));
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('discountproducts_home.tpl'));
$output .= $this->displayConfirmation($this->l('Your settings have been updated.'));
}
$output .= $this->displayForm();
return $output;
}
示例7: upgrade_module_2_5
function upgrade_module_2_5($module)
{
$module_path = $module->getLocalPath();
$img_folder_path = $module->getLocalPath() . 'img';
if (!Tools::file_exists_cache($img_folder_path)) {
mkdir($img_folder_path);
}
$files = scandir($module->getLocalPath());
foreach ($files as $file) {
if (strncmp($file, 'homepage_logo', 13) == 0) {
copy($module_path . $file, $img_folder_path . DIRECTORY_SEPARATOR . $file);
unlink($module_path . $file);
}
}
Tools::clearCache(Context::getContext()->smarty, $module->getTemplatePath('editorial.tpl'));
return true;
}
示例8: getContent
public function getContent()
{
$output = '';
$errors = array();
if (Tools::isSubmit('submitHomeFeatured')) {
$nbr = (int) Tools::getValue('HOME_FEATURED_NBR');
if (!$nbr || $nbr <= 0 || !Validate::isInt($nbr)) {
$errors[] = $this->l('An invalid number of products has been specified.');
} else {
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('homefeatured.tpl'));
Configuration::updateValue('HOME_FEATURED_NBR', (int) $nbr);
}
if (isset($errors) && count($errors)) {
$output .= $this->displayError(implode('<br />', $errors));
} else {
$output .= $this->displayConfirmation($this->l('Your settings have been updated.'));
}
}
return $output . $this->renderForm();
}
示例9: updateBlockPosition
public function updateBlockPosition($order = null)
{
if (is_null($order)) {
return false;
}
$position = explode('::', $order);
$res = false;
if (count($position) > 0) {
foreach ($position as $key => $id_block) {
$res = Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'advance_topmenu_blocks`
SET `position` = ' . $key . '
WHERE `id_block` = ' . (int) $id_block);
if (!$res) {
break;
}
}
}
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('topmenu.tpl'));
return $res;
}
示例10: _deferedClearCache
public static function _deferedClearCache($template_path, $cache_id, $compile_id)
{
Tools::enableCache();
$number_of_template_cleared = Tools::clearCache(Context::getContext()->smarty, $template_path, $cache_id, $compile_id);
Tools::restoreCacheSettings();
return $number_of_template_cleared;
}
示例11: clearSmartyCache
public function clearSmartyCache()
{
Tools::enableCache();
Tools::clearCache($this->context->smarty);
Tools::restoreCacheSettings();
}
示例12: updateOptionPsRewritingSettings
/**
* Called when PS_REWRITING_SETTINGS option is saved
*/
public function updateOptionPsRewritingSettings()
{
Configuration::updateValue('PS_REWRITING_SETTINGS', (int) Tools::getValue('PS_REWRITING_SETTINGS'));
if (Tools::generateHtaccess($this->ht_file, null, null, '', Tools::getValue('PS_HTACCESS_DISABLE_MULTIVIEWS'), false, Tools::getValue('PS_HTACCESS_DISABLE_MODSEC'))) {
Tools::enableCache();
Tools::clearCache($this->context->smarty);
Tools::restoreCacheSettings();
} else {
Configuration::updateValue('PS_REWRITING_SETTINGS', 0);
// Message copied/pasted from the information tip
$message = $this->l('Before being able to use this tool, you need to:');
$message .= '<br />- ' . $this->l('Create a blank .htaccess in your root directory.');
$message .= '<br />- ' . $this->l('Give it write permissions (CHMOD 666 on Unix system)');
$this->errors[] = $message;
}
}
示例13: _clearCache
protected function _clearCache($template, $cacheId = NULL, $compileId = NULL)
{
global $smarty;
Tools::clearCache($smarty);
}
示例14: getContent
public function getContent()
{
$output = '';
$errors = array();
$languages = Language::getLanguages();
$id_lang_default = (int) Configuration::get('PS_LANG_DEFAULT');
$id_lang = $this->context->language->id;
if (Tools::getValue('confirm_msg')) {
$output .= $this->displayConfirmation(Tools::getValue('confirm_msg'));
}
if (Tools::isSubmit('submitGlobal')) {
$id_position = (int) Tools::getValue('id_position', 1);
$html_id = $this->getHtmlIdByPosition($id_position);
if ($html_id && count($html_id) > 0) {
$htmlObject = new HtmlObject($html_id['id_htmlobject']);
} else {
$htmlObject = new HtmlObject();
}
$htmlObject->active = (int) Tools::getValue('active');
//$hook_postition
$htmlObject->hook_postition = (int) Tools::getValue('id_position');
foreach ($languages as $language) {
$htmlObject->title[$language['id_lang']] = Tools::getValue('item_title_' . $language['id_lang']);
$htmlObject->content[$language['id_lang']] = Tools::getValue('item_html_' . $language['id_lang']);
}
if (!$errors || count($errors) < 1) {
/* Update */
if ($html_id && count($html_id) > 0) {
if (!$htmlObject->update()) {
$errors[] = $this->displayError($this->l('The Advertising slide could not be updated.'));
}
} elseif (!$htmlObject->add()) {
$errors[] = $this->displayError($this->l('The Advertising slide could not be add.'));
}
/* Adds */
}
if (!isset($errors) || count($errors) < 1) {
if ($html_id && count($html_id) > 0) {
$confirm_msg = $this->l('Slide successfully updated.');
} else {
$confirm_msg = $this->l('New slide successfully added.');
}
Tools::clearCache(Context::getContext()->smarty, $this->getTemplatePath('blockhtml.tpl'));
Tools::redirectAdmin(AdminController::$currentIndex . '&configure=' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&confirm_msg=' . $confirm_msg . '&id_position=' . $id_position);
}
}
if (isset($errors) && count($errors)) {
$output .= $this->displayError(implode('<br />', $errors));
}
return $output . $this->displayForm();
}
示例15: postProcess
/**
* This functions make checks about AdminThemes configuration edition only.
*
* @since 1.4
*/
public function postProcess()
{
// new check compatibility theme feature (1.4) :
$val = Tools::getValue('PS_THEME');
Configuration::updateValue('PS_IMG_UPDATE_TIME', time());
if (!empty($val) && !$this->_isThemeCompatible($val)) {
// don't submit if errors
unset($_POST['submitThemes' . $this->table]);
}
Tools::clearCache($this->context->smarty);
parent::postProcess();
}