本文整理汇总了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);
}
示例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;
}
示例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');
}
示例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'));
}
示例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;
}
示例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');
}
}
}
示例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);
}
示例8: _parseResponse
protected function _parseResponse($response)
{
$results = json_decode($response->body);
if (is_object($results)) {
$results = Set::reverse($results);
}
return $results;
}
示例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;
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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'];
}