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


PHP qw2函数代码示例

本文整理汇总了PHP中qw2函数的典型用法代码示例。如果您正苦于以下问题:PHP qw2函数的具体用法?PHP qw2怎么用?PHP qw2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: htmlCollectData

function htmlCollectData($item, &$additionalAttributes, $level = 0)
{
    $stopText = qw2('#comment #cdata-section');
    if (in_array($item->nodeName, $stopText)) {
        return '';
    }
    if ($item->nodeName == 'script') {
        if (!isset($additionalAttributes['script'])) {
            $additionalAttributes['script'] = '';
        }
        $additionalAttributes['script'] .= $item->nodeValue;
        $additionalAttributes['script'] = preg_replace("/[\\x0D\\x0A]/i", '', $additionalAttributes['script']);
        return '';
    }
    $children = $item->childNodes;
    $text = '';
    for ($i = 0; $children && $i < $children->length; $i++) {
        $text .= htmlCollectData($children->item($i), $additionalAttributes, $level + 1);
    }
    if (!$i) {
        $text .= $item->nodeValue;
    }
    $attributes = collectAttributes($item);
    if ($item->nodeName != '#text' && $level) {
        $text = '<' . $item->nodeName . $attributes . '>' . $text . '</' . $item->nodeName . '>';
    }
    return $text;
}
开发者ID:evilgeny,项目名称:bob,代码行数:28,代码来源:tools.php

示例2: editPerson

 /**
  * Enter description here...
  *
  * @param RM_User_Object $obUser
  * @param array $data
  * @return RM_User_Family_Decorator_Person | TRUE
  */
 public function editPerson(RM_User_Object $obUser, &$data)
 {
     try {
         if (isNull($obPerson = M('User')->loadPersonById($data['id']))) {
             $obPerson = M('User')->createPerson(array());
             $obPerson->user_id = $obUser->id();
         }
         $data['sex'] = @$data['sex'] ? $data['sex'] : NULL;
         $data['birthday'] = @(!$data['y']) || @(!$data['m']) || @(!$data['d']) ? NULL : M('Date')->dbDate($data['y'] . '-' . $data['m'] . '-' . $data['d']);
         if (M('Date')->time() < M('Date')->time($data['birthday'])) {
             $res = new RM_Base_Result();
             $res->error('not_exists_date');
             throw new RM_Validator_Exception($res);
         }
         $map = qw2('d m y id');
         foreach ($data as $name => $value) {
             if (!in_array($name, $map)) {
                 $obPerson->{$name} = $value;
             }
         }
         $obPerson->save();
         return TRUE;
     } catch (RM_Validator_Exception $e) {
         $err = iterFirst($e->getResult()->getErrors());
         error($err['code'] == 'not_exists_date' ? L('user.' . $err['code']) : L('user.field') . ' "' . L('user.' . $err['place']) . '" ' . L('user.' . $err['code']));
         return $obPerson;
     }
 }
开发者ID:evilgeny,项目名称:bob,代码行数:35,代码来源:Family.class.php

