Changeset 103
- Timestamp:
- 03/26/2009 09:52:04 AM (3 years ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 1 added
- 3 edited
-
globals.php (added)
-
parser.php (modified) (3 diffs)
-
transposh.php (modified) (7 diffs)
-
transposh_widget.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/parser.php
r93 r103 26 26 require_once("logging.php"); 27 27 require_once("constants.php"); 28 29 //The language to which the current page will be translated to. 30 $lang; 28 require_once("globals.php"); 31 29 32 30 //The html page which starts contains the content being translated … … 45 43 $tr_mark = 0; 46 44 47 //Is the current use is in edit mode.48 $is_edit_mode = FALSE;49 50 45 //Segment identifier within tags (span/img) mainly for use by js code on the client 51 46 $segment_id = 0; … … 56 51 //Is current position within the channel tag, i.e. RSS feed 57 52 $is_in_channel = FALSE; 58 59 //Indicates whether automatic translation (i.e. google) is enabled for this page60 $enable_auto_translate;61 53 62 54 /* -
trunk/WordPress/plugin/transposh/transposh.php
r102 r103 29 29 require_once("logging.php"); 30 30 require_once("constants.php"); 31 require_once("globals.php"); 31 32 require_once("transposh_db.php"); 32 33 require_once("parser.php"); … … 34 35 require_once("transposh_admin.php"); 35 36 36 //37 // Global variables38 //39 40 //Home url of the blog41 $home_url;42 43 //Home url of the blog - already quoted and ready for regex44 $home_url_quoted;45 46 //The url pointing to the base of the plugin47 $plugin_url;48 49 37 //Error message displayed for the admin in case of failure 50 38 $admin_msg; … … 110 98 function process_anchor_tag($start, $end) 111 99 { 112 global $home_url, $home_url_quoted, $lang, $is_edit_mode, $ wp_rewrite;100 global $home_url, $home_url_quoted, $lang, $is_edit_mode, $enable_permalinks_rewrite; 113 101 114 102 $href = get_attribute($start, $end, 'href'); … … 125 113 } 126 114 127 $use_params = FALSE;115 $use_params = !$enable_permalinks_rewrite; 128 116 129 117 //Only use params if permalinks are not enabled. 130 118 //don't fix links pointing to real files as it will cause that the 131 119 //web server will not be able to locate them 132 if(!$wp_rewrite->using_permalinks() || 133 stripos($href, '/wp-admin') !== FALSE || 134 stripos($href, '/wp-content') !== FALSE || 135 stripos($href, '/wp-login') !== FALSE || 136 stripos($href, '/.php') !== FALSE) 120 if(stripos($href, '/wp-admin') !== FALSE || 121 stripos($href, '/wp-content') !== FALSE || 122 stripos($href, '/wp-login') !== FALSE || 123 stripos($href, '/.php') !== FALSE) 137 124 { 138 125 $use_params = TRUE; … … 153 140 * param use_params_only - use only parameters as modifiers, i.e. not permalinks 154 141 */ 155 function rewrite_url_lang_param($url, $lang, $is_edit, $use_params_only )156 { 157 global $home_url, $home_url_quoted ;158 159 if(! get_option(ENABLE_PERMALINKS_REWRITE))142 function rewrite_url_lang_param($url, $lang, $is_edit, $use_params_only=FALSE) 143 { 144 global $home_url, $home_url_quoted, $enable_permalinks_rewrite; 145 146 if(!$enable_permalinks_rewrite) 160 147 { 161 148 //override the use only params - admin configured system to not touch permalinks … … 233 220 function init_global_vars() 234 221 { 235 global $home_url, $home_url_quoted, $plugin_url, $enable_auto_translate; 222 global $home_url, $home_url_quoted, $plugin_url, $enable_auto_translate, 223 $enable_permalinks_rewrite, $wp_rewrite; 236 224 237 225 $home_url = get_option('home'); … … 243 231 244 232 $enable_auto_translate = get_option(ENABLE_AUTO_TRANSLATE,1) && is_translator(); 233 234 if($wp_rewrite->using_permalinks() && get_option(ENABLE_PERMALINKS_REWRITE)) 235 { 236 $enable_permalinks_rewrite = TRUE; 237 } 245 238 } 246 239 -
trunk/WordPress/plugin/transposh/transposh_widget.php
r92 r103 35 35 logger("Enter " . __METHOD__, 4); 36 36 37 global $wp_rewrite;38 39 37 $ref=getenv('HTTP_REFERER'); 40 38 $lang = $_POST[LANG_PARAM]; … … 45 43 if($lang != "none") 46 44 { 47 $use_params_only = !$wp_rewrite->using_permalinks();48 45 $is_edit = $_POST[EDIT_PARAM]; 49 50 $ref = rewrite_url_lang_param($ref, $lang, $is_edit, $use_params_only); 46 $ref = rewrite_url_lang_param($ref, $lang, $is_edit); 51 47 } 52 48 … … 83 79 { 84 80 logger("Enter " . __METHOD__, 4); 85 global $languages, $wp_query, $ wp_rewrite, $plugin_url;81 global $languages, $wp_query, $plugin_url; 86 82 extract($args); 87 83 … … 109 105 echo "<div style=\"text-align: left;\" class=\"" . NO_TRANSLATE_CLASS . "\" >"; 110 106 111 $using_permalinks = $wp_rewrite->using_permalinks(); 112 113 foreach($languages as $code => $lang2) 107 foreach($languages as $code => $lang2) 114 108 { 115 109 list($language,$flag) = explode (",",$lang2); … … 122 116 ($is_translator && strstr($editable_langs, $code))) 123 117 { 124 //$page_url = cleanup_url($page_url); 125 $page_url2 = rewrite_url_lang_param($page_url, $code, $is_edit, !$using_permalinks); 118 $page_url2 = rewrite_url_lang_param($page_url, $code, $is_edit); 126 119 127 120 echo "<a href=\"" . $page_url2 . "\">".
Note: See TracChangeset
for help on using the changeset viewer.
