本文整理汇总了PHP中CFactory::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::attach方法的具体用法?PHP CFactory::attach怎么用?PHP CFactory::attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::attach方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Load messaging javascript header
*/
public static function load()
{
static $loaded = false;
if (!$loaded) {
$config = CFactory::getConfig();
require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
$js = 'assets/minitip-1.0.js';
CFactory::attach($js, 'js');
$css = 'assets/minitip.css';
CFactory::attach($css, 'css');
}
}
示例2: load
/**
* Load messaging javascript header
*/
public function load()
{
if (!defined('CMESSAGING_LOADED')) {
$config = CFactory::getConfig();
include_once JPATH_ROOT . '/components/com_community/libraries/core.php';
// $js = 'assets/window-1.0.min.js';
// CFactory::attach($js, 'js');
// $css = 'assets/window.css';
// CFactory::attach($css, 'css');
$css = 'templates/' . $config->get('template') . '/css/style.css';
CFactory::attach($css, 'css');
}
}
示例3: 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;
CFactory::attach('assets/easytabs/jquery.easytabs.min.js', 'js');
if ($guests) {
?>
<div id="notice"></div>
<ul class="cIndexList forEventGuest cResetList">
<?php
foreach ($guests as $guest) {
?>
<li id="member_<?php
echo $guest->id;
?>
">
<div class="cIndex-Box clearfix">
<a href="<?php
echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $guest->id);
?>
" class="cIndex-Avatar cFloat-L">
<img class="cAvatar" src="<?php
echo $guest->getThumbAvatar();
示例4: 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) . '/');
}
}
示例5: photo
/**
* Displays single photo view
*
**/
public function photo()
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
// Load window library
//CFactory::load( 'libraries' , 'window' );
CWindow::load();
// Get the configuration object.
$config = CFactory::getConfig();
$css = JURI::root(true) . '/components/com_community/assets/photos.css';
$document->addStyleSheet($css);
$js = 'assets/gallery.min.js';
CFactory::attach($js, 'js');
$albumId = $jinput->get->get('albumid', '', 'INT');
//JRequest::getVar('albumid' , '' , 'GET');
if (empty($albumId)) {
echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR');
return;
}
//CFactory::load( 'models' , 'photos' );
// Load the album table
$album = JTable::getInstance('Album', 'CTable');
$album->load($albumId);
if ($album->type == PHOTOS_GROUP_TYPE) {
$this->_groupPhoto();
} else {
$this->_userPhoto();
}
}
示例6: cShowCarousel
function cShowCarousel($id, $total, $jaxCall)
{
static $carouselCustomTag = null;
if (!$carouselCustomTag) {
CFactory::attach('templates/default/carousel.css', 'css');
CFactory::attach('assets/carousel-1.0.js', 'js');
$carouselCustomTag = true;
}
ob_start();
?>
<div class="carousel-container" id="<?php
echo $id;
?>
">
<a class="carousel-prev" href="javascript:void(0)" onclick="this.blur();cCarouselPrev('<?php
echo $id;
?>
', '<?php
echo $jaxCall;
?>
');joms.jQuery(this).trigger('onblur');">« Prev</a>
<a class="carousel-next" href="javascript:void(0)" onclick="this.blur();cCarouselNext('<?php
echo $id;
?>
', '<?php
echo $jaxCall;
?>
');joms.jQuery(this).trigger('onblur');">Next »</a>
<div class="carousel-content">
<div class="carousel-content-wrap" style="display: block;">
<div class="carousel-content-clip">
<ul class="carousel-list" style="width: 1600px; left: 0pt;margin:0px">
<?php
for ($i = 0; $i < $total; $i++) {
?>
<li class="carousel-item" id="<?php
echo $id;
?>
-item-<?php
echo $i;
?>
"><div class="ajax-wait"> </div></li>
<?php
}
?>
</ul>
</div>
</div>
</div>
</div>
<script type='text/javascript'>
cCarouselInit('<?php
echo $id;
?>
', '<?php
echo $jaxCall;
?>
');
</script>
<?php
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例7:
<!--[if IE 6]><?php
CFactory::attach('assets/featuredslider/sliderkit-ie6.css', 'css');
?>
<![endif]-->
<!--[if IE 7]><?php
CFactory::attach('assets/featuredslider/sliderkit-ie7.css', 'css');
?>
<![endif]-->
<!--[if IE 8]><?php
CFactory::attach('assets/featuredslider/sliderkit-ie8.css', 'css');
?>
<![endif]-->
<!-- Slider Kit scripts -->
<?php
CFactory::attach('assets/featuredslider/sliderkit/jquery.sliderkit.1.8.js', 'js');
?>
<!-- Slider Kit launch -->
<script type="text/javascript">
joms.jQuery(window).load(function(){
<?php
if ($jinput->get('limitstart') != "" || $jinput->get('sort') != "" || $jinput->get('catid') != "") {
?>
var target_offset = joms.jQuery("#lists").offset();
var target_top = target_offset.top;
joms.jQuery('html, body').animate({scrollTop:target_top}, 200);
<?php
}
?>
示例8: getAutoSuggestInput
/**
* Function to add input text box with auto user suggest option.
* param - fieldId : string - id of the input box
* - $hiddenField : boolean - set true for for a hidden input text that will store the userid
* - $hiddenFieldId : string - id of the hidden input box*
* - width : int - specify a custom width for the input box
* - minChar : int - minimum character for performing auto suggest
* - delay : int - delay before getting suggestion from database, milisecond
* - cacheLength : int - amount to cache, set to 1 if no cache is needed
*/
function getAutoSuggestInput($fieldId = 'autoSuggestUserName', $hiddenField = false, $hiddenFieldId = 'autoSuggestUserId', $width = 200, $minChar = 3, $delay = 400, $cacheLength = 10)
{
$js = 'assets/autocomplete-1.0.js';
CFactory::attach($js, 'js');
$onClickAction = !empty($hiddenField) ? "onclick=\"joms.jQuery(\\'#{$hiddenFieldId}\\').val('+data[1]+');\"" : "";
$autoCLink = CRoute::_('index.php?option=com_community&view=autousersuggest&task=ajaxAutoUserSuggest&no_html=1&tmpl=component');
$js = <<<SHOWJS
\t\tjoms.jQuery().ready(function(){
\t\t\tjoms.jQuery("#{$fieldId}").autocomplete("{$autoCLink}", {
\t\t\t\tminChars:{$minChar},
\t\t\t\tmatchSubset:1,
\t\t\t\tdelay: 200,
\t\t\t\tcacheLength:{$cacheLength},
\t\t\t\tmultiple:false,
\t\t\t\tformatItem: function(data, i, n, value) {
\t\treturn '<div {$onClickAction}><div style="vertical-align: middle; display: inline; width: 45px; float: left;"><img src="'+data[2]+'" width="30" height="30"/></div><div style="vertical-align: middle; line-height: 25px;">'+data[0]+'</div></div>';
\t\t},
\t\tformatResult: function(data, value) {
\t\treturn data[0];
\t\t\t\t}
\t\t\t});
\t\t\tjoms.jQuery("#{$fieldId}").result(function(event, data, formatted) {
\t\t\t\t\tif (data)
\t\t\t\t\t\tjoms.jQuery("#{$hiddenFieldId}").val(data[1]);
\t\t\t});
\t\t\tjoms.jQuery("#{$fieldId}").val('');
\t\t\tjoms.jQuery("#{$hiddenFieldId}").val('');
\t\t});
SHOWJS;
$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
$content = '';
ob_start();
?>
<input name="<?php
echo $fieldId;
?>
" id="<?php
echo $fieldId;
?>
" type="text" value="" autocomplete="off" style="width: <?php
echo $width;
?>
px;"/>
<?php
if (!empty($hiddenField)) {
?>
<input name="<?php
echo $hiddenFieldId;
?>
" id="<?php
echo $hiddenFieldId;
?>
" type="hidden" value=""/>
<?php
}
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例9: defined
/**
* @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;
CFactory::attach('assets/easytabs/jquery.easytabs.min.js', 'js');
CFactory::attach('assets/ajaxfileupload.pack.js', 'js');
CFactory::attach('assets/imgareaselect/scripts/jquery.imgareaselect.min.js', 'js');
CFactory::attach('assets/imgareaselect/css/imgareaselect-avatar.css', 'css');
CFactory::attach('assets/jqueryui/drag/jquery-ui-drag.js', 'js');
CFactory::attach('assets/jqueryui/drag/jquery.ui.touch-punch.min.js', 'js');
?>
<div class="js-focus">
<div class="js-focus-cover">
<img id='<?php
echo $group->id;
?>
' data-cover-context="group" class="focusbox-image cover-image" src="<?php
echo $group->getCover();
?>
" alt="cover photo" style="top:<?php
echo $group->coverPostion;
?>
">
<div class="js-focus-gradient" data-cover-context="group" data-cover-type="cover"></div>
示例10: 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");
}
示例11:
CFactory::attach('assets/featuredslider/sliderkit-ie6.css', 'css');
?>
<![endif]-->
<!--[if IE 7]><?php
CFactory::attach('assets/featuredslider/sliderkit-ie7.css', 'css');
?>
<![endif]-->
<!--[if IE 8]><?php
CFactory::attach('assets/featuredslider/sliderkit-ie8.css', 'css');
?>
<![endif]-->
<!-- Slider Kit scripts -->
<?php
CFactory::attach('assets/featuredslider/sliderkit/jquery.sliderkit.1.8.js', 'js');
CFactory::attach('assets/joms.jomSelect.js', 'js');
?>
<!-- Slider Kit launch -->
<script type="text/javascript">
joms.jQuery(window).load(function(){
<?php
if ($jinput->get('limitstart') != "" || $jinput->get('sort') != "" || $jinput->get('categoryid') != "") {
?>
if(joms.jQuery("#lists").length){
var target_offset = joms.jQuery("#lists").offset();
var target_top = target_offset.top;
joms.jQuery('html, body').animate({scrollTop:target_top}, 200);
}
<?php
示例12:
CFactory::attach('assets/featuredslider/sliderkit-ie7.css', 'css');
?>
<![endif]-->
<!--[if IE 8]><?php
CFactory::attach('assets/featuredslider/sliderkit-ie8.css', 'css');
?>
<![endif]-->
<!-- Slider Kit scripts -->
<?php
CFactory::attach('assets/featuredslider/sliderkit/jquery.sliderkit.1.8.js', 'js');
CFactory::attach('assets/imgareaselect/scripts/jquery.imgareaselect.min.js', 'js');
CFactory::attach('assets/imgareaselect/css/imgareaselect-default.css', 'css');
CFactory::attach('assets/autocomplete/jquery.autocomplete.min.js', 'js');
CFactory::attach('assets/easytabs/jquery.easytabs.min.js', 'js');
CFactory::attach('assets/jquery.cj-swipe.min.js', 'js');
?>
<!-- Slider Kit launch -->
<script type="text/javascript">
joms.jQuery(window).load(function(){
joms.jQuery(".single-photo").sliderkit({
shownavitems:7,
scroll:5,
// set auto to true to autoscroll
auto:false,
mousewheel:true,
circular:true,
scrollspeed:500,
autospeed:10000,
start:0
示例13: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_kunena', JPATH_ADMINISTRATOR);
$files = JPATH_ROOT . '/components/com_kunena/class.kunena.php';
// for the newest kunena version
$files2 = JPATH_ROOT . '/components/com_kunena/kunena.php';
if (JFile::exists($files) || JFile::exists($files2)) {
$config = CFactory::getConfig();
/*
if (!$config->get('enablegroups')) {
return JText::_('PLG_KUNENA_GROUP_DISABLED');
}*/
$uri = JURI::base();
$document = JFactory::getDocument();
// Attach CSS
//$css = JURI::base() . 'plugins/community/kunena/style.css';
//$document->addStyleSheet($css);
$css = 'plugins/community/kunena/kunena/';
CFactory::attach('style.css', 'css', $css);
//CFactory::load('helpers', 'time');
$groupsModel = CFactory::getModel('groups');
$avatarModel = CFactory::getModel('avatar');
$user = CFactory::getRequestUser();
$userName = $user->getDisplayName();
$groups = $groupsModel->getGroups($user->id);
$my = JFactory::getUser();
$username = $this->params->get('username');
$password = $this->params->get('password');
$db = JFactory::getDBO();
// Get forum user info:
$sql = 'SELECT a.*, b.* FROM ' . $db->quoteName('#__' . $this->db_prefix . '_users') . ' as a ' . 'LEFT JOIN ' . $db->quoteName('#__users') . ' AS b on b.' . $db->quoteName('id') . '=a.' . $db->quoteName('userid') . 'WHERE a.' . $db->quoteName('userid') . '=' . $db->Quote($user->id);
$db->setQuery($sql);
$userinfo = $db->loadObject();
if ($userinfo) {
$usr_info = 1;
//print_r($userinfo);
$maxPost = intval($userinfo->posts);
// Get latest forum topics
// Search only within allowed group
$query = 'SELECT b.' . $db->quoteName('group_id') . ' as gid' . ' FROM ' . $db->quoteName('#__users') . ' as a, ' . $db->quoteName('#__user_usergroup_map') . ' as b' . ' WHERE a.' . $db->quoteName('id') . '= b.' . $db->quoteName('user_id') . ' AND a.' . $db->quoteName('id') . '=' . $db->Quote($my->id);
$db->setQuery($query);
$db->query();
$dse_groupid = $db->loadObjectList();
if (count($dse_groupid)) {
$group_id = $dse_groupid[0]->gid;
} else {
$group_id = 0;
}
$maxCount = $this->params->get('count', 5);
$query = 'SELECT a.* , b.' . $db->quoteName('id') . ' as category, b.' . $db->quoteName('name') . ' as catname, c.' . $db->quoteName('hits') . ' AS threadhits' . ' FROM ' . $db->quoteName('#__' . $this->db_prefix . '_messages') . ' AS a, ' . $db->quoteName('#__' . $this->db_prefix . '_categories') . ' AS b, ' . $db->quoteName('#__' . $this->db_prefix . '_messages') . ' AS c, ' . $db->quoteName('#__' . $this->db_prefix . '_messages_text') . ' AS d' . ' WHERE a.' . $db->quoteName('catid') . ' = b.' . $db->quoteName('id') . ' AND a.' . $db->quoteName('thread') . ' = c.' . $db->quoteName('id') . ' AND a.' . $db->quoteName('id') . ' = d.' . $db->quoteName('mesid') . ' AND a.' . $db->quoteName('hold') . ' = ' . $db->Quote('0') . ' AND b.' . $db->quoteName('published') . ' = ' . $db->Quote('1') . ' AND a.' . $db->quoteName('userid') . ' =' . $db->Quote($user->id) . ' AND (b.' . $db->quoteName('pub_access') . ' <=' . $db->Quote($group_id) . ')' . ' ORDER BY ' . $db->quoteName('time') . ' DESC' . ' LIMIT 0, ' . $maxCount;
$db->setQuery($query);
$items = $db->loadObjectList();
} else {
$usr_info = 0;
$userId = "";
$userName = "";
$items = "";
}
$fbItemid = '&Itemid=' . $this->getItemid();
$mainframe = JFactory::getApplication();
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityKunena');
$cache->setCaching($caching);
$callback = array('plgCommunityKunena', '_getKunenaHTML');
$content = $cache->call($callback, $usr_info, $user->id, $userName, $items, $fbItemid);
} else {
//$content = "<div class=\"icon-nopost\"><img src='".JURI::base()."components/com_community/assets/error.gif' alt=\"\" /></div>";
//$content .= "<div class=\"content-nopost\" style=\"height:100%;\">".JText::_('PLG_KUNENA_NOT_INSTALLED')."</div>";
$content = "<div>" . JText::_('PLG_KUNENA_NOT_INSTALLED') . "</div>";
}
return $content;
}
示例14: updateProfile
/**
* Once a user changed their profile, request them to update their profile
* */
public function updateProfile()
{
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE'));
$profileType = JRequest::getVar('profileType', '');
$my = CFactory::getUser();
$this->addPathway(JText::_('COM_COMMUNITY_PROFILE'), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
$this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_CHANGE_TYPE'), CRoute::_('index.php?option=com_community&view=multiprofile&task=changeprofile'));
$this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE'));
$model = CFactory::getModel('profile');
$profileType = JRequest::getVar('profileType', 0);
// Get all published custom field for profile
$filter = array('published' => '1', 'registration' => '1');
// $fields = $model->getAllFields( $filter , $profileType );
$result = $model->getEditableProfile($my->id, $profileType);
$empty_html = array();
$post = JRequest::get('post');
// Bind result from previous post into the field object
if (!empty($post)) {
foreach ($fields as $group) {
$field = $group->fields;
for ($i = 0; $i < count($field); $i++) {
$fieldid = $field[$i]->id;
$fieldType = $field[$i]->type;
if (!empty($post['field' . $fieldid])) {
if (is_array($post['field' . $fieldid])) {
if ($fieldType != 'date') {
$values = $post['field' . $fieldid];
$value = '';
foreach ($values as $listValue) {
$value .= $listValue . ',';
}
$field[$i]->value = $value;
} else {
$field[$i]->value = $post['field' . $fieldid];
}
} else {
$field[$i]->value = $post['field' . $fieldid];
}
}
}
}
}
$js = 'assets/validate-1.5.min.js';
CFactory::attach($js, 'js');
$profileType = JRequest::getVar('profileType', 0, 'GET');
//CFactory::load( 'libraries' , 'profile' );
$tmpl = new CTemplate();
echo $tmpl->set('fields', $result['fields'])->set('profileType', $profileType)->fetch('multiprofile.update');
}