本文整理汇总了PHP中Customization::isCurrentlyUsed方法的典型用法代码示例。如果您正苦于以下问题:PHP Customization::isCurrentlyUsed方法的具体用法?PHP Customization::isCurrentlyUsed怎么用?PHP Customization::isCurrentlyUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customization
的用法示例。
在下文中一共展示了Customization::isCurrentlyUsed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _deleteOldLabels
protected function _deleteOldLabels()
{
$max = array(Product::CUSTOMIZE_FILE => (int) Tools::getValue('uploadable_files'), Product::CUSTOMIZE_TEXTFIELD => (int) Tools::getValue('text_fields'));
/* Get customization field ids */
if (($result = Db::getInstance()->executeS('SELECT `id_customization_field`, `type`
FROM `' . _DB_PREFIX_ . 'customization_field`
WHERE `id_product` = ' . (int) $this->id . '
ORDER BY `id_customization_field`')) === false) {
return false;
}
if (empty($result)) {
return true;
}
$customization_fields = array(Product::CUSTOMIZE_FILE => array(), Product::CUSTOMIZE_TEXTFIELD => array());
foreach ($result as $row) {
$customization_fields[(int) $row['type']][] = (int) $row['id_customization_field'];
}
$extra_file = count($customization_fields[Product::CUSTOMIZE_FILE]) - $max[Product::CUSTOMIZE_FILE];
$extra_text = count($customization_fields[Product::CUSTOMIZE_TEXTFIELD]) - $max[Product::CUSTOMIZE_TEXTFIELD];
/* If too much inside the database, deletion */
if ($extra_file > 0 && count($customization_fields[Product::CUSTOMIZE_FILE]) - $extra_file >= 0 && (!Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'customization_field`
WHERE `id_product` = ' . (int) $this->id . '
AND `type` = ' . Product::CUSTOMIZE_FILE . '
AND `id_customization_field` >= ' . (int) $customization_fields[Product::CUSTOMIZE_FILE][count($customization_fields[Product::CUSTOMIZE_FILE]) - $extra_file]) || !Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'customization_field_lang`
WHERE `id_customization_field`
NOT IN (
SELECT `id_customization_field`
FROM `' . _DB_PREFIX_ . 'customization_field`
)'))) {
return false;
}
if ($extra_text > 0 && count($customization_fields[Product::CUSTOMIZE_TEXTFIELD]) - $extra_text >= 0 && (!Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'customization_field`
WHERE `id_product` = ' . (int) $this->id . '
AND `type` = ' . Product::CUSTOMIZE_TEXTFIELD . '
AND `id_customization_field` >= ' . (int) $customization_fields[Product::CUSTOMIZE_TEXTFIELD][count($customization_fields[Product::CUSTOMIZE_TEXTFIELD]) - $extra_text]) || !Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'customization_field_lang`
WHERE `id_customization_field`
NOT IN (
SELECT `id_customization_field`
FROM `' . _DB_PREFIX_ . 'customization_field`
)'))) {
return false;
}
// Refresh cache of feature detachable
Configuration::updateGlobalValue('PS_CUSTOMIZATION_FEATURE_ACTIVE', Customization::isCurrentlyUsed());
return true;
}