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

Commit

Permalink
version update 1.8.9.8 - email notifications, daily schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhanirabin committed Feb 5, 2015
1 parent eeb3973 commit 37fb622
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 66 deletions.
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tags: comments, spam, optimize, database, revisions, users, posts, trash, schedule, automatic, clean, phpmyadmin, meta, postmeta, responsive, mobile
Requires at least: 3.8
Tested up to: 4.0
Stable tag: 1.8.9.7
Stable tag: 1.8.9.8
License: GPLv2+
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -42,7 +42,9 @@ Please join GitHub and collaborate.
* Enable/Disable weekly schedules of optimization
* Apply native WordPress MySql optimize commands on your database tables without phpMyAdmin or any manual query.
* Display Database table statistics. Shows how much space can be optimized and how much space has been cleared.
* Enabled for Administrators only.
* Enabled for Administrators only.
* E-mail notifications on automatic cleanup


**All the potentially dangerous clean up options are marked RED.**

Expand Down Expand Up @@ -151,6 +153,10 @@ Please check your database for corrupted tables. That can happen, usually your w

== Changelog ==

= 1.8.9.8 =
* Daily Schedule Option Added
* Email notification on automatic optimization, default email is admin email address. You can change this in settings

= 1.8.9.7 =
* BUGFIX for Settings screen
* Enable/Disable trackbacks / comments buttons removal and use select box instead. Extra button caused the Auto Scheduler to get into reset mode.
Expand Down
2 changes: 1 addition & 1 deletion wp-optimize-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function wpo_headerImage(){

$text = '<img src="'.WPO_PLUGIN_URL.'/wp-optimize.png" border="0" alt="WP-Optimize" title="WP-Optimize" width="310px" height="auto"/><br />';

$text .='<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.ruhanirabin.com%2Fwp-optimize%2F&amp;width=310&amp;height=46&amp;colorscheme=light&amp;layout=standard&amp;action=like&amp;show_faces=false&amp;send=true&amp;" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:310px; height:46px;" allowTransparency="true"></iframe>';
//$text .='<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.ruhanirabin.com%2Fwp-optimize%2F&amp;width=310&amp;height=46&amp;colorscheme=light&amp;layout=standard&amp;action=like&amp;show_faces=false&amp;send=true&amp;" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:310px; height:46px;" allowTransparency="true"></iframe>';
echo $text;

}
Expand Down
9 changes: 0 additions & 9 deletions wp-optimize-credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@
<p><?php _e('WP-Optimize started as a utility for my own projects. I have realized soon, that this plugin might help a lot of people out there. I am personally thanking all of the users who use this plugin as a daily basis. Also thank you all of the translators and the generous people who have donated for this project.','wp-optimize'); ?><br />
<br />
- Ruhani Rabin </p>
<a href="#"
onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent('http://www.ruhanirabin.com/wp-optimize/'),
'facebook-share-dialog',
'width=626,height=436');
return false;">
<?php _e('Share this plugin on Facebook','wp-optimize');?>
</a>

<br /><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
Expand Down
97 changes: 43 additions & 54 deletions wp-optimize.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: WP-Optimize
Plugin URI: http://www.ruhanirabin.com/wp-optimize/
Plugin URI: http://wp-optimize.ruhanirabin.com/
Description: This plugin helps you to keep your database clean by removing post revisions and spams in a blaze. Additionally it allows you to run optimize command on your WordPress core tables (use with caution).
Version: 1.8.9.8
Author: Ruhani Rabin
Expand All @@ -11,7 +11,7 @@
Git URI: https://github.com/ruhanirabin/wp-optimize
GitHub Plugin URI: https://github.com/ruhanirabin/wp-optimize
GitHub Branch: master
Copyright 2009-2014 Ruhani Rabin (email : get@ruhanirabin.com)
Copyright 2009-2014 Ruhani Rabin (email : plugins@ruhanirabin.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -37,7 +37,7 @@
# prevent file from being accessed directly
# --------------------------------------- #
if ( ! defined( 'WPINC' ) ) {
die;
die;
}

global $current_user;
Expand All @@ -48,17 +48,17 @@
define('WPO_VERSION', '1.8.9.8');

if (! defined('WPO_PLUGIN_MAIN_PATH'))
define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path( __FILE__ ));
define('WPO_PLUGIN_MAIN_PATH', plugin_dir_path( __FILE__ ));

