/** * Fired when the plugin is activated. * * @since 1.0.0 * * @param boolean $network_wide True if WPMU superadmin uses "Network Activate" action, false if WPMU is disabled or plugin is activated on an individual blog. */ public static function activate($network_wide) { $class = Original_Image_Handler::get_instance(); if (get_option('oih_auto_convert_bmp', 'NotExistingValue') == 'NotExistingValue') { //If the setting has not been set before update_option('oih_auto_convert_bmp', $class->default_auto_convert_bmp); } if (get_option('oih_remove_original_after_resizing', 'NotExistingValue') == 'NotExistingValue') { update_option('oih_remove_original_after_resizing', $class->default_remove_original_after_resizing); } if (get_option('oih_max_image_width', 'NotExistingValue') == 'NotExistingValue') { update_option('oih_max_image_width', $class->default_max_image_width); } if (get_option('oih_max_image_height', 'NotExistingValue') == 'NotExistingValue') { update_option('oih_max_image_height', $class->default_max_image_height); } if (get_option('oih_bmp_conversion_quality', 'NotExistingValue') == 'NotExistingValue') { update_option('oih_bmp_conversion_quality', $class->default_bmp_conversion_quality); } if (get_option('oih_start_upload_size', 'NotExistingValue') == 'NotExistingValue') { $upload_path = wp_upload_dir(); $output = $class->calculate_upload_dir($upload_path['basedir']); update_option('oih_start_upload_size', $output); update_option('oih_current_upload_size', $output); } }
<?php /** * @package original-image-handler * @author Internetbureau Haboes <*****@*****.**> * @license GPL-2.0+ * @link http://www.haboes.nl * @copyright 2013 Internetbureau Haboes * * @wordpress-plugin * Plugin Name: Original Image Handler * Plugin URI: http://www.haboes.nl * Description: After uploading an file it will resize and remove the original file from the server to save diskspace. It also converts BMP files to JPEG files to save diskspace. * Version: 1.0.0 * Author: Internetbureau Haboes B.V. * Author URI: http://www.haboes.nl * Text Domain: oih * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * Domain Path: /lang */ // If this file is called directly, abort. if (!defined('WPINC')) { die; } require_once plugin_dir_path(__FILE__) . 'class-original-image-handler.php'; // Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively. register_activation_hook(__FILE__, array('Original_Image_Handler', 'activate')); Original_Image_Handler::get_instance();