403Webshell
Server IP : 103.88.176.108  /  Your IP : 216.73.216.211
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux webserver 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.18
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 : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/optimole-wp/inc/compatibilities/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/optimole-wp/inc/compatibilities/pinterest.php
<?php

/**
 * Class Pinterest.
 *
 * @reason Pinterest plugins picks eco images to share
 */
class Optml_pinterest extends Optml_compatibility {
	/**
	 * String with all css selectors to target
	 *
	 * @var string
	 */
	private $selectors;
	/**
	 * Should we load the integration logic.
	 *
	 * @return bool Should we load.
	 */
	public function should_load() {

		include_once ABSPATH . 'wp-admin/includes/plugin.php';

		$load = false;
		$selectors_array = [];
		if ( $this->isShareaholic() ) {
			$selectors_array[] = 'li.shareaholic-share-button[data-service=\"pinterest\"]';
			$load = true;
		}
		if ( $this->isSassySocialShare() ) {
			$selectors_array[] = '.heateorSssSharing.heateorSssPinterestBackground';
			$load = true;
		}
		$this->selectors = implode( ', ', $selectors_array );
		return $load;
	}

	/**
	 * Register integration details.
	 */
	public function register() {
		add_action(
			'wp_enqueue_scripts',
			function () {
				wp_register_script( 'optml-pinterest', false );
				wp_enqueue_script( 'optml-pinterest' );
				$script = sprintf(
					'
			(function(w, d){
			w.addEventListener("load", function() {
					const addCustomEventListener = function (selector, event, handler) {
		                let rootElement = document.querySelector(\'body\');
		                  rootElement.addEventListener(event, function (evt) {
			                  var targetElement = evt.target;
			                  while (targetElement != null) {
				                  if (targetElement.matches(selector)) {
					                  handler(evt);
					                  return;
				                  }
			                      targetElement = targetElement.parentElement;
			                  }
		                  },
		                  true
		                   );
                   };
					addCustomEventListener(\'%s\',\'mouseover\',function(){
						let images = d.getElementsByTagName( "img" );
						for ( let i = 0; i < images.length; i++ ) {
							if ( "optSrc" in images[i].dataset ) {
								images[i].src = images[i].dataset.optSrc ;
							}
						}
					});
			});		
			}(window, document));
		',
					$this->selectors
				);
				wp_add_inline_script( 'optml-pinterest', $script );
			}
		);
	}
	/**
	Check if plugin is active.

	@return bool
	 */
	private function isShareaholic() {

		if ( ! is_plugin_active( 'shareaholic/shareaholic.php' ) ) {
			return false;
		}
		return true;
	}
	/**
	 * Check if plugin is active.
	 *
	 * @return bool
	 */
	private function isSassySocialShare() {

		if ( ! is_plugin_active( 'sassy-social-share/sassy-social-share.php' ) ) {
			return false;
		}
		$ss_options = get_option( 'heateor_sss' );
		$ss_bars = [ 'vertical_re_providers', 'horizontal_re_providers' ];
		if ( ! is_array( $ss_options ) ) {
			return false;
		}
		foreach ( $ss_bars as $key => $bar ) {
			if ( ! isset( $ss_options[ $bar ] ) ) {
				continue;
			}
			foreach ( $ss_options[ $bar ] as $index => $value ) {
				if ( isset( $value ) && is_string( $value ) ) {
					if ( strpos( $value, 'pinterest' ) !== false ) {
						return true;
					}
				}
			}
		}

		return false;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit