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


PHP Set::numeric方法代码示例

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


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

示例1: save

 function save($data)
 {
     if (empty($data['Origin']) && !Set::numeric(array_keys($data))) {
         $data = array('Origin' => $data);
     }
     $key = null;
     if (!empty($data['Origin']['link'])) {
         $key = md5($data['Origin']['link']);
         if (!empty($this->__cache[$key])) {
             return $this->__cache[$key];
         }
     }
     if (empty($data['Origin']['id']) && !empty($data['Origin']['provider_key'])) {
         $found = parent::find('first', array('conditions' => array('Origin.provider_key' => $data['Origin']['provider_key'])));
         if ($found) {
             unset($found['Origin']['modified']);
             $this->set($found);
         }
     }
     $this->set($data);
     $result = parent::save();
     $result['Origin']['id'] = $this->id;
     if ($key) {
         $this->__cache[$key] = $result;
     }
     return $result;
 }
开发者ID:rchavik,项目名称:20Couch,代码行数:27,代码来源:origin.php

示例2: addLoadedItems

 function addLoadedItems($items)
 {
     $this->load();
     foreach ($items as $modelName => $m_items) {
         if (!Set::numeric(array_keys(SetMulti::excludeKeys($m_items, array('internal'))))) {
             $m_items = array($m_items);
         }
         foreach ($m_items as $item) {
             if (!empty($item['id'])) {
                 $model = ClassRegistry::init($modelName);
                 if ($model->Behaviors->attached('Node')) {
                     if (!empty($item['internal']['Node'][0]['id'])) {
                         $nodeId = $item['internal']['Node'][0]['id'];
                     } else {
                         $node = $model->node($model->myNodeRef($item['id']), false, true);
                         $nodeId = $node['Node']['id'];
                     }
                     if (!empty($nodeId)) {
                         if (isset($this->loadedItems[$nodeId])) {
                             unset($this->loadedItems[$nodeId]);
                             //Make sure everything id in DESC Order
                         }
                         $this->loadedItems[$nodeId] = $this->startTime;
                         if (!empty($item['items'])) {
                             $this->addLoadedItems($item['items']);
                         }
                     }
                 }
             }
         }
     }
     //debug($this->loadedItems);
 }
开发者ID:kevthunder,项目名称:arch,代码行数:33,代码来源:link.php

示例3: afterFind

 function afterFind($data)
 {
     if ($data && is_array($data) && !Set::numeric(array_keys($data))) {
         $data = array($data);
     }
     if (is_array($data) && Set::numeric(array_keys($data))) {
         foreach ($data as $i => $row) {
             if (empty($row['user']) && !empty($row['sender'])) {
                 $row['user'] = $row['sender'];
                 $row['message'] = true;
             } else {
                 $row['message'] = false;
             }
             $data[$i] = array('Item' => array('provider_key' => $row['id'], 'message' => $row['message'], 'text' => $row['text'], 'client' => $this->parse($row, 'source'), 'link' => 'http://twitter.com/' . $row['user']['screen_name'] . '/status/' . $row['id'], 'reply_user_provider_key' => $this->parse($row, 'in_reply_to_user_id'), 'reply_status_provider_key' => $this->parse($row, 'in_reply_to_status_id'), 'posted' => date('Y-m-d H:i:s', strtotime($row['created_at']))), 'Origin' => array('provider_key' => $row['user']['id'], 'name' => $row['user']['screen_name'], 'profile' => $row['user']['description'], 'origin_link' => $row['user']['url'], 'follower_count' => $row['user']['followers_count'], 'following_count' => $row['user']['friends_count'], 'update_count' => $row['user']['statuses_count'], 'avatar' => $row['user']['profile_image_url'], 'link' => 'http://twitter.com/' . $row['user']['screen_name']));
             if ($this->name == 'TwitterAccount') {
                 $data[$i]['Origin']['following'] = true;
             }
             if (!empty($row['retweeted_status'])) {
                 $data[$i]['Item']['text'] = $row['retweeted_status']['text'];
                 $data[$i]['ForwardOrigin'] = array('provider_key' => $row['retweeted_status']['user']['id'], 'name' => $row['retweeted_status']['user']['screen_name'], 'profile' => $row['retweeted_status']['user']['description'], 'origin_link' => $row['retweeted_status']['user']['url'], 'follower_count' => $row['retweeted_status']['user']['followers_count'], 'following_count' => $row['retweeted_status']['user']['friends_count'], 'update_count' => $row['retweeted_status']['user']['statuses_count'], 'avatar' => $row['retweeted_status']['user']['profile_image_url'], 'link' => 'http://twitter.com/' . $row['retweeted_status']['user']['screen_name']);
             }
         }
     } else {
         if (is_string($data)) {
             $dataArray = explode('&', $data);
             $data = array();
             foreach ($dataArray as $value) {
                 list($key, $value) = explode('=', $value);
                 $data[$key] = $value;
             }
         }
     }
     return $data;
 }
