Changeset 2199347
- Timestamp:
- 11/23/2019 09:14:56 AM (6 years ago)
- Location:
- dokan-wpml/trunk
- Files:
-
- 3 edited
-
dokan-wpml.php (modified) (7 diffs)
-
languages/dokan-wpml.pot (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dokan-wpml/trunk/dokan-wpml.php
r2109217 r2199347 4 4 Plugin URI: https://wedevs.com/ 5 5 Description: WPML and Dokan compitable package 6 Version: 1.0. 16 Version: 1.0.2 7 7 Author: weDevs 8 8 Author URI: https://wedevs.com/ 9 Text Domain: dokan-wpml 10 WC requires at least: 3.0 11 WC tested up to: 3.8.0 12 Domain Path: /languages/ 9 13 License: GPL2 10 14 */ … … 74 78 add_filter( 'dokan_get_navigation_url', array( $this, 'load_translated_url' ), 10 ,2 ); 75 79 add_filter( 'body_class', array( $this, 'add_dashboard_template_class_if_wpml' ), 99 ); 80 add_filter( 'dokan_get_current_page_id', [ $this, 'dokan_set_current_page_id' ] ); 76 81 } 77 82 … … 147 152 */ 148 153 function load_translated_url( $url, $name ) { 149 if ( function_exists('wpml_object_id_filter') ) { 150 $page_id = dokan_get_option( 'dashboard', 'dokan_pages' ); 151 152 if ( ! empty( $name ) ) { 153 $url = $this->get_dokan_url_for_language( ICL_LANGUAGE_CODE ).$name.'/'; 154 } else { 155 $url = $this->get_dokan_url_for_language( ICL_LANGUAGE_CODE ); 156 } 154 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 157 155 return $url; 158 156 } 159 157 158 if ( ! empty( $name ) ) { 159 $url = $this->get_dokan_url_for_language( ICL_LANGUAGE_CODE ).$name.'/'; 160 } else { 161 $url = $this->get_dokan_url_for_language( ICL_LANGUAGE_CODE ); 162 } 163 160 164 return $url; 161 165 } … … 169 173 **/ 170 174 public function reflect_page_url( $url, $page_id, $context ) { 175 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 176 return $url; 177 } 178 179 $page_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE ); 180 181 return get_permalink( $page_id ); 182 } 183 184 /** 185 * Get terms and condition page url 186 * 187 * @since 1.0.1 188 * 189 * @return url 190 **/ 191 public function get_terms_condition_url( $url, $page_id ) { 192 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 193 return $url; 194 } 195 196 $page_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE ); 197 198 return get_permalink( $page_id ); 199 } 200 201 /** 202 * Redirect if not login 203 * 204 * @since 1.0.1 205 * 206 * @return void 207 **/ 208 public function redirect_if_not_login( $url ) { 209 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 210 return $url; 211 } 212 213 $page_id = wc_get_page_id( 'myaccount' ); 171 214 $lang_post_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE ); 215 172 216 return get_permalink( $lang_post_id ); 173 217 } 174 218 175 219 /** 176 * Get terms and condition page url220 * undocumented function 177 221 * 178 222 * @since 1.0.1 179 223 * 180 * @return url181 **/182 public function get_terms_condition_url( $url, $page_id ) {183 $page_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE );184 185 return get_permalink( $page_id );186 }187 188 /**189 * Redirect if not login190 *191 * @since 1.0.1192 *193 224 * @return void 194 225 **/ 195 public function redirect_if_not_login( $url ) {196 $page_id = wc_get_page_id( 'myaccount' );197 $lang_post_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE );198 return get_permalink( $lang_post_id );199 }200 201 /**202 * undocumented function203 *204 * @since 1.0.1205 *206 * @return void207 **/208 226 public function force_redirect_page( $flag, $page_id ) { 227 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 228 return false; 229 } 230 209 231 $lang_post_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE ); 210 232 … … 226 248 */ 227 249 public function get_dokan_url_for_language( $language ) { 228 $post_id = dokan_get_option( 'dashboard', 'dokan_pages' ); 229 $lang_post_id = wpml_object_id_filter( $post_id , 'page', true, $language ); 250 $post_id = $this->get_raw_option( 'dashboard', 'dokan_pages' ); 251 $lang_post_id = ''; 252 253 if ( function_exists( 'wpml_object_id_filter' ) ) { 254 $lang_post_id = wpml_object_id_filter( $post_id , 'page', true, $language ); 255 } 230 256 231 257 $url = ""; 232 if ($lang_post_id != 0) { 258 259 if ( $lang_post_id != 0 ) { 233 260 $url = get_permalink( $lang_post_id ); 234 261 } else { 235 // No page found, it's most likely the homepage236 262 $url = apply_filters( 'wpml_home_url', get_option( 'home' ) ); 237 238 } 263 } 264 239 265 return $url; 240 266 } … … 248 274 */ 249 275 public function add_dashboard_template_class_if_wpml( $classes ) { 250 if ( function_exists('wpml_object_id_filter') ) { 251 global $post; 252 253 if( !$post ) { 254 return $classes; 255 } 256 257 $default_lang = apply_filters('wpml_default_language', NULL ); 258 259 $current_page_id = wpml_object_id_filter( $post->ID,'page',false, $default_lang ); 260 $page_id = dokan_get_option( 'dashboard', 'dokan_pages' ); 261 262 if ( ( $current_page_id == $page_id ) ) { 263 $classes[] = 'dokan-dashboard'; 264 } 265 } 276 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 277 return $classes; 278 } 279 280 global $post; 281 282 if ( ! is_object( $post ) ) { 283 return $classes; 284 } 285 286 $page_id = $this->get_raw_option( 'dashboard', 'dokan_pages' ); 287 $current_page_id = wpml_object_id_filter( $post->ID, 'page', true, wpml_get_default_language() ); 288 289 if ( ( $current_page_id == $page_id ) ) { 290 $classes[] = 'dokan-dashboard'; 291 } 292 266 293 return $classes; 267 294 } … … 275 302 */ 276 303 public function load_scripts_and_style() { 277 if ( function_exists('wpml_object_id_filter') ) { 278 global $post; 279 280 if( !$post ) { 281 return false; 282 } 283 284 $default_lang = apply_filters('wpml_default_language', NULL ); 285 $current_page_id = wpml_object_id_filter( $post->ID,'page',false, $default_lang ); 286 $page_id = dokan_get_option( 'dashboard', 'dokan_pages' ); 287 288 if ( ( $current_page_id == $page_id ) || ( get_query_var( 'edit' ) && is_singular( 'product' ) ) ) { 289 return true; 290 } 291 } 292 293 return false; 304 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 305 return false; 306 } 307 308 global $post; 309 310 if ( ! is_object( $post ) ) { 311 return false; 312 } 313 314 $page_id = $this->get_raw_option( 'dashboard', 'dokan_pages' ); 315 $current_page_id = wpml_object_id_filter( $post->ID, 'page', true, wpml_get_default_language() ); 316 317 if ( ( $current_page_id == $page_id ) || ( get_query_var( 'edit' ) && is_singular( 'product' ) ) ) { 318 return true; 319 } 320 } 321 322 /** 323 * Dokan set current page id 324 * 325 * @since 1.0.2 326 * 327 * @param int page_id 328 * 329 * @return int 330 */ 331 public function dokan_set_current_page_id( $page_id ) { 332 if ( ! function_exists( 'wpml_object_id_filter' ) ) { 333 return $page_id; 334 } 335 336 return wpml_object_id_filter( $page_id, 'page', true, wpml_get_default_language() ); 337 } 338 339 /** 340 * Get raw value from database 341 * 342 * @since DOKAN_WPML_SINCE 343 * 344 * @param string $option 345 * @param string $section 346 * @param mix $default 347 * 348 * @return mix 349 */ 350 public function get_raw_option( $option, $section, $default = '' ) { 351 if ( ! class_exists( 'WPML_Multilingual_Options_Utils' ) ) { 352 return dokan_get_option( $option, $section, $default ); 353 } 354 355 global $wpdb; 356 357 $util = new WPML_Multilingual_Options_Utils( $wpdb ); 358 $options = $util->get_option_without_filtering( $section ); 359 360 return isset( $options[ $option ] ) ? $options[ $option ] : $default; 294 361 } 295 362 -
dokan-wpml/trunk/languages/dokan-wpml.pot
r2109217 r2199347 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Dokan - WPML Integration 1.0. 1\n"5 "Project-Id-Version: Dokan - WPML Integration 1.0.2\n" 6 6 "Report-Msgid-Bugs-To: http://wedevs.com/support/\n" 7 "POT-Creation-Date: 2019- 06-20 03:55:12+00:00\n"7 "POT-Creation-Date: 2019-11-23 09:12:29+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=utf-8\n" … … 14 14 "X-Generator: grunt-wp-i18n 0.4.9\n" 15 15 16 #: dokan-wpml.php:1 0516 #: dokan-wpml.php:110 17 17 msgid "" 18 18 "<b>Dokan - WPML Integration</b> requires %sDokan plugin%s to be installed & " … … 20 20 msgstr "" 21 21 22 #: dokan-wpml.php:11 122 #: dokan-wpml.php:116 23 23 msgid "" 24 24 "<b>Dokan - WPML Integration</b> requires %sWPML Multilingual CMS%s to be " -
dokan-wpml/trunk/readme.txt
r2109217 r2199347 4 4 Donate link: https://tareq.co/donate 5 5 Requires at least: 4.7 6 Tested up to: 5. 2.26 Tested up to: 5.3.0 7 7 WC requires at least: 3.0 8 WC tested up to: 3. 6.48 WC tested up to: 3.8.0 9 9 Requires PHP: 5.6 10 10 Stable tag: trunk … … 53 53 == Changelog == 54 54 55 v1.0.2 -> November 23, 2019 56 --------------------------- 57 - [Fix] Color customizer and order page is not loading 58 - [Fix] Undefined function calling error 59 - [Fix] wpml is not working when string translation is enabled 60 - [Tweak] Add get_raw_option functions for getting raw value from database 61 55 62 v1.0.1 -> June 20, 2019 56 63 ------------------------
Note: See TracChangeset
for help on using the changeset viewer.