eturn $total_size; } public function migrateBackupFolder() { $oldBackupFolder = WP_CONTENT_DIR . '/' . SP_BACKUP; if(file_exists($oldBackupFolder)) { //if old backup folder does not exist then there is nothing to do if(!file_exists(SP_BACKUP_FOLDER)) { //we check that the backup folder exists, if not we create it so we can copy into it if(!mkdir(SP_BACKUP_FOLDER, 0777, true)) return; } $scannedDirectory = array_diff(scandir($oldBackupFolder), array('..', '.')); foreach($scannedDirectory as $file) { @rename($oldBackupFolder.'/'.$file, SP_BACKUP_FOLDER.'/'.$file); } $scannedDirectory = array_diff(scandir($oldBackupFolder), array('..', '.')); if(empty($scannedDirectory)) { @rmdir($oldBackupFolder); } } //now if the backup folder does not contain the uploads level, create it if( !is_dir(SP_BACKUP_FOLDER . '/' . SP_UPLOADS_NAME ) && !is_dir(SP_BACKUP_FOLDER . '/' . basename(WP_CONTENT_DIR))) { @rename(SP_BACKUP_FOLDER, SP_BACKUP_FOLDER."_tmp"); @mkdir(SP_BACKUP_FOLDER); @rename(SP_BACKUP_FOLDER."_tmp", SP_BACKUP_FOLDER.'/'.SP_UPLOADS_NAME); if(!file_exists(SP_BACKUP_FOLDER)) {//just in case.. @rename(SP_BACKUP_FOLDER."_tmp", SP_BACKUP_FOLDER); } } //then create the wp-content level if not present if(!is_dir(SP_BACKUP_FOLDER . '/' . basename(WP_CONTENT_DIR))) { @rename(SP_BACKUP_FOLDER, SP_BACKUP_FOLDER."_tmp"); @mkdir(SP_BACKUP_FOLDER); @rename(SP_BACKUP_FOLDER."_tmp", SP_BACKUP_FOLDER.'/' . basename(WP_CONTENT_DIR)); if(!file_exists(SP_BACKUP_FOLDER)) {//just in case.. @rename(SP_BACKUP_FOLDER."_tmp", SP_BACKUP_FOLDER); } } return; } function getMaxIntermediateImageSize() { global $_wp_additional_image_sizes; $width = 0; $height = 0; $get_intermediate_image_sizes = get_intermediate_image_sizes(); // Create the full array with sizes and crop info foreach( $get_intermediate_image_sizes as $_size ) { if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) { $width = max($width, get_option( $_size . '_size_w' )); $height = max($height, get_option( $_size . '_size_h' )); //$sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' ); } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { $width = max($width, $_wp_additional_image_sizes[ $_size ]['width']); $height = max($height, $_wp_additional_image_sizes[ $_size ]['height']); //'crop' => $_wp_additional_image_sizes[ $_size ]['crop'] } } return array('width' => $width, 'height' => $height); } public function getEncryptedData() { return base64_encode(self::encrypt($this->getApiKey() . "|" . get_site_url(), "sh0r+Pix3l8im1N3r")); } /** * Returns an encrypted & utf8-encoded */ public static function encrypt($pure_string, $encryption_key) { if(!function_exists("mcrypt_get_iv_size") || !function_exists('utf8_encode')) { return ""; } $iv_size = \mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = \mcrypt_create_iv($iv_size, MCRYPT_RAND); $encrypted_string = \mcrypt_encrypt(MCRYPT_BLOWFISH, $encryption_key, utf8_encode($pure_string), MCRYPT_MODE_ECB, $iv); return $encrypted_string; } public function getApiKey() { return $this->_settings->apiKey; } public function getPrioQ() { return $this->prioQ; } public function backupImages() { return $this->_settings->backupImages; } public function processThumbnails() { return $this->_settings->processThumbnails; } public function getCMYKtoRGBconversion() { return $this->_settings->CMYKtoRGBconversion; } public function getSettings() { return $this->_settings; } public function getResizeImages() { return $this->_settings->resizeImages; } public function getResizeWidth() { return $this->_settings->resizeWidth; } public function getResizeHeight() { return $this->_settings->resizeHeight; } public function getAffiliateSufix() { return $this->_affiliateSufix; } public function getVerifiedKey() { return $this->_settings->verifiedKey; } public function getCompressionType() { return $this->_settings->compressionType; } public function hasNextGen() { return $this->hasNextGen; } public function getSpMetaDao() { return $this->spMetaDao; } } function shortpixelInit() { global $pluginInstance; //is admin, is logged in - :) seems funny but it's not, ajax scripts are admin even if no admin is logged in. $prio = get_option('wp-short-pixel-priorityQueue'); if (!isset($pluginInstance) && (($prio && is_array($prio) && count($prio) && get_option('wp-short-pixel-front-bootstrap')) || is_admin() && (function_exists("is_user_logged_in") && is_user_logged_in()) && ( current_user_can( 'manage_options' ) || current_user_can( 'upload_files' ) || current_user_can( 'edit_posts' ) ) ) ) { $pluginInstance = new WPShortPixel; } } function handleImageUploadHook($meta, $ID = null) { global $pluginInstance; if(!isset($pluginInstance)) { $pluginInstance = new WPShortPixel; } return $pluginInstance->handleMediaLibraryImageUpload($meta, $ID); } function shortpixelNggAdd($image) { global $pluginInstance; if(!isset($pluginInstance)) { $pluginInstance = new WPShortPixel; } $pluginInstance->handleNextGenImageUpload($image); } if ( !function_exists( 'vc_action' ) || vc_action() !== 'vc_inline' ) { //handle incompatibility with Visual Composer add_action( 'init', 'shortpixelInit'); add_action('ngg_added_new_image', 'shortpixelNggAdd'); add_filter( 'wp_generate_attachment_metadata', 'handleImageUploadHook', 10, 2 ); register_activation_hook( __FILE__, array( 'WPShortPixel', 'shortPixelActivatePlugin' ) ); register_deactivation_hook( __FILE__, array( 'WPShortPixel', 'shortPixelDeactivatePlugin' ) ); } ?> Reisen, so individuell, wie ich. | Lebensfreude & Genuss erleben.
Marijuana Card
Visit us on TwitterVisit us on FacebookVisit us on GooglePlusVisit us on YouTubeCheck our RSS FeedReisen. Incentives. Events.