Skip to content

Commit

Permalink
Merge branch 'devel' of github.com:transifex/transifex-live-wordpress
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Jackowski committed Apr 8, 2016
2 parents 3107aa9 + abd41db commit d1a2082
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</td></tr>
</tbody>
</table>
<input type="hidden" id="transifex_live_settings_enable_prerender_check" name="transifex_live_settings[enable_prerender_check]" value="1" <?php echo $checked_enable_prerender_check ?> />
<input type="hidden" id="transifex_live_settings_enable_prerender_check" name="transifex_live_settings[enable_prerender_check]" value="<?php echo $enable_prerender_check ?>" />
<input name="transifex_live_settings[enable_custom_urls]" id="transifex_live_settings_custom_urls" type="hidden" value="<?php echo $checked_custom_urls ?>" >
<input type="hidden" value="<?php echo htmlentities( stripslashes( $language_map ) ) ?>" name="transifex_live_settings[language_map]" id="transifex_live_settings_language_map" />
<input type="hidden" value="<?php echo htmlentities( stripslashes( $transifex_settings_settings ) ) ?>" name="transifex_live_transifex_settings[settings]" id="transifex_live_transifex_settings_settings" />
Expand Down
4 changes: 1 addition & 3 deletions includes/admin/transifex-live-integration-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ static function options_page() {
checked( $settings['enable_prerender'], 1 );
$checked_enable_prerender = ob_get_clean();

ob_start();
checked( $settings['enable_prerender_check'], 1 );
$checked_enable_prerender_check = ob_get_clean();
$enable_prerender_check = $settings['enable_prerender_check'];

ob_start();
checked( $settings['static_frontpage_support'], 1 );
Expand Down
12 changes: 8 additions & 4 deletions includes/lib/transifex-live-integration-prerender.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ class Transifex_Live_Integration_Prerender {
* Overrides check for prerender header
* @var bool
*/
private $override_prerender_check;
private $enable_prerender_check;

/*
* Constructor
* @param string $prerender_url Url to prerender service
* @param bool $override_prerender_check Overrides check for prerender header
*/

public function __construct( $prerender_url, $override_prerender_check ) {
public function __construct( $prerender_url, $enable_prerender_check ) {
Plugin_Debug::logTrace();
$this->prerender_url = $prerender_url;
$this->override_prerender_check = ($override_prerender_check) ? true : false;
$this->enable_prerender_check = ($enable_prerender_check) ? true : false;
}

/*
Expand Down Expand Up @@ -95,8 +95,12 @@ function callback( $buffer ) {
$header = substr( $curl_response['response'], 0, $curl_response['header_size'] );
$body = substr( $curl_response['response'], $curl_response['header_size'] );
$header_lowercase = strtolower($header);
if ( strpos( $header_lowercase, 'x-prerender-req' ) && $this->enable_prerender_check ) {
$header_prerender_check = (strpos( $header_lowercase, 'x-prerender-req' ))?true:false;
$debug_html .= 'X-Prerender-Req Header check:'. $header_prerender_check . "\n";
$debug_html .= 'Check enabled:'.$this->enable_prerender_check."\n";
if ( $header_prerender_check && $this->enable_prerender_check ) {
$output = ($curl_response['response'])?$body:$output;
$debug_html .= 'Buffer swapped with prerender response.'."\n";
}
$debug_html .= $curl_response['url'] . "\n";
$debug_html .= $header."\n";
Expand Down
4 changes: 2 additions & 2 deletions includes/transifex-live-integration-static-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ static function create_prerender( $settings ) {

include_once TRANSIFEX_LIVE_INTEGRATION_DIRECTORY_BASE . '/includes/lib/transifex-live-integration-prerender.php';
$check = Transifex_Live_Integration_Util::prerender_check( $agent, $req_escaped_fragment, $settings['generic_bot_types'], $settings['whitelist_crawlers'] );
$override_prerender_check = (isset($settings['override_prerender_check']))?true:false;
return ($check) ? new Transifex_Live_Integration_Prerender( $settings['prerender_url'], $override_prerender_check ) : false;
$enable_prerender_check = (isset($settings['enable_prerender_check']))?true:false;
return ($check) ? new Transifex_Live_Integration_Prerender( $settings['prerender_url'], $enable_prerender_check ) : false;
}

}
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,7 @@ Additional admin API key validation

= 1.3.0 =
Added Prerendering capability
Fixed some timing issues with the WP loop
Fixed some timing issues with the WP loop

= 1.3.1 =
Patch for Prerender logic
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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.4.2
Stable tag: 1.2.5
Stable tag: 1.3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -114,4 +114,7 @@ Additional admin API key validation

= 1.3.0 =
Added Prerendering capability
Fixed some timing issues with the WP loop
Fixed some timing issues with the WP loop

= 1.3.1 =
Patch for Prerender logic
6 changes: 3 additions & 3 deletions transifex-live-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*
* @link http://docs.transifex.com/developer/integrations/wordpress
* @package TransifexLiveIntegration
* @version 1.3.0
* @version 1.3.1
*
* @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.0
* Version: 1.3.1
* License: GNU General Public License
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: transifex-live-integration
Expand Down Expand Up @@ -75,7 +75,7 @@
}

define( 'LANG_PARAM', 'lang' );
$version = '1.3.0';
$version = '1.3.1';

require_once( dirname( __FILE__ ) . '/transifex-live-integration-main.php' );
Transifex_Live_Integration::do_plugin( is_admin(), $version );

0 comments on commit d1a2082

Please sign in to comment.