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


PHP JS::add方法代码示例

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


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

示例1: run

 public function run()
 {
     $config = $this->config();
     if (empty($config['action'])) {
         throw new CException('File Upload: param "action" cannot be empty.');
     }
     unset($config['element']);
     $this->publishAssets();
     $postParams = array('PHPSESSID' => session_id(), 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken);
     if (isset($this->postParams)) {
         $postParams = array_merge($postParams, $this->postParams);
     }
     $postParams['sizeLimit'] = $this->sizeLimit;
     if (!isset($postParams['cover'])) {
         $postParams['cover'] = true;
     }
     if (!key_exists('file_type', $postParams)) {
         $postParams['file_type'] = 'image';
     }
     $setup = array('element' => 'js:document.getElementById("' . $this->id . '")');
     $setup = array_merge($setup, $config);
     $setup['params'] = $postParams;
     $setup = CJavaScript::encode($setup);
     JS::add('ajaxFileUpload' . $this->id, "var FileUploader_" . $this->id . " = new qq.FileUploader(" . $setup . ");");
     $view = '<div id="' . $this->id . '"><noscript><p>' . Yii::t('admin', 'In order to use the plugin, enable javascript') . '</p></noscript></div>';
     if ($this->multiple == true) {
         $view .= '<p class = "l-hint">' . Yii::t('admin', 'You can upload multiple files simultaneously holding down the shift or ctrl when selecting') . '</p>';
     }
     $view .= '<div id = "j-error_message" class = "l-system_message"></div>';
     echo $view;
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:31,代码来源:UploadWidget.php

示例2: getCover

    /**
     * Вывод обложки для file manager
     * @param int $id идентификатор модели
     * @param string $name имя модели
     * @param string $link ссылка, если задана, то выводится ссылка, иначе галерея
     * @param string $noImage если изображение не найдено
     * @param string $type тип изображения, которое хотим получить
     * @return string
     */
    public static function getCover($id, $name, $link = '', $type = 'thumbnail', $noImage = '')
    {
        Yii::import('application.modules.file.models.FileManager');
        $data = FileManager::model()->find('model_name=:model_name AND model_id = :model_id AND cover = 1', array(':model_id' => $id, ':model_name' => $name));
        if ($data === null) {
            $noImage = '<img alt = "" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '"/>';
            if ($link == '') {
                $view = $noImage;
            } else {
                $view = '<a href = "' . $link . '">' . $noImage . '</a>';
            }
        } else {
            $file = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder . DS . $data->folder . DS . $type . DS . $data->file;
            if (Yii::app()->cFile->set($file)->exists) {
                $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/' . $type . '/' . $data->file . '"/>';
            } else {
                $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '/>';
            }
            if ($link == '') {
                $view = '<ul id= "j-photobox_gallery_cover" class = "b-images_view b-image_cover j-photobox_gallery">
						<li class = "l-inline_block">
							<a href = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/original/' . $data->file . '">' . $img . '</a>
						</li>
					</ul>';
                if (!Yii::app()->request->isAjaxRequest) {
                    Yii::app()->clientScript->registerPackage('photobox');
                }
                JS::add('photobox_init', "\$('.j-photobox_gallery').photobox('a',{ 'time':0, 'loop':false, 'afterClose': function(){}});");
            } else {
                $view = '<a href = "' . $link . '">' . $img . '</a>';
            }
        }
        return $view;
    }
开发者ID:blrtromax,项目名称:seobility,代码行数:43,代码来源:Helper.php

示例3: initDisplay

 /**
  * Initialize requires CSS and JS files.
  */
 public static function initDisplay()
 {
     static $inited = false;
     if (!$inited) {
         JS::add('/js/video-js.min.js', false);
         JS::startup('videojs.options.flash.swf = "/swf/video-js.swf"');
         CSS::add('/css/video-js.min.css');
         $inited = true;
     }
 }
开发者ID:kemosabhay,项目名称:Lightning,代码行数:13,代码来源:Video.php

示例4: run

 public function run()
 {
     Yii::app()->getClientScript()->registerCoreScript('jquery.ui');
     JS::add('jquery-ui-sortable', "\$('#d-file_manager_items').sortable({'delay':'300','deactivate':function(event, ui ) { sendImagesPosion();}});");
     Yii::import('application.modules.file.models.FileManager');
     $criteria = FileManager::getSearchCriteria($this->id, $this->modelName);
     $criteria->order = 'position, date DESC';
     if ($this->id < 0) {
         if (Yii::app()->user->hasState('file_manager_folder_' . $this->modelName)) {
             $folderName = Yii::app()->user->getState('file_manager_folder_' . $this->modelName);
         } else {
             $folderName = Yii::app()->getModule('file')->generateName(Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder);
         }
         $criteria->compare('folder', $folderName, true);
     }
     $dataprovider = FileManager::model()->findAll($criteria);
     $this->render('form', array('dataprovider' => $dataprovider));
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:18,代码来源:FormWidget.php

示例5: seo

    public function seo($title = null, $seoKeywords = null, $seoDescription = null, $name = null)
    {
        if ($title != '') {
            $this->pageTitle = $title;
        } else {
            $this->pageTitle = $name;
        }
        if ($seoKeywords) {
            $this->metaKeywords = $seoKeywords;
        }
        if ($seoDescription) {
            $this->metaDescription = $seoDescription;
        }
        if (Yii::app()->request->isAjaxRequest) {
            JS::add('page_seo', '
			$("title").text("' . addslashes(strip_tags($this->pageTitle)) . '");
			$("meta[name=description]").attr("content", "' . addslashes($this->metaDescription) . '");
			$("meta[name=keywords]").attr("content", "' . addslashes($this->metaKeywords) . '");
		');
        }
    }
开发者ID:blrtromax,项目名称:seobility,代码行数:21,代码来源:Controller.php

示例6: buildTheViewScript


//.........这里部分代码省略.........
                     $funcCall = $this->buildFunctionCall($l_function, $l_matchKeys, $getValue);
                     if (isset($this->setScriptMediaSwitch) && ComponentbuilderHelper::checkArray($this->setScriptMediaSwitch) && in_array($matchTypeKey, $this->setScriptMediaSwitch)) {
                         $modal .= $funcCall['code'];
                     } else {
                         if (isset($this->setScriptUserSwitch) && ComponentbuilderHelper::checkArray($this->setScriptUserSwitch) && in_array($matchTypeKey, $this->setScriptUserSwitch)) {
                             $name = $name . '_id';
                         }
                         $listener .= "\n// #jform_" . $name . " listeners for " . $l_matchKey . " function";
                         $listener .= "\njQuery('#jform_" . $name . "').on('keyup',function()";
                         $listener .= "\n{";
                         $listener .= $funcCall['code'];
                         $listener .= "\n});";
                         $listener .= "\njQuery('#adminForm').on('change', '#jform_" . $name . "',function (e)";
                         $listener .= "\n{";
                         $listener .= "\n\te.preventDefault();";
                         $listener .= $funcCall['code'];
                         $listener .= "\n});\n";
                     }
                 }
             }
             if (ComponentbuilderHelper::checkString($modal)) {
                 $listener .= "\nwindow.SqueezeBox.initialize({";
                 $listener .= "\n\tonClose:function(){";
                 $listener .= $modal;
                 $listener .= "\n\t}";
                 $listener .= "\n});\n";
             }
             // now build the function
             $func = '';
             $head = '';
             foreach ($functions as $f_function => $f_matchKeys) {
                 $map = '';
                 // does this function require an array
                 $addArray = false;
                 $func_ = $this->buildFunctionCall($f_function, $f_matchKeys, $getValue);
                 // set array switch
                 if ($func_['array']) {
                     $addArray = true;
                 }
                 $func .= "\n// the " . $f_function . " function";
                 $func .= "\nfunction " . $f_function . "(";
                 $fucounter = 0;
                 foreach ($f_matchKeys as $fu_matchKey) {
                     if (ComponentbuilderHelper::checkString($fu_matchKey)) {
                         if ($fucounter == 0) {
                             $func .= $fu_matchKey;
                         } else {
                             $func .= ',' . $fu_matchKey;
                         }
                         $fucounter++;
                     }
                 }
                 $func .= ")";
                 $func .= "\n{";
                 if ($addArray) {
                     foreach ($f_matchKeys as $a_matchKey) {
                         $name = $matchNames[$a_matchKey];
                         $func .= "\n\tif (isSet(" . $a_matchKey . ") && " . $a_matchKey . ".constructor !== Array)\n\t{\n\t\tvar temp_" . $f_function . " = " . $a_matchKey . ";\n\t\tvar " . $a_matchKey . " = [];\n\t\t" . $a_matchKey . ".push(temp_" . $f_function . ");\n\t}";
                         $func .= "\n\telse if (!isSet(" . $a_matchKey . "))\n\t{";
                         $func .= "\n\t\tvar " . $a_matchKey . " = [];";
                         $func .= "\n\t}";
                         $func .= "\n\tvar " . $name . " = " . $a_matchKey . ".some(" . $a_matchKey . "_SomeFunc);\n";
                         // setup the map function
                         $map .= "\n// the " . $f_function . " Some function";
                         $map .= "\nfunction " . $a_matchKey . "_SomeFunc(" . $a_matchKey . ")";
                         $map .= "\n{";
开发者ID:vdm-io,项目名称:Joomla-Component-Builder,代码行数:67,代码来源:e_Interpretation.php

示例7: me

				return true;
			}
		</script>
		<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<?
	CSS::add("/styles/jquery-ui-1.8.17.custom.css");
	CSS::add("/styles/pic.css");
	CSS::emit();
	JS::add("/offensive/js/jquery-1.7.1.min.js");
	JS::add("/offensive/js/tmbolib.js");
	JS::add("/offensive/js/jquery-ui-1.8.17.custom.min.js");
	JS::add("/offensive/js/jquery.ba-outside-events.min.js");
	JS::add("/offensive/js/subscriptions.js");
	JS::add("/offensive/js/irsz.js");
	JS::add("/offensive/js/picui.js");
	JS::add("/offensive/js/analytics.js");
	JS::emit();
?>
		<script type="text/javascript">
			var me = {
				hide_nsfw: <?= me()->getPref("hide_nsfw") == 1 ? 'true' : 'false' ?>,
				hide_tmbo: <?= me()->getPref("hide_tmbo") == 1 ? 'true' : 'false' ?>,
				hide_bad: <?= me()->getPref("hide_bad") == 1 ? 'true' : 'false' ?>,
				squelched: <?= json_encode(me()->squelched_list()) ?>
			}
			getSocket("<?php $t = new Token("realtime"); echo $t->tokenid(); ?>", function(socket) {
				socket.on('comment', function(comment) {
					var stats_row = $("#voting_stats");
					if (comment.comment) {
						var comments_count = parseInt(stats_row.find('#count_comment').text()) + 1;
						stats_row.find('#count_comment').text(comments_count);
开发者ID:numist,项目名称:this-might-be-offensive,代码行数:31,代码来源:pic.php

示例8: GraphicAdmin

 Echo the big graphical menu, function called by the admin modules
	$cat: Which menucategory to show, default = all
************************************************************************************/
function GraphicAdmin($cat = 'all')
{
    global $CLASS, $cpgtpl;
    require_once CORE_PATH . 'classes/cpg_adminmenu.php';
    if ($CLASS['adminmenu']->display($cat, 'graph')) {
        $cpgtpl->set_filenames(array('body' => 'admin/index_body.html'));
        $cpgtpl->display('body');
    }
}
$op = !empty($_GET['op']) ? $_GET['op'] : (isset($_POST['op']) ? $_POST['op'] : 'index');
if ($MAIN_CFG['global']['admingraphic'] >= '4' || strtolower($op) == 'forums') {
    JS::add('includes/javascript/JSCookMenu.js');
    JS::add('themes/default/javascript/cookmenu.js');
    CSS::add('themes/default/style/cookmenu.css');
}
global $CPG_SESS;
if ($op == 'logout') {
    unset($CPG_SESS['admin']);
    $redir = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $mainindex;
    cpg_error(_YOUARELOGGEDOUT, _ADMINMENU_LOGOUT, $redir);
} else {
    if ($CLASS['member']->admin_id) {
        if (!preg_match('#^([a-zA-Z0-9_\\-]+)$#', $op)) {
            cpg_error(sprintf(_ERROR_BAD_CHAR, strtolower(_ADMIN)), _SEC_ERROR);
        }
        $Module = new Module('Admin');
        Blocks::$showblocks = $Module->sides;
        $Blocks = new Blocks(-1);
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:admin.php

示例9:

?>
</h2>
		<div class = "b-admin_post_seo j-admin_post_seo">
			<div class="l-row">
				<?php 
echo $form->textFieldControlGroup($model, 'seo_title');
?>
			</div>
			
			<div class="l-row">
				<?php 
echo $form->textAreaControlGroup($model, 'seo_description');
?>
			</div>
			
			<div class="l-row">
				<?php 
echo $form->textAreaControlGroup($model, 'seo_keywords');
?>
			</div>
	
			<div class="l-row">
				<?php 
echo $form->textFieldControlGroup($model, 'url');
?>
			</div>
		</div>
	</div>
<?php 
JS::add('seoInit', 'seoInit("' . Yii::t('admin', 'Show') . '", "' . Yii::t('admin', 'Hide') . '", "btn btn-default btn-sm");', 0);
开发者ID:blrtromax,项目名称:seobility,代码行数:30,代码来源:_seo.php

示例10: listBox

 public static function listBox($model, $form, $data, $attribute = '')
 {
     $options = array();
     if (isset($model->{$attribute})) {
         $m = explode(",", $model->{$attribute});
         foreach ($m as $v) {
             $options[$v] = array('selected' => 'selected');
         }
     }
     Yii::app()->clientScript->registerPackage('choosen');
     $view = $form->listBoxControlGroup($model, $attribute, $data, array('multiple' => 'multiple', 'size' => count($data), 'options' => $options, 'class' => 'j-choosen'));
     JS::add('choosen', "\$('.j-choosen').chosen({\n\t\t\t\t'search_contains':true,\n\t\t\t\t'width': '100%'\n\t\t\t});");
     return $view;
 }
开发者ID:blrtromax,项目名称:seobility,代码行数:14,代码来源:Fields.php

示例11: get_lang

// optional
Module::$path = BASEDIR . "modules/{$Module->path_name}/";
// optional
Module::$is_home = $Module->name === $MAIN_CFG['global']['main_module'];
/* finished instructing class */
# check for permissions
$Module->allow();
# get module custom language
get_lang($Module->name, -1);
# setup blocks, showblocks may be depreciated in the near future
Blocks::$showblocks = $Module->sides;
/* compatibility */
$home = Module::$is_home;
$module_name = $Module->name;
$showblocks = $Module->sides;
$module_title = $Module->title;
/* end compatibility */
JS::add('includes/javascript/poodle.js');
if ($MAIN_CFG['global']['admin_help']) {
    JS::add('includes/javascript/infobox.js');
}
//MetaTag::add(Module::$metatag); // must include Page data already
require 'includes/meta.php';
require Module::$path . Module::$file . '.php';
if ($Module->name === 'smilies') {
    echo smilies_table('window', $_GET['field'], $_GET['form']);
    exit;
}
if (defined('HEADER_OPEN')) {
    require_once 'footer.php';
}
开发者ID:cbsistem,项目名称:nexos,代码行数:31,代码来源:name.php

示例12: foreach

    echo '<ul id= "j-photobox_gallery_' . $this->modelName . '" class = "b-images_view j-photobox_gallery">';
    foreach ($dataprovider as $data) {
        $file = Yii::getPathOfAlias('webroot') . DS . 'upload' . DS . Yii::app()->getModule('file')->uploadFolder . DS . $data->folder . DS . $this->type . DS;
        if (Yii::app()->cFile->set($file . $data->file)->exists) {
            $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/upload/' . Yii::app()->getModule('file')->uploadFolder . '/' . $data->folder . '/' . $this->type . '/' . $data->file . '"/>';
        } else {
            $img = '<img alt = "' . strip_tags($data->description) . '" class = "j-lazy" src = "/images/' . Yii::app()->getModule('file')->noImage . '/>';
        }
        ?>
	<li class = "l-inline_block">
		<a href = "/upload/<?php 
        echo Yii::app()->getModule('file')->uploadFolder;
        ?>
/<?php 
        echo $data->folder;
        ?>
/original/<?php 
        echo $data->file;
        ?>
">
			<?php 
        echo $img;
        ?>
		</a>
	</li>
	<?php 
    }
    echo '</ul>';
    JS::add('photobox_init', "\$('.j-photobox_gallery').photobox('a',{ 'time':0, 'loop':false, 'afterClose': function(){}});");
    //JS::add('lazy_init', '$(".j-lazy").lazy({effect: "fadeIn", effectTime: 1000});');
}
开发者ID:blrtromax,项目名称:seobility,代码行数:31,代码来源:view.php


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