本文整理汇总了PHP中CFactory::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::getPath方法的具体用法?PHP CFactory::getPath怎么用?PHP CFactory::getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::getPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addScript
/**
*
* @param type $file
*/
public static function addScript($file)
{
$assetsFile = CFactory::getPath('template://js/' . $file . '.js');
if ($assetsFile) {
$assetsDir = dirname($assetsFile);
} else {
/* This file is not located under template */
$assetsFile = CFactory::getPath('assets://' . $file . '.js');
if ($assetsFile) {
$assetsDir = dirname($assetsFile);
}
}
if (isset($assetsDir)) {
/**
* @todo Update CAssets
*/
CFactory::attach($file . '.js', 'js', CPath::getInstance()->toUrl($assetsDir) . '/');
}
}
示例2: defined
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @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;
$viewName = JRequest::getCmd('view');
$taskName = JRequest::getCmd('task');
require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
$svgPath = CFactory::getPath('template://assets/icon/joms-icon.svg');
include_once $svgPath;
// call the auto refresh on specific page
if ($menuParams != '' && $menuParams->get('show_page_heading') != 0) {
?>
<div class="page-header">
<h3><?php
echo $this->escape($menuParams->get('page_title'));
?>
</h3>
</div>
<?php
}
if ($showToolbar) {
?>
<div class="joms-toolbar">
示例3: 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
//.........这里部分代码省略.........
示例4: getDefault
public static function getDefault($key)
{
/*
* This is where we store our own defaults
* in case the template file is broken or otherwise not available
*/
$defaultSettings = JPATH_ROOT . '/components/com_community/templates/jomsocial/assets/default.' . $key . '.json';
/*
* Attempt to read and parse template settings
*/
$templateSettings = CFactory::getPath('template://assets/default.' . $key . '.json');
jimport('joomla.file');
// If the file exists, and contains parseable JSON data
if (strlen($templateSettings) && JFile::exists($templateSettings)) {
$json = JFile::read($templateSettings);
if (strlen($json)) {
$settings = json_decode($json, true);
}
}
if (!isset($settings) || !is_array($settings)) {
return json_decode(JFile::read($defaultSettings), true);
}
return $settings;
}
示例5: saveCSSFile
/**
* Write compiled css into css file
* @param string $fileName
* @return boolean
*/
public function saveCSSFile($fileName)
{
$templateAssetsDir = CFactory::getPath('template://assets/css');
if ($templateAssetsDir) {
$cssFile = $templateAssetsDir . '/' . $fileName . '.css';
return JFile::write($cssFile, $this->_css);
}
return false;
}
示例6: _init
/**
* Init assets
* @param type $name
*/
public function _init($name)
{
$document = JFactory::getDocument();
if ($document->getType() == 'html') {
$document->addScriptDeclaration("joms_base_url = '" . JURI::root() . "';");
$document->addScriptDeclaration("joms_assets_url = '" . JURI::root(true) . "/components/com_community/assets/';");
// Legacy script relative path.
$document->addScriptDeclaration("joms_script_url = '" . JURI::root(true) . "/components/com_community/assets/_release/js/';");
// Language translation.
$this->_loadLanguageTranslation();
}
// $this->attach('assets/joms.jquery-1.8.1.min.js', 'js');
// $this->attach('assets/script-1.2.js', 'js');
/* Assets init */
$assetFile = CFactory::getPath('assets://default.json');
if ($assetFile) {
$assets = json_decode(file_get_contents($assetFile));
foreach ($assets->core->css as $css) {
$cssFile = CFactory::getPath('assets://' . $css . '.css');
if ($cssFile) {
$this->attach(JFile::getName($css) . '.css', 'css', CPath::getInstance()->toUrl(dirname($cssFile)) . '/');
}
}
foreach ($assets->core->js as $js) {
$jsFile = CFactory::getPath('assets://' . $js . '.js');
if ($jsFile) {
$this->attach(JFile::getName($js) . '.js', 'js', CPath::getInstance()->toUrl(dirname($jsFile)) . '/');
}
}
}
if (JFactory::getApplication()->isSite()) {
/* Template init */
$lang = JFactory::getLanguage();
$templateFile = CFactory::getPath('template://assets/' . $name . '.json');
if ($templateFile) {
$assets = json_decode(file_get_contents($templateFile));
/* Load template core files */
foreach ($assets->core->css as $css) {
$cssFile = CFactory::getPath('template://assets/css/' . $css . '.css');
if ($cssFile) {
$this->attach(JFile::getName($css) . '.css', 'css', CPath::getInstance()->toUrl(dirname($cssFile)) . '/');
}
}
foreach ($assets->core->js as $js) {
$jsFile = CFactory::getPath('template://assets/js/' . $js . '.js');
if ($jsFile) {
$this->attach(JFile::getName($js) . '.js', 'js', CPath::getInstance()->toUrl(dirname($jsFile)) . '/');
}
}
/* Load template view files */
$view = JFactory::getApplication()->input->getWord('view');
if (isset($assets->views->{$view})) {
if (isset($assets->views->{$view}->css)) {
foreach ($assets->views->{$view}->css as $css) {
$cssFile = CFactory::getPath('template://assets/css/view.' . $css . '.css');
if ($cssFile) {
$this->attach('view.' . JFile::getName($css) . '.css', 'css', CPath::getInstance()->toUrl(dirname($cssFile)) . '/');
}
}
}
}
if (isset($assets->views->{$view})) {
if (isset($assets->views->{$view}->js)) {
foreach ($assets->views->{$view}->js as $js) {
$jsFile = CFactory::getPath('template://assets/js/view.' . $js . '.js');
if ($jsFile) {
$this->attach('view.' . JFile::getName($js) . '.js', 'js', CPath::getInstance()->toUrl(dirname($jsFile)) . '/');
}
}
}
}
}
}
}
示例7: getToolbar
/**
* Displays the toolbar of JomSocial
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getToolbar()
{
if (!$this->config->get('integrations_jomsocial_toolbar')) {
return;
}
// Allow third party to control the toolbar
$displayToolbar = $this->input->get('showJomsocialToolbar', true);
$format = $this->input->get('format', '', 'word');
$tmpl = $this->input->get('tmpl', '', 'word');
if ($format == 'pdf' || $format == 'phocapdf' || $tmpl == 'component' || !$displayToolbar) {
return;
}
// Ensure that JomSocial exists
if (!$this->exists()) {
return;
}
// Ensure the library really exists on the site.
if (!class_exists('CToolbarLibrary') || !method_exists('CToolbarLibrary', 'getInstance')) {
return;
}
$svg = '';
if (method_exists('CFactory', 'getPath')) {
$svg = CFactory::getPath('template://assets/icon/joms-icon.svg');
}
// Load up the apps
$appsLib = CAppPlugins::getInstance();
$appsLib->loadApplications();
$appsLib->triggerEvent('onSystemStart', array());
// Get the toolbar library
$toolbar = CToolbarLibrary::getInstance();
$theme = EB::template();
$theme->set('svg', $svg);
$theme->set('toolbar', $toolbar);
$contents = $theme->output('site/toolbar/toolbar.jomsocial');
return $contents;
}