__construct() public method

Constructor
public __construct ( Cake\Controller\ComponentRegistry $registry, array $config = [] )
$registry Cake\Controller\ComponentRegistry A ComponentRegistry this component can use to lazy load its components
$config array Array of configuration settings.
 public function __construct(ComponentCollection $collection, $settings = array())
 {
     parent::__construct($collection, $settings);
     // initialize callback urls
     $router = new Router();
     $baseurl = $router->url('/', true);
     $this->controller = $collection->getController();
     $this->http = new Client();
     // Load in PHP extension ZIP...?
     if (extension_loaded('zip') == true) {
         $this->zip = new ZipArchive();
         $this->Controller = $collection->getController();
     } else {
         throw new MissingComponentException(__('Error: Not Load extension "ZIP" in PHP.INI!!'));
     }
     $this->controller->loadModel('EmailTemplates');
     $this->EmailTemplates = $this->controller->EmailTemplates;
     /*
     
      // prefetch partner details
      $this->Partners = $this->controller->Partners;        
      $this->partner_id = $this->controller->Auth->user('partner_id');
      $this->partner = $this->Partners->get($this->partner_id);
      // end prefetch
     */
 }
 /**
  * Constructor.
  *
  * @param \Cake\Controller\ComponentRegistry $collection
  * @param array $config
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     $this->Controller = $collection->getController();
     $defaults = (array) Configure::read('Ajax') + $this->_defaultConfig;
     $config += $defaults;
     parent::__construct($collection, $config);
 }
Example #3
0
 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $collection Component Registry
  * @param array $config Array of configuration settings.
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     $this->_controller = $collection->getController();
     $this->_eventManager = $this->_controller->eventManager();
     parent::__construct($collection, $config);
     $this->_createCrudComponentInstance();
 }
 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry object.
  * @param array             $config   Array of configuration settings.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($registry->getController() instanceof \Cake\Controller\Controller) {
         $this->_controller = $registry->getController();
     }
 }
 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $collection
  * @param array $config Config options array
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     parent::__construct($collection, $config);
     $Controller = $collection->getController();
     $this->request = $Controller->request;
     $this->response = $Controller->response;
 }
Example #6
0
 /**
  * Component constructor.
  *
  * @param ComponentRegistry $registry
  * @param array $config
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($controller = $registry->getController()) {
         $this->_controller = $controller;
     }
 }
 /**
  * Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
  *
  * @param ComponentRegistry $registry ComponentRegistry object.
  * @param array $config Config options array
  */
 public function __construct(ComponentRegistry $registry, $config = [])
 {
     $this->_defaultConfig = Hash::merge($this->_defaultConfig, $this->_translateConfigMessages(), (array) Configure::read('UserTools.Component'));
     $this->_controller = $registry->getController();
     $this->response = $this->_controller->response;
     parent::__construct($registry, $config);
 }
 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry object.
  * @param array             $config   Array of configuration settings.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     if ($registry->getController() instanceof \Cake\Controller\Controller) {
         $this->_session = $registry->getController()->request->session();
     }
     $facebookConfig = Configure::read('Facebook');
     FacebookSession::setDefaultApplication($facebookConfig['app_id'], $facebookConfig['app_secret']);
 }
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $this->controller = $collection->getController();
     /*
      * Register event listener in the constructor (and not in the startup() method)
      * to ensure the listener is set when code in Controller->beforeFilter() is executed
      * (startup() is called after Controller->beforeFilter())
      */
     $this->listenToModelBeforeSave();
 }