示例3: categoryTable

 /**
  *	Description...
  *
  *	@return void
  **/
 public function categoryTable()
 {
     $periods = qw2('month week quarter double_weeks');
     $level = qw2('category owner brand subbrand barcode');
     $period = isset($_GET['period']) && in_array($_GET['period'], $periods) ? $_GET['period'] : 'month';
     return 'penetration_' . $level[@$_GET['column'] + 0] . '_' . $period;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Penetration.class.php

示例4: __set

 /**
  *	Set value of property
  *
  *	@param		name	string		Property name
  *	@param		value	mixed		Property value
  *	@return		void
  */
 protected function __set($name, $value)
 {
     if (in_array($name, qw2('result_id step_id')) && $this->_propInitial($name)) {
         throw new RM_Base_Exception_BadUsage("Cannot change property `{$name}' of object `" . get_class($this) . "'");
     }
     parent::__set($name, $value);
 }
开发者ID:evilgeny,项目名称:bob,代码行数:14,代码来源:Step.class.php

示例5: save

 public function save(RM_Barcode_Object $obBarcode, &$error)
 {
     try {
         $obBarcode->save();
         return TRUE;
     } catch (RM_Validator_Exception $e) {
         foreach ($e->getResult()->getErrors() as $err) {
             break;
         }
         if ($err['code'] == 'not_empty' || $err['code'] == 'not_null') {
             $error = 'barcode.fill_required_fields';
         } else {
             if (in_array($err['code'], qw2('no_such_segment no_such_class no_such_family no_such_brick no_such_attributes no_attributes2brick no_such_values no_values2attribute'))) {
                 $error = 'gpc.' . $err['code'];
             } else {
                 $error = 'barcode.cannot_edit_object';
             }
         }
         return FALSE;
     }
     /*		catch (Exception $e)
     		{
     			$error = 'barcode.cannot_edit_object';
     			return FALSE;
     		}*/
 }
开发者ID:evilgeny,项目名称:bob,代码行数:26,代码来源:Barcode.class.php

示例6: _getFields

 protected function _getFields($admin = FALSE, $action = '', $obUser = NULL)
 {
     if ($admin) {
         $fields = qw2('login first_name middle_name status_id phone city_id area_id metro_id home_address home_index extended_info sex birthday setup_date who_set_scanner payment_method payment_info compensation_method compensation_info inn_id pensionary_id is_tester diary_access_disabled repair_status deny_status equipment equipment_removed internet_connection_type document_copy stream');
         if (me()->isSuperAdmin()) {
             $fields[] = 'ssl_number';
         }
     } else {
         $fields = qw2('payment_method payment_info compensation_method compensation_info area_id metro_id');
         // login phone home_address home_index
     }
     foreach ($fields as $k => $f) {
         $fields[$f] = $f;
         unset($fields[$k]);
     }
     if (!($admin || $this->checkCanEditPaymentInfo($obUser))) {
         unset($fields['payment_method']);
         unset($fields['payment_info']);
         unset($fields['compensation_method']);
         unset($fields['compensation_info']);
     }
     if ($action != 'add') {
         unset($fields['sex']);
         unset($fields['birthday']);
     }
     if (!$this->canChangeCity($admin)) {
         unset($fields['city_id']);
     }
     return $fields;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:30,代码来源:Profile.class.php

示例7: getAnswers

 /**
  * Retrieves list of answers
  *
  * @return	RM_Store_iRequest<RM_Anketa_Entity_Answer>
  **/
 public function getAnswers()
 {
     $aliases = $this->rotation ? qw2('random>RAND(UNIX_TIMESTAMP())') : array();
     $request = $this->_mapper->getList('answer', $aliases)->filter('question_id = ?', $this->id());
     $this->_mapper->applyActive($request);
     return $this->rotation ? $request->sort('random') : $this->_mapper->applySort($request);
 }
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Question.class.php

示例8: getData

 /**
  *	Get gepir barcode info
  *
  *	@param 		string		barcode
  *	@return		array
  */
 public function getData($barcode)
 {
     $doc = new DOMDocument();
     if (!@$doc->loadXML($this->_getSoapXml('barcode', $barcode))) {
         return NULL;
     }
     $retcode = $doc->getElementsByTagName('returnCode');
     if (!is_object($retcode)) {
         return NULL;
     }
     if ($retcode->item(0)->nodeValue != 0) {
         return FALSE;
     }
     $result = array();
     foreach (qw2('brandName ex_prod_category ex_prod_dtype ex_prod_desc ex_prod_cover_type ex_prod_cover_qty ex_prod_cover_measure ex_prod_cover_desc ex_prod_cover_ext_desc ex_prod_cover_single_cover ex_prod_cover_okp manufacturerGln') as $node_name) {
         /*			$node = $doc->getElementsByTagName($node_name);
         			if (is_object($node))*/
         @($result[$node_name] = $doc->getElementsByTagName($node_name)->item(0)->nodeValue);
     }
     // производитель
     $man_doc = new DOMDocument();
     if (@$man_doc->loadXML($this->_getSoapXml('gln', $result['manufacturerGln']))) {
         foreach (qw2('partyName pOBoxNumber streetAddress contactName city') as $node_name) {
             /*				$node = $man_doc->getElementsByTagName($node_name);
             				if (is_object($node))*/
             @($result[$node_name] = $man_doc->getElementsByTagName($node_name)->item(0)->nodeValue);
         }
     }
     return $result;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:36,代码来源:Gepir.class.php

示例9: getDefaultGroup

 public function getDefaultGroup()
 {
     if (!$this->_default) {
         return $this->_default = new $this->_className(array('mapper' => M('Base')->null(), 'props' => qw2('id>0 name>' . L('client.table_data_other'))));
     }
     return $this->_default;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Mapper.class.php

示例10: searchInTree

 /**
  * Search GPC entities using name/keywords fields
  *
  * @param 		string			search
  * @return		RM_Store_iRequest<RM_Gpc_Tree_Entity>
  **/
 public function searchInTree($search, $lang = NULL)
 {
     $lang = is_null($lang) ? L(NULL) : $lang;
     $this->_resetConditions();
     $this->_resetSort();
     foreach (array_reverse($this->_mapper->entities()) as $k => $entity) {
         $entity_fields = $this->_mapper->fields($entity);
         if ($k == 0) {
             $query = M('Db')->createQuery($this->_mapper->table($entity) . " {$entity}");
         } else {
             if ($children_entity = @$this->_mapper->children_types($entity)) {
                 $children_entity_fields = $this->_mapper->fields($children_entity);
             }
             $query->join($children_entity, "LEFT JOIN " . $this->_mapper->table($entity) . " {$entity} ON " . M('Db')->field($children_entity, $children_entity_fields[$entity . '_id']) . " = " . M('Db')->field($entity, $entity_fields['id']));
         }
         $map = qw2('id eng_name rus_name');
         if ($entity == 'brick') {
             // если брик, то добавим доп. поля и условия поиска
             $map = array_merge($map, qw2('eng_info rus_info keywords'));
             $this->_setCondition($entity, 'keywords', $search);
         }
         foreach ($map as $field_name) {
             $this->_addFieldToQuery($query, $entity, $field_name);
         }
         $this->_setCondition($entity, $lang . '_name', $search);
         $this->_setSort($entity, $lang . '_name');
         $this->_addGroupToQuery($query, $entity, 'id');
     }
     $this->_addConditionsToQuery($query);
     $this->_addSortToQuery($query);
     return M('Store')->requestQuery($this->_getTreeFactory(), $query);
 }
开发者ID:evilgeny,项目名称:bob,代码行数:38,代码来源:Search.class.php

示例11: __construct

 /**
  *	c-tor
  *
  *	@param		res		scalar							One of PERM_XXX contants
  *	@param		perm	string							Permission requested
  *	@param		object	RM_Permission_iPermissionable	Object caused permission exception
  *	@param		userId	int								User ID, NULL - current user
  */
 public function __construct($res, $perm, RM_Permission_iPermissionable $object, $userId = NULL)
 {
     foreach (qw2('res perm object userId') as $i) {
         $this->{$i} = ${$i};
     }
     $p = array(PERM_UNDEF => 'undefined', PERM_ALLOW => 'allow', PERM_PWD_REQUIRED => 'password is required', PERM_PWD_WRONG => 'password is wrong', PERM_DENY => 'access denied');
     parent::__construct("Permission denied - " . $p[$res], 0);
 }
开发者ID:evilgeny,项目名称:bob,代码行数:16,代码来源:Exception.class.php

示例12: initFactory

function initFactory()
{
    global $facade, $factory, $TABLE;
    $mediator = new RM_Store_Object_Mediator();
    $mediator->setMeta(new RM_Store_Object_Metadata(qw2('id>a val nick>nick_name'), qw2('id')));
    $mediator->setIdentityMap(new RM_Store_IdentityMap_Simple($mediator));
    $factory = new RM_Store_Factory_GuidDecorator(new RM_Store_Factory_Hash($mediator, 'MyObject'), G($TABLE));
}
开发者ID:evilgeny,项目名称:bob,代码行数:8,代码来源:base.php

示例13: __construct

 /**
  *	Constructor
  *
  *	@return
  */
 public function __construct()
 {
     $this->_fields = array('category' => qw2('id name descr is_visible ord'), 'present' => qw2('id category_id name descr price is_visible is_exists ord'), 'cart' => qw2('id user_id total'), 'cart_item' => qw2('id cart_id present_id quantity'), 'order' => qw2('id user_id present_id price quantity state cdate mdate '), 'order_item' => qw2('id order_id equipment_id'));
     $this->_validator = array('category' => qw2('name>not_empty descr>not_empty is_visible>not_null ord>not_null'), 'present' => array('category_id' => 'not_empty', 'name' => 'not_empty', 'descr' => 'not_empty', 'price' => array('and', 'not_empty', array('regexp', '/^\\d+$/')), 'is_visible' => 'not_null', 'is_exists' => 'not_null', 'ord' => 'not_null'), 'cart' => qw2('user_id>not_empty total>not_null'), 'cart_item' => qw2('cart_id>not_empty present_id>not_empty quantity>not_empty'), 'order' => qw2('user_id>not_empty present_id>not_empty price>not_empty quantity>not_empty'), 'order_item' => qw2('order_id>not_empty equipment_id>not_empty'));
     $storages = array('category' => M('Store')->storage(array('table' => $this->_tables['category'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id'), 'props' => $this->_fields['category'], 'class' => 'RM_Presents_Category', 'validator' => M('Validator')->create($this->_validator['category']))), 'present' => M('Store')->storage(array('table' => $this->_tables['present'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id'), 'props' => $this->_fields['present'], 'class' => 'RM_Presents_Present', 'guid' => G('present'), 'validator' => M('Validator')->create($this->_validator['present']))), 'cart' => M('Store')->storage(array('table' => $this->_tables['cart'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id user_id'), 'props' => $this->_fields['cart'], 'class' => 'RM_Presents_Cart_Object', 'guid' => G('present-cart'), 'validator' => M('Validator')->create($this->_validator['cart']))), 'cart_item' => M('Store')->storage(array('table' => $this->_tables['cart_item'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id ukey>cart_id+present_id'), 'props' => $this->_fields['cart_item'], 'class' => 'RM_Presents_Cart_Item', 'validator' => M('Validator')->create($this->_validator['cart_item']))), 'order' => M('Store')->storage(array('table' => $this->_tables['order'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id'), 'props' => $this->_fields['order'], 'class' => 'RM_Presents_Order_Object', 'validator' => M('Validator')->create($this->_validator['order']))), 'order_item' => M('Store')->storage(array('table' => $this->_tables['order_item'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id ukey>order_id+equipment_id equipment_id'), 'props' => $this->_fields['order_item'], 'class' => 'RM_Presents_Order_Item', 'validator' => M('Validator')->create($this->_validator['order_item']))));
     foreach ($storages as $k => $v) {
         $this->_storage[$k] = $v;
     }
 }
开发者ID:evilgeny,项目名称:bob,代码行数:14,代码来源:Mapper.class.php

示例14: __construct

 public function __construct($args = NULL)
 {
     parent::__construct($args);
     $this->_format = array('db' => 'D%x.%D');
     if ($this->_periodEnd($this->range()->getMaxStamp()) > $this->range()->getMaxStamp()) {
         $this->range()->moveMaxDate('-14d');
     }
     $this->_data = qw2('table>double_weeks systemName>double');
 }
开发者ID:evilgeny,项目名称:bob,代码行数:9,代码来源:Double.class.php

示例15: getState

 public function getState()
 {
     $data = array();
     foreach (qw2('_iterator _mediator') as $k) {
         $data[$k] = M('Memento')->setMemento($this->{$k});
     }
     $data['_factory'] = get_class($this->_factory);
     return $data;
 }
开发者ID:evilgeny,项目名称:bob,代码行数:9,代码来源:Group.class.php


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