if (! defined('WPO_PAYPAL'))
define('WPO_PAYPAL', 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LTCMF6JDX94QS');
define('WPO_PAYPAL', 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=LTCMF6JDX94QS');

if ( file_exists(WPO_PLUGIN_MAIN_PATH . 'wp-optimize-common.php')) {
if ( file_exists(WPO_PLUGIN_MAIN_PATH . 'wp-optimize-common.php')) {
require_once (WPO_PLUGIN_MAIN_PATH . 'wp-optimize-common.php');

} else {
die ('Functions File is missing!');
}
die ('Functions File is missing!');
}


register_activation_hook(__FILE__,'wpo_admin_actions');
Expand All @@ -68,23 +68,23 @@
add_action('init', 'wp_optimize_textdomain');
function wp_optimize_textdomain() {
if (function_exists('load_plugin_textdomain')) {
load_plugin_textdomain('wp-optimize', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
load_plugin_textdomain('wp-optimize', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
}

function wp_optimize_menu(){
include_once( 'wp-optimize-admin.php' );
include_once( 'wp-optimize-admin.php' );
}

function wpo_admin_bar() {
global $wp_admin_bar;
global $wp_admin_bar;

//Add a link called at the top admin bar
$wp_admin_bar->add_node(array(
'id' => 'wp-optimize',
'title' => 'WP-Optimize',
'href' => admin_url( 'admin.php?page=WP-Optimize', 'http' )
));
//Add a link called at the top admin bar
$wp_admin_bar->add_node(array(
'id' => 'wp-optimize',
'title' => 'WP-Optimize',
'href' => admin_url( 'admin.php?page=WP-Optimize', 'http' )
));

}

Expand All @@ -106,32 +106,32 @@ function wpo_plugin_settings_link($links) {
// plugin activation actions
function wpo_admin_actions()
{
if ( current_user_can('manage_options') ) {
if (function_exists('add_meta_box')) {
add_menu_page("WP-Optimize", "WP-Optimize", "manage_options", "WP-Optimize", "wp_optimize_menu", plugin_dir_url( __FILE__ ).'wpo.png');
} else {
add_submenu_page("index.php", "WP-Optimize", "WP-Optimize", "manage_options", "WP-Optimize", "wp_optimize_menu", plugin_dir_url( __FILE__ ).'wpo.png');
} // end if addmeta box
if ( current_user_can('manage_options') ) {
if (function_exists('add_meta_box')) {
add_menu_page("WP-Optimize", "WP-Optimize", "manage_options", "WP-Optimize", "wp_optimize_menu", plugin_dir_url( __FILE__ ).'wpo.png');
} else {
add_submenu_page("index.php", "WP-Optimize", "WP-Optimize", "manage_options", "WP-Optimize", "wp_optimize_menu", plugin_dir_url( __FILE__ ).'wpo.png');
} // end if addmeta box
if (get_option( OPTION_NAME_ENABLE_ADMIN_MENU, 'false' ) == 'true' ){
add_action( 'wp_before_admin_bar_render', 'wpo_admin_bar' );
add_action( 'wp_before_admin_bar_render', 'wpo_admin_bar' );
}

//wpo_detectDBType();
//wpo_detectDBType();
wpo_PluginOptionsSetDefaults();
wpo_cron_activate();
}
wpo_cron_activate();
}
}

// TODO: Need to find out why the schedule time is not refreshing
function wpo_cron_activate() {
//wpo_debugLog('running wpo_cron_activate()');
//wpo_debugLog('running wpo_cron_activate()');
$gmtoffset = (int) (3600 * ((double) get_option('gmt_offset')));

if ( get_option( OPTION_NAME_SCHEDULE ) !== false ) {
if ( get_option(OPTION_NAME_SCHEDULE) == 'true') {
if (!wp_next_scheduled('wpo_cron_event2')) {
if ( get_option(OPTION_NAME_SCHEDULE) == 'true') {
if (!wp_next_scheduled('wpo_cron_event2')) {

$schedule_type = get_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly');
$schedule_type = get_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly');

switch ($schedule_type) {
case "wpo_daily":
Expand Down Expand Up @@ -159,20 +159,17 @@ function wpo_cron_activate() {
break;

}
//$this_time = time() + $gmtoffset;
add_action('wpo_cron_event2', 'wpo_cron_action');
//wp_schedule_event(current_time( "timestamp", 0 ) + $this_time + $gmtoffset, $schedule_type, 'wpo_cron_event2');
wp_schedule_event(current_time( "timestamp", 0 ) + $this_time , $schedule_type, 'wpo_cron_event2');
wpo_debugLog('running wp_schedule_event()');
//add_filter('cron_schedules', 'wpo_cron_update_sched');
}
}
} else wpo_PluginOptionsSetDefaults();
}
}
} else wpo_PluginOptionsSetDefaults();
}

function wpo_cron_deactivate() {
//wp_clear_scheduled_hook('wpo_cron_event');
wpo_debugLog('running wpo_cron_deactivate()');
//wp_clear_scheduled_hook('wpo_cron_event');
wpo_debugLog('running wpo_cron_deactivate()');
wp_clear_scheduled_hook('wpo_cron_event2');
}

Expand All @@ -181,32 +178,24 @@ function wpo_cron_deactivate() {


// scheduler functions to update schedulers
// possible problem found at support request
// http://wordpress.org/support/topic/bug-found-in-scheduler-code

function wpo_cron_update_sched( $schedules ) {
$schedules['wpo_daily'] = array('interval' => 60*60*24, 'display' => 'Once Daily');
$schedules['wpo_weekly'] = array('interval' => 60*60*24*7, 'display' => 'Once Weekly');
$schedules['wpo_otherweekly'] = array('interval' => 60*60*24*14, 'display' => 'Once Every Other Week');
$schedules['wpo_monthly'] = array('interval' => 60*60*24*31, 'display' => 'Once Every Month');
return $schedules;
$schedules['wpo_daily'] = array('interval' => 60*60*24, 'display' => 'Once Daily');
$schedules['wpo_weekly'] = array('interval' => 60*60*24*7, 'display' => 'Once Weekly');
$schedules['wpo_otherweekly'] = array('interval' => 60*60*24*14, 'display' => 'Once Every Other Week');
$schedules['wpo_monthly'] = array('interval' => 60*60*24*31, 'display' => 'Once Every Month');
return $schedules;
}


// plugin deactivation actions
function wpo_admin_actions_remove()
{
wpo_cron_deactivate();
wpo_removeOptions();
wpo_cron_deactivate();
wpo_removeOptions();
}
add_action('admin_menu', 'wpo_admin_actions');

/* function wpo_admin_styles() {
wp_register_style( 'wpo_admin_stylesheet', plugins_url( '/css/wpo_admin.css', __FILE__ ) );
wp_enqueue_style( 'wpo_admin_stylesheet' );
}
add_action( 'admin_enqueue_scripts', 'wpo_admin_styles' ); */


function wpo_admin_register_head() {
$style_url = plugins_url( '/css/wpo_admin.css', __FILE__ ) ;
Expand Down

0 comments on commit 37fb622

Please sign in to comment.