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


PHP Set::reverse方法代码示例

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


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

示例1: xml

 function xml()
 {
     // import XML class
     App::import('Xml');
     // your XML file's location
     $file = TMP . 'uploads' . DS . "product.xml";
     // now parse it
     $parsed_xml =& new XML($file);
     $parsed_xml = Set::reverse($parsed_xml);
     // this is what i call magic
     // see the returned array
     // debug($parsed_xml);
     //$i = 0;
     foreach ($parsed_xml['Doct']['Product'] as $for_img) {
         //$newImage[$i]['old_id'] = $for_img['product_id'];
         if (isset($for_img['BigImage']['src'])) {
             //$newImage[$for_img['product_id']] = $for_img['BigImage']['src'];
             $this->Gift->recursive = -1;
             $giftId = $this->Gift->find('first', array('conditions' => array('Gift.old_id' => $for_img['product_id'])));
             $this->data['Image']['gift_id'] = $giftId['Gift']['id'];
             $this->data['Image']['img'] = $for_img['BigImage']['src'];
             debug($this->data['Image']);
             $this->Image->create();
             $this->Image->save($this->data['Image']);
             $this->Image->id = null;
             //$newImage[$i]['SmallImage'] = $for_img['SmallImage']['src'];
         }
         //$i++;
     }
     debug($newImage);
 }
开发者ID:kondrat,项目名称:agift,代码行数:31,代码来源:xmltest_controller.php

示例2: request

 /**
  * Process the request from MN Digital
  * @param $options an array of the function and search request
  * @return $data a formated array converting the xml response to an object to an array
  */
 public function request($options = array())
 {
     // fetch respponse
     $this->HttpSocket = new HttpSocket();
     $response = $this->HttpSocket->get($this->url, array_merge($options, $this->defaults));
     // convert xml to object
     $xml = new Xml($response);
     // convert object to array
     $this->results = Set::reverse($xml);
     // format the results
     foreach ($this->results['AlbumSearchResults']['Albums'] as $key => $value) {
         $data[$key]['mnid'] = $value['MnetId'];
         $data[$key]['artist'] = $value['Artist']['Name'];
         $data[$key]['genre'] = $value['Genre'];
         $data[$key]['explicit'] = $value['ExplicitLyrics'];
         $data[$key]['date'] = $value['ReleaseDate'];
         $data[$key]['tracks'] = $value['NumberOfTracks'];
         $data[$key]['length'] = $value['Duration'];
         $data[$key]['name'] = $value['Title'];
         $data[$key]['media'] = $value['Images'];
         foreach ($value['Tracks']['Track'] as $key2 => $value2) {
             $data[$key]['track'][$key2]['name'] = $value2['Title'];
             $data[$key]['track'][$key2]['artist'] = $value2['Artist']['Name'];
             $data[$key]['track'][$key2]['length'] = $value2['Duration'];
             $data[$key]['track'][$key2]['mnid'] = $value2['MnetId'];
             $data[$key]['track'][$key2]['track'] = $value2['TrackNumber'];
             $data[$key]['track'][$key2]['sample'] = $value2['SampleLocations']['MediaLocation'];
         }
     }
     return $data;
 }
开发者ID:studdr,项目名称:cakephp-extras,代码行数:36,代码来源:mndigital.php

示例3: admin_update

 /**
  * [AJAX] Twitterのステータスを更新する(ツイート)
  * @return	mixid	TwitterユーザープロフィールへのURL / false
  * @access	public
  */
 function admin_update()
 {
     if (!$this->data) {
         $this->notFound();
     } else {
         $result = false;
         if (!empty($this->data['Twitter']['status'])) {
             if ($this->Twitter->setupTwitterBehavior()) {
                 $result = $this->Twitter->update($this->data['Twitter']['status']);
                 if ($result) {
                     App::import('Core', 'Xml');
                     $xml = new Xml($result);
                     $array = Set::reverse($xml);
                     if (!empty($array['Status']['User']['screen_name'])) {
                         $result = 'http://twitter.com/' . $array['Status']['User']['screen_name'];
                     } else {
                         $result = false;
                     }
                 }
             }
         }
         $this->set('result', $result);
     }
     $this->render('ajax_result');
 }
开发者ID:nazo,项目名称:phpcondo,代码行数:30,代码来源:twitter_controller.php