Example #10
0
 /**
  * Constructor. Will return an instance of the correct ACL class as defined in `Configure::read('Acl.classname')`
  *
  * @param ComponentRegistry $collection A ComponentRegistry
  * @param array $config Array of configuration settings
  * @throws \Cake\Error\Exception when Acl.classname could not be loaded.
  */
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $className = $name = Configure::read('Acl.classname');
     if (!class_exists($className)) {
         $className = App::className('Acl.' . $name, 'Adapter');
         if (!$className) {
             throw new Error\Exception(sprintf('Could not find %s.', $name));
         }
     }
     $this->adapter($className);
 }
 public function __construct(&$controller, $settings = array())
 {
     parent::__construct($controller, $settings);
     if (isset($settings['skipAuthCheck'])) {
         $this->skipAuthCheck = $settings['skipAuthCheck'];
     }
     if (!empty($settings['exclude_check_on'])) {
         foreach ($settings['exclude_check_on'] as $exclude_check_on) {
             $this->_excludeCheckOnList[] = $exclude_check_on;
         }
     }
     $this->secret = Configure::read('shared_secret');
     $this->api_key = Configure::read('api_key');
     $this->scope = Configure::read('scope');
 }
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     // initialize callback urls
     $router = new Router();
     $baseurl = $router->url('/', true);
     $this->callback_url = $baseurl . 'external_apps/salesforce/callback';
     //end
     $this->controller = $collection->getController();
     $this->http = new Client();
     $this->controller->loadModel('Vendors');
     // prefetch vendor details
     $this->Vendors = $this->controller->Vendors;
     $this->vendor_id = $this->controller->Auth->user('vendor_id');
     $this->vendor = $this->Vendors->get($this->vendor_id);
     // end prefetch
 }
 /**
  * Class constructor
  *
  * @param Cake\Controller\ComponentRegistry $collection ComponentRegistry instance.
  * @param array $config Configuration options
  * @return void
  */
 public function __construct(\Cake\Controller\ComponentRegistry $collection, array $config)
 {
     pr("AppPlusPlus __construct()");
     // make calling controller available
     $this->_controller = $collection->getController();
     // Enable Authentication if needed
     if ($this->Config('Authentication.enabled')) {
         $this->setupAuth();
     }
     // Load components for the calling calling controller
     $this->_controller->loadComponent('RequestHandler');
     $this->_controller->loadComponent('Flash');
     $this->_controller->loadComponent('Crud.Crud', ['actions' => ['Crud.Index', 'Crud.Add', 'Crud.Edit', 'Crud.View', 'Crud.Delete'], 'listeners' => ['Crud.Api', 'Crud.ApiPagination', 'Crud.ApiQueryLog']]);
     $this->_controller->loadComponent('Paginator', ['settings' => ['page' => 1, 'limit' => 25, 'maxLimit' => 100, 'whitelist' => ['limit', 'sort', 'page', 'direction']]]);
     //$this->_eventManager = $this->_controller->eventManager();
     parent::__construct($collection, $config);
 }
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     // initialize callback urls
     $router = new Router();
     $baseurl = $router->url('/', true);
     $this->facebook['callback_url'] = $baseurl . 'social_apps/facebook/callback';
     $this->twitter['callback_url'] = $baseurl . 'social_apps/twitter/callback';
     $this->linkedin['callback_url'] = $baseurl . 'social_apps/linkedin/callback';
     //end
     $this->controller = $collection->getController();
     $this->http = new Client();
     FacebookSession::setDefaultApplication($this->facebook['appID'], $this->facebook['appSecret']);
     $this->controller->loadModel('Partners');
     // prefetch partner details
     $this->Partners = $this->controller->Partners;
     $this->partner_id = $this->controller->Auth->user('partner_id');
     $this->partner = $this->Partners->get($this->partner_id);
     // end prefetch
 }
Example #15
0
 /**
  * Constructor
  *
  * @param \Cake\Controller\ComponentRegistry $collection A ComponentCollection this component
  *   can use to lazy load its components.
  * @param array $config Array of configuration settings.
  */
 public function __construct(ComponentRegistry $collection, $config = [])
 {
     $config += ['actions' => [], 'listeners' => []];
     $config['actions'] = $this->normalizeArray($config['actions']);
     $config['listeners'] = $this->normalizeArray($config['listeners']);
     $this->_controller = $collection->getController();
     $this->_eventManager = $this->_controller->eventManager();
     parent::__construct($collection, $config);
 }
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $this->http = new Client();
 }
