function url($url = null, $full = false) { if (!isset($url['language']) && isset($this->params['language'])) { $url['language'] = $this->params['language']; } return parent::url($url, $full); }
/** * __construct callback * * @param \Cake\View\View $View : View * @param array $config : Config * @throws Cake\Error\NotFoundException */ public function __construct(\Cake\View\View $View, array $config = []) { parent::__construct($View, $config); if (!$this->_isSupportedFramework($fw = $this->config('assets.framework'))) { throw new NotFoundException(sprintf(__d('bootstrap', 'Configured JavaScript framework "{0}" is not supported. Only "{1}" are valid options.', $fw, implode(', ', $this->_authorizedJsLibs)))); } }
public function __call($tag, $args) { if (strpos($tag, 'set') !== 0) { return parent::__call($tag, $args); } $tag = strtolower(substr($tag, 3)); switch ($tag) { case 'card': case 'title': case 'description': case 'data1': case 'label1': case 'data2': case 'label2': return $this->addTag($tag, array_shift($args)); case 'site': case 'creator': case 'image': case 'player': if (count($args) < 2) { $args[] = []; } list($value, $options) = $args; return $this->addTag($tag, $value, $options); default: return parent::__call($tag, $args); } }
/** * Constructor. Overridden to merge passed args with URL options. * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(View $View, array $config = []) { parent::__construct($View, $config); $query = $this->request->query; unset($query['page'], $query['limit'], $query['sort'], $query['direction']); $this->config('options.url', array_merge($this->request->params['pass'], ['?' => $query])); }
/** * Class Constructor * * Merges defaults with * - Configure::read(Meta) * - Helper options * - viewVars _meta * in that order (the latter trumps) * * @param array $options */ public function __construct(View $View, $options = []) { parent::__construct($View, $options); $configureMeta = (array) Configure::read('Meta'); if (Configure::read('Meta.robots') && is_array(Configure::read('Meta.robots'))) { $configureMeta['robots'] = Hash::merge($this->meta['robots'], Configure::read('Meta.robots')); } $this->meta = $configureMeta + $this->meta; if (!empty($options['robots']) && is_array($options['robots'])) { $options['robots'] = Hash::merge($this->meta['robots'], $options['robots']); } $this->meta = $options + $this->meta; if (!empty($this->_View->viewVars['_meta'])) { $viewVarsMeta = (array) $this->_View->viewVars['_meta']; if (!empty($viewVarsMeta['robots']) && is_array($viewVarsMeta['robots'])) { $viewVarsMeta['robots'] = Hash::merge($this->meta['robots'], $viewVarsMeta['robots']); } $this->meta = $viewVarsMeta + $this->meta; } if ($this->meta['charset'] === null) { // By default include this $this->meta['charset'] = true; } if ($this->meta['icon'] === null) { // By default include this $this->meta['icon'] = true; } if ($this->meta['title'] === null) { $this->meta['title'] = __(Inflector::humanize(Inflector::underscore($this->request->params['controller']))) . ' - ' . __(Inflector::humanize(Inflector::underscore($this->request->params['action']))); } }
public function __construct(View $view, $config = []) { parent::__construct($view, $config); $this->_configs = $this->config(); $this->appId = $this->_configs['app_id']; $this->redirectUrl = $this->_configs['redirect_url']; $this->appScope = $this->_configs['app_scope']; }
/** * Constructor * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(View $View, array $config = []) { $defaults = (array) Configure::read('Highlighter'); parent::__construct($View, $config + $defaults); if ($this->_config['debug'] === null) { $this->_config['debug'] = Configure::read('debug'); } }
/** * Constructor * @param View $View * @param unknown $settings */ public function __construct(View $View, array $config = []) { // call parent constructor parent::__construct($View, $config); // calculate file system route $this->_config['css']['route'] = rtrim(WWW_ROOT, DS) . str_replace('/', DS, $this->_config['css']['path']); $this->_config['js']['route'] = rtrim(WWW_ROOT, DS) . str_replace('/', DS, $this->_config['js']['path']); }
/** * Constructor - finds and parses the ini file the plugin uses. * * @param \Cake\View\View $view The view instance to use. * @param array $settings The settings for the helper. * @return void */ public function __construct(View $view, $settings = []) { parent::__construct($view, $settings); if (empty($settings['noconfig'])) { $configFinder = new ConfigFinder(); $this->assetConfig($configFinder->loadAll()); } }
/** * Construct method. * * @param \Cake\View\View $view The view that was fired. * @param array $config The config passed to the class. */ public function __construct(View $view, $config = []) { parent::__construct($view, $config); $collection = new ComponentRegistry(); $this->Acl = new AclComponent($collection); $this->Authorize = new ActionsAuthorize($collection); $this->Authorize->config(['actionPath' => 'app/', 'userModel' => 'Users']); }
public function __construct(View $View, array $config = []) { $defaults = (array) Configure::read('Format') + $this->_defaults; $config += $defaults; $config['fontIcons'] = (array) $config['fontIcons'] + $this->_defaultIcons; $this->template = new StringTemplate($config['templates']); parent::__construct($View, $config); }
/** * Initializes Lessc and cleans less and css paths * * {@inheritdoc} */ public function __construct(View $View, array $config = []) { parent::__construct($View, $config); // Initialize oyejorge/less.php parser require_once ROOT . DS . 'vendor' . DS . 'oyejorge' . DS . 'less.php' . DS . 'lib' . DS . 'Less' . DS . 'Autoloader.php'; \Less_Autoloader::register(); $this->css_path = WWW_ROOT . trim($this->css_path, '/'); }
/** * Construct method. * * @param \Cake\View\View $view The view that was fired. * @param array $config The config passed to the class. */ public function __construct(View $view, $config = []) { parent::__construct($view, $config); $collection = new ComponentRegistry(); $this->Acl = new AclComponent($collection); $this->Authorize = new ActionsAuthorize($collection); $this->Authorize->config($this->config()); }
/** * Constructor. Overridden to merge passed args with URL options. * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(\Cake\View\View $View, array $config = []) { // Amazon S3 config $config = $this->config(); $credentials = new Credentials($config['S3Key'], $config['S3Secret']); $options = ['region' => $config['S3Region'], 'version' => $config['S3Version'], 'http' => ['verify' => false], 'signature_version' => $config['S3SignatureVersion'], 'credentials' => $credentials]; $this->_s3Client = new S3Client($options); parent::__construct($View, $config + ['helpers' => ['Html']]); }
/** * Constructor * * @param View $View * @param array $config */ public function __construct(View $View, array $config = array()) { parent::__construct($View, $config); if (isset($config['dateformat'])) { $this->__dateformat = $config['dateformat']; } else { $this->__dateformat = Configure::read('excel.dateformat'); } }
/** * Construct, optionally with GeshiHelper for code highlighting * * @param \Cake\View\View $View * @param array $config */ public function __construct(View $View, array $config = array()) { $config += $this->defaultConfig; $this->helpers += (array) $config['helpers']; parent::__construct($View, $config); if (!is_object($this->Geshi)) { $this->Geshi = FALSE; } }
/** * Set the operating conditions for reursive operation * * $config keys: * 0 - the CrudHelper object * filter_property - the property name in child entities that will be tested * filter_match - the property name in the parent entity that will used in testing * list_type - UL or OL. Defaults to UL if not spec'd * * The filter iterator gets configured to match some property in the iterator data set * to some property value in the current <LI>s entity * * @param View $View * @param array $config */ public function __construct(View $View, array $config = array()) { $config += ['list_type' => 'ul']; parent::__construct($View, $config); $this->Crud = $config[0]; $this->filter_property = $config['filter_property']; $this->filter_match = $config['filter_match']; $this->list_wrapper = (object) ['open' => "<{$config['list_type']}>", 'close' => "</{$config['list_type']}>"]; $this->depth = 0; }
public function __construct(View $View, array $config = array()) { if (isset($config['options'])) { if (is_string($config['options'])) { $this->loadConfig($config['options']); unset($config['options']); } } parent::__construct($View, $config); }
/** * Default Constructor * * ### Settings: * * - `engine` Class name to use to replace Cake\I18n\Number functionality * The class needs to be placed in the `Utility` directory. * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper * @throws \Cake\Core\Exception\Exception When the engine class could not be found. */ public function __construct(View $View, array $config = []) { parent::__construct($View, $config); $config = $this->_config; $engineClass = App::className($config['engine'], 'Utility'); if ($engineClass) { $this->_engine = new $engineClass($config); } else { throw new Exception(sprintf('Class for %s could not be found', $config['engine'])); } }
/** * Constructor * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(View $View, array $config = []) { $defaults = (array) Configure::read('Hashid'); parent::__construct($View, $config + $defaults); if ($this->_config['salt'] === null) { $this->_config['salt'] = Configure::read('Security.salt') ? sha1(Configure::read('Security.salt')) : null; } if ($this->_config['debug'] === null) { $this->_config['debug'] = Configure::read('debug'); } }
/** * Make the helper, possibly configuring with CrudData objects * * @param \Cake\View\View $View * @param array $config An array of CrudData objects */ public function __construct(View $View, array $config = array()) { parent::__construct($View, $config); $config += ['_CrudData' => [], 'actions' => []]; $this->_defaultAlias = new NameConventions(Inflector::pluralize(Inflector::classify($this->request->controller))); $this->_CrudData = $config['_CrudData']; $this->DecorationSetups = new DecorationFactory($this); // $this->_Field = new Collection(); foreach ($config['actions'] as $name => $pattern) { $this->{$name} = $pattern; } $this->useCrudData($this->_defaultAlias->name); }
public function __construct(View $view, $config = []) { parent::__construct($view, $config); /* ---------- Set the current User to $this->CurUser { ---------- */ $objUser = $this->request->session()->read('Core.Users'); if (isset($objUser) && !empty($objUser)) { $arrUser = $objUser->toArray(); $arrProp = array_keys($arrUser); foreach ($arrProp as $prop) { $this->{$prop} = $objUser->{$prop}; } } /* ---------- Set the current User to $this->CurUser } ---------- */ }
/** * Constructor * * @param View $view View * @param array $config Config * * @return void */ public function __construct(View $view, $config = []) { parent::__construct($view, $config); // Merge Options given by user in config/recaptcha $configRecaptcha = Configure::read('Recaptcha'); $this->config($configRecaptcha); $lang = $this->config('lang'); if (empty($lang)) { $this->config('lang', I18n::locale()); } // Validate the Configure Data // unset secret param $this->config('secret', ''); }
/** * Instantiate the class and apply settings. * * @param View $view * @param array $settings */ public function __construct(View $view, $settings = array()) { parent::__construct($view, $settings); $settings = $settings + Configure::read('Decoda.config'); $locale = Configure::read('Config.language') ?: $settings['locale']; $localeMap = Configure::read('Decoda.locales'); unset($settings['locale']); $decoda = new Decoda('', $settings); $decoda->whitelist($settings['whitelist'])->blacklist($settings['blacklist']); if ($paths = $settings['paths']) { foreach ((array) $paths as $path) { $decoda->addPath($path); } } if ($messages = $settings['messages']) { $decoda->addMessages(new \Decoda\Loader\DataLoader($messages)); } // Set locale if (isset($localeMap[$locale])) { $decoda->setLocale($localeMap[$locale]); } else { if (in_array($locale, $localeMap)) { $decoda->setLocale($locale); } } // Apply hooks and filters if (empty($settings['filters']) && empty($settings['hooks'])) { $decoda->defaults(); } else { if ($filters = $settings['filters']) { foreach ((array) $filters as $filter) { $filter = sprintf('\\Decoda\\Filter\\%sFilter', $filter); $decoda->addFilter(new $filter()); } } if ($hooks = $settings['hooks']) { foreach ((array) $hooks as $hook) { $hook = sprintf('\\Decoda\\Hook\\%sHook', $hook); $decoda->addHook(new $hook()); } } } // Custom config $decoda->addHook(new \Decoda\Hook\EmoticonHook(array('path' => '/utility/img/emoticon/'))); $decoda->setEngine(new CakeEngine($settings['helpers'])); $this->_decoda = $decoda; }
public function __construct(View $View, array $config = array()) { $appConfig = Configure::read('App'); $config += ['debug' => Configure::read('debug')]; $this->_defaultConfig = (array) Configure::read('Assetic') + ['debug' => $config['debug'], 'cache' => !$config['debug'], 'cssOriginPath' => $appConfig['cssBaseUrl'], 'cssTargetPath' => '_' . $appConfig['cssBaseUrl'], 'imageOriginPath' => $appConfig['imageBaseUrl'], 'imageTargetPath' => '_' . $appConfig['imageBaseUrl'], 'jsOriginPath' => $appConfig['jsBaseUrl'], 'jsTargetPath' => '_' . $appConfig['jsBaseUrl'], 'webrootOriginPath' => $appConfig['www_root'], 'webrootTargetPath' => $appConfig['www_root'], 'cssGroups' => [], 'jsGroups' => []] + $this->_defaultConfig; parent::__construct($View, $config); $this->_blocks = $this->_groupMap = $this->_groups = ['css' => [], 'js' => []]; $this->_initialized = ['css' => false, 'image' => false, 'js' => false]; $this->setWebrootPath($this->_config['webrootOriginPath'], 'origin'); $this->setCssPath($this->_config['cssOriginPath'], 'origin'); $this->setJsPath($this->_config['jsOriginPath'], 'origin'); $this->setImagePath($this->_config['imageOriginPath'], 'origin'); $this->setWebrootPath($this->_config['webrootTargetPath'], 'target'); $this->setCssPath($this->_config['cssTargetPath'], 'target'); $this->setJsPath($this->_config['jsTargetPath'], 'target'); $this->setImagePath($this->_config['imageTargetPath'], 'target'); Configure::write('Assetic', $this->_config); }
/** * Constructor * * @param View $view View * @param array $config Config * * @return void */ public function __construct(View $view, $config = []) { parent::__construct($view, $config); // Merge Options given by user in config/recaptcha $this->config(Configure::read('Recaptcha')); $lang = $this->config('lang'); if (empty($lang)) { $this->config('lang', I18n::locale()); } // Validate the Configure Data $validator = new RecaptchaValidator(); $errors = $validator->errors($this->config()); if (!empty($errors)) { throw new \Exception(__d('recaptcha', 'One of your recaptcha config value is incorrect')); // throw an exception with config error that is raised } // Make sure the secret param is $this->config('secret', ''); }
/** * Constructor - merges options with $this->settings, detects debug level * @param View $View - Cake view object currently in use * @param array $options - user specified options * @return void */ public function __construct(View $View, $options = array()) { parent::__construct($View, $options); // URL Rewrites are switched off, so wee need to add this extra path. if (Configure::read('App.baseUrl')) { $this->extraPath = 'app/webroot/'; } // Determine the debug level to see if we should minify $cakedebug = Configure::read('debug'); if ($cakedebug >= $this->settings['debugLevel']) { $this->debugging = true; if ($cakedebug == 2) { $this->settings['js']['minifier'] = false; $this->settings['minify']['minifier'] = false; } } if ($this->settings['js']['minifier'] === false) { $this->settings['js']['minifier'] = 'none'; } if ($this->settings['css']['minifier'] === false) { $this->settings['css']['minifier'] = 'none'; } }
/** * Construct the widgets and binds the default context providers * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(View $View, array $config = []) { $registry = null; $widgets = $this->_defaultWidgets; if (isset($config['registry'])) { $registry = $config['registry']; unset($config['registry']); } if (isset($config['widgets'])) { if (is_string($config['widgets'])) { $config['widgets'] = (array) $config['widgets']; } $widgets = $config['widgets'] + $widgets; unset($config['widgets']); } parent::__construct($View, $config); $this->widgetRegistry($registry, $widgets); $this->_addDefaultContextProviders(); $this->_idPrefix = $this->config('idPrefix'); }
/** * Constructor * * ### Settings * * - `templates` Either a filename to a config containing templates. * Or an array of templates to load. See Cake\View\StringTemplate for * template formatting. * * ### Customizing tag sets * * Using the `templates` option you can redefine the tag HtmlHelper will use. * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(View $View, array $config = []) { parent::__construct($View, $config); $this->response = $this->_View->response ?: new Response(); }
/** * Constructor. Overridden to merge passed args with URL options. * * @param \Cake\View\View $View The View this helper is being attached to. * @param array $config Configuration settings for the helper. */ public function __construct(View $View, array $config = []) { parent::__construct($View, $config); $this->config('options.url', array_merge($this->request->params['pass'], $this->request->query)); }