示例4: add

 function add($dashboard_id, $template = null)
 {
     if (!empty($template) && !empty($dashboard_id)) {
         $this->Dbview->create();
         $this->data['Dbview']['name'] = $template;
         $this->data['Dbview']['code'] = file_get_contents(APP . 'templates' . DS . 'views' . DS . $template . DS . $template . '.js');
         $this->data['Dbview']['dashboard_id'] = $dashboard_id;
         $this->data['Dbview']['left'] = 100;
         $this->data['Dbview']['top'] = 100;
         $this->data['Dbview']['width'] = 300;
         $this->data['Dbview']['height'] = 300;
         if ($this->Dbview->save($this->data)) {
             $this->Session->setFlash(__('The dbview has been saved', true));
             $this->redirect(array('controller' => 'dashboards', 'action' => 'view', $dashboard_id));
         } else {
             $this->Session->setFlash(__('The dbview could not be saved. Please, try again.', true));
         }
     }
     $files = scandir(APP . 'templates' . DS . 'views');
     App::import('Xml');
     foreach ($files as $f) {
         if ($f == '.' || $f == '..' || $f == '.svn') {
             continue;
         }
         $templates[] = Set::reverse(new Xml(APP . 'templates' . DS . 'views' . DS . $f . DS . $f . '.xml'));
         $templates[count($templates) - 1]['Template']['code'] = file_get_contents(APP . 'templates' . DS . 'views' . DS . $f . DS . $f . '.js');
     }
     $this->set(compact('templates', 'dashboard_id'));
 }
开发者ID:rasmusbergpalm,项目名称:nomnom,代码行数:29,代码来源:dbviews_controller.php

示例5: find

 function find($type, $query = array())
 {
     if (is_array($type)) {
         $query = $type;
     } else {
         $query['type'] = $type;
     }
     if (!is_array($query)) {
         $query = array('Title' => $query);
     }
     $map = array('info' => 'ResponseGroup', 'type' => 'SearchIndex');
     foreach ($map as $old => $new) {
         $query[$new] = $query[$old];
         unset($query[$old]);
     }
     foreach ($query as $key => $val) {
         if (preg_match('/^[a-z]/', $key)) {
             $query[Inflector::camelize($key)] = $val;
             unset($query[$key]);
         }
     }
     $query = am(array('Service' => 'AWSECommerceService', 'AWSAccessKeyId' => $this->config['key'], 'Operation' => 'ItemSearch', 'Version' => '2008-06-28'), $query);
     $r = $this->Http->get('http://ecs.amazonaws.com/onca/xml', $query);
     $r = Set::reverse(new Xml($r));
     return $r;
 }
开发者ID:jimiyash,项目名称:debuggable-scraps,代码行数:26,代码来源:amazon_associates_source.php

示例6: add

 function add()
 {
     if ($this->isAPIKeyCorrect) {
         if (!empty($this->data)) {
             $data = array();
             //If the posted data is in XML format
             if ($this->params['url']['ext'] == 'xml') {
                 //Parse the XML Object into an array
                 $data = Set::reverse($this->data);
             } else {
                 $data = json_decode($this->data);
             }
             //Create a fountain model to use the save method
             $this->Fountain->create();
             //If it's possible to save the data
             if ($this->Fountain->save($data)) {
                 $this->set('status', '201 Created');
             } else {
                 $this->set('status', '500 Internal Server Error');
             }
         } else {
             $this->set('status', '401 Unauthorized');
         }
     }
 }
开发者ID:ninamiolane,项目名称:Software-Portfolio,代码行数:25,代码来源:fountains_controller.php

示例7: set

 function set($one, $two = null, $protectFields = true)
 {
     if ($protectFields) {
         if (!$one) {
             return;
         }
         if (is_object($one)) {
             $one = Set::reverse($one);
         }
         if (is_array($one)) {
             if (empty($one[$this->alias])) {
                 if ($this->getAssociated(key($one)) === null) {
                     $one = array($this->alias => $one);
                 }
             }
             foreach ($one as $alias => $data) {
                 if ($alias == $this->alias) {
                     $one[$alias] = $this->filterProtectedFields($data);
                 } else {
                     $associated = $this->getAssociated($alias);
                     if (!empty($associated)) {
                         $model = $associated['className'];
                         $one[$alias] = $this->{$model}->filterProtectedFields($data);
                     }
                 }
             }
         }
     }
     parent::set($one, $two);
 }
开发者ID:bluesky0811,项目名称:cakephp-protected-fields,代码行数:30,代码来源:app_model.php

示例8: _parseResponse

 protected function _parseResponse($response)
 {
     $results = json_decode($response->body);
     if (is_object($results)) {
         $results = Set::reverse($results);
     }
     return $results;
 }
开发者ID:00f100,项目名称:opauth-facebook-model,代码行数:8,代码来源:FacebookApiAppModel.php

示例9: importXml

 function importXml()
 {
     $file = dirname(dirname(__FILE__)) . '/vendors/emoji4unicode.xml';
     $xml = new Xml($file);
     $this->data = Set::reverse($xml);
     Cache::write('MobileKitEmoji', serialize($this->data));
     return;
 }
开发者ID:slywalker,项目名称:mobile_kit,代码行数:8,代码来源:emoji.php

