Plugin Directory

Changeset 2199347


Ignore:
Timestamp:
11/23/2019 09:14:56 AM (6 years ago)
Author:
sabbir1991
Message:

Deploy version 1.0.2

Location:
dokan-wpml/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • dokan-wpml/trunk/dokan-wpml.php

    r2109217 r2199347  
    44Plugin URI: https://wedevs.com/
    55Description: WPML and Dokan compitable package
    6 Version: 1.0.1
     6Version: 1.0.2
    77Author: weDevs
    88Author URI: https://wedevs.com/
     9Text Domain: dokan-wpml
     10WC requires at least: 3.0
     11WC tested up to: 3.8.0
     12Domain Path: /languages/
    913License: GPL2
    1014*/
     
    7478        add_filter( 'dokan_get_navigation_url', array( $this, 'load_translated_url' ), 10 ,2 );
    7579        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' ] );
    7681    }
    7782
     
    147152     */
    148153    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' ) ) {
    157155            return $url;
    158156        }
    159157
     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
    160164        return $url;
    161165    }
     
    169173    **/
    170174    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' );
    171214        $lang_post_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE );
     215
    172216        return get_permalink( $lang_post_id );
    173217    }
    174218
    175219    /**
    176     * Get terms and condition page url
     220    * undocumented function
    177221    *
    178222    * @since 1.0.1
    179223    *
    180     * @return url
    181     **/
    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 login
    190     *
    191     * @since 1.0.1
    192     *
    193224    * @return void
    194225    **/
    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 function
    203     *
    204     * @since 1.0.1
    205     *
    206     * @return void
    207     **/
    208226    public function force_redirect_page( $flag, $page_id ) {
     227        if ( ! function_exists( 'wpml_object_id_filter' ) ) {
     228            return false;
     229        }
     230
    209231        $lang_post_id = wpml_object_id_filter( $page_id , 'page', true, ICL_LANGUAGE_CODE );
    210232
     
    226248     */
    227249    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        }
    230256
    231257        $url = "";
    232         if ($lang_post_id != 0) {
     258
     259        if ( $lang_post_id != 0 ) {
    233260            $url = get_permalink( $lang_post_id );
    234261        } else {
    235             // No page found, it's most likely the homepage
    236262            $url = apply_filters( 'wpml_home_url', get_option( 'home' ) );
    237 
    238         }
     263        }
     264
    239265        return $url;
    240266    }
     
    248274     */
    249275    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
    266293        return $classes;
    267294    }
     
    275302     */
    276303    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;
    294361    }
    295362
  • dokan-wpml/trunk/languages/dokan-wpml.pot

    r2109217 r2199347  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Dokan - WPML Integration 1.0.1\n"
     5"Project-Id-Version: Dokan - WPML Integration 1.0.2\n"
    66"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"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
     
    1414"X-Generator: grunt-wp-i18n 0.4.9\n"
    1515
    16 #: dokan-wpml.php:105
     16#: dokan-wpml.php:110
    1717msgid ""
    1818"<b>Dokan - WPML Integration</b> requires %sDokan plugin%s to be installed & "
     
    2020msgstr ""
    2121
    22 #: dokan-wpml.php:111
     22#: dokan-wpml.php:116
    2323msgid ""
    2424"<b>Dokan - WPML Integration</b> requires %sWPML Multilingual CMS%s to be "
  • dokan-wpml/trunk/readme.txt

    r2109217 r2199347  
    44Donate link: https://tareq.co/donate
    55Requires at least: 4.7
    6 Tested up to: 5.2.2
     6Tested up to: 5.3.0
    77WC requires at least: 3.0
    8 WC tested up to: 3.6.4
     8WC tested up to: 3.8.0
    99Requires PHP: 5.6
    1010Stable tag: trunk
     
    5353== Changelog ==
    5454
     55v1.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
    5562v1.0.1 -> June 20, 2019
    5663------------------------
Note: See TracChangeset for help on using the changeset viewer.