WordPress.org

Plugin Directory

Changeset 618035


Ignore:
Timestamp:
10/27/12 14:35:15 (18 months ago)
Author:
eskapism
Message:

version 1.0.6

Location:
simple-history
Files:
2 edited
7 copied

Legend:

Unmodified
Added
Removed
  • simple-history/tags/1.0.6/index.php

    r607619 r618035  
    44Plugin URI: http://eskapism.se/code-playground/simple-history/ 
    55Description: Get a log/history/audit log/version history of the changes made by users in WordPress. 
    6 Version: 1.0.5 
     6Version: 1.0.6 
    77Author: Pär Thernström 
    88Author URI: http://eskapism.se/ 
     
    2828load_plugin_textdomain('simple-history', false, "/simple-history/languages"); 
    2929 
    30 define( "SIMPLE_HISTORY_VERSION", "1.0.5"); 
     30define( "SIMPLE_HISTORY_VERSION", "1.0.6"); 
    3131define( "SIMPLE_HISTORY_NAME", "Simple History");  
    3232define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/'); 
     
    3939     var 
    4040        $plugin_foldername_and_filename, 
    41         $view_history_capability; 
    42  
    43      static $pager_size = 5; 
     41        $view_history_capability 
     42        ; 
    4443 
    4544     function __construct() { 
     
    5756         
    5857        $this->add_types_for_translation(); 
     58    } 
     59     
     60    function get_pager_size() { 
     61        $pager_size = get_option("simple_history_pager_size", 5); 
     62        return $pager_size; 
    5963    } 
    6064     
     
    252256        add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug"); 
    253257 
    254         add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"),  "simple_history_settings_field",            "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    255         add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"),             "simple_history_settings_field_rss",        "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    256         add_settings_field("simple_history_settings_field_4", __("Clear log", "simple-history"),            "simple_history_settings_field_clear_log",  "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    257         add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"),               "simple_history_settings_field_donate",     "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     258        add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"),  "simple_history_settings_field",                            "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     259        add_settings_field("simple_history_settings_field_5", __("Number of items per page", "simple-history"),         "simple_history_settings_field_number_of_items",            "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     260        add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"),             "simple_history_settings_field_rss",                        "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     261        add_settings_field("simple_history_settings_field_4", __("Clear log", "simple-history"),            "simple_history_settings_field_clear_log",                  "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     262        add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"),               "simple_history_settings_field_donate",                     "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    258263 
    259264        register_setting("simple_history_settings_group", "simple_history_show_on_dashboard"); 
    260265        register_setting("simple_history_settings_group", "simple_history_show_as_page"); 
     266        register_setting("simple_history_settings_group", "simple_history_pager_size"); 
    261267     
    262268    } 
     
    360366    function ajax() { 
    361367     
     368        global $simple_history; 
     369     
    362370        $type = isset($_POST["type"]) ? $_POST["type"] : ""; 
    363371        $subtype = isset($_POST["subtype"]) ? $_POST["subtype"] : ""; 
     
    373381     
    374382        // number of items to get 
    375         $items = (int) (isset($_POST["items"])) ? $_POST["items"] : 5; 
     383        $items = (int) (isset($_POST["items"])) ? $_POST["items"] : $simple_history->get_pager_size(); 
    376384 
    377385        // number of prev added items = number of items to skip before starting to add $items num of new items 
    378         $num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : 5; 
     386        $num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : $simple_history->get_pager_size(); 
    379387     
    380388        $search = (isset($_POST["search"])) ? $_POST["search"] : ""; 
     
    414422            $arr_json["filtered_items_total_count"] = sizeof($all_items); 
    415423            $arr_json["filtered_items_total_count_string"] = sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items)); 
    416             $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / simple_history::$pager_size); 
     424            $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / $simple_history->get_pager_size()); 
    417425        } 
    418426         
     
    445453    $setting = apply_filters("simple_history_show_as_page", $setting); 
    446454    return (bool) $setting; 
     455 
     456} 
     457 
     458function simple_history_settings_field_number_of_items() { 
     459     
     460    global $simple_history; 
     461    $current_pager_size = $simple_history->get_pager_size(); 
     462 
     463    ?> 
     464    <select name="simple_history_pager_size"> 
     465        <option <?php echo $current_pager_size == 5 ? "selected" : "" ?> value="5">5</option> 
     466        <option <?php echo $current_pager_size == 10 ? "selected" : "" ?> value="10">10</option> 
     467        <option <?php echo $current_pager_size == 15 ? "selected" : "" ?> value="15">15</option> 
     468        <option <?php echo $current_pager_size == 20 ? "selected" : "" ?> value="20">20</option> 
     469        <option <?php echo $current_pager_size == 25 ? "selected" : "" ?> value="25">25</option> 
     470        <option <?php echo $current_pager_size == 30 ? "selected" : "" ?> value="30">30</option> 
     471        <option <?php echo $current_pager_size == 40 ? "selected" : "" ?> value="40">40</option> 
     472        <option <?php echo $current_pager_size == 50 ? "selected" : "" ?> value="50">50</option> 
     473        <option <?php echo $current_pager_size == 75 ? "selected" : "" ?> value="75">75</option> 
     474        <option <?php echo $current_pager_size == 100 ? "selected" : "" ?> value="100">100</option> 
     475    </select> 
     476    <? 
    447477 
    448478} 
     
    875905function simple_history_management_page() { 
    876906 
     907    global $simple_history; 
     908 
    877909    simple_history_purge_db(); 
    878910 
     
    883915        <?php    
    884916        simple_history_print_nav(array("from_page=1")); 
    885         echo simple_history_print_history(array("items" => 5, "from_page" => "1")); 
     917        echo simple_history_print_history(array("items" => $simple_history->get_pager_size(), "from_page" => "1")); 
    886918        echo simple_history_get_pagination(); 
    887919        ?> 
     
    10951127 
    10961128    // pagination 
     1129    global $simple_history; 
    10971130    $all_items = simple_history_get_items_array("items=all"); 
    10981131    $items_count = sizeof($all_items); 
    1099     $pages_count = ceil($items_count/simple_history::$pager_size); 
     1132    $pages_count = ceil($items_count/$simple_history->get_pager_size()); 
    11001133    $page_current = 1; 
    11011134 
     
    11341167function simple_history_get_items_array($args = "") { 
    11351168 
    1136     global $wpdb; 
     1169    global $wpdb, $simple_history; 
    11371170     
    11381171    $defaults = array( 
    11391172        "page"        => 0, 
    1140         "items"       => 5, 
     1173        "items"       => $simple_history->get_pager_size(), 
    11411174        "filter_type" => "", 
    11421175        "filter_user" => "", 
     
    13001333function simple_history_print_history($args = null) { 
    13011334     
     1335    global $simple_history; 
     1336     
    13021337    $arr_events = simple_history_get_items_array($args); 
    13031338    #sf_d($args);sf_d($arr_events); 
    13041339    $defaults = array( 
    13051340        "page" => 0, 
    1306         "items" => 5, 
     1341        "items" => $simple_history->get_pager_size(), 
    13071342        "filter_type" => "", 
    13081343        "filter_user" => "", 
  • simple-history/tags/1.0.6/readme.txt

    r607619 r618035  
    55Requires at least: 3.0 
    66Tested up to: 3.4.2 
    7 Stable tag: 1.0.5 
     7Stable tag: 1.0.6 
    88 
    99View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more. 
     
    9292 
    9393== Changelog == 
     94 
     95= 1.0.6 = 
     96- Added: option to set number of items to show, per page. Default i 5 history log items. 
    9497 
    9598= 1.0.5 = 
  • simple-history/trunk/index.php

    r607619 r618035  
    44Plugin URI: http://eskapism.se/code-playground/simple-history/ 
    55Description: Get a log/history/audit log/version history of the changes made by users in WordPress. 
    6 Version: 1.0.5 
     6Version: 1.0.6 
    77Author: Pär Thernström 
    88Author URI: http://eskapism.se/ 
     
    2828load_plugin_textdomain('simple-history', false, "/simple-history/languages"); 
    2929 
    30 define( "SIMPLE_HISTORY_VERSION", "1.0.5"); 
     30define( "SIMPLE_HISTORY_VERSION", "1.0.6"); 
    3131define( "SIMPLE_HISTORY_NAME", "Simple History");  
    3232define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/'); 
     
    3939     var 
    4040        $plugin_foldername_and_filename, 
    41         $view_history_capability; 
    42  
    43      static $pager_size = 5; 
     41        $view_history_capability 
     42        ; 
    4443 
    4544     function __construct() { 
     
    5756         
    5857        $this->add_types_for_translation(); 
     58    } 
     59     
     60    function get_pager_size() { 
     61        $pager_size = get_option("simple_history_pager_size", 5); 
     62        return $pager_size; 
    5963    } 
    6064     
     
    252256        add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug"); 
    253257 
    254         add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"),  "simple_history_settings_field",            "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    255         add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"),             "simple_history_settings_field_rss",        "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    256         add_settings_field("simple_history_settings_field_4", __("Clear log", "simple-history"),            "simple_history_settings_field_clear_log",  "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    257         add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"),               "simple_history_settings_field_donate",     "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     258        add_settings_field("simple_history_settings_field_1", __("Show Simple History", "simple-history"),  "simple_history_settings_field",                            "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     259        add_settings_field("simple_history_settings_field_5", __("Number of items per page", "simple-history"),         "simple_history_settings_field_number_of_items",            "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     260        add_settings_field("simple_history_settings_field_2", __("RSS feed", "simple-history"),             "simple_history_settings_field_rss",                        "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     261        add_settings_field("simple_history_settings_field_4", __("Clear log", "simple-history"),            "simple_history_settings_field_clear_log",                  "simple_history_settings_menu_slug", "simple_history_settings_section"); 
     262        add_settings_field("simple_history_settings_field_3", __("Donate", "simple-history"),               "simple_history_settings_field_donate",                     "simple_history_settings_menu_slug", "simple_history_settings_section"); 
    258263 
    259264        register_setting("simple_history_settings_group", "simple_history_show_on_dashboard"); 
    260265        register_setting("simple_history_settings_group", "simple_history_show_as_page"); 
     266        register_setting("simple_history_settings_group", "simple_history_pager_size"); 
    261267     
    262268    } 
     
    360366    function ajax() { 
    361367     
     368        global $simple_history; 
     369     
    362370        $type = isset($_POST["type"]) ? $_POST["type"] : ""; 
    363371        $subtype = isset($_POST["subtype"]) ? $_POST["subtype"] : ""; 
     
    373381     
    374382        // number of items to get 
    375         $items = (int) (isset($_POST["items"])) ? $_POST["items"] : 5; 
     383        $items = (int) (isset($_POST["items"])) ? $_POST["items"] : $simple_history->get_pager_size(); 
    376384 
    377385        // number of prev added items = number of items to skip before starting to add $items num of new items 
    378         $num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : 5; 
     386        $num_added = (int) (isset($_POST["num_added"])) ? $_POST["num_added"] : $simple_history->get_pager_size(); 
    379387     
    380388        $search = (isset($_POST["search"])) ? $_POST["search"] : ""; 
     
    414422            $arr_json["filtered_items_total_count"] = sizeof($all_items); 
    415423            $arr_json["filtered_items_total_count_string"] = sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items)); 
    416             $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / simple_history::$pager_size); 
     424            $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / $simple_history->get_pager_size()); 
    417425        } 
    418426         
     
    445453    $setting = apply_filters("simple_history_show_as_page", $setting); 
    446454    return (bool) $setting; 
     455 
     456} 
     457 
     458function simple_history_settings_field_number_of_items() { 
     459     
     460    global $simple_history; 
     461    $current_pager_size = $simple_history->get_pager_size(); 
     462 
     463    ?> 
     464    <select name="simple_history_pager_size"> 
     465        <option <?php echo $current_pager_size == 5 ? "selected" : "" ?> value="5">5</option> 
     466        <option <?php echo $current_pager_size == 10 ? "selected" : "" ?> value="10">10</option> 
     467        <option <?php echo $current_pager_size == 15 ? "selected" : "" ?> value="15">15</option> 
     468        <option <?php echo $current_pager_size == 20 ? "selected" : "" ?> value="20">20</option> 
     469        <option <?php echo $current_pager_size == 25 ? "selected" : "" ?> value="25">25</option> 
     470        <option <?php echo $current_pager_size == 30 ? "selected" : "" ?> value="30">30</option> 
     471        <option <?php echo $current_pager_size == 40 ? "selected" : "" ?> value="40">40</option> 
     472        <option <?php echo $current_pager_size == 50 ? "selected" : "" ?> value="50">50</option> 
     473        <option <?php echo $current_pager_size == 75 ? "selected" : "" ?> value="75">75</option> 
     474        <option <?php echo $current_pager_size == 100 ? "selected" : "" ?> value="100">100</option> 
     475    </select> 
     476    <? 
    447477 
    448478} 
     
    875905function simple_history_management_page() { 
    876906 
     907    global $simple_history; 
     908 
    877909    simple_history_purge_db(); 
    878910 
     
    883915        <?php    
    884916        simple_history_print_nav(array("from_page=1")); 
    885         echo simple_history_print_history(array("items" => 5, "from_page" => "1")); 
     917        echo simple_history_print_history(array("items" => $simple_history->get_pager_size(), "from_page" => "1")); 
    886918        echo simple_history_get_pagination(); 
    887919        ?> 
     
    10951127 
    10961128    // pagination 
     1129    global $simple_history; 
    10971130    $all_items = simple_history_get_items_array("items=all"); 
    10981131    $items_count = sizeof($all_items); 
    1099     $pages_count = ceil($items_count/simple_history::$pager_size); 
     1132    $pages_count = ceil($items_count/$simple_history->get_pager_size()); 
    11001133    $page_current = 1; 
    11011134 
     
    11341167function simple_history_get_items_array($args = "") { 
    11351168 
    1136     global $wpdb; 
     1169    global $wpdb, $simple_history; 
    11371170     
    11381171    $defaults = array( 
    11391172        "page"        => 0, 
    1140         "items"       => 5, 
     1173        "items"       => $simple_history->get_pager_size(), 
    11411174        "filter_type" => "", 
    11421175        "filter_user" => "", 
     
    13001333function simple_history_print_history($args = null) { 
    13011334     
     1335    global $simple_history; 
     1336     
    13021337    $arr_events = simple_history_get_items_array($args); 
    13031338    #sf_d($args);sf_d($arr_events); 
    13041339    $defaults = array( 
    13051340        "page" => 0, 
    1306         "items" => 5, 
     1341        "items" => $simple_history->get_pager_size(), 
    13071342        "filter_type" => "", 
    13081343        "filter_user" => "", 
  • simple-history/trunk/readme.txt

    r607619 r618035  
    55Requires at least: 3.0 
    66Tested up to: 3.4.2 
    7 Stable tag: 1.0.5 
     7Stable tag: 1.0.6 
    88 
    99View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more. 
     
    9292 
    9393== Changelog == 
     94 
     95= 1.0.6 = 
     96- Added: option to set number of items to show, per page. Default i 5 history log items. 
    9497 
    9598= 1.0.5 = 
Note: See TracChangeset for help on using the changeset viewer.