403Webshell
Server IP : 192.64.118.117  /  Your IP : 18.224.21.26
Web Server : LiteSpeed
System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64
User : thecgapy ( 1160)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/thecgapy/www/wp-content/plugins/wp-smushit/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/thecgapy/www/wp-content/plugins/wp-smushit/lib/class-wp-smush-bulk.php
<?php

/**
 * @package WP SmushIt
 * @subpackage Admin
 * @version 1.0
 *
 * @author Saurabh Shukla <saurabh@incsub.com>
 * @author Umesh Kumar <umesh@incsub.com>
 *
 * @copyright (c) 2016, Incsub (http://incsub.com)
 */
if ( ! class_exists( 'WpSmushitBulk' ) ) {

	/**
	 * Methods for bulk processing
	 */
	class WpSmushitBulk {

		/**
		 * Fetch all the unsmushed attachments
		 * @return array $attachments
		 */
		function get_attachments() {
			global $wpsmushit_admin, $wpsmush_stats;

			if ( ! isset( $_REQUEST['ids'] ) ) {
				$limit = $wpsmushit_admin->query_limit();
				$limit = ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count < $limit ? $wpsmushit_admin->total_count : $limit;

				//Do not fetch more than this, any time
				//Localizing all rows at once increases the page load and sloes down everything
				$r_limit = apply_filters( 'wp_smush_max_rows', 5000 );

				$get_posts       = true;
				$unsmushed_posts = array();
				$args            = array(
					'fields'                 => array( 'ids', 'post_mime_type' ),
					'post_type'              => 'attachment',
					'post_status'            => 'any',
					'orderby'                => 'ID',
					'order'                  => 'DESC',
					'posts_per_page'         => $limit,
					'offset'                 => 0,
					'meta_query'             => array(
						array(
							'key'     => 'wp-smpro-smush-data',
							'compare' => 'NOT EXISTS'
						)
					),
					'update_post_meta_cache' => false,
					'update_post_term_cache' => false,
					'no_found_rows'          => true,
				);
				//Loop Over to get all the attachments
				while ( $get_posts ) {

					//Remove the Filters added by WP Media Folder
					$wpsmush_stats->remove_filters();

					$query = new WP_Query( $args );

					if ( ! empty( $query->post_count ) && sizeof( $query->posts ) > 0 ) {

						//Get a filtered list of post ids
						$posts = $wpsmushit_admin->filter_by_mime( $query->posts );

						//Merge the results
						$unsmushed_posts = array_merge( $unsmushed_posts, $posts );

						//Update the offset
						$args['offset'] += $limit;
					} else {
						//If we didn't get any posts from query, set $get_posts to false
						$get_posts = false;
					}

					//If we already got enough posts
					if ( count( $unsmushed_posts ) >= $r_limit ) {
						$get_posts = false;
					}

					//If total Count is set, and it is alread lesser than offset, don't query
					if ( ! empty( $wpsmushit_admin->total_count ) && $wpsmushit_admin->total_count < $args['offset'] ) {
						$get_posts = false;
					}
				}
			} else {
				return array_map( 'intval', explode( ',', $_REQUEST['ids'] ) );
			}

			return $unsmushed_posts;
		}

	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit