Changeset 1602135
- Timestamp:
- 02/23/2017 01:29:08 PM (9 years ago)
- Location:
- bablic
- Files:
-
- 6 added
- 2 edited
-
tags/2.4 (added)
-
tags/2.4/Bablic.php (added)
-
tags/2.4/lang (added)
-
tags/2.4/lang/Bablic-en_US.po (added)
-
tags/2.4/readme.txt (added)
-
tags/2.4/sdk.php (added)
-
trunk/Bablic.php (modified) (5 diffs)
-
trunk/sdk.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bablic/trunk/Bablic.php
r1529702 r1602135 4 4 class wp_store { 5 5 public function get($key){ 6 return get_option($key); 6 $value = get_option('bablic.'.$key); 7 if(empty($value)){ 8 $value = get_option($key); 9 if(!empty($value)){ 10 update_option('bablic.'.$key, $value); 11 delete_option($key); 12 } 13 } 14 return $value; 7 15 } 8 16 public function set($key, $value){ 9 update_option( $key, $value);17 update_option('bablic.'.$key, $value); 10 18 } 11 19 } … … 16 24 Plugin URI: https://www.bablic.com/docs#wordpress' 17 25 Description: Integrates your site with Bablic localization cloud service. 18 Version: 2. 326 Version: 2.4 19 27 Author: Ishai Jaffe 20 28 Author URI: https://www.bablic.com … … 33 41 var $bablic_version = '3.3'; 34 42 var $query_var = 'bablic_locale'; 35 var $bablic_plugin_version = '2. 2.5';43 var $bablic_plugin_version = '2.4.0'; 36 44 37 45 … … 295 303 296 304 function addAdminScripts($hook_suffix){ 297 wp_enqueue_style('bablic-admin-css','//cdn2.bablic.com/addons/wp2 .css');298 wp_enqueue_script('bablic-admin-sdk','//cdn2.bablic.com/addons/wp2 .js');305 wp_enqueue_style('bablic-admin-css','//cdn2.bablic.com/addons/wp24.css'); 306 wp_enqueue_script('bablic-admin-sdk','//cdn2.bablic.com/addons/wp24.js'); 299 307 } 300 308 … … 326 334 $site = $this->sdk->get_site(); 327 335 ?> 328 <div class="bablic-wp"> 329 <h2>Bablic</h2> 330 <label >336 <div class="bablic-wp tw-bs" id="bablic_all"> 337 338 <label id="bablic-subdir"> 331 339 <input type="checkbox" id="bablic_dont_permalink" <?php checked( 'no', $options['dont_permalink'], true ) ?> > Generate sub-directory urls (for example: /es/, /fr/about, ...) 332 340 </label> 333 <div style="display:none;"> 334 <?php if(isset($options['uninstalled']) && $options['uninstalled'] == '1') echo '<input type="hidden" id="bablic_was_uninstalled" />' ?> 335 <input type="hidden" value="<?php echo $site['site_id'] ?>" id="bablic_site_id" /> 336 <input type="hidden" value="<?php echo $site['access_token'] ?>" id="bablic_access_token" /> 337 <textarea id="bablic_item_meta"><?php echo $site['meta'] ?></textarea> 338 <input type="hidden" value="<?php echo ($site['trial_started'] ? '1' : '') ?>" id="bablic_trial" /> 339 </div> 340 <div id="bablic_form"></div> 341 342 <div style="display:none;"> 343 <?php if(isset($options['uninstalled']) && $options['uninstalled'] == '1') echo '<input type="hidden" id="bablic_was_uninstalled" />' ?> 344 <input type="hidden" value="<?php echo $site['site_id'] ?>" id="bablic_site_id" /> 345 <input type="hidden" value="<?php echo $site['access_token'] ?>" id="bablic_access_token" /> 346 <textarea id="bablic_item_meta"><?php echo $site['meta'] ?></textarea> 347 <input type="hidden" value="<?php echo ($site['trial_started'] ? '1' : '') ?>" id="bablic_trial" /> 341 348 </div> 342 349 <div id="bablic-register-step"> 350 <div class='panel bablic_info'> 351 <img class='row' src="https://s.bablic.com/images/4/assets/logo-onwhite.png" alt="Bablic Website Translation"/> 352 <div class='info_container row'> 353 <h2 class='header row'> Do it yourself website translation - no programming required! </h2> 354 <h4 class='subheader row'>That's how it works: </h4> 355 <div class='left_side col-xs-12 col-md-6'> 356 <ol> 357 <li> <span> Select a language & instantly preview your translated site using machine translation </span> </li> 358 <li> <span> Edit/improve the machine translation or order professional human translation with just a click </span> </li> 359 <li> <span> Easily replace images & fix style/CSS issues in a user-friendly, in-context, visual editor </span> </li> 360 <li> <span> Customize the language selector color, position and style to match your Prestashop site's look and feel </span> </li> 361 <li> <span> Click Publish when ready to go live </span> </li> 362 </ol> 363 <div id='bablic_form'> </div> 364 </div> 365 <div class='right_side col-xs-12 col-md-6'> 366 <div><span></span> Reach new customers globally in a matter of minutes & increase sales</div> 367 <div><span></span> Start ranking on leading search engines for your new languages with Bablic's SEO-friendly solution</div> 368 <div><span></span> Immediately compete with the big guys using your fully localized Prestashop store</div> 369 <div><span></span> Free dedicated support on all plans</div> 370 </div> 371 </div> 372 <div class="clear"></div> 373 </div> 374 <div class="panel"> 375 <div class="panel-heading bablic"> 376 For more information visit <a href="https://www.bablic.com">Bablic.com</a> or contact us at <a href="mailto: [email protected]">[email protected]</a> 377 </div> 378 <div class="clear"></div> 379 </div> 380 </div> 381 </div> 343 382 <?php 344 383 -
bablic/trunk/sdk.php
r1529702 r1602135 59 59 private $version = ''; 60 60 private $meta = ''; 61 p rivate$trial_started = false;61 public $trial_started = false; 62 62 private $_body = ''; 63 63 private $pos = 0; 64 64 private $timestamp = 0; 65 private $use_snippet_url = false; 65 66 66 67 function __construct($options) { … … 94 95 } 95 96 } 97 if(isset($options['use_snippet_url'])) 98 $this->use_snippet_url = true; 96 99 } 97 100 … … 158 161 $payload = array( 159 162 'url' => $options['site_url'], 160 'email'=> $options['email'],161 'original' => $options['original_locale'],162 'callback' => $options['callback'],163 'email'=> isset($options['email']) ? $options['email'] : '', 164 'original' => isset($options['original_locale']) ? $options['original_locale'] : '', 165 'callback' => isset($options['callback']) ? $options['callback'] : '', 163 166 ); 164 167 $ch = curl_init($url); … … 177 180 $this->access_token = $result['access_token']; 178 181 $this->site_id = $result['id']; 179 $this->snippet = $ result['snippet'];182 $this->snippet = $this->use_snippet_url ? $result['snippetURL'] : $result['snippet']; 180 183 $this->version = $result['version']; 181 184 $this->trial_started = false; … … 203 206 $this->access_token = $result['access_token']; 204 207 $this->site_id = $result['id']; 205 $this->snippet = $ result['snippet'];208 $this->snippet = $this->use_snippet_url ? $result['snippetURL'] : $result['snippet']; 206 209 $this->version = $result['version']; 207 210 $this->trial_started = $result['trialStarted']; … … 223 226 array_map('unlink', glob("$folder/*")); 224 227 } 225 228 229 public function get_meta() { 230 return $this->meta; 231 } 226 232 public function get_site(){ 227 233 return array ( … … 343 349 344 350 public function get_link($locale, $url) { 351 if($url[0] != '/' && $url[0] != 'h') 352 return $url; 345 353 $parsed = parse_url($url); 346 354 $scheme = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : ''; … … 388 396 $locale_keys = $meta['localeKeys']; 389 397 $locale_regex = "(" . implode("|",$locale_keys) . ")"; 390 $path = preg_replace('/^'.preg_quote($this->subdir_base,'/').'\/'.$locale_regex.'\//','/',$path); 398 if($this->subdir_base != "") 399 $path = preg_replace('/^'.preg_quote($this->subdir_base,'/').'\//','/',$path); 400 $path = preg_replace('/^'.$locale_regex.'\//','/',$path); 391 401 $prefix = $locale == $meta['original'] ? '' : '/' . $locale; 392 402 return $scheme.$host.$port.$this->subdir_base.$prefix.$path.$query.$fragment; … … 453 463 case 'subdir': 454 464 $path = $parsed_url['path']; 455 preg_match("/^ ".preg_quote($this->subdir_base,'/')."(\/(\w\w(_\w\w)?))(?:\/|$)/", $path, $matches);465 preg_match("/^(?:".preg_quote($this->subdir_base,'/').")?(\/(\w\w(_\w\w)?))(?:\/|$)/", $path, $matches); 456 466 if ($matches) return $matches[2]; 457 467 if ($from_cookie)
Note: See TracChangeset
for help on using the changeset viewer.