PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/seoshop.live/wp-content/plugins/jch-optimize/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/seoshop.live/wp-content/plugins/jch-optimize/jchplugininstaller.php

<?php

/**
 * JCH Optimize - Plugin to aggregate and minify external resources for
 * optmized downloads
 *
 * @author Samuel Marshall <sdmarshall73@gmail.com>
 * @copyright Copyright (c) 2014 Samuel Marshall
 * @license GNU/GPLv3, See LICENSE file
 *
 * 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
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * If LICENSE file missing, see <http://www.gnu.org/licenses/>.
 */

class JchPluginInstaller {


	public function __construct ()
	{
	}

	/**
	 * Fires when plugin is activated and create a dir.php file in plugin root containing 
	 * absolute path of plugin install
	 *
	 *
	 * @return null
	 */
	public function activate()
	{
		//$this->initializeFileSystem();

		//global $wp_filesystem;

		try
		{
			$wp_filesystem = JchPlatformCache::getWpFileSystem();
		}
		catch(Exception $e)
		{
			return false;
		}

		if ($wp_filesystem === false)
		{
			return false;
		}

		$file    = JCH_PLUGIN_DIR . 'dir.php';
		$abspath = ABSPATH;
		$code    = <<<PHPCODE
<?php
           
\$DIR = '$abspath';
           
PHPCODE;

		$wp_filesystem->put_contents($file, $code, FS_CHMOD_FILE);
		JchOptimizeAdmin::leverageBrowserCaching();
	}

	/**
	 * Initialize the WordPress FileSystem API, 
	 *
	 *
	 * @return null
	 */
	protected function initializeFileSystem()
	{

		$access_type = get_filesystem_method();
		if($access_type === 'direct')
		{
			/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
			$creds = request_filesystem_credentials(site_url() . '/wp-admin/', '', false, false, array());

			/* initialize the API */
			if ( ! WP_Filesystem($creds) ) {
				/* any problems and we exit */
				return false;
			}	

		}	
		else
		{
			/* don't have direct write access. Prompt user with our notice */
			//add_action('admin_notices', 'you_admin_notice_function'); 	
		}
	}	
}