Plugin Directory

Changeset 1466398


Ignore:
Timestamp:
08/02/2016 06:51:49 PM (10 years ago)
Author:
Rafael Mor
Message:

WPML Support.

Location:
pixelshop-integration/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pixelshop-integration/trunk/core/controllers/export.php

    r1325817 r1466398  
    101101                $products[$i] = array(
    102102                    "sync_id"       => $the_query->post->ID,
    103                     "link"          => wp_get_shortlink($the_query->post->ID),
     103                    "link"          => wp_get_shortlink($the_query->post->ID) . '&pixelshop=true',
    104104                    "title"         => get_the_title(),
    105105                    "description"   => get_the_excerpt(),
     
    134134                add_option( 'pixelshop_message', $export, '', 'yes' );
    135135
    136                 $time = 60*60*24;
    137 
    138                 if( get_option('pxs_last_export') === false )
    139                     add_option( 'pxs_last_export', time() + $time, '', 'no' );
    140                 else
    141                     update_option( 'pxs_last_export', time() + $time );
     136                // $time = 60*60*24;
     137
     138                // if( get_option('pxs_last_export') === false )
     139                    // add_option( 'pxs_last_export', time() + $time, '', 'no' );
     140                // else
     141                    // update_option( 'pxs_last_export', time() + $time );
    142142            }
    143143        }
  • pixelshop-integration/trunk/pixelshop.php

    r1325820 r1466398  
    44Plugin URI: http://pixelshop.io
    55Description: Wordpress plugin for pixelshop.io Integration.
    6 Version: 1.1.0
     6Version: 1.2.0
    77Author: Pixelshop
    88Author URI: http://pixelshop.io/
     
    192192        }
    193193    }
     194
     195
     196    /**
     197     * Get user location by IP
     198     * @return array user info
     199     */
     200    function get_user_location()
     201    {
     202        $source = "http://ip-api.com/json/" . $_SERVER['REMOTE_ADDR'];
     203
     204        $ch = curl_init();
     205
     206        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     207
     208        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     209
     210        curl_setopt($ch, CURLOPT_URL, $source);
     211
     212        $result = curl_exec($ch);
     213
     214        curl_close($ch);
     215
     216        return json_decode($result, true);
     217    }
    194218   
    195219   
     
    213237        {
    214238            include_once('core/controllers/export.php');
     239        }
     240        else
     241        {
     242            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     243
     244            if( isset($_GET['pixelshop']) && isset($_SERVER['REMOTE_ADDR']) && is_plugin_active('sitepress-multilingual-cms/sitepress.php') && function_exists('curl_version') )
     245            {
     246                $info = $this->get_user_location();
     247
     248                $post_id = intval($_GET['p']);
     249               
     250                if( isset($info['countryCode']) )
     251                {
     252                    if( $info['countryCode'] == 'IL' )
     253                    {
     254                        $translation = icl_object_id($post_id, 'post', false, 'he');
     255                    }
     256
     257                    if( $translation )
     258                    {
     259                        $url = get_permalink($translation);
     260
     261                        $_SERVER['REQUEST_URI'] = str_replace('pixelshop=true', '', $_SERVER['REQUEST_URI']);
     262
     263                        wp_redirect($url);
     264                    }
     265                }
     266            }
    215267        }
    216268
     
    274326        if( isset($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'api_key') )
    275327        {
    276             $api_key = get_option('api_key');
     328            $api_key = get_option('pixelshop_key');
    277329           
    278330            if( $api_key === false )
  • pixelshop-integration/trunk/readme.txt

    r1336930 r1466398  
    33Tags: pixelshop,
    44Requires at least: 3.5.0
    5 Tested up to: 4.4.1
     5Tested up to: 4.5.1
    66Stable tag: 4.4.3
    77License: GPLv2 or later
     
    3939</p>
    4040
     41= 1.2.0 =
     42* WPML support for products.
     43* Allow multi export per day.
     44
    4145= 1.1.0 =
    4246* Pixelshop Conversion Pixel.
Note: See TracChangeset for help on using the changeset viewer.