Plugin Directory

Changeset 2680188


Ignore:
Timestamp:
02/16/2022 09:10:36 PM (4 years ago)
Author:
datacake
Message:

1.1.15 correcoes

Location:
datacake-core
Files:
1 deleted
8 edited
15 copied

Legend:

Unmodified
Added
Removed
  • datacake-core/tags/1.1.15/README.md

    r2609130 r2680188  
    1515City SEO, this will replicate a text changing the city in the text for SEO purposes
    1616
    17 * Version: V1.1.14
     17* Version: V1.1.15
    1818
    1919
  • datacake-core/tags/1.1.15/README.txt

    r2609130 r2680188  
    66Tested up to: 5.7.0
    77Requires PHP: 7.2
    8 Stable tag: 1.1.14
    9 Last Tag: 1.1.13
     8Stable tag: 1.1.15
     9Last Tag: 1.1.14
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • datacake-core/tags/1.1.15/datacake_core.php

    r2609130 r2680188  
    1616 * Plugin URI:        http://www.datacake.com.br
    1717 * Description:       Plugin Datacake para linkar com as Funcionalidade do Data ISP/ISP OG - Redirecionar cidade baseada no cookie
    18  * Version:           1.1.14
     18 * Version:           1.1.15
    1919 * Author:            Paulo Peres Jr
    2020 * Author URI:        https://github.com/PauloPeres
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'DATACAKE_CORE_VERSION', '1.1.14' );
     38define( 'DATACAKE_CORE_VERSION', '1.1.15' );
    3939
    4040require_once __DIR__ . '/vendor/autoload.php';
     
    4949}
    5050function update_datacake_core() {
     51    // Isso parece estranho mas por causa do Wordpress Network pode ser que o register_activation_hook não rode
     52    // então temos que checar de qualquer maneira se o Plugin esta ativo
     53    DatacakeCoreActivator::activate();
    5154    DatacakeCoreActivator::update();
    5255}
  • datacake-core/tags/1.1.15/src/Includes/DatacakeCoreActivator.php

    r2481788 r2680188  
    3232    public static function activate() {
    3333        global $wpdb;
    34         require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    35         $charset_collate = $wpdb->get_charset_collate();
    36         if( ! get_option(self::$config_name,null) ) {
    37             require_once(
    38                 realpath(__DIR__.'/../Models/db/001Initial.php')
    39             );
     34        $db_version = get_option(self::$config_name, '0.0.0');
     35        if( version_compare( $db_version,   '1.0.0', '<' ) ) {
     36            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     37            $charset_collate = $wpdb->get_charset_collate();
     38            if( ! get_option(self::$config_name,null) ) {
     39                require_once(
     40                    realpath(__DIR__.'/../Models/db/001Initial.php')
     41                );
     42            }
    4043        }
    4144       
  • datacake-core/tags/1.1.15/src/Pub/DatacakeCorePublic.php

    r2481788 r2680188  
    159159                }
    160160            }else{
    161                
     161                if($page_id){
     162                    $data_force_redirect = get_option('datacake_redir_force',null);
     163                    $data_redirect_id = get_option('datacake_redir_page_id',null);
     164                   
     165                    if($data_force_redirect && $data_redirect_id){
     166                        global $wp;
     167                        $currentUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
     168                        if(strpos($currentUrl, 'wp-admin') !== false || strpos($currentUrl, 'wp-login') !== false){
     169                            //Admin or login found in the current url let's not redirect
     170                        }else{
     171                            $redirect = isset($_GET['redirect']) ? $_GET['redirect'] : $currentUrl;
     172                            $link = get_permalink($data_redirect_id)."?redirect=".$redirect;
     173                            if($data_redirect_id != $page_id){
     174                                header("Location: $link");
     175                                die();
     176                            }
     177                        }
     178                    }
     179                }
    162180            }
    163181        }
     
    182200        if($city){
    183201            $utils->setCity($city->id);
    184         }else{
    185             $city = $utils->getCity();
    186             if(!$city){
    187                 $data_force_redirect = get_option('datacake_redir_force',null);
    188                 $data_redirect_id = get_option('datacake_redir_page_id',null);
    189                
    190                 if($data_force_redirect && $data_redirect_id){
    191                     global $wp;
    192                     $currentUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    193                     if(strpos($currentUrl, 'wp-admin') !== false || strpos($currentUrl, 'wp-login') !== false){
    194                         //Admin or login found in the current url let's not redirect
    195                     }else{
    196                         $redirect = isset($_GET['redirect']) ? $_GET['redirect'] : $currentUrl;
    197                         $link = get_permalink($data_redirect_id)."?redirect=".$redirect;
    198                         if($currentUrl != $link){
    199                             header("Location: $link");
    200                             die();
    201                         }
    202                     }
    203                 }
    204             }
    205202        }
    206203    }
  • datacake-core/tags/1.1.15/src/Wda/BaseApi.php

    r2609130 r2680188  
    2626
    2727        $this->config = get_option('datacake_api');
    28        
    29         // Instantiate an empty PSR-7 request, note that the default HTTP method must be provided
    30         $this->request = new Request('GET', '');
     28            // Instantiate an empty PSR-7 request, note that the default HTTP method must be provided
     29            $this->request = new Request('GET', '');
    3130
    32         // Instantiate the request builder
    33         $this->requestBuilder = new JsonApiRequestBuilder($this->request);
    34         $this->requestBuilder
    35             ->setProtocolVersion("1.1")
    36             ->setMethod("GET")
    37             ->setUri($this->config['url'].$this->version.$this->baseUrl)
    38             ->setHeader("Accept-Charset", "utf-8");
     31            // Instantiate the request builder
     32            $this->requestBuilder = new JsonApiRequestBuilder($this->request);
     33        if($this->config){
     34            $this->requestBuilder
     35                ->setProtocolVersion("1.1")
     36                ->setMethod("GET")
     37                ->setUri($this->config['url'].$this->version.$this->baseUrl)
     38                ->setHeader("Accept-Charset", "utf-8");
     39        }
    3940    }
    4041   
  • datacake-core/trunk/README.md

    r2609130 r2680188  
    1515City SEO, this will replicate a text changing the city in the text for SEO purposes
    1616
    17 * Version: V1.1.14
     17* Version: V1.1.15
    1818
    1919
  • datacake-core/trunk/README.txt

    r2609130 r2680188  
    66Tested up to: 5.7.0
    77Requires PHP: 7.2
    8 Stable tag: 1.1.14
    9 Last Tag: 1.1.13
     8Stable tag: 1.1.15
     9Last Tag: 1.1.14
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • datacake-core/trunk/datacake_core.php

    r2609130 r2680188  
    1616 * Plugin URI:        http://www.datacake.com.br
    1717 * Description:       Plugin Datacake para linkar com as Funcionalidade do Data ISP/ISP OG - Redirecionar cidade baseada no cookie
    18  * Version:           1.1.14
     18 * Version:           1.1.15
    1919 * Author:            Paulo Peres Jr
    2020 * Author URI:        https://github.com/PauloPeres
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'DATACAKE_CORE_VERSION', '1.1.14' );
     38define( 'DATACAKE_CORE_VERSION', '1.1.15' );
    3939
    4040require_once __DIR__ . '/vendor/autoload.php';
     
    4949}
    5050function update_datacake_core() {
     51    // Isso parece estranho mas por causa do Wordpress Network pode ser que o register_activation_hook não rode
     52    // então temos que checar de qualquer maneira se o Plugin esta ativo
     53    DatacakeCoreActivator::activate();
    5154    DatacakeCoreActivator::update();
    5255}
  • datacake-core/trunk/src/Includes/DatacakeCoreActivator.php

    r2481788 r2680188  
    3232    public static function activate() {
    3333        global $wpdb;
    34         require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    35         $charset_collate = $wpdb->get_charset_collate();
    36         if( ! get_option(self::$config_name,null) ) {
    37             require_once(
    38                 realpath(__DIR__.'/../Models/db/001Initial.php')
    39             );
     34        $db_version = get_option(self::$config_name, '0.0.0');
     35        if( version_compare( $db_version,   '1.0.0', '<' ) ) {
     36            require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
     37            $charset_collate = $wpdb->get_charset_collate();
     38            if( ! get_option(self::$config_name,null) ) {
     39                require_once(
     40                    realpath(__DIR__.'/../Models/db/001Initial.php')
     41                );
     42            }
    4043        }
    4144       
  • datacake-core/trunk/src/Pub/DatacakeCorePublic.php

    r2481788 r2680188  
    159159                }
    160160            }else{
    161                
     161                if($page_id){
     162                    $data_force_redirect = get_option('datacake_redir_force',null);
     163                    $data_redirect_id = get_option('datacake_redir_page_id',null);
     164                   
     165                    if($data_force_redirect && $data_redirect_id){
     166                        global $wp;
     167                        $currentUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
     168                        if(strpos($currentUrl, 'wp-admin') !== false || strpos($currentUrl, 'wp-login') !== false){
     169                            //Admin or login found in the current url let's not redirect
     170                        }else{
     171                            $redirect = isset($_GET['redirect']) ? $_GET['redirect'] : $currentUrl;
     172                            $link = get_permalink($data_redirect_id)."?redirect=".$redirect;
     173                            if($data_redirect_id != $page_id){
     174                                header("Location: $link");
     175                                die();
     176                            }
     177                        }
     178                    }
     179                }
    162180            }
    163181        }
     
    182200        if($city){
    183201            $utils->setCity($city->id);
    184         }else{
    185             $city = $utils->getCity();
    186             if(!$city){
    187                 $data_force_redirect = get_option('datacake_redir_force',null);
    188                 $data_redirect_id = get_option('datacake_redir_page_id',null);
    189                
    190                 if($data_force_redirect && $data_redirect_id){
    191                     global $wp;
    192                     $currentUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    193                     if(strpos($currentUrl, 'wp-admin') !== false || strpos($currentUrl, 'wp-login') !== false){
    194                         //Admin or login found in the current url let's not redirect
    195                     }else{
    196                         $redirect = isset($_GET['redirect']) ? $_GET['redirect'] : $currentUrl;
    197                         $link = get_permalink($data_redirect_id)."?redirect=".$redirect;
    198                         if($currentUrl != $link){
    199                             header("Location: $link");
    200                             die();
    201                         }
    202                     }
    203                 }
    204             }
    205202        }
    206203    }
  • datacake-core/trunk/src/Wda/BaseApi.php

    r2609130 r2680188  
    2626
    2727        $this->config = get_option('datacake_api');
    28        
    29         // Instantiate an empty PSR-7 request, note that the default HTTP method must be provided
    30         $this->request = new Request('GET', '');
     28            // Instantiate an empty PSR-7 request, note that the default HTTP method must be provided
     29            $this->request = new Request('GET', '');
    3130
    32         // Instantiate the request builder
    33         $this->requestBuilder = new JsonApiRequestBuilder($this->request);
    34         $this->requestBuilder
    35             ->setProtocolVersion("1.1")
    36             ->setMethod("GET")
    37             ->setUri($this->config['url'].$this->version.$this->baseUrl)
    38             ->setHeader("Accept-Charset", "utf-8");
     31            // Instantiate the request builder
     32            $this->requestBuilder = new JsonApiRequestBuilder($this->request);
     33        if($this->config){
     34            $this->requestBuilder
     35                ->setProtocolVersion("1.1")
     36                ->setMethod("GET")
     37                ->setUri($this->config['url'].$this->version.$this->baseUrl)
     38                ->setHeader("Accept-Charset", "utf-8");
     39        }
    3940    }
    4041   
Note: See TracChangeset for help on using the changeset viewer.