/** * Check then return multilingual fields for database interaction * * @return array Multilingual fields */ public function getTranslationsFieldsChild() { parent::validateFieldsLang(); $fieldsArray = array('title', 'url'); $fields = array(); $languages = Language::getLanguages(false); $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang']; $fields[$language['id_lang']][self::$definition['primary']] = (int) $this->id; foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) { die(Tools::displayError()); } if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], true); } elseif (in_array($field, $this->fieldsRequiredLang)) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], true); } else { $fields[$language['id_lang']][$field] = ''; } } } return $fields; }
public function getTranslationsFieldsChild() { if (!parent::validateFieldsLang()) { return false; } return parent::getTranslationsFields(array('name')); }
/** * Check then return multilingual fields for database interaction * * @return array Multilingual fields */ public function getTranslationsFieldsChild() { parent::validateFieldsLang(); $fieldsArray = array('name', 'link'); $fields = array(); $languages = Language::getLanguages(false); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = intval($this->id); $fields[$language['id_lang']]['value_over'] = isset($this->value_over[$language['id_lang']]) ? pSQL($this->value_over[$language['id_lang']], true) : ''; $fields[$language['id_lang']]['value_under'] = isset($this->value_under[$language['id_lang']]) ? pSQL($this->value_under[$language['id_lang']], true) : ''; foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) { die(Tools::displayError()); } /* Check fields validity */ if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); } elseif (in_array($field, $this->fieldsRequiredLang)) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]); } else { $fields[$language['id_lang']][$field] = ''; } } } return $fields; return parent::getTranslationsFields(array('name', 'link')); }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); $fieldsArray = array('meta_title', 'meta_description', 'meta_keywords', 'link_rewrite'); $fields = array(); $languages = Language::getLanguages(false); $defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = (int) $this->id; $fields[$language['id_lang']]['content'] = isset($this->content[$language['id_lang']]) ? pSQL($this->content[$language['id_lang']], true) : ''; foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) { die(Tools::displayError()); } if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); } elseif (in_array($field, $this->fieldsRequiredLang)) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]); } else { $fields[$language['id_lang']][$field] = ''; } } } return $fields; }
/** * Check then return multilingual fields for database interaction * * @return array Multilingual fields */ public function getTranslationsFieldsChild() { if (!is_array($this->value)) { return true; } parent::validateFieldsLang(); return parent::getTranslationsFields(array('value')); }
/** * Check then return multilingual fields for database interaction * * @return array Multilingual fields */ public function getTranslationsFieldsChild() { parent::validateFieldsLang(); $fields = array(); $languages = Language::getLanguages(false); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = intval($this->id); $fields[$language['id_lang']]['value_over'] = isset($this->value_over[$language['id_lang']]) ? pSQL($this->value_over[$language['id_lang']], true) : ''; $fields[$language['id_lang']]['value_under'] = isset($this->value_under[$language['id_lang']]) ? pSQL($this->value_under[$language['id_lang']], true) : ''; } return $fields; }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); $fieldsArray = array('meta_title', 'meta_description', 'title', 'seo_url', 'meta_keywords'); $fields = array(); $languages = Language::getLanguages(false); $defaultLanguage = Configuration::get('PS_LANG_DEFAULT'); foreach ($languages as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = intval($this->id); $fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']]) and !empty($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : pSQL($this->description[$defaultLanguage], true); foreach ($fieldsArray as $field) { if (!Validate::isTableOrIdentifier($field)) { die(Tools::displayError()); } if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); } else { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]); } } } return $fields; }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); return parent::getTranslationsFields(array('description', 'meta_title', 'meta_keywords', 'meta_description')); }
public function validateFieldsLang($die = true, $errorReturn = false) { $limit = (int) Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT'); if ($limit <= 0) { $limit = 800; } if (!is_array($this->description_short)) { $this->description_short = array(); } foreach ($this->description_short as $k => $value) { if (Tools::strlen(strip_tags($value)) > $limit) { if ($die) { die(Tools::displayError() . ' (' . get_class($this) . '->description_short: length > ' . $limit . ' for language ' . $k . ')'); } return $errorReturn ? get_class($this) . '->' . Tools::displayError('description_short: length >') . ' ' . $limit . ' ' . Tools::displayError('for language') . ' ' . $k : false; } } return parent::validateFieldsLang($die, $errorReturn); }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); return parent::getTranslationsFields(array('category_name', 'category_description', 'category_meta_title', 'category_meta_description', 'category_meta_keywords', 'link_rewrite')); }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); return parent::getTranslationsFields(array('title', 'description', 'keywords', 'url_rewrite')); }
public function validateFieldsLang($die = true, $errorReturn = false) { if (!is_array($this->description_short)) { $this->description_short = array(); } foreach ($this->description_short as $k => $value) { if (Tools::strlen(strip_tags($value)) > 4000) { if ($die) { die(Tools::displayError() . ' (' . get_class($this) . '->description: length > 4000 for language ' . $k . ')'); } return $errorReturn ? get_class($this) . '->' . Tools::displayError('description: length > 4000 for language') . ' ' . $k : false; } } return parent::validateFieldsLang($die, $errorReturn); }
/** * @see ObjectModel::validateFieldsLang() */ public function validateFieldsLang($die = true, $error_return = false) { $limit = (int) Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT'); if ($limit <= 0) { $limit = 800; } $this->def['fields']['description_short']['size'] = $limit; return parent::validateFieldsLang($die, $error_return); }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); return parent::getTranslationsFields(array('name', 'icon', 'range_sign', 'range_interval')); }
public function getTranslationsFieldsChild() { parent::validateFieldsLang(); return parent::getTranslationsFields(array('tags_name', 'tags_description')); }
/** * Check then return multilingual fields for database interaction * * @return array Multilingual fields */ public function getTranslationsFieldsChild() { parent::validateFieldsLang(); return parent::getTranslationsFields(array('name')); }
public function getTranslationsFieldsChild() { if (version_compare(_PS_VERSION_, '1.5', '<')) { if (count($this->tables) == 1) { return; } parent::validateFieldsLang(); $fields_array = array(); $fields = array(); $definition = $this->getDefinitionProperty(); if (isset($definition)) { foreach ($definition['fields'] as $field_name => $field) { if (is_array($this->{$field_name})) { $fields_array[] = $field_name; } } } foreach (Language::getLanguages(false) as $language) { $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; $fields[$language['id_lang']][$this->identifier] = (int) $this->{$this->identifier}; foreach ($fields_array as $field) { if (!Validate::isTableOrIdentifier($field)) { die(Tools::displayError()); } if (isset($this->{$field}[$language['id_lang']]) && !empty($this->{$field}[$language['id_lang']])) { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]); } elseif (in_array($field, $this->fieldsRequiredLang)) { if ($this->{$field} != '') { $fields[$language['id_lang']][$field] = pSQL($this->{$field}[(int) _PS_LANG_DEFAULT_]); } } else { $fields[$language['id_lang']][$field] = ''; } } } return $fields; } else { $this->validateFieldsLang(); $is_lang_multishop = $this->isLangMultishop(); $fields = array(); if ($this->id_lang === null) { foreach (Language::getLanguages(false) as $language) { $fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']); $fields[$language['id_lang']]['id_lang'] = $language['id_lang']; if ($this->id_shop && $is_lang_multishop) { $fields[$language['id_lang']]['id_shop'] = (int) $this->id_shop; } } } else { $fields = array($this->id_lang => $this->formatFields(self::FORMAT_LANG, $this->id_lang)); $fields[$this->id_lang]['id_lang'] = $this->id_lang; if ($this->id_shop && $is_lang_multishop) { $fields[$this->id_lang]['id_shop'] = (int) $this->id_shop; } } return $fields; } }