本文整理汇总了PHP中ObjectModel::validateFieldsLang方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectModel::validateFieldsLang方法的具体用法?PHP ObjectModel::validateFieldsLang怎么用?PHP ObjectModel::validateFieldsLang使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectModel
的用法示例。
在下文中一共展示了ObjectModel::validateFieldsLang方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTranslationsFieldsChild
/**
* 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;
}
示例2: getTranslationsFieldsChild
public function getTranslationsFieldsChild()
{
if (!parent::validateFieldsLang()) {
return false;
}
return parent::getTranslationsFields(array('name'));
}
示例3: getTranslationsFieldsChild
/**
* 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'));
}
示例4: getTranslationsFieldsChild
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;
}
示例5: getTranslationsFieldsChild
/**
* 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'));
}
示例6: getTranslationsFieldsChild
/**
* 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;
}
示例7: getTranslationsFieldsChild
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;
}
示例8: getTranslationsFieldsChild
public function getTranslationsFieldsChild()
{
parent::validateFieldsLang();
return parent::getTranslationsFields(array('description', 'meta_title', 'meta_keywords', 'meta_description'));
}
示例9: validateFieldsLang
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);
}
示例10: getTranslationsFieldsChild
public function getTranslationsFieldsChild()
{
parent::validateFieldsLang();
return parent::getTranslationsFields(array('category_name', 'category_description', 'category_meta_title', 'category_meta_description', 'category_meta_keywords', 'link_rewrite'));
}
示例11: validateFieldsLang
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);
}
示例12: validateFieldsLang
/**
* @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);
}
示例13: getTranslationsFieldsChild
public function getTranslationsFieldsChild()
{
parent::validateFieldsLang();
return parent::getTranslationsFields(array('tags_name', 'tags_description'));
}
示例14: getTranslationsFieldsChild
/**
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
parent::validateFieldsLang();
return parent::getTranslationsFields(array('name'));
}
示例15: getTranslationsFieldsChild
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;
}
}