PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
wp-google-maps
/
includes
<?php namespace WPGMZA; if(!defined('ABSPATH')) return; class InternalEngine { const LEGACY = "legacy"; const ATLAS_NOVUS = "atlas-novus"; const RAND_PROB_FACTOR = 0.7; private $engine; private $baseUrl; private $baseDir; private $styleDir; private $templateDir; /** * Constructor */ public function __construct($engine = false){ $this->engine = self::validateEngine($engine); $this->baseUrl = rtrim(WPGMZA_PLUGIN_DIR_URL, '/'); $this->baseDir = rtrim(WPGMZA_PLUGIN_DIR_PATH, '/'); $this->styleDir = "css"; $this->templateDir = "html"; $this->baseDirOverride = false; } /** * Get the current internal engine * * @return string */ public function getEngine(){ return $this->engine; } /** * Check if the user is running legacy engine * * @return bool */ public function isLegacy(){ return $this->getEngine() === self::LEGACY; } /** * Get the build code for the current version combination * * It's important to note that this is not the same as getting the version of the plugin, as this instead is a coded build number with more details such as * engine name codes, and total build trails * * It is not reliant on any one plugin to function, which is why it lives in the InternalEngine class specifically. Probably shouldn't be used for file versions or anything like that * * @return string */ public function getBuildVersion(){ global $wpgmza, $wpgmza_version, $wpgmza_pro_version, $wpgmza_gold_version, $wpgmza_ugm_version; /* Using the globals let's register each of the build params */ $versions = array( 'basic' => $wpgmza_version, 'pro' => $wpgmza_pro_version, 'gold' => $wpgmza_gold_version, 'vgm' => $wpgmza_ugm_version, ); /* Developer Hook (Filter) - Alter version number array/tags */ $versions = apply_filters("wpgmza_internal_engine_build_version_plugins", $versions); $buildCodes = array(); foreach($versions as $slug => $version){ if(!empty($version)){ $tag = strtoupper(substr($slug, 0, 1)); $buildCodes[] = "{$tag}.{$version}"; } } $buildCodes = implode("::", $buildCodes); $flags = array(); /* Create a tag from the build name */ $engine = strtoupper(substr($this->getEngine(), 0, 1)); $flags[] = $engine; /* Flag for map engine */ if(!empty($wpgmza->settings->wpgmza_maps_engine)){ $mapEngine = strtoupper(substr($wpgmza->settings->wpgmza_maps_engine, 0, 1)); $flags[] = $mapEngine; } /* Flag if dev mode */ $isDevMode = !empty($wpgmza) && $wpgmza->isInDeveloperMode() ? true : false; if($isDevMode){ $flags[] = "D"; } /* Developer Hook (Filter) - Add or alter plugin build flags */ $flags = apply_filters("wpgmza_internal_engine_build_version_flags", $flags); $flags = implode(".", $flags); /* Developer Hook (Filter) - Add or alter final build code string */ $buildString = apply_filters("wpgmza_internal_engine_build_version", "{$buildCodes}::{$flags}"); return $buildString; } /** * Get a path to a stylesheet, based on build * * @return string */ public function getStylesheet($path){ return $this->compilePath($this->baseUrl, $this->styleDir, $path); } /** * Get a path to a template file, based on build */ public function getTemplate($path, $baseOverride = false){ if(!empty($baseOverride)){ $this->setBaseDir($baseOverride); } $template = $this->compilePath($this->getBaseDir(), $this->templateDir, $path); $this->unsetBaseDir(); return $template; } /** * Get button class based on build * * Legacy buttons are different from the refactor * * @param string $default The default tag class * * @return string */ public function getButtonClass($default){ if($this->engine !== self::LEGACY){ return "wpgmza-{$default}"; } return $default; } /** * Get base directory, allowing Pro to use basic method for pathing * * @return string */ public function getBaseDir(){ if(!empty($this->baseDirOverride)){ return $this->baseDirOverride; } return $this->baseDir; } /** * Set override for the base directory * * @param string $baseDirOverride The new base directory * * @return void */ private function setBaseDir($baseDirOverride){ $this->baseDirOverride = rtrim($baseDirOverride, '/'); } /** * Unset, or reset the base directory for the system * * @return void */ private function unsetBaseDir(){ $this->baseDirOverride = false; } /** * Compile the full bath to a file, based on engine and caller * * @param string $base The base directory to use * @param string $type The type of resource * @param string $file The filename to be loaded * * @return string */ private function compilePath($base, $type, $file){ $compiled = array( 'base' => $base, 'type' => $type, 'engine' => $this->engine, 'file' => $file ); if(empty($this->engine) || $this->engine === self::LEGACY){ unset($compiled['engine']); } if(!$this->validatePath($compiled)){ if(!empty($compiled['engine'])){ unset($compiled['engine']); } } return $this->buildPath($compiled); } /** * Build the path based on parts generated by the compilePath method (in most cases) * * @param array $parts The path parts to be joined * * @return string */ private function buildPath($parts){ return implode('/', $parts); } /** * Validate a full path, by checking if the file exists * * @param array $parts The path parts * * @return bool */ private function validatePath($parts){ $parts['base'] = $this->getBaseDir(); if(file_exists($this->buildPath($parts))){ return true; } return false; } /** * Valiate engine selection * * @return string */ public static function validateEngine($engine = false){ switch ($engine) { case self::LEGACY: case self::ATLAS_NOVUS: return $engine; default: return self::getStableBuildName(); } } /** * Select a random engine, usually for installation * * This accounts for probability factors * * As of 9.0.13 we use a different approach to randomizing engines, we now use days of the month instead of random ranges * * @return string */ public static function getRandomEngine(){ $today = intval(date('j')); $days = intval(date('t')); $rFact = $today / $days; /* Old approach */ /* $rFact = mt_rand(0, 10) / 10; */ if($rFact <= self::RAND_PROB_FACTOR){ return self::getExperimentalBuildName(); } return self::getStableBuildName(); } /** * Get stable build name, in this case legacy * * @return string */ public static function getStableBuildName(){ return self::LEGACY; } /** * Get experimental build name, in this case atlas novus * * @return string */ public static function getExperimentalBuildName(){ return self::ATLAS_NOVUS; } }
[-] class.admin-ui.php
[edit]
[+]
3rd-party-integration
[-] class.latlng.php
[edit]
[-] class.map.php
[edit]
[-] class.admin-notices.php
[edit]
[-] class.dom-query-results.php
[edit]
[-] class.pointlabel.php
[edit]
[-] class.upgrader.php
[edit]
[-] class.map-list-page.php
[edit]
[-] class.integrity-checker.php
[edit]
[-] class.dom-document.php
[edit]
[-] class.crud.php
[edit]
[+]
styling
[-] class.dynamic-translations.php
[edit]
[-] class.strings.php
[edit]
[-] class.library-script-panel.php
[edit]
[+]
open-layers
[-] class.maps-engine-dialog.php
[edit]
[+]
compat
[-] class.plugin.php
[edit]
[-] class.theme-panel.php
[edit]
[-] class.global-settings.php
[edit]
[+]
google-maps
[-] class.query.php
[edit]
[-] class.modal-dialog.php
[edit]
[-] class.script-loader.php
[edit]
[-] class.internal-engine.php
[edit]
[-] class.selector-to-xpath.php
[edit]
[-] class.polygon.php
[edit]
[-] class.rectangle.php
[edit]
[-] class.system-info.php
[edit]
[-] class.shortcodes.php
[edit]
[-] class.gdpr-compliance.php
[edit]
[+]
php8
[-] build.log
[edit]
[+]
tables
[-] class.polyline.php
[edit]
[-] class.settings.php
[edit]
[-] class.store-locator.php
[edit]
[-] class.country-select.php
[edit]
[-] class.settings-page.php
[edit]
[-] class.dom-element.php
[edit]
[+]
..
[-] class.elias-fano.php
[edit]
[-] class.distance.php
[edit]
[-] class.auto-loader.php
[edit]
[-] class.circle.php
[edit]
[-] class.page.php
[edit]
[-] class.component-anchor-control.php
[edit]
[+]
map-edit-page
[-] class.feature.php
[edit]
[-] class.marker.php
[edit]
[-] class.database.php
[edit]
[-] class.marker-filter.php
[edit]
[-] class.google-maps-api-loader.php
[edit]
[-] class.factory.php
[edit]
[+]
legacy
[-] class.installer-page.php
[edit]
[-] class.query-fragment.php
[edit]