Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #63 from pedro-mendonca/develop
Browse files Browse the repository at this point in the history
Strings cleanup by Pedro Mendonca
  • Loading branch information
ruhanirabin committed Oct 22, 2015
2 parents 9e98bf9 + 1d2e161 commit b415122
Show file tree
Hide file tree
Showing 21 changed files with 2,834 additions and 1,445 deletions.
223 changes: 130 additions & 93 deletions languages/wp-optimize-de_DE.po

Large diffs are not rendered by default.

238 changes: 145 additions & 93 deletions languages/wp-optimize-es_ES.po

Large diffs are not rendered by default.

217 changes: 127 additions & 90 deletions languages/wp-optimize-fi.po

Large diffs are not rendered by default.

Binary file modified languages/wp-optimize-fr_FR.mo
Binary file not shown.
236 changes: 136 additions & 100 deletions languages/wp-optimize-fr_FR.po

Large diffs are not rendered by default.

219 changes: 128 additions & 91 deletions languages/wp-optimize-hu_HU.po

Large diffs are not rendered by default.

221 changes: 129 additions & 92 deletions languages/wp-optimize-id_ID.po

Large diffs are not rendered by default.

225 changes: 131 additions & 94 deletions languages/wp-optimize-it_IT.po

Large diffs are not rendered by default.

221 changes: 129 additions & 92 deletions languages/wp-optimize-ka_GE.po

Large diffs are not rendered by default.

223 changes: 130 additions & 93 deletions languages/wp-optimize-lt_LT.po

Large diffs are not rendered by default.

221 changes: 129 additions & 92 deletions languages/wp-optimize-nl_NL.po

Large diffs are not rendered by default.

Binary file added languages/wp-optimize-pt_PT.mo
Binary file not shown.
846 changes: 846 additions & 0 deletions languages/wp-optimize-pt_PT.po

Large diffs are not rendered by default.

223 changes: 130 additions & 93 deletions languages/wp-optimize-sk_SK.po

Large diffs are not rendered by default.

225 changes: 131 additions & 94 deletions languages/wp-optimize-sl_SI.po

Large diffs are not rendered by default.

221 changes: 129 additions & 92 deletions languages/wp-optimize-zh_CN.po

Large diffs are not rendered by default.

388 changes: 226 additions & 162 deletions languages/wp-optimize.pot

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions wp-optimize-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,23 +632,23 @@ function wpo_cleanUpSystem($cleanupType){
$clean .= ';';

$transient_options = $wpdb->query( $clean );
$message .= $transient_options.' '.__('transient options deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d transient option deleted', '%d transient options deleted', $transient_options, 'wp-optimize'), number_format_i18n($transient_options)).'<br>';
break;
// TODO: need to use proper query
case "postmeta":
$clean = "DELETE pm FROM `$wpdb->postmeta` pm LEFT JOIN `$wpdb->posts` wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL";
$clean .= ';';

//$postmeta = $wpdb->query( $clean );
//$message .= $postmeta.' '.__('orphaned postmeta deleted', 'wp-optimize').'<br>';
//$message .= sprintf(_n('%d orphaned postmeta deleted', '%d orphaned postmeta deleted', $postmeta, 'wp-optimize'), number_format_i18n($postmeta)).'<br>';
break;

case "tags":
// $clean = "DELETE t,tt FROM `$wpdb->terms` t INNER JOIN `$wpdb->term_taxonomy` tt ON t.term_id=tt.term_id WHERE tt.taxonomy='post_tag' AND tt.count=0";
// $clean .= ';';
//
// $tags = $wpdb->query( $clean );
// $message .= $tags.' '.__('unused tags deleted', 'wp-optimize').'<br>';
// $message .= sprintf(_n('%d unused tag deleted', '%d unused tags deleted', $tags, 'wp-optimize'), number_format_i18n($tags)).'<br>';
break;

case "revisions":
Expand All @@ -659,7 +659,7 @@ function wpo_cleanUpSystem($cleanupType){
$clean .= ';';

$revisions = $wpdb->query( $clean );
$message .= $revisions.' '.__('post revisions deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d post revision deleted', '%d post revisions deleted', $revisions, 'wp-optimize'), number_format_i18n($revisions)).'<br>';
break;

