Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/staging' into autosuggester
Browse files Browse the repository at this point in the history
  • Loading branch information
tkempf committed Aug 24, 2015
2 parents cc08f65 + 05fb991 commit b8002e8
Show file tree
Hide file tree
Showing 1,703 changed files with 41,802 additions and 33,551 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
25 changes: 9 additions & 16 deletions .travis.yml
@@ -1,3 +1,6 @@
# Forces new Travis-CI Infrastructure
sudo: false

language: php

php:
Expand All @@ -16,11 +19,8 @@ services:
- redis-server

before_script:
# - composer update
# Install PHPCS to validate code standards
- composer require squizlabs/php_codesniffer 1.5.6
# Install Cache_Lite for testing
- composer require pear/cache_lite 1.7.16
# Make sure all dev dependencies are installed
- composer install
# Set up databases for testing
- mysql -e 'create database joomla_ut;'
- mysql joomla_ut < tests/unit/schema/mysql.sql
Expand All @@ -30,22 +30,15 @@ before_script:
# - ./build/travis/php-apache.sh
# Enable additional PHP extensions
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '7.0' ]; then phpenv config-add build/travis/phpenv/memcached.ini; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '7.0' ]; then phpenv config-add build/travis/phpenv/apc-$TRAVIS_PHP_VERSION.ini; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' == '5.3' ] || [ '$TRAVIS_PHP_VERSION' == '5.4' ]; then phpenv config-add build/travis/phpenv/apc-$TRAVIS_PHP_VERSION.ini; fi"
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '7.0' ]; then phpenv config-add build/travis/phpenv/redis.ini; fi"
# PHP 5.5+ needs APCu
- if [ '$TRAVIS_PHP_VERSION' == "5.5" ] || [ '$TRAVIS_PHP_VERSION' == "5.6" ]; then printf "\n" | echo -e "extension = apcu.so\napc.enabled=1\napc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi

script:
- phpunit --configuration travisci-phpunit.xml
- libraries/vendor/bin/phpunit --configuration travisci-phpunit.xml
- sh -c "if [ '$TRAVIS_PHP_VERSION' != '7.0' ]; then libraries/vendor/bin/phpcs --report=full --extensions=php -p --standard=build/phpcs/Joomla .; fi"

branches:
except:
- 2.5.x

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/18687d008d633d02aa84
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false

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');
}
}
111 changes: 58 additions & 53 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 All @@ -201,7 +205,8 @@ public function &getLatestVersionCheck()
{
if (!$this->latest_version_check)
{
$override = 'https://help.joomla.org/proxy/index.php?option=com_help&amp;keyref=Help{major}{minor}:Joomla_Version_{major}_{minor}_{maintenance}/{langcode}&amp;lang={langcode}';
$override = 'https://help.joomla.org/proxy/index.php?option=com_help&amp;keyref=Help{major}{minor}:'
. 'Joomla_Version_{major}_{minor}_{maintenance}/{langcode}&amp;lang={langcode}';
$this->latest_version_check = JHelp::createUrl('JVERSION', false, $override);
}

Expand Down

0 comments on commit b8002e8

Please sign in to comment.