开发者ID:rchavik,项目名称:20Couch,代码行数:34,代码来源:twitter_base.php

示例4: afterFind

 function afterFind($results, $primary)
 {
     $results = parent::afterFind($results, $primary);
     if (!empty($results)) {
         if (!Set::numeric(array_keys($results))) {
             $tmp = array(&$results);
             $myResults =& $tmp;
         } else {
             $myResults =& $results;
         }
         foreach ($myResults as &$resRoot) {
             ////// get updated Data //////
             if (isset($resRoot[$this->alias])) {
                 $res =& $resRoot[$this->alias];
             } else {
                 $res =& $resRoot;
             }
             $res['TemplateConfig'] = $this->getConfig($res);
             if (!empty($res['TemplateConfig'])) {
                 $result = $res['TemplateConfig']->afterFind($this, $res);
                 if (!empty($result)) {
                     $res = $result;
                 }
             }
             if (!empty($resRoot['NewsletterAssoc'])) {
                 foreach ($resRoot['NewsletterAssoc'] as $assoc) {
                     $res['associated'][$assoc['type']] = $assoc['newsletter_id'];
                 }
             }
         }
     }
     return $results;
 }
开发者ID:kevthunder,项目名称:cake-newsletter,代码行数:33,代码来源:newsletter.php

示例5: afterFind

 function afterFind($data)
 {
     $data = $data['results'];
     if ($data && Set::numeric(array_keys($data))) {
         foreach ($data as $i => $row) {
             $data[$i] = array('Item' => array('provider_key' => $row['id'], 'text' => $row['text'], 'client' => $row['source'], 'link' => 'http://twitter.com/' . $row['from_user'] . '/status/' . $row['id'], 'posted' => date('Y-m-d H:i:s', strtotime($row['created_at']))), 'Origin' => array('provider_key' => $row['from_user_id'], 'name' => $row['from_user'], 'avatar' => $row['profile_image_url'], 'link' => 'http://twitter.com/' . $row['from_user']));
         }
     }
     return $data;
 }
开发者ID:rchavik,项目名称:20Couch,代码行数:10,代码来源:twitter_search.php

示例6: __prepareAction

 function __prepareAction($data)
 {
     if (isset($data['Action']) && is_array($data['Action']) && count($data['Action']) > 0 && !Set::numeric(array_keys($data['Action']))) {
         $action = $data['Action'];
         $data['Action'] = array();
         $i = 0;
         foreach ($action as $metaUuid => $metaArray) {
             $data['Action'][$i] = $metaArray;
             $i++;
         }
     }
     return $data;
 }
开发者ID:jmaties,项目名称:Layarizar,代码行数:13,代码来源:action.php

示例7: __prepareMeta

 /**
  * Private method for MetaBehavior::prepareData()
  *
  * @param object $model
  * @param array  $data
  * @return array
  */
 private function __prepareMeta($data)
 {
     if (isset($data['Meta']) && is_array($data['Meta']) && count($data['Meta']) > 0 && !Set::numeric(array_keys($data['Meta']))) {
         $meta = $data['Meta'];
         $data['Meta'] = array();
         $i = 0;
         foreach ($meta as $metaUuid => $metaArray) {
             $data['Meta'][$i] = $metaArray;
             $i++;
         }
     }
     return $data;
 }
