/** * @return array action filters */ public function filters() { $out = array_merge(parent::filters(), array('accessControl', 'postOnly + delete')); if (Yii::app()->params['booster']['loadInFilters']) { $out[] = array('booster.filters.BoosterFilter'); } return array_merge(parent::filters(), $out); }
/** * @return array action filters */ public function filters() { $out = array('accessControl'); /** @var UserModule $module */ $module = $this->getModule(); if ($module->loadBoosterInFilters) { $out[] = array('booster.filters.BoosterFilter'); } return array_merge(parent::filters(), $out); }
/** * @return array action filters */ public function filters() { $out = array('accessControl', 'postOnly + addTranslation, deleteTranslation, delete'); /** @var NewsModule $module */ $module = $this->getModule(); if ($module->loadBoosterInFilters) { $out[] = array('booster.filters.BoosterFilter'); } return array_merge(parent::filters(), $out); }
/** * */ public function init() { parent::init(); $this->defaultAction = 'logout'; }
<?php /** * @package CMP * @subpackage controllers * * This file is only called on by /core/components/YOUR-EXTRA/index.php */ /** the doodles example code require_once dirname(dirname(__FILE__)).'/model/doodles/doodles.class.php'; $doodles = new Doodles($modx); return $doodles->initialize('mgr'); */ // my code, I replaced names to make them common and easier to copy an extra and then make a custom on from it /* * you should only need to change the Package Name var! Not keep all folder/files lowercase * and no spaces or hyphen(-) */ $package_name = 'cmpgenerator'; $config = array('packageName' => $package_name); // load the controller class - mycontroller.class.php define('CMP_MODEL_DIR', dirname(dirname(__FILE__)) . '/model/'); require_once CMP_MODEL_DIR . $package_name . '/mycontroller.class.php'; $cmpController = new myController($modx, $config); return $cmpController->initialize('mgr');
<?php // Require composer autoloader require __DIR__ . '/vendor/autoload.php'; require 'controller/controller.php'; // Create Router instance $router = new \Bramus\Router\Router(); $router->before('GET', '/.*', function () { header('X-Powered-By: router'); }); $router->get('/', function () { echo "Welcome to beautyUniversity JSON api"; }); $router->get('/v1/school/(\\w+)/analytic/(\\w+)', function ($name, $bool) { header('Content-Type: application/json; charset=utf-8'); ob_start("ob_gzhandler"); $req = htmlentities($name); $check = htmlentities($bool); $controller = new myController($req); if ($check === "true") { echo $controller->indexAction("colleges_" . $req); } if ($check === "false") { echo $controller->indexAction("school_" . $req); } }); $router->set404(function () { header('HTTP/1.1 404 Not Found'); echo "invalid request url"; }); $router->run();
<?php /* * This file is part of the symfony package. * (c) 2004-2006 Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please controller the LICENSE * file that was distributed with this source code. */ require_once dirname(__FILE__) . '/../../bootstrap/unit.php'; require_once $_test_dir . '/unit/sfContextMock.class.php'; $t = new lime_test(2, new lime_output_color()); class myController extends sfController { function execute() { } } $context = new sfContext(); $controller = new myController(); $controller->initialize($context); // mixins require_once $_test_dir . '/unit/sfMixerTest.class.php'; $mixert = new sfMixerTest($t); $mixert->launchTests($controller, 'sfController');