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


PHP a::merge方法代码示例

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


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

示例1: __construct

 public function __construct($data = array())
 {
     if (!isset($data['id'])) {
         throw new Exception('The role id is missing');
     }
     if (!isset($data['name'])) {
         throw new Exception('The role name is missing');
     }
     // required data
     $this->id = $data['id'];
     $this->name = $data['name'];
     if (isset($data['permissions']) and is_array($data['permissions'])) {
         $this->permissions = a::merge($this->permissions, $data['permissions']);
     } else {
         if (isset($data['permissions']) and $data['permissions'] === false) {
             $this->permissions = array_fill_keys(array_keys($this->permissions), false);
         } else {
             $this->permissions = $this->permissions;
         }
     }
     // fallback permissions support for old 'panel' role variable
     if (isset($data['panel']) and is_bool($data['panel'])) {
         $this->permissions['panel.access'] = $data['panel'];
     }
     // is this role the default role?
     if (isset($data['default'])) {
         $this->default = $data['default'] === true;
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:29,代码来源:role.php

示例2: __construct

 /**
  * Creates a new Uniform instance.
  *
  * @param string $id The unique ID of this form.
  * @param array $options Array of uniform options, including the actions.
  */
 public function __construct($id, $options)
 {
     if (empty($id)) {
         throw new Error('No Uniform ID was given.');
     }
     $this->id = $id;
     $this->erroneousFields = array();
     $this->options = array('guard' => a::get($options, 'guard', 'honeypot'), 'required' => a::get($options, 'required', array()), 'validate' => a::get($options, 'validate', array()), 'actions' => a::get($options, 'actions', array()));
     // required fields will also be validated by default
     $this->options['validate'] = a::merge($this->options['validate'], $this->options['required']);
     // initialize output array with the output of the plugin itself
     $this->actionOutput = array('_uniform' => array('success' => false, 'message' => ''));
     // the token is stored as session variable until the form is sent
     // successfully
     $this->token = s::get($this->id);
     if (!$this->token) {
         $this->generateToken();
     }
     // get the data to be sent (if there is any)
     $this->data = get();
     if ($this->requestValid()) {
         if (empty($this->options['actions'])) {
             throw new Error('No Uniform actions were given.');
         }
         if ($this->dataValid()) {
             // uniform is done, now it's the actions turn
             $this->actionOutput['_uniform']['success'] = true;
         }
     }
 }
开发者ID:fetzi,项目名称:kirby-uniform,代码行数:36,代码来源:UniForm.php

示例3: findEventFields

 /**
  * Aggregates all the fields present in the given event object.
  * @param array $events An array of Event objects.
  */
 private static function findEventFields($events)
 {
     $fields = array();
     foreach ($events as $event) {
         $fields = a::merge($fields, $event->getFieldKeys());
     }
     // make an associative array with the same keys as values
     return array_combine($fields, $fields);
 }
开发者ID:igorqr,项目名称:kirby-extensions,代码行数:13,代码来源:Calendar.php

示例4: __construct

 /**
  * Create a new CrazyMailer
  *
  * @var array $config data, accepts same as Email::__construct()
  */
 public function __construct($config)
 {
     $defaults = ['to' => KirbyConfig::get('mailer.to'), 'from' => KirbyConfig::get('mailer.from'), 'service' => 'mailgun', 'options' => ['key' => KirbyConfig::get('mailgun.key'), 'domain' => KirbyConfig::get('mailgun.domain')]];
     $this->emailer = new KirbyEmailer(KirbyArray::merge($defaults, $config));
     $this->enabled = env('MAILER_ENABLED', false);
     $handler = new StreamHandler(kirby()->roots()->site() . '/../logs/emailer.log', Logger::WARNING);
     $this->logger = new Logger('crazy');
     $this->logger->pushHandler($handler);
 }
开发者ID:evendev,项目名称:paintcrazy,代码行数:14,代码来源:Mailer.php

示例5: _extend

 public function _extend($params)
 {
     $extends = $params['extends'];
     $snippet = f::resolve(kirby()->roots()->blueprints() . DS . 'fields' . DS . $extends, array('yml', 'php', 'yaml'));
     if (empty($snippet)) {
         throw new Exception(l('fields.error.extended'));
     }
     $yaml = data::read($snippet, 'yaml');
     $params = a::merge($yaml, $params);
     return $params;
 }
开发者ID:peterbinks,项目名称:peterbinks.net,代码行数:11,代码来源:field.php

示例6: _extend

 public function _extend($params)
 {
     $extends = $params['extends'];
     $files = glob(kirby()->roots()->blueprints() . DS . 'fields' . DS . $extends . '.{yml,yaml,php}', GLOB_BRACE);
     if (empty($files)) {
         throw new Exception(l('fields.error.extended'));
     }
     $yaml = data::read($files[0], 'yaml');
     $params = a::merge($yaml, $params);
     return $params;
 }
开发者ID:ssigur,项目名称:portfolio-2015,代码行数:11,代码来源:field.php

示例7: _extend

 public function _extend($params)
 {
     $extends = $params['extends'];
     $file = kirby()->get('blueprint', 'fields/' . $extends);
     if (empty($file) || !is_file($file)) {
         throw new Exception(l('fields.error.extended'));
     }
     $yaml = data::read($file, 'yaml');
     $params = a::merge($yaml, $params);
     return $params;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:11,代码来源:field.php

示例8: __construct

 /**
  * Creates a new Uniform instance.
  *
  * @param string $id The unique ID of this form.
  * @param array $options Array of uniform options, including the actions.
  */
 public function __construct($id, $options)
 {
     if (empty($id)) {
         throw new Error('No Uniform ID was given.');
     }
     $this->id = $id;
     $this->erroneousFields = array();
     $this->options = array('guard' => a::get($options, 'guard', 'honeypot'), 'honeypot' => a::get($options, 'honeypot', 'website'), 'required' => a::get($options, 'required', array()), 'validate' => a::get($options, 'validate', array()), 'actions' => a::get($options, 'actions', array()));
     // required fields will also be validated by default
     $this->options['validate'] = a::merge($this->options['validate'], $this->options['required']);
     // initialize output array with the output of the plugin itself
     $this->actionOutput = array('_uniform' => array('success' => false, 'message' => ''));
     // the token is stored as session variable until the form is sent
     // successfully
     $this->token = s::get($this->id);
     if (!$this->token) {
         $this->generateToken();
     }
     // get the data to be sent (if there is any)
     $this->data = get();
     // if($this->data) {
     // 	print_r($this->data);
     // }
     if ($this->requestValid()) {
         // remove uniform specific fields from form data
         unset($this->data['_submit']);
         if (empty($this->options['actions'])) {
             throw new Error('No Uniform actions were given.');
         }
         if ($this->dataValid()) {
             // uniform is done, now it's the actions turn
             $this->actionOutput['_uniform']['success'] = true;
         }
     } else {
         // generate new token to spite the bots }:-)
         $this->generateToken();
         // clear the data array
         // see https://github.com/mzur/kirby-uniform/issues/48
         $this->data = array();
     }
 }
开发者ID:psihius,项目名称:webconf,代码行数:47,代码来源:UniForm.php

示例9: __construct

 /**
  * @param string $id The unique ID of this form.
  *
  * @param string $recipient e-mail adress the form content should be sent to.
  *
  * @param array $options Array of sendform options.
  */
 public function __construct($id, $recipient, $options)
 {
     if (empty($id)) {
         throw new Error('No SendForm ID was given.');
     }
     if (empty($recipient)) {
         throw new Error('No SendForm recipient was given.');
     }
     $this->id = $id;
     $this->erroneousFields = array();
     // the token is stored as session variable until the form is sent
     // successfully
     $this->token = s::get($this->id);
     if (!$this->token) {
         $this->generateToken();
     }
     // get the data to be sent (if there is any)
     $this->data = get();
     if ($this->requestValid()) {
         $this->options = array('subject' => str::template(a::get($options, 'subject', l::get('sendform-default-subject')), $this->data), 'snippet' => a::get($options, 'snippet', false), 'copy' => a::get($options, 'copy', array()), 'required' => a::get($options, 'required', array()), 'validate' => a::get($options, 'validate', array()), 'to' => $recipient, 'service' => a::get($options, 'service', 'mail'), 'service-options' => a::get($options, 'service-options', array()));
         // remove newlines to prevent malicious modifications of the email
         // header
         $this->options['subject'] = str_replace("\n", '', $this->options['subject']);
         // extend the data array so email snippets get these fields, too
         $this->data['_subject'] = $this->options['subject'];
         $this->data['_to'] = $this->options['to'];
         if (array_key_exists('_receive_copy', $this->data)) {
             array_unshift($this->options['copy'], $this->data['_from']);
         }
         $this->sentSuccessful = false;
         $this->message = '';
         $requiredFields = a::merge($this->options['required'], array('_from' => 'email'));
         $validateFields = a::merge($this->options['validate'], $requiredFields);
         if ($this->dataValid($requiredFields, $validateFields)) {
             $this->sendForm();
         }
     }
 }
开发者ID:peterbinks,项目名称:peterbinks.net,代码行数:45,代码来源:SendForm.php

示例10: merge

 /**
  * Returns a new combined collection
  *
  * @return Collection
  */
 public function merge($collection2)
 {
     $collection = clone $this;
     $collection->data = a::merge($collection->data, $collection2->data);
     return $collection;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:11,代码来源:collection.php

示例11: i18n

 public function i18n()
 {
     // load the interface language file
     if ($user = $this->site()->user()) {
         $this->language = $user->language();
     } else {
         $this->language = $this->kirby()->option('panel.language', 'en');
     }
     $translation = (require $this->roots()->languages() . DS . 'en.php');
     $translation = a::merge($translation, require $this->roots()->languages() . DS . $this->language . '.php');
     // set all language variables
     l::$data = $translation['data'];
     // set language direction (ltr is default)
     if (isset($translation['direction']) and $translation['direction'] == 'rtl') {
         l::set('language.direction', 'rtl');
     } else {
         l::set('language.direction', 'ltr');
     }
 }
开发者ID:v1m0,项目名称:kirby-f6,代码行数:19,代码来源:panel.php

示例12: send

 /**
  * Sends the constructed email
  *
  * @param array $params Optional way to set values for the email
  * @return boolean
  */
 public function send($params = null)
 {
     try {
         // fail silently if sending emails is disabled
         if (static::$disabled) {
             throw new Error('Sending emails is disabled', static::ERROR_DISABLED);
         }
         // overwrite already set values
         if (is_array($params) && !empty($params)) {
             foreach (a::merge($this->toArray(), $params) as $key => $val) {
                 $this->set($key, $val);
             }
         }
         // reset all errors
         $this->error = null;
         // default service
         if (empty($this->service)) {
             $this->service = 'mail';
         }
         // if there's no dedicated reply to address, use the from address
         if (empty($this->replyTo)) {
             $this->replyTo = $this->from;
         }
         // validate the email
         $this->validate();
         // check if the email service is available
         if (!isset(static::$services[$this->service])) {
             throw new Error('The email service is not available: ' . $this->service, static::ERROR_INVALID_SERVICE);
         }
         // run the service
         call(static::$services[$this->service], $this);
         // reset the error
         $this->error = null;
         return true;
     } catch (Exception $e) {
         $this->error = $e;
         return false;
     }
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:45,代码来源:email.php


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