本文整理汇总了PHP中JFactory::getDocument方法的典型用法代码示例。如果您正苦于以下问题:PHP JFactory::getDocument方法的具体用法?PHP JFactory::getDocument怎么用?PHP JFactory::getDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFactory
的用法示例。
在下文中一共展示了JFactory::getDocument方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchButton
function fetchButton($type = 'Acyactions')
{
$url = JURI::base() . "index.php?option=com_acymailing&ctrl=filter&tmpl=component";
$top = 0;
$left = 0;
$width = 700;
$height = 500;
$text = JText::_('ACTIONS');
if (!ACYMAILING_J30) {
$class = "icon-32-acyaction";
} else {
$class = "icon-14-acyaction";
}
$js = "\r\nfunction getAcyActionUrl() {\r\n\ti = 0;\r\n\tmylink = 'index.php?option=com_acymailing&ctrl=filter&tmpl=component&subid=';\r\n\twhile(window.document.getElementById('cb'+i)){\r\n\t\tif(window.document.getElementById('cb'+i).checked)\r\n\t\t\tmylink += window.document.getElementById('cb'+i).value+',';\r\n\t\ti++;\r\n\t}\r\n\treturn mylink;\r\n}\r\n";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
if (!ACYMAILING_J30) {
JHTML::_('behavior.modal', 'a.modal');
return '<a href="' . $url . '" class="modal" onclick="this.href=getAcyActionUrl();" rel="{handler: \'iframe\', size: {x: ' . $width . ', y: ' . $height . '}}"><span class="' . $class . '" title="' . $text . '"></span>' . $text . '</a>';
}
$html = '<button class="btn btn-small modal" data-toggle="modal" data-target="#modal-' . $type . '"><i class="' . $class . '"></i> ' . $text . '</button>';
$params['title'] = $text;
$params['url'] = '\'+getAcyActionUrl()+\'';
//$url;
$params['height'] = $height;
$params['width'] = $width;
$modalHtml = JHtml::_('bootstrap.renderModal', 'modal-' . $type, $params);
$html .= str_replace(array('id="modal-' . $type . '"'), array('id="modal-' . $type . '" style="width:' . ($width + 20) . 'px;height:' . ($height + 90) . 'px;margin-left:-' . ($width + 20) / 2 . 'px"'), $modalHtml);
$html .= '<script>' . "\r\n" . 'jQuery(document).ready(function(){jQuery("#modal-' . $type . '").appendTo(jQuery(document.body));});' . "\r\n" . '</script>';
return $html;
}
示例2: display
function display($tpl = null)
{
JToolBarHelper::title(JText::_('COM_REDSOCIALSTREAM_CONFIGURE'), 'configure.png');
JToolBarHelper::apply();
JToolBarHelper::cancel('cancel', 'COM_REDSOCIALSTREAM_CLOSE');
//DEVNOTE: set document title
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_REDSOCIALSTREAM_REDSOCIALSTREAMS'));
$mainframe = JFactory::getApplication();
$context = "config";
$model = $this->getModel('configure');
$db = JFactory::getDbo();
$q = "SELECT * FROM #__redsocialstream_settings";
$db->setQuery($q);
$this->settingsrows = $db->loadObjectList();
$typelist = $this->get('type_list_sorted');
$pagination = $this->get('Pagination');
//DEVNOTE:give me ordering from request
$filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'ordering');
$filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '');
$this->assignRef('lists', $lists);
$this->assignRef("typelist", $typelist);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
示例3: onAfterRoute
public function onAfterRoute()
{
$app = JFactory::getApplication();
if($app->isAdmin()){
return;
}
$menus = $app->getMenu('site');
$menu = $menus->getActive();
if(!$menu || $menu->home != 1) return;
$doc = JFactory::getDocument();
if($doc->getType() != 'html') return;
$params = JComponentHelper::getParams('com_xmlrpc');
if($params->get('show_rsd', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getRsdRoute());
$doc->addHeadLink($link, 'EditURI', 'rel', array('type' => 'application/rsd+xml', 'title'=>'RSD'));
}
if($params->get('show_manifest', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getManifestRoute());
$doc->addHeadLink($link, 'wlwmanifest', 'rel', array('type'=>'application/wlwmanifest+xml'));
}
}
示例4: fetchHead
public static function fetchHead($params, $module)
{
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$template = $mainframe->getTemplate();
JHTML::_('behavior.framework');
$language = JFactory::getLanguage();
$mapApi = 'http://maps.google.com/maps/api/js?sensor=true&language=' . $language->getTag();
if ($params->get('weather')) {
$mapApi .= '&libraries=weather';
}
$document->addScript($mapApi);
if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/js/default.js')) {
$document->addScript(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/js/default.js');
} else {
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/btbase64.min.js');
if ($params->get('enable-custom-infobox')) {
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/infobox.js');
}
$document->addScript(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/js/default.js');
}
if (file_exists(JPATH_BASE . '/templates/' . $template . '/html/mod_bt_googlemaps/css/styles.css')) {
$document->addStyleSheet(JURI::root() . 'templates/' . $template . '/html/mod_bt_googlemaps/css/style.css');
} else {
$document->addStyleSheet(JURI::root() . 'modules/mod_bt_googlemaps/tmpl/css/style.css');
}
}
示例5: getInput
protected function getInput()
{
JHTML::_('behavior.framework');
$document =& JFactory::getDocument();
if (!version_compare(JVERSION, '3.0', 'ge')) {
$checkJqueryLoaded = false;
$header = $document->getHeadData();
foreach ($header['scripts'] as $scriptName => $scriptData) {
if (substr_count($scriptName, '/jquery')) {
$checkJqueryLoaded = true;
}
}
//Add js
if (!$checkJqueryLoaded) {
$document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.min.js');
}
$document->addScript(JURI::root() . $this->element['path'] . 'js/chosen.jquery.min.js');
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/chosen.css');
}
$document->addScript(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/jquery.lightbox-0.5.min.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/btbase64.min.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/bt.js');
$document->addScript(JURI::root() . $this->element['path'] . 'js/script.js');
//Add css
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/bt.css');
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'js/colorpicker/colorpicker.css');
$document->addStyleSheet(JURI::root() . $this->element['path'] . 'css/jquery.lightbox-0.5.css');
return null;
}
示例6: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
JHtml::_('jquery.framework');
$itemid = JFactory::getApplication()->input->getInt('id', 0);
$document = JFactory::getDocument();
$document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP');
$html = '<div
id="' . $this->id . '"
class="form-horizontal customfield"
data-fieldname="' . $this->fieldname . '"
data-controller="' . $this->element['controller'] . '"
data-itemid="' . $itemid . '">
<div class="form-container"></div>
<img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" />
<div class="control-group">
<div class="controls">
<button class="btn btn-primary btn-reload"><span class="icon-refresh"></span> ' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button>
</div>
</div>
</div>';
return $html;
}
示例7: display
function display($dummy1 = false, $dummy2 = false)
{
$moduleId = JRequest::getInt('formid');
if (empty($moduleId)) {
return;
}
if (JRequest::getInt('interval') > 0) {
setcookie('acymailingSubscriptionState', true, time() + JRequest::getInt('interval'), '/');
}
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM #__modules WHERE id = ' . intval($moduleId) . ' AND `module` LIKE \'%acymailing%\' LIMIT 1');
$module = $db->loadObject();
if (empty($module)) {
echo 'No module found';
exit;
}
$module->user = substr($module->module, 0, 4) == 'mod_' ? 0 : 1;
$module->name = $module->user ? $module->title : substr($module->module, 4);
$module->style = null;
$module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module);
$params = array();
if (JRequest::getInt('autofocus', 0)) {
acymailing_loadMootools();
$js = "\n\t\t\t\twindow = addEvent('load', function(){\n\t\t\t\t\tthis.focus();\n\t\t\t\t\tvar moduleInputs = document.getElementsByTagName('input');\n\t\t\t\t\tif(moduleInputs){\n\t\t\t\t\t\tvar i = 0;\n\t\t\t\t\t\twhile(moduleInputs[i].disabled == true){\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(moduleInputs[i]) moduleInputs[i].focus();\n\t\t\t\t\t}\n\t\t\t\t});";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
}
echo JModuleHelper::renderModule($module, $params);
}
示例8: tag
function tag()
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
JPluginHelper::importPlugin('acymailing');
$dispatcher = JDispatcher::getInstance();
$tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
$defaultFamily = reset($tagsfamilies);
$app = JFactory::getApplication();
$fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
ob_start();
$defaultContents = $dispatcher->trigger($fctplug);
$defaultContent = ob_get_clean();
$js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
$js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
$js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
$js .= 'function hideTagButton(){}';
$js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
$doc->addScriptDeclaration($js);
$this->assignRef('fctplug', $fctplug);
$type = JRequest::getString('type', 'news');
$this->assignRef('type', $type);
$this->assignRef('defaultContent', $defaultContent);
$this->assignRef('tagsfamilies', $tagsfamilies);
$app = JFactory::getApplication();
$this->assignRef('app', $app);
$ctrl = JRequest::getString('ctrl');
$this->assignRef('ctrl', $ctrl);
}
示例9: getInput
function getInput($name, $id, $value, $params, $children, $j15 = 0)
{
$this->params = $params;
JHTML::_('behavior.modal', 'a.modal');
$_size = $this->def('size');
$_multiple = $this->def('multiple', 1);
$_doc =& JFactory::getDocument();
$_js = "\n\t\t\tfunction jSelectArticle( id, title, object )\n\t\t\t{\n\t\t\t\tif ( document.getElementById(object+'_name') ) {\n\t\t\t\t\tdocument.getElementById(object+'_id').value = id;\n\t\t\t\t\tdocument.getElementById(object+'_name').value = title;\n\t\t\t\t} else {\n\t\t\t\t\t// multiple\n\t\t\t\t\tdocument.getElementById(object+'_id').value = document.getElementById(object+'_id').value.trim();\n\t\t\t\t\tif ( document.getElementById(object+'_id').value ) {\n\t\t\t\t\t\t document.getElementById(object+'_id').value += ',';\n\t\t\t\t\t}\n\t\t\t\t\tdocument.getElementById(object+'_id').value += id;\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('sbox-window').close();\n\t\t\t}";
$_doc->addScriptDeclaration($_js);
$_link = 'index.php?option=com_content&task=element&tmpl=component&object=' . $id;
$html = "\n" . '<div style="float: left;">';
if (!$_multiple) {
$val_name = $value;
if ($value) {
$db =& JFactory::getDBO();
// load the list of menu types
$query = 'SELECT title' . ' FROM #__content' . ' WHERE id = ' . $value . ' LIMIT 1';
$db->setQuery($query);
$val_name = $db->loadResult();
$val_name .= ' [' . $value . ']';
}
$html .= '<input type="text" id="' . $id . '_name" value="' . $val_name . '" class="inputbox" size="' . $_size . '" disabled="disabled" />';
$html .= '<input type="hidden" name="' . $name . '" id="' . $id . '_id" value="' . $value . '" />';
} else {
$html .= '<input type="text" name="' . $name . '" id="' . $id . '_id" value="' . $value . '" class="inputbox" size="' . $_size . '" />';
}
$html .= '</div>';
$html .= '<div class="button2-left"><div class="blank"><a class="modal" title="' . JText::_('NN_SELECT_AN_ARTICLE') . '" href="' . $_link . '" rel="{handler: \'iframe\', size: {x: 650, y: 375}}">' . JText::_('NN_SELECT') . '</a></div></div>' . "\n";
return $html;
}
示例10: _initDefaultPage
private function _initDefaultPage()
{
$document = JFactory::getDocument();
$document->addCustomTag('<link href="' . JURI::root(true) . '/media/cbcc/js/jstree/themes/default/style.css" rel="stylesheet" />');
$document->addScript(JURI::root(true) . '/media/jui/js/jquery.min.js');
$document->addScript(JURI::root(true) . '/media/cbcc/js/jstree/jquery.jstree.js');
}
示例11: display
function display($tpl = null)
{
$entry = $this->get('Data');
$characters_length = $this->get('CharactersLength');
$robots_array = array('', 'index, follow', 'noindex, follow', 'index, nofollow', 'noindex, nofollow');
if (empty($entry->id)) {
JToolBarHelper::title(JText::_('COM_EASYFRONTENDSEO') . ' - ' . JText::_('COM_EASYFRONTENDSEO_NEWENTRY'), 'easyfrontendseo-add');
JToolBarHelper::save('save');
JToolBarHelper::cancel('cancel');
} else {
JToolBarHelper::title(JText::_('COM_EASYFRONTENDSEO') . ' - ' . JText::_('COM_EASYFRONTENDSEO_EDITENTRY'), 'easyfrontendseo-edit');
JToolbarHelper::apply('apply');
JToolBarHelper::save('save');
JToolBarHelper::cancel('cancel', 'Close');
}
JHTML::_('behavior.framework');
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_easyfrontendseo/css/easyfrontendseo.css');
$document->addScript('components/com_easyfrontendseo/js/wordcount.js', 'text/javascript');
$output = "window.addEvent('domready', function(){";
$output .= "new WordCount('counter_title', {inputName:'title', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'}); new WordCount('counter_title', {inputName:'title', eventTrigger: 'click', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'});\n";
$output .= "new WordCount('counter_description', {inputName:'description', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'}); new WordCount('counter_description', {inputName:'description', eventTrigger: 'click', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'});\n";
$output .= "new WordCount('counter_keywords', {inputName:'keywords', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'}); new WordCount('counter_keywords', {inputName:'keywords', eventTrigger: 'click', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'});\n";
$output .= "new WordCount('counter_generator', {inputName:'generator', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'}); new WordCount('counter_generator', {inputName:'generator', eventTrigger: 'click', wordText:'" . JText::_('COM_EASYFRONTENDSEO_WORDS') . "', charText:'" . JText::_('COM_EASYFRONTENDSEO_CHARACTERS') . "'});\n";
$output .= " });";
$document->addScriptDeclaration($output, 'text/javascript');
$this->entry = $entry;
$this->characters_length = $characters_length;
$this->robots_array = $robots_array;
// Get donation code message
require_once JPATH_COMPONENT . '/helpers/easyfrontendseo.php';
$donation_code_message = EasyFrontendSeoHelper::getDonationCodeMessage();
$this->donation_code_message = $donation_code_message;
parent::display($tpl);
}
示例12: title
/**
* Render the action bar title
*
* @param array $config An optional array with configuration options
* @return string Html
*/
public function title($config = array())
{
$config = new KObjectConfigJson($config);
$config->append(array('command' => NULL));
$title = $this->getObject('translator')->translate($config->command->title);
$icon = $config->command->icon;
$html = '';
if (!empty($title)) {
if (JFactory::getApplication()->isAdmin() && version_compare(JVERSION, '3.2', 'ge')) {
$layout = new JLayoutFile('joomla.toolbar.title');
$html = $layout->render(array('title' => $title, 'icon' => $icon));
} elseif ($this->_useBootstrap()) {
// Strip the extension.
$icons = explode(' ', $icon);
foreach ($icons as &$icon) {
$icon = 'pagetitle--' . preg_replace('#\\.[^.]*$#', '', $icon);
}
$html = '<div class="pagetitle ' . htmlspecialchars(implode(' ', $icons)) . '"><h2>' . $title . '</h2></div>';
} else {
$html = '<div class="header pagetitle icon-48-' . $icon . '">';
$html .= '<h2>' . $title . '</h2>';
$html .= '</div>';
}
if (JFactory::getApplication()->isAdmin()) {
$app = JFactory::getApplication();
$app->JComponentTitle = $html;
$html = '';
JFactory::getDocument()->setTitle($app->getCfg('sitename') . ' - ' . JText::_('JADMINISTRATION') . ' - ' . $title);
}
}
return $html;
}
示例13: onDisplay
/**
* Display the button
*
* @return array A four element array of (article_id, article_title, category_id, object)
*/
function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectArticle when an article is clicked
* jSelectArticle creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "\n\t\tfunction jSelectArticle(id, title, catid, object) {\n\t\t\tvar tag = '<a href='+'\"index.php?option=com_content&view=article&catid='+catid+'&id='+id+'\">'+title+'</a>';\n\t\t\tjInsertEditorText(tag, '" . $name . "');\n\t\t\tSqueezeBox.close();\n\t\t}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
JHtml::_('behavior.modal');
/*
* Use the built-in element view to select the article.
* Currently uses blank class.
*/
$link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component';
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('PLG_ARTICLE_BUTTON_ARTICLE'));
$button->set('name', 'article');
$button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
return $button;
}
示例14: bootstrap
/**
* This renders the necessary bootstrap data into the html headers.
*/
public function bootstrap()
{
static $isRendered = false;
$doc = JFactory::getDocument();
if( !$isRendered && $doc->getType() == 'html' )
{
// @task: Include dependencies from foundry.
require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'foundry' . DIRECTORY_SEPARATOR . '3.1' . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'configuration.php' );
$config = Komento::getConfig();
$environment = JRequest::getVar( 'komento_environment' , $config->get( 'komento_environment' ) );
$folder = 'scripts';
// @task: Let's see if we should load the dev scripts.
if( $environment == 'development' )
{
$folder = 'scripts_';
}
$doc->addScript( rtrim( JURI::root() , '/' ) . '/media/com_komento/' . $folder . '/abstract.js' );
$isRendered = true;
}
return $isRendered;
}
示例15: display
/**
* Display the view
*/
function display()
{
$document =& JFactory::getDocument();
$viewName = JRequest::getVar('view', 'category', 'default', 'cmd');
$viewType = $document->getType();
// interceptors to support legacy urls
switch ($this->getTask()) {
//index.php?option=com_contact&task=category&id=0&Itemid=4
case 'category':
$viewName = 'category';
$layout = 'default';
break;
case 'view':
$viewName = 'contact';
$layout = 'default';
break;
}
// Set the default view name from the Request
$view =& $this->getView($viewName, $viewType);
// Push a model into the view
$model =& $this->getModel($viewName);
if (!JError::isError($model)) {
$view->setModel($model, true);
}
// Workaround for the item view
if ($viewName == 'contact') {
$modelCat =& $this->getModel('category');
$view->setModel($modelCat);
}
// Display the view
$view->assign('error', $this->getError());
$view->display();
}