本文整理汇总了PHP中JHtml::addIncludePath方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::addIncludePath方法的具体用法?PHP JHtml::addIncludePath怎么用?PHP JHtml::addIncludePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtml
的用法示例。
在下文中一共展示了JHtml::addIncludePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param array An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
$this->input = JFactory::getApplication()->input;
parent::__construct($config);
// Guess the JText message prefix. Defaults to the option.
if (empty($this->extension)) {
$this->extension = JRequest::getCmd('extension', 'com_content');
}
// If the joomla's version is more than or equal to 3.0
if (!COM_TZ_PORTFOLIO_JVERSION_COMPARE) {
JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tz_portfolio/libraries/cms/html');
tzportfolioimport('cms/html/sidebar');
$doc = JFactory::getDocument();
//Add Script to the header
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery.min.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery-noconflict.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/bootstrap.min.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/chosen.jquery.min.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery.ui.core.min.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/jquery.ui.sortable.min.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/js/sortablelist.js');
$doc->addScript(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/js/template.min.js');
$doc->addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/jui/css/chosen.min.css');
// $doc -> addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/jui/css/bootstrap.min.css');
// $doc -> addStyleSheet(COM_TZ_PORTFOLIO_ADMIN_HOST_PATH.'/css/template.css');
$doc->addCustomTag('<link href="' . COM_TZ_PORTFOLIO_ADMIN_HOST_PATH . '/css/template.min.css' . '" rel="stylesheet" type="text/css"/>');
}
}
示例2: vote
/**
* Votes an image via AJAX
*
* @return void
* @since 2.1
*/
public function vote()
{
require_once JPATH_ADMINISTRATOR . '/components/com_languages/helpers/jsonresponse.php';
$response = array();
$model = $this->getModel('vote');
if (!$model->vote()) {
echo new JJsonResponse(new Exception($model->getError()));
} else {
// HTML for updating the rating
JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers/html');
$response['rating'] = JHtml::_('joomgallery.rating', $model->getRating(), true, 'jg_starrating_detail', 'hasHintAjaxVote');
// Set CSS tooltip class in case of star rating
$response['tooltipclass'] = '';
if ($this->_config->get('jg_ratingdisplaytype') == 1) {
if ($this->_config->get('jg_tooltips') == 2) {
$response['tooltipclass'] = 'jg-tooltip-wrap';
} else {
if ($this->_config->get('jg_tooltips') == 1) {
$response['tooltipclass'] = 'default';
}
}
}
echo new JJsonResponse($response, JText::_('COM_JOOMGALLERY_DETAIL_RATINGS_MSG_YOUR_VOTE_COUNTED'));
}
}
示例3: prepareRender
/**
* prepareRender
*
* @return void
*/
protected function prepareRender()
{
\Windwalker\Helper\LanguageHelper::loadLanguage('com_content');
// Fix for 3.3.6
JHtml::addIncludePath(\Windwalker\Helper\PathHelper::getSite('com_content') . '/helpers');
parent::prepareRender();
}
示例4: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 2.5
*/
public function display($tpl = null)
{
// Load plug-in language files.
FinderHelperLanguage::loadPluginLanguage();
$this->items = $this->get('Items');
$this->total = $this->get('Total');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->pluginState = $this->get('pluginState');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
FinderHelper::addSubmenu('index');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
if (!$this->pluginState['plg_content_finder']->enabled) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_PLUGIN_CONTENT_NOT_ENABLED'), 'warning');
} elseif ($this->get('TotalIndexed') === 0) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_FINDER_INDEX_NO_DATA') . ' ' . JText::_('COM_FINDER_INDEX_TIP'), 'notice');
}
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Configure the toolbar.
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例5: display
/**
* Method to display the view.
*
* @param string $tpl A template file to load. [optional]
*
* @return mixed A string if successful, otherwise a JError object.
*
* @since 1.6
*/
public function display($tpl = null)
{
$this->categories = $this->get('CategoryOrders');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
BannersHelper::addSubmenu('banners');
$this->addToolbar();
require_once JPATH_COMPONENT . '/models/fields/bannerclient.php';
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例6: getInput
/**
* Returns the HTML for a OpenImage select box form field.
*
* @return string The OpenImage select box form field.
* @since 3.0
*/
protected function getInput()
{
JHtml::addIncludePath(JPATH_BASE . '/components/com_joomgallery/helpers/html');
$class = $this->element['class'] ? (string) $this->element['class'] : '';
if ($this->element['required'] && $this->element['required'] == true && strpos($class, 'required') === false) {
if (!empty($class)) {
$class .= ' ';
}
$class .= 'required';
}
$attr = '';
$attr .= !empty($class) ? ' class="' . $class . '"' : '';
$attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';
$detail = true;
if ((string) $this->element['detail'] == 'false') {
$detail = false;
}
$default = false;
if ((string) $this->element['defaultMethod'] == 'true') {
$default = true;
}
$prefix = 'COM_JOOMGALLERY_CONFIG_CV_GS_';
if ($this->element['prefix']) {
$prefix = (string) $this->element['prefix'];
}
return JHtml::_('joomselect.openimage', $this->name, $this->value, $detail, $default, $prefix, $attr, parent::getOptions());
}
示例7: getLabel
public function getLabel()
{
global $jlistConfig;
$app = JFactory::getApplication();
JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/helpers');
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$label = '';
$replace = '';
// Get the label text from the XML element, defaulting to the element name.
if ($app->isAdmin()) {
$text = $this->element['label'] ? (string) $this->element['label'] : (string) JDownloadsHelper::getOnlyLanguageSubstring($jlistConfig['custom.field.11.title']);
} else {
$text = $this->element['label'] ? (string) $this->element['label'] : (string) JDHelper::getOnlyLanguageSubstring($jlistConfig['custom.field.11.title']);
}
// Build the class for the label.
$class = !empty($this->description) ? 'hasTip' : '';
$class = $this->required == true ? $class . ' required' : $class;
$req = $this->required == true ? '<span class="star"> *</span>' : '';
// Add the opening label tag and main attributes attributes.
$label .= '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="' . $class . '"';
// If a description is specified, use it to build a tooltip.
if (!empty($this->description)) {
$label .= ' title="' . htmlspecialchars(trim(JText::_($text), ':') . '::' . JText::_($this->description), ENT_COMPAT, 'UTF-8') . '"';
}
// Add the label text and closing tag.
$label .= '>' . JText::_($text) . $req . '</label>';
return $label;
}
示例8: test_
/**
* Test the _ method.
*
* @return void
*
* @since 11.1
*/
public function test_()
{
// Add the include path to html test files.
JHtml::addIncludePath(array(__DIR__ . '/html/testfiles'));
// Test the class method was called and the arguments passed correctly.
$this->assertThat(JHtml::_('inspector.method1', 'argument1', 'argument2'), $this->equalTo('JHtmlInspector::method1'), 'JHtmlInspector::method1 could not be called.');
$this->assertThat(JHtmlInspector::$arguments[0], $this->equalTo(array('argument1', 'argument2')), 'The arguments where not correctly passed to JHtmlInspector::method1.');
// Test error cases.
// Prepare the error handlers.
$this->saveErrorHandlers();
$errorCallback = $this->getMock('errorCallback', array('error1', 'error2', 'error3'));
$errorCallback->expects($this->once())->method('error1');
$errorCallback->expects($this->once())->method('error2');
$errorCallback->expects($this->once())->method('error3');
// Ensure that we get an error if we can find the file but the file does not contain the class.
JError::setErrorHandling(E_ERROR, 'callback', array($errorCallback, 'error1'));
$this->assertThat(JHtml::_('empty.anything'), $this->isFalse());
// Ensure that we get an error if we can't find the file.
JError::setErrorHandling(E_ERROR, 'callback', array($errorCallback, 'error2'));
$this->assertThat(JHtml::_('nofile.anything'), $this->isFalse());
// Ensure that we get an error if we have the class but not the method.
JError::setErrorHandling(E_ERROR, 'callback', array($errorCallback, 'error3'));
$this->assertThat(JHtml::_('inspector.nomethod'), $this->isFalse());
// Restore the error handlers.
$this->setErrorHandlers($this->savedErrorState);
}
示例9: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->getConfig();
foreach ($this->items as $i => $item) {
$this->items[$i]->params = json_decode($item->advancedparams);
if (is_null($this->items[$i]->params)) {
$this->items[$i]->params = new stdClass();
}
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Check if there are no matching items
if (!count($this->items)) {
JFactory::getApplication()->enqueueMessage(JText::_('COM_MODULES_MSG_MANAGE_NO_MODULES'), 'warning');
}
$this->addToolbar();
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
parent::display($tpl);
}
示例10: display
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 1.6
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// We don't need the toolbar in the modal window.
if ($this->getLayout() !== 'modal') {
$this->addToolbar();
} else {
// Client id selector should not exist.
$this->filterForm->removeField('client_id', '');
// If in the frontend state and language should not activate the search tools.
if (JFactory::getApplication()->isSite()) {
unset($this->activeFilters['state']);
unset($this->activeFilters['language']);
}
}
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
return parent::display($tpl);
}
示例11: config
function config()
{
jimport('joomla.html.editor');
JHtml::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'htmlelements');
$model = JModel::getInstance('Comission', 'J' . APP_PREFIX . 'PricingModel');
$r = $model->getItemPrices($this->commissionType);
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'thefactory' . DS . 'category' . DS . 'models');
$catModel = JModel::getInstance('Category', 'JTheFactoryModel');
$cattree = $catModel->getCategoryTree();
$pricing = $model->loadPricingObject();
$params = new JParameter($pricing->params);
$editor = JFactory::getEditor();
$viewMenu = $this->getView('menu');
$viewMenu->display();
$view = $this->getView('Config');
$view->assign('default_price', $r->default_price);
$view->assign('price_powerseller', $r->price_powerseller);
$view->assign('price_verified', $r->price_verified);
$view->assign('category_pricing_enabled', $r->category_pricing_enabled);
$view->assign('category_pricing', $r->category_pricing);
$view->assign('category_tree', $cattree);
$view->assign('itemname', $this->itemname);
$view->assign('editor', $editor);
$view->assign('email_text', base64_decode($params->get('email_text')));
$view->display();
}
示例12: display
function display($tpl = null)
{
require_once JPATH_COMPONENT . '/helpers/jcomments.php';
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$filter_state = $this->state->get('filter.state');
// Filter by published state
$filter_state_options = array();
$filter_state_options[] = JHTML::_('select.option', '1', JText::_('A_FILTER_STATE_PUBLISHED'));
$filter_state_options[] = JHTML::_('select.option', '0', JText::_('A_FILTER_STATE_UNPUBLISHED'));
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('jcomments.stylesheet');
// Use frontend template's stylesheet for icons
$document = JFactory::getDocument();
$document->addStylesheet(JURI::root(true) . '/components/com_jcomments/tpl/default/style.css?v=3002', 'text/css', null);
if (version_compare(JVERSION, '3.0', 'ge')) {
JHtml::_('bootstrap.tooltip');
JHtml::_('formbehavior.chosen', 'select');
JCommentsHelper::addSubmenu('custombbcodes');
JHtmlSidebar::setAction('index.php?option=com_jcomments&view=custombbcodes');
JHtmlSidebar::addFilter(JText::_('A_FILTER_STATE'), 'filter_state', JHtml::_('select.options', $filter_state_options, 'value', 'text', $filter_state, true));
$this->bootstrap = true;
$this->sidebar = JHtmlSidebar::render();
} else {
JCommentsHelper::addSubmenu('custombbcodes');
array_unshift($filter_state_options, JHTML::_('select.option', '', JText::_('A_FILTER_STATE')));
$filter = JHTML::_('select.genericlist', $filter_state_options, 'filter_state', 'onchange="Joomla.submitform();"', 'value', 'text', $filter_state);
$this->assignRef('filter', $filter);
}
$this->addToolbar();
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
parent::display($tpl);
}
示例13: addToolbar
protected function addToolbar()
{
JRequest::setVar('hidemainmenu', true);
include JPATH_COMPONENT . '/helpers/toolbar.php';
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = SolidresHelper::getActions('', $this->item->id);
if ($isNew) {
JToolBarHelper::title(JText::_('SR_ADD_NEW_ROOM_TYPE'), 'generic.png');
} else {
JToolBarHelper::title(JText::sprintf('SR_EDIT_ROOM_TYPE', $this->item->name), 'generic.png');
}
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
JHtml::_('behavior.tooltip');
SRHtml::_('jquery.validate');
// If not checked out, can save the item.
if (!$checkedOut && $canDo->get('core.edit')) {
JToolBarHelper::apply('roomtype.apply', 'JToolbar_Apply');
JToolBarHelper::save('roomtype.save', 'JToolbar_Save');
JToolBarHelper::addNew('roomtype.save2new', 'JToolbar_Save_and_new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('roomtype.save2copy', 'copy.png', 'copy_f2.png', 'JToolbar_Save_as_Copy', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('roomtype.cancel', 'JToolbar_Cancel');
} else {
JToolBarHelper::cancel('roomtype.cancel', 'JToolbar_Close');
}
SRToolBarHelper::mediaManager();
JToolBarHelper::divider();
JToolBarHelper::help('screen.roomtype.edit', 'JTOOLBAR_HELP');
}
示例14: test_
/**
* @todo Implement test_().
*/
public function test_()
{
// first we test to ensure that if a handler is properly registered, it gets called
$registered = $this->getMock('MyHtmlClass', array('mockFunction'));
// test that we can register the method
JHtml::register('file.testfunction', array($registered, 'mockFunction'));
// test that calling _ actually calls the function
$registered->expects($this->once())->method('mockFunction')->with('Test Return Value')->will($this->returnValue('My Expected Return Value'));
$this->assertThat(JHtml::_('file.testfunction', 'Test Return Value'), $this->equalTo('My Expected Return Value'));
// we unregister the method to return to our original state
JHtml::unregister('prefix.file.testfunction');
// now we test with a class that will be found in the expected file
JHtml::addIncludePath(array(JPATH_BASE . '/tests/unit/suite/libraries/joomla/html/htmltests'));
$this->assertThat(JHtml::_('mocktest.method1', 'argument1', 'argument2'), $this->equalTo('JHtml Mock Called'));
$this->assertThat(JHtmlMockTest::$arguments[0], $this->equalTo(array('argument1', 'argument2')));
JHtmlMockTest::$arguments = array();
$this->saveErrorHandlers();
$mock1 = $this->getMock('errorCallback', array('error1', 'error2', 'error3'));
JError::setErrorHandling(E_ERROR, 'callback', array($mock1, 'error1'));
$mock1->expects($this->once())->method('error1');
// we ensure that we get an error if we can find the file but the file does not contain the class
$this->assertThat(JHtml::_('mocktest2.function1'), $this->isFalse());
JError::setErrorHandling(E_ERROR, 'callback', array($mock1, 'error2'));
$mock1->expects($this->once())->method('error2');
// we ensure that we get an error if we can't find the file
$this->assertThat(JHtml::_('mocktestnotthere.function1'), $this->isFalse());
JError::setErrorHandling(E_ERROR, 'callback', array($mock1, 'error3'));
$mock1->expects($this->once())->method('error3');
// we ensure that we get an error if we have the class but not the method
$this->assertThat(JHtml::_('mocktest.nomethod'), $this->isFalse());
// restore our error handlers
$this->setErrorHandlers($this->savedErrorState);
}
示例15: _setToolBar
/**
* Установки тулбара
*/
protected function _setToolBar()
{
require_once JPATH_COMPONENT . '/helpers/smfaq.php';
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
SmFaqHelper::addSubmenu($this->_name);
$canDo = SmFaqHelper::getActions($this->state->get('filter.category_id'));
// Выводим нужные кнопки и заголовок
JToolBarHelper::title(JText::_('COM_SMFAQ_MANAGER_QUESTIONS'), 'smfaq');
if ($canDo->get('core.create')) {
JToolBarHelper::addNewX('smfaq.add', 'JTOOLBAR_NEW');
}
if ($canDo->get('core.edit')) {
JToolBarHelper::editListX('smfaq.edit', 'JTOOLBAR_EDIT');
}
JToolBarHelper::divider();
JToolBarHelper::custom('smfaqlist.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('smfaqlist.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
JToolBarHelper::divider();
JToolBarHelper::checkin('smfaqlist.checkin');
// Замена тулбара карзины на удаление
if ($this->state->get('filter.published') == -2) {
JToolBarHelper::deleteList('COM_SMFAQ_YOU_WANT_DELETE_THIS', 'smfaqlist.delete', 'JTOOLBAR_EMPTY_TRASH');
} else {
JToolBarHelper::trash('smfaqlist.trash', 'JTOOLBAR_TRASH');
}
JToolBarHelper::divider();
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_smfaq');
}
}