开发者ID:rchavik,项目名称:indent-all-the-things,代码行数:20,代码来源:meta.php

示例8: beforeSave

 function beforeSave()
 {
     // Convert all the uuid keys to ordered numbers
     if (isset($this->data['NodeSchemaField']) && is_array($this->data['NodeSchemaField']) && count($this->data['NodeSchemaField']) > 0 && !Set::numeric(array_keys($this->data['NodeSchemaField']))) {
         $nodeSchemaField = $this->data['NodeSchemaField'];
         $this->data['NodeSchemaField'] = array();
         $i = 0;
         foreach ($nodeSchemaField as $nodeSchemaFieldUuid => $nodeSchemaFieldArray) {
             $this->data['NodeSchemaField'][$i] = $nodeSchemaFieldArray;
             unset($this->data['NodeSchemaField'][$nodeSchemaFieldUuid]);
             // don't need this uuid field anymore
             $i++;
         }
     }
     return true;
 }
开发者ID:hgassen,项目名称:node_schema,代码行数:16,代码来源:node_schema_field.php

示例9: checkEvents

 function checkEvents($events)
 {
     $toTrigger = array();
     if (!Set::numeric(array_keys($events))) {
         $events = array($events);
     }
     foreach ($events as $event) {
         if (empty($event[$this->alias])) {
             $event = array($this->alias => $event);
         }
         if (!empty($event[$this->alias]['time']) && strtotime($event[$this->alias]['time']) <= mktime()) {
             $toTrigger[] = $event;
         }
     }
     if (!empty($toTrigger)) {
         $this->triggerEvents($toTrigger);
     }
 }
开发者ID:kevthunder,项目名称:arch,代码行数:18,代码来源:timed_event.php

示例10: search

 function search($artist)
 {
     $artist = strtolower($artist);
     //check for "The ...." pattern, switch to ..., The"
     if (stripos($artist, 'the ') === 0) {
         $artist = substr($artist, 4) . ', The';
     }
     $url = sprintf('%s/search', $this->url);
     $params = array('type' => 'artists', 'q' => $artist);
     $results = $this->__request($url, $params);
     if (!empty($results['Exactresults'])) {
         if (Set::numeric(array_keys($results['Exactresults']['Result']))) {
             return array_shift($results['Exactresults']['Result']);
         }
         return $results['Exactresults']['Result'];
     }
     return false;
 }
开发者ID:hardsshah,项目名称:cakephp_datasource_discogs,代码行数:18,代码来源:discogs_source.php

示例11: getResultFormat

 function getResultFormat($model, &$results, $alias = null)
 {
     if (is_null($alias)) {
         $alias = $model->alias;
     }
     $oldFormat = array();
     $oldFormat['multiple'] = is_array($results) && Set::numeric(array_keys($results));
     if (!$oldFormat['multiple']) {
         $val = $results;
     } else {
         $val = reset($results);
     }
     $oldFormat['named'] = !empty($val) && (is_array($val) && isset($val[$alias]) || !empty($model->{key($val)}) && $model->{key($val)} instanceof Model);
     if (!$oldFormat['named']) {
         $val = array($alias => $val);
     }
     $oldFormat['idOnly'] = !empty($val[$alias]) && !is_array($val[$alias]) && is_numeric($val[$alias]);
     return $oldFormat;
 }
开发者ID:kevthunder,项目名称:arch,代码行数:19,代码来源:util.php

