Skip to content

Commit f6c7322

Browse files
author
Jippe Holwerda
committed
empty() function only accepts variables prior to PHP 5.5
1 parent 2b3c700 commit f6c7322

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/class-tiny-settings.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ public function render_multisite_api_key() {
200200

201201
public function render_api_key() {
202202
$field = self::get_prefixed_name('api_key');
203-
$value = $this->get_api_key();
203+
$key = $this->get_api_key();
204204
if (tiny_is_network_activated()) {
205-
if (empty($this->get_multisite_api_key())) {
206-
if (empty($value)) {
205+
$multisite_key = $this->get_multisite_api_key();
206+
if (empty($multisite_key)) {
207+
if (empty($key)) {
207208
echo '<p>' . self::translate('Your Network Admin has not configured an API key yet.') . '</p>';
208209
} else {
209210
echo '<p>' . self::translate('You have an API key configured. Your Network Admin can change the key.') . '</p>';
@@ -212,8 +213,8 @@ public function render_api_key() {
212213
echo '<p>' . self::translate('The API key has been installed by the Network Admin.') . '</p>';
213214
}
214215
} else {
215-
echo '<input type="text" id="' . $field . '" name="' . $field . '" value="' . htmlspecialchars($value) . '" size="40" />';
216-
if (empty($value)) {
216+
echo '<input type="text" id="' . $field . '" name="' . $field . '" value="' . htmlspecialchars($key) . '" size="40" />';
217+
if (empty($key)) {
217218
echo '<p>';
218219
$link = '<a href="https://tinypng.com/developers">' . self::translate_escape('TinyPNG Developer section') . '</a>';
219220
printf(self::translate_escape('Visit %s to get an API key') . '.', $link);

0 commit comments

Comments
 (0)