本文整理汇总了PHP中CTemplate::addStylesheet方法的典型用法代码示例。如果您正苦于以下问题:PHP CTemplate::addStylesheet方法的具体用法?PHP CTemplate::addStylesheet怎么用?PHP CTemplate::addStylesheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTemplate
的用法示例。
在下文中一共展示了CTemplate::addStylesheet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showToolbar
function showToolbar($data = null)
{
$mySQLVer = 0;
if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) {
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php';
$mySQLVer = CAdvanceSearch::getMySQLVersion();
}
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'toolbar.php';
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'miniheader.php';
$format = JRequest::getVar('format', 'html', 'get');
if ($format == 'json') {
return;
}
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
$my = CFactory::getUser();
$userid = JRequest::getInt('userid', '');
$user = CFactory::getUser($userid);
// Get the configuration object.
$config = CFactory::getConfig();
//JHTML::_('behavior.tooltip');
$js = 'assets/window-1.0';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
$js = 'assets/script-1.2';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
$js = '<script type=\'text/javascript\'>';
$js .= '/*<![CDATA[*/';
$js .= 'var js_viewerId = ' . $my->id . '; ';
$js .= 'var js_profileId = ' . $user->id . ';';
$js .= '/*]]>*/';
$js .= '</script>';
$mainframe->addCustomHeadTag($js);
CFactory::load('libraries', 'template');
CTemplate::addStylesheet('style');
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
// FOr iPhone, we need to add the stylesheet AFTER the main stylesheet has been loaded
// if(JRequest::getVar('screen')=='mobile')
// {
// $document->addStylesheet( JURI::root() . 'components/com_community/templates/default/css/style.mobile.css' );
// }
// This need to be loaded in main messaging library
CFactory::load('libraries', 'window');
CWindow::load();
$template = new CTemplateHelper();
$styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
$styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
$css = '<!-- Jom Social -->
<!--[if IE 7.0]>
<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
<![endif]-->';
$mainframe->addCustomHeadTag($css);
$css = 'assets/autocomplete.css';
CAssets::attach($css, 'css');
// Load joms.ajax
CTemplate::addScript('joms.ajax');
$task = JRequest::getVar('task', '', 'GET');
$groupId = JRequest::getInt('groupid', '', 'GET');
// Hide the toolbar from unregistered user
// but still show the mini header
if (empty($my->id)) {
if (!empty($groupId) && $task != 'viewgroup') {
CFactory::load('libraries', 'miniheader');
echo CMiniHeader::showGroupMiniHeader($groupId);
return;
}
echo CMiniHeader::showMiniHeader($this->_showMiniHeaderUser);
return;
}
/**
* Inbox unread count
*/
$inboxUnread = 0;
if (!empty($data['inbox'])) {
$inboxUnread = $data['inbox'];
}
/**
* Notification alert
*/
$notiAlert = 0;
$notiAlert = $this->_newNotification();
if (!empty($notiAlert) && $notiAlert > 0) {
CFactory::load('libraries', 'window');
CWindow::load();
}
$config = CFactory::getConfig();
$logoutLink = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false);
$logoutLink = base64_encode($logoutLink);
$isFacebookUser = false;
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) {
CFactory::load('libraries', 'facebook');
CFactory::load('models', 'connect');
// Once they reach here, we assume that they are already logged into facebook.
//.........这里部分代码省略.........
示例2: defined
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
defined('_JEXEC') or die('Unauthorized Access');
// Check if JomSocial core file exists
$corefile = JPATH_ROOT . '/components/com_community/libraries/core.php';
jimport('joomla.filesystem.file');
if (!JFile::exists($corefile)) {
return;
}
// Include JomSocial's Core file, helpers, settings...
require_once $corefile;
require_once dirname(__FILE__) . '/helper.php';
// Add proper stylesheet
JFactory::getLanguage()->isRTL() ? CTemplate::addStylesheet('style.rtl') : CTemplate::addStylesheet('style');
$displayType = $params->get('display_type', 1);
// 0 = albums, 1 = photos (default)
$limit = $params->get('limit', 20);
$photoType = $params->get('category_type', 0);
$sortBy = $params->get('filter_by', 0);
if ($sortBy) {
// 1 = popularity
$sortBy = 'hit';
}
switch ($photoType) {
case 1:
$photoType = 'user';
break;
case 2:
$photoType = 'group';
示例3: attachHeaders
/**
* Attach necessary scripts and stylesheets for the toolbar to operate correctly on 3rd party
* environments.
**/
private function attachHeaders()
{
$document =& JFactory::getDocument();
$config = CFactory::getConfig();
if ($document->getType() != 'html') {
return;
}
$js = 'assets/window-1.0';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
$js = 'assets/script-1.2';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
CFactory::load('libraries', 'template');
CTemplate::addStylesheet('style');
$templateParams = CTemplate::getTemplateParams();
CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme'));
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
// This need to be loaded so the popups will work correctly in notification window
CFactory::load('libraries', 'window');
CWindow::load();
$template = new CTemplateHelper();
$styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
$styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
$css = '<!-- Jom Social -->
<!--[if IE 7.0]>
<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
<![endif]-->';
$document->addCustomTag($css);
$css = 'assets/autocomplete.css';
CAssets::attach($css, 'css');
// Load joms.ajax
CTemplate::addScript('joms.ajax');
}
示例4: executeMobile
public function executeMobile($task = '')
{
CFactory::load('libraries', 'mobile');
$view =& $this->getView(JRequest::getCmd('view', 'frontpage'));
// Fetch content
ob_start();
if (!empty($task) && method_exists($this, $task)) {
$this->{$task}();
} else {
$this->display();
}
$content = ob_get_contents();
ob_end_clean();
// Swap joomla document with
// CDocumentMobile or CDocumentMobileAjax
$document =& JFactory::getDocument();
if (JRequest::getCmd('section') == 'content') {
$document = new CDocumentMobileAjax($document);
echo $content;
} else {
$document = new CDocumentMobile($document);
// Add our scripts & stylesheets
CTemplate::addScript('script.mobile-1.0');
CTemplate::addScript('joms.ajax');
CTemplate::addStylesheet('style.mobile');
// Fetch toolbar
ob_start();
$view->showToolbarMobile();
$toolbar = ob_get_contents();
ob_end_clean();
// Fetch switcher
ob_start();
CMobile::showSwitcher();
$switcher = ob_get_contents();
ob_end_clean();
$tmpl = new CTemplate();
$tmpl->set('toolbar', $toolbar);
$tmpl->set('content', $content);
$tmpl->set('switcher', $switcher);
echo $tmpl->fetch('mobile.index');
}
}
示例5: execute
/**
* Execute a request
*/
public function execute($task)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$my = CFactory::getUser();
$pathway = $mainframe->getPathway();
$menus = $mainframe->getMenu();
$menuitem = $menus->getActive();
$userId = $jinput->get->get('userid', '', 'INT');
$tmpl = $jinput->request->get('tmpl', '', 'STRING');
$format = $jinput->request->get('format', '', 'STRING');
$nohtml = $jinput->request->get('no_html', '', 'STRING');
if ($tmpl != 'component' && $format != 'feed' && $format != 'ical' && $nohtml != 1 && $format != 'raw') {
// This is to fix MSIE that has incorrect user agent because jquery doesn't detect correctly.
$ieFix = "<!--[if IE 6]><script type=\"text/javascript\">var jomsIE6 = true;</script><![endif]-->";
$document->addCustomTag($ieFix);
}
// Add custom css for the specific view if needed.
$config = CFactory::getConfig();
$viewName = JString::strtolower($jinput->request->get('view', '', 'STRING'));
jimport('joomla.filesystem.file');
if ($config->get('enablecustomviewcss')) {
CTemplate::addStylesheet($viewName);
}
$template = JFactory::getApplication()->getTemplate();
// echo var_dump(CTemplate::addStylesheet('beez2'));
if ($template == 'beez_20' && JVERSION > 2 && JVERSION < 3) {
CTemplate::addStylesheet('beez2');
}
$env = CTemplate::getTemplateEnvironment();
$svgFile = CFactory::getPath('template://assets/icon/joms-icon.svg');
// non ajax-prefixed tasks that should avoid svg
$excludeSvgList = array('changeAvatar', 'multiUpload', 'uploadvideo');
// exclude svg file from ajax response
if ($svgFile && substr($task, 0, 4) != 'ajax' && !in_array($task, $excludeSvgList)) {
include_once $svgFile;
}
$html = '<div id="community-wrap" class="jomsocial-wrapper on-' . $env->joomlaTemplate . ' ' . $document->direction . ' c' . ucfirst($viewName) . '">';
$html .= '<div class="jomsocial">';
// Build the component menu module
ob_start();
$tmpl = new CTemplate();
$tmpl->renderModules('js_top');
$moduleHTML = ob_get_contents();
ob_end_clean();
$html .= $moduleHTML;
// Build the content HTML
//CFactory::load( 'helpers' , 'azrul' );
if (!empty($task) && method_exists($this, $task)) {
ob_start();
if (method_exists($this, '_viewEnabled') && !$this->_viewEnabled()) {
echo property_exists($this, '_disabledMessage') ? $this->_disabledMessage : JText::_('COM_COMMUNITY_CONTROLLER_FUNCTION_DISABLED_WARNING');
} else {
$this->{$task}();
}
$output = ob_get_contents();
ob_end_clean();
} else {
ob_start();
$this->display();
$output = ob_get_contents();
ob_end_clean();
}
// Build toolbar HTML
ob_start();
$view = $this->getView(JString::strtolower($jinput->get('view', 'frontpage', 'STRING')));
// Do not rely on the toolbar to include necessary css or javascripts.
$view->attachHeaders();
// Display the site's toolbar.
$view->showToolbar();
// Header title will use view->title. If not specified, we will
// use current page title
$headerTitle = !empty($view->title) ? $view->title : $document->getTitle();
$view->showHeader($headerTitle, $this->_icon);
$header = ob_get_contents();
ob_end_clean();
$html .= $header;
// @rule: Super admin should always be allowed regardless of their block status
// block member to access profile owner details
//CFactory::load( 'helpers' , 'owner' );
//CFactory::load( 'libraries' , 'block' );
$getBlockStatus = new blockUser();
$blocked = $getBlockStatus->isUserBlocked($userId, $viewName);
if ($blocked) {
if (COwnerHelper::isCommunityAdmin()) {
$mainframe = JFactory::getApplication();
$mainframe->enqueueMessage(JText::_('COM_COMMUNITY_YOU_ARE_BLOCKED_BY_USER', 'error'));
} else {
$tmpl = new CTemplate();
$view->showToolbar();
echo $tmpl->fetch('block.denied');
return;
$block = true;
}
}
// Build the component bottom module
//.........这里部分代码省略.........
示例6: attachHeaders
public function attachHeaders()
{
$document = JFactory::getDocument();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
if ($document->getType() != 'html') {
return;
}
$document = JFactory::getDocument();
$js = '<script type=\'text/javascript\'>';
$js .= '/*<![CDATA[*/';
$js .= 'var js_viewerId = ' . $my->id . '; ';
$js .= 'var js_profileId = ' . $user->id . ';';
$js .= '/*]]>*/';
$js .= '</script>';
$document->addCustomTag($js);
// This need to be loaded so the popups will work correctly in notification window
CFactory::load('libraries', 'window');
CWindow::load();
CFactory::load('libraries', 'minitip');
CMinitip::load();
CFactory::load('libraries', 'template');
CTemplate::addStylesheet('style');
$templateParams = CTemplate::getTemplateParams();
CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme'));
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
$template = new CTemplateHelper();
$styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
$styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
$css = '<!-- Jom Social -->
<!--[if IE 7.0]>
<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
<![endif]-->';
$document->addCustomTag($css);
$css = 'assets/autocomplete.css';
CAssets::attach($css, 'css');
// Required, but added in default template
//$css = 'assets/tipsy-0.1.7/src/stylesheets/tipsy.css';
//CAssets::attach($css, 'css');
// Load joms.ajax
CTemplate::addScript('joms.ajax');
}
示例7: attachHeaders
public function attachHeaders()
{
$document = JFactory::getDocument();
$config = CFactory::getConfig();
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$view = $jinput->request->get('view', '');
$my = CFactory::getUser();
$userid = $jinput->get('userid', '', 'INT');
$user = CFactory::getUser($userid);
if ($document->getType() != 'html') {
return;
}
// Mobile devices flag.
$isMobile = preg_match('/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i', $_SERVER['HTTP_USER_AGENT']);
$isIOS = preg_match('/iphone|ipad|ipod/i', $_SERVER['HTTP_USER_AGENT']);
// Disable zooming on mobile devices.
if ($isMobile) {
$document->setMetaData('viewport', 'width=device-width, initial-scale=1, user-scalable=no');
}
// Output view.
$document->addScriptDeclaration("joms_page = '" . $view . "';");
// IDs.
$document->addScriptDeclaration('joms_my_id = ' . $my->id . ';');
$document->addScriptDeclaration('joms_user_id = ' . $user->id . ';');
// Group's ID.
if ($view === 'groups') {
$groupid = $jinput->get('groupid', '', 'INT');
$group = JTable::getInstance('Group', 'CTable');
$group->load($groupid);
$document->addScriptDeclaration("joms_group_id = +'" . $group->id . "';");
}
// Event's ID.
if ($view === 'events') {
$eventid = $jinput->get('eventid', '', 'INT');
$event = JTable::getInstance('Event', 'CTable');
$event->load($eventid);
$document->addScriptDeclaration("joms_event_id = +'" . $event->id . "';");
}
// Two-factor authentication.
$document->addScriptDeclaration('joms_use_tfa = ' . (CSystemHelper::tfaEnabled() ? 'true' : 'false') . ';');
// Flag to check if we should use native video player.
if ($config->get('video_native') == 1) {
$document->addScriptDeclaration('joms_videoplayer_native = 1;');
}
CTemplate::addStylesheet('style');
$templateParams = CTemplate::getTemplateParams();
CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme', 'green'));
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
// Datepicker style.
$css = 'assets/pickadate/themes/' . ($isMobile ? 'default' : 'classic') . '.combined.css';
CFactory::attach($css, 'css');
// Fluid video on small screen.
$css = '<style type="text/css">video { width: 100% !important; height: auto !important; }</style>';
$document->addCustomTag($css);
//$document->addScript("http://192.168.1.19:8080/target/target-script-min.js#anonymous");
}