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


PHP Set::merge方法代码示例

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


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

示例1: input

 public function input($name, $options = array())
 {
     $default = array('type' => null, 'label' => null, 'before' => null, 'after' => null, 'div' => array('class' => 'input'));
     $options = Set::merge($default, $options);
     $out = array();
     $label = $options['label'];
     $out[] = $this->Form->label($name, $label);
     $options['label'] = false;
     $divOptions = $options['div'];
     $options['div'] = false;
     $options['error'] = array('wrap' => 'span', 'class' => 'help-block');
     if ($options['after']) {
         $options['after'] = $this->Html->tag('span', $options['after'], array('class' => 'help-inline'));
     }
     if ($options['before']) {
         $options = $this->_prepend($options['before'], $options);
     }
     $form = $this->Form->input($name, $options);
     if (!empty($options['multiple']) && $options['multiple'] === 'checkbox') {
         $form = $this->_multipleCheckbox($form);
     }
     $out[] = $this->Html->div($divOptions['class'], $form, $divOptions);
     $errorClass = '';
     if ($this->Form->error($name)) {
         $errorClass = ' error';
     }
     return $this->Html->div('clearfix' . $errorClass, implode("\n", $out));
 }
开发者ID:nano-eight,项目名称:TwitterBootstrapSkel,代码行数:28,代码来源:BootstrapFormHelper.php

示例2: setup

 /**
  * setup
  *
  * @param Model $Model
  * @param array $config
  * @return void
  */
 public function setup(Model $Model, $config = array())
 {
     $recipe = Configure::read('Oven.recipe');
     if (!empty($recipe)) {
         foreach ($recipe as $key => $type) {
             $modelName = Inflector::classify($key);
             if (!isset($this->settings['uploadFields'][$modelName])) {
                 $this->settings['uploadFields'][$modelName] = array();
             }
             if (!empty($type['schema'])) {
                 foreach ($type['schema'] as $field => $val) {
                     if (empty($val['type'])) {
                         continue;
                     }
                     if ($val['type'] == 'file') {
                         $this->settings['uploadFields'][$modelName][] = $field;
                     }
                 }
             }
         }
     }
     if (empty($config['uploadLocation'])) {
         $config['uploadLocation'] = Configure::read('Oven.config.upload_location');
         if (empty($config['uploadLocation'])) {
             $config['uploadLocation'] = WWW_ROOT . 'files' . DS . 'uploads' . DS;
         }
     }
     if (!file_exists($config['uploadLocation'])) {
         new Folder($config['uploadLocation'], true);
     }
     $this->settings = Set::merge($this->settings, $config);
 }
开发者ID:shama,项目名称:oven,代码行数:39,代码来源:UploadBehavior.php

示例3: initialize

 /**
  *
  * @param AppController $controller
  * @param array         $settings
  */
 public function initialize($controller, $settings = array())
 {
     $this->settings = Set::merge($this->settings, $settings);
     $this->controller = $controller;
     $this->getTwitterSource();
     $this->Cookie->path = Router::url('/');
 }
开发者ID:hiromi2424,项目名称:twitter_kit,代码行数:12,代码来源:twitter.php

示例4: file

 /**
  * リスト用のimgタグを出力する
  *
  * @param	array	$uploaderFile
  * @param	array	$options
  * @return	string	imgタグ
  */
 public function file($uploaderFile, $options = array())
 {
     if (isset($uploaderFile['UploaderFile'])) {
         $uploaderFile = $uploaderFile['UploaderFile'];
     }
     $imgUrl = $this->getFileUrl($uploaderFile['name']);
     $pathInfo = pathinfo($uploaderFile['name']);
     $ext = $pathInfo['extension'];
     $_options = array('alt' => $uploaderFile['alt']);
     $options = Set::merge($_options, $options);
     if (in_array(strtolower($ext), array('gif', 'jpg', 'png'))) {
         if (isset($options['size'])) {
             $resizeName = $pathInfo['filename'] . '__' . $options['size'] . '.' . $ext;
             if (!empty($uploaderFile['publish_begin']) || !empty($uploaderFile['publish_end'])) {
                 $savePath = $this->savePath . 'limited' . DS . $resizeName;
             } else {
                 $savePath = $this->savePath . $resizeName;
             }
             if (file_exists($savePath)) {
                 $imgUrl = $this->getFileUrl($resizeName);
                 unset($options['size']);
             }
         }
         return $this->Html->image($imgUrl, $options);
     } else {
         $imgUrl = 'Uploader.icon_upload_file.png';
         return $this->Html->image($imgUrl, $options);
     }
 }
开发者ID:baserproject,项目名称:basercms,代码行数:36,代码来源:UploaderHelper.php

示例5: _findCloud

 /**
  * Returns a tag cloud
  *
  * The result contains a "weight" field which has a normalized size of the tag
  * occurrence set. The min and max size can be set by passing 'minSize" and
  * 'maxSize' to the query. This value can be used in the view to controll the
  * size of the tag font.
  *
  * @todo Ideas to improve this are welcome
  * @param string
  * @param array
  * @param array
  * @return array
  * @access public
  */
 public function _findCloud($state, $query, $results = array())
 {
     if ($state == 'before') {
         $options = array('minSize' => 10, 'maxSize' => 20, 'page' => null, 'limit' => null, 'order' => null, 'joins' => null, 'offset' => null, 'contain' => 'Tag', 'conditions' => array(), 'fields' => 'Tag.*, Tagged.tag_id, COUNT(*) AS occurrence', 'group' => 'Tagged.tag_id');
         foreach ($query as $key => $value) {
             if (!empty($value)) {
                 $options[$key] = $value;
             }
         }
         $query = $options;
         if (isset($query['model'])) {
             $query['conditions'] = Set::merge($query['conditions'], array('Tagged.model' => $query['model']));
         }
         return $query;
     } elseif ($state == 'after') {
         if (!empty($results) && isset($results[0][0]['occurrence'])) {
             $weights = Set::extract($results, '{n}.0.occurrence');
             $maxWeight = max($weights);
             $minWeight = min($weights);
             $spread = $maxWeight - $minWeight;
             if (0 == $spread) {
                 $spread = 1;
             }
             foreach ($results as $key => $result) {
                 $size = $query['minSize'] + ($result[0]['occurrence'] - $minWeight) * (($query['maxSize'] - $query['minSize']) / $spread);
                 $results[$key]['Tag']['occurrence'] = $result[0]['occurrence'];
                 $results[$key]['Tag']['weight'] = ceil($size);
             }
         }
         return $results;
     }
 }
开发者ID:rchavik,项目名称:infinitas,代码行数:47,代码来源:tagged.php

示例6: productContain

 function productContain(&$model, $opt = array())
 {
     $model->Behaviors->attach('Containable');
     $contains = Set::merge($opt, array('ShopProduct' => array('ShopSubproduct')));
     $model->contain($contains);
     return $contains;
 }
开发者ID:kevthunder,项目名称:cake-shop,代码行数:7,代码来源:product.php

示例7: beforeFind

 function beforeFind($model, $query)
 {
     $options = $this->settings[$model->alias];
     $conditions = array("{$model->alias}.{$options['field']}" => $options['value']);
     $query['conditions'] = Set::merge($query['conditions'], $conditions);
     return $query;
 }
开发者ID:evilbloodydemon,项目名称:cakephp-scope,代码行数:7,代码来源:scope.php

示例8: __construct

 /**
  * Constructor
  *
  * @param ComponentCollection $collection A ComponentCollection for this component
  * @param array $settings Array of settings.
  */
 public function __construct(ComponentCollection $collection, $settings = array())
 {
     parent::__construct($collection, $settings);
     $this->_checkAndSetCookieLifeTime();
     $this->settings = Set::merge($this->_defaults, $settings);
     $this->configureCookie($this->settings['cookie']);
 }
开发者ID:tetsuo111,项目名称:cakephp,代码行数:13,代码来源:RememberMeComponent.php