case "autodraft":
Expand All @@ -670,7 +670,7 @@ function wpo_cleanUpSystem($cleanupType){
$clean .= ';';

$autodraft = $wpdb->query( $clean );
$message .= $autodraft.' '.__('auto drafts deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d auto draft deleted', '%d auto drafts deleted', $autodraft, 'wp-optimize'), number_format_i18n($autodraft)).'<br>';


// TODO: query trashed posts and cleanup metadata
Expand All @@ -680,7 +680,7 @@ function wpo_cleanUpSystem($cleanupType){
}
$clean .= ';';
$posttrash = $wpdb->query( $clean );
$message .= $posttrash.' '.__('items removed from Trash', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d item removed from Trash', '%d items removed from Trash', $posttrash, 'wp-optimize'), number_format_i18n($posttrash)).'<br>';

break;

Expand All @@ -692,7 +692,7 @@ function wpo_cleanUpSystem($cleanupType){
$clean .= ';';

$comments = $wpdb->query( $clean );
$message .= $comments.' '.__('spam comments deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d spam comment deleted', '%d spam comments deleted', $comments, 'wp-optimize'), number_format_i18n($comments)).'<br>';

// TODO: query trashed comments and cleanup metadata
$clean = "DELETE FROM `$wpdb->comments` WHERE comment_approved = 'trash'";
Expand All @@ -701,19 +701,19 @@ function wpo_cleanUpSystem($cleanupType){
}
$clean .= ';';
$commentstrash = $wpdb->query( $clean );
$message .= $commentstrash.' '.__('comments removed from Trash', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d comment removed from Trash', '%d comments removed from Trash', $commentstrash, 'wp-optimize'), number_format_i18n($commentstrash)).'<br>';

// TODO: still need to test now cleaning up comments meta tables
$clean = "DELETE FROM `$wpdb->commentmeta` WHERE comment_id NOT IN ( SELECT comment_id FROM `$wpdb->comments` )";
$clean .= ';';
$commentstrash_meta = $wpdb->query( $clean );
$message .= $commentstrash_meta.' '.__('unused comment metadata items removed', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d unused comment metadata item removed', '%d unused comment metadata items removed', $commentstrash_meta, 'wp-optimize'), number_format_i18n($commentstrash_meta)).'<br>';

// TODO: still need to test now cleaning up comments meta tables - removing akismet related settings
$clean = "DELETE FROM `$wpdb->commentmeta` WHERE meta_key LIKE '%akismet%'";
$clean .= ';';
$commentstrash_meta2 = $wpdb->query( $clean );
$message .= $commentstrash_meta2.' '.__('unused akismet comment metadata items removed', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d unused akismet comment metadata item removed', '%d unused akismet comment metadata items removed', $commentstrash_meta2, 'wp-optimize'), number_format_i18n($commentstrash_meta2)).'<br>';
break;

case "unapproved":
Expand All @@ -723,19 +723,19 @@ function wpo_cleanUpSystem($cleanupType){
}
$clean .= ';';
$comments = $wpdb->query( $clean );
$message .= $comments.' '.__('unapproved comments deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d unapproved comment deleted', '%d unapproved comments deleted', $comments, 'wp-optimize'), number_format_i18n($comments)).'<br>';
break;

case "pingbacks":
$clean = "DELETE FROM `$wpdb->comments` WHERE comment_type = 'pingback';";
$comments = $wpdb->query( $clean );
$message .= $comments.' '.__('pingbacks deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d pingback deleted', '%d pingbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments)).'<br>';
break;

case "trackbacks":
$clean = "DELETE FROM `$wpdb->comments` WHERE comment_type = 'trackback';";
$comments = $wpdb->query( $clean );
$message .= $comments.' '.__('trackbacks deleted', 'wp-optimize').'<br>';
$message .= sprintf(_n('%d trackback deleted', '%d trackbacks deleted', $comments, 'wp-optimize'), number_format_i18n($comments)).'<br>';
break;


Expand Down Expand Up @@ -784,7 +784,7 @@ function wpo_getInfo($cleanupType){
$transient_options = $wpdb->get_var( $sql );

if(!$transient_options == 0 || !$transient_options == NULL){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$transient_options.' '.__('transient options in your database', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d transient option in your database', '%d transient options in your database', $transient_options, 'wp-optimize'), number_format_i18n($transient_options));
}
else $message .='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No transient options found', 'wp-optimize');
break;
Expand All @@ -795,7 +795,7 @@ function wpo_getInfo($cleanupType){
$postmeta = $wpdb->get_var( $sql );

if(!$postmeta == 0 || !$postmeta == NULL){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$postmeta.' '.__('orphaned postmeta in your database', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d orphaned postmeta in your database', '%d orphaned postmeta in your database', $postmeta, 'wp-optimize'), number_format_i18n($postmeta));
}
else $message .='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No orphaned postmeta in your database', 'wp-optimize');
break;
Expand All @@ -806,7 +806,7 @@ function wpo_getInfo($cleanupType){
$tags = $wpdb->get_var( $sql );

if(!$tags == 0 || !$tags == NULL){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$tags.' '.__('unused tags in your database', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d unused tag in your database', '%d unused tags in your database', $tags, 'wp-optimize'), number_format_i18n($tags));
}
else $message .='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No unused tags found', 'wp-optimize');
break;
Expand All @@ -821,7 +821,7 @@ function wpo_getInfo($cleanupType){
$revisions = $wpdb->get_var( $sql );

if(!$revisions == 0 || !$revisions == NULL){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$revisions.' '.__('post revisions in your database', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d post revision in your database', '%d post revisions in your database', $revisions, 'wp-optimize'), number_format_i18n($revisions));
}
else $message .='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No post revisions found', 'wp-optimize');
break;
Expand All @@ -836,7 +836,7 @@ function wpo_getInfo($cleanupType){
$autodraft = $wpdb->get_var( $sql );

if(!$autodraft == 0 || !$autodraft == NULL){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$autodraft.' '.__('auto draft post(s) in your database', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d auto draft post in your database', '%d auto draft posts in your database', $autodraft, 'wp-optimize'), number_format_i18n($autodraft));
}
else $message .='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No auto draft posts found', 'wp-optimize');
break;
Expand All @@ -850,7 +850,7 @@ function wpo_getInfo($cleanupType){
$sql .= ';';
$comments = $wpdb->get_var( $sql );
if(!$comments == NULL || !$comments == 0){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$comments.' '.__('spam comments found', 'wp-optimize').' | <a href="edit-comments.php?comment_status=spam">'.' '.__('Review', 'wp-optimize').'</a>';
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d spam comment found', '%d spam comments found', $comments, 'wp-optimize'), number_format_i18n($comments)).' | <a href="edit-comments.php?comment_status=spam">'.' '.__('Review', 'wp-optimize').'</a>';
} else
$message .='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No spam comments found', 'wp-optimize');

Expand Down Expand Up @@ -881,7 +881,7 @@ function wpo_getInfo($cleanupType){
$sql .= ';';
$comments = $wpdb->get_var( $sql );
if(!$comments == NULL || !$comments == 0){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$comments.' '.__('unapproved comments found', 'wp-optimize').' | <a href="edit-comments.php?comment_status=moderated">'.' '.__('Review', 'wp-optimize').'</a>';;
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d unapproved comment found', '%d unapproved comments found', $comments, 'wp-optimize'), number_format_i18n($comments)).' | <a href="edit-comments.php?comment_status=moderated">'.' '.__('Review', 'wp-optimize').'</a>';;
} else
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No unapproved comments found', 'wp-optimize');

Expand All @@ -891,7 +891,7 @@ function wpo_getInfo($cleanupType){
$sql = "SELECT COUNT(*) FROM `$wpdb->comments` WHERE comment_type='pingback';";
$comments = $wpdb->get_var( $sql );
if(!$comments == NULL || !$comments == 0){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$comments.' '.__('Pingbacks found', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d Pingback found', '%d Pingbacks found', $comments, 'wp-optimize'), number_format_i18n($comments));
} else
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No pingbacks found', 'wp-optimize');

Expand All @@ -901,7 +901,7 @@ function wpo_getInfo($cleanupType){
$sql = "SELECT COUNT(*) FROM `$wpdb->comments` WHERE comment_type='trackback';";
$comments = $wpdb->get_var( $sql );
if(!$comments == NULL || !$comments == 0){
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$comments.' '.__('Trackbacks found', 'wp-optimize');
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.sprintf(_n('%d Trackback found', '%d Trackbacks found', $comments, 'wp-optimize'), number_format_i18n($comments));
} else
$message .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.__('No trackbacks found', 'wp-optimize');

Expand Down
56 changes: 21 additions & 35 deletions wp-optimize-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
}

if (isset($_POST["optimize-db"])) {
$text .= DB_NAME.' '.__('Database Optimized!', 'wp-optimize').'<br>';
$text .= sprintf(_x('%s Database Optimized!', '%s is the Database Name', 'wp-optimize'), "'".DB_NAME."'").'<br>';
}
if ( isset( $_POST["optimize-db"] ) ) {
$user_options["user-optimize"] = TRUE;
Expand Down Expand Up @@ -162,10 +162,7 @@
<input name="clean-revisions" id="clean-revisions" type="checkbox" value="true" <?php echo $wpo_user_selection['user-revisions'] == 'true' ? 'checked="checked"':''; ?> />
<?php
if ( get_option( OPTION_NAME_RETENTION_ENABLED, 'false' ) == 'true' ) {
_e('Clean post revisions which are older than ', 'wp-optimize');
echo get_option( OPTION_NAME_RETENTION_PERIOD, '2' );
echo ' ';
_e('weeks', 'wp-optimize');
printf(__('Clean post revisions which are older than %d weeks', 'wp-optimize'), get_option( OPTION_NAME_RETENTION_PERIOD, '2' ));
} else {
_e('Clean all post revisions', 'wp-optimize');
}
Expand All @@ -180,10 +177,7 @@
<input name="clean-autodraft" id="clean-autodraft" type="checkbox" value="true" <?php echo $wpo_user_selection['user-drafts'] == 'true' ? 'checked="checked"':''; ?> />
<?php
if ( get_option( OPTION_NAME_RETENTION_ENABLED, 'false' ) == 'true' ) {
_e('Clean auto draft posts which are older than ', 'wp-optimize');
echo get_option( OPTION_NAME_RETENTION_PERIOD, '2' );
echo ' ';
_e('weeks', 'wp-optimize');
printf(__('Clean auto draft posts which are older than %d weeks', 'wp-optimize'), get_option( OPTION_NAME_RETENTION_PERIOD, '2' ));
} else {
_e('Clean all auto draft posts and posts in trash', 'wp-optimize');
}
Expand All @@ -200,10 +194,7 @@
<input name="clean-comments" id="clean-comments" type="checkbox" value="true" <?php echo $wpo_user_selection['user-spams'] == 'true' ? 'checked="checked"':''; ?> />
<?php
if ( get_option( OPTION_NAME_RETENTION_ENABLED, 'false' ) == 'true' ) {
_e('Remove spam comments which are older than ', 'wp-optimize');
echo get_option( OPTION_NAME_RETENTION_PERIOD, '2' );
echo ' ';
_e('weeks', 'wp-optimize');
printf(__('Remove spam comments which are older than %d weeks', 'wp-optimize'), get_option( OPTION_NAME_RETENTION_PERIOD, '2' ));
} else {
_e('Remove spam comments and comments in trash', 'wp-optimize');
}
Expand All @@ -219,10 +210,7 @@
<input name="unapproved-comments" id="unapproved-comments" type="checkbox" value="true" <?php echo $wpo_user_selection['user-unapproved'] == 'true' ? 'checked="checked"':''; ?> />
<?php
if ( get_option( OPTION_NAME_RETENTION_ENABLED, 'false' ) == 'true' ) {
_e('Remove unapproved comments which are older than ', 'wp-optimize');
echo get_option( OPTION_NAME_RETENTION_PERIOD, '2' );
echo ' ';
_e('weeks', 'wp-optimize');
printf(__('Remove unapproved comments which are older than %d weeks', 'wp-optimize'), get_option( OPTION_NAME_RETENTION_PERIOD, '2' ));
} else {
_e('Remove unapproved comments', 'wp-optimize');
}
Expand Down Expand Up @@ -325,13 +313,13 @@
<p>

<a class="button-primary" href="<?php echo WPO_PAYPAL ; ?>" title="<?php _e('Please donate! It really helps me keep improvising', 'wp-optimize'); ?>" target="_blank"><?php _e('Donate!', 'wp-optimize'); ?></a>
<a class="button-primary" href="http://wordpress.org/support/view/plugin-reviews/wp-optimize?rate=5#postform" target="_blank" title="<?php _e('Please give a proper rating:)', 'wp-optimize'); ?>">
<a class="button-primary" href="http://wordpress.org/support/view/plugin-reviews/wp-optimize?rate=5#postform" target="_blank" title="<?php _e('Please give a proper rating :)', 'wp-optimize'); ?>">
<?php _e('Rating', 'wp-optimize'); ?>
</a>

</p>

<h3><?php _e('Status log: ', 'wp-optimize'); ?></h3>
<h3><?php _e('Status log', 'wp-optimize'); ?></h3>

<?php
$news_items = wpo_readFeed('http://ruhanirabin.github.io/WP-Optimize/feed.xml', 1);
Expand Down Expand Up @@ -359,7 +347,7 @@
} else {
echo '<i>';
_e('There was no automatic optimization', 'wp-optimize');
echo ' - ';
//echo ' - ';
//echo '<a href="?page=WP-Optimize&tab=wp_optimize_settings">';
//_e('Check settings', 'wp-optimize');
//echo '</a>';
Expand All @@ -385,8 +373,8 @@
$timestamp = wp_next_scheduled( 'wpo_cron_event2' );
$date = new DateTime("@$timestamp");
echo '<i>';
_e('Next schedule', 'wp-optimize');
echo ' : ';
_e('Next schedule:', 'wp-optimize');
echo ' ';
echo '<font color="green">';
//echo $date->format('l jS \of F Y') . "\n";
//echo gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp + (get_option('gmt_offset')));
Expand Down Expand Up @@ -419,10 +407,7 @@
echo '<i>';
echo '<b>';
echo '<font color="blue">';
_e('Keeping last ', 'wp-optimize');
echo get_option( OPTION_NAME_RETENTION_PERIOD, '2' );
echo ' ';
_e('weeks data', 'wp-optimize');
printf(__('Keeping last %s weeks data', 'wp-optimize'), get_option( OPTION_NAME_RETENTION_PERIOD, '2' ) ) ;
echo '</font>';
echo '</i>';
echo '</b>';
Expand All @@ -447,28 +432,29 @@

if (isset($_POST["optimize-db"])) {
list ($part1, $part2) = wpo_getCurrentDBSize();
_e('Current database size : ', 'wp-optimize');
_e('Current database size:', 'wp-optimize');
echo ' ';
echo '<font color="blue">';
echo $part1.'</font> ';

echo ' <br />';
_e('You have saved', 'wp-optimize');
echo ' : ';
_e('You have saved:', 'wp-optimize');
echo ' ';
echo '<font color="blue">';
echo $part2.'</font> ';
}
else {
list ($part1, $part2) = wpo_getCurrentDBSize();
_e('Current database size', 'wp-optimize');
echo ' : ';
_e('Current database size:', 'wp-optimize');
echo ' ';
echo '<font color="blue">';
echo $part1.'</font> ';
$this_value = $part2;

if ($this_value > 0){
echo ' <br />';
_e('You can save almost', 'wp-optimize');
echo ' : ';
_e('You can save almost:', 'wp-optimize');
echo ' ';
echo '<font color="red">';
echo $part2.'</font> ';
}
Expand All @@ -484,8 +470,8 @@

if ($total_cleaned_num > 0){
echo '<h5>';
_e('Total clean up overall','wp-optimize');
echo ': ';
_e('Total clean up overall:','wp-optimize');
echo ' ';
echo '<font color="green">';
echo wpo_format_size($total_cleaned);
echo '</font>';
Expand Down
Loading

0 comments on commit b415122

Please sign in to comment.