From 08d81022f2db1311d4f81ccb29406bb30f177f29 Mon Sep 17 00:00:00 2001 From: Matthew Jackowski Date: Tue, 17 May 2016 03:29:15 -0700 Subject: [PATCH 1/4] Added 'wp' identifier --- .../transifex-live-integration-javascript.php | 5 +++-- .../transifex-live-integration-defaults.php | 19 ++++++++++--------- ...nsifex-live-integration-static-factory.php | 4 ++-- readme.md | 4 +++- readme.txt | 8 +++++--- transifex-live-integration-main.php | 3 ++- transifex-live-integration.php | 6 +++--- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/includes/lib/transifex-live-integration-javascript.php b/includes/lib/transifex-live-integration-javascript.php index 54eabfb2..1d189e15 100644 --- a/includes/lib/transifex-live-integration-javascript.php +++ b/includes/lib/transifex-live-integration-javascript.php @@ -38,9 +38,10 @@ class Transifex_Live_Integration_Javascript { * Public constructor, sets local settings * @param array $settings Associative array of plugin settings. */ - public function __construct( $settings ) { + public function __construct( $settings, $live_settings ) { Plugin_Debug::logTrace(); - $this->live_settings['api_key'] = $settings['api_key']; + $this->live_settings = $live_settings; // set defaults + $this->live_settings['api_key'] = $settings['api_key']; // add api key $this->lang = false; $this->source_language = $settings['source_language']; $this->language_map = $settings['language_map']; diff --git a/includes/transifex-live-integration-defaults.php b/includes/transifex-live-integration-defaults.php index 09be700a..49cdaa8b 100644 --- a/includes/transifex-live-integration-defaults.php +++ b/includes/transifex-live-integration-defaults.php @@ -56,15 +56,16 @@ static function get_options_text( $key ) { */ static function transifex_settings() { return [ - 'settings' => null, - 'picker' => 'no-picker', - 'domain' => 'wpliveplugin.onpressidium.com', - 'ignore_tags' => [ ], - 'autocollect' => false, - 'parse_attr' => [ ], - 'dynamic' => false, - 'detectlang' => false, - 'ignore_class' => [ ] + //'settings' => null, + //'picker' => 'no-picker', + //'domain' => '', + //'ignore_tags' => [ ], + //'autocollect' => false, + //'parse_attr' => [ ], + //'dynamic' => false, + //'detectlang' => false, + //'ignore_class' => [ ], + 'wp' => true ]; } diff --git a/includes/transifex-live-integration-static-factory.php b/includes/transifex-live-integration-static-factory.php index 751e93c3..270b8ee4 100644 --- a/includes/transifex-live-integration-static-factory.php +++ b/includes/transifex-live-integration-static-factory.php @@ -41,7 +41,7 @@ static function create_hreflang( $settings, $rewrite_options ) { * @return object/false Returns new onject or false */ - static function create_live_snippet( $settings ) { + static function create_live_snippet( $settings, $live_settings ) { Plugin_Debug::logTrace(); if ( !isset( $settings['api_key'] ) ) { @@ -50,7 +50,7 @@ static function create_live_snippet( $settings ) { } include_once TRANSIFEX_LIVE_INTEGRATION_DIRECTORY_BASE . '/includes/lib/transifex-live-integration-javascript.php'; - return new Transifex_Live_Integration_Javascript( $settings ); + return new Transifex_Live_Integration_Javascript( $settings, $live_settings ); } /** diff --git a/readme.md b/readme.md index 7b4849cb..64791772 100755 --- a/readme.md +++ b/readme.md @@ -115,4 +115,6 @@ Patch for Prerender logic Added additional Prerender options for caching = 1.3.3 = -A few minor fixes. Revised admin UI \ No newline at end of file +A few minor fixes. Revised admin UI + += 1.3.4 = diff --git a/readme.txt b/readme.txt index 71313269..219f3528 100755 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Name: Transifex Live Translation Plugin Contributors: txmatthew, ThemeBoy, brooksx Tags: transifex, translate, translations, localize, localise, localization, localisation, multilingual, t9n, l10n, i18n, language, switcher, live, translation, translator Requires at least: 3.5.2 -Tested up to: 4.5 -Stable tag: 1.3.3 +Tested up to: 4.5.2 +Stable tag: 1.3.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -123,4 +123,6 @@ Patch for Prerender logic Added additional Prerender options for caching = 1.3.3 = -A few minor fixes. Revised admin UI \ No newline at end of file +A few minor fixes. Revised admin UI + += 1.3.4 = diff --git a/transifex-live-integration-main.php b/transifex-live-integration-main.php index e021e79e..0b947525 100755 --- a/transifex-live-integration-main.php +++ b/transifex-live-integration-main.php @@ -22,6 +22,7 @@ static function do_plugin( $is_admin, $version ) { $settings = Transifex_Live_Integration_Defaults::settings(); } + $live_settings = Transifex_Live_Integration_Defaults::transifex_settings(); $debug_mode = ($settings['debug']) ? true : false; require_once TRANSIFEX_LIVE_INTEGRATION_DIRECTORY_BASE . '/includes/common/plugin-debug.php'; @@ -71,7 +72,7 @@ static function do_plugin( $is_admin, $version ) { add_filter( 'query_vars', [ 'Transifex_Live_Integration_Util', 'query_vars_hook' ] ); - $live_snippet = Transifex_Live_Integration_Static_Factory::create_live_snippet( $settings ); + $live_snippet = Transifex_Live_Integration_Static_Factory::create_live_snippet( $settings, $live_settings ); if ( $live_snippet ) { // We need to wait until wp is setup to retrieve query var add_action( 'wp', [ $live_snippet, 'wp_hook' ] ); diff --git a/transifex-live-integration.php b/transifex-live-integration.php index db903544..c5e89fc8 100755 --- a/transifex-live-integration.php +++ b/transifex-live-integration.php @@ -5,13 +5,13 @@ * * @link http://docs.transifex.com/developer/integrations/wordpress * @package TransifexLiveIntegration - * @version 1.3.3 + * @version 1.3.4 * * @wordpress-plugin * Plugin Name: Transifex Live Translation Plugin * Plugin URI: http://docs.transifex.com/developer/integrations/wordpress * Description: Translate your WordPress website or blog without the usual complex setups. - * Version: 1.3.3 + * Version: 1.3.4 * License: GNU General Public License * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Text Domain: transifex-live-integration @@ -75,7 +75,7 @@ } define( 'LANG_PARAM', 'lang' ); -$version = '1.3.3'; +$version = '1.3.4'; require_once( dirname( __FILE__ ) . '/transifex-live-integration-main.php' ); Transifex_Live_Integration::do_plugin( is_admin(), $version ); From bcbc73a2d8844e8ac8b61b935e22484569d4c454 Mon Sep 17 00:00:00 2001 From: Matthew Jackowski Date: Mon, 23 May 2016 22:01:21 -0700 Subject: [PATCH 2/4] Removed unneeded checkbox logic --- includes/admin/transifex-live-integration-admin.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/admin/transifex-live-integration-admin.php b/includes/admin/transifex-live-integration-admin.php index ce0d11f4..31302a7c 100644 --- a/includes/admin/transifex-live-integration-admin.php +++ b/includes/admin/transifex-live-integration-admin.php @@ -105,10 +105,6 @@ static function options_page() { checked( $settings['static_frontpage_support'], 1 ); $checked_static_frontpage_support = ob_get_clean(); - ob_start(); - checked( $settings['enable_seo'], 1 ); - $checked_enable_seo = ob_get_clean(); - // These are used by the template: DO NOT REMOVE - Mjj 2/22/2016 $languages = [ ]; if ( $settings['transifex_languages'] !== '' ) { From ddfef27d4b377f19bd42a219b55b70be8ec853b1 Mon Sep 17 00:00:00 2001 From: Matthew Jackowski Date: Mon, 23 May 2016 22:43:40 -0700 Subject: [PATCH 3/4] fixed missing settings from defaults --- includes/admin/transifex-live-integration-admin.php | 1 + includes/transifex-live-integration-defaults.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/admin/transifex-live-integration-admin.php b/includes/admin/transifex-live-integration-admin.php index 31302a7c..d103f40c 100644 --- a/includes/admin/transifex-live-integration-admin.php +++ b/includes/admin/transifex-live-integration-admin.php @@ -75,6 +75,7 @@ static function options_page() { } $transifex_settings = self::load_transifex_settings(); + $transifex_settings_settings = $transifex_settings['settings']; ob_start(); diff --git a/includes/transifex-live-integration-defaults.php b/includes/transifex-live-integration-defaults.php index 49cdaa8b..6843484e 100644 --- a/includes/transifex-live-integration-defaults.php +++ b/includes/transifex-live-integration-defaults.php @@ -56,7 +56,7 @@ static function get_options_text( $key ) { */ static function transifex_settings() { return [ - //'settings' => null, + 'settings' => '', //'picker' => 'no-picker', //'domain' => '', //'ignore_tags' => [ ], From 9ab4c59c2c79a0718b36d0699f296cf1066c4f1e Mon Sep 17 00:00:00 2001 From: Matthew Jackowski Date: Mon, 23 May 2016 23:35:34 -0700 Subject: [PATCH 4/4] defaulting to strings --- includes/admin/transifex-live-integration-admin.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/admin/transifex-live-integration-admin.php b/includes/admin/transifex-live-integration-admin.php index d103f40c..2a11cf93 100644 --- a/includes/admin/transifex-live-integration-admin.php +++ b/includes/admin/transifex-live-integration-admin.php @@ -107,12 +107,12 @@ static function options_page() { $checked_static_frontpage_support = ob_get_clean(); // These are used by the template: DO NOT REMOVE - Mjj 2/22/2016 - $languages = [ ]; + $languages = ''; if ( $settings['transifex_languages'] !== '' ) { $languages = $settings['transifex_languages']; } - $languages_regex = [ ]; + $languages_regex = ''; if ( $settings['languages_regex'] !== '' ) { $languages_regex = $settings['languages_regex']; } @@ -127,7 +127,7 @@ static function options_page() { $language_lookup = $settings['language_lookup']; } - $language_map = [ ]; + $language_map = ''; if ( $settings['language_map'] !== '' ) { $language_map = $settings['language_map']; }