Plugin Directory

Changeset 514819


Ignore:
Timestamp:
03/05/2012 05:54:01 PM (14 years ago)
Author:
wmsedgar
Message:

Committing version 1.1.

Location:
wp-html-sitemap/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • wp-html-sitemap/trunk/css/sitemap.css

    r513643 r514819  
    11/*
    2     WP HTML Sitemap v1.0
     2    WP HTML Sitemap v1.1
    33    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    44    http://www.oaktondata.com/wordpress-html-sitemap
  • wp-html-sitemap/trunk/css/style.css

    r513643 r514819  
    11/*
    2     WP HTML Sitemap v1.0
     2    WP HTML Sitemap v1.1
    33    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    44    http://www.oaktondata.com/wordpress-html-sitemap
  • wp-html-sitemap/trunk/inc/AdminPage.php

    r513643 r514819  
    22
    33/*
    4     WP HTML Sitemap v1.0
     4    WP HTML Sitemap v1.1
    55    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    66    http://www.oaktondata.com/wordpress-html-sitemap
  • wp-html-sitemap/trunk/inc/Exception.php

    r513643 r514819  
    22
    33/*
    4     WP HTML Sitemap v1.0
     4    WP HTML Sitemap v1.1
    55    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    66    http://www.oaktondata.com/wordpress-html-sitemap
  • wp-html-sitemap/trunk/inc/Map.php

    r513643 r514819  
    22
    33/*
    4     WP HTML Sitemap v1.0
     4    WP HTML Sitemap v1.1
    55    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    66    http://www.oaktondata.com/wordpress-html-sitemap
  • wp-html-sitemap/trunk/inc/Options.php

    r513643 r514819  
    22
    33/*
    4     WP HTML Sitemap v1.0
     4    WP HTML Sitemap v1.1
    55    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    66    http://www.oaktondata.com/wordpress-html-sitemap
     
    200200            $this->OPTIONS['wp-html-sitemap-general']['defaults'] = array(
    201201                'title' =>                  'Sitemap',
    202                 'name' =>                   'sitemap',
     202                'name' =>                   'html-sitemap',
    203203                'template' =>               'default',
    204204                'type' =>                   'page',
     
    226226        function add_options() {
    227227           
    228             // load settings from external file
    229             $return = $this->load_file_input(
    230                 $file =         WP_HTML_SITEMAP_ADD_OPTIONS,
    231                 $object =       $this,
    232                 $target =       'settings',
    233                 $pattern =      "/obj=/",
    234                 $delimiter =    "/[\s]+/",
    235                 $operator =     "/=/"
    236                 );
     228            try {
     229                // load settings from external file
     230                $return = $this->load_file_input(
     231                    $file =         WP_HTML_SITEMAP_ADD_OPTIONS,
     232                    $object =       $this,
     233                    $target =       'settings',
     234                    $pattern =      "/obj=/",
     235                    $delimiter =    "/[\s]+/",
     236                    $operator =     "/=/"
     237                    );
     238            } catch ( wp_html_sitemap_Exception $e ) {
     239                echo $e->getError();
     240                die( '<p>WP HTML Sitemap exiting.</p>' );
     241            }
    237242               
    238243            // verify load, report error
     
    335340            // loop for each file
    336341            foreach ( $loads as $key => $value ) {
    337                 // load external file
    338                 $return = $this->load_file_input(
    339                     $file = $value,
    340                     $object = $this,
    341                     $target = $key,
    342                     $pattern = "/obj=/",
    343                     $delimiter = "/[\s]+/",
    344                     $operator = "/=/"
    345                     );
    346                 // verify load, report error
    347                 if ( !$return['retval'] ) {
    348                     die( $return['msg'] );
     342                try {
     343                    // load external file
     344                    $return = $this->load_file_input(
     345                        $file = $value,
     346                        $object = $this,
     347                        $target = $key,
     348                        $pattern = "/obj=/",
     349                        $delimiter = "/[\s]+/",
     350                        $operator = "/=/"
     351                        );
     352                } catch ( wp_html_sitemap_Exception $e ) {
     353                    echo $e->getError();
     354                    die( '<p>WP HTML Sitemap exiting.</p>' );
    349355                }
    350356            }
     
    439445            // if input file is not able to be read, alert
    440446            if ( !$input_stream ) {
    441                 return array( 'retval' => false, 'msg' => "error: unable to load $file." );
     447                throw new wp_html_sitemap_Exception( "Unable to load $file." );
    442448            // otherwise proceed
    443449            } else {
     
    454460                    return array( 'retval' => true, 'msg' => "info: loaded $file." );
    455461                } else {
    456                     return array( 'retval' => false, 'msg' => "error: unable to load $file." );
     462                    throw new wp_html_sitemap_Exception( "Unable to load file contents from $file." );
    457463                }
    458464            }
  • wp-html-sitemap/trunk/inc/SitemapShortcode.php

    r513643 r514819  
    22
    33/*
    4     WP HTML Sitemap v1.0
     4    WP HTML Sitemap v1.1
    55    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    66    http://www.oaktondata.com/wordpress-html-sitemap
     
    214214             */
    215215            // section header
     216            global $wpdb;
     217            $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
     218            if ( $numposts < 0 ) {
     219                $numposts = 100;
     220            }
    216221            $html = '<div id="wp_html_sitemap_posts" class="wp_html_sitemap_posts"><h2>Posts</h2><ul>';
    217222            // retrieve categories list
     
    227232                'category' =>       '',
    228233                'exclude' =>        '',
    229                 'numberposts' =>    '',
     234                'numberposts' =>    $numposts,
    230235                'order' =>          'DESC',
    231236                'orderby' =>        'post_date',
  • wp-html-sitemap/trunk/inc/Utilities.php

    r513643 r514819  
    22
    33/*
    4     WP HTML Sitemap v1.0
     4    WP HTML Sitemap v1.1
    55    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    66    http://www.oaktondata.com/wordpress-html-sitemap
  • wp-html-sitemap/trunk/js/wp-html-sitemap.options.js

    r513643 r514819  
    11/*
    2     WP HTML Sitemap v1.0
     2    WP HTML Sitemap v1.1
    33    Contact: Bill Edgar (bill.edgar@oaktondata.com)
    44    http://www.oaktondata.com/wordpress-html-sitemap
    55   
    6     Copyright (c) 2011, Oakton Data LLC
     6    Copyright (c) 2012, Oakton Data LLC
    77    All rights reserved.
    88
  • wp-html-sitemap/trunk/readme.txt

    r513643 r514819  
    55Requires at least: 2.9
    66Tested up to: 3.3.1
    7 Stable tag: 1.0
     7Stable tag: 1.1
    88
    99Add a WordPress HTML sitemap that is fully customizable to improve your website SEO and enable easy navigation for your users.
     
    7272== Changelog ==
    7373
     74= 1.1 =
     75* Updated default options to avoid conflicts with XML sitemaps in WordPress document root.
     76* Added more robust error handling for loading of WP functions required for load of sitemap.
     77* Fixed bug with automatic sitemap generation for non-administrative users.
     78
    7479= 1.0 =
    7580* Initial release
     
    7782== Upgrade Notice ==
    7883
     84= 1.1 =
     85* Updated default options to avoid conflicts with XML sitemaps, minor bug fixes, and enhanced error handling.
     86
    7987= 1.0 =
    8088* Initial release
  • wp-html-sitemap/trunk/wp-html-sitemap.php

    r513643 r514819  
    55    Plugin Name: WP HTML Sitemap
    66    Plugin URI: http://oaktondata.com/wordpress-html-sitemap/
    7     Version: 1.0
     7    Version: 1.1
    88    Author: Bill Edgar
    99    Author URI: http://oaktondata.com
     
    4444
    4545// define constants
    46 define( 'WP_HTML_SITEMAP_VERSION', '1.0' );
     46define( 'WP_HTML_SITEMAP_VERSION', '1.1' );
    4747define( 'WP_HTML_SITEMAP_BASE_URL', network_site_url() );
    4848
     
    9393    } catch ( Exception $e ) {
    9494        echo "<p>" . $e->getMessage() . "</p>";
     95        die( "<p>Unable to include $class_name. WP HTML Sitemap exiting.</p>" );
    9596    }
    9697}
     
    142143            wp_html_sitemap__autoinclude( WP_HTML_SITEMAP_SHORTCODE_CLASS );
    143144           
     145            try {
     146                $this->include_wp_functions();
     147            } catch ( wp_html_sitemap_Exception $e ) {
     148                echo $e->getMessage();
     149                die( "<p>WP HTML Sitemap exiting.</p>" );
     150            }
     151           
    144152            $this->addShortcodes();
    145153           
     
    157165                wp_html_sitemap__autoinclude( WP_HTML_SITEMAP_OPTIONS_CLASS );
    158166                wp_html_sitemap__autoinclude( WP_HTML_SITEMAP_ADMINPAGE_CLASS );
    159                 $wp_admin_includes = strstr( WP_HTML_SITEMAP_INCLUDES, 'wp-content', true ) . 'wp-admin/includes/';
    160                 include_once( $wp_admin_includes . 'theme.php' ); // for WP get_page_templates function
    161                 include_once( $wp_admin_includes . 'plugin.php' ); // for WP get_plugins function
    162167
    163168                // runs when plugin is activated
     
    236241             * @TODO must be updated to include additonal option groups for WP HTML Sitemap Pro
    237242            */
    238             return $options;
     243            if ( $version == '1.0' ) {
     244                return $options;
     245            }
    239246        } // end method do_option_upgrade
     247       
     248        function include_wp_functions() {
     249            $wp_admin_includes = strstr( WP_HTML_SITEMAP_INCLUDES, 'wp-content', true ) . 'wp-admin/includes/';
     250            if ( is_file( $wp_admin_includes . 'theme.php' ) ) {
     251                if ( !function_exists( 'get_page_templates' ) ) {
     252                    if ( !include_once( $wp_admin_includes . 'theme.php' ) ) { // for WP get_page_templates function
     253                        throw new wp_html_sitemap_Exception( 'get_page_templates function not defined.</p>' );
     254                    }
     255                }
     256            } else {
     257                throw new wp_html_sitemap_Exception( $wp_admin_includes . 'theme.php file not found.' );
     258            }
     259            if ( is_file( $wp_admin_includes . 'plugin.php' ) ) {
     260                if ( !function_exists( 'get_plugins' ) ) {
     261                    if ( !include_once( $wp_admin_includes . 'plugin.php' ) ) { // for WP get_plugins function
     262                        throw new wp_html_sitemap_Exception( 'get_plugins function not defined</p>' );
     263                    }
     264                } else {
     265                    throw new wp_html_sitemap_Exception( $wp_admin_includes . 'plugin.php file not found.' );
     266                }
     267            }
     268        }
    240269       
    241270        // method to check options to upgrade plugin options, if necessary
     
    253282                // check to see if option array exists
    254283                if ( $options !== false ) {
     284                    $this->do_option_upgrade( '1.0', $group, $options );
    255285                    // check and upgrade options if necessary
    256286                }
     287                // update new options in wordpress database
     288                update_option(
     289                    $option_name = $group,
     290                    $newvalue = $options
     291                    );
    257292            }
    258293        } // end method upgrade_options
Note: See TracChangeset for help on using the changeset viewer.