示例9: read

 function read($query)
 {
     $query = Set::merge($this->_queryDefaults, $query);
     $this->setLimits($query);
     if (isset($query['max_query_time'])) {
         $this->setMaxQueryTime($query['max_query_time']);
     }
     if (isset($query['match_mode'])) {
         $this->setMatchMode($query['match_mode']);
     }
     if (isset($query['rank_mode'])) {
         $this->setRankMode($query['rank_mode']);
     }
     if (isset($query['sort_mode'])) {
         $this->setSortMode($query['sort_mode']);
     }
     if (isset($query['filters'])) {
         foreach ($query['filters'] as $filter) {
             $this->setFilter($filter);
         }
     }
     // if(count(explode(",",$query['index'])) > 1) {
     //     $this->setArrayResult(true);
     // }
     $this->sphinx->SetFieldWeights(array("title" => 2, "contestant_responses_response" => 2, "profiles_country" => 1));
     $result = $this->sphinx->Query($query['query'], $query['index']);
     if ($result === false) {
         trigger_error("sphinx query failed: " . $this->sphinx->GetLastError());
     }
     $this->reset();
     return $result;
 }
开发者ID:namelessnotion,项目名称:sphinx-cakephp-plugin,代码行数:32,代码来源:sphinx_source.php

示例10: setup

 function setup($model, $settings = array())
 {
     if ($this->_setup) {
         return;
     }
     $this->_settings = Set::merge($this->_settings, $settings['models']);
 }
开发者ID:hoge2rock,项目名称:cakephp-merged_field_plugin,代码行数:7,代码来源:merged_field.php

示例11: input

 /**
  * input
  *
  * @param string $fieldName
  * @param array $opts
  * 
  * @todo Checkboxes break with this
  */
 public function input($fieldName, $opts = array())
 {
     $opts = Set::merge(array('div' => array('class' => 'control-group'), 'between' => '<div class="controls">', 'after' => '</div>', 'class' => 'input-xlarge', 'label' => array('class' => 'control-label')), $opts);
     if (!empty($opts['help'])) {
         $opts['after'] = '<p class="help-block">' . $opts['help'] . '</p>' . $opts['after'];
         unset($opts['help']);
     }
     if (is_string($opts['label'])) {
         $opts['label'] = array('text' => $opts['label'], 'class' => 'control-label');
     }
     if (!empty($opts['type'])) {
         switch ($opts['type']) {
             case 'ckeditor':
                 $opts['type'] = 'textarea';
                 break;
             case 'boolean':
                 $opts['type'] = 'radio';
                 $opts['multiple'] = true;
                 $opts['options'] = array(1 => 'Yes', 0 => 'No');
                 break;
             case 'slug':
                 // TODO: ADD JS TO AUTO-FILL FROM DISPLAY FIELD
                 $opts['type'] = 'text';
                 break;
         }
     }
     return parent::input($fieldName, $opts);
 }
开发者ID:shama,项目名称:oven,代码行数:36,代码来源:OvenFormHelper.php

示例12: file

 /**
  * リスト用のimgタグを出力する
  *
  * @param	array	$uploaderFile
  * @param	array	$options
  * @return	string	imgタグ
  */
 function file($uploaderFile, $options = array())
 {
     if (isset($uploaderFile['UploaderFile'])) {
         $uploaderFile = $uploaderFile['UploaderFile'];
     }
     $imgUrl = $this->_getFileUrl($uploaderFile['name']);
     $pathInfo = pathinfo($uploaderFile['name']);
     $ext = $pathInfo['extension'];
     $_options = array('alt' => $uploaderFile['alt']);
     $options = Set::merge($_options, $options);
     if (in_array(strtolower($ext), array('gif', 'jpg', 'png'))) {
         if (isset($options['size'])) {
             $basename = basename($uploaderFile['name'], '.' . $ext);
             $resizeName = $basename . '__' . $options['size'] . '.' . $ext;
             if (file_exists($this->savePath . $resizeName)) {
                 $imgUrl = $this->_getFileUrl($resizeName);
                 unset($options['size']);
             }
         }
         return $this->Html->image($imgUrl, $options);
     } else {
         $imgUrl = '/uploader/img/icon_upload_file.png';
         return $this->Html->image($imgUrl, $options);
     }
 }
开发者ID:nazo,项目名称:phpcondo,代码行数:32,代码来源:uploader.php