示例12: afterFind

 function afterFind($data)
 {
     $data = $data['results'];
     $filteredData = array();
     $maxReplyId = 0;
     if ($data && Set::numeric(array_keys($data))) {
         foreach ($data as $i => $row) {
             $maxReplyId = max($maxReplyId, $row['id']);
             $options = array('callbacks' => false, 'action' => 'single', 'urlSuffix' => $row['id']);
             $item = parent::find('all', $options);
             if (!empty($item['in_reply_to_status_id']) && $item['in_reply_to_status_id'] == $this->replyProviderKey) {
                 $filteredData[] = array('Item' => array('provider_key' => $row['id'], 'text' => $row['text'], 'client' => $row['source'], 'link' => 'http://twitter.com/' . $row['from_user'] . '/status/' . $row['id'], 'reply_user_provider_key' => $this->parse($item, 'in_reply_to_user_id'), 'reply_status_provider_key' => $this->parse($item, 'in_reply_to_status_id'), 'posted' => date('Y-m-d H:i:s', strtotime($row['created_at']))), 'Origin' => array('provider_key' => $row['from_user_id'], 'name' => $row['from_user'], 'avatar' => $row['profile_image_url'], 'link' => 'http://twitter.com/' . $row['from_user']));
             }
         }
     }
     if ($maxReplyId > 0) {
         $filteredData[] = array('maxReplyId' => $maxReplyId);
     }
     return $filteredData;
 }
开发者ID:rchavik,项目名称:20Couch,代码行数:20,代码来源:twitter_reply.php

示例13: normalizeConfig

 /**
  * Creates all parameters on configuration using defaults, if not set.
  * The configuration is stored back in the Configure class.
  * 
  * @access public
  * @return boolean Return true if succefully nomalized, false, if not.
  */
 static function normalizeConfig()
 {
     $config = Configure::read('ContentStream');
     if (Configure::read() && (!is_array($config['streams']) || Set::numeric(array_keys($config['streams'])))) {
         return !trigger_error('CsConfigurator::normalizeConfig - ContentStream.streams must be a array indexed by type of content stream.');
     }
     $config['streams'] = Set::normalize($config['streams']);
     foreach ($config['streams'] as $type => &$stream) {
         if (!isset($stream['model'])) {
             $stream['model'] = Inflector::camelize($type) . '.' . Inflector::classify($type);
         }
         if (!isset($stream['controller'])) {
             $stream['controller'] = Inflector::pluralize($type);
         }
         if (!isset($stream['title'])) {
             $stream['title'] = Inflector::humanize($type);
         }
     }
     Configure::write('ContentStream', $config);
     return self::$nomalized = true;
 }
开发者ID:rcaravita,项目名称:jodeljodel,代码行数:28,代码来源:cs_configurator.php

示例14: index

 function index()
 {
     $panels = array();
     foreach (Configure::read('Status.panels') as $panel => $options) {
         if (is_numeric($panel)) {
             $panel = $options;
             $options = array();
         }
         if (empty($options) || !Set::numeric(array_keys($options))) {
             $options = array($options);
         }
         if (strpos($panel, '.') !== false) {
             list($plugin, $panel) = explode('.', $panel);
         } else {
             $plugin = false;
         }
         foreach ($options as $option) {
             $panels[] = array('plugin' => $plugin, 'element' => $panel, 'options' => $option);
         }
     }
     $this->set('panels', $panels);
 }
开发者ID:sersilva,项目名称:status,代码行数:22,代码来源:status_controller.php

示例15: makeItemXml

 function makeItemXml($items)
 {
     $out = '';
     foreach ($items as $modelName => $model) {
         if (!empty($model)) {
             $tagName = Inflector::underscore($modelName);
             if ($tagName != 'data') {
                 $tagName = Inflector::singularize($tagName);
             }
             unset($model['internal']);
             if (!Set::numeric(array_keys($model))) {
                 $model = array($model);
             } else {
             }
             foreach ($model as $item) {
                 $attrib = array();
                 if (is_array($item)) {
                     $subItems = null;
                     unset($item['internal']);
                     if (!empty($item['items'])) {
                         $subItems = $item['items'];
                     }
                     unset($item['items']);
                     extract($this->dataSplitAttrib($item));
                     //debug($attrib );
                     $content = $this->makeItemXml($collections);
                     if (!empty($subItems)) {
                         $content .= $this->Xml->elem('items', null, $this->makeItemXml($subItems));
                     }
                 } else {
                     $content = $item;
                 }
                 $out .= $this->Xml->elem($tagName, $attrib, $content);
             }
         }
     }
     return $out;
 }
开发者ID:kevthunder,项目名称:arch,代码行数:38,代码来源:xml_link.php


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