Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php class PLL_Frontend_Filters_Search { public $links_model, $curlang; ..

Decoded Output download

<?php






class PLL_Frontend_Filters_Search {
	public $links_model, $curlang;

	






	public function __construct( &$polylang ) {
		$this->links_model = &$polylang->links_model;
		$this->curlang = &$polylang->curlang;

		
		
		add_filter( 'get_search_form', array( &$this, 'get_search_form' ), 99 );

		
		add_action( 'add_admin_bar_menus', array( &$this, 'add_admin_bar_menus' ) );

		
		
		if ( defined( 'PLL_SEARCH_FORM_JS' ) && PLL_SEARCH_FORM_JS ) {
			add_action( 'wp_footer', array( &$this, 'wp_print_footer_scripts' ) );
		}
	}

	








	public function get_search_form( $form ) {
		if ( $form ) {
			if ( $this->links_model->using_permalinks ) {
				
				preg_match( '#<form.+>#', $form, $matches );
				$old = reset( $matches );
				$new = preg_replace( '#' . esc_url( $this->links_model->home ) . '\/?#', esc_url( $this->curlang->search_url ), $old );
				$form = str_replace( $old, $new, $form );
			}
			else {
				$form = str_replace( '</form>', '<input type="hidden" name="lang" value="'.esc_attr( $this->curlang->slug ).'" /></form>', $form );
			}
		}

		return $form;
	}

	




	function add_admin_bar_menus() {
		remove_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
		add_action( 'admin_bar_menu', array( &$this, 'admin_bar_search_menu' ), 4 );
	}

	







	public function admin_bar_search_menu( $wp_admin_bar ) {
		$form  = '<form action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch">';
		$form .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />';
		$form .= '<label for="adminbar-search" class="screen-reader-text">' . __( 'Search' ) . '</label>';
		$form .= '<input type="submit" class="adminbar-button" value="' . __( 'Search' ) . '"/>';
		$form .= '</form>';

		$wp_admin_bar->add_menu( array(
			'parent' => 'top-secondary',
			'id'     => 'search',
			'title'  => $this->get_search_form( $form ), 
			'meta'   => array( 'class' => 'admin-bar-search', 'tabindex' => -1 ),
		) );
	}

	




	public function wp_print_footer_scripts() {
		
		
		
		
		$lang = esc_js( $this->curlang->slug );
		$js = "//<![CDATA[
		e = document.getElementsByName( 's' );
		for ( i = 0; i < e.length; i++ ) {
			if ( e[i].tagName.toUpperCase() == 'INPUT' ) {
				s = e[i].parentNode.parentNode.children;
				l = 0;
				for ( j = 0; j < s.length; j++ ) {
					if ( s[j].name == 'lang' ) {
						l = 1;
					}
				}
				if ( l == 0 ) {
					var ih = document.createElement( 'input' );
					ih.type = 'hidden';
					ih.name = 'lang';
					ih.value = '$lang';
					e[i].parentNode.appendChild( ih );
				}
			}
		}
		//]]>";
		echo '<script type="text/javascript">' . $js . '</script>';
	}
}
 ?>

Did this file decode correctly?

Original Code

<?php






class PLL_Frontend_Filters_Search {
	public $links_model, $curlang;

	






	public function __construct( &$polylang ) {
		$this->links_model = &$polylang->links_model;
		$this->curlang = &$polylang->curlang;

		
		
		add_filter( 'get_search_form', array( &$this, 'get_search_form' ), 99 );

		
		add_action( 'add_admin_bar_menus', array( &$this, 'add_admin_bar_menus' ) );

		
		
		if ( defined( 'PLL_SEARCH_FORM_JS' ) && PLL_SEARCH_FORM_JS ) {
			add_action( 'wp_footer', array( &$this, 'wp_print_footer_scripts' ) );
		}
	}

	








	public function get_search_form( $form ) {
		if ( $form ) {
			if ( $this->links_model->using_permalinks ) {
				
				preg_match( '#<form.+>#', $form, $matches );
				$old = reset( $matches );
				$new = preg_replace( '#' . esc_url( $this->links_model->home ) . '\/?#', esc_url( $this->curlang->search_url ), $old );
				$form = str_replace( $old, $new, $form );
			}
			else {
				$form = str_replace( '</form>', '<input type="hidden" name="lang" value="'.esc_attr( $this->curlang->slug ).'" /></form>', $form );
			}
		}

		return $form;
	}

	




	function add_admin_bar_menus() {
		remove_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 4 );
		add_action( 'admin_bar_menu', array( &$this, 'admin_bar_search_menu' ), 4 );
	}

	







	public function admin_bar_search_menu( $wp_admin_bar ) {
		$form  = '<form action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch">';
		$form .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />';
		$form .= '<label for="adminbar-search" class="screen-reader-text">' . __( 'Search' ) . '</label>';
		$form .= '<input type="submit" class="adminbar-button" value="' . __( 'Search' ) . '"/>';
		$form .= '</form>';

		$wp_admin_bar->add_menu( array(
			'parent' => 'top-secondary',
			'id'     => 'search',
			'title'  => $this->get_search_form( $form ), 
			'meta'   => array( 'class' => 'admin-bar-search', 'tabindex' => -1 ),
		) );
	}

	




	public function wp_print_footer_scripts() {
		
		
		
		
		$lang = esc_js( $this->curlang->slug );
		$js = "//<![CDATA[
		e = document.getElementsByName( 's' );
		for ( i = 0; i < e.length; i++ ) {
			if ( e[i].tagName.toUpperCase() == 'INPUT' ) {
				s = e[i].parentNode.parentNode.children;
				l = 0;
				for ( j = 0; j < s.length; j++ ) {
					if ( s[j].name == 'lang' ) {
						l = 1;
					}
				}
				if ( l == 0 ) {
					var ih = document.createElement( 'input' );
					ih.type = 'hidden';
					ih.name = 'lang';
					ih.value = '$lang';
					e[i].parentNode.appendChild( ih );
				}
			}
		}
		//]]>";
		echo '<script type="text/javascript">' . $js . '</script>';
	}
}

Function Calls

None

Variables

None

Stats

MD5 7730fc277c88dbd2e98ae17ca34f6313
Eval Count 0
Decode Time 99 ms