當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Inflector::humanize方法代碼示例

本文整理匯總了PHP中Inflector::humanize方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::humanize方法的具體用法?PHP Inflector::humanize怎麽用?PHP Inflector::humanize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Inflector的用法示例。


在下文中一共展示了Inflector::humanize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $path = func_get_args();
     //debug($path);
     $count = count($path);
     //debug($count);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     //debug(Inflector::humanize($path[$count - 1]));
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     //debug($this->render(implode('/', $path)));
     //debug($page);
     //debug($subpage);
     //debug($title_for_layout);
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
開發者ID:pavsnellski,項目名稱:SMC,代碼行數:42,代碼來源:PagesController.php

示例2: display

 /**
  * Displays a view
  *
  * @return void
  * @throws NotFoundException When the view file could not be found
  *	or MissingViewException in debug mode.
  */
 public function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     // 獲取用戶所有的項目
     $this->loadModel('Project');
     $projects = $this->Project->findAllByUserId($this->Auth->user('id'));
     $this->set('ProjectList', $projects);
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
開發者ID:sdgdsffdsfff,項目名稱:JustDeployIt,代碼行數:38,代碼來源:PagesController.php

示例3: set_values

 public function set_values(array $data)
 {
     if (!Valid::url($data['next_url'])) {
         $data['next_url'] = NULL;
     }
     $data['fields'] = array();
     if (!empty($data['field']) and is_array($data['field'])) {
         foreach ($data['field'] as $key => $values) {
             foreach ($values as $index => $value) {
                 if ($index == 0) {
                     continue;
                 }
                 if ($key == 'source') {
                     $value = URL::title($value, '_');
                 }
                 $data['fields'][$index][$key] = $value;
             }
         }
         $data['field'] = NULL;
     }
     $email_type_fields = array();
     foreach ($data['fields'] as $field) {
         $email_type_fields['key'][] = $field['id'];
         $email_type_fields['value'][] = !empty($field['name']) ? $field['name'] : Inflector::humanize($field['id']);
     }
     $this->create_email_type($email_type_fields);
     return parent::set_values($data);
 }
開發者ID:ZerGabriel,項目名稱:cms-1,代碼行數:28,代碼來源:sendmail.php

示例4: display

/**
 * Displays a view
 *
 * @param mixed What page to display
 * @return void
 */
	public function display() {
		$path = func_get_args();

		$count = count($path);
		if (!$count) {
			$this->redirect('/');
		}
		$page = $subpage = $titleForLayout = null;

		if (!empty($path[0])) {
			$page = $path[0];
		}
		if (!empty($path[1])) {
			$subpage = $path[1];
		}
		if (!empty($path[$count - 1])) {
			$titleForLayout = Inflector::humanize($path[$count - 1]);
		}
		$this->set(array(
			'page' => $page,
			'subpage' => $subpage,
			'title_for_layout' => $titleForLayout
		));
		$this->render(implode('/', $path));
	}
開發者ID:hungnt88,項目名稱:5stars-1,代碼行數:31,代碼來源:PagesController.php

示例5: add

 /**
  * Sample action for uploading a twitpic. Not intended for use in your apps.
  */
 public function add()
 {
     if (!empty($this->data)) {
         if ($this->TwitterAuth->isAuthorized) {
             if ($this->Twitpic->save($this->data)) {
                 $this->Session->setFlash(__('Twitpic created successfully', true));
                 $this->redirect(array('action' => 'view', $this->Twitpic->getInsertID()));
             } else {
                 if (!empty($this->Twitpic->response['error'])) {
                     $flashMessage = $this->Twitpic->response['error'];
                 } elseif (!empty($this->Twitpic->validationErrors)) {
                     $flashMessage = '';
                     foreach ($this->Twitpic->validationErrors as $field => $errorMessage) {
                         $flashMessage .= Inflector::humanize($field) . ': ' . $errorMessage;
                     }
                 } else {
                     $flashMessage = __('Unknown error', true);
                 }
             }
         } else {
             $flashMessage = __('You are not authorized', true);
         }
         $this->Session->setFlash($flashMessage);
     }
 }
開發者ID:neilcrookes,項目名稱:CakePHP-Twitter-API-Plugin,代碼行數:28,代碼來源:twitpics_controller.php

