Plugin Directory

Changeset 2525101


Ignore:
Timestamp:
05/03/2021 06:29:45 AM (5 years ago)
Author:
_luigi
Message:

Publishing version 6.0.2

Location:
sitetree
Files:
5 deleted
9 edited
49 copied

Legend:

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

    r2521279 r2525101  
    317317        $sitemap_filename_has_changed = false;
    318318
    319         if ( $form_id == 'sitemap' ) {
    320             $old_sitemap_filename = $this->db->getOption( 'sitemap_filename' );
    321         }
    322         else {
    323             $content_types_id = $form_id . '_content_types';
    324             $content_flags    = $config_options[$content_types_id];
    325             $at_least_one_content_type_is_included = false;
    326 
    327             foreach ( $content_flags as $content_type_included ) {
    328                 if ( $content_type_included ) {
    329                     $at_least_one_content_type_is_included = true;
    330 
    331                     break;
    332                 }
    333             }
    334 
    335             if (! $at_least_one_content_type_is_included ) {
    336                 if ( $form_id === 'newsmap' ) {
    337                     $config_options[$content_types_id]['post'] = true;
    338                 }
    339                 else {
    340                     $config_options[$content_types_id]['page'] = true;
    341                 }
    342             }
    343 
    344             if ( $form_id == 'site_tree' ) {
     319        switch ( $form_id ) {
     320            case 'site_tree':
    345321                $old_site_tree_id = (int) $this->db->getOption( 'page_for_site_tree' );
     322                break;
     323
     324            case 'sitemap':
     325                $old_sitemap_filename = $this->db->getOption( 'sitemap_filename' );
     326                break;
     327        }
     328       
     329        $content_types_id = $form_id . '_content_types';
     330        $content_flags    = $config_options[$content_types_id];
     331        $at_least_one_content_type_is_included = false;
     332
     333        foreach ( $content_flags as $content_type_included ) {
     334            if ( $content_type_included ) {
     335                $at_least_one_content_type_is_included = true;
     336
     337                break;
     338            }
     339        }
     340
     341        if (! $at_least_one_content_type_is_included ) {
     342            if ( $form_id === 'newsmap' ) {
     343                $config_options[$content_types_id]['post'] = true;
     344            }
     345            else {
     346                $config_options[$content_types_id]['page'] = true;
    346347            }
    347348        }
  • sitetree/tags/6.0.2/data-model/dashboard-page-data.php

    r2517376 r2525101  
    551551
    552552$sitemap_fieldset = new Fieldset( $fieldset_tooltip, 'sitemap_content_types' );
     553$sitemap_fieldset->addField( new Field( 'page', 'Checkbox', 'bool', '', $tooltips['pages'], true ) );
    553554$sitemap_fieldset->addField( new Field( 'post', 'Checkbox', 'bool', '', $tooltips['posts'], true ) );
    554555
     
    567568}
    568569
    569 $sitemap_fieldset->setDescription( __( 'Pages will be included automatically.', 'sitetree' ) );
    570570$sitemap_section->addField( $sitemap_fieldset );
    571571$sitemap_section->addField( new Field( 'max_permalinks_in_sitemap', 'NumberField', 'positive_number',
  • sitetree/tags/6.0.2/includes/builders/stylesheet-builder.class.php

    r2517376 r2525101  
    187187
    188188#counter-head {
    189     width: 30px;
     189    width: 45px;
    190190}
    191191
     
    422422
    423423#counter-head {
    424     width: 30px;
     424    width: 45px;
    425425}
    426426
     
    631631
    632632#counter-head {
    633     min-width: 30px;
     633    min-width: 40px;
    634634}
    635635
  • sitetree/tags/6.0.2/includes/core-delegate.class.php

    r2521279 r2525101  
    231231                            exit;
    232232                        }
     233                    }
     234                    else {
     235                        header( 'HTTP/1.0 404 Not Found' );
     236                           
     237                        exit;
    233238                    }
    234239
  • sitetree/tags/6.0.2/includes/core.class.php

    r2517376 r2525101  
    362362     */
    363363    public function isContentTypeIncluded( $content_type, $sitemap_slug, $default = false ) {
    364         if ( ( $sitemap_slug === 'sitemap' ) && ( $content_type === 'page' ) ) {
    365             return true;
    366         }
    367        
    368364        $option_key_group = $sitemap_slug . '_content_types';
    369365
  • sitetree/tags/6.0.2/includes/indexer.class.php

    r2517376 r2525101  
    158158
    159159            if ( $this->requestedSitemapID == 'index' ) {
    160                 switch ( $this->requestedSitemapSlug ) {
    161                     case 'sitemap':
    162                         $this->requestedSitemapContentType = 'page';
     160                if ( $this->requestedSitemapSlug == 'sitemap' ) {
     161                    $this->requestedSitemapContentType = 'page';
     162                }
     163                else {
     164                    $this->requestedSitemapContentType = 'post';
     165                }
     166
     167                $post_types = get_post_types( array( 'public' => true ) );
     168
     169                foreach ( $post_types as $post_type ) {
     170                    if ( $this->plugin->isContentTypeIncluded( $post_type, $this->requestedSitemapSlug ) ) {
     171                        $this->requestedSitemapContentType = $post_type;
     172
    163173                        break;
    164 
    165                     case 'newsmap':
    166                         $post_types = get_post_types( array( 'public' => true ) );
    167                    
    168                         $this->requestedSitemapContentType = 'post';
    169 
    170                         foreach ( $post_types as $post_type ) {
    171                             if ( $this->plugin->isContentTypeIncluded( $post_type, 'newsmap' ) ) {
    172                                 $this->requestedSitemapContentType = $post_type;
    173 
    174                                 break;
    175                             }
    176                         }
    177                         break;
     174                    }
    178175                }
    179176            }
     
    306303     */
    307304    private function countCustomPosts() {
    308         $meta_keys = $this->db->prepareMetaKey( "exclude_from_{$this->requestedSitemapSlug}" );
     305        $meta_keys  = $this->db->prepareMetaKey( "exclude_from_{$this->requestedSitemapSlug}" );
     306        $post_types = get_post_types( array( 'public' => true ) );
     307       
     308        foreach ( $post_types as $post_type ) {
     309            if ( $this->plugin->isContentTypeIncluded( $post_type, $this->requestedSitemapSlug ) ) {
     310                $this->postTypesList .= "'" . $post_type . "',";
     311            }
     312        }
     313
     314        // Removes the trailing comma from the string.
     315        $this->postTypesList = substr( $this->postTypesList, 0, -1 );
     316
     317        $sitemap_orderby = '';
    309318
    310319        if ( $this->requestedSitemapSlug == 'sitemap' ) {
    311             $this->postTypesList = "'page',";
    312 
    313             $sitemap_orderby         = "CASE WHEN ( content_type = 'page' ) THEN 0 ELSE 1 END,";
    314320            $newsmap_where_condition = '';
    315321            $meta_keys              .= ',';
    316322            $meta_keys              .= $this->db->prepareMetaKey( 'is_ghost_page' );
    317323
     324            if ( $this->plugin->isContentTypeIncluded( 'page', 'sitemap' ) ) {
     325                $sitemap_orderby = "CASE WHEN ( content_type = 'page' ) THEN 0 ELSE 1 END,";
     326            }
     327
    318328            if ( get_option( 'page_on_front' ) <= 0 ) {
    319329                $this->totalNumberOfPermalinks += 1;
     
    321331        }
    322332        else {
    323             $sitemap_orderby         = '';
    324333            $newsmap_where_condition = 'AND ( p.post_date_gmt >= UTC_TIMESTAMP() - INTERVAL 2 DAY )';
    325334        }
    326 
    327         $post_types = get_post_types( array( 'public' => true ) );
    328        
    329         foreach ( $post_types as $post_type ) {
    330             if ( $this->plugin->isContentTypeIncluded( $post_type, $this->requestedSitemapSlug ) ) {
    331                 $this->postTypesList .= "'" . $post_type . "',";
    332             }
    333         }
    334 
    335         // Removes the trailing comma from the string.
    336         $this->postTypesList = substr( $this->postTypesList, 0, -1 );
    337335
    338336        $query_clauses = array(
  • sitetree/tags/6.0.2/includes/upgrader.class.php

    r2517376 r2525101  
    2626            delete_transient( 'sitetree_xml' );
    2727        }
     28        elseif ( version_compare( $version_to_upgrade_from, '6.0', '>=' ) ) {
     29            if ( version_compare( $version_to_upgrade_from, '6.0.2', '<' ) ) {
     30                $this->includePageContentTypeInSitemap();
     31            }
     32        }
    2833        elseif ( version_compare( $version_to_upgrade_from, '5.0', '>=' ) ) {
    2934            if ( version_compare( $version_to_upgrade_from, '5.1', '<' ) ) {
     
    3439            }
    3540
    36             if ( version_compare( $version_to_upgrade_from, '6.0', '<' ) ) {
    37                 $this->db->deleteNonAutoloadOption( 'stats' );
    38                
    39                 $this->plugin->registerRewriteRules();
    40                 flush_rewrite_rules( false );
    41             }
     41            $this->includePageContentTypeInSitemap();
     42            $this->db->deleteNonAutoloadOption( 'stats' );
     43
     44            $this->plugin->registerRewriteRules();
     45            flush_rewrite_rules( false );
    4246        }
    4347        elseif ( version_compare( $version_to_upgrade_from, '4.0', '>=' ) ) {
     
    359363        $this->db->deleteOption( 'exclude_childs', 'page', 'site_tree' );
    360364    }
     365
     366    /**
     367     * @since 6.0.2
     368     */
     369    private function includePageContentTypeInSitemap() {
     370        if ( $this->plugin->isSitemapActive( 'sitemap' ) ) {
     371            $this->db->setOption( 'page', true, 'sitemap_content_types' );
     372        }
     373    }
    361374}
  • sitetree/tags/6.0.2/readme.txt

    r2521279 r2525101  
    77Tested up to: 5.7.1
    88Requires PHP: 5.6.20
    9 Stable tag: 6.0.1
     9Stable tag: 6.0.2
    1010License: GPLv3
    1111License URI: https://opensource.org/licenses/GPL-3.0
     
    135135== Upgrade Notice ==
    136136
    137 = 6.0.1 =
     137= 6.0.2 =
    138138
    139139You might need to act on the 'Max. number of items' setting in the 'Site Tree Settings' screen to allow the plugin to show in the Site Tree the whole list of your Posts or Custom Posts.
     
    142142== Changelog ==
    143143
     144= 6.0.2 (3 May 2021) =
     145
     146Now you can tell SiteTree to not generate the 'Page' Google Sitemap by excluding the 'page' content type — you have to click on 'Configure' in the 'Google Sitemaps' pane.
     147
     148Also, fixed a bug that caused non-existent Google Sitemaps to be served anyway as empty sitemaps.
     149
     150
    144151= 6.0.1 (26 April 2021) =
    145152
    146 Fixed a bug where a PHP notice could show up in the site's homepage when a static homepage was set.
     153Fixed a bug where a PHP notice could show up in the site's home page when a static home page was set.
    147154
    148155
  • sitetree/tags/6.0.2/sitetree.php

    r2521279 r2525101  
    44 * Plugin URI: https://luigicavalieri.com/sitetree/
    55 * Description: Sitemaps, Hyper-lists and Beyond.
    6  * Version: 6.0.1
     6 * Version: 6.0.2
    77 * Requires: 5.5
    88 * Supported Leaves: wonder 1.1, multilingual 1.1
     
    1414 *
    1515 * @package SiteTree
    16  * @version 6.0.1
     16 * @version 6.0.2
    1717 * @copyright Copyright 2021 Luigi Cavalieri.
    1818 * @license https://opensource.org/licenses/GPL-3.0 GPL v3.0
  • sitetree/trunk/admin/page-controller-classes.php

    r2521279 r2525101  
    317317        $sitemap_filename_has_changed = false;
    318318
    319         if ( $form_id == 'sitemap' ) {
    320             $old_sitemap_filename = $this->db->getOption( 'sitemap_filename' );
    321         }
    322         else {
    323             $content_types_id = $form_id . '_content_types';
    324             $content_flags    = $config_options[$content_types_id];
    325             $at_least_one_content_type_is_included = false;
    326 
    327             foreach ( $content_flags as $content_type_included ) {
    328                 if ( $content_type_included ) {
    329                     $at_least_one_content_type_is_included = true;
    330 
    331                     break;
    332                 }
    333             }
    334 
    335             if (! $at_least_one_content_type_is_included ) {
    336                 if ( $form_id === 'newsmap' ) {
    337                     $config_options[$content_types_id]['post'] = true;
    338                 }
    339                 else {
    340                     $config_options[$content_types_id]['page'] = true;
    341                 }
    342             }
    343 
    344             if ( $form_id == 'site_tree' ) {
     319        switch ( $form_id ) {
     320            case 'site_tree':
    345321                $old_site_tree_id = (int) $this->db->getOption( 'page_for_site_tree' );
     322                break;
     323
     324            case 'sitemap':
     325                $old_sitemap_filename = $this->db->getOption( 'sitemap_filename' );
     326                break;
     327        }
     328       
     329        $content_types_id = $form_id . '_content_types';
     330        $content_flags    = $config_options[$content_types_id];
     331        $at_least_one_content_type_is_included = false;
     332
     333        foreach ( $content_flags as $content_type_included ) {
     334            if ( $content_type_included ) {
     335                $at_least_one_content_type_is_included = true;
     336
     337                break;
     338            }
     339        }
     340
     341        if (! $at_least_one_content_type_is_included ) {
     342            if ( $form_id === 'newsmap' ) {
     343                $config_options[$content_types_id]['post'] = true;
     344            }
     345            else {
     346                $config_options[$content_types_id]['page'] = true;
    346347            }
    347348        }
  • sitetree/trunk/data-model/dashboard-page-data.php

    r2517376 r2525101  
    551551
    552552$sitemap_fieldset = new Fieldset( $fieldset_tooltip, 'sitemap_content_types' );
     553$sitemap_fieldset->addField( new Field( 'page', 'Checkbox', 'bool', '', $tooltips['pages'], true ) );
    553554$sitemap_fieldset->addField( new Field( 'post', 'Checkbox', 'bool', '', $tooltips['posts'], true ) );
    554555
     
    567568}
    568569
    569 $sitemap_fieldset->setDescription( __( 'Pages will be included automatically.', 'sitetree' ) );
    570570$sitemap_section->addField( $sitemap_fieldset );
    571571$sitemap_section->addField( new Field( 'max_permalinks_in_sitemap', 'NumberField', 'positive_number',
  • sitetree/trunk/includes/builders/stylesheet-builder.class.php

    r2517376 r2525101  
    187187
    188188#counter-head {
    189     width: 30px;
     189    width: 45px;
    190190}
    191191
     
    422422
    423423#counter-head {
    424     width: 30px;
     424    width: 45px;
    425425}
    426426
     
    631631
    632632#counter-head {
    633     min-width: 30px;
     633    min-width: 40px;
    634634}
    635635
  • sitetree/trunk/includes/core-delegate.class.php

    r2521279 r2525101  
    231231                            exit;
    232232                        }
     233                    }
     234                    else {
     235                        header( 'HTTP/1.0 404 Not Found' );
     236                           
     237                        exit;
    233238                    }
    234239
  • sitetree/trunk/includes/core.class.php

    r2517376 r2525101  
    362362     */
    363363    public function isContentTypeIncluded( $content_type, $sitemap_slug, $default = false ) {
    364         if ( ( $sitemap_slug === 'sitemap' ) && ( $content_type === 'page' ) ) {
    365             return true;
    366         }
    367        
    368364        $option_key_group = $sitemap_slug . '_content_types';
    369365
  • sitetree/trunk/includes/indexer.class.php

    r2517376 r2525101  
    158158
    159159            if ( $this->requestedSitemapID == 'index' ) {
    160                 switch ( $this->requestedSitemapSlug ) {
    161                     case 'sitemap':
    162                         $this->requestedSitemapContentType = 'page';
     160                if ( $this->requestedSitemapSlug == 'sitemap' ) {
     161                    $this->requestedSitemapContentType = 'page';
     162                }
     163                else {
     164                    $this->requestedSitemapContentType = 'post';
     165                }
     166
     167                $post_types = get_post_types( array( 'public' => true ) );
     168
     169                foreach ( $post_types as $post_type ) {
     170                    if ( $this->plugin->isContentTypeIncluded( $post_type, $this->requestedSitemapSlug ) ) {
     171                        $this->requestedSitemapContentType = $post_type;
     172
    163173                        break;
    164 
    165                     case 'newsmap':
    166                         $post_types = get_post_types( array( 'public' => true ) );
    167                    
    168                         $this->requestedSitemapContentType = 'post';
    169 
    170                         foreach ( $post_types as $post_type ) {
    171                             if ( $this->plugin->isContentTypeIncluded( $post_type, 'newsmap' ) ) {
    172                                 $this->requestedSitemapContentType = $post_type;
    173 
    174                                 break;
    175                             }
    176                         }
    177                         break;
     174                    }
    178175                }
    179176            }
     
    306303     */
    307304    private function countCustomPosts() {
    308         $meta_keys = $this->db->prepareMetaKey( "exclude_from_{$this->requestedSitemapSlug}" );
     305        $meta_keys  = $this->db->prepareMetaKey( "exclude_from_{$this->requestedSitemapSlug}" );
     306        $post_types = get_post_types( array( 'public' => true ) );
     307       
     308        foreach ( $post_types as $post_type ) {
     309            if ( $this->plugin->isContentTypeIncluded( $post_type, $this->requestedSitemapSlug ) ) {
     310                $this->postTypesList .= "'" . $post_type . "',";
     311            }
     312        }
     313
     314        // Removes the trailing comma from the string.
     315        $this->postTypesList = substr( $this->postTypesList, 0, -1 );
     316
     317        $sitemap_orderby = '';
    309318
    310319        if ( $this->requestedSitemapSlug == 'sitemap' ) {
    311             $this->postTypesList = "'page',";
    312 
    313             $sitemap_orderby         = "CASE WHEN ( content_type = 'page' ) THEN 0 ELSE 1 END,";
    314320            $newsmap_where_condition = '';
    315321            $meta_keys              .= ',';
    316322            $meta_keys              .= $this->db->prepareMetaKey( 'is_ghost_page' );
    317323
     324            if ( $this->plugin->isContentTypeIncluded( 'page', 'sitemap' ) ) {
     325                $sitemap_orderby = "CASE WHEN ( content_type = 'page' ) THEN 0 ELSE 1 END,";
     326            }
     327
    318328            if ( get_option( 'page_on_front' ) <= 0 ) {
    319329                $this->totalNumberOfPermalinks += 1;
     
    321331        }
    322332        else {
    323             $sitemap_orderby         = '';
    324333            $newsmap_where_condition = 'AND ( p.post_date_gmt >= UTC_TIMESTAMP() - INTERVAL 2 DAY )';
    325334        }
    326 
    327         $post_types = get_post_types( array( 'public' => true ) );
    328        
    329         foreach ( $post_types as $post_type ) {
    330             if ( $this->plugin->isContentTypeIncluded( $post_type, $this->requestedSitemapSlug ) ) {
    331                 $this->postTypesList .= "'" . $post_type . "',";
    332             }
    333         }
    334 
    335         // Removes the trailing comma from the string.
    336         $this->postTypesList = substr( $this->postTypesList, 0, -1 );
    337335
    338336        $query_clauses = array(
  • sitetree/trunk/includes/upgrader.class.php

    r2517376 r2525101  
    2626            delete_transient( 'sitetree_xml' );
    2727        }
     28        elseif ( version_compare( $version_to_upgrade_from, '6.0', '>=' ) ) {
     29            if ( version_compare( $version_to_upgrade_from, '6.0.2', '<' ) ) {
     30                $this->includePageContentTypeInSitemap();
     31            }
     32        }
    2833        elseif ( version_compare( $version_to_upgrade_from, '5.0', '>=' ) ) {
    2934            if ( version_compare( $version_to_upgrade_from, '5.1', '<' ) ) {
     
    3439            }
    3540
    36             if ( version_compare( $version_to_upgrade_from, '6.0', '<' ) ) {
    37                 $this->db->deleteNonAutoloadOption( 'stats' );
    38                
    39                 $this->plugin->registerRewriteRules();
    40                 flush_rewrite_rules( false );
    41             }
     41            $this->includePageContentTypeInSitemap();
     42            $this->db->deleteNonAutoloadOption( 'stats' );
     43
     44            $this->plugin->registerRewriteRules();
     45            flush_rewrite_rules( false );
    4246        }
    4347        elseif ( version_compare( $version_to_upgrade_from, '4.0', '>=' ) ) {
     
    359363        $this->db->deleteOption( 'exclude_childs', 'page', 'site_tree' );
    360364    }
     365
     366    /**
     367     * @since 6.0.2
     368     */
     369    private function includePageContentTypeInSitemap() {
     370        if ( $this->plugin->isSitemapActive( 'sitemap' ) ) {
     371            $this->db->setOption( 'page', true, 'sitemap_content_types' );
     372        }
     373    }
    361374}
  • sitetree/trunk/readme.txt

    r2521279 r2525101  
    77Tested up to: 5.7.1
    88Requires PHP: 5.6.20
    9 Stable tag: 6.0.1
     9Stable tag: 6.0.2
    1010License: GPLv3
    1111License URI: https://opensource.org/licenses/GPL-3.0
     
    135135== Upgrade Notice ==
    136136
    137 = 6.0.1 =
     137= 6.0.2 =
    138138
    139139You might need to act on the 'Max. number of items' setting in the 'Site Tree Settings' screen to allow the plugin to show in the Site Tree the whole list of your Posts or Custom Posts.
     
    142142== Changelog ==
    143143
     144= 6.0.2 (3 May 2021) =
     145
     146Now you can tell SiteTree to not generate the 'Page' Google Sitemap by excluding the 'page' content type — you have to click on 'Configure' in the 'Google Sitemaps' pane.
     147
     148Also, fixed a bug that caused non-existent Google Sitemaps to be served anyway as empty sitemaps.
     149
     150
    144151= 6.0.1 (26 April 2021) =
    145152
    146 Fixed a bug where a PHP notice could show up in the site's homepage when a static homepage was set.
     153Fixed a bug where a PHP notice could show up in the site's home page when a static home page was set.
    147154
    148155
  • sitetree/trunk/sitetree.php

    r2521279 r2525101  
    44 * Plugin URI: https://luigicavalieri.com/sitetree/
    55 * Description: Sitemaps, Hyper-lists and Beyond.
    6  * Version: 6.0.1
     6 * Version: 6.0.2
    77 * Requires: 5.5
    88 * Supported Leaves: wonder 1.1, multilingual 1.1
     
    1414 *
    1515 * @package SiteTree
    16  * @version 6.0.1
     16 * @version 6.0.2
    1717 * @copyright Copyright 2021 Luigi Cavalieri.
    1818 * @license https://opensource.org/licenses/GPL-3.0 GPL v3.0
Note: See TracChangeset for help on using the changeset viewer.