Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
html.
  • Loading branch information
elinw committed Apr 18, 2011
1 parent 85e024c commit 1644ef5
Show file tree
Hide file tree
Showing 22 changed files with 228 additions and 194 deletions.
2 changes: 1 addition & 1 deletion libraries/joomla/filter/filterinput.php
Expand Up @@ -318,7 +318,7 @@ protected function _cleanTags($source)
$preTag = null;
$postTag = $source;
$currentSpace = false;
// moffats: Setting to null due to issues in migration system - undefined variable errors
// Setting to null to deal with undefined variables
$attr = '';

// Is there a tag? If so it will certainly start with a '<'.
Expand Down
13 changes: 7 additions & 6 deletions libraries/joomla/html/editor.php
Expand Up @@ -49,7 +49,7 @@ class JEditor extends JObservable
protected $author = null;

/**
* constructor
* Constructor
*
* @param string The editor name
*/
Expand Down Expand Up @@ -130,7 +130,7 @@ public function display($name, $html, $width, $height, $col, $row, $buttons = tr
$this->author = $author;
$this->_loadEditor($params);

//check if editor is already loaded
// Check whether editor is already loaded
if (is_null(($this->_editor))) {
return;
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public function save($editor)
{
$this->_loadEditor();

//check if editor is already loaded
// Check whether editor is already loaded
if (is_null(($this->_editor))) {
return;
}
Expand Down Expand Up @@ -254,7 +254,8 @@ public function setContent($editor, $html)
* Get the editor buttons
*
* @param string $editor The name of the editor.
* @param mixed $buttons Can be boolean or array, if boolean defines if the buttons are displayed, if array defines a list of buttons not to show.
* @param mixed $buttons Can be boolean or array, if boolean defines if the buttons are
* displayed, if array defines a list of buttons not to show.
*
* @since 11.1
*/
Expand Down Expand Up @@ -301,7 +302,7 @@ public function getButtons($editor, $buttons = true)
*/
protected function _loadEditor($config = array())
{
//check if editor is already loaded
// Check whether editor is already loaded
if (!is_null(($this->_editor))) {
return;
}
Expand Down Expand Up @@ -342,7 +343,7 @@ protected function _loadEditor($config = array())
$name = 'plgEditor'.$this->_name;

if ($this->_editor = new $name ($this, (array)$plugin)) {
// load plugin parameters
// Load plugin parameters
$this->initialise();
JPluginHelper::importPlugin('editors-xtd');
}
Expand Down
72 changes: 39 additions & 33 deletions libraries/joomla/html/html.php
Expand Up @@ -28,11 +28,10 @@ abstract class JHtml
/**
* Option values related to the generation of HTML output. Recognized
* options are:
* <ul><li>fmtDepth, integer. The current indent depth.
* </li><li>fmtEol, string. The end of line string, default is linefeed.
* </li><li>fmtIndent, string. The string to use for indentation, default is
* tab.
* </ul>
* fmtDepth, integer. The current indent depth.
* fmtEol, string. The end of line string, default is linefeed.
* fmtIndent, string. The string to use for indentation, default is
* tab.
*
* @var array
*/
Expand All @@ -55,7 +54,7 @@ protected static function extract($key)
{
$key = preg_replace('#[^A-Z0-9_\.]#i', '', $key);

// Check to see if we need to load a helper file
// Check to see whether we need to load a helper file
$parts = explode('.', $key);

$prefix = (count($parts) == 3 ? array_shift($parts) : 'JHtml');
Expand All @@ -81,7 +80,7 @@ public static function _($key)
{
$function = self::$registry[$key];
$args = func_get_args();
// remove function name from arguments
// Remove function name from arguments
array_shift($args);
return JHtml::call($function, $args);
}
Expand Down Expand Up @@ -113,7 +112,7 @@ public static function _($key)
{
JHtml::register($key, $toCall);
$args = func_get_args();
// remove function name from arguments
// Remove function name from arguments
array_shift($args);
return JHtml::call($toCall, $args);
}
Expand Down Expand Up @@ -229,18 +228,19 @@ public static function iframe($url, $name, $attribs = null, $noFrames = '')
}

/**
* compute the files to be include
* Compute the files to be include
* @param string path to file
* @param boolean path to file is relative to /media folder
* @param boolean detect browser to include specific browser js files
* @param folder folder name to search into (images, css, js, ...)
* @see JBrowser
*
* @return array files to be included
* @since 11.1
*/
private static function _includeRelativeFiles($file, $relative, $detect_browser, $folder)
{
// if http is present in filename
// If http is present in filename
if (strpos($file, 'http') === 0)
{
$includes = array($file);
Expand All @@ -257,7 +257,7 @@ private static function _includeRelativeFiles($file, $relative, $detect_browser,
$ext = JFile::getExt($file);
$strip = JFile::stripExt($file);

// try to include files named filename.ext, filename_browser.ext, filename_browser_major.ext, filename_browser_major_minor.ext
// Try to include files named filename.ext, filename_browser.ext, filename_browser_major.ext, filename_browser_major_minor.ext
// where major and minor are the browser version names
$potential = array($file, $strip.'_'.$browser.'.'.$ext, $strip.'_'.$browser.'_'.$major.'.'.$ext, $strip.'_'.$browser.'_'.$major.'_'.$minor.'.'.$ext);
}
Expand All @@ -266,7 +266,7 @@ private static function _includeRelativeFiles($file, $relative, $detect_browser,
$potential = array($file);
}

// if relative search in template directory or media directory
// If relative search in template directory or media directory
if($relative)
{

Expand All @@ -277,26 +277,26 @@ private static function _includeRelativeFiles($file, $relative, $detect_browser,
// Prepare array of files
$includes = array();

// for each potential files
// For each potential files
foreach ($potential as $file)
{
// if the file is in the template folder
// If the file is in the template folder
if (file_exists(JPATH_THEMES . "/$template/$folder/$file"))
{
$includes[] = JURI::base(true) . "/templates/$template/$folder/$file";
}
else
{
// if the file contains any /: it can be in an media extension subfolder
// If the file contains any /: it can be in an media extension subfolder
if (strpos($file, '/'))
{
// divide the file extracting the extension as the first part before /
// Divide the file extracting the extension as the first part before /
list($extension, $file) = explode('/', $file, 2);

// if the file yet contains any /: it can be a plugin
// If the file yet contains any /: it can be a plugin
if (strpos($file, '/'))
{
// divide the file extracting the element as the first part before /
// Divide the file extracting the element as the first part before /
list($element, $file) = explode('/', $file, 2);

// Try to deal with plugins group in the media folder
Expand Down Expand Up @@ -340,7 +340,7 @@ private static function _includeRelativeFiles($file, $relative, $detect_browser,
}
}
}
// if not relative and http is not present in filename
// If not relative and http is not present in filename
else
{
$includes = array();
Expand Down Expand Up @@ -373,7 +373,7 @@ public static function image($file, $alt, $attribs = null, $relative = false, $p

$includes = self::_includeRelativeFiles($file, $relative, false, 'images');

// if only path is required
// If only path is required
if($path_only)
{
if (count($includes)) {
Expand Down Expand Up @@ -428,7 +428,7 @@ public static function image($file, $alt, $attribs = null, $relative = false, $p
public static function stylesheet($file, $attribs = array(), $relative = false, $path_only = false, $detect_browser = true)
{
// Need to adjust for the change in API from 1.5 to 1.6.
// function stylesheet($filename, $path = 'media/system/css/', $attribs = array())
// Function stylesheet($filename, $path = 'media/system/css/', $attribs = array())
if (is_string($attribs)) {
// Assume this was the old $path variable.
$file = $attribs.$file;
Expand All @@ -442,7 +442,7 @@ public static function stylesheet($file, $attribs = array(), $relative = false,

$includes = self::_includeRelativeFiles($file, $relative, $detect_browser, 'css');

// if only path is required
// If only path is required
if ($path_only) {
if (count($includes)==0) {
return null;
Expand All @@ -454,7 +454,7 @@ public static function stylesheet($file, $attribs = array(), $relative = false,
return $includes;
}
}
// if inclusion is required
// If inclusion is required
else {
$document = JFactory::getDocument();
foreach ($includes as $include)
Expand All @@ -471,6 +471,7 @@ public static function stylesheet($file, $attribs = array(), $relative = false,
* @param boolean path to file is relative to /media folder
* @param boolean return the path to the file only
* @param boolean detect browser to include specific browser js files
*
* @return mixed nothing if $path_only is false, null, path or array of path if specific js browser files were detected
* @see JHtml::stylesheet
* @since 11.1
Expand All @@ -487,14 +488,14 @@ public static function script($file, $framework = false, $relative = false, $pat
$framework = $relative;
}

// Include mootools framework
// Include MooTools framework
if ($framework) {
JHtml::_('behavior.framework');
}

$includes = self::_includeRelativeFiles($file, $relative, $detect_browser, 'js');

// if only path is required
// If only path is required
if ($path_only) {
if (count($includes)==0) {
return null;
Expand All @@ -506,7 +507,7 @@ public static function script($file, $framework = false, $relative = false, $pat
return $includes;
}
}
// if inclusion is required
// If inclusion is required
else {
$document = JFactory::getDocument();
foreach ($includes as $include)
Expand Down Expand Up @@ -621,6 +622,7 @@ public static function date($input = 'now', $format = null, $tz = true, $gregori
* @param string $text The text for the tip
* @param string $href An URL that will be used to create the link
* @param string $alt The alt attribute for img tag
*
* @return string
* @since 11.1
*/
Expand Down Expand Up @@ -667,6 +669,7 @@ public static function tooltip($tooltip, $title = '', $image = 'tooltip.png', $t
if ($title) {
$tooltip = $title.'::'.$tooltip;
}

return '<span class="'.$class.'" title="' . $tooltip . '">'.$tip.'</span>';
}

Expand Down Expand Up @@ -703,10 +706,14 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri
{
$document = JFactory::getDocument();
$document->addScriptDeclaration('window.addEvent(\'domready\', function() {Calendar.setup({
inputField: "'.$id.'", // id of the input field
ifFormat: "'.$format.'", // format of the input field
button: "'.$id.'_img", // trigger for the calendar (button ID)
align: "Tl", // alignment (defaults to "Bl")
// Id of the input field
inputField: "'.$id.'",
// Format of the input field
ifFormat: "'.$format.'",
// Trigger for the calendar (button ID)
button: "'.$id.'_img",
// Alignment (defaults to "Bl")
align: "Tl",
singleClick: true,
firstDay: '.JFactory::getLanguage()->getFirstDay().'
});});');
Expand All @@ -729,10 +736,10 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri
*/
public static function addIncludePath($path = '')
{
// force path to array
// Force path to array
settype($path, 'array');

// loop through the path directories
// Loop through the path directories
foreach ($path as $dir)
{
if (!empty($dir) && !in_array($dir, JHtml::$includePaths)) {
Expand All @@ -742,5 +749,4 @@ public static function addIncludePath($path = '')

return JHtml::$includePaths;
}

}
4 changes: 2 additions & 2 deletions libraries/joomla/html/html/access.php
Expand Up @@ -30,7 +30,7 @@ abstract class JHtmlAccess
* @param string The form field name.
* @param string The name of the selected section.
* @param string Additional attributes to add to the select field.
* @param mixed True to add "All Sections" option or and array of option
* @param mixed True to add "All Sections" option or and array of options
* @param string The form field id
*
* @return string The required HTML for the SELECT tag.
Expand Down Expand Up @@ -162,7 +162,7 @@ public static function usergroups($name, $selected, $checkSuperAdmin = false)
if ((!$checkSuperAdmin) || $isSuperAdmin || (!JAccess::checkGroup($item->id, 'core.admin'))) {
// Setup the variable attributes.
$eid = $count . 'group_' . $item->id;
// don't call in_array unless something is selected
// Don't call in_array unless something is selected
$checked = '';
if ($selected) {
$checked = in_array($item->id, $selected) ? ' checked="checked"' : '';
Expand Down

0 comments on commit 1644ef5

Please sign in to comment.