Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins/nav-menu-collapse/includes/static/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins/nav-menu-collapse/includes/static/class-utilities.php
<?php
/*!
 * Plugin utility functions.
 *
 * @since 2.0.0
 *
 * @package    Nav Menu Collapse
 * @subpackage Utilities
 */

if (!defined('ABSPATH'))
{
	exit;
}

/**
 * Class used to implement utility functions.
 *
 * @since 2.0.0
 */
final class Nav_Menu_Collapse_Utilities
{
	/**
	 * Check a value to see if it is an array or convert to an array if necessary.
	 *
	 * @since 2.0.0
	 *
	 * @access public static
	 * @param  mixed $value        Value to turn into an array.
	 * @param  mixed $return_empty True if an empty value should be returned as-is.
	 * @return mixed               Checked value as an array.
	 */
	public static function check_array($value, $return_empty = false)
	{
		$is_empty = empty($value);
		
		if
		(
			$is_empty
			&&
			$return_empty
		)
		{
			return $value;
		}

		if ($is_empty)
		{
			$value = array();
		}

		if (!is_array($value))
		{
			$value = array($value);
		}

		return $value;
	}

	/**
	 * Remove comments, line breaks and tabs from provided code.
	 *
	 * @since 2.0.0
	 *
	 * @access public static
	 * @param  string $code Raw code to clean up.
	 * @return string       Code without comments, line breaks and tabs.
	 */
	public static function clean_code($code)
	{
		$code = preg_replace('/<!--(.*)-->/Uis', '', $code);
		$code = preg_replace('/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\'|\")\/\/.*))/', '', $code);

		return str_replace(array(PHP_EOL, "\r", "\n", "\t"), '', $code);
	}
	
	/**
	 * Check to see if a full string end with a specified string.
	 * 
	 * @since 2.0.1 Improved condition.
	 * @since 2.0.0
	 * 
	 * @access public static
	 * @param  string  $needle   String to check for.
	 * @param  string  $haystack Full string to check.
	 * @return boolean           True if the full string ends with the specified string.
	 */
	public static function ends_with($needle, $haystack)
	{
		$length = strlen($needle);
		
		if ($length === 0)
		{
			return true;
		}
		
		return (substr($haystack, -$length) === $needle);
	}
	
	/**
	 * Check to see if a variable is a valid field object.
	 *
	 * @since 2.0.0
	 *
	 * @access public static
	 * @param  mixed   $variable Variable to check.
	 * @return boolean           True if the variable is a valid field object.
	 */
	public static function is_field($variable)
	{
		return
		(
			is_object($variable)
			&&
			self::starts_with('Nav_Menu_Collapse_Field', get_class($variable))
			&&
			!is_a($variable, 'Nav_Menu_Collapse_Field_Tab')
		);
	}

	/**
	 * Load and decode JSON from a provided file path.
	 *
	 * @since 2.0.0
	 *
	 * @access public static
	 * @param  string $file_path   Path to the JSON file.
	 * @param  string $plugin_path Path for the current plugin.
	 * @return string              Decoded JSON file.
	 */
	public static function load_json($file_path, $plugin_path = '')
	{
		if (empty($plugin_path))
		{
			$plugin_path = Nav_Menu_Collapse()->plugin;
		}
		
		$file = plugin_dir_path($plugin_path) . $file_path;

		if (!file_exists($file))
		{
			return '';
		}

		ob_start();

		require($file);

		return json_decode(ob_get_clean(), true);
	}
	
	/**
	 * Check to see if a full string starts with a specified string.
	 * 
	 * @since 2.0.0
	 * 
	 * @access public static
	 * @param  string  $needle   String to check for.
	 * @param  string  $haystack Full string to check.
	 * @return boolean           True if the full string starts with the specified string.
	 */
	public static function starts_with($needle, $haystack)
	{
		return
		(
			empty($needle)
			||
			strpos($haystack, $needle) === 0
		);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit