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


PHP CMap::mergeArray方法代码示例

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


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

示例1: actionAdd

 /**
  * Action добавления комментария
  *
  *
  **/
 public function actionAdd()
 {
     if (!Yii::app()->getRequest()->getIsPostRequest() || !Yii::app()->getRequest()->getPost('Comment')) {
         throw new CHttpException(404);
     }
     $module = Yii::app()->getModule('comment');
     if (!$module->allowGuestComment && !Yii::app()->user->isAuthenticated()) {
         throw new CHttpException(404);
     }
     if (Yii::app()->commentManager->isSpam(Yii::app()->user)) {
         if (Yii::app()->getRequest()->getIsAjaxRequest()) {
             Yii::app()->ajax->failure(array('message' => Yii::t('CommentModule.comment', 'Spam protection, try to create comment after {few} seconds!', array('{few}' => $module->antispamInterval))));
         }
         throw new CHttpException(404, Yii::t('CommentModule.comment', 'Spam protection, try to create comment after {few} seconds!', array('{few}' => $module->antispamInterval)));
     }
     $params = Yii::app()->getRequest()->getPost('Comment');
     if (Yii::app()->user->isAuthenticated()) {
         $params = CMap::mergeArray($params, array('user_id' => Yii::app()->user->getId(), 'name' => Yii::app()->user->getState('nick_name'), 'email' => Yii::app()->user->getState('email')));
     }
     $redirect = Yii::app()->getRequest()->getPost('redirectTo', Yii::app()->user->returnUrl);
     if ($comment = Yii::app()->commentManager->create($params, $module, Yii::app()->user)) {
         $commentContent = $comment->status == Comment::STATUS_APPROVED ? $this->_renderComment($comment) : '';
         if (Yii::app()->getRequest()->getIsAjaxRequest()) {
             Yii::app()->ajax->success(array('message' => Yii::t('CommentModule.comment', 'You record was created. Thanks.'), 'comment' => array('parent_id' => $comment->parent_id), 'commentContent' => $commentContent));
         }
         Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('CommentModule.comment', 'You record was created. Thanks.'));
         $this->redirect($redirect);
     } else {
         if (Yii::app()->getRequest()->getIsAjaxRequest()) {
             Yii::app()->ajax->failure(array('message' => Yii::t('CommentModule.comment', 'Record was not added! Fill form correct!')));
         }
         Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::ERROR_MESSAGE, Yii::t('CommentModule.comment', 'Record was not added! Fill form correct!'));
         $this->redirect($redirect);
     }
 }
开发者ID:sherifflight,项目名称:yupe,代码行数:40,代码来源:CommentController.php

示例2: init

 /**
  * Panel initialization.
  * Generate unique tag for page. Attach panels, log watcher. Register scripts for printing debug panel.
  */
 public function init()
 {
     parent::init();
     if (!$this->enabled) {
         return;
     }
     Yii::setPathOfAlias('yii2-debug', dirname(__FILE__));
     Yii::app()->setImport(array('yii2-debug.*', 'yii2-debug.panels.*'));
     if ($this->logPath === null) {
         $this->logPath = Yii::app()->getRuntimePath() . '/debug';
     }
     $panels = array();
     foreach (CMap::mergeArray($this->corePanels(), $this->panels) as $id => $config) {
         if (!isset($config['highlightCode'])) {
             $config['highlightCode'] = $this->highlightCode;
         }
         $panels[$id] = Yii::createComponent($config, $this, $id);
     }
     $this->panels = $panels;
     Yii::app()->setModules(array($this->moduleId => array('class' => 'Yii2DebugModule', 'owner' => $this)));
     if ($this->internalUrls && Yii::app()->getUrlManager()->urlFormat == 'path') {
         $rules = array();
         foreach ($this->coreUrlRules() as $key => $value) {
             $rules[$this->moduleId . '/' . $key] = $this->moduleId . '/' . $value;
         }
         Yii::app()->getUrlManager()->addRules($rules, false);
     }
     Yii::app()->attachEventHandler('onEndRequest', array($this, 'onEndRequest'));
     $this->initToolbar();
 }
开发者ID:Orlac,项目名称:yii2-debug,代码行数:34,代码来源:Yii2Debug.php

