本文整理匯總了PHP中ImageType::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageType::getAll方法的具體用法?PHP ImageType::getAll怎麽用?PHP ImageType::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageType
的用法示例。
在下文中一共展示了ImageType::getAll方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkAndAddLanguage
public static function checkAndAddLanguage($iso_code, $lang_pack = false, $only_add = false, $params_lang = null)
{
if (Language::getIdByIso($iso_code)) {
return true;
}
// Initialize the language
$lang = new Language();
$lang->iso_code = Tools::strtolower($iso_code);
$lang->language_code = $iso_code;
// Rewritten afterwards if the language code is available
$lang->active = true;
// If the language pack has not been provided, retrieve it from prestashop.com
if (!$lang_pack) {
$lang_pack = self::getLangDetails($iso_code);
}
// If a language pack has been found or provided, prefill the language object with the value
if ($lang_pack) {
foreach ($lang_pack as $key => $value) {
if ($key != 'iso_code' && isset(Language::$definition['fields'][$key])) {
$lang->{$key} = $value;
}
}
}
// Use the values given in parameters to override the data retrieved automatically
if ($params_lang !== null && is_array($params_lang)) {
foreach ($params_lang as $key => $value) {
if ($key != 'iso_code' && isset(Language::$definition['fields'][$key])) {
$lang->{$key} = $value;
}
}
}
if (!$lang->name && $lang->iso_code) {
$lang->name = $lang->iso_code;
}
if (!$lang->validateFields() || !$lang->validateFieldsLang() || !$lang->add(true, false, $only_add)) {
return false;
}
if (isset($params_lang['allow_accented_chars_url']) && in_array($params_lang['allow_accented_chars_url'], array('1', 'true'))) {
Configuration::updateGlobalValue('PS_ALLOW_ACCENTED_CHARS_URL', 1);
}
$flag = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/flags/jpeg/' . $iso_code . '.jpg');
if ($flag != null && !preg_match('/<body>/', $flag)) {
$file = fopen(_PS_ROOT_DIR_ . '/img/l/' . (int) $lang->id . '.jpg', 'w');
if ($file) {
fwrite($file, $flag);
fclose($file);
} else {
Language::_copyNoneFlag((int) $lang->id);
}
} else {
Language::_copyNoneFlag((int) $lang->id);
}
$files_copy = array('/en.jpg');
foreach (ImageType::getAll() as $alias => $config) {
$files_copy[] = '/en-default-' . ImageType::getFormattedName($alias) . '.jpg';
}
foreach (array(_PS_CAT_IMG_DIR_, _PS_MANU_IMG_DIR_, _PS_PROD_IMG_DIR_, _PS_SUPP_IMG_DIR_) as $to) {
foreach ($files_copy as $file) {
@copy(_PS_ROOT_DIR_ . '/img/l' . $file, $to . str_replace('/en', '/' . $iso_code, $file));
}
}
return true;
}