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


PHP CJavaScript::encode方法代码示例

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


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

示例1: render

 public function render()
 {
     $htmlOptions = $this->getHtmlOptions();
     $request = Yii::app()->getRequest();
     if ($request->enableCsrfValidation && isset($htmlOptions['csrf']) && $htmlOptions['csrf']) {
         $htmlOptions['params'][$request->csrfTokenName] = $request->getCsrfToken();
     }
     if (isset($htmlOptions['params'])) {
         $params = CJavaScript::encode($htmlOptions['params']);
         unset($htmlOptions['params']);
     } else {
         $params = '{}';
     }
     if (isset($htmlOptions['class'])) {
         $htmlOptions['class'] .= ' z-button';
     } else {
         $htmlOptions['class'] = 'z-button';
     }
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('jquery');
     $cs->registerCoreScript('yii');
     $handler = "jQuery.yii.submitForm(this, '', {$params}); return false;";
     if (isset($htmlOptions['onclick'])) {
         $htmlOptions['onclick'] = $htmlOptions['onclick'] . $handler;
     } else {
         $htmlOptions['onclick'] = $handler;
     }
     $aContent = ZurmoHtml::tag('span', array('class' => 'z-spinner'), null);
     $aContent .= ZurmoHtml::tag('span', array('class' => 'z-icon'), null);
     $aContent .= ZurmoHtml::tag('span', array('class' => 'z-label'), $this->getLabel());
     return ZurmoHtml::link($aContent, '#', $htmlOptions);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:32,代码来源:SubmitButtonActionElement.php

示例2: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     echo CHtml::openTag('div', $this->htmlOptions);
     echo '<div class="carousel-inner">';
     $this->renderItems($this->items);
     echo '</div>';
     echo '<a class="carousel-control left" href="#' . $id . '" data-slide="prev">' . $this->prev . '</a>';
     echo '<a class="carousel-control right" href="#' . $id . '" data-slide="next">' . $this->next . '</a>';
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').carousel({$options});");
     // Register the "slide" event-handler.
     if (isset($this->events['slide'])) {
         $fn = CJavaScript::encode($this->events['slide']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.slide', "jQuery('#{$id}').on('slide', {$fn});");
     }
     // Register the "slid" event-handler.
     if (isset($this->events['slid'])) {
         $fn = CJavaScript::encode($this->events['slid']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.slid', "jQuery('#{$id}').on('slid', {$fn});");
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:28,代码来源:BootCarousel.php

示例3: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $options = CJavaScript::encode($this->options);
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').modal({$options});");
     // Register the "show" event-handler.
     if (isset($this->events['show'])) {
         $fn = CJavaScript::encode($this->events['show']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.show', "jQuery('#{$id}').on('show', {$fn});");
     }
     // Register the "shown" event-handler.
     if (isset($this->events['shown'])) {
         $fn = CJavaScript::encode($this->events['shown']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.shown', "jQuery('#{$id}').on('shown', {$fn});");
     }
     // Register the "hide" event-handler.
     if (isset($this->events['hide'])) {
         $fn = CJavaScript::encode($this->events['hide']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.hide', "jQuery('#{$id}').on('hide', {$fn});");
     }
     // Register the "hidden" event-handler.
     if (isset($this->events['hidden'])) {
         $fn = CJavaScript::encode($this->events['hidden']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.hidden', "jQuery('#{$id}').on('hidden', {$fn});");
     }
 }
开发者ID:laiello,项目名称:what-i-need,代码行数:32,代码来源:BootModal.php

示例4: buildInifiniteScrollOptions

 private function buildInifiniteScrollOptions()
 {
     $options = array_merge($this->_options, $this->_default_options);
     $options = array_filter($options);
     $options = CJavaScript::encode($options);
     return $options;
 }
开发者ID:huynt57,项目名称:fashion,代码行数:7,代码来源:YiinfiniteScroller.php

示例5: run

 public function run()
 {
     if (empty($this->config['action'])) {
         throw new CException('EAjaxUpload: param "action" cannot be empty.');
     }
     if (empty($this->config['allowedExtensions'])) {
         throw new CException('EAjaxUpload: param "allowedExtensions" cannot be empty.');
     }
     if (empty($this->config['sizeLimit'])) {
         throw new CException('EAjaxUpload: param "sizeLimit" cannot be empty.');
     }
     unset($this->config['element']);
     echo '<div id="' . $this->id . '"><noscript><p>Habilite Jva Script en este navegador para usar esta funcion .</p></noscript></div>';
     $assets = dirname(__FILE__) . '/assets';
     $baseUrl = Yii::app()->assetManager->publish($assets);
     Yii::app()->clientScript->registerScriptFile($baseUrl . '/fileuploader.js', CClientScript::POS_HEAD);
     $this->css = !empty($this->css) ? $this->css : $baseUrl . '/fileuploader.css';
     Yii::app()->clientScript->registerCssFile($this->css);
     $postParams = array('PHPSESSID' => session_id(), 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken);
     if (isset($this->postParams)) {
         $postParams = array_merge($postParams, $this->postParams);
     }
     $config = array('element' => 'js:document.getElementById("' . $this->id . '")', 'debug' => false, 'multiple' => false);
     $config = array_merge($config, $this->config);
     $config['params'] = $postParams;
     $config = CJavaScript::encode($config);
     Yii::app()->getClientScript()->registerScript("FileUploader_" . $this->id, "var FileUploader_" . $this->id . " = new qq.FileUploader({$config}); ", CClientScript::POS_LOAD);
 }
开发者ID:hipogea,项目名称:zega,代码行数:28,代码来源:EAjaxUpload.php

示例6: getFileBrowserCallback

    public function getFileBrowserCallback()
    {
        $connectorUrl = $this->settings['url'];
        $id = $this->getId();
        $settings = array_merge(array('places' => "", 'rememberLastDir' => false), $this->settings);
        $settings['dialog'] = array('zIndex' => 400001, 'width' => 900, 'modal' => true, 'title' => "Files");
        $settings['editorCallback'] = 'js:function(url) {
                        aWin.document.getElementById(field_name).value = url;
                        if (type == "image" && aFieldName=="src" && aWin.ImageDialog.showPreviewImage)
                            aWin.ImageDialog.showPreviewImage(url);
                    }';
        $settings['closeOnEditorCallback'] = true;
        $settings = CJavaScript::encode($settings);
        $script = <<<JS
        function(field_name, url, type, win) {
            var aFieldName = field_name, aWin = win;
            var el = \$("#{$id}");
            if(el.length == 0) {
                el = \$("<div/>").attr("id", "{$id}");
                \$("body").append(el);
                el.elfinder({$settings});
                //place it above tinymce dialogue
                el[0].elfinder.dialog.closest('.ui-dialog').css({'z-index':4000001});
            }
            else {
                el.elfinder("open","{$connectorUrl}");
            }
        }
JS;
        return 'js:' . $script;
    }
开发者ID:mmedojevicbg,项目名称:yii-elfinder,代码行数:31,代码来源:TinyMceElFinder.php

示例7: run

 public function run()
 {
     if (empty($this->config['action'])) {
         throw new CException('EAjaxUpload: param "action" cannot be empty.');
     }
     if (empty($this->config['allowedExtensions'])) {
         throw new CException('EAjaxUpload: param "allowedExtensions" cannot be empty.');
     }
     if (empty($this->config['sizeLimit'])) {
         throw new CException('EAjaxUpload: param "sizeLimit" cannot be empty.');
     }
     unset($this->config['element']);
     echo '<div id="' . $this->id . '"><noscript><p>Для того, что бы воспользоваться плагином, включите javascript</p></noscript></div>';
     $assets = dirname(__FILE__) . '/assets';
     $baseUrl = Yii::app()->assetManager->publish($assets);
     Yii::app()->clientScript->registerScriptFile($baseUrl . '/fileuploader.js', CClientScript::POS_HEAD);
     $this->css = !empty($this->css) ? $this->css : $baseUrl . '/fileuploader.css';
     Yii::app()->clientScript->registerCssFile($this->css);
     $postParams = array('PHPSESSID' => session_id(), 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken);
     if (isset($this->postParams)) {
         $postParams = array_merge($postParams, $this->postParams);
     }
     $config = array('element' => 'js:document.getElementById("' . $this->id . '")', 'debug' => false, 'multiple' => true);
     $config = array_merge($config, $this->config);
     $config['params'] = $postParams;
     $config = CJavaScript::encode($config);
     echo "<script type = 'text/javascript'>var FileUploader_" . $this->id . " = new qq.FileUploader({$config}); </script>";
     echo '<div class = "b-file_upload_error_message" id = "j-error_message"></div>';
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:29,代码来源:EAjaxUpload.php

示例8: run

 public function run()
 {
     list($this->name, $this->id) = $this->resolveNameId();
     if (isset($this->htmlOptions['placeholder'])) {
         $this->options['placeholder'] = $this->htmlOptions['placeholder'];
     }
     $data = array();
     if (isset($this->options['placeholder'])) {
         $data[''] = '';
     }
     $this->data = $data + $this->data;
     if ($this->hasModel()) {
         echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
     } else {
         $this->htmlOptions['id'] = $this->id;
         echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions);
     }
     $bu = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets/');
     $cs = Yii::app()->clientScript;
     $cs->registerCssFile($bu . '/select2.css');
     if ($this->scriptPosition === null) {
         $this->scriptPosition = $cs->coreScriptPosition;
     }
     $cs->registerScriptFile($bu . '/select2.js', $this->scriptPosition);
     $options = $this->options ? CJavaScript::encode($this->options) : '';
     $cs->registerScript(__CLASS__ . '#' . $this->id, "\$('#{$this->id}').select2({$options});");
 }
开发者ID:rusli-nasir,项目名称:ERP_Accounting_Indonesia,代码行数:27,代码来源:ESelect2.php

示例9: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $id = $this->resolveId($id);
     if ($this->hasModel()) {
         echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo TbHtml::textField($name, $this->value, $this->htmlOptions);
     }
     if ($this->assetPath !== false) {
         $this->publishAssets($this->assetPath);
         $this->registerCssFile('/css/bootstrap-datetimepicker.css');
         if ($this->registerJs) {
             $this->registerScriptFile('/js/' . $this->resolveScriptVersion('bootstrap-datetimepicker.js'), CClientScript::POS_END);
             if (isset($this->locale)) {
                 $this->locale = str_replace('_', '-', $this->locale);
                 $this->registerScriptFile("/js/locales/bootstrap-datetimepicker.{$this->locale}.js", CClientScript::POS_END);
             }
         }
     }
     if ($this->bindPlugin) {
         $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
         $this->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').datetimepicker({$options});");
     }
 }
开发者ID:juanprua,项目名称:yiistrap-widgets,代码行数:28,代码来源:TbDateTimePicker.php

示例10: renderButton

 public function renderButton($button, $name, $config, $id, &$js)
 {
     $output = '';
     $buttonCssClass = 'cms-icon-' . $config['iconSize'] . '-' . $button['icon'];
     if ($button['click']) {
         $js .= "\$('#{$id}_{$name}').click(" . CJavaScript::encode($button['click']) . ");\n";
     }
     $output .= '<li id="' . $id . '_' . $name . '_li" class="' . $button['cssClass'] . '">';
     $output .= '<a id="' . $id . '_' . $name . '"
             title="' . $button['title'] . '" href="#">';
     if (isset($button['checked'])) {
         $output .= '<input ';
         if ($button['checked']) {
             $output .= ' checked="checked" ';
         }
         $output .= 'type="checkbox" id="' . $id . '_' . $name . '_checkbox" /><label for="' . $id . '_' . $name . '_checkbox">';
     }
     if ($config['showIcons']) {
         $output .= '<span class="' . $buttonCssClass . '"></span>';
     }
     if ($config['showTitles']) {
         $output .= $button['title'];
     }
     if (isset($button['checked'])) {
         $output .= '</label>';
     }
     $output .= '</a>';
     $output .= '</li>';
     return $output;
 }
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:30,代码来源:Toolbar.php

示例11: registerFiles

 protected function registerFiles()
 {
     $assetsDir = (defined(__DIR__) ? __DIR__ : dirname(__FILE__)) . '/assets';
     $assets = Yii::app()->assetManager->publish($assetsDir);
     $ext = defined('YII_DEBUG') ? 'js' : 'min.js';
     $cs = Yii::app()->clientScript;
     $cs->registerCoreScript('jquery');
     $cs->registerScriptFile($assets . '/fullcalendar/jalali.js');
     $cs->registerScriptFile($assets . '/fullcalendar/fullcalendar.' . $ext);
     $cs->registerScriptFile($assets . '/fullcalendar/jquery-ui-1.8.23.custom.min.js');
     /* $cs->registerCssFile($assets.'/fullcalendar/fullcalendar.css'); */
     $cs->registerCssFile($assets . '/fullcalendar/fullcalendar_theme.css');
     if ($this->loadPrintCss) {
         $cs->registerCssFile($assets . '/fullcalendar/fullcalendar.print.css');
     }
     if ($this->googleCalendarUrl) {
         $cs->registerScriptFile($assets . '/fullcalendar/gcal.js');
         $this->options['events'] = $this->googleCalendarUrl;
     }
     if ($this->themeCssFile) {
         $this->options['theme'] = true;
         $cs->registerCssFile($assets . '/themes/' . $this->themeCssFile);
     }
     $BootBoxBaseUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.bootbox'));
     $cs->registerScriptFile($BootBoxBaseUrl . '/bootstrap.bootbox.min.js');
     $js = 'var ' . $this->id . ' = $("#' . $this->id . '").fullCalendar(' . CJavaScript::encode($this->options) . ');';
     $cs->registerScript(__CLASS__ . '#' . $this->id, $js, CClientScript::POS_READY);
 }
开发者ID:RezaMansouri70,项目名称:jalali-fullcalendar,代码行数:28,代码来源:JFullCalendar.php

示例12: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     if (is_string($this->keys)) {
         $this->keys = array($this->keys);
     }
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->keys as $key) {
         if (Yii::app()->user->hasFlash($key)) {
             echo strtr($this->template, array('{class}' => ' fade in', '{key}' => $key, '{message}' => Yii::app()->user->getFlash($key)));
         }
     }
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $selector = "#{$id} .alert";
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('{$selector}').alert();");
     // Register the "close" event-handler.
     if (isset($this->events['close'])) {
         $fn = CJavaScript::encode($this->events['close']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.close', "jQuery('{$selector}').bind('close', {$fn});");
     }
     // Register the "closed" event-handler.
     if (isset($this->events['closed'])) {
         $fn = CJavaScript::encode($this->events['closed']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.closed', "jQuery('{$selector}').bind('closed', {$fn});");
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:BootAlert.php

示例13: run

 public function run()
 {
 	$this->editorOptions = array_merge($this->editorOptions, $this->defaultOptions);
 	
     list($name, $id) = $this->resolveNameID();
     
     // Publishing assets.
     $dir = dirname(__FILE__);
     $assets = Yii::app()->getAssetManager()->publish($dir.DIRECTORY_SEPARATOR.'assets');
     $this->editorOptions['script_url'] = $assets.'/tiny_mce.js';
     
     // Registering javascript.
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('jquery');
     $cs->registerScriptFile($assets.'/jquery.tinymce.js');
     $cs->registerScriptFile($assets.'/plugins/tinybrowser/tb_tinymce.js.php');
     
     $cs->registerScript(
         'Yii.'.get_class($this).'#'.$id,
         '$(function(){$("#'.$id.'").tinymce('.CJavaScript::encode($this->editorOptions).');});'
     );
     
     $this->htmlOptions['id'] = $id;
     
     if($this->hasModel())
         $html = CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
     else
         $html = CHtml::textArea($name, $this->value, $this->htmlOptions);
         
     echo $html;
 }
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:31,代码来源:TinyMCE.php

示例14: registerClientScript

 /**
  * Registers plugin options and events (if any)
  */
 public function registerClientScript()
 {
     if (!empty($this->pluginOptions)) {
         $options = \CJavaScript::encode($this->pluginOptions);
         \Yii::app()->clientScript->registerScript('Tooltip#' . $this->getId(), "\$(document).foundation('tooltip', {$options});");
     }
 }
开发者ID:2amigos,项目名称:yiifoundation,代码行数:10,代码来源:Tooltip.php

示例15: run

 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (isset($this->htmlOptions['name'])) {
         $name = $this->htmlOptions['name'];
     } else {
         $this->htmlOptions['name'] = $name;
     }
     if ($this->hasModel()) {
         echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::textField($name, $this->value, $this->htmlOptions);
     }
     $options = CJavaScript::encode($this->options);
     $js = "jQuery('#{$id}').{$this->mode}picker({$options});";
     if (isset($this->language)) {
         $this->registerScriptFile($this->i18nScriptFile);
         $js = "jQuery('#{$id}').{$this->mode}picker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['{$this->language}'], {$options}));";
     }
     $cs = Yii::app()->getClientScript();
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets');
     $cs->registerCssFile($assets . self::ASSETS_NAME . '.css');
     $cs->registerScriptFile($assets . self::ASSETS_NAME . '.js', CClientScript::POS_END);
     $cs->registerScript(__CLASS__, $this->defaultOptions ? 'jQuery.{$this->mode}picker.setDefaults(' . CJavaScript::encode($this->defaultOptions) . ');' : '');
     $cs->registerScript(__CLASS__ . '#' . $id, $js);
 }
开发者ID:rusli-nasir,项目名称:ERP_Accounting_Indonesia,代码行数:31,代码来源:CJuiDateTimePicker.php


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