示例3: renderItem

 /**
  *### .renderItem()
  */
 protected function renderItem($options, $templateData)
 {
     //apply editable if not set 'editable' params or set and not false
     $apply = !empty($options['name']) && (!isset($options['editable']) || $options['editable'] !== false);
     if ($apply) {
         //ensure $options['editable'] is array
         if (!isset($options['editable'])) {
             $options['editable'] = array();
         }
         //take common url if not defined for particular item and not related model
         if (!isset($options['editable']['url']) && strpos($options['name'], '.') === false) {
             $options['editable']['url'] = $this->url;
         }
         //take common params if not defined for particular item
         if (!isset($options['editable']['params'])) {
             $options['editable']['params'] = $this->params;
         }
         $editableOptions = CMap::mergeArray($options['editable'], array('model' => $this->data, 'attribute' => $options['name'], 'emptytext' => $this->nullDisplay === null ? Yii::t('zii', 'Not set') : strip_tags($this->nullDisplay)));
         //if value in detailview options provided, set text directly (as value means text)
         if (isset($options['value']) && $options['value'] !== null) {
             $editableOptions['text'] = $templateData['{value}'];
             $editableOptions['encode'] = false;
         }
         /** @var $widget TbEditableField */
         $widget = $this->controller->createWidget('TbEditableField', $editableOptions);
         //'apply' can be changed during init of widget (e.g. if related model and unsafe attribute)
         if ($widget->apply) {
             ob_start();
             $widget->run();
             $templateData['{value}'] = ob_get_clean();
         }
     }
     parent::renderItem($options, $templateData);
 }
开发者ID:robebeye,项目名称:isims,代码行数:37,代码来源:TbEditableDetailView.php

示例4: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $behavior = $this->controller->asa('seo');
     if ($behavior !== null && $behavior->metaDescription !== null) {
         $this->_description = $behavior->metaDescription;
     } else {
         if ($this->defaultDescription !== null) {
             $this->_description = $this->defaultDescription;
         }
     }
     if ($behavior !== null && $behavior->metaKeywords !== null) {
         $this->_keywords = $behavior->metaKeywords;
     } else {
         if ($this->defaultKeywords !== null) {
             $this->_keywords = $this->defaultKeywords;
         }
     }
     if ($behavior !== null) {
         $this->_properties = CMap::mergeArray($behavior->metaProperties, $this->defaultProperties);
     } else {
         $this->_properties = $this->defaultProperties;
     }
     if ($behavior !== null && $behavior->canonical !== null) {
         $this->_canonical = $behavior->canonical;
     }
 }
开发者ID:vangogogo,项目名称:justsns,代码行数:29,代码来源:SeoHead.php

示例5: registerClientScript

 /**
  * Register required script files
  * @param $id
  */
 public function registerClientScript($id)
 {
     Yii::app()->bootstrap->registerAssetCss('redactor.css');
     Yii::app()->bootstrap->registerAssetJs('redactor.min.js');
     $options = CJSON::encode(CMap::mergeArray($this->editorOptions, array('lang' => $this->lang)));
     Yii::app()->bootstrap->registerRedactor('#' . $id, $options);
 }
开发者ID:hipogea,项目名称:test-yii,代码行数:11,代码来源:TbRedactorJs.php

示例6: init

 public function init()
 {
     $this->defaultOptions = CMap::mergeArray($this->defaultOptions, array('delegate' => $this->delegate));
     $this->target = '#' . $this->id;
     echo CHtml::openTag($this->tagName, array('id' => $this->id), $this->htmlOptions);
     parent::init();
 }
开发者ID:robebeye,项目名称:sim-kk,代码行数:7,代码来源:EGroupMagnificPopup.php

示例7: init

 /**
  * initialize widget
  *
  */
 public function init()
 {
     //check needed values
     /*if(!isset($this->dataUrl))
       {
           throw new CException("You have to define a dataUrl!",500);
       }*/
     //get widget id
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $this->getId();
     }
     //set additional default options that only make sense after initialization
     $this->defaultOptions = CMap::mergeArray($this->defaultOptions, array('parent' => $this->id));
     //merge options with default options
     $this->options = CMap::mergeArray($this->defaultOptions, $this->options);
     //set correct image path according to skin if not set already
     if (!isset($this->options['icon_path'])) {
         $this->options['icon_path'] = $this->getAssetPath() . '/codebase/imgs/' . $this->skinToImgFolderMappings[$this->options['skin']] . '/';
     }
     //set correct image path according to skin if not set already
     if (!isset($this->options['image_path'])) {
         $this->options['image_path'] = $this->getAssetPath() . '/codebase/imgs/' . $this->skinToImgFolderMappings[$this->options['skin']] . '/';
     }
     $this->options['items'] = array(array('id' => 'file', 'text' => 'File', 'items' => array(array('id' => 'fileopen', 'text' => 'Open File'))));
     //publish assets
     parent::init();
 }
开发者ID:philippfrenzel,项目名称:yiidhtmlx,代码行数:33,代码来源:DHtmlxMenuWidget.php

示例8: renderMenuRecursive

 /**
  * @see CMenu::renderMenuRecursive
  */
 protected function renderMenuRecursive($items)
 {
     foreach ($items as $item) {
         echo CHtml::openTag('li', isset($item['htmlOptions']) ? $item['htmlOptions'] : array());
         if (isset($item['encodeLabel']) ? $item['encodeLabel'] : $this->encodeLabel) {
             $item['label'] = CHtml::encode($item['label']);
         }
         if (isset($item['url']) && !($this->activeLinkDisable && $item['active'])) {
             $menu = CHtml::link($item['label'], $item['url'], isset($item['linkOptions']) ? $item['linkOptions'] : array());
         } else {
             $menu = CHtml::tag('span', isset($item['linkOptions']) ? $item['linkOptions'] : array(), $item['label']);
         }
         if (isset($this->itemTemplate) || isset($item['template'])) {
             $template = isset($item['template']) ? $item['template'] : $this->itemTemplate;
             echo strtr($template, array('{menu}' => $menu));
         } else {
             echo $menu;
         }
         if (isset($item['items']) && count($item['items'])) {
             echo "\n" . CHtml::openTag('ul', CMap::mergeArray($this->submenuHtmlOptions, $item['submenuHtmlOptions'] ? $item['submenuHtmlOptions'] : array())) . "\n";
             $this->renderMenuRecursive($item['items']);
             echo CHtml::closeTag('ul') . "\n";
         }
         echo CHtml::closeTag('li') . "\n";
     }
 }
开发者ID:sinelnikof,项目名称:yiiext,代码行数:29,代码来源:EMenuWidget.php

示例9: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @param array $options
  * @return YdActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($options = array())
 {
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id);
     $criteria->compare('t.name', $this->name, true);
     return new YdActiveDataProvider($this, CMap::mergeArray(array('criteria' => $criteria), $options));
 }
开发者ID:zainengineer,项目名称:yii-dressing,代码行数:12,代码来源:YdRole.php

示例10: configureApplication

/**
 * Load the environment file and Yii config file for the application
 * The Yii config file must be named as main-APP_ID where APP_ID is defined in the index.php
 *
 * @return array
 */
function configureApplication($appId, $resolver)
{
    ensureSSL();
    if ($resolver !== true) {
        return array();
    }
    include_once WEB_ROOT . '../server/modules/Xpress/components/Application.php';
    // load environment info
    $envFile = checkInditionEnv();
    if ($envFile) {
        include $envFile;
        // load application config
        $appConfigFile = WEB_ROOT . '../server/config/main-' . APP_ID . '.php';
        if (file_exists($appConfigFile)) {
            $appConfig = (include $appConfigFile);
        } else {
            $appConfig = array();
        }
        // merge app config with base config
        $base = (require WEB_ROOT . '../server/config/base.php');
        $config = CMap::mergeArray($base, $appConfig);
        if ($appConfig['modules'] == array()) {
            $config['components']['Xpress']['RebuildModuleCache'] = true;
        }
        return $config;
    } else {
        return array();
    }
}
开发者ID:hung5s,项目名称:yap,代码行数:35,代码来源:init.php

示例11: cmsDataTypeRelations

 public function cmsDataTypeRelations($event)
 {
     $event->relations = CMap::mergeArray(
         $event->relations,
         array('gallery' => array(ImageGallery::HAS_MANY, 'ImageGallery', ImageGallery::getPkAttr()))
     );
 }
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:7,代码来源:ImageGalleryModule.php

