当前位置: 首页>>代码示例>>PHP>>正文


PHP Validate::isGenericName方法代码示例

本文整理汇总了PHP中Validate::isGenericName方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::isGenericName方法的具体用法?PHP Validate::isGenericName怎么用?PHP Validate::isGenericName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validate的用法示例。


在下文中一共展示了Validate::isGenericName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

 public function getContent()
 {
     $output = '<h2>' . $this->displayName . '</h2>';
     if (Tools::isSubmit('submitBlockRss')) {
         $urlfeed = strval(Tools::getValue('urlfeed'));
         $title = strval(Tools::getValue('title'));
         $nbr = intval(Tools::getValue('nbr'));
         if ($urlfeed and !Validate::isUrl($urlfeed)) {
             $errors[] = $this->l('Invalid feed URL');
         } elseif (!$title or empty($title) or !Validate::isGenericName($title)) {
             $errors[] = $this->l('Invalid title');
         } elseif (!$nbr or $nbr <= 0 or !Validate::isInt($nbr)) {
             $errors[] = $this->l('Invalid number of feeds');
         } else {
             Configuration::updateValue('RSS_FEED_URL', $urlfeed);
             Configuration::updateValue('RSS_FEED_TITLE', $title);
             Configuration::updateValue('RSS_FEED_NBR', $nbr);
         }
         if (isset($errors) and sizeof($errors)) {
             $output .= $this->displayError(implode('<br />', $errors));
         } else {
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:sealence,项目名称:local,代码行数:26,代码来源:blockrss.php

示例2: addTags

    /**
     * Add several tags in database and link it to a product
     *
     * @param integer $id_lang Language id
     * @param integer $id_product Product id to link tags with
     * @param string $string Tags separated by commas
     *
     * @return boolean Operation success
     */
    public static function addTags($id_lang, $id_product, $string)
    {
        if (!Validate::isUnsignedId($id_lang) or Validate::isTagsList($string)) {
            Tools::displayError();
        }
        $tmpTab = array_unique(array_map('trim', explode(',', $string)));
        $list = array();
        foreach ($tmpTab as $tag) {
            if (!Validate::isGenericName($tag)) {
                return false;
            }
            $tagObj = new Tag(NULL, trim($tag), intval($id_lang));
            /* Tag does not exist in database */
            if (!Validate::isLoadedObject($tagObj)) {
                $tagObj->name = trim($tag);
                $tagObj->id_lang = intval($id_lang);
                $tagObj->add();
            }
            if (!in_array($tagObj->id, $list)) {
                $list[] = $tagObj->id;
            }
        }
        $data = '';
        foreach ($list as $tag) {
            $data .= '(' . intval($tag) . ',' . intval($id_product) . '),';
        }
        $data = rtrim($data, ',');
        if (!Validate::isValuesList($list)) {
            Tools::displayError();
        }
        return Db::getInstance()->Execute('
		INSERT INTO `' . _DB_PREFIX_ . 'product_tag` (`id_tag`, `id_product`) 
		VALUES ' . $data);
    }
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:43,代码来源:Tag.php

示例3: addTags

 /**
  * Add several tags in database and link it to a product
  *
  * @param integer $id_lang Language id
  * @param integer $id_simpleblog_post Post id to link tags with
  * @param string|array $tag_list List of tags, as array or as a string with comas
  * @return boolean Operation success
  */
 public static function addTags($id_lang, $id_simpleblog_post, $tag_list, $separator = ',')
 {
     if (!Validate::isUnsignedId($id_lang)) {
         return false;
     }
     if (!is_array($tag_list)) {
         $tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\' . $separator . '#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
     }
     $list = array();
     if (is_array($tag_list)) {
         foreach ($tag_list as $tag) {
             if (!Validate::isGenericName($tag)) {
                 return false;
             }
             $tag_obj = new SimpleBlogTag(null, $tag, (int) $id_lang);
             /* Tag does not exist in database */
             if (!Validate::isLoadedObject($tag_obj)) {
                 $tag_obj->name = $tag;
                 $tag_obj->id_lang = (int) $id_lang;
                 $tag_obj->add();
             }
             if (!in_array($tag_obj->id, $list)) {
                 $list[] = $tag_obj->id;
             }
         }
     }
     $data = '';
     foreach ($list as $tag) {
         $data .= '(' . (int) $tag . ',' . (int) $id_simpleblog_post . '),';
     }
     $data = rtrim($data, ',');
     $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'simpleblog_post_tag` (`id_simpleblog_tag`, `id_simpleblog_post`) VALUES ' . $data;
     return Db::getInstance()->execute($sql);
 }
开发者ID:evgrishin,项目名称:se1614,代码行数:42,代码来源:SimpleBlogTag.php

示例4: loadData

    public static function loadData($p = 1, $limit = 50, $orderBy = NULL, $orderWay = NULL, $filter = array())
    {
        $where = '';
        if (!empty($filter['id_onepage']) && Validate::isInt($filter['id_onepage'])) {
            $where .= ' AND a.`id_onepage`=' . intval($filter['id_onepage']);
        }
        if (!empty($filter['view_name']) && Validate::isEntityName($filter['view_name'])) {
            $where .= ' AND a.`view_name` LIKE "%' . pSQL($filter['view_name']) . '%"';
        }
        if (!empty($filter['meta_title']) && Validate::isGenericName($filter['meta_title'])) {
            $where .= ' AND a.`meta_title` LIKE "%' . pSQL($filter['meta_title']) . '%"';
        }
        if (!empty($filter['rewrite']) && Validate::isLinkRewrite($filter['rewrite'])) {
            $where .= ' AND a.`rewrite` LIKE "%' . pSQL($filter['rewrite']) . '%"';
        }
        if (!is_null($orderBy) and !is_null($orderWay)) {
            $postion = 'ORDER BY ' . pSQL($orderBy) . ' ' . pSQL($orderWay);
        } else {
            $postion = 'ORDER BY `id_onepage` DESC';
        }
        $total = Db::getInstance()->getRow('SELECT count(*) AS total FROM `' . DB_PREFIX . 'onepage` a
				WHERE 1 ' . $where);
        if ($total == 0) {
            return false;
        }
        $result = Db::getInstance()->getAll('SELECT a.* FROM `' . DB_PREFIX . 'onepage` a
				WHERE 1 ' . $where . '
				' . $postion . '
				LIMIT ' . ($p - 1) * $limit . ',' . (int) $limit);
        $rows = array('total' => $total['total'], 'items' => $result);
        return $rows;
    }
开发者ID:yiuked,项目名称:tmcart,代码行数:32,代码来源:Onepage.php

示例5: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $my_module_name = strval(Tools::getValue('INSTAMOJO'));
         if (!$my_module_name || empty($my_module_name) || !Validate::isGenericName($my_module_name)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('INSTAMOJO', $my_module_name);
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     return $this->display(__FILE__, '/views/templates/admin/configure_instamojo.tpl');
 }
开发者ID:sengupta,项目名称:instamojo-prestashop,代码行数:14,代码来源:instamojo.php

示例6: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $my_module_name = strval(Tools::getValue('SHOPCONNECTORMODULE_HASH'));
         if (!$my_module_name || empty($my_module_name) || !Validate::isGenericName($my_module_name)) {
             $output .= $this->displayError($this->l('Niepoprawna konfiguracja sklepu lub brak hasha.'));
         } else {
             Configuration::updateValue('SHOPCONNECTORMODULE_HASH', $my_module_name);
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:adamterepora,项目名称:ShopConnectorIntegrationModules,代码行数:14,代码来源:shopconnectormodule.php

示例7: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $ps_module_name = strval(Tools::getValue('PSMODULE_NAME'));
         if (!$ps_module_name || empty($ps_module_name) || !Validate::isGenericName($ps_module_name)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('PSMODULE_NAME', $ps_module_name);
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:tu2,项目名称:psmodule,代码行数:14,代码来源:psmodule.php

示例8: validate

 /**
  * @see InstallAbstractModel::validate()
  */
 public function validate()
 {
     // List of required fields
     $required_fields = array('shop_name', 'shop_country', 'shop_timezone', 'admin_firstname', 'admin_lastname', 'admin_email', 'admin_password');
     foreach ($required_fields as $field) {
         if (!$this->session->{$field}) {
             $this->errors[$field] = $this->l('Field required');
         }
     }
     // Check shop name
     if ($this->session->shop_name && !Validate::isGenericName($this->session->shop_name)) {
         $this->errors['shop_name'] = $this->l('Invalid shop name');
     } else {
         if (strlen($this->session->shop_name) > 64) {
             $this->errors['shop_name'] = $this->l('The field %s is limited to %d characters', $this->l('shop name'), 64);
         }
     }
     // Check admin name
     if ($this->session->admin_firstname && !Validate::isName($this->session->admin_firstname)) {
         $this->errors['admin_firstname'] = $this->l('Your firstname contains some invalid characters');
     } else {
         if (strlen($this->session->admin_firstname) > 32) {
             $this->errors['admin_firstname'] = $this->l('The field %s is limited to %d characters', $this->l('firstname'), 32);
         }
     }
     if ($this->session->admin_lastname && !Validate::isName($this->session->admin_lastname)) {
         $this->errors['admin_lastname'] = $this->l('Your lastname contains some invalid characters');
     } else {
         if (strlen($this->session->admin_lastname) > 32) {
             $this->errors['admin_lastname'] = $this->l('The field %s is limited to %d characters', $this->l('lastname'), 32);
         }
     }
     // Check passwords
     if ($this->session->admin_password) {
         if (!Validate::isPasswdAdmin($this->session->admin_password)) {
             $this->errors['admin_password'] = $this->l('The password is incorrect (alphanumeric string with at least 8 characters)');
         } else {
             if ($this->session->admin_password != $this->session->admin_password_confirm) {
                 $this->errors['admin_password'] = $this->l('Password and its confirmation are different');
             }
         }
     }
     // Check email
     if ($this->session->admin_email && !Validate::isEmail($this->session->admin_email)) {
         $this->errors['admin_email'] = $this->l('This e-mail address is invalid');
     }
     return count($this->errors) ? false : true;
 }
开发者ID:FAVHYAN,项目名称:a3workout,代码行数:51,代码来源:configure.php

示例9: getContent

 public function getContent()
 {
     $this->registerHook('displayNav');
     //TODO: !!!
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $my_module_name = strval(Tools::getValue('MYMODULE_NAME'));
         if (!$my_module_name || empty($my_module_name) || !Validate::isGenericName($my_module_name)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('MYMODULE_NAME', $my_module_name);
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     $output .= $this->displayForm();
     $output .= $this->renderList();
     return $output;
 }
开发者ID:evgrishin,项目名称:mh16014,代码行数:18,代码来源:egmultishop.php

示例10: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $list_value = strval(Tools::getValue('PRODUCTUPDATE_LIST'));
         if (!$list_value || empty($list_value) || !Validate::isGenericName($list_value)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('PRODUCTUPDATE_LIST', $list_value);
             Configuration::updateValue('PRODUCTUPDATE_STATUS', '0');
             return $this->display(__FILE__, 'productupdate.tpl');
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     //$this->context->controller->addJS($this->_path.'productupdate.js');
     //return $this->display(__FILE__,'productupdate.tpl');
     return $output . $this->displayForm();
 }
开发者ID:Eximagen,项目名称:3m,代码行数:18,代码来源:productupdate.php

示例11: getContent

 public function getContent()
 {
     $output = '<h2>' . $this->displayName . '</h2>';
     if (Tools::isSubmit('submitBlockRss')) {
         $errors = array();
         $urlfeed = Tools::getValue('urlfeed');
         $title = Tools::getValue('title');
         $nbr = (int) Tools::getValue('nbr');
         if ($urlfeed and !Validate::isAbsoluteUrl($urlfeed)) {
             $errors[] = $this->l('Invalid feed URL');
         } elseif (!$title or empty($title) or !Validate::isGenericName($title)) {
             $errors[] = $this->l('Invalid title');
         } elseif (!$nbr or $nbr <= 0 or !Validate::isInt($nbr)) {
             $errors[] = $this->l('Invalid number of feeds');
         } elseif (stristr($urlfeed, $_SERVER['HTTP_HOST'] . __PS_BASE_URI__)) {
             $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');
         } elseif (!($contents = Tools::file_get_contents($urlfeed))) {
             $errors[] = $this->l('Feed is unreachable, check your URL');
         } else {
             try {
                 $xmlFeed = new XML_Feed_Parser($contents);
             } catch (XML_Feed_Parser_Exception $e) {
                 $errors[] = $this->l('Invalid feed:') . ' ' . $e->getMessage();
             }
         }
         if (!sizeof($errors)) {
             Configuration::updateValue('RSS_FEED_URL', $urlfeed);
             Configuration::updateValue('RSS_FEED_TITLE', $title);
             Configuration::updateValue('RSS_FEED_NBR', $nbr);
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         } else {
             $output .= $this->displayError(implode('<br />', $errors));
         }
     } else {
         $errors = array();
         if (stristr(Configuration::get('RSS_FEED_URL'), $_SERVER['HTTP_HOST'] . __PS_BASE_URI__)) {
             $errors[] = $this->l('You have selected a feed URL on your own website. Please choose another URL');
         }
         if (sizeof($errors)) {
             $output .= $this->displayError(implode('<br />', $errors));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:jicheng17,项目名称:pengwine,代码行数:44,代码来源:blockrss.php

示例12: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $bla_email = strval(Tools::getValue('BLA_EMAIL'));
         if (empty($bla_email) || !Validate::isGenericName($bla_email)) {
             $output .= $this->displayError($this->l('Invalid Email value'));
         }
         if (empty($output)) {
             Configuration::updateValue('BLA_EMAIL', $bla_email);
             Configuration::updateValue('BLA_ACTIV_EMAIL', Tools::getValue('BLA_ACTIV_EMAIL'));
             Configuration::updateValue('BLA_ISLOG_CARUP', Tools::getValue('BLA_ISLOG_CARUP'));
             Configuration::updateValue('BLA_ISLOG_MODINST', Tools::getValue('BLA_ISLOG_MODINST'));
             Configuration::updateValue('BLA_ISLOG_MODREG', Tools::getValue('BLA_ISLOG_MODREG'));
             Configuration::updateValue('BLA_ISLOG_MODUREG', Tools::getValue('BLA_ISLOG_MODUREG'));
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:azriel49,项目名称:PrestaShop-BoLogActivity,代码行数:20,代码来源:bologactivity.php

示例13: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $la_tabcount = strval(Tools::getValue('LAMPACCESSORIES_TABCOUNT'));
         if (!$la_tabcount || empty($la_tabcount) || !Validate::isGenericName($la_tabcount)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('LAMPACCESSORIES_TABCOUNT', intval($la_tabcount));
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
         $la_itemcount = strval(Tools::getValue('LAMPACCESSORIES_ITEMCOUNT'));
         if (!$la_itemcount || empty($la_itemcount) || !Validate::isGenericName($la_itemcount)) {
             $output .= $this->displayError($this->l('Invalid Configuration value'));
         } else {
             Configuration::updateValue('LAMPACCESSORIES_ITEMCOUNT', intval($la_itemcount));
             $output .= $this->displayConfirmation($this->l('Settings updated'));
         }
     }
     return $output . $this->displayForm();
 }
开发者ID:yonkon,项目名称:lustr,代码行数:21,代码来源:lampaccessories.php

示例14: getContent

 public function getContent()
 {
     $output = null;
     if (Tools::isSubmit('submit' . $this->name)) {
         $lp_site_id = Tools::getValue('LP_SITEID');
         if (!$lp_site_id || empty($lp_site_id) || !Validate::isGenericName($lp_site_id)) {
             $output .= $this->displayError($this->l('You have entered an invalid LivePerson ID.'));
         } else {
             Configuration::updateValue('LP_SITEID', $lp_site_id);
             $output .= $this->displayConfirmation($this->l('You have successfully connected your LivePerson account!  We deployed the LiveEngage tag to your store.'));
         }
     }
     $lp_site_id = Configuration::get('LP_SITEID');
     if ($lp_site_id == "0") {
         $lp_site_id = "";
     }
     $link = $this->context->link->getAdminLink('AdminModules');
     $link = $link . "&configure=liveperson";
     $this->context->smarty->assign(array('lp_site_id' => $lp_site_id, 'link' => $link));
     return $output . $this->display(__FILE__, 'views/templates/admin/configure.tpl');
 }
开发者ID:pankajshoffex,项目名称:shoffex_prestashop,代码行数:21,代码来源:liveperson.php

示例15: addTags

    /**
     * Add several tags in database and link it to a product
     *
     * @param int $id_lang Language id
     * @param int $id_product Product id to link tags with
     * @param string|array $tag_list List of tags, as array or as a string with comas
     * @return bool Operation success
     */
    public static function addTags($id_lang, $id_product, $tag_list, $separator = ',')
    {
        if (!Validate::isUnsignedId($id_lang)) {
            return false;
        }
        if (!is_array($tag_list)) {
            $tag_list = array_filter(array_unique(array_map('trim', preg_split('#\\' . $separator . '#', $tag_list, null, PREG_SPLIT_NO_EMPTY))));
        }
        $list = array();
        if (is_array($tag_list)) {
            foreach ($tag_list as $tag) {
                if (!Validate::isGenericName($tag)) {
                    return false;
                }
                $tag = trim(Tools::substr($tag, 0, self::$definition['fields']['name']['size']));
                $tag_obj = new Tag(null, $tag, (int) $id_lang);
                /* Tag does not exist in database */
                if (!Validate::isLoadedObject($tag_obj)) {
                    $tag_obj->name = $tag;
                    $tag_obj->id_lang = (int) $id_lang;
                    $tag_obj->add();
                }
                if (!in_array($tag_obj->id, $list)) {
                    $list[] = $tag_obj->id;
                }
            }
        }
        $data = '';
        foreach ($list as $tag) {
            $data .= '(' . (int) $tag . ',' . (int) $id_product . ',' . (int) $id_lang . '),';
        }
        $data = rtrim($data, ',');
        $result = Db::getInstance()->execute('
		INSERT INTO `' . _DB_PREFIX_ . 'product_tag` (`id_tag`, `id_product`, `id_lang`)
		VALUES ' . $data);
        if ($list != array()) {
            self::updateTagCount($list);
        }
        return $result;
    }
开发者ID:ortegon000,项目名称:tienda,代码行数:48,代码来源:Tag.php


注:本文中的Validate::isGenericName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。