WordPress.org

Plugin Directory

Changeset 605848


Ignore:
Timestamp:
09/29/12 16:35:42 (19 months ago)
Author:
eskapism
Message:

fixes and stuff

Location:
simple-history/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • simple-history/trunk/index.php

    r605505 r605848  
    5656        $this->view_history_capability = apply_filters("simple_history_view_history_capability", $this->view_history_capability); 
    5757         
     58        $this->add_types_for_translation(); 
     59    } 
     60     
     61    /** 
     62     * Some post types etc are added as variables from the log, so to catch these for translation I just add them as dummy stuff here. 
     63     * There is probably a better way to do this, but this should work anyway 
     64     */ 
     65    function add_types_for_translation() { 
     66        $dummy = __("approved", "simple-history"); 
     67        $dummy = __("unapproved", "simple-history"); 
     68        $dummy = __("marked as spam", "simple-history"); 
     69        $dummy = __("trashed", "simple-history"); 
     70        $dummy = __("untrashed", "simple-history"); 
     71        $dummy = __("created", "simple-history"); 
     72        $dummy = __("deleted", "simple-history"); 
     73        $dummy = __("updated", "simple-history"); 
     74        $dummy = __("nav_menu_item", "simple-history"); 
     75        $dummy = __("attachment", "simple-history"); 
     76        $dummy = __("user", "simple-history"); 
     77        $dummy = __("settings page", "simple-history"); 
    5878    } 
    5979 
     
    128148    // WordPress Core updated 
    129149    function action_core_updated($wp_version) { 
    130         simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('WordPress Core', 'simple-history') . "&object_id=wordpress_core&object_name=".sprintf(__('WordPress %1$s', 'simple-history'), $wp_version)); 
     150        simple_history_add("action=updated&object_type=wordpress_core&object_id=wordpress_core&object_name=".sprintf(__('WordPress %1$s', 'simple-history'), $wp_version)); 
    131151    } 
    132152 
     
    186206             
    187207            // Store this upgrade in ourself :) 
    188             simple_history_add("action=" . __( 'upgraded it\'s database', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=" . SIMPLE_HISTORY_NAME); 
     208            simple_history_add("action=" . 'upgraded it\'s database' . "&object_type=plugin&object_name=" . SIMPLE_HISTORY_NAME); 
    189209 
    190210            #echo "done upgrading database"; 
     
    228248        add_settings_section("simple_history_settings_section", __("", "simple-history"), "simple_history_settings_page", "simple_history_settings_menu_slug"); 
    229249 
    230         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"); 
    231         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"); 
    232         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"); 
     250        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"); 
     251        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"); 
     252        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"); 
     253        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"); 
    233254 
    234255        register_setting("simple_history_settings_group", "simple_history_show_on_dashboard"); 
     
    335356    function ajax() { 
    336357     
    337         $type = $_POST["type"]; 
    338         if ($type == __( "All types", 'simple-history' )) { $type = ""; } 
     358        $type = isset($_POST["type"]) ? $_POST["type"] : ""; 
     359        $subtype = isset($_POST["subtype"]) ? $_POST["subtype"] : ""; 
    339360     
    340361        $user = $_POST["user"]; 
     
    355376        $search = (isset($_POST["search"])) ? $_POST["search"] : ""; 
    356377     
     378        $filter_type = $type . "/" . $subtype; 
     379 
    357380        $args = array( 
    358381            "is_ajax" => true, 
    359             "filter_type" => $type, 
     382            "filter_type" => $filter_type, 
    360383            "filter_user" => $user, 
    361384            "page" => $page, 
     
    370393            "items_li" => "", 
    371394            "filtered_items_total_count" => 0, 
     395            "filtered_items_total_count_string" => "", 
    372396            "filtered_items_total_pages" => 0 
    373397        ); 
     
    385409            $all_items = simple_history_get_items_array($args); 
    386410            $arr_json["filtered_items_total_count"] = sizeof($all_items); 
     411            $arr_json["filtered_items_total_count_string"] = sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items)); 
    387412            $arr_json["filtered_items_total_pages"] = ceil($arr_json["filtered_items_total_count"] / simple_history::$pager_size); 
    388413        } 
     
    433458     
    434459    <?php 
     460} 
     461 
     462/** 
     463 * Settings section to clear database 
     464 */ 
     465function simple_history_settings_field_clear_log() { 
     466 
     467    $clear_log = false; 
     468 
     469    if (isset($_GET["simple_history_clear_log"]) && $_GET["simple_history_clear_log"]) { 
     470        $clear_log = true; 
     471        echo "<div class='simple-history-settings-page-updated'><p>"; 
     472        _e("Cleared database", 'simple-history'); 
     473        echo "</p></div>"; 
     474    } 
     475     
     476    if ($clear_log) { 
     477        simple_history_clear_log(); 
     478    } 
     479     
     480    _e("Items in the database are automatically removed after 60 days.", 'simple-history'); 
     481    $update_link = add_query_arg("simple_history_clear_log", "1"); 
     482    printf(' <a href="%2$s">%1$s</a>', __('Clear it now.', 'simple-history'), $update_link); 
     483} 
     484 
     485function simple_history_clear_log() { 
     486    global $wpdb; 
     487    $tableprefix = $wpdb->prefix; 
     488    $sql = "DELETE FROM {$tableprefix}simple_history"; 
     489    $wpdb->query($sql); 
    435490} 
    436491 
     
    472527    <?php 
    473528    $create_new_secret = false; 
    474     /* 
    475     // eeek! why was this here? 
    476     if ($rss_secret == false) { 
    477         $create_new_secret = true; 
    478     } 
    479     */ 
    480529    if (isset($_GET["simple_history_rss_update_secret"]) && $_GET["simple_history_rss_update_secret"]) { 
    481530        $create_new_secret = true; 
     
    495544    echo "<br />"; 
    496545    $update_link = add_query_arg("simple_history_rss_update_secret", "1"); 
    497     printf(__("You can <a href='%s#simple-history-settings-page'>generate a new address</a> for the RSS feed. This is useful if you think that the address has fallen into the wrong hands.", 'simple-history'), $update_link); 
     546    printf(__("You can <a href='%s'>generate a new address</a> for the RSS feed. This is useful if you think that the address has fallen into the wrong hands.", 'simple-history'), $update_link); 
    498547} 
    499548 
     
    502551function simple_history_activated_plugin($plugin_name) { 
    503552    $plugin_name = urlencode($plugin_name); 
    504     simple_history_add("action=" . __( 'activated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name"); 
     553    simple_history_add("action=activated&object_type=plugin&object_name=$plugin_name"); 
    505554} 
    506555function simple_history_deactivated_plugin($plugin_name) { 
    507556    $plugin_name = urlencode($plugin_name); 
    508     simple_history_add("action=" . __( 'deactivated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name"); 
     557    simple_history_add("action=deactivated&object_type=plugin&object_name=$plugin_name"); 
    509558} 
    510559 
     
    521570    $str = urlencode($str); 
    522571 
    523     simple_history_add("action=" . __( 'edited', 'simple-history' ) . "&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id"); 
     572    simple_history_add("action=edited&object_type=comment&object_name=$str&object_id=$comment_id"); 
    524573 
    525574} 
     
    537586    $str = urlencode($str); 
    538587 
    539     simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id"); 
     588    simple_history_add("action=deleted&object_type=comment&object_name=$str&object_id=$comment_id"); 
    540589 
    541590} 
     
    553602    $action = ""; 
    554603    if ("approve" == $new_status) { 
    555         $action = __( 'approved', 'simple-history' ); 
     604        $action = 'approved'; 
    556605    } elseif ("hold" == $new_status) { 
    557         $action = __( 'unapproved', 'simple-history' ); 
     606        $action = 'unapproved'; 
    558607    } elseif ("spam" == $new_status) { 
    559         $action = __( 'marked as spam', 'simple-history' ); 
     608        $action = 'marked as spam'; 
    560609    } elseif ("trash" == $new_status) { 
    561         $action = __( 'trashed', 'simple-history' ); 
     610        $action = 'trashed'; 
    562611    } elseif ("0" == $new_status) { 
    563         $action = __( 'untrashed', 'simple-history' ); 
     612        $action = 'untrashed'; 
    564613    } 
    565614 
     
    569618    $str = urlencode($str); 
    570619 
    571     simple_history_add("action=$action&object_type=" . __('Comment') . "&object_name=$str&object_id=$comment_id"); 
     620    simple_history_add("action=$action&object_type=comment&object_name=$str&object_id=$comment_id"); 
    572621 
    573622} 
     
    619668*/ 
    620669 
    621  
    622670function simple_history_add_attachment($attachment_id) { 
    623671    $post = get_post($attachment_id); 
    624672    $post_title = urlencode(get_the_title($post->ID)); 
    625     simple_history_add("action=" . __( 'added', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title"); 
     673    simple_history_add("action=added&object_type=attachment&object_id=$attachment_id&object_name=$post_title"); 
    626674 
    627675} 
     
    630678    $post = get_post($attachment_id); 
    631679    $post_title = urlencode(get_the_title($post->ID)); 
    632     simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title"); 
     680    simple_history_add("action=updated&object_type=attachment&object_id=$attachment_id&object_name=$post_title"); 
    633681} 
    634682function simple_history_delete_attachment($attachment_id) { 
    635683    $post = get_post($attachment_id); 
    636684    $post_title = urlencode(get_the_title($post->ID)); 
    637     simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Attachment', 'simple-history') . "&object_id=$attachment_id&object_name=$post_title"); 
     685    simple_history_add("action=deleted&object_type=attachment&object_id=$attachment_id&object_name=$post_title"); 
    638686} 
    639687 
     
    642690    $user = get_user_by("id", $user_id); 
    643691    $user_nicename = urlencode($user->user_nicename); 
    644     simple_history_add("action=" . __( 'updated', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') . "&object_id=$user_id&object_name=$user_nicename"); 
     692    simple_history_add("action=updated&object_type=user&object_id=$user_id&object_name=$user_nicename"); 
    645693} 
    646694 
     
    656704    $user = get_user_by("id", $user_id); 
    657705    $user_nicename = urlencode($user->user_nicename); 
    658     simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') . "&object_id=$user_id&object_name=$user_nicename"); 
     706    simple_history_add("action=deleted&object_type=user&object_id=$user_id&object_name=$user_nicename"); 
    659707} 
    660708 
     
    670718        $user_id = $current_user->ID; 
    671719    } 
    672     simple_history_add("action=" . __( 'logged in', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=".$user->ID."&user_id=$user_id&object_name=$user_nicename"); 
     720    simple_history_add("action=logged in&object_type=user&object_id=".$user->ID."&user_id=$user_id&object_name=$user_nicename"); 
    673721} 
    674722// user logs out 
     
    677725    $current_user_id = $current_user->ID; 
    678726    $user_nicename = urlencode($current_user->user_nicename); 
    679     simple_history_add("action=" . __( 'logged out', 'simple-history' ) . "&object_type=" . __('User', 'simple-history') ."&object_id=$current_user_id&object_name=$user_nicename"); 
     727    simple_history_add("action=logged out&object_type=user&object_id=$current_user_id&object_name=$user_nicename"); 
    680728} 
    681729 
     
    685733        if ($post->post_status != "auto-draft" && $post->post_status != "inherit") { 
    686734            $post_title = urlencode(get_the_title($post->ID)); 
    687             simple_history_add("action=" . __( 'deleted', 'simple-history' ) . "&object_type=" . __('Post') ."&object_subtype=" . $post->post_type . "&object_id=$post_id&object_name=$post_title"); 
     735            simple_history_add("action=deleted&object_type=post&object_subtype=" . $post->post_type . "&object_id=$post_id&object_name=$post_title"); 
    688736        } 
    689737    } 
     
    722770    if ($old_status == "auto-draft" && ($new_status != "auto-draft" && $new_status != "inherit")) { 
    723771        // page created 
    724         $action = __( "created", 'simple-history' ); 
     772        $action = "created"; 
    725773    } elseif ($new_status == "auto-draft" || ($old_status == "new" && $new_status == "inherit")) { 
    726774        // page...eh.. just leave it. 
    727775        return; 
    728776    } elseif ($new_status == "trash") { 
    729         $action = __( "deleted", 'simple-history' ); 
     777        $action = "deleted"; 
    730778    } else { 
    731779        // page updated. i guess. 
    732         $action = __( "updated", 'simple-history' ); 
     780        $action = "updated"; 
    733781    } 
    734782    $object_type = "post"; 
     
    736784 
    737785    // Attempt to auto-translate post types*/ 
    738     $object_type = __( ucfirst ( $object_type ) ); 
    739     $object_subtype = __( ucfirst ( $object_subtype ) ); 
     786    // no, no longer, do it at presentation instead 
     787    #$object_type = __( ucfirst ( $object_type ) ); 
     788    #$object_subtype = __( ucfirst ( $object_subtype ) ); 
    740789 
    741790    if ($object_subtype == "revision") { 
     
    887936    #} 
    888937 
    889     simple_history_add("action=" . __( 'activated', 'simple-history' ) . "&object_type=" . __('Plugin') . "&object_name=$plugin_name"); 
     938    simple_history_add("action=activated&object_type=plugin&object_name=$plugin_name"); 
    890939 
    891940    // also generate a rss secret, if it does not exist 
     
    911960    $sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype"; 
    912961    $arr_types = $wpdb->get_results($sql); 
    913     #echo "<p>View:</p>"; 
     962 
    914963    $str_types = ""; 
    915964    $str_types .= "<ul class='simple-history-filter simple-history-filter-type'>"; 
     
    919968    } 
    920969 
    921     // add_query_arg( 
    922970    $link = esc_html(add_query_arg("simple_history_type_to_show", "")); 
    923971    $str_types_desc = __("All types", 'simple-history'); 
    924     $str_types .= "<li $css><a href='$link'>" . esc_html($str_types_desc) . "</a> | </li>"; 
     972    $str_types .= "<li $css><a data-simple-history-filter-type='' href='$link'>" . esc_html($str_types_desc) . "</a> | </li>"; 
    925973    foreach ($arr_types as $one_type) { 
    926974        $css = ""; 
     
    930978            $css = "class='selected'"; 
    931979        } 
    932         $str_types .= "<li $css>"; 
     980        $str_types .= sprintf('<li %1$s data-simple-history-filter-type="%2$s" data-simple-history-filter-subtype="%3$s" >', $css, $one_type->object_type, $one_type->object_subtype); 
    933981        $arg = ""; 
    934982        if ($one_type->object_subtype) { 
     
    939987        $link = esc_html(add_query_arg("simple_history_type_to_show", $arg)); 
    940988        $str_types .= "<a href='$link'>"; 
    941         $str_types .= esc_html(__($one_type->object_type)); 
    942         if ($one_type->object_subtype) { 
    943             $str_types .= "/". esc_html(__($one_type->object_subtype)); 
    944         } 
     989         
     990        // Some built in types we translate with built in translation, the others we use simple history for 
     991        $arr_built_in_types_with_translation = array("page", "post"); 
     992        $object_type_translated = ""; 
     993        $object_subtype_translated = ""; 
     994        if ( in_array($one_type->object_type, $arr_built_in_types_with_translation) ) { 
     995            $object_type_translated = esc_html__(ucfirst($one_type->object_type)); 
     996        } else { 
     997            $object_type_translated = esc_html__(ucfirst($one_type->object_type), "simple-history");             
     998        } 
     999        if (in_array($one_type->object_subtype, $arr_built_in_types_with_translation) ) { 
     1000            $object_subtype_translated = esc_html__(ucfirst($one_type->object_subtype));             
     1001        } else { 
     1002            $object_subtype_translated = esc_html__(ucfirst($one_type->object_subtype), "simple-history"); 
     1003        } 
     1004         
     1005        $str_types .= $object_type_translated; 
     1006        if ($object_subtype_translated && $object_subtype_translated != $object_type_translated) { 
     1007            $str_types .= "/". $object_subtype_translated; 
     1008        } 
     1009         
    9451010        $str_types .= "</a> | "; 
    9461011        $str_types .= "</li>"; 
     1012         
     1013        // debug 
     1014        #$str_types .= " type: " . $one_type->object_type; 
     1015        #$str_types .= " type: " . ucfirst($one_type->object_type); 
     1016        #$str_types .= " subtype: " . $one_type->object_subtype. " "; 
     1017         
    9471018    } 
    9481019    $str_types .= "</ul>"; 
     
    9741045    } 
    9751046 
    976     if ($arr_users) { 
     1047    if (isset($arr_users) && $arr_users) { 
    9771048        if (isset($_GET["simple_history_user_to_show"])) { 
    9781049            $simple_history_user_to_show = $_GET["simple_history_user_to_show"]; 
     
    10391110        </div> 
    10401111        ', 
    1041         sprintf( __('<span>%1$d</span> items', "simple-history"), $items_count), 
     1112        sprintf(_n('One item', '%1$d items', sizeof($all_items), "simple-history"), sizeof($all_items)), 
    10421113        $page_current, 
    10431114        $pages_count, 
     
    10871158            $filter_type = $simple_history_type_to_show; 
    10881159        } 
    1089         $where .= " AND lower(object_type) = '".strtolower($filter_type)."' "; 
    1090         $where .= " AND lower(object_subtype) = '".strtolower($filter_subtype)."' "; 
     1160        if ($filter_type) { 
     1161            $where .= " AND lower(object_type) = '" . $wpdb->escape(strtolower($filter_type)) . "' ";        
     1162        } 
     1163        if ($filter_subtype) { 
     1164            $where .= " AND lower(object_subtype) = '" . $wpdb->escape(strtolower($filter_subtype)) . "' "; 
     1165        } 
    10911166    } 
    10921167    if ($simple_history_user_to_show) { 
     
    11031178 
    11041179    $sql = "SELECT * FROM {$tableprefix}simple_history $where ORDER BY date DESC, id DESC "; 
    1105  
     1180#sf_d($args); 
     1181#echo "\n$sql\n"; 
    11061182    $rows = $wpdb->get_results($sql); 
    11071183     
     
    11151191        $prev_row = null; 
    11161192        foreach ($rows as $one_row) { 
     1193             
     1194            // check if this event is same as prev event 
     1195            // todo: how to do with object_name vs object id? 
     1196            // if object_id is same as prev, but object_name differ, then it's the same object but with a new name 
     1197            // we store it as same and use occations to output the name etc of 
    11171198            if ( 
    11181199                $prev_row 
     
    11221203                && $one_row->object_subtype == $prev_row->object_subtype 
    11231204                && $one_row->user_id == $prev_row->user_id 
    1124                 && $one_row->object_id == $prev_row->object_id 
    1125                 && $one_row->object_name == $prev_row->object_name 
     1205                && ( 
     1206                        (!empty($one_row->object_id) && !empty($prev_row->object_id)) 
     1207                        && ($one_row->object_id == $prev_row->object_id) 
     1208                        || ($one_row->object_name == $prev_row->object_name) 
     1209                ) 
    11261210            ) { 
     1211                 
    11271212                // this event is like the previous event, but only with a different date 
    11281213                // so add it to the last element in arr_events 
    11291214                $arr_events[$prev_row->id]->occasions[] = $one_row; 
     1215                 
    11301216            } else { 
    11311217 
     
    11821268    //  
    11831269    //$offset = $args["num_added"]; // old way when we appended 
     1270/* 
     1271<pre class='sf_box_debug'>Array 
     1272( 
     1273    [page] =&gt; 1 
     1274    [items] =&gt; 5 
     1275    [filter_type] =&gt; / 
     1276    [filter_user] =&gt;  
     1277    [is_ajax] =&gt; 1 
     1278    [search] =&gt;  
     1279    [num_added] =&gt; 5 
     1280) 
     1281*/ 
     1282 
    11841283    if (is_numeric($args["items"]) && $args["items"] > 0) { 
    11851284        #sf_d($args); 
     
    11881287        $arr_events = array_splice($arr_events, $offset, $args["items"]); 
    11891288    } 
    1190      
     1289 
    11911290    return $arr_events; 
    11921291     
     
    11981297     
    11991298    $arr_events = simple_history_get_items_array($args); 
    1200  
     1299    #sf_d($args);sf_d($arr_events); 
    12011300    $defaults = array( 
    12021301        "page" => 0, 
     
    12831382            } 
    12841383            $who .= "</span>"; 
    1285             // &rarr; 
    1286  
    1287             /* 
    1288                 sf_d($one_row); 
    1289                 [object_type] => Post 
    1290                 [object_subtype] => Page 
    1291                 somewhere/somewhow object_type turned from being lowercase to being capitalized 
    1292                 unsure if it's me or wp 
    1293                 ah: after some digging it seems to have with translation to do, we changed to upperase 
    1294                 to support translation. 
    1295             */ 
    12961384 
    12971385            // what and object 
     
    12991387                 
    13001388                $post_out = ""; 
    1301                 $post_out .= $object_subtype; 
     1389                $post_out .= esc_html__(ucfirst($object_subtype)); 
    13021390                $post = get_post($object_id); 
    13031391 
     
    13191407                    $post_out .= "</a>"; 
    13201408                } 
    1321                 /* 
    1322                 if ("created" == $action) { 
    1323                     $post_out .= " " . __("created", 'simple-history') . " "; 
    1324                 } elseif ("updated" == $action) { 
    1325                     $post_out .= " " . __("updated", 'simple-history') . " "; 
    1326                 } elseif ("deleted" == $action) { 
    1327                     $post_out .= " " . __("deleted", 'simple-history') . " "; 
    1328                 } else { 
    1329                     */ 
    1330                     $post_out .= " " . esc_html($action); 
    1331                 //} 
     1409 
     1410                $post_out .= " " . esc_html__($action, "simple-history"); 
    13321411                 
    13331412                $post_out = ucfirst($post_out); 
     
    13631442                } 
    13641443 
    1365                 $attachment_out .= " $action "; 
     1444                $attachment_out .= " " . esc_html__($action, "simple-history") . " "; 
    13661445                 
    13671446                $attachment_out = ucfirst($attachment_out); 
     
    13691448 
    13701449            } elseif ("user" == $object_type_lcase) { 
     1450 
    13711451                $user_out = ""; 
    13721452                $user_out .= __("user", 'simple-history'); 
     
    14031483                } 
    14041484 
    1405                 /* 
    1406                 if ("created" == $action) { 
    1407                     $user_out .=  " " . __("added", 'simple-history') . " "; 
    1408                 } elseif ("updated" == $action) { 
    1409                     $user_out .= " " . __("updated", 'simple-history') . " " ; 
    1410                 } elseif ("deleted" == $action) { 
    1411                     $user_out .= " " . __("deleted", 'simple-history') . " "; 
    1412                 } elseif ("logged_in" == $action) { 
    1413                     $user_out .= " " . __("logged in", 'simple-history') . " "; 
    1414                 } elseif ("logged_out" == $action) { 
    1415                     $user_out .= " " . __("logged out", 'simple-history') . " "; 
    1416                 } else { 
    1417                     */ 
    1418                     $user_out .= " " . esc_html($action); 
    1419                 //} 
     1485                $user_out .= " " . esc_html__($action, "simple-history"); 
    14201486                 
    14211487                $user_out = ucfirst($user_out); 
     
    14251491                 
    14261492                $comment_link = get_edit_comment_link($object_id); 
    1427                 $output .= esc_html(ucwords($object_type)) . " " . esc_html($object_subtype) . " <a href='$comment_link'><span class='simple-history-title'>" . esc_html($object_name) . "\"</span></a> " . esc_html($action); 
     1493                $output .= esc_html(ucwords($object_type)) . " " . esc_html($object_subtype) . " <a href='$comment_link'><span class='simple-history-title'>" . esc_html($object_name) . "\"</span></a> " . esc_html__($action, "simple-history"); 
    14281494 
    14291495            } else { 
     
    14481514                        $unknown_action = $unknown_action; // dah! 
    14491515                } 
    1450                 $output .= esc_html(ucwords($object_type)) . " " . esc_html($object_subtype) . " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span> " . esc_html($unknown_action); 
     1516                $output .= ucwords(esc_html__($object_type, "simple-history")) . " " . ucwords(esc_html__($object_subtype, "simple-history")) . " <span class='simple-history-title'>\"" . esc_html($object_name) . "\"</span> " . esc_html($unknown_action); 
    14511517 
    14521518            } 
     
    15111577            $loading = __("Loading...", 'simple-history'); 
    15121578            $loading =  "<img src='".site_url("wp-admin/images/loading.gif")."' width=16 height=16>" . $loading; 
    1513             $no_found = __("No matchin items found.", 'simple-history'); 
     1579            $no_found = __("No matching items found.", 'simple-history'); 
    15141580            $view_rss = __("RSS feed", 'simple-history'); 
    15151581            $view_rss_link = simple_history_get_rss_address(); 
     
    15581624    if (isset($arr_options_names[$option_page])) { 
    15591625        $option_page_name = $arr_options_names[$option_page]; 
    1560         simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name"); 
     1626        simple_history_add("action=modified&object_type=settings page&object_id=$option_page&object_name=$option_page_name"); 
    15611627    } 
    15621628 
     
    15701636        $option_page_name = __("Permalink Settings"); 
    15711637        $option_page = "permalink"; 
    1572         simple_history_add("action=" . __( 'modified', 'simple-history' ) . "&object_type=" . __('Settings page', 'simple-history') . "&object_id=$option_page&object_name=$option_page_name"); 
    1573     } 
    1574  
    1575 } 
    1576  
     1638        simple_history_add("action=modified&object_type=settings page&object_id=$option_page&object_name=$option_page_name"); 
     1639    } 
     1640 
     1641} 
     1642 
  • simple-history/trunk/readme.txt

    r605505 r605848  
    9292 
    9393== Changelog == 
     94 
     95= 1.0.4 = 
     96- You may want to clear the history database after this update because the items in the log will have mixed translate/untranslated status and it may look/work a bit strange. 
     97- No longer stored translated history items in the log. This makes the history work even if/when you switch langauge of WordPress. 
     98- Fixed: if for example a post was editied several times and during these edits it changed name, it would end up at different occasions. Now it's correctly stored as one event with several occasions. 
     99- Some more items are translateable 
    94100 
    95101= 1.0.3 = 
  • simple-history/trunk/scripts.js

    r602653 r605848  
    3838        $first_page = $tablenav.find(".first-page"), 
    3939        $last_page = $tablenav.find(".last-page"), 
    40         $displaying_num = $tablenav.find(".displaying-num span"); 
     40        $displaying_num = $tablenav.find(".displaying-num"); 
    4141 
    4242    e.preventDefault(); 
     
    8787    $current_page.val(simple_history_current_page+1); 
    8888     
     89    var type = jQuery("ul.simple-history-filter-type li.selected").data("simple-history-filter-type"); 
     90    var subtype = jQuery("ul.simple-history-filter-type li.selected").data("simple-history-filter-subtype"); 
     91     
    8992    var data = { 
    9093        "action": "simple_history_ajax", 
    91         "type": jQuery("ul.simple-history-filter-type li.selected a").text(), 
     94        "type": type, 
     95        "subtype" : subtype, 
    9296        "user": jQuery("ul.simple-history-filter-user li.selected a").text(), 
    9397        "search": search, 
     
    108112 
    109113        } else { 
    110          
     114 
    111115            // update number of existing items and total pages 
    112             $displaying_num.html(data.filtered_items_total_count); 
     116            $displaying_num.html(data.filtered_items_total_count_string); 
    113117            $total_pages.text(data.filtered_items_total_pages); 
    114118         
Note: See TracChangeset for help on using the changeset viewer.