示例12: renderInput

 public function renderInput()
 {
     //set default settings
     $this->attributes = CMap::mergeArray($this->defaultWidgetSettings, $this->attributes);
     /*
      * if we have more than 1 forms on page for single model,
      * than at some input will be same id. we must set different id.
      * but Yii generate non different id for error tag.
      */
     if (!isset($this->errorOptions['inputID']) && isset($this->attributes['id'])) {
         $this->errorOptions['inputID'] = $this->attributes['id'];
     }
     //replace sinonym on full alias
     if (isset($this->widgets[$this->type])) {
         $this->type = $this->widgets[$this->type];
         if (strpos($this->type, '.') === false) {
             $this->type = $this->widgets_path . str_repeat('.' . $this->type, 2);
         }
         $attributes = $this->attributes;
         $attributes['model'] = $this->getParent()->getModel();
         $attributes['attribute'] = $this->name;
         $attributes['input_element'] = $this;
         ob_start();
         $this->getParent()->getOwner()->widget($this->type, $attributes);
         return ob_get_clean();
     }
     return parent::renderInput();
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:28,代码来源:FormInputElement.php

示例13: execute

 public function execute($url, $options = array(), $postData = array())
 {
     $ch = curl_init();
     $options = CMap::mergeArray(self::$defaultOptions, $options);
     $options[CURLOPT_URL] = $url;
     if (!empty($postData)) {
         $options[CURLOPT_POST] = true;
         $options[CURLOPT_POSTFIELDS] = $postData;
     }
     foreach ($options as $key => $value) {
         curl_setopt($ch, $key, $value);
     }
     $start = microtime(true);
     // загрузка страницы и выдача её браузеру
     $this->content = curl_exec($ch);
     $this->totalTime = microtime(true) - $start;
     $this->errorCode = curl_errno($ch);
     if ($this->errorCode) {
         $this->errorMessage = curl_error($ch);
     }
     $this->httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     // завершение сеанса и освобождение ресурсов
     curl_close($ch);
     if ($this->errorCode) {
         return false;
     } else {
         if (!$this->isHttpOK()) {
             $this->errorMessage = $this->content;
             return false;
         } else {
             return true;
         }
     }
 }
开发者ID:joelsantosjunior,项目名称:wotdb,代码行数:34,代码来源:CUrlHelper.php

示例14: renderMeta

 public function renderMeta()
 {
     if (empty($this->metaTitle)) {
         $this->metaTitle = Yii::app()->params['htmlMetadata']['title'];
     }
     if (empty($this->metaDescription)) {
         $this->metaDescription = Yii::app()->params['htmlMetadata']['description'];
     }
     if (empty($this->metaKeyword)) {
         $this->metaKeyword = Yii::app()->params['htmlMetadata']['keywords'];
     }
     if (empty($this->canonical)) {
         $this->canonical = Yii::app()->request->getHostInfo() . Yii::app()->request->url;
     }
     echo CHtml::tag('link', array('rel' => 'canonical', 'href' => $this->canonical));
     $metaKeywords = CMap::mergeArray(array('title' => $this->metaTitle, 'description' => $this->metaDescription, 'keywords' => $this->metaKeyword), $this->metaKeyOthers);
     foreach ($metaKeywords as $name => $content) {
         echo CHtml::metaTag($content, $name) . PHP_EOL;
     }
     if (!empty($this->metaProperties)) {
         foreach ($this->metaProperties as $key => $content) {
             echo '<meta property="' . $content['name'] . '" content="' . $content['value'] . '" />' . PHP_EOL;
         }
         // we can't use Yii's method for this.
     }
 }
开发者ID:giangnh264,项目名称:mobileplus,代码行数:26,代码来源:SEO.php

示例15: run

 /**
  */
 public function run()
 {
     /**
      * @var CClientScript $cs
      */
     $cs = Yii::app()->getClientScript();
     // Javascript var
     if (empty($this->jsVarName)) {
         $this->jsVarName = $this->getId() . 'Layout';
     }
     // Container ID
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
     $id = $this->htmlOptions['id'];
     echo CHtml::openTag('div', $this->htmlOptions);
     $layoutsOptions = $this->renderLayouts();
     echo '</div>';
     // Prepare options
     $options = CMap::mergeArray($this->options, $layoutsOptions);
     $options = empty($options) ? '' : CJavaScript::encode($options);
     // Register global JS var
     $cs->registerScript(__CLASS__ . '#jsVar#' . $this->getId(), 'var ' . $this->jsVarName . ';', CClientScript::POS_HEAD);
     // Register Layouts init script
     $cs->registerScript(__CLASS__ . '#init#' . $this->getId(), $this->jsVarName . ' = $("#' . $id . '").layout(' . $options . ');', CClientScript::POS_READY);
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:28,代码来源:TbUiLayout.php


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