Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.97.2  /  Your IP : 104.23.197.230
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
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 : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nicolasj/www/ecoledelangues.be/wp-content/plugins/wp-google-maps/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nicolasj/www/ecoledelangues.be/wp-content/plugins/wp-google-maps/includes/class.feature.php
<?php

namespace WPGMZA;

class Feature extends Crud
{
	private static $cachedSubclasses;
	
	public static function isTypeSpatial($type)
	{
		$type = strtolower(preg_replace('/\(\d+\)$/', '', $type));
		
		switch($type)
		{
			case 'geometry':
			case 'point':
			case 'linestring':
			case 'polygon':
			case 'multipoint':
			case 'multilinestring':
			case 'multipolygon':
			case 'geometrycollection':
				return true;
				break;
			
			default:
				break;
		}
		
		return false;
	}
	
	public static function getSubclasses()
	{
		if(Feature::$cachedSubclasses)
			return Feature::$cachedSubclasses;
		
		foreach(glob(__DIR__ . '/*.php') as $file){
			if(basename($file) === 'class.dom-element.php'){
				continue;
			}
			require_once($file);
		}
		
	    /* Developer Hook (Action) - Load required feature classes */     
		do_action('wpgmza_require_feature_classes');
		
		foreach(get_declared_classes() as $class)
		{
			if(!is_subclass_of($class, 'WPGMZA\\Feature'))
				continue;
			
			$reflection = new \ReflectionClass($class);
			
			if(preg_match('/^Pro/', $reflection->getShortName()))
				continue;
			
			Feature::$cachedSubclasses[] = $reflection->getShortName();
		}
		
		return Feature::$cachedSubclasses;
	}
	
	public static function getBulkReadColumns($table)
	{
		global $wpgmza;
		
		$columns = array();
		
		foreach(Crud::getColumnsByTableName($table) as $obj)
		{			
			if(Feature::isTypeSpatial($obj->Type))
				$columns[] = "{$wpgmza->spatialFunctionPrefix}AsText(`{$obj->Field}`) AS {$obj->Field}";
			else
				$columns[] = "`{$obj->Field}`";
		}
		
		return $columns;
	}
	
	public static function convertSpatialTextToJson($text)
	{
		if(preg_match_all('/[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/', $text, $m) === false)
			throw new \Exception('Invalid spatial data, no coordinates found');
		
		$floats	= $m[0];
		$count	= count($floats);
		
		
		if($count % 2 == 1)
			throw new \Exception('Invalid spatial data, odd number of coordinates found');
		
		if(preg_match('/^POINT/i', $text) || $count == 2)
		{
			if(count($floats) != 2)
				throw new \Exception('Invalid number of coordinates found in point data');
			
			$result = array(
				'lat'	=> $floats[0],
				'lng'	=> $floats[1]
			);

		}
		else
		{
			$result = array();
			
			for($i = 0; $i < $count; $i += 2)
			{
				$result[] = array(
					'lat'	=> $floats[$i],
					'lng'	=> $floats[$i + 1]
				);
			}
		}
		
		return $result;
	}
	
	protected function getReadColumns()
	{
		global $wpgmza;
		
		$columns	= $this->get_columns();
		$result		= array();
		
		foreach($columns as $key => $definition)
		{
			if(Feature::isTypeSpatial($definition->Type))
				$result[] = "{$wpgmza->spatialFunctionPrefix}AsText({$definition->Field}) AS {$definition->Field}";
			else
				$result[] = $definition->Field;
		}
		
		return $result;
	}
	
	protected function get_placeholder_by_type($type)
	{
		global $wpgmza;
		
		switch($type)
		{
			case 'geometry':
			case 'point':
			case 'linestring':
			case 'polygon':
			case 'multipoint':
			case 'multilinestring':
			case 'multipolygon':
			case 'geometrycollection':
				return "{$wpgmza->spatialFunctionPrefix}GeomFromText(%s)";
				break;
			
			default:
				break;
		}
		
		return Crud::get_placeholder_by_type($type);
	}
	
	public function jsonSerialize()
	{
		global $wpgmza;

		$json		= Crud::jsonSerialize();
		$columns	= $this->get_columns_by_name();
		
		foreach($json as $key => $value)
		{
			switch($key)
			{
				case 'dataset':
				case 'polydata':
				
					// NB: Legacy field support
					try{
						$json[$key] = $this->convertSpatialTextToJson($value);
					} catch(\Exception $ex){
						/*
						 * This was added for legacy shape fallback, when the dataset is corrupted
						 * Prevents bad spatial data from breaking the map editor
						 * Added: 2021-01-22
						*/
						$json[$key] = null;
					}

					break;

				case 'description':
					if(!$this->useRawData && empty($wpgmza->processingContext)){
						$json[$key]	= do_shortcode($value);
					}
					break;
				default:
					if(isset($columns[$key]) && $this->isTypeSpatial($columns[$key]->Type))
					{
						$converted = $this->convertSpatialTextToJson($value);
						$json[$key] = $converted;
					}
				
					break;
			}
		}
		
		return $json;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit