Plugin Directory

Changeset 2405752


Ignore:
Timestamp:
10/24/2020 06:34:54 AM (5 years ago)
Author:
_luigi
Message:

Publishing version 4.5.1

Location:
sitetree
Files:
10 deleted
5 edited
32 copied

Legend:

Unmodified
Added
Removed
  • sitetree/tags/4.5.1/admin/page-controller-classes.php

    r2402399 r2405752  
    231231                }
    232232
    233                 if ( $this->plugin->isServerLocal() ) {
     233                if ( $this->plugin->isWebsiteLocal() ) {
    234234                    return false;
    235235                }
     
    474474    private function makePingNode( $form_id ) {
    475475        $can_ping             = false;
    476         $server_is_local      = $this->plugin->isServerLocal();
     476        $server_is_local      = $this->plugin->isWebsiteLocal();
    477477        $automatic_pinging_on = ( $this->db->getOption( 'automatic_pinging_on' ) || ( $form_id == 'newsmap' ) );
    478478
     
    535535
    536536        if ( $server_is_local ) {
    537             $node .= __( 'I cannot send pings from a local server, I am sorry.', 'sitetree' );
     537            $node .= __( 'I cannot send pings from your website, because its address appears to be a known local development environment URL.', 'sitetree' );
    538538            $node .= '</p>';
    539539        }
  • sitetree/tags/4.5.1/core/ping-controller.class.php

    r2324214 r2405752  
    9898        if (
    9999            !( $is_automatic_ping || $this->canPingOnRequest( $sitemap_id ) ) ||
    100             $this->plugin->isServerLocal()
     100            $this->plugin->isWebsiteLocal()
    101101        ) {
    102102            return false;
  • sitetree/tags/4.5.1/core/sitetree.class.php

    r2402399 r2405752  
    311311
    312312    /**
    313      * @since 3.2
     313     * @since 4.5.1
    314314     * @return bool
    315315     */
    316     public function isServerLocal() {
     316    public function isWebsiteLocal() {
    317317        if ( WP_DEBUG ) {
    318318            return false;
    319319        }
    320        
    321         return (
    322             ( $_SERVER['SERVER_ADDR'] == '127.0.0.1' ) ||
    323             ( $_SERVER['SERVER_ADDR'] == '::1' )
     320
     321        $site_url = site_url();
     322
     323        if ( strpos( $site_url, '.' ) === false ) {
     324            return true;
     325        }
     326       
     327        $host = parse_url( $site_url, PHP_URL_HOST );
     328
     329        if ( $host == '127.0.0.1' ) {
     330            return true;
     331        }
     332
     333        $known_local_patterns = array(
     334            '#\.local$#i',
     335            '#\.localhost$#i',
     336            '#\.test$#i',
     337            '#\.staging$#i',     
     338            '#\.stage$#i',
     339            '#^dev\.#i',
     340            '#^stage\.#i',
     341            '#^staging\.#i',
    324342        );
     343
     344        foreach( $known_local_patterns as $pattern ) {
     345            if ( preg_match( $pattern, $host ) ) {
     346                return true;
     347            }
     348        }
     349       
     350        return false;
    325351    }
    326352
  • sitetree/tags/4.5.1/readme.txt

    r2402399 r2405752  
    77Tested up to: 5.5.1
    88Requires PHP: 5.6.20
    9 Stable tag: 4.5
     9Stable tag: 4.5.1
    1010License: GPLv3
    1111License URI: https://opensource.org/licenses/GPL-3.0
     
    131131== Upgrade Notice ==
    132132
    133 = 4.5 =
     133= 4.5.1 =
    134134
    135135If you are upgrading from SiteTree 1.5.3 your preferences about whether or not to exclude a post or page from the sitemaps will be automatically upgraded, but your general settings will be reset instead. The Change Frequency and Priority metadata are not used any more, nonetheless they will be deleted from the database with a future update.
     
    137137
    138138== Changelog ==
     139
     140= 4.5.1 (24 October 2020) =
     141
     142Implemented a more reliable way of checking whether SiteTree is installed on a local development environment.
     143
    139144
    140145= 4.5 (19 October 2020) =
  • sitetree/tags/4.5.1/sitetree.php

    r2402399 r2405752  
    44 * Plugin URI: https://luigicavalieri.com/sitetree/
    55 * Description: A sitemap maker for WordPress.
    6  * Version: 4.5
     6 * Version: 4.5.1
    77 * Requires: 5.2
    88 * Author: Luigi Cavalieri
     
    1313 *
    1414 * @package SiteTree
    15  * @version 4.5
     15 * @version 4.5.1
    1616 * @copyright Copyright 2020 Luigi Cavalieri.
    1717 * @license https://opensource.org/licenses/GPL-3.0 GPL v3.0
  • sitetree/trunk/admin/page-controller-classes.php

    r2402399 r2405752  
    231231                }
    232232
    233                 if ( $this->plugin->isServerLocal() ) {
     233                if ( $this->plugin->isWebsiteLocal() ) {
    234234                    return false;
    235235                }
     
    474474    private function makePingNode( $form_id ) {
    475475        $can_ping             = false;
    476         $server_is_local      = $this->plugin->isServerLocal();
     476        $server_is_local      = $this->plugin->isWebsiteLocal();
    477477        $automatic_pinging_on = ( $this->db->getOption( 'automatic_pinging_on' ) || ( $form_id == 'newsmap' ) );
    478478
     
    535535
    536536        if ( $server_is_local ) {
    537             $node .= __( 'I cannot send pings from a local server, I am sorry.', 'sitetree' );
     537            $node .= __( 'I cannot send pings from your website, because its address appears to be a known local development environment URL.', 'sitetree' );
    538538            $node .= '</p>';
    539539        }
  • sitetree/trunk/core/ping-controller.class.php

    r2324214 r2405752  
    9898        if (
    9999            !( $is_automatic_ping || $this->canPingOnRequest( $sitemap_id ) ) ||
    100             $this->plugin->isServerLocal()
     100            $this->plugin->isWebsiteLocal()
    101101        ) {
    102102            return false;
  • sitetree/trunk/core/sitetree.class.php

    r2402399 r2405752  
    311311
    312312    /**
    313      * @since 3.2
     313     * @since 4.5.1
    314314     * @return bool
    315315     */
    316     public function isServerLocal() {
     316    public function isWebsiteLocal() {
    317317        if ( WP_DEBUG ) {
    318318            return false;
    319319        }
    320        
    321         return (
    322             ( $_SERVER['SERVER_ADDR'] == '127.0.0.1' ) ||
    323             ( $_SERVER['SERVER_ADDR'] == '::1' )
     320
     321        $site_url = site_url();
     322
     323        if ( strpos( $site_url, '.' ) === false ) {
     324            return true;
     325        }
     326       
     327        $host = parse_url( $site_url, PHP_URL_HOST );
     328
     329        if ( $host == '127.0.0.1' ) {
     330            return true;
     331        }
     332
     333        $known_local_patterns = array(
     334            '#\.local$#i',
     335            '#\.localhost$#i',
     336            '#\.test$#i',
     337            '#\.staging$#i',     
     338            '#\.stage$#i',
     339            '#^dev\.#i',
     340            '#^stage\.#i',
     341            '#^staging\.#i',
    324342        );
     343
     344        foreach( $known_local_patterns as $pattern ) {
     345            if ( preg_match( $pattern, $host ) ) {
     346                return true;
     347            }
     348        }
     349       
     350        return false;
    325351    }
    326352
  • sitetree/trunk/readme.txt

    r2402399 r2405752  
    77Tested up to: 5.5.1
    88Requires PHP: 5.6.20
    9 Stable tag: 4.5
     9Stable tag: 4.5.1
    1010License: GPLv3
    1111License URI: https://opensource.org/licenses/GPL-3.0
     
    131131== Upgrade Notice ==
    132132
    133 = 4.5 =
     133= 4.5.1 =
    134134
    135135If you are upgrading from SiteTree 1.5.3 your preferences about whether or not to exclude a post or page from the sitemaps will be automatically upgraded, but your general settings will be reset instead. The Change Frequency and Priority metadata are not used any more, nonetheless they will be deleted from the database with a future update.
     
    137137
    138138== Changelog ==
     139
     140= 4.5.1 (24 October 2020) =
     141
     142Implemented a more reliable way of checking whether SiteTree is installed on a local development environment.
     143
    139144
    140145= 4.5 (19 October 2020) =
  • sitetree/trunk/sitetree.php

    r2402399 r2405752  
    44 * Plugin URI: https://luigicavalieri.com/sitetree/
    55 * Description: A sitemap maker for WordPress.
    6  * Version: 4.5
     6 * Version: 4.5.1
    77 * Requires: 5.2
    88 * Author: Luigi Cavalieri
     
    1313 *
    1414 * @package SiteTree
    15  * @version 4.5
     15 * @version 4.5.1
    1616 * @copyright Copyright 2020 Luigi Cavalieri.
    1717 * @license https://opensource.org/licenses/GPL-3.0 GPL v3.0
Note: See TracChangeset for help on using the changeset viewer.