本文整理汇总了PHP中cs函数的典型用法代码示例。如果您正苦于以下问题:PHP cs函数的具体用法?PHP cs怎么用?PHP cs使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerBootstrap3CoreAssets
public function registerBootstrap3CoreAssets()
{
//bootstrap css
app()->params['bootswatch3_skin'] == "none" ? cs()->registerCssFile(bu() . '/libs/bootstrap/dist/css/bootstrap.css') : cs()->registerCssFile(bu() . '/libs/bootswatch/' . app()->params['bootswatch3_skin'] . '/bootstrap.min.css');
//bootstrap js
cs()->registerScriptFile(bu() . '/libs/bootstrap/dist/js/bootstrap.min.js', CClientScript::POS_END);
}
示例2: actionPosts
public function actionPosts($name)
{
$tag = urldecode($name);
$this->setSiteTitle(t('tag_posts', 'main', array('{name}' => $tag)));
// @todo 关键字的描述没有指定
$this->setPageKeyWords($tag);
$this->setPageDescription(t('tag_posts_page_description', 'main', array('{name}' => $tag)));
cs()->registerMetaTag('all', 'robots');
$cmd = app()->getDb()->createCommand()->select('p.id')->from(TABLE_TAG . ' t')->where('t.name = :tagname', array(':tagname' => $tag))->join(TABLE_POST_TAG . ' pt', 'pt.tag_id = t.id')->join(TABLE_POST . ' p', 'p.id = pt.post_id');
$ids = $cmd->queryColumn();
if (count($ids) > 0) {
$criteria = new CDbCriteria();
if (param('post_list_type') == POST_LIST_TYPE_TITLE) {
$criteria->select = array('t.id', 't.title', 't.visit_nums', 't.comment_nums', 't.create_time');
}
$criteria->order = 't.istop, t.create_time desc, t.id desc';
$criteria->addInCondition('t.id', $ids)->addCondition('t.state = :state');
$criteria->params += array(':state' => POST_STATE_ENABLED);
$count = Post::model()->count($criteria);
$pages = new CPagination($count);
$pages->setPageSize(param('postCountOfTitleListPage'));
$pages->applyLimit($criteria);
$posts = Post::model()->findAll($criteria);
}
$listType = param('post_list_type');
$view = $listType == POST_LIST_TYPE_SUMMARY ? '/post/_summary_list' : '/post/_title_list';
$blockTitle = t('tag_posts', 'main', array('{name}' => $tag));
$data = array('blockTitle' => $blockTitle, 'posts' => $posts, 'pages' => $pages);
$postListHtml = $this->renderPartial($view, $data, true);
$this->render('posts', array('postListHtml' => $postListHtml));
}
示例3: cmpr
function cmpr()
{
$s = array("", "123", "123q", "q123", "-456", "-456.7", "7.80", "9000000000", "9e10");
$i = array(0, 123, -456, 7.8, 90000000000);
for ($ji = 0; $ji < 5; ++$ji) {
cs($i[$ji]);
}
for ($js = 0; $js < 9; ++$js) {
ci($s[$js]);
}
for ($ji = 0; $ji < 5; ++$ji) {
for ($js = 0; $js < 9; ++$js) {
is($i[$ji], $s[$js]);
}
}
print "----------\n0 == 'q123'\n";
var_dump(0 == "q123");
print "----------\n123 == '123q'\n";
var_dump(123 == "123q");
print "----------\n123 == '123.0'\n";
var_dump(123 == "123.0");
print "----------\n90000000000 == '9e10'\n";
var_dump(9000000000 == "9e10");
print "----------\n0 == '-456'\n";
var_dump(0 == "-456");
}
示例4: registerJs
protected function registerJs()
{
$assets = Yii::getPathOfAlias('Xpress.extensions.web.widgets.XDataTable.assets');
$assetsBaseUrl = app()->assetManager->publish($assets);
cs()->registerScriptFile($assetsBaseUrl . '/media/js/jquery.dataTables.min.js', CClientScript::POS_HEAD);
cs()->registerCssFile($assetsBaseUrl . '/media/css/jquery.dataTables.min.css');
}
示例5: regCoreFile
/**
* This is the shotcut to Yii::app()->clientScript->registerCoreScript
*/
function regCoreFile($files)
{
if (!is_array($files)) {
$files = array($files);
}
foreach ($files as $file) {
cs()->registerCoreScript($file);
}
}
示例6: regJsFile
/**
* This is the shortcut to Yii::app()->clientScript->registerScriptFile
*/
function regJsFile($files, $url = 'js', $pos = CClientScript::POS_HEAD)
{
if (!is_array($files)) {
$files = array($files);
}
foreach ($files as $file) {
cs()->registerScriptFile(bu($url) . '/' . $file . '.js', $pos);
}
}
示例7: setPageDescription
protected function setPageDescription($text)
{
if (empty($text)) {
return false;
}
if (is_array($text)) {
$text = join(',', $text);
}
cs()->registerMetaTag($text . ',' . param('shortdesc') . ',' . param('description'), 'description');
}
示例8: run
public function run()
{
$files = $this->files;
$model = $this->model;
$params = $this->params;
$bigSize = $this->bigSize;
$showTypeLink = $this->showTypeLink;
cs()->registerScriptFile($this->assetsUrl . '/js/tools.js', CClientScript::POS_END);
cs()->registerScriptFile($this->assetsUrl . '/js/uploader.js', CClientScript::POS_END);
cs()->registerCssFile($this->assetsUrl . '/css/uploader.css');
cs()->registerCssFile($this->assetsUrl . '/css/crop.css');
//jcrop
cs()->registerScriptFile(app()->controller->rootAssetsUrl . '/plugins/jquery-jcrop/jquery.Jcrop.min.js', CCLientScript::POS_END);
cs()->registerCssFile(app()->controller->rootAssetsUrl . '/plugins/jquery-jcrop/jquery.Jcrop.css');
/**
* register FANCYBOX
*/
// $fancy = app()->controller->rootAssetsUrl.'/js/plugins/fancybox';
//Add mousewheel plugin (this is optional)
// cs()->registerScriptFile($fancy.'/jquery.mousewheel-3.0.6.pack.js', CCLientScript::POS_END);
//Add fancyBox
// cs()->registerScriptFile($fancy.'/jquery.fancybox.pack.js', CCLientScript::POS_END);
// cs()->registerCssFile($fancy.'/jquery.fancybox.css');
// cs()->registerCssFile($fancy.'/custom.css');
//sortable
cs()->registerScriptFile($this->assetsUrl . '/js/jquery.sortable.min.js', CClientScript::POS_END);
$id = $model->id;
$mName = get_class($model);
$script = <<<script
\t\tsetTimeout(function(){
\$("#photos_grid_{$model->id}").initTools({
\t\t\t\tdel: true, rotate: true, crop: true, cropContainer: \$('#crop_{$mName}_photos_{$id}')
\t\t\t});
//add fancybox to thumnails
if(\$.fn.fancybox != undefined){
\$(".photos_tabs a.fancybox").fancybox({
padding: 5,
nextEffect: 'fade', prevEffect: 'fade',
openEffect: 'fade', closeEffect: 'fade',
helpers: {
title : {type: 'outside'},
overlay : {css : {'background' : 'rgba(0,0,0, 0.4)'} }
}
});
}
}, 1000);
script;
cs()->registerScript('uploader_tools', $script, CClientScript::POS_END);
$css = $this->assetsUrl . '/css/custom_multiple.css';
$this->render('uploader', compact('files', 'model', 'params', 'css', 'bigSize', 'showTypeLink'));
}
示例9: actionList
public function actionList()
{
$this->channel = 'topic';
$criteria = new CDbCriteria();
$criteria->order = 'orderid desc, post_nums desc, id asc';
$topics = Topic::model()->findAll($criteria);
$this->setSiteTitle(t('all_topic_list'));
$this->setPageKeyWords(null);
$this->setPageDescription(t('all_topics_description'));
cs()->registerMetaTag('all', 'robots');
$this->render('list', array('topics' => $topics));
}
示例10: run
public function run()
{
ob_start();
ob_implicit_flush(false);
$this->widget('zii.widgets.CMenu', array('items' => $this->items));
$menuHtml = ob_get_clean();
$menuHtml = '<div id="' . $this->id . '">' . $menuHtml . '</div>';
// fix autoOpenPopup if the menu is context menu
if ($this->options['mode'] == 'popup') {
$this->options['autoOpenPopup'] = false;
}
$js = $this->render('jqxMenu', array('html' => $menuHtml, 'options' => $this->options, 'ownerId' => $this->ownerId), true);
cs()->registerScript("jqxMenu_{$this->id}", $js, CClientScript::POS_READY);
}
示例11: setPageDescription
protected function setPageDescription($value)
{
if (empty($value)) {
return false;
}
$value = (array) $value;
$sitename = param('sitename');
if (param('shortdesc')) {
$sitename = $sitename . ' - ' . param('shortdesc');
}
array_push($value, $sitename);
$text = strip_tags(trim(join(',', $value)));
cs()->registerMetaTag($text, 'description');
}
示例12: asChainable
private static function asChainable($p)
{
switch (gettype($p)) {
case "string":
return cs($p);
case "array":
return ca($p);
case "object":
return co($p);
default:
if (is_object($p)) {
return c($p);
} else {
return $p;
}
}
}
示例13: run
public function run()
{
self::$commentsRelationArray[$this->id]['commentsRelation'] = $this->commentsRelation;
self::$commentsRelationArray[$this->id]['hasCommentsRelation'] = $this->hasCommentsRelation;
//Если аякс то не рисуем попап, а только заполняем массив с реляциями
if (app()->request->isAjaxRequest) {
return false;
}
$ownerModel = new $this->ownerModel();
$commentsRelation = $ownerModel->metaData->relations[$this->commentsRelation];
$commentsModelClassName = $commentsRelation->className;
$commentsForeignKey = $commentsRelation->foreignKey;
//init
$model = new $commentsModelClassName();
cs()->registerPackage('comments');
cs()->registerScript('init-comments' . $this->id, "\$.fn.comments('init', {id: '{$this->id}'});", CClientScript::POS_READY);
$this->render('index', compact('id', 'model', 'commentsForeignKey'));
}
示例14: init
public function init()
{
parent::init();
cs()->coreScriptPosition = CClientScript::POS_END;
cs()->defaultScriptFilePosition = CClientScript::POS_END;
$this->theme = 'movil';
$useragent = $_SERVER['HTTP_USER_AGENT'];
/*if (strpos($useragent, 'Android') || strpos($useragent, 'iPad') || strpos($useragent, 'iPhone') || strpos($useragent, 'PlayBook') || strpos($useragent, 'BB10') || strpos($useragent, 'BlackBerry') || strpos($useragent, 'Opera Mini') || strpos($useragent, 'IEMobile') || strpos($useragent, 'webOS') || strpos($useragent, 'MeeGo'))
$this->theme = 'movil';
else
$this->theme = 'pc';/**/
if (preg_match('/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i', $useragent) || preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i', substr($useragent, 0, 4))) {
$this->theme = 'movil';
} else {
$this->theme = 'pc';
}
/**/
Yii::app()->setTheme($this->theme);
return true;
}
示例15: actionPosts
public function actionPosts($id)
{
$id = (int) $id;
$category = Category::model()->findByPk($id);
if ($category === null) {
throw new CHttpException(403, t('category_is_not_found'));
}
$data = self::fetchCategoryPosts($id);
$this->setSiteTitle(t('category_posts', 'main', array('{name}' => $category->name)));
$this->setPageKeyWords($category->name);
$this->setPageDescription(t('category_posts_page_description', 'main', array('{name}' => $category->name)));
$this->channel = $id;
cs()->registerMetaTag('all', 'robots');
$listType = param('post_list_type');
$view = $listType == POST_LIST_TYPE_SUMMARY ? '/post/_summary_list' : '/post/_title_list';
$data['blockTitle'] = t('category_posts', 'main', array('{name}' => $category->name));
$postListHtml = $this->renderPartial($view, $data, true);
$feedTitle = $category->name . t('category_feed');
cs()->registerLinkTag('alternate', 'application/rss+xml', aurl('feed/category', array('id' => $id)), null, array('title' => $feedTitle));
$this->render('posts', array('category' => $category, 'postListHtml' => $postListHtml));
}