WordPress.org

Plugin Directory

Changeset 730884


Ignore:
Timestamp:
06/24/13 13:34:57 (10 months ago)
Author:
eskapism
Message:

version 1.3.4

Location:
simple-history
Files:
1 deleted
2 edited
13 copied

Legend:

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

    r730740 r730884  
    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.3.3 
     6Version: 1.3.4 
    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.3.3"); 
     30define( "SIMPLE_HISTORY_VERSION", "1.3.4"); 
    3131define( "SIMPLE_HISTORY_NAME", "Simple History"); 
    3232 
     
    11891189    } 
    11901190 
    1191     // Begin list 
    1192     $str_types = ""; 
    1193     $str_types .= "<ul class='simple-history-filter simple-history-filter-type'>"; 
    1194  
    11951191    // Begin select 
    11961192    $str_types_select = ""; 
     
    12051201    $link = esc_html(add_query_arg("simple_history_type_to_show", "")); 
    12061202    $str_types_desc = __("All types", 'simple-history'); 
    1207     $str_types .= "<li $css><a data-simple-history-filter-type='' href='$link'>" . esc_html($str_types_desc) . " <span>($total_object_num_count)</span></a> | </li>"; 
    12081203 
    12091204    $str_types_select .= sprintf('<option data-simple-history-filter-type="" data-simple-history-filter-subtype="" value="%1$s">%2$s (%3$d)</option>', $link, esc_html($str_types_desc), $total_object_num_count ); 
     
    12251220        } 
    12261221 
    1227         // Begin LI 
    1228         $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); 
    1229  
    12301222        // Create link to filter this type + subtype 
    12311223        $arg = ""; 
     
    12361228        } 
    12371229        $link = esc_html(add_query_arg("simple_history_type_to_show", $arg)); 
    1238         $str_types .= "<a href='$link'>"; 
    12391230 
    12401231        // Begin option 
     
    12491240        // Some built in types we translate with built in translation, the others we use simple history for 
    12501241        // TODO: use WP-function to get all built in types? 
    1251         $arr_built_in_types_with_translation = array("page", "post"); 
    12521242        $object_type_translated = ""; 
    12531243        $object_subtype_translated = ""; 
     
    12581248        $object_type_translated = ""; 
    12591249        $object_subtype_translated = ""; 
     1250 
     1251        // For built in types 
    12601252        if ( in_array( $one_type->object_type, $arr_built_in_post_types ) ) { 
    12611253             
     1254            // Get name of main type 
    12621255            $object_post_type_object = get_post_type_object( $one_type->object_type ); 
    1263             $object_type_translated = $object_post_type_object->labels->singular_name; 
    1264  
     1256            $object_type_translated = $object_post_type_object->labels->name; 
     1257             
     1258            // Get name of subtype 
    12651259            $object_subtype_post_type_object = get_post_type_object( $one_type->object_subtype ); 
    12661260            if ( ! is_null( $object_subtype_post_type_object ) ) { 
    1267                 $object_subtype_translated = $object_subtype_post_type_object->labels->singular_name;; 
     1261                $object_subtype_translated = $object_subtype_post_type_object->labels->name;; 
    12681262            } 
    12691263 
     
    12791273         
    12801274        // Add name of type (post / attachment / user / etc.) 
    1281         $str_types .= $object_type_translated; 
    1282         $str_types_select .= $object_type_translated; 
    1283  
    1284         // And subtype, if different from main type 
    1285         if ($object_subtype_translated && $object_subtype_translated != $object_type_translated) { 
    1286             $str_types .= "/". $object_subtype_translated; 
    1287             $str_types_select .= "/" . $object_subtype_translated; 
    1288         } 
    1289  
     1275         
     1276        // built in types use only subtype 
     1277        if ( in_array( $one_type->object_type, $arr_built_in_post_types ) && ! empty($object_subtype_translated) ) { 
     1278 
     1279            $str_types_select .= $object_subtype_translated; 
     1280 
     1281        } else { 
     1282             
     1283            $str_types_select .= $object_type_translated; 
     1284 
     1285            // And subtype, if different from main type 
     1286            if ($object_subtype_translated && $object_subtype_translated != $object_type_translated) { 
     1287                $str_types_select .= "/" . $object_subtype_translated; 
     1288            } 
     1289 
     1290        } 
    12901291        // Add object count 
    1291         $str_types .= sprintf(' <span>(%d)</span>', $one_type->object_type_count); 
    12921292        $str_types_select .= sprintf(' (%d)', $one_type->object_type_count); 
    12931293         
    1294         // Close link and li 
    1295         $str_types .= "</a> | "; 
    1296         $str_types .= "</li>"; 
    1297  
    12981294        // Close option 
    12991295        $str_types_select .= "\n</option>"; 
     
    13051301         
    13061302    } // foreach arr types 
    1307  
    1308     $str_types .= "</ul>"; 
    1309     $str_types = str_replace("| </li></ul>", "</li></ul>", $str_types); 
    13101303 
    13111304    $str_types_select .= "\n</select>"; 
     
    13501343        } 
    13511344 
    1352         $str_users = ""; 
    1353         $str_users .= "<ul class='simple-history-filter simple-history-filter-user'>"; 
    1354  
    13551345        $str_users_select = ""; 
    13561346        $str_users_select .= "<select name='' class='simple-history-filter simple-history-filter-user'>"; 
     
    13651355        // All users 
    13661356        $link = esc_html(add_query_arg("simple_history_user_to_show", "")); 
    1367         $str_users .= "<li $css><a href='$link'>" . __("By all users", 'simple-history') ."</a> | </li>"; 
    13681357 
    13691358        $str_users_select .= sprintf( 
     
    13931382            $str_user_name = sprintf('%1$s (%2$s)', esc_attr($user->user_login), esc_attr($user->user_email)); 
    13941383            // if ( ! empty( $user_info["first_name"] )  $user_info["last_name"] ); 
    1395  
    1396             $str_users .= "<li $css>"; 
    1397             $str_users .= "<a href='$link'>"; 
    1398             $str_users .= $str_user_name; 
    1399             $str_users .= "</a> | "; 
    1400             $str_users .= "</li>"; 
    14011384             
    14021385            $str_users_select .= sprintf( 
     
    14101393        } 
    14111394 
    1412         $str_users .= "</ul>"; 
    1413         $str_users = str_replace("| </li></ul>", "</li></ul>", $str_users); 
    1414  
    14151395        $str_users_select .= "</select>"; 
    14161396 
    1417         if ( ! empty($str_users) ) { 
    1418             // echo $str_users; 
     1397        if ( ! empty($str_users_select) ) { 
    14191398            echo $str_users_select; 
    14201399        } 
     
    14291408    </p>"; 
    14301409    echo $search; 
    1431  
    1432     // echo simple_history_get_pagination(); 
    14331410     
    14341411} 
     
    18241801                    if ( ! empty( $attachment_metadata['width'] ) && ! empty( $attachment_metadata['height'] ) ) { 
    18251802                        $media_dims .= "<span>{$attachment_metadata['width']}&nbsp;&times;&nbsp;{$attachment_metadata['height']}</span>"; 
    1826                          
    18271803                    } 
    18281804 
    18291805                    // Generate string with metainfo 
     1806                    $size_unit = ($u == -1) ? __("bytes", "simple-history") : $sizes[$u]; 
    18301807                    $object_image_out .= sprintf('<p>%1$s %2$s</p>', __("File name:"), esc_html( basename( $attachment_file ) ) );; 
    1831                     $object_image_out .= sprintf('<p>%1$s %2$s %3$s</p>', __("File size:", "simple-history"), round( $attachment_filesize, 0 ), $sizes[$u] ); 
     1808                    $object_image_out .= sprintf('<p>%1$s %2$s %3$s</p>', __("File size:", "simple-history"), round( $attachment_filesize, 0 ), $size_unit ); 
    18321809                    // $object_image_out .= sprintf('<p>%1$s %2$s</p>', __("File type:"), $file_type_out ); 
    18331810                    if ( ! empty( $media_dims ) ) $object_image_out .= sprintf('<p>%1$s %2$s</p>', __("Dimensions:"), $media_dims );                     
  • simple-history/tags/1.3.4/readme.txt

    r730740 r730884  
    55Requires at least: 3.5.1 
    66Tested up to: 3.5.1 
    7 Stable tag: 1.3.3 
     7Stable tag: 1.3.4 
    88 
    99View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more. 
     
    176176== Changelog == 
    177177 
     178= 1.3.4 = 
     179- Changed the way post types show in the dropdown. Now uses plural names + not prefixed with main post type. Looks better I think. Thank to Hassan for the suggestion! 
     180- Added "bytes" to size units that an attachment can have. Also fixes undefined notice warning when attachment had a size less that 1 KB. 
     181 
    178182= 1.3.3 = 
    179183- Capability for viewing settings changed from edit_pages to the more correct [manage_options](http://codex.wordpress.org/Roles_and_Capabilities#manage_options) 
  • simple-history/trunk/index.php

    r730740 r730884  
    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.3.3 
     6Version: 1.3.4 
    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.3.3"); 
     30define( "SIMPLE_HISTORY_VERSION", "1.3.4"); 
    3131define( "SIMPLE_HISTORY_NAME", "Simple History"); 
    3232 
     
    11891189    } 
    11901190 
    1191     // Begin list 
    1192     $str_types = ""; 
    1193     $str_types .= "<ul class='simple-history-filter simple-history-filter-type'>"; 
    1194  
    11951191    // Begin select 
    11961192    $str_types_select = ""; 
     
    12051201    $link = esc_html(add_query_arg("simple_history_type_to_show", "")); 
    12061202    $str_types_desc = __("All types", 'simple-history'); 
    1207     $str_types .= "<li $css><a data-simple-history-filter-type='' href='$link'>" . esc_html($str_types_desc) . " <span>($total_object_num_count)</span></a> | </li>"; 
    12081203 
    12091204    $str_types_select .= sprintf('<option data-simple-history-filter-type="" data-simple-history-filter-subtype="" value="%1$s">%2$s (%3$d)</option>', $link, esc_html($str_types_desc), $total_object_num_count ); 
     
    12251220        } 
    12261221 
    1227         // Begin LI 
    1228         $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); 
    1229  
    12301222        // Create link to filter this type + subtype 
    12311223        $arg = ""; 
     
    12361228        } 
    12371229        $link = esc_html(add_query_arg("simple_history_type_to_show", $arg)); 
    1238         $str_types .= "<a href='$link'>"; 
    12391230 
    12401231        // Begin option 
     
    12491240        // Some built in types we translate with built in translation, the others we use simple history for 
    12501241        // TODO: use WP-function to get all built in types? 
    1251         $arr_built_in_types_with_translation = array("page", "post"); 
    12521242        $object_type_translated = ""; 
    12531243        $object_subtype_translated = ""; 
     
    12581248        $object_type_translated = ""; 
    12591249        $object_subtype_translated = ""; 
     1250 
     1251        // For built in types 
    12601252        if ( in_array( $one_type->object_type, $arr_built_in_post_types ) ) { 
    12611253             
     1254            // Get name of main type 
    12621255            $object_post_type_object = get_post_type_object( $one_type->object_type ); 
    1263             $object_type_translated = $object_post_type_object->labels->singular_name; 
    1264  
     1256            $object_type_translated = $object_post_type_object->labels->name; 
     1257             
     1258            // Get name of subtype 
    12651259            $object_subtype_post_type_object = get_post_type_object( $one_type->object_subtype ); 
    12661260            if ( ! is_null( $object_subtype_post_type_object ) ) { 
    1267                 $object_subtype_translated = $object_subtype_post_type_object->labels->singular_name;; 
     1261                $object_subtype_translated = $object_subtype_post_type_object->labels->name;; 
    12681262            } 
    12691263 
     
    12791273         
    12801274        // Add name of type (post / attachment / user / etc.) 
    1281         $str_types .= $object_type_translated; 
    1282         $str_types_select .= $object_type_translated; 
    1283  
    1284         // And subtype, if different from main type 
    1285         if ($object_subtype_translated && $object_subtype_translated != $object_type_translated) { 
    1286             $str_types .= "/". $object_subtype_translated; 
    1287             $str_types_select .= "/" . $object_subtype_translated; 
    1288         } 
    1289  
     1275         
     1276        // built in types use only subtype 
     1277        if ( in_array( $one_type->object_type, $arr_built_in_post_types ) && ! empty($object_subtype_translated) ) { 
     1278 
     1279            $str_types_select .= $object_subtype_translated; 
     1280 
     1281        } else { 
     1282             
     1283            $str_types_select .= $object_type_translated; 
     1284 
     1285            // And subtype, if different from main type 
     1286            if ($object_subtype_translated && $object_subtype_translated != $object_type_translated) { 
     1287                $str_types_select .= "/" . $object_subtype_translated; 
     1288            } 
     1289 
     1290        } 
    12901291        // Add object count 
    1291         $str_types .= sprintf(' <span>(%d)</span>', $one_type->object_type_count); 
    12921292        $str_types_select .= sprintf(' (%d)', $one_type->object_type_count); 
    12931293         
    1294         // Close link and li 
    1295         $str_types .= "</a> | "; 
    1296         $str_types .= "</li>"; 
    1297  
    12981294        // Close option 
    12991295        $str_types_select .= "\n</option>"; 
     
    13051301         
    13061302    } // foreach arr types 
    1307  
    1308     $str_types .= "</ul>"; 
    1309     $str_types = str_replace("| </li></ul>", "</li></ul>", $str_types); 
    13101303 
    13111304    $str_types_select .= "\n</select>"; 
     
    13501343        } 
    13511344 
    1352         $str_users = ""; 
    1353         $str_users .= "<ul class='simple-history-filter simple-history-filter-user'>"; 
    1354  
    13551345        $str_users_select = ""; 
    13561346        $str_users_select .= "<select name='' class='simple-history-filter simple-history-filter-user'>"; 
     
    13651355        // All users 
    13661356        $link = esc_html(add_query_arg("simple_history_user_to_show", "")); 
    1367         $str_users .= "<li $css><a href='$link'>" . __("By all users", 'simple-history') ."</a> | </li>"; 
    13681357 
    13691358        $str_users_select .= sprintf( 
     
    13931382            $str_user_name = sprintf('%1$s (%2$s)', esc_attr($user->user_login), esc_attr($user->user_email)); 
    13941383            // if ( ! empty( $user_info["first_name"] )  $user_info["last_name"] ); 
    1395  
    1396             $str_users .= "<li $css>"; 
    1397             $str_users .= "<a href='$link'>"; 
    1398             $str_users .= $str_user_name; 
    1399             $str_users .= "</a> | "; 
    1400             $str_users .= "</li>"; 
    14011384             
    14021385            $str_users_select .= sprintf( 
     
    14101393        } 
    14111394 
    1412         $str_users .= "</ul>"; 
    1413         $str_users = str_replace("| </li></ul>", "</li></ul>", $str_users); 
    1414  
    14151395        $str_users_select .= "</select>"; 
    14161396 
    1417         if ( ! empty($str_users) ) { 
    1418             // echo $str_users; 
     1397        if ( ! empty($str_users_select) ) { 
    14191398            echo $str_users_select; 
    14201399        } 
     
    14291408    </p>"; 
    14301409    echo $search; 
    1431  
    1432     // echo simple_history_get_pagination(); 
    14331410     
    14341411} 
     
    18241801                    if ( ! empty( $attachment_metadata['width'] ) && ! empty( $attachment_metadata['height'] ) ) { 
    18251802                        $media_dims .= "<span>{$attachment_metadata['width']}&nbsp;&times;&nbsp;{$attachment_metadata['height']}</span>"; 
    1826                          
    18271803                    } 
    18281804 
    18291805                    // Generate string with metainfo 
     1806                    $size_unit = ($u == -1) ? __("bytes", "simple-history") : $sizes[$u]; 
    18301807                    $object_image_out .= sprintf('<p>%1$s %2$s</p>', __("File name:"), esc_html( basename( $attachment_file ) ) );; 
    1831                     $object_image_out .= sprintf('<p>%1$s %2$s %3$s</p>', __("File size:", "simple-history"), round( $attachment_filesize, 0 ), $sizes[$u] ); 
     1808                    $object_image_out .= sprintf('<p>%1$s %2$s %3$s</p>', __("File size:", "simple-history"), round( $attachment_filesize, 0 ), $size_unit ); 
    18321809                    // $object_image_out .= sprintf('<p>%1$s %2$s</p>', __("File type:"), $file_type_out ); 
    18331810                    if ( ! empty( $media_dims ) ) $object_image_out .= sprintf('<p>%1$s %2$s</p>', __("Dimensions:"), $media_dims );                     
  • simple-history/trunk/readme.txt

    r730740 r730884  
    55Requires at least: 3.5.1 
    66Tested up to: 3.5.1 
    7 Stable tag: 1.3.3 
     7Stable tag: 1.3.4 
    88 
    99View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more. 
     
    176176== Changelog == 
    177177 
     178= 1.3.4 = 
     179- Changed the way post types show in the dropdown. Now uses plural names + not prefixed with main post type. Looks better I think. Thank to Hassan for the suggestion! 
     180- Added "bytes" to size units that an attachment can have. Also fixes undefined notice warning when attachment had a size less that 1 KB. 
     181 
    178182= 1.3.3 = 
    179183- Capability for viewing settings changed from edit_pages to the more correct [manage_options](http://codex.wordpress.org/Roles_and_Capabilities#manage_options) 
Note: See TracChangeset for help on using the changeset viewer.