Skip to content

Commit

Permalink
Merge pull request #16 from epfl-si/feature/status-code-value
Browse files Browse the repository at this point in the history
[feature] status code value
  • Loading branch information
ponsfrilus authored Nov 12, 2020
2 parents 8feea60 + 60d87d7 commit 47563c1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
vendor
vendor
*.po~
*.po.bak
4 changes: 2 additions & 2 deletions epfl-coming-soon.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Plugin URI: https://github.com/epfl-si/wp-plugin-epfl-coming-soon
* Description: Coming Soon, Under Construction or Maintenance Mode plugin for WordPress done right.
* Author: EPFL IDEV-FSD
* Version: 0.1.0
* Version: 0.1.1
* Author URI: https://github.com/epfl-si
* Text Domain: epfl-coming-soon
* Domain Path: src/languages
Expand All @@ -19,7 +19,7 @@
defined( 'ABSPATH' )
|| die( 'Direct access not allowed.' );

define( 'EPFL_COMING_SOON_VERSION', '0.1.0' );
define( 'EPFL_COMING_SOON_VERSION', '0.1.1' );

require_once WP_CONTENT_DIR . '/plugins/epfl-coming-soon/src/classes/class-epflcomingsoon.php';

Expand Down
12 changes: 9 additions & 3 deletions src/classes/class-epflcomingsoon.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,15 @@ public function epfl_coming_soon_plugin_setting_theme_maintenance() {
*/
public function epfl_coming_soon_plugin_setting_status_code() {
$epfl_coming_soon_options = get_option( 'epfl_csp_options' );
$epfl_coming_soon_status_code = $epfl_coming_soon_options['status_code'] ?? 'no';
printf( "<input id='epfl_coming_soon_plugin_setting_status_code_503_yes' name='epfl_csp_options[status_code]' type='radio' value='yes' " . ( 'yes' === $epfl_coming_soon_status_code ? "checked='checked'" : '' ) . " /> <label for='epfl_coming_soon_plugin_setting_status_code_503_yes'>%s</label><br>", __( 'Yes, use 503 HTTP status code (best for maintenance)', 'epfl-coming-soon' ) );
printf( "<input id='epfl_coming_soon_plugin_setting_status_code_503_no' name='epfl_csp_options[status_code]' type='radio' value='no' " . ( 'no' === $epfl_coming_soon_status_code ? "checked='checked'" : '' ) . " /> <label for='epfl_coming_soon_plugin_setting_status_code_503_no'>%s</label>", __( 'No, just display the page with a 200 HTTP status code (best for coming soon)', 'epfl-coming-soon' ) );
$epfl_coming_soon_status_code = $epfl_coming_soon_options['status_code'] ?? '200';
// Transform yes/no values in 503/200 values for more readibility. Retro-compatible.
if ( 'no' === $epfl_coming_soon_status_code ) {
$epfl_coming_soon_status_code = '200';
} elseif ( 'yes' === $epfl_coming_soon_status_code ) {
$epfl_coming_soon_status_code = '503';
}
printf( "<input id='epfl_coming_soon_plugin_setting_status_code_503_yes' name='epfl_csp_options[status_code]' type='radio' value='503' " . ( '503' === $epfl_coming_soon_status_code ? "checked='checked'" : '' ) . " /> <label for='epfl_coming_soon_plugin_setting_status_code_503_yes'>%s</label><br>", __( 'Yes, use 503 HTTP status code (best for maintenance)', 'epfl-coming-soon' ) );
printf( "<input id='epfl_coming_soon_plugin_setting_status_code_503_no' name='epfl_csp_options[status_code]' type='radio' value='200' " . ( '200' === $epfl_coming_soon_status_code ? "checked='checked'" : '' ) . " /> <label for='epfl_coming_soon_plugin_setting_status_code_503_no'>%s</label>", __( 'No, just display the page with a 200 HTTP status code (best for coming soon)', 'epfl-coming-soon' ) );
}

/**
Expand Down
Binary file modified src/languages/epfl-coming-soon-fr_FR.mo
Binary file not shown.
10 changes: 5 additions & 5 deletions src/languages/epfl-coming-soon-fr_FR.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the same license as the EPFL Coming Soon plugin.
msgid ""
msgstr ""
"Project-Id-Version: WPForms EPFL Payonline 0.1.0\n"
"Project-Id-Version: WPForms EPFL Payonline 0.1.1\n"
"Report-Msgid-Bugs-To: https://github.com/wp-cli/i18n-command/issues\n"
"POT-Creation-Date: 2020-11-11T20:57:23+01:00\n"
"POT-Creation-Date: 2020-11-12T18:52:27+01:00\n"
"PO-Revision-Date: 2020-11-11 18:23+0100\n"
"Last-Translator: Nicolas Borboën <ponsfrilus@gmail.com>\n"
"Language-Team: French\n"
Expand Down Expand Up @@ -131,16 +131,16 @@ msgstr "Oui, si présent (maintenance.php)"
msgid "No, use the HTML code provided below"
msgstr "Non, utiliser le code HTML ci-dessous"

#: src/classes/class-epflcomingsoon.php:316
#: src/classes/class-epflcomingsoon.php:322
msgid "Yes, use 503 HTTP status code (best for maintenance)"
msgstr "Oui, utiliser le code HTTP 503 (si page de maintenance)"

#: src/classes/class-epflcomingsoon.php:317
#: src/classes/class-epflcomingsoon.php:323
msgid ""
"No, just display the page with a 200 HTTP status code (best for coming soon)"
msgstr "Non, afficher la page avec un code HTTP 200 (si page \"coming soon\")"

#: src/classes/class-epflcomingsoon.php:328
#: src/classes/class-epflcomingsoon.php:334
msgid "EPFL Coming Soon is active"
msgstr "EPFL Coming Soon est activé"

Expand Down
10 changes: 5 additions & 5 deletions src/languages/epfl-coming-soon.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the same license as the EPFL Coming Soon plugin.
msgid ""
msgstr ""
"Project-Id-Version: EPFL Coming Soon 0.1.0\n"
"Project-Id-Version: EPFL Coming Soon 0.1.1\n"
"Report-Msgid-Bugs-To: https://github.com/wp-cli/i18n-command/issues\n"
"Last-Translator: Nicolas Borboën <ponsfrilus@gmail.com>\n"
"Language-Team: EPFL IDEV-FSD <https://github.com/epfl-si/wp-plugin-epfl-coming-soon>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2020-11-11T21:00:03+01:00\n"
"POT-Creation-Date: 2020-11-12T18:52:27+01:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.4.0\n"
"X-Domain: epfl-coming-soon\n"
Expand Down Expand Up @@ -103,14 +103,14 @@ msgstr ""
msgid "No, use the HTML code provided below"
msgstr ""

#: src/classes/class-epflcomingsoon.php:316
#: src/classes/class-epflcomingsoon.php:322
msgid "Yes, use 503 HTTP status code (best for maintenance)"
msgstr ""

#: src/classes/class-epflcomingsoon.php:317
#: src/classes/class-epflcomingsoon.php:323
msgid "No, just display the page with a 200 HTTP status code (best for coming soon)"
msgstr ""

#: src/classes/class-epflcomingsoon.php:328
#: src/classes/class-epflcomingsoon.php:334
msgid "EPFL Coming Soon is active"
msgstr ""

0 comments on commit 47563c1

Please sign in to comment.