Skip to content

Commit

Permalink
Merge pull request #13 from mbabker/3447-updates
Browse files Browse the repository at this point in the history
PR updates
  • Loading branch information
wilsonge committed Jun 27, 2015
2 parents 779e7bc + ce48b1a commit a9dc9c1
Show file tree
Hide file tree
Showing 1,179 changed files with 33,229 additions and 31,584 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -18,6 +18,14 @@
/phpunit.xml
/tests/system/webdriver/tests/logs/
/tests/system/servers/configdef.php
codecept.phar
tests/codeception/_output/*
tests/codeception/vendor/*
tests/codeception/testingsite*
tests/codeception/tests/acceptance.suite.yml
tests/codeception/tests/acceptance/*Tester.php
tests/codeception/tests/functional/*Tester.php
tests/codeception/tests/unit/*Tester.php

# phpDocumentor Logs #
phpdoc-*
Expand Down
21 changes: 5 additions & 16 deletions administrator/components/com_admin/helpers/html/directory.php
Expand Up @@ -29,10 +29,8 @@ public static function writable($writable)
{
return '<span class="badge badge-success">' . JText::_('COM_ADMIN_WRITABLE') . '</span>';
}
else
{
return '<span class="badge badge-important">' . JText::_('COM_ADMIN_UNWRITABLE') . '</span>';
}

return '<span class="badge badge-important">' . JText::_('COM_ADMIN_UNWRITABLE') . '</span>';
}

/**
Expand All @@ -46,22 +44,13 @@ public static function writable($writable)
*/
public static function message($dir, $message, $visible = true)
{
if ($visible)
{
$output = $dir;
}
else
{
$output = '';
}
$output = $visible ? $dir : '';

if (empty($message))
{
return $output;
}
else
{
return $output . ' <strong>' . JText::_($message) . '</strong>';
}

return $output . ' <strong>' . JText::_($message) . '</strong>';
}
}
27 changes: 3 additions & 24 deletions administrator/components/com_admin/helpers/html/phpsetting.php
Expand Up @@ -25,14 +25,7 @@ abstract class JHtmlPhpSetting
*/
public static function boolean($val)
{
if ($val)
{
return JText::_('JON');
}
else
{
return JText::_('JOFF');
}
return JText::_($val ? 'JON' : 'JOFF');
}

/**
Expand All @@ -44,14 +37,7 @@ public static function boolean($val)
*/
public static function set($val)
{
if ($val)
{
return JText::_('JYES');
}
else
{
return JText::_('JNO');
}
return JText::_($val ? 'JYES' : 'JNO');
}

/**
Expand All @@ -63,14 +49,7 @@ public static function set($val)
*/
public static function string($val)
{
if (empty($val))
{
return JText::_('JNONE');
}
else
{
return $val;
}
return !empty($val) ? $val : JText::_('JNONE');
}

/**
Expand Down
9 changes: 1 addition & 8 deletions administrator/components/com_admin/helpers/html/system.php
Expand Up @@ -25,13 +25,6 @@ abstract class JHtmlSystem
*/
public static function server($val)
{
if (empty($val))
{
return JText::_('COM_ADMIN_NA');
}
else
{
return $val;
}
return !empty($val) ? $val : JText::_('COM_ADMIN_NA');
}
}
108 changes: 56 additions & 52 deletions administrator/components/com_admin/models/help.php
Expand Up @@ -127,68 +127,72 @@ public function getLangTag()
*/
public function &getToc()
{
if (is_null($this->toc))
if (!is_null($this->toc))
{
// Get vars
$lang_tag = $this->getLangTag();
$help_search = $this->getHelpSearch();
return $this->toc;
}

// New style - Check for a TOC JSON file
if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'))
{
$data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'));
// Get vars
$lang_tag = $this->getLangTag();
$help_search = $this->getHelpSearch();

// Loop through the data array
foreach ($data as $key => $value)
{
$this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value);
}
}
else
// New style - Check for a TOC JSON file
if (file_exists(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'))
{
$data = json_decode(file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/toc.json'));

// Loop through the data array
foreach ($data as $key => $value)
{
// Get Help files
jimport('joomla.filesystem.folder');
$files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$');
$this->toc = array();

foreach ($files as $file)
{
$buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file);

if (preg_match('#<title>(.*?)</title>#', $buffer, $m))
{
$title = trim($m[1]);

if ($title)
{
// Translate the page title
$title = JText::_($title);

// Strip the extension
$file = preg_replace('#\.xml$|\.html$#', '', $file);

if ($help_search)
{
if (JString::strpos(JString::strtolower(strip_tags($buffer)), JString::strtolower($help_search)) !== false)
{
// Add an item in the Table of Contents
$this->toc[$file] = $title;
}
}
else
{
// Add an item in the Table of Contents
$this->toc[$file] = $title;
}
}
}
}
$this->toc[$key] = JText::_('COM_ADMIN_HELP_' . $value);
}

// Sort the Table of Contents
asort($this->toc);

return $this->toc;
}

// Get Help files
jimport('joomla.filesystem.folder');
$files = JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$');
$this->toc = array();

foreach ($files as $file)
{
$buffer = file_get_contents(JPATH_BASE . '/help/' . $lang_tag . '/' . $file);

if (!preg_match('#<title>(.*?)</title>#', $buffer, $m))
{
continue;
}

$title = trim($m[1]);

if (!$title)
{
continue;
}

// Translate the page title
$title = JText::_($title);

// Strip the extension
$file = preg_replace('#\.xml$|\.html$#', '', $file);

if ($help_search
&& JString::strpos(JString::strtolower(strip_tags($buffer)), JString::strtolower($help_search)) === false)
{
continue;
}

// Add an item in the Table of Contents
$this->toc[$file] = $title;
}

// Sort the Table of Contents
asort($this->toc);

return $this->toc;
}

Expand Down

0 comments on commit a9dc9c1

Please sign in to comment.