Skip to content

Commit

Permalink
Update package
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Sep 19, 2017
1 parent af33d95 commit c0ff1b7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: php
php:
- 7.0
- 7.1
- 7.2

sudo: false

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
],
"require": {
"php": "^7.0",
"wpackagist-plugin/polylang": "^2.1"
"wpackagist-plugin/polylang": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "^6.1"
"phpunit/phpunit": "^6.3"
},
"autoload": {
"files": [
Expand Down
16 changes: 8 additions & 8 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
*/
function pll_translations(array $groups, $multiline = false)
{
if (!function_exists('pll_register_string')) {
if (function_exists('add_action')) {
add_action('admin_notices', function () {
printf('<div class="notice notice-error"><p>Please <a href="%s">activate</a> the Polylang plugin and configure it with at least one <a href="%s">language</a>.</p></div>', admin_url('plugins.php'), admin_url('admin.php?page=mlang'));
});
}
} else {
if (!function_exists('pll_register_string') && function_exists('add_action')) {
add_action('admin_notices', function () {
printf('<div class="notice notice-error"><p>Please <a href="%s">activate</a> the Polylang plugin and configure it with at least one <a href="%s">language</a>.</p></div>', admin_url('plugins.php'), admin_url('admin.php?page=mlang'));
});
}

if (function_exists('pll_register_string')) {
foreach ($groups as $group => $translations) {
foreach ($translations as $key => $description) {
pll_register_string($description, $key, $group, $multiline);
Expand All @@ -43,7 +43,7 @@ function pll_translations(array $groups, $multiline = false)
* Get translations by their strings.
*
* @param string $key
* @param string|null $lang
* @param null|string $lang
*
* @return string
*/
Expand Down
16 changes: 0 additions & 16 deletions tests/HelpersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
*/
class HelpersTest extends TestCase
{
/**
* @expectedException \BadFunctionCallException
*/
public function testPllTranslationsException()
{
pll_translations([]);
}

/**
* @runInSeparateProcess
*/
Expand All @@ -42,14 +34,6 @@ public function testPllTranslations()
]));
}

/**
* @expectedException \BadFunctionCallException
*/
public function testTransException()
{
trans('message');
}

/**
* @runInSeparateProcess
*/
Expand Down

0 comments on commit c0ff1b7

Please sign in to comment.