示例6: display

 function display()
 {
     $path = func_get_args();
     if (!count($path)) {
         $this->redirect('/');
     }
     $count = count($path);
     $page = $subpage = $title = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title'));
     if ($this->RequestHandler->isMobile()) {
         //	$this->layout = 'iphone';
         $this->render(join('/', $path));
     } else {
         $this->render(join('/', $path));
     }
 }
開發者ID:quinns,項目名稱:REST-API,代碼行數:25,代碼來源:pages_controller.php

示例7: add

 /**
  * Add a menu item.
  *
  * @param string $path dot separated path in the array.
  * @param array $options menu options array
  * @return void
  */
 public static function add($path, $options)
 {
     if (Reveal::is('Sapi.cli')) {
         return;
     }
     if (!empty($options['access'])) {
         foreach ((array) $options['access'] as $rule) {
             $check = strpos($rule, '!') === 0;
             if ($check) {
                 $rule = substr($rule, 1);
             }
             if (Reveal::is($rule) == $check) {
                 return;
             }
         }
         unset($options['access']);
     }
     $pathE = explode('.', $path);
     $pathE = array_splice($pathE, 0, count($pathE) - 2);
     $parent = join('.', $pathE);
     if (!empty($parent) && !Hash::check(self::$_items, $parent)) {
         $title = Inflector::humanize(end($pathE));
         $o = array('title' => $title);
         self::_setupOptions($o);
         self::add($parent, $o);
     }
     self::_setupOptions($options);
     $current = Hash::extract(self::$_items, $path);
     if (!empty($current)) {
         self::_replace(self::$_items, $path, $options);
     } else {
         self::$_items = Hash::insert(self::$_items, $path, $options);
     }
 }
開發者ID:gourmet,項目名稱:common,代碼行數:41,代碼來源:Navigation.php

示例8: display

 public function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     $this->loadModel('Article');
     $this->paginate = array('Article' => array('limit' => 5, 'order' => array('id' => 'desc'), 'conditions' => array('is_active' => '1')));
     $articledata = $this->paginate('Article');
     //pr($articledata);
     $this->set('dataArt', $articledata);
     $this->render(implode('/', $path));
 }
開發者ID:ankitbhattgit,項目名稱:cake,代碼行數:25,代碼來源:PagesController.php

