Plugin Directory

Changeset 1953598


Ignore:
Timestamp:
10/08/2018 11:05:48 PM (7 years ago)
Author:
recomendo
Message:

version 1.0.1

Location:
recomendo/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • recomendo/trunk/README.txt

    r1945381 r1953598  
    125125
    126126== Changelog ==
     127= 1.0.1 =
     128* Bug fixes
     129
    127130= 1.0.0 =
    128131* Option for excluding older items
  • recomendo/trunk/recomendo-client.php

    r1945379 r1953598  
    99    const TIMEOUT = 3;
    1010    const HTTPVERSION = '1.1';
    11     const AUTH_URL = 'https://auth.recomendo.ai/v1/auth';
    12     const EVENTS_URL = 'https://events.recomendo.ai/v1/events';
    13     const PREDICTIONS_URL = 'https://predictions.recomendo.ai/v1/queries.json';
     11    const AUTH_URL = 'https://auth.recomendo.ai/v1/auth';
     12    const EVENTS_URL = 'https://events.recomendo.ai/v1/events';
     13    const PREDICTIONS_URL = 'https://predictions.recomendo.ai/v1/queries.json';
    1414
    1515
     
    4747
    4848        if (! $client_secret )
    49             $client_secret = $this->client_secret; 
     49            $client_secret = $this->client_secret;
    5050
    5151        if ( false === ( $token = get_transient( 'recomendo_token' ) ) ) {
     
    6464                $token = $body->payload->token;
    6565                set_transient( 'recomendo_token', $token , 3500 );
    66             } 
     66            }
    6767        }
    6868
     
    9090    public function send_query( array $query ) {
    9191        $url = self::PREDICTIONS_URL;
    92                
     92
    9393        $response = wp_remote_post( $url,
    9494                        array(
     
    331331
    332332        $url = self::EVENTS_URL . '.json';
    333        
     333
    334334        $response = wp_remote_post( $url,
    335335                        array(
     
    348348                        )
    349349                    );
    350        
     350
    351351        return  $response;
    352352    }
     
    372372                    );
    373373
    374       return $response;
     374        return $response;
    375375    }
    376376
     
    384384     */
    385385    public function get_event($event_id) {
    386         $url = self::EVENTS_URL . "/$event_id.json?accessKey=$this->api_access_key";
     386        $url = self::EVENTS_URL . "/$event_id.json";
    387387
    388388        $response = wp_remote_get( $url,
     
    394394                    );
    395395
    396       return $response;
     396        return $response;
    397397    }
    398398
     
    411411
    412412        $url = self::EVENTS_URL . ".json";
    413        
     413
    414414        $query_params = array();
    415415
     
    443443        if (! empty( $query_params) )
    444444            $url .= '?' . http_build_query( $query_params );
    445        
    446        
     445
     446
    447447        $response = wp_remote_get( $url,
    448448                        array(
     
    454454
    455455        return $response;
    456        
     456
    457457    }
    458458
     
    482482     */
    483483    public function send_train_request() {
    484            
     484
    485485        if ( ! get_transient( 'recomendo_train_request_sent' ) )  {
    486        
     486
    487487            $url = 'https://client.recomendo.ai/v1/train';
    488488
     
    494494                                        )
    495495                                      );
    496                                    
     496
    497497            // It wasn't there, so regenerate the data and save the transient
    498498            set_transient( 'recomendo_train_request_sent', true, 1800 );
    499        
    500         } else {   
     499
     500        } else {
    501501            // if transient exists we ignore sending train request, but record it as OK
    502502            $response = array( 'response' => array( 'code' => 200, 'message' => 'OK' ) );
    503503        }
    504        
     504
    505505        // Here we return the raw response!
    506506        return $response;
  • recomendo/trunk/recomendo-plugin.php

    r1945379 r1953598  
    2525
    2626    public static function is_event_server_up() {
    27        
     27
    2828        // static function - need to initialize client
    2929        $client = new Recomendo_Client();
    3030
    3131        $response = $client->get_event_server_status();
    32                
     32
    3333        $status = wp_remote_retrieve_response_code( $response );
    3434        if  ( $status == 200 ) {
     
    4848
    4949
    50    
     50
    5151    public static function is_prediction_server_up() {
    5252
    5353        $client = new Recomendo_Client();
    54        
     54
    5555        $response = $client->get_prediction_server_status();
    56                
     56
    5757        $status = wp_remote_retrieve_response_code( $response );
    5858        if  ( $status == 200 ) {
     
    6464
    6565
    66    
     66
    6767    public function register() {
    6868
     
    8383        // Record Buy Event
    8484        add_action( 'woocommerce_thankyou', array( $this, 'record_buy_event' ) );
    85         // Record category_pref 
     85        // Record category_pref
    8686        add_action( 'wp', array( $this, 'record_category_pref' ) );
    8787        // Register and load the widget
     
    9090        add_shortcode( 'recomendo', array( $this, 'show_shortcode' ) );
    9191        // Show recommendations in WooCommerce related products
    92         if ( isset( $this->woo_options['woo_show_related'] ) ) 
     92        if ( isset( $this->woo_options['woo_show_related'] ) )
    9393            add_filter( 'woocommerce_related_products', array( $this, 'show_related_products' ), 10, 1);
    9494        // Show recommendations in the cart
     
    9999                add_action( 'woocommerce_product_set_visibility', array( $this, 'add_item' ), 10, 1 );
    100100        }
    101        
     101
    102102    } //end of method
    103    
    104    
     103
     104
    105105
    106106    public function load_widget() {
     
    108108    }
    109109
    110    
    111    
     110
     111
    112112    public function detect_crawler() {
    113113        // User lowercase string for comparison.
     
    118118        // ignore requests from this wordpress server... cron or other plugins
    119119        if ( $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR'] ) return TRUE;
    120                
    121         if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 
     120
     121        if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
    122122                $transient = 'recomendo_' . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_X_FORWARDED_FOR'] ;
    123123        } else {
     
    151151    }
    152152
    153    
    154    
     153
     154
    155155    // Tracks non-registered users with cookies
    156156    public function set_cookie() {
     
    162162                $_COOKIE['recomendo-cookie-user'] = $uniq_id;
    163163
    164                 if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { 
     164                if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
    165165                    $transient = 'recomendo_' . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['HTTP_X_FORWARDED_FOR'] ;
    166166                } else {
     
    182182    } // end of method --> set_cookie
    183183
    184    
    185 
    186     // Creates shortcode [recomendo] 
     184
     185
     186    // Creates shortcode [recomendo]
    187187    public function show_shortcode( $atts, $content=null ) {
    188                
     188
    189189        $a = shortcode_atts( array(
    190190         'number' => 16,
    191191         'type' => 'personalized',
    192          'template' => 'content-' . $this->options['post_type'] 
     192         'template' => 'content-' . $this->options['post_type']
    193193        ), $atts );
    194        
     194
    195195        // get the slug and name from the shortcode template arg
    196196        $template = explode( '-', basename( $a['template'], '.php') );
    197197        $template_slug = $template[0];
    198198        $template_name = implode( '-', array_slice( $template, 1) );
    199        
     199
    200200        switch (  strtolower( $a['type'] ) ) {
    201201            case 'personalized' :
     
    258258
    259259        if ( $response != false and array_key_exists( 'itemScores', $response ) ) {
    260             ob_start(); 
     260            ob_start();
    261261            if ( class_exists( 'woocommerce' ) ) {
    262262                woocommerce_product_loop_start();
     
    266266                        setup_postdata( $GLOBALS['post'] =& $post_object );
    267267                        wc_get_template_part( $template_slug, $template_name );
    268                     } 
     268                    }
    269269                }
    270                 woocommerce_product_loop_end();                             
     270                woocommerce_product_loop_end();
    271271            } else {
    272272
     
    277277                        // REPLACE by custom parameter
    278278                        get_template_part( $template_slug, $template_name );
    279                     } 
     279                    }
    280280                }
    281281
    282282            }
    283283
    284             wp_reset_postdata();                   
     284            wp_reset_postdata();
    285285            $output = ob_get_clean();
    286286            return $output;
    287287        }
    288                    
    289    
     288
     289
    290290    } // end of method --> show_shortcode
    291291
     
    293293    // Shows recommendations in the WooCommerce Related Products area
    294294    public function show_related_products( $args ) {
    295        
     295
    296296        global $product;
    297297
     
    309309    } // end of method --> show_related_products
    310310
    311        
     311
    312312    // Shows recommendations in the WooCommerce Cart
    313313    public function show_cart_recommendations( $args = array() ) {
     
    322322        $args = wp_parse_args( $args, $defaults );
    323323
    324        
     324
    325325        if ( ! $woocommerce ) {
    326326            return;
     
    365365            woocommerce_product_loop_end();
    366366            wp_reset_postdata();
    367  
     367
    368368        }
    369369    } // end of method --> show_cart_recommendations
     
    374374    public function get_excluded_items() {
    375375
    376         if ( class_exists( 'woocommerce' ) && 
    377             $this->options['post_type'] == 'product'  && 
     376        if ( class_exists( 'woocommerce' ) &&
     377            $this->options['post_type'] == 'product'  &&
    378378            isset( $this->woo_options['woo_exclude_outofstock'] ) ) {
    379379
     
    426426
    427427        $query['blacklistItems'] = $this->get_excluded_items();
    428        
    429         if ( isset ( $this->general_options['expire_date'] ) && 
     428
     429        if ( isset ( $this->general_options['expire_date'] ) &&
    430430            $this->general_options['expire_date'] != 0 ) {
    431            
     431
    432432                $after_date = date('c', strtotime('-' . $this->general_options['expire_date'] . ' days' ) );
    433433                $query['dateRange'] = array(
    434434                    'name' => 'published_date',
    435                     'after' => $after_date     
     435                    'after' => $after_date
    436436                );
    437            
    438         }       
     437
     438        }
    439439
    440440        $response = $this->client->send_query( $query );
     
    476476    private function map_range_input_to_bias( $value ) {
    477477        if ( intval($value) == -1 ) return 0.0; // exclude
    478         if ( intval($value) == 0 ) return 0.5; // less importance 
     478        if ( intval($value) == 0 ) return 0.5; // less importance
    479479        if ( intval($value) == 1 ) return 1.0;  // neutral
    480480        if ( intval($value) == 2 ) return 1.5; // more importance
    481         if ( intval($value) == 3) return -1.0;  // Include only         
     481        if ( intval($value) == 3) return -1.0;  // Include only
    482482    }
    483483
     
    493493
    494494        $fields = array();
    495        
     495
    496496        if ( isset(  $this->woo_options['woo_onsale_relevance'] ) ) {
    497            
    498                 $on_sale_bias = $this->map_range_input_to_bias( 
     497
     498                $on_sale_bias = $this->map_range_input_to_bias(
    499499                    $this->woo_options['woo_onsale_relevance'] );
    500                
     500
    501501                // we ignore neutral and dont add it to the query
    502502                if ( $on_sale_bias != 1.0 ) {
    503503                    // less importance boost "no" instead
    504                     if ( $on_sale_bias == 0.5 ) { 
     504                    if ( $on_sale_bias == 0.5 ) {
    505505                        $on_sale_args = array(
    506506                            'name' => 'is_on_sale',
     
    515515                        );
    516516                    }
    517                
     517
    518518                    $fields[] = $on_sale_args;
    519519                }
    520                    
    521         } 
    522        
     520
     521        }
     522
    523523        if ( isset(  $this->woo_options['woo_featured_relevance'] ) ) {
    524                 $featured_bias = $this->map_range_input_to_bias( 
    525                     $this->woo_options['woo_featured_relevance'] ); 
    526            
     524                $featured_bias = $this->map_range_input_to_bias(
     525                    $this->woo_options['woo_featured_relevance'] );
     526
    527527                // we ignore neutral and dont add it to the query
    528528                if ( $featured_bias != 1.0 ) {
     
    540540                            'bias' => $featured_bias
    541541                        );
    542                                
     542
    543543                    }
    544                    
     544
    545545                    $fields[] = $featured_args;
    546546
     
    548548
    549549        }
    550        
     550
    551551        $query = array(
    552552            'user' => $userid,
     
    554554            'fields' => $fields
    555555        );
    556        
    557         if ( isset ( $this->general_options['expire_date'] ) && 
     556
     557        if ( isset ( $this->general_options['expire_date'] ) &&
    558558            $this->general_options['expire_date'] != 0 ) {
    559            
     559
    560560                $after_date = date('c', strtotime('-' . $this->general_options['expire_date'] . ' days' ) );
    561561                $query['dateRange'] = array(
    562562                    'name' => 'published_date',
    563                     'after' => $after_date     
    564                 );         
     563                    'after' => $after_date
     564                );
    565565        }
    566566
    567567        $query['blacklistItems'] = $this->get_excluded_items();
    568                        
     568
    569569        $response = $this->client->send_query( $query );
    570570
     
    597597            $result = false;
    598598        }
    599        
    600        
    601        
     599
     600
     601
    602602        return $result;
    603603
     
    610610
    611611        $fields = array();
    612        
     612
    613613        // Check if WPML is installed and get the id of the original language post (not translation)
    614614        if ( function_exists('icl_object_id') ) {
     
    621621        // Apply the Similar Categories Bias/Boost to the query
    622622        if ( isset(  $this->general_options['similar_categories_relevance'] ) ) {
    623            
    624             $same_categories_bias = $this->map_range_input_to_bias( 
     623
     624            $same_categories_bias = $this->map_range_input_to_bias(
    625625                    $this->general_options['similar_categories_relevance'] );
    626                        
     626
    627627            // we ignore neutral and dont add it to the query
    628628            if ( $same_categories_bias != 1.0 ) {
    629                
     629
    630630                $categories = array();
    631631
     
    636636                    $terms = get_the_terms( $item, 'category' );
    637637                }
    638                
     638
    639639                if (is_array($terms) or is_object($terms)) {
    640640                    foreach ($terms as $term) {
    641641                        $categories[] = (string) $term->term_id;
    642642                    }
    643                    
     643
    644644                    $similar_categories_args = array(
    645645                        'name' => 'categories',
    646646                        'values' => $categories,
    647647                        'bias' => $same_categories_bias
    648                     );             
    649                    
     648                    );
     649
    650650                    $fields[] = $similar_categories_args;
    651651                }
    652             } 
    653                
    654                    
    655         } 
    656        
     652            }
     653
     654
     655        }
     656
    657657        // Apply the Similar Tags Bias/Boost to the query
    658658        if ( isset(  $this->general_options['similar_tags_relevance'] ) ) {
    659            
    660             $same_tags_bias = $this->map_range_input_to_bias( 
     659
     660            $same_tags_bias = $this->map_range_input_to_bias(
    661661                    $this->general_options['similar_tags_relevance'] );
    662                        
     662
    663663            // we ignore neutral and dont add it to the query
    664664            if ( $same_tags_bias != 1.0 ) {
    665                
     665
    666666                $tags = array();
    667667
     
    673673                }
    674674
    675                
     675
    676676                if (is_array($taglist) or is_object($taglist)) {
    677677                    foreach ($taglist as $tagitem) {
    678678                        $tags[] = (string) $tagitem->term_id;
    679679                    }
    680                    
     680
    681681                    $similar_tags_args = array(
    682682                        'name' => 'tags',
    683683                        'values' => $tags,
    684684                        'bias' => $same_tags_bias
    685                     );   
    686                    
     685                    );
     686
    687687                    $fields[] = $similar_tags_args;
    688688
    689689                }
    690                            
    691             } 
    692                
    693                    
    694         } 
     690
     691            }
     692
     693
     694        }
    695695
    696696        // Apply Boost-Bias to Items on Sale
    697697        if ( isset(  $this->woo_options['woo_onsale_relevance'] ) ) {
    698698
    699             $on_sale_bias = $this->map_range_input_to_bias( 
     699            $on_sale_bias = $this->map_range_input_to_bias(
    700700                $this->woo_options['woo_onsale_relevance'] );
    701701
     
    703703            if ( $on_sale_bias != 1.0 ) {
    704704                // less importance boost "no" instead
    705                 if ( $on_sale_bias == -99 ) {
     705                if ( $on_sale_bias == 0.5 ) {
    706706                    $on_sale_args = array(
    707707                        'name' => 'is_on_sale',
     
    719719                $fields[] = $on_sale_args;
    720720            }
    721                    
    722         } 
    723        
     721
     722        }
     723
    724724        // Apply Boost-Bias to Featured Items
    725725        if ( isset(  $this->woo_options['woo_featured_relevance'] ) ) {
    726             $featured_bias = $this->map_range_input_to_bias( 
    727                 $this->woo_options['woo_featured_relevance'] ); 
     726            $featured_bias = $this->map_range_input_to_bias(
     727                $this->woo_options['woo_featured_relevance'] );
    728728
    729729            // we ignore neutral and dont add it to the query
    730730            if ( $featured_bias != 1.0 ) {
    731731                // less importance boost "no" instead
    732                 if ( $featured_bias == -99 ) {
     732                if ( $featured_bias == 0.5 ) {
    733733                    $featured_args = array(
    734734                        'name' => 'is_featured',
     
    755755        );
    756756
    757         if ( isset ( $this->general_options['expire_date'] ) && 
     757        if ( isset ( $this->general_options['expire_date'] ) &&
    758758            $this->general_options['expire_date'] != 0 ) {
    759            
     759
    760760                $after_date = date('c', strtotime('-' . $this->general_options['expire_date'] . ' days' ) );
    761761                $query['dateRange'] = array(
    762762                    'name' => 'published_date',
    763                     'after' => $after_date     
     763                    'after' => $after_date
    764764                );
    765            
     765
    766766        }
    767767
     
    769769
    770770        $response = $this->client->send_query( $query );
    771        
     771
    772772
    773773        // check that the response is not WP_error
     
    800800            $result = false;
    801801        }
    802        
     802
    803803
    804804        return $result;
     
    812812
    813813        $fields = array();
    814        
     814
    815815        if ( isset(  $this->woo_options['woo_onsale_relevance'] ) ) {
    816            
    817             $on_sale_bias = $this->map_range_input_to_bias( 
     816
     817            $on_sale_bias = $this->map_range_input_to_bias(
    818818                $this->woo_options['woo_onsale_relevance'] );
    819819
     
    821821            if ( $on_sale_bias != 1.0 ) {
    822822                // less importance boost "no" instead
    823                 if ( $on_sale_bias == -99 ) {
     823                if ( $on_sale_bias == 0.5 ) {
    824824                    $on_sale_args = array(
    825825                        'name' => 'is_on_sale',
     
    838838            }
    839839
    840         } 
     840        }
    841841
    842842        if ( isset(  $this->woo_options['woo_featured_relevance'] ) ) {
    843                 $featured_bias = $this->map_range_input_to_bias( 
    844                     $this->woo_options['woo_featured_relevance'] ); 
    845            
     843                $featured_bias = $this->map_range_input_to_bias(
     844                    $this->woo_options['woo_featured_relevance'] );
     845
    846846                // we ignore neutral and dont add it to the query
    847847                if ( $featured_bias != 1.0 ) {
    848848                    // less importance boost "no" instead
    849                     if ( $featured_bias == -99 ) {
     849                    if ( $featured_bias == 0.5 ) {
    850850                        $featured_args = array(
    851851                            'name' => 'is_featured',
     
    859859                            'bias' => $featured_bias
    860860                        );
    861                                
     861
    862862                    }
    863                    
     863
    864864                    $fields[] = $featured_args;
    865865
     
    867867
    868868        }
    869        
     869
    870870        $query = array(
    871871            'itemSet'=> $items,
     
    876876        $query['blacklistItems'] = $this->get_excluded_items();
    877877
    878         if ( isset ( $this->general_options['expire_date'] ) && 
     878        if ( isset ( $this->general_options['expire_date'] ) &&
    879879            $this->general_options['expire_date'] != 0 ) {
    880            
     880
    881881                $after_date = date('c', strtotime('-' . $this->general_options['expire_date'] . ' days' ) );
    882882                $query['dateRange'] = array(
    883883                    'name' => 'published_date',
    884                     'after' => $after_date     
     884                    'after' => $after_date
    885885                );
    886            
    887         }
    888        
     886
     887        }
     888
    889889        $response = $this->client->send_query( $query );
    890890
     
    943943        }
    944944    } // end of method --> add_user
    945    
    946    
     945
     946
    947947    // Add all users using background processing
    948948    public function add_all_users_background() {
    949                
     949
    950950        $args = array(
    951951            'fields'       => 'ids',
     
    954954
    955955        $user_ids = get_users( $args );
    956        
     956
    957957        // Array of WP_User objects.
    958        
     958
    959959        foreach ( $user_ids as $id ) {
    960             $this->bg_user_copy->push_to_queue( $id );     
    961         }
    962        
     960            $this->bg_user_copy->push_to_queue( $id );
     961        }
     962
    963963        $this->bg_user_copy->save()->dispatch();
    964        
     964
    965965    } //end-of-method add_all_users_background()
    966966
     
    10501050    } // end of method --> add_item
    10511051
    1052    
    1053    
     1052
     1053
    10541054    public function add_all_items_background() {
    1055        
     1055
    10561056        //$options = get_option( 'recomendo_options ' );
    1057        
     1057
    10581058        $args = array(
    10591059            'post_type' => $this->options['post_type'],
     
    10671067
    10681068        $post_ids = get_posts( $args );
    1069                
     1069
    10701070        foreach ($post_ids as $id) {
    10711071            $this->bg_item_copy->push_to_queue( $id );
    10721072        }
    1073        
     1073
    10741074        $this->bg_item_copy->save()->dispatch();
    1075        
     1075
    10761076    } //end-of-method add_all_items_background()
    1077    
     1077
    10781078
    10791079    // delete item from Recomendo when Post status changes to not Published
     
    11581158    } // end of method --> record_view_event
    11591159
    1160    
     1160
    11611161    // Send category-pref
    11621162    public function record_category_pref() {
     
    11681168
    11691169        if ( is_category() or is_tax() or is_tag() ) {
    1170            
     1170
    11711171            $queried_object = get_queried_object();
    1172            
     1172
    11731173            $term_id = $queried_object->term_id ;
    11741174            $term_type = $queried_object->name ;
    1175            
    1176            
     1175
     1176
    11771177            if ( get_current_user_id() == 0 ) {
    11781178                $userid = $_COOKIE['recomendo-cookie-user'];
     
    11881188                global $sitepress;
    11891189                $term_id = icl_object_id( $term_id , $term_type, true, $sitepress->get_default_language() );
    1190              } 
     1190             }
    11911191
    11921192            $response = $this->client->record_user_action('category_pref', $userid, $term_id);
     
    12201220            $userid = get_current_user_id();
    12211221        }
    1222        
     1222
    12231223
    12241224        // Check if registered user does not want user behaviour to be tracked
     
    12641264            $userid = get_current_user_id();
    12651265        }
    1266        
     1266
    12671267        // Check if registered user does not want user behaviour to be tracked
    12681268        if ( in_array( $userid, $this->get_excluded_users() ) ) return;
     
    13151315    // Executed when all data is copied to eventserver
    13161316    public function add_all_orders_background() {
    1317        
     1317
    13181318        $query_args = array(
    13191319            'fields'         => 'ids',
     
    13271327        if ( sizeof( $order_ids ) > 0 ) {
    13281328            foreach ( $order_ids as $id ) {
    1329                 $this->bg_order_copy->push_to_queue( $id );     
     1329                $this->bg_order_copy->push_to_queue( $id );
    13301330            }
    13311331        }
    1332        
     1332
    13331333        $this->bg_order_copy->save()->dispatch();
    1334        
     1334
    13351335    } //end-of-method add_all_orders_background()
    13361336
    1337        
    1338    
     1337
     1338
    13391339    public function copy_data_to_eventserver() {
    1340            
     1340
    13411341            update_option( 'recomendo_data_saved_ok', true );
    13421342
    1343             $this->add_all_users_background();         
    1344             $this->add_all_items_background();             
     1343            $this->add_all_users_background();
     1344            $this->add_all_items_background();
    13451345            if ( class_exists( 'woocommerce' ) &&
    13461346                $this->options['post_type'] == 'product' ) {
    1347                
     1347
    13481348                    $this->add_all_orders_background();
    13491349            }
  • recomendo/trunk/recomendo.php

    r1945379 r1953598  
    55* Description: Make your website smart with Artificial Intelligence recommendations.
    66* Author: Recomendo
    7 * Version: 1.0.0
     7* Version: 1.0.1
    88* Requires at least: 4.7
    99* Tested up to: 4.9.8
     
    4545        if ( class_exists( 'Recomendo_Plugin' ) ) {
    4646            // launch the plugin
    47             $recomendo = new Recomendo_Plugin( $options ); 
    48            
     47            $recomendo = new Recomendo_Plugin( $options );
     48
    4949        }
    5050    }
  • recomendo/trunk/uninstall.php

    r1931195 r1953598  
    66}
    77
    8 // call api.recomendo.ai/wp_uninstall/
    9 $options = get_option( 'recomendo_api' );
    10 $response = wp_remote_post( 'https://api.recomendo.ai/wp-uninstall',
    11                 array(
    12                   'headers' => json_encode([
    13                         'Content-Type' => 'application/json',
    14                         'Authorization' => 'Basic ' . base64_encode(
    15                             $options['username'] . ':' . $options['password']
    16                         )
    17                   ]),
    18                   'body' => json_encode([
    19                       'username' => $options['username']
    20                   ])
    21                 )
    22             );
    238
    249// remove Recomendo options
     
    2712delete_option( 'recomendo_options' );
    2813delete_option( 'recomendo_woo_options' );
    29 delete_option('recomendo_data_saved_ok');
    30 
     14delete_option( 'recomendo_data_saved_ok' );
    3115delete_transient( 'recomendo_token' );
    32 
    3316delete_post_meta_by_key( 'recomendo_exclude_metabox' );
    3417
Note: See TracChangeset for help on using the changeset viewer.