camelize() 공개 정적인 메소드

Returns given word as CamelCased Converts a word like "send_email" to "SendEmail". It will remove non alphanumeric character from the word, so "who's online" will be converted to "WhoSOnline"
또한 보기: variablize()
public static camelize ( string $word ) : string
$word string the word to CamelCase
리턴 string
예제 #1
0
 public function run()
 {
     $view = $this->getView();
     JsoneditorAsset::register($view);
     $editorName = BaseInflector::camelize($this->id) . 'Editor';
     $view->registerJs("var container = document.getElementById('" . $this->options['id'] . "');\n            var options = " . Json::encode($this->editorOptions) . ";\n            var json = " . $this->value . ";\n            " . $editorName . " = new JSONEditor(container, options, json);\n            jQuery('#" . $this->id . "').parents('form').eq(0).submit(function() {\n                jQuery('#" . $this->id . "').val(" . $editorName . ".getText());\n                return true;\n            });");
     echo Html::hiddenInput($this->name, $this->value, ['id' => $this->id]);
     echo Html::tag('div', '', $this->options);
 }
예제 #2
0
 /**
  * On event callback
  */
 public function beforeAction($actionEvent)
 {
     $actionId = BaseInflector::camelize($actionEvent->action->id);
     $controllerId = BaseInflector::camelize($actionEvent->action->controller->id);
     $permissionName = "{$controllerId}.{$actionId}";
     $allowedActions = $actionEvent->action->controller->allowed();
     if (\Yii::$app->getUser()->isGuest && !in_array(strtolower($permissionName), array_map('strtolower', $allowedActions)) && \Yii::$app->getRequest()->url !== Url::to(\Yii::$app->getUser()->loginUrl)) {
         \Yii::$app->getResponse()->redirect(\Yii::$app->getUser()->loginUrl);
     }
     if (!Yii::$app->getUser()->isGuest && !in_array(strtolower($permissionName), array_map('strtolower', $allowedActions))) {
         if (!Yii::$app->user->can($permissionName)) {
             Yii::$app->getResponse()->redirect(Yii::$app->params['accessDeniedUrl']);
         }
     }
 }