/** * Tests the createURL method for com_content's Article Manager view * * @return void * * @covers JHelp::createURL * @since 3.0 */ public function testCreateURL() { $this->assertEquals('help/en-GB/Content_Article_Manager.html', JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER'), 'Creates a local help URL for com_content Article Manager.'); $this->assertEquals('components/com_content/help/en-GB/Content_Article_Manager.html', JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', true, null, 'com_content'), 'Creates a local help URL for com_content Article Manager in the component.'); $this->assertEquals('http://domain.tld/help', JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', true, 'http://domain.tld/help', 'com_content'), 'Creates a remote help URL via an override for com_content Article Manager.'); $this->assertEquals('help/en-GB/Content_Article_Manager.html', JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', false, null, 'com_content'), 'Creates a local help URL for com_content Article Manager.'); }
/** * Get the JavaScript command for the button * * @param string $ref The name of the help screen (its key reference). * @param boolean $com Use the help file in the component directory. * @param string $override Use this URL instead of any other. * @param string $component Name of component to get Help (null for current component) * * @return string JavaScript command string * * @since 12.1 */ protected function _getCommand($ref, $com, $override, $component) { // Get Help URL $url = JHelp::createURL($ref, $com, $override, $component); $url = htmlspecialchars($url, ENT_QUOTES); $cmd = "Joomla.popupWindow('{$url}', '" . JText::_('JHELP', true) . "', 700, 500, 1)"; return $cmd; }
/** * Get the JavaScript command for the button * * @access private * @param object $definition Button definition * @return string JavaScript command string * @since 1.5 */ function _getCommand($ref, $com) { // Get Help URL jimport('joomla.language.help'); $url = JHelp::createURL($ref, $com); $cmd = "popupWindow('{$url}', '" . JText::_('Help', true) . "', 640, 480, 1)"; return $cmd; }
/** * Get the JavaScript command for the button * * @param string $ref The name of the help screen (its key reference). * @param boolean $com Use the help file in the component directory. * @param string $override Use this URL instead of any other. * @param string $component Name of component to get Help (null for current component) * * @return string JavaScript command string * @since 11.1 */ protected function _getCommand($ref, $com, $override, $component, $width, $height) { // Get Help URL jimport('joomla.language.help'); $url = JHelp::createURL($ref, $com, $override, $component); $url = htmlspecialchars($url, ENT_QUOTES); $cmd = "popupWindow('{$url}', '" . JText::_('JHELP', true) . "', {$width}, {$height}, 1)"; return $cmd; }
function replaceToolbar($body) { $t3toolbar = T3_ADMIN_PATH . '/admin/tpls/toolbar.php'; $input = JFactory::getApplication()->input; if (file_exists($t3toolbar) && class_exists('JToolBar')) { //get the existing toolbar html jimport('joomla.language.help'); $params = T3::getTplParams(); $toolbar = JToolBar::getInstance('toolbar')->render('toolbar'); $helpurl = JHelp::createURL($input->getCmd('view') == 'template' ? 'JHELP_EXTENSIONS_TEMPLATE_MANAGER_TEMPLATES_EDIT' : 'JHELP_EXTENSIONS_TEMPLATE_MANAGER_STYLES_EDIT'); $helpurl = htmlspecialchars($helpurl, ENT_QUOTES); //render our toolbar ob_start(); include $t3toolbar; $t3toolbar = ob_get_clean(); //replace it $body = str_replace($toolbar, $t3toolbar, $body); } return $body; }
/** * Load a template file -- This is a special implementation that tries to find the files within the distribution help * dir first. There localized versions of these files can be stored! * * @access public * @param string $tpl The name of the template source file ... * automatically searches the template paths and compiles as needed. * @return string The output of the the template script. */ public function loadTemplate($tpl = null) { global $mainframe, $option; // clear prior output $this->_output = null; $file = isset($tpl) ? $this->_layout . '_' . $tpl : $this->_layout; // Add specific prefix to the file for usage within the help directry $file = 'help.' . $file; // clean the file name $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file); // Get Help URL jimport('joomla.language.help'); $filetofind = JHelp::createURL($file, true); // TODO: reactivate - this construct can not deal with symbolic links! //$this->_template = JPath::find(JPATH_ADMINISTRATOR, $filetofind); $fullname = JPATH_ADMINISTRATOR . DS . $filetofind; $this->_template = JFile::exists($fullname) ? $fullname : false; if ($this->_template != false) { // unset so as not to introduce into template scope unset($tpl); unset($file); // never allow a 'this' property if (isset($this->this)) { unset($this->this); } // start capturing output into a buffer ob_start(); // include the requested template filename in the local scope // (this will execute the view logic). include $this->_template; // done with the requested template; get the buffer and // clear it. $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; } else { return parent::loadTemplate($tpl); } }
/** * Tests the createURL method for com_content's Article Manager view * * @return void * * @since 3.0 */ public function testCreateURL_com_content() { $this->assertThat(JHelp::createURL('JHELP_CONTENT_ARTICLE_MANAGER', false, null, 'com_content'), $this->equalTo('help/en-GB/Content_Article_Manager.html'), 'Creates a local help URL for com_content Article Manager.'); }
/** * Get the JavaScript command for the button * * @param string $ref The name of the help screen (its key reference). * @param boolean $com Use the help file in the component directory. * @param string $override Use this URL instead of any other. * @param string $component Name of component to get Help (null for current component) * @return string JavaScript command string */ protected function _getCommand($ref, $com, $override, $component) { // Get Help URL jimport('joomla.language.help'); $url = \JHelp::createURL($ref, $com, $override, $component); $url = htmlspecialchars($url, ENT_QUOTES); $cmd = "Joomla.popupWindow('{$url}', '" . \Lang::txt('JHELP', true) . "', 700, 500, 1)"; return $cmd; }
/** * Load a template file -- This is a special implementation that tries to find the files within the distribution help * dir first. There localized versions of these files can be stored! * * @access public * @param string $tpl The name of the template source file ... * automatically searches the template paths and compiles as needed. * @return string The output of the the template script. */ function loadTemplate($tpl = null) { global $mainframe, $option; // clear prior output $this->_output = null; $file = $this->_layout; // clean the file name $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file); // Get Help URL jimport('joomla.language.help'); $filetofind = JHelp::createURL($file, true); $this->_template = JPath::find(JPATH_ADMINISTRATOR, $filetofind); if ($this->_template != false) { // unset so as not to introduce into template scope unset($tpl); unset($file); // never allow a 'this' property if (isset($this->this)) { unset($this->this); } // start capturing output into a buffer ob_start(); // include the requested template filename in the local scope // (this will execute the view logic). include $this->_template; // done with the requested template; get the buffer and // clear it. $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; } else { return parent::loadTemplate($tpl); } }