示例13: display

    /**
     * Displays the Recaptcha input
     * 
     * @param array $options An array of options
     * 
     * ### Options:
     *
     * - `recaptchaOptions` assoc array of options to pass into RecaptchaOptions var, like 'theme', 'lang'
     *    or 'custom_translations' to runtime configure the widget.
     * 
     * @return string The resulting mark up
     * @access public
     */
    public function display($options = array())
    {
        $defaults = array('element' => null, 'publicKey' => Configure::read('Recaptcha.publicKey'), 'error' => null, 'ssl' => true, 'error' => false, 'div' => array('class' => 'recaptcha'), 'recaptchaOptions' => array('theme' => 'red', 'lang' => 'en', 'custom_translations' => array()));
        $options = Set::merge($defaults, $options);
        extract($options);
        if ($ssl) {
            $server = $this->secureApiUrl;
        } else {
            $server = $this->apiUrl;
        }
        $errorpart = "";
        if ($error) {
            $errorpart = "&amp;error=" . $error;
        }
        if (!empty($element)) {
            $elementOptions = array();
            if (is_array($element)) {
                $keys = array_keys($element);
                $elementOptions = $element[$keys[0]];
            }
            $View = $this->__view();
            return $View->element($element, $elementOptions);
        }
        $jsonOptions = json_encode($recaptchaOptions);
        unset($recaptchaOptions);
        if (empty($this->params['isAjax'])) {
            $configScript = sprintf('var RecaptchaOptions = %s', $jsonOptions);
            $this->Html->scriptBlock($configScript, array('inline' => false));
            $script = '<script type="text/javascript" src="' . $server . '/challenge?k=' . $publicKey . '"></script>
				<noscript>
					<iframe src="' . $server . '/noscript?k=' . $publicKey . '" height="300" width="500" frameborder="0"></iframe><br/>
					<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
					<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
				</noscript>';
            if (!empty($error)) {
                $script .= $this->Form->error($error);
            }
            if ($options['div'] != false) {
                $script = $this->Html->tag('div', $script, $options['div']);
            }
            return $script;
        }
        $id = uniqid('recaptcha-');
        return '<div id="' . $id . '"></div>' . '<script>
					if (window.Recaptcha == undefined) {
						(function() {
							var headID = document.getElementsByTagName("head")[0];
							var newScript = document.createElement("script");
							newScript.type = "text/javascript";
							newScript.onload = function() {
								Recaptcha.create("' . $publicKey . '", "' . $id . '", ' . $jsonOptions . ');
							};
							newScript.src = "' . $server . '/js/recaptcha_ajax.js"
							headID.appendChild(newScript);
						})();
					} else {
						setTimeout(\'Recaptcha.create("' . $publicKey . '", "' . $id . '", ' . $jsonOptions . ')\', 1000);
					}
				</script>';
    }
开发者ID:ersin-demirtas,项目名称:clubcolosseum.com,代码行数:73,代码来源:recaptcha.php

示例14: _ifProfilePhoto

 function _ifProfilePhoto(&$model, $options, $id)
 {
     $profilePhoto = $model->read('profile_profile_id', $id);
     $profile_profile_id = $profilePhoto['ProfilePhoto']['profile_profile_id'];
     $options = Set::merge($options, array('conditions' => array('ProfilePhoto.profile_profile_id' => $profile_profile_id)));
     return $options;
 }
开发者ID:slywalker,项目名称:tool_kit,代码行数:7,代码来源:order.php

示例15: setup

 /**
  * Setup the behavior
  *
  * @param object $Model instance of model
  * @param array $config array of configuration settings.
  * @return void
  * @access public
  */
 function setup(&$Model, $config = array())
 {
     if (!is_array($config)) {
         $config = array($config);
     }
     $settings = Set::merge($this->_baseConfig, $config);
     if (!isset($this->settings[$Model->alias])) {
         $this->settings[$Model->alias] = $settings;
     } else {
         $this->settings[$Model->alias] = Set::merge($this->settings[$Model->alias], (array) $settings);
     }
     //		$indexModel = $this->Model->name . 'Index';
     /*
     		$this->Model->bindModel(array(
     			'hasMany' => array(
     				$indexModel => array(
     					'className' => 'Indexable.IndexableIndex',
     					'foreignKey' => 'model_id',
     				),
     			),
     		));
     */
     //		$this->IndexModel = $this->Model->$indexModel;
     //		$this->IndexModel->bindModel(array('belongsTo' => array($this->Model->alias => array('foreignKey' => 'model_id'))));
     //		$this->IndexModel->setSource(strtolower($this->Model->name) . '_index');
 }
开发者ID:ricog,项目名称:indexable,代码行数:34,代码来源:indexable.php


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