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


PHP AbstractController::init方法代码示例

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


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

示例1: init

    function init()
    {
        parent::init();
        //UA-36477683-1
        $account = $this->api->getConfig('google/analytics/account', false);
        if ($account === false) {
            return $this->destroy();
        }
        $this->api->add('Text', null, 'js_block')->setHTML(<<<EOF
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', '{$account}');
</script>        
EOF
);
        $this->api->addHook('post-init', function ($api) {
            $p = $api->page;
            if ($p == 'index') {
                $p = '';
            }
            $api->page_object->js(true, "ga('send','pageview', '/" . $p . "');");
        });
    }
开发者ID:agile55,项目名称:ga,代码行数:27,代码来源:Tracker.php

示例2: init

 /**
  * 初始化
  * (non-PHPdoc)
  * @see AbstractController#init()
  */
 public function init()
 {
     parent::init();
     $this->oSkin = new Config_Skin();
     $this->oHero = new Config_Hero();
     $this->oApp = new Config_App();
 }
开发者ID:032404cxd,项目名称:prototype_main,代码行数:12,代码来源:SkinController.php

示例3: init

 function init()
 {
     parent::init();
     $this->implementations_names_query = new OpenStackImplementationNamesQueryHandler();
     $this->distribution_repository = new SapphireDistributionRepository();
     $this->appliance_repository = new SapphireApplianceRepository();
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:7,代码来源:Implementation_Controller.php

示例4: init

 function init()
 {
     parent::init();
     if ($this->page_name === null) {
         $this->page_name = $this->owner->short_name;
     }
     $this->user = $this->add('xavoc_acl/Model_ACLUser');
     $this->user->load($this->api->auth->model->id);
     $this->page = $this->add('xavoc_acl/Model_AclPages');
     $this->page->addCondition('name', $this->page_name);
     $this->page->tryLoadAny();
     if (!$this->page->loaded()) {
         $this->page->save();
         if (!$this->user['is_system_admin']) {
             throw $this->exception('This page is first time loaded, Added to system, Let System administrator manage it for you');
         }
     }
     $this->user_acl = $this->user->ref('xavoc_acl/Acl')->addCondition('page_id', $this->page->id)->tryLoadAny();
     if (!$this->user_acl->loaded()) {
         if ($this->user['is_system_admin']) {
             $this->user_acl['allowed'] = true;
             $this->user_acl['permissions'] = 30;
         }
         $this->user_acl->save();
         if (!$this->user['is_system_admin']) {
             throw $this->exception('This is your first access to this page, Your request is sent to administrator');
         }
     }
     if ($this->user_acl['allowed'] == false) {
         throw $this->exception('You are not allowed to access the page');
     }
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:32,代码来源:Acl.php

示例5: init

 function init()
 {
     parent::init();
     $this->api->addGlobalMethod('frame', array($this, 'frame'));
     $this->api->addGlobalMethod('ajax', array($this, 'ajax'));
     $this->api->addHook('compat-addModelSave', array($this, 'addModelSave'));
 }
开发者ID:respond,项目名称:atk4,代码行数:7,代码来源:Compat.php

示例6: init

 public function init()
 {
     parent::init();
     $this->adminUser = Table::factory('Users')->loadFromSession();
     $this->assign('adminUser', $this->adminUser);
     switch ($this->path->getAction()) {
         case "login":
             if ($this->adminUser->isAuthed()) {
                 throw new InitException($this->redirectAction("index"), "Already Authed");
             }
             break;
         default:
             if (!$this->adminUser->isAuthed()) {
                 throw new InitException($this->redirectAction("login"), "Not Authed");
             }
             break;
     }
     if ($this->getMatch('id') !== null) {
         $post = Table::factory('Posts')->read($this->getMatch('id'));
         if ($post == false || $this->adminUser->owns($post) == false) {
             throw new InitException($this->redirectAction("index", "You cannot perform this action"), "You cannot perform this action");
         }
         $this->post = $post;
     }
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:25,代码来源:admin.php

示例7: init

 /**
  * 初始化
  * (non-PHPdoc)
  * @see AbstractController#init()
  */
 public function init()
 {
     parent::init();
     $this->oUser = new Lm_User();
     $this->oResearch = new Config_Research();
     $this->oQuestion = new Config_Research_Question();
 }
开发者ID:032404cxd,项目名称:prototype_main,代码行数:12,代码来源:ResearchController.php

示例8: init

 function init()
 {
     parent::init();
     $this->api->requires('atk', '4.2');
     $symbols = $this->owner->model->_dsql()->field($this->owner->model->_dsql()->expr("DISTINCT LEFT({$this->field},1) as symbol"))->order($this->field);
     $ul = $this->api->add('View', null, 'Content')->setElement('ul')->addClass('gridqsearch');
     $li = $ul->add('View', 'c')->setElement('li')->addClass('refresh')->addStyle('cursor', 'pointer');
     $li->add('View')->setElement('span')->addClass('qsearch-refresh')->set("clear");
     $li->js('click', array($this->owner->js()->reload(array('filter' => 'clear'))));
     foreach ($symbols as $symbol) {
         $li = $ul->add('View', 'c' . $this->count++)->setElement('li')->addClass('ui-corner-all')->addStyle('cursor', 'pointer');
         $li->add('View')->setElement('span')->addClass('qsearch-value')->set($symbol['symbol']);
         $li->js('click', array($this->owner->js()->reload(array('filter' => $li->js()->text()))));
     }
     if ($_GET['filter'] != '') {
         if ($_GET['filter'] == 'clear') {
             $this->api->forget('filter');
         } else {
             $this->api->memorize('filter', $_GET['filter']);
         }
     }
     if ($this->api->recall('filter') != '') {
         $this->owner->model->addCondition($this->field, 'like', trim($this->api->recall('filter')) . '%');
     }
 }
开发者ID:xavoctechnocratspvtltd,项目名称:svc,代码行数:25,代码来源:GridQSearch.php

示例9: init

 public function init()
 {
     parent::init();
     $target = $this->HTTPRequest()->sharedRequest()->objectForKey("target");
     switch ($this->getAction()) {
         case self::ACTION_READ:
             $model = ReadAction::alloc()->init();
             $model->setTarget($target);
             echo $model->read()->asJSON();
             break;
         case self::ACTION_READ_HEADERS:
             $model = ReadHeadersAction::alloc()->init();
             $model->setTarget($target);
             echo $model->readHeaders()->asJSON();
             break;
         case self::ACTION_SET:
             $model = SetAction::alloc()->init();
             $model->setTarget($target);
             echo json_encode($model->set());
             break;
         default:
             throw new Exception("Unknown action '" . $this->getAction() . "'", MFUnknownActionError);
     }
     return $this;
 }
开发者ID:nbalonso,项目名称:MunkiFace,代码行数:25,代码来源:IndexController.php

示例10: init

 public function init()
 {
     parent::init();
     $this->headers['Mime-Version'] = '1.0';
     $this->headers['Content-Transfer-Encoding'] = '8bit';
     $this->setBodyType('text');
 }
开发者ID:atk4,项目名称:atk4,代码行数:7,代码来源:Compat.php

示例11: init

 function init()
 {
     parent::init();
     $this->api->pr = $this;
     $this->profstart = time() + microtime();
     $this->start('everything else');
 }
开发者ID:xavoctechnocratspvtltd,项目名称:svc,代码行数:7,代码来源:Profiler.php

示例12: init

 function init()
 {
     parent::init();
     if (!$this->owner instanceof Model_Table) {
         throw $this->exception('Use with Model_Table only');
     }
     $ni = clone $this->owner;
     $msg = "";
     foreach ($this->unique_fields as $field => $value) {
         if (is_array($value)) {
             foreach ($value as $f => $v) {
                 $ni->addCondition($f, $v);
                 $msg .= " {$f} with {$v} value,";
             }
         } else {
             $ni->addCondition($field, $value);
             $msg .= "{$field} with {$value} ";
         }
         if ($this->owner->loaded()) {
             $ni->addCondition('id', '<>', $this->owner->id);
         }
         $ni->tryLoadAny();
         if ($ni->loaded()) {
             throw $this->exception("Already Existes with {$msg}");
         }
         //->setField($field);
     }
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:28,代码来源:Unique.php

示例13: init

 function init()
 {
     parent::init();
     $this->dbh = new PDO($this->api->getConfig('pdo/dsn'), $this->api->getConfig('pdo/user', 'root'), $this->api->getConfig('pdo/password', 'root'), $this->api->getConfig('pdo/options', array(PDO::ATTR_PERSISTENT => true)));
     $this->dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $this->table_prefix = $this->api->getConfig('pdo/table_prefix', '');
 }
开发者ID:respond,项目名称:atk4,代码行数:7,代码来源:DB.php

示例14: init

 function init()
 {
     parent::init();
     $this->owner->addField('id')->type('int')->system(true);
     $this->owner->addField('name');
     $this->owner->addMethod('getBy,loadBy', $this);
 }
开发者ID:romaninsh,项目名称:atkSchool,代码行数:7,代码来源:Array.php

示例15: init

 public function init()
 {
     parent::init();
     if (($post_id = $this->getFlash("preview_post_id")) !== null) {
         Log::debug("Got preview post ID [" . $post_id . "]");
         $post = Table::factory('Posts')->read($post_id);
         if ($post == false) {
             throw new CoreException('No matching blog post found to preview', CoreException::PATH_REJECTED);
         }
         // we need to explicitly opt out of caching as this should be a one-time only link
         Log::info("Disabling cache for one-time blog post viewing");
         $this->request->disableCache();
     } else {
         if ($this->getMatch('month') && $this->getMatch('url')) {
             $post = Table::factory('Posts')->findByMonthAndUrl($this->getMatch('month'), $this->getMatch('url'));
             if ($post == false) {
                 throw new CoreException('No matching blog post found', CoreException::PATH_REJECTED);
             }
         }
     }
     if (isset($post) && is_object($post)) {
         $this->post = $post;
         $this->assign('post', $this->post);
         $this->assign('comments', $post->getApprovedComments());
         // get the fields for comments
         $this->assign('columns', Table::factory('Comments')->getColumns());
     }
     $this->assign('tags', Table::factory('Posts')->findAllTags());
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:29,代码来源:blog.php


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