示例9: display

 public function display()
 {
     $this->layout = "institutional";
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     $pages = $this->Institutional->find('all', array('order' => array('Institutional.id ASC')));
     $this->set('pages', $pages);
     $adm_users = $this->User->find('all', array('conditions' => array('User.role' => 'adm')));
     $this->set('adm_users', $adm_users);
     try {
         $this->render(implode('/', $path));
     } catch (MissingViewException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
開發者ID:matheuswauler,項目名稱:affinity,代碼行數:32,代碼來源:PagesController.php

示例10: add

 /**
  * Sample action for creating a tweet
  */
 public function add()
 {
     if (!empty($this->data)) {
         if ($this->TwitterAuth->isAuthorized) {
             if ($this->TwitterStatus->tweet($this->data)) {
                 $flashMessage = __('Your status has been updated', true);
             } else {
                 if (!empty($this->TwitterStatus->response['error'])) {
                     $flashMessage = $this->TwitterStatus->response['error'];
                 } elseif (!empty($this->TwitterStatus->validationErrors)) {
                     $flashMessage = '';
                     foreach ($this->TwitterStatus->validationErrors as $field => $errorMessage) {
                         $flashMessage .= Inflector::humanize($field) . ': ' . $errorMessage;
                     }
                 } else {
                     $flashMessage = __('Unknown error', true);
                 }
             }
         } else {
             $flashMessage = __('You are not authorized', true);
         }
     }
     $this->Session->setFlash($flashMessage);
     $this->redirect($this->referer('/', true));
 }
開發者ID:neilcrookes,項目名稱:CakePHP-Twitter-API-Plugin,代碼行數:28,代碼來源:twitter_statuses_controller.php

示例11: sort

 /**
  * Generates a sorting link. Sets named parameters for the sort and direction.  Handles
  * direction switching automatically.
  *
  * ### Options:
  *
  * - `escape` Whether you want the contents html entity encoded, defaults to true
  * - `model` The model to use, defaults to PaginatorHelper::defaultModel()
  *
  * @param string $title Title for the link.
  * @param string $key The name of the key that the recordset should be sorted.  If $key is null
  *   $title will be used for the key, and a title will be generated by inflection.
  * @param array $options Options for sorting link. See above for list of keys.
  * @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified
  *  key the returned link will sort by 'desc'.
  * @access public
  */
 function sort($title, $key = null, $options = array())
 {
     $options = array_merge(array('url' => array(), 'model' => null), $options);
     $url = $options['url'];
     unset($options['url']);
     if (empty($key)) {
         $key = $title;
         $title = __(Inflector::humanize(preg_replace('/_id$/', '', $title)));
     }
     $dir = isset($options['direction']) ? $options['direction'] : 'asc';
     unset($options['direction']);
     $sortKey = $this->sortKey($options['model']);
     $defaultModel = $this->defaultModel();
     $isSorted = $sortKey === $key || $sortKey === $defaultModel . '.' . $key || $key === $defaultModel . '.' . $sortKey;
     if ($isSorted) {
         $dir = $this->sortDir($options['model']) === 'asc' ? 'desc' : 'asc';
         $class = $dir === 'asc' ? 'desc' : 'asc';
         if (!empty($options['class'])) {
             $options['class'] .= ' ' . $class;
         } else {
             $options['class'] = $class;
         }
     }
     if (is_array($title) && array_key_exists($dir, $title)) {
         $title = $title[$dir];
     }
     $url = array_merge(array('sort' => $key, 'direction' => $dir), $url, array('order' => null));
     return $this->link($title, $url, $options);
 }
開發者ID:sgh1986915,項目名稱:cakephp2-bpong,代碼行數:46,代碼來源:NewPaginatorHelper.php

示例12: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @access public
  */
 function display()
 {
     if (!func_num_args()) {
         $this->redirect('/');
     }
     $path = func_get_args();
     if (!count($path)) {
         $this->redirect('/');
     }
     $count = count($path);
     $page = null;
     $subpage = null;
     $title = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title = Inflector::humanize($path[$count - 1]);
     }
     $this->set('page', $page);
     $this->set('subpage', $subpage);
     $this->set('title', $title);
     $this->render(join('/', $path));
 }
開發者ID:Galvanio,項目名稱:Kinspir,代碼行數:33,代碼來源:pages_controller.php

示例13: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @access public
  */
 function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         $this->redirect('/');
     }
     $page = $subpage = $title_for_layout = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title_for_layout = Inflector::humanize($path[$count - 1]);
     }
     //To load custom data for a page, add a _$page method, and it will trigger.
     //You can set data there for that page.
     if (isset($page) && method_exists($this, '_' . $page)) {
         call_user_method('_' . $page, $this);
     }
     $this->set(compact('page', 'subpage', 'title_for_layout'));
     $this->render(implode('/', $path));
 }
開發者ID:JamieS,項目名稱:Pail---Shovel,代碼行數:31,代碼來源:pages_controller.php

示例14: display

/**
 * Displays a view
 *
 * @param mixed What page to display
 * @access public
 */
	function display() {
		$path = func_get_args();
		$count = count($path);
		if (!$count) {
			$this->redirect('/');
		}
		$page = $subpage = $title_for_layout = null;

		if (!empty($path[0])) {
			$page = $path[0];
		}
		if (!empty($path[1])) {
			$subpage = $path[1];
		}
		if (!empty($path[$count - 1])) {
			$title_for_layout = Inflector::humanize($path[$count - 1]);
		}
		
		$user = $this->Auth->user();
		if($path[0] == 'upgrade' && empty($user)){
			$this->layout = 'client_review';
		}
		
		$this->set(compact('page', 'subpage', 'title_for_layout'));
		$this->render(implode('/', $path));
	
	}
開發者ID:robksawyer,項目名稱:FIND---GET---MAKE,代碼行數:33,代碼來源:pages_controller.php

示例15: display

 /**
  * Displays a view
  *
  * @param mixed What page to display
  * @access public
  */
 function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         $this->redirect('/');
     }
     $page = $subpage = $title = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     if (!empty($path[$count - 1])) {
         $title = Inflector::humanize($path[$count - 1]);
     }
     if ($page == 'demo') {
         $this->layout = 'ajax';
     }
     $this->set(compact('page', 'subpage', 'title'));
     if (!$this->siteDown) {
         $this->render(join('/', $path));
     } else {
         $this->layout = 'blank';
         $this->render(join('/', $path));
     }
 }
開發者ID:christianallred,項目名稱:fluent_univ,代碼行數:34,代碼來源:pages_controller.php


注:本文中的Inflector::humanize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。