示例10: admin_add

 function admin_add()
 {
     $Http = new HttpSocket();
     $response = $Http->get('https://www.google.com/accounts/o8/site-xrds?hd=' . $this->__getDomain());
     $response = Set::reverse(Xml::build($response->body));
     $endpoint = $response['XRDS']['XRD']['Service'][0]['URI'];
     $query = array('openid.mode' => 'checkid_setup', 'openid.ns' => 'http://specs.openid.net/auth/2.0', 'openid.return_to' => Router::url(array('plugin' => 'google_session', 'controller' => 'google_session', 'action' => 'callback', 'admin' => true), true), 'openid.ui.mode' => 'popup', 'openid.ns.ax' => 'http://openid.net/srv/ax/1.0', 'openid.ax.mode' => 'fetch_request', 'openid.ax.required' => 'email,firstname,lastname', 'openid.ax.type.email' => 'http://schema.openid.net/contact/email', 'openid.ax.type.firstname' => 'http://axschema.org/namePerson/first', 'openid.ax.type.lastname' => 'http://axschema.org/namePerson/last', 'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select', 'hq' => $this->__getDomain());
     $this->redirect($endpoint . (strpos($endpoint, '?') ? '&' : '?') . http_build_query($query));
 }
开发者ID:rodrigorm,项目名称:google_session,代码行数:9,代码来源:GoogleSessionController.php

示例11: getFontsVendor

 public function getFontsVendor($fontFamily)
 {
     $vendor = 'browser';
     $browserFonts = Set::flatten(Set::reverse($this->getBrowserFontsList()->items));
     if (!in_array($fontFamily, $browserFonts)) {
         $vendor = 'google';
     }
     return $vendor;
 }
开发者ID:nikolaskarica,项目名称:bds-alliance,代码行数:9,代码来源:fonts.php

示例12: isFeriado

 public function isFeriado(Model $model, DateTime $data, $regioes = array())
 {
     $this->feriados = array_reduce(array_merge($regioes, ['GERAL']), function ($red, $val) {
         $feriados = Set::reverse($this->getFeriadosFixos($val));
         return !isset($red) ? $feriados : array_merge($red, $feriados);
     });
     $this->calculaFeriadosMoveis($data->format('Y'));
     return in_array($data->format('d/m'), $this->feriados);
 }
开发者ID:AmmonMa,项目名称:cake_extras,代码行数:9,代码来源:ContadorFeriadosBehavior.php

示例13: getData

 /**
  * Get the content of theme.xml file
  *
  * @param string $alias theme folder name
  * @return array
  */
 function getData($alias = null)
 {
     if ($alias == null) {
         $themeXml =& new XML(WWW_ROOT . 'theme.xml');
     } else {
         $themeXml =& new XML(WWW_ROOT . 'themed' . DS . $alias . DS . 'theme.xml');
     }
     $themeData = Set::reverse($themeXml);
     return $themeData;
 }
开发者ID:andruu,项目名称:croogo,代码行数:16,代码来源:theme.php

示例14: getAllTweets

 public function getAllTweets($q, $limit = 1)
 {
     /*$results[$this->settings['page']] = $this->getTweets($q);
       
       while (array_key_exists('feed', $results[$this->settings['page']]) && $this->checkNext($results[$this->settings['page']]['feed']['link']) && $this->settings['page'] <=$limit){
           $this->settings['page'] +=1;
           $results[$this->settings['page']] = $this->getTweets($q); 		
       }*/
     $results = Set::reverse($this->Twitter->OAuth->get('search/tweets', array('q' => $q, 'lang' => $this->settings['lang'], 'count' => $this->settings['rpp'])));
     return $results;
 }
开发者ID:huanjian,项目名称:mythesis,代码行数:11,代码来源:MyTwitterComponent.php

示例15: __listServerPlugins

 /**
  * List all the plugins in the github plugin account
  *
  * @return array
  * @author Jose Diaz-Gonzalez
  */
 function __listServerPlugins($maintainer = null)
 {
     $githubServer = "http://github.com/api/v2/xml/";
     $maintainer = $maintainer == null ? 'cakephp-plugin-provider' : $maintainer;
     $pluginList = array();
     Cache::set(array('duration' => '+7 days'));
     if (($pluginList = Cache::read('Plugins.server.list.' . date('W-Y'))) === false) {
         $xmlResponse = new Xml($this->Socket->get("{$githubServer}repos/show/{$maintainer}"));
         $pluginList = Set::reverse($xmlResponse);
         Cache::set(array('duration' => '+7 days'));
         Cache::write('Plugins.server.list.' . date('W-Y'), $pluginList);
     }
     return $pluginList['Repositories']['Repository'];
 }
开发者ID:josegonzalez,项目名称:cakephp-github-plugin-plugin,代码行数:20,代码来源:list.php


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