Example #17
0
 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry for this component
  * @param array $config Array of config.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->_session = $registry->getController()->request->session();
 }
 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry object.
  * @param array $config Array of configuration settings.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->_controller = $registry->getController();
     $this->_request = $this->_controller->request;
 }
 /**
  * @param \Cake\Controller\ComponentRegistry $registry
  * @param array $config
  * @throws \Cake\Core\Exception\Exception
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     $config = $this->_prepareConfig($config);
     parent::__construct($registry, $config);
 }
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $this->controller = $collection->getController();
 }
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     $this->controller = $collection->getController();
     $this->http = new Client(['host' => $this->_defaultConfig['host'], 'scheme' => 'https', 'type' => 'application/json', 'auth' => '']);
 }
 /**
  * Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
  *
  * @param ComponentRegistry $registry ComponentRegistry object.
  * @param array $config Array of config.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     $config += ['viewClassMap' => ['json' => 'Json', 'xml' => 'Xml', 'ajax' => 'Ajax'], 'inputTypeMap' => ['json' => ['json_decode', true], 'xml' => [[$this, 'convertXml']]]];
     parent::__construct($registry, $config);
 }
 /**
  * Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
  *
  * @param ComponentRegistry $registry ComponentRegistry object.
  * @param array $config Array of config.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->addInputType('xml', [[$this, 'convertXml']]);
 }
Example #24
0
 /**
  * Constructor
  *
  * If debug is off the component will be disabled and not do any further time tracking
  * or load the toolbar helper.
  *
  * @param \Cake\Controller\ComponentRegistry $registry The ComponentRegistry
  * @param array $settings An array of config
  * @throws \RuntimeException
  */
 public function __construct(ComponentRegistry $registry, $settings = [])
 {
     parent::__construct($registry, $settings);
     $msg = 'DebugKit is now loaded through plugin bootstrapping. Make sure you have ' . '`Plugin::load("DebugKit", ["bootstrap" => true]);` in your application\'s bootstrap.php.';
     throw new \RuntimeException($msg);
 }
Example #25
0
 /**
  * Constructor
  *
  * @param ComponentRegistry $registry A ComponentRegistry this component can use to lazy load its components.
  * @param array $config Array of configuration settings.
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->_controller = $registry->getController();
     $this->parameters(true);
 }
 /**
  * Constructor
  *
  * @param ComponentRegistry $collection A ComponentRegistry for this component
  * @param array $config Array of config.
  */
 public function __construct(ComponentRegistry $collection, array $config = array())
 {
     parent::__construct($collection, $config);
     if (!$this->_config['key']) {
         $this->config('key', Configure::read('Security.salt'));
     }
     if ($this->_config['time']) {
         $this->_expire($this->_config['time']);
     }
     $controller = $collection->getController();
     if ($controller && isset($controller->request)) {
         $this->_request = $controller->request;
     } else {
         $this->_request = Request::createFromGlobals();
     }
     if ($controller && isset($controller->response)) {
         $this->_response = $controller->response;
     } else {
         $this->_response = new Response();
     }
 }
Example #27
0
 /**
  * Constructor
  *
  * Constructor for AuthorizerComponent.
  *
  * @param ComponentRegistry $registry ComponentRegistry.
  * @param array $config Configurations.
  * @return void
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->setController($registry->getController());
     $this->setCurrentParams();
 }
 /**
  * __construct
  *
  * @param \Cake\Controller\ComponentRegistry $registry Registry.
  * @param array $config Configurations.
  */
 public function __construct($registry, array $config = [])
 {
     parent::__construct($registry, $config);
     $this->setController($this->_registry->getController());
 }
 /**
  * Public constructor for the SassComponent
  *
  * @param ComponentCollection $collection
  * @param array               $settings
  */
 public function __construct($collection, $settings = array())
 {
     $this->controller = $collection->getController();
     $this->settings = array_merge((array) Configure::read('SassCompiler'), $settings);
     parent::__construct($collection, $this->settings);
     // Don't execute the component if the debuglevel is 0
     // unless compileSass requestparameter is supplied
     // if autoRun is true then ALWAYS run the component
     if (!Configure::read('debug') && !isset($this->controller->request->query['forceSassToCompile']) && false === $this->settings['autoRun']) {
         $this->enabled = false;
         return false;
     }
     if (isset($this->controller->request->query['forceSassToCompile'])) {
         $this->settings['forceCompiling'] = true;
     }
     $this->_checkVersion();
     $this->cacheKey .= $this->request->session()->read('Config.userAgent');
     $this->_createCacheConfig();
     $this->_setFolders();
 }
 /**
  * Constructor.
  *
  * @param \Cake\Controller\ComponentRegistry $collection A ComponentRegistry
  *  for this component
  * @param array $config Array of configuration options to merge with defaults
  */
 public function __construct(ComponentRegistry $collection, array $config = [])
 {
     $this->_defaultConfig['settings'] = plugin('Comment')->settings();
     $this->_defaultConfig['settings']['visibility'] = 0;
     $this->_defaultConfig['errorMessage'] = __d('comment', 'Your comment could not be saved, please check your information.');
     $this->_defaultConfig['successMessage'] = function () {
         if ($this->config('settings.auto_approve') || $this->_controller->request->is('userAdmin')) {
             return __d('comment', 'Comment saved!');
         }
         return __d('comment', 'Your comment is awaiting moderation.');
     };
     parent::__construct($collection, $config);
     $this->_controller = $this->_registry->getController();
     $this->_loadSettings();
 }