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


PHP Helpers::CheckClassType方法代码示例

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


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

示例1: loadTargetModel

 /**
  * Loads Target Model for the Comment
  * It needs to be a SiContentBehavior Object
  *
  * @return type
  */
 private function loadTargetModel()
 {
     // Fast lane
     if ($this->cachedLoadedTarget != null) {
         return $this->cachedLoadedTarget;
     }
     // Request Params
     $targetModelClass = Yii::app()->request->getParam('model');
     $targetModelId = (int) Yii::app()->request->getParam('id');
     $targetModelClass = Yii::app()->input->stripClean(trim($targetModelClass));
     if ($targetModelClass == "" || $targetModelId == "") {
         throw new CHttpException(500, Yii::t('CommentModule.controllers_CommentController', 'Model & Id Parameter required!'));
     }
     if (!Helpers::CheckClassType($targetModelClass, 'HActiveRecordContent')) {
         throw new CHttpException(500, Yii::t('CommentModule.controllers_CommentController', 'Invalid target class given'));
     }
     $model = call_user_func(array($targetModelClass, 'model'));
     $target = $model->findByPk($targetModelId);
     if (!$target instanceof HActiveRecordContent) {
         throw new CHttpException(500, Yii::t('CommentModule.controllers_CommentController', 'Invalid target class given'));
     }
     if ($target == null) {
         throw new CHttpException(404, Yii::t('CommentModule.controllers_CommentController', 'Target not found!'));
     }
     // Check if we can read the target model, so we can comment it?
     if (!$target->content->canRead(Yii::app()->user->id)) {
         throw new CHttpException(403, Yii::t('CommentModule.controllers_CommentController', 'Access denied!'));
     }
     // Create Fastlane:
     $this->cachedLoadedTarget = $target;
     return $target;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:38,代码来源:CommentController.php

示例2: init

 public function init()
 {
     if (!Helpers::CheckClassType($this->parserClass, "cebe\\markdown\\Parser")) {
         throw new CException("Invalid markdown parser class given!");
     }
     Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/resources/highlight.js/highlight.pack.js');
     Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/resources/highlight.js/styles/' . $this->highlightJsCss . '.css');
     Yii::app()->clientScript->registerScript("highlightJs", '$("pre code").each(function(i, e) { hljs.highlightBlock(e); });');
 }
开发者ID:skapl,项目名称:design,代码行数:9,代码来源:MarkdownViewWidget.php

示例3: instantiate

 protected function instantiate($attributes)
 {
     $className = $attributes['class'];
     if (Helpers::CheckClassType($className, 'Notification')) {
         // Instanciate correct Asset Model
         $model = new $className(null);
         return $model;
     }
     return null;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:10,代码来源:Notification.php

示例4: actionContent

 /**
  * Redirects to given HActiveRecordContent or HActiveRecordContentAddon
  */
 public function actionContent()
 {
     $id = (int) Yii::app()->request->getParam('id', "");
     $model = Yii::app()->request->getParam('model');
     // Check given model
     if (!Helpers::CheckClassType($model, array('HActiveRecordContent', 'HActiveRecordContentAddon'))) {
         throw new CHttpException(404, Yii::t('WallModule.controllers_PermaController', 'Invalid model given!'));
     }
     $model = call_user_func(array($model, 'model'));
     $object = $model->findByPk($id);
     if ($object == null) {
         throw new CHttpException(404, Yii::t('WallModule.controllers_PermaController', 'Could not find requested content!'));
     }
     $this->redirect($object->content->getUrl());
 }
开发者ID:skapl,项目名称:design,代码行数:18,代码来源:PermaController.php

示例5: getTypeInstances

 /**
  * Returns an array of instances of all available field types.
  *
  * @return Array
  */
 public static function getTypeInstances($profileField = null)
 {
     $types = array();
     foreach (self::getFieldTypes() as $className => $title) {
         if (Helpers::CheckClassType($className, 'ProfileFieldType')) {
             $instance = new $className();
             if ($profileField != null) {
                 $instance->profileField = $profileField;
                 // Seems current type, so try load data
                 if ($profileField->field_type_class == $className) {
                     $instance->load();
                 }
             }
             $types[] = $instance;
         }
     }
     return $types;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:23,代码来源:ProfileFieldType.php

示例6: actionContent

 /**
  * On given Content Class and id redirect the user to it.
  */
 public function actionContent()
 {
     $content = Content::model()->findByAttributes(array('object_model' => Yii::app()->request->getParam('model'), 'object_id' => Yii::app()->request->getParam('id')));
     if ($content != null) {
         $url = $this->createUrl('WallEntry', array('id' => $content->getFirstWallEntryId()));
         $this->redirect($url);
         return;
     }
     $id = (int) Yii::app()->request->getParam('id', "");
     $model = Yii::app()->request->getParam('model');
     // Check given model
     if (!Helpers::CheckClassType($model, 'HActiveRecord')) {
         throw new CHttpException(404, Yii::t('WallModule.controllers_PermaController', 'Unknown content class!'));
     }
     $model = call_user_func(array($model, 'model'));
     $object = $model->findByPk($id);
     if ($object == null) {
         throw new CHttpException(404, Yii::t('WallModule.controllers_PermaController', 'Could not find requested content!'));
     }
     $url = $this->createUrl('WallEntry', array('id' => $object->content->getFirstWallEntryId()));
     $this->redirect($url);
 }
开发者ID:alefernie,项目名称:intranet,代码行数:25,代码来源:PermaController.php

示例7: getFieldType

 /**
  * Returns the ProfileFieldType Class for this Profile Field
  *
  * @return ProfileFieldType
  */
 public function getFieldType()
 {
     if ($this->_fieldType != null) {
         return $this->_fieldType;
     }
     if ($this->field_type_class != "" && Helpers::CheckClassType($this->field_type_class, 'ProfileFieldType')) {
         $type = $this->field_type_class;
         $this->_fieldType = new $type();
         $this->_fieldType->setProfileField($this);
         return $this->_fieldType;
     }
     return null;
 }
开发者ID:alefernie,项目名称:intranet,代码行数:18,代码来源:ProfileField.php

示例8: loadContentAddon

 /**
  * Loads Content Addon
  * We also validates that the content addon corresponds to the loaded content.
  * 
  * @param string $className
  * @param int $pk
  */
 public function loadContentAddon($className, $pk)
 {
     if (!Helpers::CheckClassType($className, 'HActiveRecordContentAddon')) {
         throw new CException("Given className is not a content addon model!");
     }
     $model = call_user_func(array($className, 'model'));
     $target = $model->findByPk($pk);
     if ($target === null) {
         throw new CHttpException(500, 'Could not find content addon record!');
     }
     if ($target->object_model != get_class($this->parentContent) && $target->object_id != $this->parentContent->getPrimaryKey()) {
         throw new CHttpException(500, 'Content addon not belongs to given content record!');
     }
     $this->contentAddon = $target;
 }
开发者ID:skapl,项目名称:design,代码行数:22,代码来源:ContentAddonController.php


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