Initial commit: Atomaste website
This commit is contained in:
25
Atomaste Reference/public_html/wp-content/plugins/hostinger-easy-onboarding/vendor/autoload.php
vendored
Normal file
25
Atomaste Reference/public_html/wp-content/plugins/hostinger-easy-onboarding/vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
$err,
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit355c18229fe47c20ad676cad3dd03349::getLoader();
|
||||
@@ -0,0 +1,579 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
/** @var \Closure(string):void */
|
||||
private static $includeFile;
|
||||
|
||||
/** @var string|null */
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
/**
|
||||
* @var array<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array<string, list<string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
/**
|
||||
* List of PSR-0 prefixes
|
||||
*
|
||||
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||
*
|
||||
* @var array<string, array<string, list<string>>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
/** @var bool */
|
||||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
/** @var bool */
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var string|null */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var array<string, self>
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param string|null $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
self::initializeIncludeClosure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string> Array of classname => path
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $classMap Class to filename map
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param list<string>|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
$paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
$paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param list<string>|string $paths The PSR-0 base directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return true|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
$includeFile = self::$includeFile;
|
||||
$includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||
*
|
||||
* @return array<string, self>
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param string $ext
|
||||
* @return string|false
|
||||
*/
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private static function initializeIncludeClosure()
|
||||
{
|
||||
if (self::$includeFile !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
self::$includeFile = \Closure::bind(static function($file) {
|
||||
include $file;
|
||||
}, null, null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* This class is copied in every Composer installed project and available to all
|
||||
*
|
||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||
*
|
||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class InstalledVersions
|
||||
{
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private static $canGetVendors;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static $installedByVendor = array();
|
||||
|
||||
/**
|
||||
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all package names with a specific type e.g. 'library'
|
||||
*
|
||||
* @param string $type
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackagesByType($type)
|
||||
{
|
||||
$packagesByType = array();
|
||||
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
foreach ($installed['versions'] as $name => $package) {
|
||||
if (isset($package['type']) && $package['type'] === $type) {
|
||||
$packagesByType[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $packagesByType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package is installed
|
||||
*
|
||||
* This also returns true if the package name is provided or replaced by another package
|
||||
*
|
||||
* @param string $packageName
|
||||
* @param bool $includeDevRequirements
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package satisfies a version constraint
|
||||
*
|
||||
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||
*
|
||||
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||
*
|
||||
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||
* @param string $packageName
|
||||
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||
* @return bool
|
||||
*/
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints((string) $constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||
*
|
||||
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||
* whether a given version of a package is installed, and not just whether it exists
|
||||
*
|
||||
* @param string $packageName
|
||||
* @return string Version constraint usable with composer/semver
|
||||
*/
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||
*/
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||
*/
|
||||
public static function getInstallPath($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||
*/
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw installed.php data for custom implementations
|
||||
*
|
||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||
* @return array[]
|
||||
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||
*/
|
||||
public static function getRawData()
|
||||
{
|
||||
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = include __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||
*
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
public static function getAllRawData()
|
||||
{
|
||||
return self::getInstalled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you reload the static array from another file
|
||||
*
|
||||
* This is only useful for complex integrations in which a project needs to use
|
||||
* this class but then also needs to execute another project's autoloader in process,
|
||||
* and wants to ensure both projects have access to their version of installed.php.
|
||||
*
|
||||
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||
* the data it needs from this class, then call reload() with
|
||||
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||
* the project in which it runs can then also use this class safely, without
|
||||
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||
*
|
||||
* @param array[] $data A vendor/composer/installed.php data set
|
||||
* @return void
|
||||
*
|
||||
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
$copiedLocalDir = false;
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require $vendorDir.'/composer/installed.php';
|
||||
self::$installedByVendor[$vendorDir] = $required;
|
||||
$installed[] = $required;
|
||||
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||
self::$installed = $required;
|
||||
$copiedLocalDir = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require __DIR__ . '/installed.php';
|
||||
self::$installed = $required;
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$installed !== array() && !$copiedLocalDir) {
|
||||
$installed[] = self::$installed;
|
||||
}
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'Hostinger\\Amplitude\\ActionDispatcher' => $vendorDir . '/hostinger/hostinger-wp-amplitude/src/ActionDispatcher.php',
|
||||
'Hostinger\\Amplitude\\AmplitudeLoader' => $vendorDir . '/hostinger/hostinger-wp-amplitude/src/AmplitudeLoader.php',
|
||||
'Hostinger\\Amplitude\\AmplitudeManager' => $vendorDir . '/hostinger/hostinger-wp-amplitude/src/AmplitudeManager.php',
|
||||
'Hostinger\\Amplitude\\Rest' => $vendorDir . '/hostinger/hostinger-wp-amplitude/src/Rest.php',
|
||||
'Hostinger\\EasyOnboarding\\Activator' => $baseDir . '/includes/Activator.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Actions' => $baseDir . '/includes/Admin/Actions.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Ajax' => $baseDir . '/includes/Admin/Ajax.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Assets' => $baseDir . '/includes/Admin/Assets.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Hooks' => $baseDir . '/includes/Admin/Hooks.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Menu' => $baseDir . '/includes/Admin/Menu.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\AutocompleteSteps' => $baseDir . '/includes/Admin/Onboarding/AutocompleteSteps.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Onboarding' => $baseDir . '/includes/Admin/Onboarding/Onboarding.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Plugin' => $baseDir . '/includes/Admin/Onboarding/Plugin.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\PluginManager' => $baseDir . '/includes/Admin/Onboarding/PluginManager.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Settings' => $baseDir . '/includes/Admin/Onboarding/Settings.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Steps\\Button' => $baseDir . '/includes/Admin/Onboarding/Steps/Button.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Steps\\Step' => $baseDir . '/includes/Admin/Onboarding/Steps/Step.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Steps\\StepCategory' => $baseDir . '/includes/Admin/Onboarding/Steps/StepCategory.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\WelcomeCards' => $baseDir . '/includes/Admin/Onboarding/WelcomeCards.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Partnership' => $baseDir . '/includes/Admin/Partnership.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Redirects' => $baseDir . '/includes/Admin/Redirects.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Surveys' => $baseDir . '/includes/Admin/Surveys.php',
|
||||
'Hostinger\\EasyOnboarding\\AmplitudeEvents\\Actions' => $baseDir . '/includes/AmplitudeEvents/Actions.php',
|
||||
'Hostinger\\EasyOnboarding\\AmplitudeEvents\\Amplitude' => $baseDir . '/includes/AmplitudeEvents/Amplitude.php',
|
||||
'Hostinger\\EasyOnboarding\\Bootstrap' => $baseDir . '/includes/Bootstrap.php',
|
||||
'Hostinger\\EasyOnboarding\\Cli' => $baseDir . '/includes/Cli.php',
|
||||
'Hostinger\\EasyOnboarding\\Cli\\Commands\\CLICommand' => $baseDir . '/includes/Cli/Commands/CLICommand.php',
|
||||
'Hostinger\\EasyOnboarding\\Cli\\Commands\\OnboardingStatus' => $baseDir . '/includes/Cli/Commands/OnboardingStatus.php',
|
||||
'Hostinger\\EasyOnboarding\\Config' => $baseDir . '/includes/Config.php',
|
||||
'Hostinger\\EasyOnboarding\\Deactivator' => $baseDir . '/includes/Deactivator.php',
|
||||
'Hostinger\\EasyOnboarding\\DefaultOptions' => $baseDir . '/includes/DefaultOptions.php',
|
||||
'Hostinger\\EasyOnboarding\\EasyOnboarding' => $baseDir . '/includes/EasyOnboarding.php',
|
||||
'Hostinger\\EasyOnboarding\\Helper' => $baseDir . '/includes/Helper.php',
|
||||
'Hostinger\\EasyOnboarding\\Hooks' => $baseDir . '/includes/Hooks.php',
|
||||
'Hostinger\\EasyOnboarding\\I18n' => $baseDir . '/includes/I18n.php',
|
||||
'Hostinger\\EasyOnboarding\\Loader' => $baseDir . '/includes/Loader.php',
|
||||
'Hostinger\\EasyOnboarding\\Preview\\Assets' => $baseDir . '/includes/Preview/Assets.php',
|
||||
'Hostinger\\EasyOnboarding\\Requests\\Client' => $baseDir . '/includes/Requests/Client.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\Routes' => $baseDir . '/includes/Rest/Routes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\StepRoutes' => $baseDir . '/includes/Rest/StepRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\TutorialRoutes' => $baseDir . '/includes/Rest/TutorialRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\WelcomeRoutes' => $baseDir . '/includes/Rest/WelcomeRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\WooRoutes' => $baseDir . '/includes/Rest/WooRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Settings' => $baseDir . '/includes/Settings.php',
|
||||
'Hostinger\\EasyOnboarding\\Updates' => $baseDir . '/includes/Updates.php',
|
||||
'Hostinger\\EasyOnboarding\\WooCommerce\\GatewayManager' => $baseDir . '/includes/WooCommerce/GatewayManager.php',
|
||||
'Hostinger\\EasyOnboarding\\WooCommerce\\Options' => $baseDir . '/includes/WooCommerce/Options.php',
|
||||
'Hostinger\\Surveys\\Ajax' => $vendorDir . '/hostinger/hostinger-wp-surveys/src/Ajax.php',
|
||||
'Hostinger\\Surveys\\Assets' => $vendorDir . '/hostinger/hostinger-wp-surveys/src/Assets.php',
|
||||
'Hostinger\\Surveys\\Loader' => $vendorDir . '/hostinger/hostinger-wp-surveys/src/Loader.php',
|
||||
'Hostinger\\Surveys\\Rest' => $vendorDir . '/hostinger/hostinger-wp-surveys/src/Rest.php',
|
||||
'Hostinger\\Surveys\\SurveyLoader' => $vendorDir . '/hostinger/hostinger-wp-surveys/src/SurveyLoader.php',
|
||||
'Hostinger\\Surveys\\SurveyManager' => $vendorDir . '/hostinger/hostinger-wp-surveys/src/SurveyManager.php',
|
||||
'Hostinger\\WpHelper\\Config' => $vendorDir . '/hostinger/hostinger-wp-helper/src/Config.php',
|
||||
'Hostinger\\WpHelper\\Constants' => $vendorDir . '/hostinger/hostinger-wp-helper/src/Constants.php',
|
||||
'Hostinger\\WpHelper\\Requests\\Client' => $vendorDir . '/hostinger/hostinger-wp-helper/src/Requests/Client.php',
|
||||
'Hostinger\\WpHelper\\Utils' => $vendorDir . '/hostinger/hostinger-wp-helper/src/Utils.php',
|
||||
'Hostinger\\WpMenuManager\\Assets' => $vendorDir . '/hostinger/hostinger-wp-menu-manager/src/Assets.php',
|
||||
'Hostinger\\WpMenuManager\\Manager' => $vendorDir . '/hostinger/hostinger-wp-menu-manager/src/Manager.php',
|
||||
'Hostinger\\WpMenuManager\\Menus' => $vendorDir . '/hostinger/hostinger-wp-menu-manager/src/Menus.php',
|
||||
);
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'256558b1ddf2fa4366ea7d7602798dd1' => $vendorDir . '/yahnis-elsts/plugin-update-checker/load-v5p5.php',
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Hostinger\\WpMenuManager\\' => array($vendorDir . '/hostinger/hostinger-wp-menu-manager/src'),
|
||||
'Hostinger\\WpHelper\\' => array($vendorDir . '/hostinger/hostinger-wp-helper/src'),
|
||||
'Hostinger\\Tests\\' => array($vendorDir . '/hostinger/hostinger-wp-helper/tests/phpunit'),
|
||||
'Hostinger\\Surveys\\' => array($vendorDir . '/hostinger/hostinger-wp-surveys/src'),
|
||||
'Hostinger\\EasyOnboarding\\' => array($baseDir . '/includes'),
|
||||
'Hostinger\\Amplitude\\' => array($vendorDir . '/hostinger/hostinger-wp-amplitude/src'),
|
||||
);
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit355c18229fe47c20ad676cad3dd03349
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit355c18229fe47c20ad676cad3dd03349', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit355c18229fe47c20ad676cad3dd03349', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit355c18229fe47c20ad676cad3dd03349::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit355c18229fe47c20ad676cad3dd03349::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
||||
require $file;
|
||||
}
|
||||
}, null, null);
|
||||
foreach ($filesToLoad as $fileIdentifier => $file) {
|
||||
$requireFile($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit355c18229fe47c20ad676cad3dd03349
|
||||
{
|
||||
public static $files = array (
|
||||
'256558b1ddf2fa4366ea7d7602798dd1' => __DIR__ . '/..' . '/yahnis-elsts/plugin-update-checker/load-v5p5.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'H' =>
|
||||
array (
|
||||
'Hostinger\\WpMenuManager\\' => 24,
|
||||
'Hostinger\\WpHelper\\' => 19,
|
||||
'Hostinger\\Tests\\' => 16,
|
||||
'Hostinger\\Surveys\\' => 18,
|
||||
'Hostinger\\EasyOnboarding\\' => 25,
|
||||
'Hostinger\\Amplitude\\' => 20,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Hostinger\\WpMenuManager\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/hostinger/hostinger-wp-menu-manager/src',
|
||||
),
|
||||
'Hostinger\\WpHelper\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/hostinger/hostinger-wp-helper/src',
|
||||
),
|
||||
'Hostinger\\Tests\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/hostinger/hostinger-wp-helper/tests/phpunit',
|
||||
),
|
||||
'Hostinger\\Surveys\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src',
|
||||
),
|
||||
'Hostinger\\EasyOnboarding\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/includes',
|
||||
),
|
||||
'Hostinger\\Amplitude\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/hostinger/hostinger-wp-amplitude/src',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'Hostinger\\Amplitude\\ActionDispatcher' => __DIR__ . '/..' . '/hostinger/hostinger-wp-amplitude/src/ActionDispatcher.php',
|
||||
'Hostinger\\Amplitude\\AmplitudeLoader' => __DIR__ . '/..' . '/hostinger/hostinger-wp-amplitude/src/AmplitudeLoader.php',
|
||||
'Hostinger\\Amplitude\\AmplitudeManager' => __DIR__ . '/..' . '/hostinger/hostinger-wp-amplitude/src/AmplitudeManager.php',
|
||||
'Hostinger\\Amplitude\\Rest' => __DIR__ . '/..' . '/hostinger/hostinger-wp-amplitude/src/Rest.php',
|
||||
'Hostinger\\EasyOnboarding\\Activator' => __DIR__ . '/../..' . '/includes/Activator.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Actions' => __DIR__ . '/../..' . '/includes/Admin/Actions.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Ajax' => __DIR__ . '/../..' . '/includes/Admin/Ajax.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Assets' => __DIR__ . '/../..' . '/includes/Admin/Assets.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Hooks' => __DIR__ . '/../..' . '/includes/Admin/Hooks.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Menu' => __DIR__ . '/../..' . '/includes/Admin/Menu.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\AutocompleteSteps' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/AutocompleteSteps.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Onboarding' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/Onboarding.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Plugin' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/Plugin.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\PluginManager' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/PluginManager.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Settings' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/Settings.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Steps\\Button' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/Steps/Button.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Steps\\Step' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/Steps/Step.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\Steps\\StepCategory' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/Steps/StepCategory.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Onboarding\\WelcomeCards' => __DIR__ . '/../..' . '/includes/Admin/Onboarding/WelcomeCards.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Partnership' => __DIR__ . '/../..' . '/includes/Admin/Partnership.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Redirects' => __DIR__ . '/../..' . '/includes/Admin/Redirects.php',
|
||||
'Hostinger\\EasyOnboarding\\Admin\\Surveys' => __DIR__ . '/../..' . '/includes/Admin/Surveys.php',
|
||||
'Hostinger\\EasyOnboarding\\AmplitudeEvents\\Actions' => __DIR__ . '/../..' . '/includes/AmplitudeEvents/Actions.php',
|
||||
'Hostinger\\EasyOnboarding\\AmplitudeEvents\\Amplitude' => __DIR__ . '/../..' . '/includes/AmplitudeEvents/Amplitude.php',
|
||||
'Hostinger\\EasyOnboarding\\Bootstrap' => __DIR__ . '/../..' . '/includes/Bootstrap.php',
|
||||
'Hostinger\\EasyOnboarding\\Cli' => __DIR__ . '/../..' . '/includes/Cli.php',
|
||||
'Hostinger\\EasyOnboarding\\Cli\\Commands\\CLICommand' => __DIR__ . '/../..' . '/includes/Cli/Commands/CLICommand.php',
|
||||
'Hostinger\\EasyOnboarding\\Cli\\Commands\\OnboardingStatus' => __DIR__ . '/../..' . '/includes/Cli/Commands/OnboardingStatus.php',
|
||||
'Hostinger\\EasyOnboarding\\Config' => __DIR__ . '/../..' . '/includes/Config.php',
|
||||
'Hostinger\\EasyOnboarding\\Deactivator' => __DIR__ . '/../..' . '/includes/Deactivator.php',
|
||||
'Hostinger\\EasyOnboarding\\DefaultOptions' => __DIR__ . '/../..' . '/includes/DefaultOptions.php',
|
||||
'Hostinger\\EasyOnboarding\\EasyOnboarding' => __DIR__ . '/../..' . '/includes/EasyOnboarding.php',
|
||||
'Hostinger\\EasyOnboarding\\Helper' => __DIR__ . '/../..' . '/includes/Helper.php',
|
||||
'Hostinger\\EasyOnboarding\\Hooks' => __DIR__ . '/../..' . '/includes/Hooks.php',
|
||||
'Hostinger\\EasyOnboarding\\I18n' => __DIR__ . '/../..' . '/includes/I18n.php',
|
||||
'Hostinger\\EasyOnboarding\\Loader' => __DIR__ . '/../..' . '/includes/Loader.php',
|
||||
'Hostinger\\EasyOnboarding\\Preview\\Assets' => __DIR__ . '/../..' . '/includes/Preview/Assets.php',
|
||||
'Hostinger\\EasyOnboarding\\Requests\\Client' => __DIR__ . '/../..' . '/includes/Requests/Client.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\Routes' => __DIR__ . '/../..' . '/includes/Rest/Routes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\StepRoutes' => __DIR__ . '/../..' . '/includes/Rest/StepRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\TutorialRoutes' => __DIR__ . '/../..' . '/includes/Rest/TutorialRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\WelcomeRoutes' => __DIR__ . '/../..' . '/includes/Rest/WelcomeRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Rest\\WooRoutes' => __DIR__ . '/../..' . '/includes/Rest/WooRoutes.php',
|
||||
'Hostinger\\EasyOnboarding\\Settings' => __DIR__ . '/../..' . '/includes/Settings.php',
|
||||
'Hostinger\\EasyOnboarding\\Updates' => __DIR__ . '/../..' . '/includes/Updates.php',
|
||||
'Hostinger\\EasyOnboarding\\WooCommerce\\GatewayManager' => __DIR__ . '/../..' . '/includes/WooCommerce/GatewayManager.php',
|
||||
'Hostinger\\EasyOnboarding\\WooCommerce\\Options' => __DIR__ . '/../..' . '/includes/WooCommerce/Options.php',
|
||||
'Hostinger\\Surveys\\Ajax' => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src/Ajax.php',
|
||||
'Hostinger\\Surveys\\Assets' => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src/Assets.php',
|
||||
'Hostinger\\Surveys\\Loader' => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src/Loader.php',
|
||||
'Hostinger\\Surveys\\Rest' => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src/Rest.php',
|
||||
'Hostinger\\Surveys\\SurveyLoader' => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src/SurveyLoader.php',
|
||||
'Hostinger\\Surveys\\SurveyManager' => __DIR__ . '/..' . '/hostinger/hostinger-wp-surveys/src/SurveyManager.php',
|
||||
'Hostinger\\WpHelper\\Config' => __DIR__ . '/..' . '/hostinger/hostinger-wp-helper/src/Config.php',
|
||||
'Hostinger\\WpHelper\\Constants' => __DIR__ . '/..' . '/hostinger/hostinger-wp-helper/src/Constants.php',
|
||||
'Hostinger\\WpHelper\\Requests\\Client' => __DIR__ . '/..' . '/hostinger/hostinger-wp-helper/src/Requests/Client.php',
|
||||
'Hostinger\\WpHelper\\Utils' => __DIR__ . '/..' . '/hostinger/hostinger-wp-helper/src/Utils.php',
|
||||
'Hostinger\\WpMenuManager\\Assets' => __DIR__ . '/..' . '/hostinger/hostinger-wp-menu-manager/src/Assets.php',
|
||||
'Hostinger\\WpMenuManager\\Manager' => __DIR__ . '/..' . '/hostinger/hostinger-wp-menu-manager/src/Manager.php',
|
||||
'Hostinger\\WpMenuManager\\Menus' => __DIR__ . '/..' . '/hostinger/hostinger-wp-menu-manager/src/Menus.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit355c18229fe47c20ad676cad3dd03349::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit355c18229fe47c20ad676cad3dd03349::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit355c18229fe47c20ad676cad3dd03349::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-amplitude",
|
||||
"version": "dev-main",
|
||||
"version_normalized": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-amplitude.git",
|
||||
"reference": "dca118cc19ab89523024ed071ebc344581859557"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/hostinger/hostinger-wp-amplitude/zipball/dca118cc19ab89523024ed071ebc344581859557",
|
||||
"reference": "dca118cc19ab89523024ed071ebc344581859557",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-helper": "dev-main",
|
||||
"php": ">=8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"time": "2024-12-12T09:23:58+00:00",
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Amplitude\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Amplitude\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"proprietary"
|
||||
],
|
||||
"description": "A PHP package with amplitude events for WordPress plugins",
|
||||
"support": {
|
||||
"source": "https://github.com/hostinger/hostinger-wp-amplitude/tree/main",
|
||||
"issues": "https://github.com/hostinger/hostinger-wp-amplitude/issues"
|
||||
},
|
||||
"install-path": "../hostinger/hostinger-wp-amplitude"
|
||||
},
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-helper",
|
||||
"version": "dev-main",
|
||||
"version_normalized": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-helper.git",
|
||||
"reference": "cc2cc0fb4e27299459fe6a4402d618fcd7ef026e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/hostinger/hostinger-wp-helper/zipball/cc2cc0fb4e27299459fe6a4402d618fcd7ef026e",
|
||||
"reference": "cc2cc0fb4e27299459fe6a4402d618fcd7ef026e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"yoast/phpunit-polyfills": "^2.0"
|
||||
},
|
||||
"time": "2024-12-02T07:25:44+00:00",
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\WpHelper\\": "src/",
|
||||
"Hostinger\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
},
|
||||
"description": "A PHP package with core functions for Hostinger WordPress plugins.",
|
||||
"support": {
|
||||
"source": "https://github.com/hostinger/hostinger-wp-helper/tree/main",
|
||||
"issues": "https://github.com/hostinger/hostinger-wp-helper/issues"
|
||||
},
|
||||
"install-path": "../hostinger/hostinger-wp-helper"
|
||||
},
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-menu-manager",
|
||||
"version": "dev-main",
|
||||
"version_normalized": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-menu-manager.git",
|
||||
"reference": "13ec41032a861dd8e7f388d99e1113e8dc982d6c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/hostinger/hostinger-wp-menu-manager/zipball/13ec41032a861dd8e7f388d99e1113e8dc982d6c",
|
||||
"reference": "13ec41032a861dd8e7f388d99e1113e8dc982d6c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-helper": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"squizlabs/php_codesniffer": "^3.0",
|
||||
"yoast/phpunit-polyfills": "^2.0"
|
||||
},
|
||||
"time": "2025-01-08T10:39:58+00:00",
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\WpMenuManager\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hostinger\\WpMenuManager\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"proprietary"
|
||||
],
|
||||
"description": "Package for managing Hostinger WordPress menus and pages.",
|
||||
"support": {
|
||||
"source": "https://github.com/hostinger/hostinger-wp-menu-manager/tree/main",
|
||||
"issues": "https://github.com/hostinger/hostinger-wp-menu-manager/issues"
|
||||
},
|
||||
"install-path": "../hostinger/hostinger-wp-menu-manager"
|
||||
},
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-surveys",
|
||||
"version": "dev-main",
|
||||
"version_normalized": "dev-main",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-surveys.git",
|
||||
"reference": "1fa637dce2b35c15c34f75b30f97602410801554"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/hostinger/hostinger-wp-surveys/zipball/1fa637dce2b35c15c34f75b30f97602410801554",
|
||||
"reference": "1fa637dce2b35c15c34f75b30f97602410801554",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-helper": "dev-main",
|
||||
"php": ">=8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"10up/wp_mock": "^1.0",
|
||||
"brain/monkey": "^2.6",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"time": "2024-11-12T11:30:31+00:00",
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Surveys\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Surveys\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
},
|
||||
"license": [
|
||||
"proprietary"
|
||||
],
|
||||
"description": "A PHP package with surveys for WordPress plugins",
|
||||
"support": {
|
||||
"source": "https://github.com/hostinger/hostinger-wp-surveys/tree/main",
|
||||
"issues": "https://github.com/hostinger/hostinger-wp-surveys/issues"
|
||||
},
|
||||
"install-path": "../hostinger/hostinger-wp-surveys"
|
||||
},
|
||||
{
|
||||
"name": "yahnis-elsts/plugin-update-checker",
|
||||
"version": "v5.5",
|
||||
"version_normalized": "5.5.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/YahnisElsts/plugin-update-checker.git",
|
||||
"reference": "845d65da93bcff31649ede00d9d73b1beadbb7f0"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/YahnisElsts/plugin-update-checker/zipball/845d65da93bcff31649ede00d9d73b1beadbb7f0",
|
||||
"reference": "845d65da93bcff31649ede00d9d73b1beadbb7f0",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=5.6.20"
|
||||
},
|
||||
"time": "2024-10-16T14:25:00+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"load-v5p5.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Yahnis Elsts",
|
||||
"email": "whiteshadow@w-shadow.com",
|
||||
"homepage": "https://w-shadow.com/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A custom update checker for WordPress plugins and themes. Useful if you can't host your plugin in the official WP repository but still want it to support automatic updates.",
|
||||
"homepage": "https://github.com/YahnisElsts/plugin-update-checker/",
|
||||
"keywords": [
|
||||
"automatic updates",
|
||||
"plugin updates",
|
||||
"theme updates",
|
||||
"wordpress"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/YahnisElsts/plugin-update-checker/issues",
|
||||
"source": "https://github.com/YahnisElsts/plugin-update-checker/tree/v5.5"
|
||||
},
|
||||
"install-path": "../yahnis-elsts/plugin-update-checker"
|
||||
}
|
||||
],
|
||||
"dev": false,
|
||||
"dev-package-names": []
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'hostinger/hostinger-easy-onboarding',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '7dc6906b0a2f97e8a23071aac7bd7b0a2bd2dc06',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev' => false,
|
||||
),
|
||||
'versions' => array(
|
||||
'hostinger/hostinger-easy-onboarding' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '7dc6906b0a2f97e8a23071aac7bd7b0a2bd2dc06',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'hostinger/hostinger-wp-amplitude' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'dca118cc19ab89523024ed071ebc344581859557',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../hostinger/hostinger-wp-amplitude',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'hostinger/hostinger-wp-helper' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => 'cc2cc0fb4e27299459fe6a4402d618fcd7ef026e',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../hostinger/hostinger-wp-helper',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'hostinger/hostinger-wp-menu-manager' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '13ec41032a861dd8e7f388d99e1113e8dc982d6c',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../hostinger/hostinger-wp-menu-manager',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'hostinger/hostinger-wp-surveys' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '1fa637dce2b35c15c34f75b30f97602410801554',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../hostinger/hostinger-wp-surveys',
|
||||
'aliases' => array(
|
||||
0 => '9999999-dev',
|
||||
),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'yahnis-elsts/plugin-update-checker' => array(
|
||||
'pretty_version' => 'v5.5',
|
||||
'version' => '5.5.0.0',
|
||||
'reference' => '845d65da93bcff31649ede00d9d73b1beadbb7f0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../yahnis-elsts/plugin-update-checker',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker" # See documentation for possible values
|
||||
directories:
|
||||
- "**/*" # Location of package manifests
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "docker"
|
||||
reviewers:
|
||||
- "hostinger/wp-devs"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -0,0 +1,11 @@
|
||||
name: sca-scan
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master, main, staging]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
run-sca:
|
||||
uses: hostinger/sca-configs/.github/workflows/sca.yml@main
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,124 @@
|
||||
# WordPress Menu Manager PHP package
|
||||
|
||||
Package for managing Hostinger Amplitude events.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Code Testing](#code-testing)
|
||||
- [Support](#support)
|
||||
|
||||
## Installation
|
||||
|
||||
This is private package, adding it to composer is a bit different.
|
||||
|
||||
Add it to the composer.json:
|
||||
```sh
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-amplitude.git"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
and:
|
||||
```sh
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-amplitude": "dev-main",
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First thing boot up package in main plugin file:
|
||||
|
||||
```sh
|
||||
use Hostinger\Amplitude\AmplitudeLoader;
|
||||
|
||||
if( !function_exists('hostinger_load_amplitude') ) {
|
||||
function hostinger_load_amplitude(): void {
|
||||
$amplitude = AmplitudeLoader::getInstance();
|
||||
$amplitude->boot();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! has_action( 'plugins_loaded', 'hostinger_load_amplitude' ) ) {
|
||||
add_action('plugins_loaded', 'hostinger_load_amplitude');
|
||||
}
|
||||
```
|
||||
|
||||
You are ready to go. There are several hooks for use.
|
||||
|
||||
**getSingleAmplitudeEvents** - Add amplitude events that should trigger only once per day.
|
||||
|
||||
```sh
|
||||
add_filter('hostinger_once_per_day_events', function($amplitudeEvents) {
|
||||
$eventsList = [
|
||||
'wordpress.home.enter',
|
||||
'wordpress.learn.enter',
|
||||
'wordpress.ai_assistant.enter',
|
||||
];
|
||||
|
||||
$amplitudeEvents = array_merge($amplitudeEvents, $eventsList)
|
||||
|
||||
return $amplitudeEvents;
|
||||
});
|
||||
```
|
||||
|
||||
**SendRequest** - Submit amplitude event from backend.
|
||||
|
||||
```sh
|
||||
namespace Hostinger\Amplitude;
|
||||
|
||||
use Hostinger\Amplitude\AmplitudeManager;
|
||||
use Hostinger\WpHelper\Utils as Helper;
|
||||
use Hostinger\WpHelper\Requests\Client;
|
||||
use Hostinger\WpHelper\Config;
|
||||
use Hostinger\WpHelper\Constants;
|
||||
|
||||
$helper = new Helper();
|
||||
$configHandler = new Config();
|
||||
$client = new Client(
|
||||
$configHandler->getConfigValue( 'base_rest_uri', Constants::HOSTINGER_REST_URI ),
|
||||
array(
|
||||
Config::TOKEN_HEADER => $helper::getApiToken(),
|
||||
Config::DOMAIN_HEADER => $helper->getHostInfo()
|
||||
)
|
||||
);
|
||||
|
||||
$params = [
|
||||
'action' => 'wp_admin.woocommerce_onboarding.setup_store',
|
||||
'location' => 'wordpress',
|
||||
]
|
||||
|
||||
$amplitudeManger = new AmplitudeManager( $helper, $configHandler, $client );
|
||||
$amplitudeManger->sendRequest( $amplitudeManger::AMPLITUDE_ENDPOINT, $params );
|
||||
```
|
||||
|
||||
**SendRequest** - Submit amplitude event from frontend.
|
||||
|
||||
```sh
|
||||
var data = {
|
||||
action: 'yourAction',
|
||||
location: 'yourLocation'
|
||||
};
|
||||
|
||||
fetch('https://yourWebsiteUrl/wp-json/hostinger-amplitude/v1/hostinger-amplitude-event', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => console.log(data))
|
||||
.catch((error) => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Package initially was written by Martynas Umbraziunas (martynas.umbraziunas@hostinger.com). You can ping him in Slack for support.
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-amplitude",
|
||||
"description": "A PHP package with amplitude events for WordPress plugins",
|
||||
"license": "proprietary",
|
||||
"type": "library",
|
||||
"version": "1.0.12",
|
||||
"require": {
|
||||
"php": ">=8.0",
|
||||
"hostinger/hostinger-wp-helper": "dev-main"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3.0",
|
||||
"phpunit/phpunit": "^9.6"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-helper.git"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Amplitude\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Amplitude\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\Amplitude;
|
||||
|
||||
use Hostinger\Amplitude\AmplitudeManager;
|
||||
use Hostinger\WpHelper\Config;
|
||||
use Hostinger\WpHelper\Requests\Client;
|
||||
use Hostinger\WpHelper\Utils as Helper;
|
||||
|
||||
class ActionDispatcher
|
||||
{
|
||||
private const TRANSIENT_KEY = 'hostinger_login_data';
|
||||
private const EXPIRATION_TIME_SECONDS = 10800; // 3 hours
|
||||
private const AMPLITUDE_LOGIN_ACTION = 'wordpress.autologin.success';
|
||||
|
||||
private Config $configHandler;
|
||||
private Client $client;
|
||||
private Helper $helper;
|
||||
|
||||
public function __construct(
|
||||
Helper $helper,
|
||||
Config $configHandler,
|
||||
Client $client
|
||||
) {
|
||||
$this->helper = $helper;
|
||||
$this->configHandler = $configHandler;
|
||||
$this->client = $client;
|
||||
|
||||
add_action( 'hostinger_autologin_user_logged_in', [ $this, 'userAlreadyLoggedIn' ] );
|
||||
add_action( 'hostinger_autologin', [ $this, 'handleAutoLogin' ] );
|
||||
add_action( 'wp_logout', [ $this, 'clearLoginData' ] );
|
||||
}
|
||||
|
||||
public function handleAutoLogin( array $data ) : void {
|
||||
$this->processLoginData( $data );
|
||||
$this->loginEvent( $this->helper, $this->configHandler, $this->client, 'new_login' );
|
||||
}
|
||||
|
||||
public function userAlreadyLoggedIn( array $data ) : void {
|
||||
$this->processLoginData( $data );
|
||||
$this->loginEvent( $this->helper, $this->configHandler, $this->client, 'logged_in' );
|
||||
}
|
||||
|
||||
|
||||
public function processLoginData( array $data ) : void {
|
||||
$sanitized_data = $this->sanitizeLoginData( $data );
|
||||
set_transient( self::TRANSIENT_KEY, $sanitized_data, self::EXPIRATION_TIME_SECONDS );
|
||||
}
|
||||
|
||||
public function loginEvent( Helper $helper, Config $config, Client $client, string $status ) : void {
|
||||
$amplitudeManager = new AmplitudeManager( $helper, $config, $client );
|
||||
$params = [
|
||||
'action' => self::AMPLITUDE_LOGIN_ACTION,
|
||||
'status' => $status,
|
||||
];
|
||||
|
||||
$amplitudeManager->sendRequest( $amplitudeManager::AMPLITUDE_ENDPOINT, $params );
|
||||
}
|
||||
|
||||
private function sanitizeLoginData( array $data ) : array {
|
||||
if ( ! is_array( $data ) ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return array_map( 'sanitize_text_field', $data );
|
||||
}
|
||||
|
||||
public function clearLoginData() : void {
|
||||
delete_transient( self::TRANSIENT_KEY );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\Amplitude;
|
||||
|
||||
use Hostinger\WpHelper\Config;
|
||||
use Hostinger\WpHelper\Constants;
|
||||
use Hostinger\WpHelper\Requests\Client;
|
||||
use Hostinger\WpHelper\Utils as Helper;
|
||||
|
||||
class AmplitudeLoader
|
||||
{
|
||||
/**
|
||||
* @var AmplitudeLoader instance.
|
||||
*/
|
||||
private static ?AmplitudeLoader $instance = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private array $objects = [];
|
||||
|
||||
/**
|
||||
* Allow only one instance of class
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function getInstance() : self {
|
||||
if ( null === self::$instance ) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function boot() : bool {
|
||||
$this->registerModules();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function registerModules() : void {
|
||||
// Action Dispatcher.
|
||||
$helper = new Helper();
|
||||
$config = new Config();
|
||||
$client = new Client(
|
||||
$config->getConfigValue( 'base_rest_uri', Constants::HOSTINGER_REST_URI ), [
|
||||
Config::TOKEN_HEADER => $helper->getApiToken(),
|
||||
Config::DOMAIN_HEADER => $helper->getHostInfo(),
|
||||
]
|
||||
);
|
||||
|
||||
$this->objects['action_dispatcher'] = new ActionDispatcher( $helper, $config, $client );
|
||||
|
||||
// Amplitude Manager.
|
||||
$this->objects['amplitude_rest'] = new Rest();
|
||||
$this->objects['amplitude_rest']->init();
|
||||
|
||||
$this->addContainer();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function addContainer() : bool {
|
||||
if ( empty( $this->objects ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ( $this->objects as $object ) {
|
||||
if ( property_exists( $object, 'amplitude' ) ) {
|
||||
$object->setAmplitude( $this );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPluginInfo() : string {
|
||||
$plugin_url = '';
|
||||
|
||||
$plugins = get_plugins();
|
||||
foreach ( $plugins as $plugin_path => $plugin_info ) {
|
||||
if ( str_contains( __FILE__, 'plugins/' . dirname( $plugin_path ) . '/' ) ) {
|
||||
$plugin_dir = dirname( $plugin_path );
|
||||
|
||||
return plugins_url( $plugin_dir );
|
||||
}
|
||||
}
|
||||
|
||||
return $plugin_url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\Amplitude;
|
||||
|
||||
use Hostinger\WpHelper\Config;
|
||||
use Hostinger\WpHelper\Requests\Client;
|
||||
use Hostinger\WpHelper\Utils as Helper;
|
||||
|
||||
class AmplitudeManager
|
||||
{
|
||||
public const AMPLITUDE_ENDPOINT = '/v3/wordpress/plugin/trigger-event';
|
||||
private const CACHE_ONE_DAY = 86400;
|
||||
private const LOGIN_DATA = 'hostinger_login_data';
|
||||
|
||||
private Config $configHandler;
|
||||
private Client $client;
|
||||
private Helper $helper;
|
||||
|
||||
public function __construct(
|
||||
Helper $helper,
|
||||
Config $configHandler,
|
||||
Client $client
|
||||
) {
|
||||
$this->helper = $helper;
|
||||
$this->configHandler = $configHandler;
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function sendRequest( string $endpoint, array $params ) : array {
|
||||
try {
|
||||
if ( ! $this->isTransientSystemWorking() ) {
|
||||
return [ 'status' => 'error', 'message' => 'Database error: Transient not set correctly' ];
|
||||
}
|
||||
|
||||
if ( ! $this->shouldSendAmplitudeEvent( $params ) ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$params = $this->addImpersonationData( $params );
|
||||
$params = $this->addDomainAndDirectory( $params );
|
||||
|
||||
$response = $this->client->post( $endpoint, [ 'params' => $params ] );
|
||||
|
||||
return $response;
|
||||
} catch ( \Exception $exception ) {
|
||||
$this->helper->errorLog( 'Error sending request: ' . $exception->getMessage() );
|
||||
|
||||
return [ 'status' => 'error', 'message' => $exception->getMessage() ];
|
||||
}
|
||||
}
|
||||
|
||||
public function addDomainAndDirectory( array $params ) : array {
|
||||
if ( $siteUrl = get_site_url() ) {
|
||||
$params['siteurl'] = $siteUrl;
|
||||
|
||||
$websiteDir = $this->getSubdirectoryName( $siteUrl );
|
||||
$params['directory'] = $websiteDir;
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function getSubdirectoryName( string $siteUrl ) : string {
|
||||
$sitePath = parse_url( $siteUrl, PHP_URL_PATH ) ?? '';
|
||||
|
||||
return trim( $sitePath, '/' ) ? : '';
|
||||
}
|
||||
|
||||
public function addImpersonationData( array $params ) : array {
|
||||
$login_data = get_transient( self::LOGIN_DATA );
|
||||
|
||||
if ( $login_data === false ) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
if ( ! empty( $login_data['acting_client_id'] ) ) {
|
||||
$params['is_impersonated'] = true;
|
||||
$params['impersonated_client_id'] = sanitize_text_field( $login_data['acting_client_id'] );
|
||||
}
|
||||
|
||||
if ( ! empty( $login_data['client_id'] ) ) {
|
||||
$params['client_id'] = sanitize_text_field( $login_data['client_id'] );
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
// Events which firing once per day
|
||||
public static function getSingleAmplitudeEvents() : array {
|
||||
return apply_filters( 'hostinger_once_per_day_events', [] );
|
||||
}
|
||||
|
||||
public function shouldSendAmplitudeEvent( array $params ): bool {
|
||||
$oneTimePerDay = self::getSingleAmplitudeEvents();
|
||||
|
||||
if ( empty( $params['action'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$eventAction = sanitize_text_field( $params['action'] );
|
||||
$transientKey = 'amplitude_event_' . $eventAction;
|
||||
|
||||
if ( in_array( $eventAction, $oneTimePerDay, true ) ) {
|
||||
$hasBeenSentToday = get_transient( $transientKey );
|
||||
|
||||
if ( $hasBeenSentToday ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
set_transient( $transientKey, time(), self::CACHE_ONE_DAY );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isTransientSystemWorking() : bool {
|
||||
set_transient( 'check_transients', 'value', 60 );
|
||||
|
||||
$testValue = get_transient( 'check_transients' );
|
||||
|
||||
return $testValue !== false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* Rest API Routes
|
||||
*
|
||||
* @package HostingerAffiliatePlugin
|
||||
*/
|
||||
|
||||
namespace Hostinger\Amplitude;
|
||||
|
||||
use Hostinger\WpHelper\Utils as Helper;
|
||||
use Hostinger\WpHelper\Requests\Client;
|
||||
use Hostinger\WpHelper\Config;
|
||||
use Hostinger\WpHelper\Constants;
|
||||
|
||||
|
||||
/**
|
||||
* Avoid possibility to get file accessed directly
|
||||
*/
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for handling Rest Api Routes
|
||||
*/
|
||||
class Rest {
|
||||
public const REST_NAMESPACE = 'hostinger-amplitude/v1';
|
||||
|
||||
/**
|
||||
* @var Helper
|
||||
*/
|
||||
private Helper $helper;
|
||||
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
private Config $configHandler;
|
||||
|
||||
/**
|
||||
* @var Client
|
||||
*/
|
||||
private Client $client;
|
||||
|
||||
public function __construct() {
|
||||
$this->helper = new Helper();
|
||||
$this->configHandler = new Config();
|
||||
$this->client = new Client(
|
||||
$this->configHandler->getConfigValue( 'base_rest_uri', Constants::HOSTINGER_REST_URI ),
|
||||
array(
|
||||
Config::TOKEN_HEADER => $this->helper::getApiToken(),
|
||||
Config::DOMAIN_HEADER => $this->helper->getHostInfo()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init rest routes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void {
|
||||
add_action( 'rest_api_init', [ $this, 'registerRoutes' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function registerRoutes(): void {
|
||||
$this->registerAmplitudeRoute();
|
||||
$this->registerExperimentsRoute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function registerAmplitudeRoute(): void {
|
||||
register_rest_route(
|
||||
self::REST_NAMESPACE,
|
||||
'hostinger-amplitude-event',
|
||||
array(
|
||||
'methods' => 'POST',
|
||||
'callback' => array( $this, 'sendAmplitudeEvent' ),
|
||||
'permission_callback' => array( $this, 'permissionCheck' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function registerExperimentsRoute(): void {
|
||||
register_rest_route(
|
||||
self::REST_NAMESPACE,
|
||||
'hostinger-amplitude-experiments',
|
||||
array(
|
||||
'methods' => 'GET',
|
||||
'callback' => array( $this, 'getExperiments' ),
|
||||
'permission_callback' => array( $this, 'permissionCheck' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \WP_REST_Response
|
||||
*/
|
||||
public function getExperiments( ): \WP_REST_Response {
|
||||
$data = array();
|
||||
|
||||
$response = new \WP_REST_Response( );
|
||||
|
||||
try {
|
||||
$response->set_status( \WP_Http::OK );
|
||||
|
||||
$request = $this->client->get( '/v3/wordpress/amplitude/experiments', array( 'domain' => $this->helper->getHostInfo() ) );
|
||||
|
||||
$data = $request;
|
||||
|
||||
if(!empty($request['body'])) {
|
||||
$json = json_decode($request['body'], true);
|
||||
|
||||
if(!empty($json['data'])) {
|
||||
$data = array(
|
||||
'status' => 'success',
|
||||
'data' => $json['data']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} catch ( \Exception $exception ) {
|
||||
|
||||
$response->set_status( \WP_Http::BAD_REQUEST );
|
||||
|
||||
$this->helper->errorLog( 'Error sending request: ' . $exception->getMessage() );
|
||||
|
||||
$data = array(
|
||||
'status' => 'error',
|
||||
'message' => $exception->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
$response->set_data( $data );
|
||||
|
||||
$response->set_headers( array( 'Cache-Control' => 'no-cache' ) );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function sendAmplitudeEvent( $request ) {
|
||||
$params = $request->get_param( 'params' );
|
||||
|
||||
$amplitudeManger = new AmplitudeManager( $this->helper, $this->configHandler, $this->client );
|
||||
$status = $amplitudeManger->sendRequest( $amplitudeManger::AMPLITUDE_ENDPOINT, !empty($params) ? $params : [] );
|
||||
|
||||
$response = new \WP_REST_Response( array( 'status' => $status ) );
|
||||
$response->set_headers(array('Cache-Control' => 'no-cache'));
|
||||
$response->set_status( \WP_Http::OK );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WP_REST_Request $request WordPress rest request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function permissionCheck( $request ): bool {
|
||||
if ( empty( is_user_logged_in() ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Implement custom capabilities when needed.
|
||||
return current_user_can( 'manage_options' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker" # See documentation for possible values
|
||||
directories:
|
||||
- "**/*" # Location of package manifests
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "docker"
|
||||
reviewers:
|
||||
- "hostinger/wp-devs"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -0,0 +1,11 @@
|
||||
name: sca-scan
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master, main, staging]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
run-sca:
|
||||
uses: hostinger/sca-configs/.github/workflows/sca.yml@main
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,45 @@
|
||||
# WordPress Core functions for plugins PHP package
|
||||
|
||||
A PHP package with core functions for Hostinger WordPress plugins.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Support](#support)
|
||||
|
||||
## Installation
|
||||
|
||||
This is private package, adding it to composer is a bit different.
|
||||
|
||||
Add it to the composer.json:
|
||||
```sh
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-helper.git"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
and:
|
||||
```sh
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-helper": "main",
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First thing boot up package in main plugin file:
|
||||
|
||||
```sh
|
||||
use Hostinger\Helper;
|
||||
|
||||
$helepr = new Helper();
|
||||
$helper->isPreviewDomain();
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Package initially was written by Martynas U. (martynas.umbraziunas@hostinger.com). You can ping him in Slack for support.
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-helper",
|
||||
"description": "A PHP package with core functions for Hostinger WordPress plugins.",
|
||||
"type": "library",
|
||||
"require": {
|
||||
"php": ">=8.0",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"version": "1.0.10",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\WpHelper\\": "src/",
|
||||
"Hostinger\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"yoast/phpunit-polyfills": "^2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpHelper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Config {
|
||||
private array $config = array();
|
||||
public const TOKEN_HEADER = 'X-Hpanel-Order-Token';
|
||||
public const DOMAIN_HEADER = 'X-Hpanel-Domain';
|
||||
public const CONFIG_PATH = ABSPATH . '.private/config.json';
|
||||
public function __construct() {
|
||||
$this->decodeConfig( self::CONFIG_PATH );
|
||||
}
|
||||
|
||||
private function decodeConfig( string $path ): void {
|
||||
if ( file_exists( $path ) ) {
|
||||
$config_content = file_get_contents( $path );
|
||||
$this->config = json_decode( $config_content, true );
|
||||
}
|
||||
}
|
||||
|
||||
public function getConfigValue( string $key, $default ): string {
|
||||
if ( $this->config && isset( $this->config[ $key ] ) && ! empty( $this->config[ $key ] ) ) {
|
||||
return $this->config[ $key ];
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpHelper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Constants {
|
||||
public const TOKEN_HEADER = 'X-Hpanel-Order-Token';
|
||||
public const DOMAIN_HEADER = 'X-Hpanel-Domain';
|
||||
public const HOSTINGER_REST_URI = 'https://rest-hosting.hostinger.com';
|
||||
public const CONFIG_PATH = ABSPATH . '.private/config.json';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpHelper\Requests;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
class Client {
|
||||
private string $api_url;
|
||||
private array $default_headers;
|
||||
|
||||
public function __construct( $api_url, $default_headers = array() ) {
|
||||
$this->api_url = $api_url;
|
||||
$this->default_headers = $default_headers;
|
||||
}
|
||||
|
||||
public function get_api_url(): string {
|
||||
return $this->api_url;
|
||||
}
|
||||
|
||||
public function set_api_url( string $api_url ): void {
|
||||
$this->api_url = $api_url;
|
||||
}
|
||||
|
||||
public function get_default_headers(): array {
|
||||
return $this->default_headers;
|
||||
}
|
||||
|
||||
public function set_default_headers( array $default_headers ): void {
|
||||
$this->default_headers = $default_headers;
|
||||
}
|
||||
|
||||
public function get( $endpoint, $params = array(), $headers = array(), $timeout = 120 ) {
|
||||
$url = $this->api_url . $endpoint;
|
||||
$request_args = array(
|
||||
'method' => 'GET',
|
||||
'headers' => array_merge( $this->default_headers, $headers ),
|
||||
'timeout' => $timeout,
|
||||
);
|
||||
|
||||
if ( ! empty( $params ) ) {
|
||||
$url = add_query_arg( $params, $url );
|
||||
}
|
||||
|
||||
$response = wp_remote_get( $url, $request_args );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function post( $endpoint, $params = array(), $headers = array(), $timeout = 120 ) {
|
||||
$url = $this->api_url . $endpoint;
|
||||
$request_args = array(
|
||||
'method' => 'POST',
|
||||
'timeout' => $timeout,
|
||||
'headers' => array_merge( $this->default_headers, $headers ),
|
||||
'body' => $params,
|
||||
);
|
||||
|
||||
$response = wp_remote_post( $url, $request_args );
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpHelper;
|
||||
|
||||
class Utils {
|
||||
|
||||
private static string $apiTokenFile;
|
||||
|
||||
private const HPANEL_DOMAIN_URL = 'https://hpanel.hostinger.com/websites/';
|
||||
private const HOSTINGER_SITE = '.hostingersite.com';
|
||||
|
||||
private static function getApiTokenPath(): void {
|
||||
$hostingerDirParts = explode( '/', __DIR__ );
|
||||
if ( count( $hostingerDirParts ) >= 3 ) {
|
||||
$hostingerServerRootPath = '/' . $hostingerDirParts[1] . '/' . $hostingerDirParts[2];
|
||||
self::$apiTokenFile = $hostingerServerRootPath . '/.api_token';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pluginSlug
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
// Check if a specific plugin is active by its slug
|
||||
public static function isPluginActive( string $pluginSlug ): bool {
|
||||
$plugin_relative_path = $pluginSlug . '/' . $pluginSlug . '.php';
|
||||
|
||||
if ( is_multisite() ) {
|
||||
return self::checkIsPluginActiveMultiSite( $plugin_relative_path );
|
||||
}
|
||||
|
||||
return self::checkIsPluginActive( $plugin_relative_path );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $plugin_relative_path
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function checkIsPluginActiveMultiSite( string $plugin_relative_path ): bool {
|
||||
// Check network-wide active plugins
|
||||
$activePlugins = get_site_option( 'active_sitewide_plugins', [] );
|
||||
if ( in_array( $plugin_relative_path, $activePlugins ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check each site in the network
|
||||
$sites = get_sites();
|
||||
foreach ( $sites as $site ) {
|
||||
switch_to_blog( $site->blog_id );
|
||||
$activePlugins = get_option( 'active_plugins', [] );
|
||||
if ( in_array( $plugin_relative_path, $activePlugins ) ) {
|
||||
restore_current_blog();
|
||||
|
||||
return true;
|
||||
}
|
||||
restore_current_blog();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $plugin_relative_path
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function checkIsPluginActive( string $plugin_relative_path ): bool {
|
||||
// Check active plugins in a single site
|
||||
$activePlugins = get_option( 'active_plugins', [] );
|
||||
|
||||
if ( in_array( $plugin_relative_path, $activePlugins ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the content of the API token file
|
||||
public static function getApiToken(): string {
|
||||
self::getApiTokenPath();
|
||||
|
||||
if ( file_exists( self::$apiTokenFile ) ) {
|
||||
$apiToken = file_get_contents( self::$apiTokenFile );
|
||||
if ( ! empty( $apiToken ) ) {
|
||||
return $apiToken;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get the host info (domain, subdomain, subdirectory)
|
||||
public function getHostInfo(): string {
|
||||
$host = $_SERVER['HTTP_HOST'] ?? '';
|
||||
$site_url = get_site_url();
|
||||
$site_url = preg_replace( '#^https?://#', '', $site_url );
|
||||
|
||||
if ( ! empty( $site_url ) && ! empty( $host ) && strpos( $site_url, $host ) === 0 ) {
|
||||
if ( $site_url === $host ) {
|
||||
return $host;
|
||||
} else {
|
||||
return substr( $site_url, strlen( $host ) + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
return $host;
|
||||
}
|
||||
|
||||
// Check if the current domain is a preview domain
|
||||
public function isPreviewDomain(): bool {
|
||||
if ( function_exists( 'getallheaders' ) ) {
|
||||
$headers = getallheaders();
|
||||
}
|
||||
|
||||
if ( isset( $headers['X-Preview-Indicator'] ) && $headers['X-Preview-Indicator'] ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the current page is the specified page
|
||||
public function isThisPage( string $page ): bool {
|
||||
|
||||
if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$current_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
|
||||
|
||||
if ( defined( 'DOING_AJAX' ) && \DOING_AJAX ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset( $current_uri ) && strpos( $current_uri, '/wp-json/' ) !== false ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( strpos( $current_uri, $page ) !== false ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get hPanel domain URL
|
||||
public function getHpanelDomainUrl() : string {
|
||||
$parsed_url = parse_url( get_site_url() );
|
||||
$host = $parsed_url['host'];
|
||||
$directory = __DIR__;
|
||||
|
||||
// Remove 'www.' if it exists in the host
|
||||
if ( strpos( $host, 'www.' ) === 0 ) {
|
||||
$host = substr( $host, 4 );
|
||||
}
|
||||
|
||||
// Parse the host into parts
|
||||
$host_parts = explode( '.', $host );
|
||||
$is_subdomain = count( $host_parts ) > 2;
|
||||
|
||||
// Helper to get the base domain (last two parts)
|
||||
$base_domain = implode( '.', array_slice( $host_parts, -2 ) );
|
||||
|
||||
// System folders to ignore
|
||||
$system_folders = [ 'wp-content', 'plugins', 'themes', 'uploads' ];
|
||||
|
||||
// Detect if there is a subdirectory immediately after 'public_html'
|
||||
$subdirectory_name = '';
|
||||
if ( preg_match( '/\/public_html\/([^\/]+)\//', $directory, $matches ) && ! in_array( $matches[1], $system_folders ) ) {
|
||||
$subdirectory_name = $matches[1];
|
||||
}
|
||||
|
||||
// Handle preview domains
|
||||
if ( $this->isPreviewDomain() ) {
|
||||
$host_parts = explode( '.', $host );
|
||||
$base_domain = str_replace( '-', '.', $host_parts[0] );
|
||||
|
||||
return self::HPANEL_DOMAIN_URL . "$base_domain." . end( $host_parts );
|
||||
}
|
||||
|
||||
// Handle subdomain with a directory structure
|
||||
if ( $subdirectory_name !== '' ) {
|
||||
$full_domain = "$subdirectory_name.$base_domain";
|
||||
|
||||
return self::HPANEL_DOMAIN_URL . "$base_domain/wordpress/dashboard/$full_domain";
|
||||
}
|
||||
|
||||
// Handle top-level subdomain (no subdirectory structure)
|
||||
if ( $is_subdomain ) {
|
||||
return self::HPANEL_DOMAIN_URL . "$host";
|
||||
}
|
||||
|
||||
// Default to handling top-level domains (without subdomains)
|
||||
return self::HPANEL_DOMAIN_URL . "$host";
|
||||
}
|
||||
|
||||
// Check transient eligibility
|
||||
public function checkTransientEligibility( $transient_request_key, $cache_time = 3600 ): bool {
|
||||
try {
|
||||
// Set transient
|
||||
set_transient( $transient_request_key, true, $cache_time );
|
||||
|
||||
// Check if transient was set successfully
|
||||
if ( false === get_transient( $transient_request_key ) ) {
|
||||
throw new \Exception( 'Unable to create transient in WordPress.' );
|
||||
}
|
||||
|
||||
// If everything is fine, return true
|
||||
return true;
|
||||
} catch ( \Exception $exception ) {
|
||||
// If there's an exception, log the error and return false
|
||||
$this->errorLog( 'Error checking eligibility: ' . $exception->getMessage() );
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function errorLog( string $message ): void {
|
||||
if ( defined( 'WP_DEBUG' ) && \WP_DEBUG === true ) {
|
||||
error_log( print_r( $message, true ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSetting( string $setting ): string {
|
||||
|
||||
if ( $setting ) {
|
||||
return get_option( 'hostinger_' . $setting, '' );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function updateSetting( string $setting, $value, $autoload = null ): void {
|
||||
|
||||
if ( $setting ) {
|
||||
update_option( 'hostinger_' . $setting, $value, $autoload );
|
||||
}
|
||||
}
|
||||
|
||||
public static function flushLitespeedCache(): void {
|
||||
if ( has_action( 'litespeed_purge_all' ) ) {
|
||||
do_action( 'litespeed_purge_all' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "docker" # See documentation for possible values
|
||||
directories:
|
||||
- "**/*" # Location of package manifests
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "docker"
|
||||
reviewers:
|
||||
- "hostinger/wp-devs"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
@@ -0,0 +1,11 @@
|
||||
name: sca-scan
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master, main, staging]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
run-sca:
|
||||
uses: hostinger/sca-configs/.github/workflows/sca.yml@main
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,131 @@
|
||||
# WordPress Menu Manager PHP package
|
||||
|
||||
Package for managing Hostinger WordPress menus and pages.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Code Testing](#code-testing)
|
||||
- [Translation](#translation)
|
||||
- [Support](#support)
|
||||
|
||||
## Installation
|
||||
|
||||
This is private package, adding it to composer is a bit different.
|
||||
|
||||
Add it to the composer.json:
|
||||
```sh
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-menu-manager.git"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
and:
|
||||
```sh
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-menu-manager": "dev-main OR dev-branch",
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First thing boot up package in main plugin file:
|
||||
|
||||
```sh
|
||||
use Hostinger\WpMenuManager\Manager;
|
||||
|
||||
if( !function_exists('hostinger_load_menus') ) {
|
||||
function hostinger_load_menus(): void {
|
||||
$manager = Manager::getInstance();
|
||||
$manager->boot();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! has_action( 'plugins_loaded', 'hostinger_load_menus' ) ) {
|
||||
add_action('plugins_loaded', 'hostinger_load_menus');
|
||||
}
|
||||
```
|
||||
|
||||
You are ready to go. There are several hooks for use.
|
||||
|
||||
**hostinger_menu_subpages** - add new subpage under Hostinger menu item
|
||||
|
||||
```sh
|
||||
add_filter('hostinger_menu_subpages', function($submenus) {
|
||||
$example_submenu = array(
|
||||
'page_title' => 'Example Submenu',
|
||||
'menu_title' => 'Example Submenu',
|
||||
'capability' => 'manage_options',
|
||||
'menu_slug' => 'example-submenu',
|
||||
'callback' => [$this, 'test'],
|
||||
'menu_order' => 10
|
||||
);
|
||||
|
||||
$submenus[] = $example_submenu;
|
||||
|
||||
return $submenus;
|
||||
});
|
||||
```
|
||||
|
||||
**hostinger_admin_menu_bar_items** - add new sub menu items under Hostinger admin bar menu
|
||||
|
||||
```sh
|
||||
add_filter('hostinger_admin_menu_bar_items', function($menu_items) {
|
||||
$menu_item = array(
|
||||
'id' => 'billings',
|
||||
'title' => 'Billings',
|
||||
'href' => 'https://',
|
||||
'meta' => [
|
||||
'target' => '_blank'
|
||||
]
|
||||
);
|
||||
|
||||
$menu_items[] = $menu_item;
|
||||
|
||||
return $menu_items;
|
||||
});
|
||||
```
|
||||
|
||||
You also need to render Hostinger navigation inside your pages:
|
||||
|
||||
```sh
|
||||
use Hostinger\WpMenuManager\Menus;
|
||||
|
||||
echo Menus::renderMenuNavigation();
|
||||
```
|
||||
|
||||
If you want to hide all menu items and only show one view you can:
|
||||
|
||||
1) Update **hostinger_hide_subpages** option with true
|
||||
|
||||
2) Hook into **hostinger_main_menu_content**
|
||||
|
||||
```sh
|
||||
add_action('hostinger_main_menu_content', function() {
|
||||
echo 'I am main content';
|
||||
});
|
||||
```
|
||||
|
||||
## Code Testing
|
||||
|
||||
PHP_CodeSniffer package is used to check code against code standards. PSR-12 standard is used.
|
||||
|
||||
```sh
|
||||
$ vendor/bin/phpcs -ps
|
||||
```
|
||||
|
||||
Translation
|
||||
|
||||
## Generate .pot file with this command
|
||||
|
||||
```sh
|
||||
$ wp i18n make-pot src/ languages/hostinger-wp-menu-package.pot --domain=hostinger-wp-menu-package
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Package initially was written by Daniels Martinovs (daniels.martinovs@hostinger.com). You can ping him in Slack for support.
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
(()=>{var e,r={144:()=>{jQuery(document).on("ready",(function(){window.addEventListener("onboardingMenuToggle",(function(e){var r="hostinger-hide-all-menu-items";switch(e.detail&&e.detail.operation?e.detail.operation:"show"){case"show":document.querySelector("body").classList.remove(r);break;case"hide":document.querySelector("body").classList.add(r)}})),window.addEventListener("resize",(function(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,r=document.querySelector(".hsr-wrapper__list"),t=document.querySelector(".hsr-mobile-sidebar .hsr-wrapper"),o=document.querySelector(".hsr-navbar-buttons");if(e<=1085)r&&t&&(t.appendChild(r),null!==o&&t.appendChild(o));else{var n=document.querySelector(".hsr-onboarding-navbar__wrapper");r&&n&&(n.appendChild(r),null!==o&&n.appendChild(o),document.querySelector(".hsr-mobile-sidebar").classList.remove("hsr-active"))}})),window.dispatchEvent(new Event("resize"));var e=document.querySelector(".hsr-mobile-sidebar"),r=document.querySelectorAll(".hsr-close, .hsr-mobile-menu-icon");null!==r&&r.forEach((function(r){r.addEventListener("click",(function(r){e.classList.toggle("hsr-active"),document.querySelector("body").classList.toggle("hsr-sidebar-active"),r.stopPropagation()}))})),document.addEventListener("click",(function(r){null!==e&&(e.contains(r.target)||(e.classList.remove("hsr-active"),document.querySelector("body").classList.remove("hsr-sidebar-active")))}))}))},796:()=>{}},t={};function o(e){var n=t[e];if(void 0!==n)return n.exports;var i=t[e]={exports:{}};return r[e](i,i.exports,o),i.exports}o.m=r,e=[],o.O=(r,t,n,i)=>{if(!t){var s=1/0;for(l=0;l<e.length;l++){for(var[t,n,i]=e[l],a=!0,c=0;c<t.length;c++)(!1&i||s>=i)&&Object.keys(o.O).every((e=>o.O[e](t[c])))?t.splice(c--,1):(a=!1,i<s&&(s=i));if(a){e.splice(l--,1);var d=n();void 0!==d&&(r=d)}}return r}i=i||0;for(var l=e.length;l>0&&e[l-1][2]>i;l--)e[l]=e[l-1];e[l]=[t,n,i]},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={580:0,540:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var n,i,[s,a,c]=t,d=0;if(s.some((r=>0!==e[r]))){for(n in a)o.o(a,n)&&(o.m[n]=a[n]);if(c)var l=c(o)}for(r&&r(t);d<s.length;d++)i=s[d],o.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return o.O(l)},t=self.webpackChunk=self.webpackChunk||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),o.O(void 0,[540],(()=>o(144)));var n=o.O(void 0,[540],(()=>o(796)));n=o.O(n)})();
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-helper.git"
|
||||
}
|
||||
],
|
||||
"name": "hostinger/hostinger-wp-menu-manager",
|
||||
"description": "Package for managing Hostinger WordPress menus and pages.",
|
||||
"license": "proprietary",
|
||||
"type": "library",
|
||||
"version": "1.2.11",
|
||||
"require": {
|
||||
"hostinger/hostinger-wp-helper": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3.0",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"yoast/phpunit-polyfills": "^2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\WpMenuManager\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hostinger\\WpMenuManager\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Arabic\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:59+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: ar\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100 >= 3 "
|
||||
"&& n%100<=10 ? 3 : n%100 >= 11 && n%100<=99 ? 4 : 5;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "الإجراء المطلوب:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "الإضافات المتأثرة:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "تنبيه! تم اكتشاف ملحقات قديمة"
|
||||
|
||||
#: templates/menu.php:83
|
||||
#, fuzzy
|
||||
msgid "Go to hPanel"
|
||||
msgstr "انتقل إلى hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
#, fuzzy
|
||||
msgid "Hostinger"
|
||||
msgstr "هوستنجر"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "الإضافات القديمة:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "تحديث المكونات الإضافية"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"يحتوي موقعك الإلكتروني على بعض الإضافات القديمة التي قد تمنع الميزات الجديدة "
|
||||
"من العمل بشكل صحيح."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: German\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:59+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: de_DE\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Aktion erforderlich:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Betroffene Plugins:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Achtung! Veraltete Plugins entdeckt"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Zum hPanel gehen"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Veraltete Plugins:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Plugins aktualisieren"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Deine Website hat einige veraltete Plugins, die verhindern können, dass neue "
|
||||
"Funktionen richtig funktionieren."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Spanish (Spain)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:59+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: es_ES\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Acción requerida:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Plugins afectados:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Atención Plugins obsoletos detectados"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Ir a hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Plugins obsoletos:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Actualizar plugins"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Su sitio web tiene algunos plugins obsoletos que podrían impedir que las "
|
||||
"nuevas funciones funcionen correctamente."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: French (France)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:59+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: fr_FR\n"
|
||||
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Action requise :"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Plugins concernés :"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Attention ! Plugins obsolètes détectés"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Accédez au hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Plugins obsolètes :"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Mise à jour des plugins"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Votre site web contient des plugins obsolètes qui peuvent empêcher les "
|
||||
"nouvelles fonctionnalités de fonctionner correctement."
|
||||
Binary file not shown.
@@ -0,0 +1,50 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Hindi\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:58+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: hi_IN\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
msgid "Action Required:"
|
||||
msgstr ""
|
||||
|
||||
#: Menus.php:228
|
||||
msgid "Affected plugins:"
|
||||
msgstr ""
|
||||
|
||||
#: Menus.php:208
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr ""
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "hPanel पर जाएं"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
msgid "Outdated plugins:"
|
||||
msgstr ""
|
||||
|
||||
#: Menus.php:237
|
||||
msgid "Update plugins"
|
||||
msgstr ""
|
||||
|
||||
#: Menus.php:211
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Indonesian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:59+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: id_ID\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Tindakan yang diperlukan:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Plugin yang terpengaruh:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Perhatian! Plugin Kedaluwarsa Terdeteksi"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Buka hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Plugin yang sudah ketinggalan zaman:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Perbarui plugin"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Situs web Anda memiliki beberapa plugin usang yang mungkin menghalangi fitur-"
|
||||
"fitur baru untuk bekerja dengan baik."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Italian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:58+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: it_IT\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Azione richiesta:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Plugin interessati:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Attenzione! Rilevati plugin obsoleti"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Vai su hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Plugin obsoleti:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Aggiornare i plugin"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Il vostro sito web ha alcuni plugin obsoleti che potrebbero impedire il "
|
||||
"corretto funzionamento di nuove funzionalità."
|
||||
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Gabriele Motuzaite\n"
|
||||
"Language-Team: Lithuanian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:59+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: lt_LT\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 "
|
||||
"&&(n%100<10||n%100 >= 20)? 1 : 2);\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Reikalingi veiksmai:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Paveikti įskiepiai:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Dėmesio! Aptikti pasenę įskiepiai"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Eiti į hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Pasenę įskiepiai:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Atnaujinti įskiepius"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Jūsų svetainėje yra pasenusių įskiepių, kurie gali trukdyti tinkamai veikti "
|
||||
"naujoms funkcijoms."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Dutch\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:58+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: nl_NL\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Vereiste actie:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Betreffende plugins:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Attentie! Verouderde plugins gedetecteerd"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Ga naar hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Verouderde plugins:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Plugins bijwerken"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Je website heeft een aantal verouderde plugins waardoor nieuwe functies "
|
||||
"mogelijk niet goed werken."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Portuguese (Brazil)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:57+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: pt_BR\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Ação necessária:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Plugins afetados:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Atenção! Detectados plug-ins desatualizados"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Ir para o hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Plugins desatualizados:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Atualizar plug-ins"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Seu site tem alguns plug-ins desatualizados que podem impedir que novos "
|
||||
"recursos funcionem corretamente."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Portuguese (Portugal)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 11:00+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: pt_PT\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Ação necessária:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Plugins afectados:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Atenção! Detectados plugins desactualizados"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Aceder ao hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Plugins desactualizados:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Atualizar plugins"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"O seu sítio Web tem alguns plug-ins desactualizados que podem impedir que as "
|
||||
"novas funcionalidades funcionem corretamente."
|
||||
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Turkish\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 11:00+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: tr_TR\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Yapılması Gerekenler:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Etkilenen eklentiler:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Dikkat! Güncel Olmayan Eklentiler Tespit Edildi"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "HPanel'e git"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Eski eklentiler:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Eklentileri güncelleyin"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"Web sitenizde yeni özelliklerin düzgün çalışmasını engelleyebilecek bazı "
|
||||
"eski eklentiler var."
|
||||
Binary file not shown.
@@ -0,0 +1,59 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Julia\n"
|
||||
"Language-Team: Ukrainian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 10:58+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: uk\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 && "
|
||||
"n%10<=4 &&(n%100<10||n%100 >= 20)? 1 : 2);\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "Потрібні дії:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "Постраждалі плагіни:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "Увага! Виявлено застарілі плагіни"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "Перейти до hPanel"
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "Застарілі плагіни:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "Оновлення плагінів"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr ""
|
||||
"На вашому веб-сайті встановлені застарілі плагіни, які можуть перешкоджати "
|
||||
"належній роботі нових функцій."
|
||||
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Menu management package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Zhou Yu\n"
|
||||
"Language-Team: Chinese (China)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-04-30T07:45:18+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 11:00+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-menu-package\n"
|
||||
"Language: zh_CN\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid "Action Required:"
|
||||
msgstr "需要采取的行动:"
|
||||
|
||||
#: Menus.php:228
|
||||
#, fuzzy
|
||||
msgid "Affected plugins:"
|
||||
msgstr "受影响的插件:"
|
||||
|
||||
#: Menus.php:208
|
||||
#, fuzzy
|
||||
msgid "Attention! Outdated Plugins Detected"
|
||||
msgstr "请注意!检测到过期插件"
|
||||
|
||||
#: templates/menu.php:83
|
||||
msgid "Go to hPanel"
|
||||
msgstr "转到 hPanel "
|
||||
|
||||
#: Menus.php:58 Menus.php:104 Menus.php:105
|
||||
msgid "Hostinger"
|
||||
msgstr "Hostinger"
|
||||
|
||||
#: Menus.php:220
|
||||
#, fuzzy
|
||||
msgid "Outdated plugins:"
|
||||
msgstr "过时的插件:"
|
||||
|
||||
#: Menus.php:237
|
||||
#, fuzzy
|
||||
msgid "Update plugins"
|
||||
msgstr "更新插件"
|
||||
|
||||
#: Menus.php:211
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"Your website has some outdated plugins that might prevent new features from "
|
||||
"working properly."
|
||||
msgstr "您的网站有一些过时的插件,可能会妨碍新功能的正常运行。"
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpMenuManager;
|
||||
|
||||
use Hostinger\WpMenuManager\Menus;
|
||||
use Hostinger\WpHelper\Utils;
|
||||
|
||||
class Assets
|
||||
{
|
||||
/**
|
||||
* @var Manager
|
||||
*/
|
||||
private Manager $manager;
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void
|
||||
{
|
||||
if (!$this->manager->checkCompatibility()) {
|
||||
add_action('admin_enqueue_scripts', [$this, 'enqueueAdminAssets']);
|
||||
add_action('admin_head', [$this, 'addMenuHidingCss']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Manager $manager
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setManager(Manager $manager): void
|
||||
{
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function enqueueAdminAssets(): void
|
||||
{
|
||||
if ($this->isHostingerMenuPage()) {
|
||||
wp_enqueue_script(
|
||||
'hostinger_menu_scripts',
|
||||
$this->manager->getPluginInfo() . '/vendor/hostinger/hostinger-wp-menu-manager/assets/js/menus.min.js',
|
||||
[
|
||||
'jquery',
|
||||
],
|
||||
'1.1.4',
|
||||
false
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'hostinger_menu_styles',
|
||||
$this->manager->getPluginInfo()
|
||||
. '/vendor/hostinger/hostinger-wp-menu-manager/assets/css/style.min.css',
|
||||
[],
|
||||
'1.1.4'
|
||||
);
|
||||
|
||||
//Hide notices and badges in Hostinger menu pages.
|
||||
$hide_notices = '.notice { display: none !important; } .hostinger-notice { display: block !important; }';
|
||||
wp_add_inline_style('hostinger_menu_styles', $hide_notices);
|
||||
|
||||
if (Utils::isPluginActive('wpforms')) {
|
||||
$hide_wp_forms_counter = '.wp-admin #wpadminbar .wpforms-menu-notification-counter { display: none !important; }';
|
||||
wp_add_inline_style('hostinger_menu_styles', $hide_wp_forms_counter);
|
||||
}
|
||||
if (Utils::isPluginActive('googleanalytics')) {
|
||||
$hide_monsterinsights_notification = '.wp-admin .monsterinsights-menu-notification-indicator { display: none !important; }';
|
||||
wp_add_inline_style('hostinger_menu_styles', $hide_monsterinsights_notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function addMenuHidingCss(): void
|
||||
{
|
||||
// These CSS rules should be loaded on every page in WordPress admin.
|
||||
?>
|
||||
<style type="text/css">
|
||||
body.hostinger-hide-main-menu-item #toplevel_page_hostinger .wp-submenu > .wp-first-item {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-hostinger_admin_bar .ab-item {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#wpadminbar #wp-admin-bar-hostinger_admin_bar .ab-sub-wrapper .ab-item svg {
|
||||
fill: #9ca1a7;
|
||||
margin-left: 3px;
|
||||
max-height: 18px;
|
||||
}
|
||||
|
||||
body.hostinger-hide-all-menu-items #toplevel_page_hostinger .wp-submenu {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
body.hostinger-hide-all-menu-items .hsr-onboarding-navbar__wrapper {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
body.hostinger-hide-all-menu-items .hsr-onboarding-navbar .hsr-mobile-menu-icon,
|
||||
body.hostinger-hide-all-menu-items .hsr-onboarding-navbar .hsr-wrapper__list {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function isHostingerMenuPage(): bool
|
||||
{
|
||||
$pages = [
|
||||
'wp-admin/admin.php?page=' . Menus::MENU_SLUG
|
||||
];
|
||||
|
||||
$subpages = Menus::getMenuSubpages();
|
||||
|
||||
foreach ($subpages as $page) {
|
||||
if (isset($page['menu_slug'])) {
|
||||
$pages[] = 'wp-admin/admin.php?page=' . $page['menu_slug'];
|
||||
}
|
||||
}
|
||||
|
||||
$utils = new Utils();
|
||||
|
||||
foreach ($pages as $page) {
|
||||
if ($utils->isThisPage($page)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpMenuManager;
|
||||
|
||||
class Manager
|
||||
{
|
||||
/**
|
||||
* @var Manager instance.
|
||||
*/
|
||||
private static ?Manager $instance = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private array $objects = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public array $old_plugins = [
|
||||
[
|
||||
'name' => 'Hostinger',
|
||||
'slug' => 'hostinger',
|
||||
'version' => '3.0.0',
|
||||
],
|
||||
[
|
||||
'name' => 'Hostinger Affiliate Plugin',
|
||||
'slug' => 'hostinger-affiliate-plugin',
|
||||
'version' => '2.0.0',
|
||||
],
|
||||
[
|
||||
'name' => 'Hostinger AI Assistant',
|
||||
'slug' => 'hostinger-ai-assistant',
|
||||
'version' => '2.0.0',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public array $outdated_plugins = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public array $affected_plugins = [
|
||||
'hostinger' => 'Hostinger Tools',
|
||||
'hostinger-affiliate-plugin' => 'Hostinger Affiliate Connector',
|
||||
'hostinger-ai-assistant' => 'Hostinger AI',
|
||||
'hostinger-easy-onboarding' => 'Hostinger Easy Onboarding',
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow only one instance of class
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function getInstance(): self
|
||||
{
|
||||
if (null === self::$instance) {
|
||||
self::$instance = new self();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string[]
|
||||
*/
|
||||
public function getOutdatedPlugins(): array
|
||||
{
|
||||
return $this->outdated_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getAffectedActivePlugins(): array
|
||||
{
|
||||
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||
|
||||
$plugins = [];
|
||||
|
||||
if (empty($this->getAffectedPlugins())) {
|
||||
return [];
|
||||
}
|
||||
|
||||
foreach ($this->getAffectedPlugins() as $plugin_slug => $plugin_name) {
|
||||
if (\is_plugin_active($plugin_slug . DIRECTORY_SEPARATOR . $plugin_slug . '.php')) {
|
||||
$plugins[$plugin_slug] = $plugin_name;
|
||||
}
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string[]
|
||||
*/
|
||||
public function getAffectedPlugins(): array
|
||||
{
|
||||
return $this->affected_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function boot(): bool
|
||||
{
|
||||
// Locale.
|
||||
$this->loadTextDomain();
|
||||
|
||||
// Modules.
|
||||
$this->registerModules();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function registerModules(): void
|
||||
{
|
||||
// Assets.
|
||||
$this->objects['assets'] = new Assets();
|
||||
|
||||
// Menus.
|
||||
$this->objects['menus'] = new Menus();
|
||||
|
||||
$this->addContainer();
|
||||
|
||||
// Init after container is added.
|
||||
$this->objects['assets']->init();
|
||||
$this->objects['menus']->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function addContainer(): bool
|
||||
{
|
||||
if (empty($this->objects)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->objects as $object) {
|
||||
if (property_exists($object, 'manager')) {
|
||||
$object->setManager($this);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPluginInfo(): string
|
||||
{
|
||||
$plugin_url = '';
|
||||
|
||||
$plugins = get_plugins();
|
||||
foreach ($plugins as $plugin_path => $plugin_info) {
|
||||
if (str_contains(__FILE__, 'plugins/' . dirname($plugin_path) . '/')) {
|
||||
$plugin_dir = dirname($plugin_path);
|
||||
|
||||
return plugins_url($plugin_dir);
|
||||
}
|
||||
}
|
||||
|
||||
return $plugin_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function loadTextDomain(): void
|
||||
{
|
||||
load_plugin_textdomain(
|
||||
'hostinger-wp-menu-package',
|
||||
false,
|
||||
dirname(dirname(plugin_basename(__FILE__))) . '/languages/'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function checkCompatibility(): bool
|
||||
{
|
||||
$outdated_plugins = false;
|
||||
|
||||
if (empty($this->old_plugins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($this->old_plugins as $plugin_data) {
|
||||
if ($this->checkOutdatedPluginVersion($plugin_data['slug'], $plugin_data['version'])) {
|
||||
$outdated_plugins = true;
|
||||
$this->outdated_plugins[$plugin_data['slug']] = $plugin_data['name'];
|
||||
}
|
||||
}
|
||||
|
||||
return $outdated_plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* If main hostinger plugin is outdated
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
public function maybeDoCompatibilityRedirect(): bool
|
||||
{
|
||||
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||
|
||||
$plugin_name = 'hostinger';
|
||||
$current_uri = !empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
|
||||
|
||||
$plugin = current(array_filter($this->old_plugins, fn($p) => $p['slug'] === $plugin_name));
|
||||
|
||||
if (str_contains($current_uri, '/wp-admin/admin.php?page=hostinger')) {
|
||||
if (!$this->checkOutdatedPluginVersion($plugin['slug'], $plugin['version'])) {
|
||||
wp_redirect(get_admin_url());
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $plugin_name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getPluginVersion($plugin_name): string
|
||||
{
|
||||
$version = get_file_data(WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_name . DIRECTORY_SEPARATOR . $plugin_name . '.php', array('Version'), 'plugin');
|
||||
|
||||
if (empty($version[0])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $version[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $plugin_name
|
||||
* @param $compare_version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function checkOutdatedPluginVersion($plugin_name, $compare_version): bool
|
||||
{
|
||||
include_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
||||
|
||||
if (!\is_plugin_active($plugin_name . DIRECTORY_SEPARATOR . $plugin_name . '.php')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$version = $this->getPluginVersion($plugin_name);
|
||||
|
||||
if (empty($version)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return version_compare($version, $compare_version, '<');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
|
||||
namespace Hostinger\WpMenuManager;
|
||||
|
||||
use WP_Admin_Bar;
|
||||
|
||||
class Menus
|
||||
{
|
||||
/**
|
||||
* @var Manager
|
||||
*/
|
||||
private Manager $manager;
|
||||
|
||||
public const MENU_SLUG = 'hostinger';
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function init(): void
|
||||
{
|
||||
if (!$this->manager->checkCompatibility()) {
|
||||
add_action('admin_bar_menu', [$this, 'modifyAdminBar'], 999);
|
||||
add_filter('admin_body_class', [$this, 'addMenuClass']);
|
||||
add_action('admin_menu', [$this, 'registerAdminMenu']);
|
||||
} else {
|
||||
$this->manager->maybeDoCompatibilityRedirect();
|
||||
add_action('admin_notices', [$this, 'compatibilityMessage'], 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Manager $manager
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setManager(Manager $manager): void
|
||||
{
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WP_Admin_Bar $bar
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function modifyAdminBar(WP_Admin_Bar $bar): void
|
||||
{
|
||||
if (!is_user_logged_in()){
|
||||
return;
|
||||
}
|
||||
|
||||
$menu_items = apply_filters('hostinger_admin_menu_bar_items', []);
|
||||
|
||||
if (!empty($menu_items)) {
|
||||
$hostinger_icon = '<svg width="28" height="29" viewBox="0 0 28 29" fill="#9ca1a7" style="margin-right: 6px; max-height: 22px; float: left; margin-top: 4px;" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.8669 13.6096V0.500465L8.48322 4.02842V9.93472L17.2419 9.93895L23.9655 13.6096H1.8669ZM19.033 8.85388V0.5L25.8277 3.94018V12.801L19.033 8.85388ZM19.033 24.8765V19.0211L10.2067 19.015C10.215 19.054 3.37149 15.2857 3.37149 15.2857L25.8277 15.3911V28.5L19.033 24.8765ZM1.86667 24.8765L1.8669 16.31L8.48322 20.1637V28.3164L1.86667 24.8765Z" fill="" />
|
||||
</svg>';
|
||||
|
||||
$bar->add_menu([
|
||||
'id' => 'hostinger_admin_bar',
|
||||
'parent' => null,
|
||||
'group' => null,
|
||||
'title' => $hostinger_icon . esc_html__('Hostinger', 'hostinger-wp-menu-package'),
|
||||
]);
|
||||
|
||||
foreach ($menu_items as $menu_item) {
|
||||
$menu_item_data = [
|
||||
'id' => $menu_item['id'],
|
||||
'parent' => 'hostinger_admin_bar',
|
||||
'group' => null,
|
||||
'title' => $menu_item['title'],
|
||||
'href' => $menu_item['href'],
|
||||
];
|
||||
|
||||
if( isset( $menu_item['meta'] ) ){
|
||||
$menu_item_data['meta'] = $menu_item['meta'];
|
||||
}
|
||||
|
||||
$bar->add_menu($menu_item_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $classes
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function addMenuClass(mixed $classes): mixed
|
||||
{
|
||||
|
||||
if (!is_string( $classes)) return $classes;
|
||||
|
||||
$classes .= ' hostinger-hide-main-menu-item';
|
||||
|
||||
if (!empty(self::isSubmenuItemsHidden())) {
|
||||
$classes .= ' hostinger-hide-all-menu-items';
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function registerAdminMenu(): bool
|
||||
{
|
||||
$submenus = self::getMenuSubpages();
|
||||
|
||||
if (empty($submenus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$icon = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjEiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyMSAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0wLjAwMDE5OTY1MyAxMS4yMzY4VjAuMDAwMzk4MjM1TDUuNjcxMzMgMy4wMjQzNlY4LjA4NjkxTDEzLjE3ODggOC4wOTA1M0wxOC45NDE5IDExLjIzNjhIMC4wMDAxOTk2NTNaTTE0LjcxNCA3LjE2MDQ3VjBMMjAuNTM4IDIuOTQ4NzJWMTAuNTQzN0wxNC43MTQgNy4xNjA0N1pNMTQuNzE0IDIwLjg5NDJWMTUuODc1M0w3LjE0ODYyIDE1Ljg3QzcuMTU1NjggMTUuOTAzNCAxLjI4OTg0IDEyLjY3MzUgMS4yODk4NCAxMi42NzM1TDIwLjUzOCAxMi43NjM4VjI0TDE0LjcxNCAyMC44OTQyWk0wIDIwLjg5NDFMMC4wMDAyMDE3NjkgMTMuNTUxNEw1LjY3MTMzIDE2Ljg1NDZWMjMuODQyN0wwIDIwLjg5NDFaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K';
|
||||
|
||||
add_menu_page(
|
||||
__('Hostinger', 'hostinger-wp-menu-package'),
|
||||
__('Hostinger', 'hostinger-wp-menu-package'),
|
||||
'edit_posts',
|
||||
self::MENU_SLUG,
|
||||
[$this, 'render'],
|
||||
$icon,
|
||||
1
|
||||
);
|
||||
|
||||
$this->registerSubMenus();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function render(): void
|
||||
{
|
||||
if ($this->hasLoadedMainContent() && !empty(self::isSubmenuItemsHidden())) {
|
||||
do_action('hostinger_main_menu_content');
|
||||
} else {
|
||||
$submenus = self::getMenuSubpages();
|
||||
|
||||
if (!empty($submenus)) {
|
||||
call_user_func($submenus[0]['callback']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public static function renderMenuNavigation(): string
|
||||
{
|
||||
ob_start();
|
||||
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'menu.php';
|
||||
|
||||
$content = ob_get_contents();
|
||||
|
||||
ob_end_clean();
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function getMenuSubpages(): array
|
||||
{
|
||||
return apply_filters('hostinger_menu_subpages', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isSubmenuItemsHidden(): bool
|
||||
{
|
||||
return !empty(get_option('hostinger_hide_subpages'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function hasLoadedMainContent(): bool
|
||||
{
|
||||
return has_action('hostinger_main_menu_content');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function registerSubMenus(): bool
|
||||
{
|
||||
$submenus = self::getMenuSubpages();
|
||||
|
||||
if (empty($submenus)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($submenus as $submenu) {
|
||||
add_submenu_page(
|
||||
self::MENU_SLUG,
|
||||
$submenu['page_title'],
|
||||
$submenu['menu_title'],
|
||||
$submenu['capability'],
|
||||
$submenu['menu_slug'],
|
||||
$submenu['callback'],
|
||||
$submenu['menu_order']
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function compatibilityMessage(): void
|
||||
{
|
||||
?>
|
||||
<div class="notice notice-error is-dismissible hts-theme-settings">
|
||||
<p>
|
||||
<strong><?php echo __('Attention! Outdated Plugins Detected', 'hostinger-wp-menu-package') ?></strong>
|
||||
</p>
|
||||
<p>
|
||||
<strong><?php echo __('Action Required:', 'hostinger-wp-menu-package') ?></strong> <?php echo __('Your website has some outdated plugins that might prevent new features from working properly.', 'hostinger-wp-menu-package') ?>
|
||||
</p>
|
||||
|
||||
<ul style="list-style: circle;margin-left: 18px;">
|
||||
<?php
|
||||
|
||||
if (!empty($this->manager->getOutdatedPlugins())) {
|
||||
?>
|
||||
<li>
|
||||
<p><?php echo __('Outdated plugins:', 'hostinger-wp-menu-package') ?> <?php echo implode(', ', $this->manager->getOutdatedPlugins()); ?></p>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
if (!empty($this->manager->getAffectedActivePlugins())) {
|
||||
?>
|
||||
<li>
|
||||
<p><?php echo __('Affected plugins:', 'hostinger-wp-menu-package') ?> <?php echo implode(', ', $this->manager->getAffectedActivePlugins()); ?></p>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
<p>
|
||||
<a href="/wp-admin/update-core.php" class="button-primary">
|
||||
<?php echo __('Update plugins', 'hostinger-wp-menu-package') ?>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
use Hostinger\WpHelper\Utils;
|
||||
|
||||
$submenus = self::getMenuSubpages();
|
||||
|
||||
?>
|
||||
<div class="hsr-overlay"></div>
|
||||
<div class="hsr-onboarding-navbar">
|
||||
<div class="hsr-mobile-sidebar">
|
||||
<div class="hsr-close">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.99961 8.04961L1.74961 13.2996C1.59961 13.4496 1.42461 13.5246 1.22461 13.5246C1.02461 13.5246 0.849609 13.4496 0.699609 13.2996C0.549609 13.1496 0.474609 12.9746 0.474609 12.7746C0.474609 12.5746 0.549609 12.3996 0.699609 12.2496L5.94961 6.99961L0.699609 1.74961C0.549609 1.59961 0.474609 1.42461 0.474609 1.22461C0.474609 1.02461 0.549609 0.849609 0.699609 0.699609C0.849609 0.549609 1.02461 0.474609 1.22461 0.474609C1.42461 0.474609 1.59961 0.549609 1.74961 0.699609L6.99961 5.94961L12.2496 0.699609C12.3996 0.549609 12.5746 0.474609 12.7746 0.474609C12.9746 0.474609 13.1496 0.549609 13.2996 0.699609C13.4496 0.849609 13.5246 1.02461 13.5246 1.22461C13.5246 1.42461 13.4496 1.59961 13.2996 1.74961L8.04961 6.99961L13.2996 12.2496C13.4496 12.3996 13.5246 12.5746 13.5246 12.7746C13.5246 12.9746 13.4496 13.1496 13.2996 13.2996C13.1496 13.4496 12.9746 13.5246 12.7746 13.5246C12.5746 13.5246 12.3996 13.4496 12.2496 13.2996L6.99961 8.04961Z"
|
||||
fill="#673DE6"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="hsr-wrapper"></div>
|
||||
</div>
|
||||
<div class="hsr-onboarding-navbar__wrapper">
|
||||
<div class="hsr-logo">
|
||||
<svg class="hsr-mobile-logo" width="24" height="24" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.00025 14.046V0.000497794L9.08916 3.78046V10.1086L18.4735 10.1132L25.6774 14.046H2.00025ZM20.3925 8.95058V0L27.6725 3.6859V13.1797L20.3925 8.95058ZM20.3924 26.1177V19.8441L10.9358 19.8375C10.9446 19.8793 3.6123 15.8418 3.6123 15.8418L27.6725 15.9547V30L20.3924 26.1177ZM2 26.1177L2.00025 16.9393L9.08916 21.0683V29.8033L2 26.1177Z" fill="#1D1E20"/>
|
||||
</svg>
|
||||
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.00025 14.046V0.000497794L9.08916 3.78046V10.1086L18.4735 10.1132L25.6774 14.046H2.00025ZM20.3925 8.95058V0L27.6725 3.6859V13.1797L20.3925 8.95058ZM20.3924 26.1177V19.8441L10.9358 19.8375C10.9446 19.8793 3.6123 15.8418 3.6123 15.8418L27.6725 15.9547V30L20.3924 26.1177ZM2 26.1177L2.00025 16.9393L9.08916 21.0683V29.8033L2 26.1177Z" fill="#1D1E20"/>
|
||||
</svg>
|
||||
</div>
|
||||
<svg class="hsr-mobile-menu-icon" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M3.75 18C3.5375 18 3.35938 17.9277 3.21563 17.7831C3.07187 17.6385 3 17.4594 3 17.2456C3 17.0319 3.07187 16.8542 3.21563 16.7125C3.35938 16.5708 3.5375 16.5 3.75 16.5H20.25C20.4625 16.5 20.6406 16.5723 20.7844 16.7169C20.9281 16.8615 21 17.0406 21 17.2544C21 17.4681 20.9281 17.6458 20.7844 17.7875C20.6406 17.9292 20.4625 18 20.25 18H3.75ZM3.75 12.75C3.5375 12.75 3.35938 12.6777 3.21563 12.5331C3.07187 12.3885 3 12.2094 3 11.9956C3 11.7819 3.07187 11.6042 3.21563 11.4625C3.35938 11.3208 3.5375 11.25 3.75 11.25H20.25C20.4625 11.25 20.6406 11.3223 20.7844 11.4669C20.9281 11.6115 21 11.7906 21 12.0044C21 12.2181 20.9281 12.3958 20.7844 12.5375C20.6406 12.6792 20.4625 12.75 20.25 12.75H3.75ZM3.75 7.5C3.5375 7.5 3.35938 7.42771 3.21563 7.28313C3.07187 7.13853 3 6.95936 3 6.74563C3 6.53188 3.07187 6.35417 3.21563 6.2125C3.35938 6.07083 3.5375 6 3.75 6H20.25C20.4625 6 20.6406 6.07229 20.7844 6.21687C20.9281 6.36147 21 6.54064 21 6.75437C21 6.96812 20.9281 7.14583 20.7844 7.2875C20.6406 7.42917 20.4625 7.5 20.25 7.5H3.75Z"
|
||||
fill="#36344D"></path>
|
||||
</svg>
|
||||
<?php
|
||||
if (!empty($submenus)) { ?>
|
||||
<ul class="hsr-wrapper__list">
|
||||
<?php
|
||||
|
||||
foreach ($submenus as $index => $submenu) {
|
||||
$page = (isset($_GET['page'])) ? $_GET['page'] : '';
|
||||
|
||||
$is_active = ($page === $submenu['menu_slug'] || ($page === self::MENU_SLUG && $index === 0));
|
||||
|
||||
?>
|
||||
<li
|
||||
class="hsr-list__item <?php echo ($is_active) ? "hsr-active" : ""; ?>"
|
||||
>
|
||||
<a
|
||||
href="<?php echo menu_page_url($submenu['menu_slug'], false); ?>"
|
||||
class="<?php echo $submenu['menu_slug']; ?>"
|
||||
>
|
||||
<?php
|
||||
|
||||
echo $submenu['menu_title'];
|
||||
|
||||
?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
$utils = new Utils();
|
||||
$api_token = Utils::getApiToken();
|
||||
?>
|
||||
<div class="hsr-navbar-buttons">
|
||||
<?php if (get_site_url()) { ?>
|
||||
<div class="hts-preview-website">
|
||||
<a href="<?php echo esc_url(get_site_url()); ?>" target="_blank" rel="noopener">
|
||||
<?php echo esc_html__('Preview website', 'hostinger-wp-menu-package'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if (!empty($api_token)) { ?>
|
||||
<div class="hts-hpanel">
|
||||
<a href="<?php echo esc_url($utils->getHpanelDomainUrl()); ?>" target="_blank" rel="noopener">
|
||||
<?php echo esc_html__('Go to Hostinger', 'hostinger-wp-menu-package'); ?>
|
||||
</a>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 5.24609C2.5 3.72731 3.73122 2.49609 5.25 2.49609H6C6.41421 2.49609 6.75 2.83188 6.75 3.24609C6.75 3.66031 6.41421 3.99609 6 3.99609H5.25C4.55964 3.99609 4 4.55574 4 5.24609V10.6842C4 11.3745 4.55964 11.9342 5.25 11.9342H10.7508C11.4411 11.9342 12.0008 11.3745 12.0008 10.6842V9.99829C12.0008 9.58408 12.3366 9.24829 12.7508 9.24829C13.165 9.24829 13.5008 9.58408 13.5008 9.99829V10.6842C13.5008 12.203 12.2696 13.4342 10.7508 13.4342H5.25C3.73122 13.4342 2.5 12.203 2.5 10.6842V5.24609ZM12 5.05906L8.03033 9.02873C7.73744 9.32162 7.26256 9.32162 6.96967 9.02873C6.67678 8.73583 6.67678 8.26096 6.96967 7.96807L10.9393 3.9984L9 3.9984C8.58579 3.9984 8.25 3.66261 8.25 3.2484C8.25 2.83418 8.58579 2.4984 9 2.4984L12.25 2.4984C12.9404 2.4984 13.5 3.05804 13.5 3.7484V6.9984C13.5 7.41261 13.1642 7.7484 12.75 7.7484C12.3358 7.7484 12 7.41261 12 6.9984V5.05906Z" fill="#673DE6"/>
|
||||
</svg>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
@@ -0,0 +1,11 @@
|
||||
name: sca-scan
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master, main, staging]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
run-sca:
|
||||
uses: hostinger/sca-configs/.github/workflows/sca.yml@main
|
||||
secrets: inherit
|
||||
@@ -0,0 +1,5 @@
|
||||
/.idea/
|
||||
/vendor
|
||||
/node_modules
|
||||
.phpunit.result.cache
|
||||
hostinger-surveys-package.php
|
||||
@@ -0,0 +1,96 @@
|
||||
# WordPress Hostinger Surveys PHP package
|
||||
|
||||
Package for managing Hostinger WordPress surveys.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Usage](#usage)
|
||||
- [Support](#support)
|
||||
|
||||
## Installation
|
||||
|
||||
This is private package, adding it to composer is a bit different.
|
||||
|
||||
Add it to the composer.json:
|
||||
```sh
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-surveys.git"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
and:
|
||||
```sh
|
||||
"require": {
|
||||
"hostinger/hostinger-surveys": "main",
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
First thing boot up package in main plugin file:
|
||||
|
||||
```sh
|
||||
use Hostinger\Surveys\Loader;
|
||||
if( !function_exists('hostinger_load_surveys') ) {
|
||||
function hostinger_load_surveys(): void {
|
||||
$surveys = Loader::get_instance();
|
||||
$surveys->boot();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! has_action( 'plugins_loaded', 'hostinger_load_surveys' ) ) {
|
||||
add_action('plugins_loaded', 'hostinger_load_surveys');
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Then boot Surveys class with all surveys logic
|
||||
|
||||
```sh
|
||||
use Hostinger\Surveys\SurveyManager;
|
||||
if ( class_exists( SurveyManager::class ) ) {
|
||||
$surveys = new Surveys();
|
||||
$surveys->init();
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
And here is example of Surveys class
|
||||
|
||||
```sh
|
||||
<?php
|
||||
|
||||
namespace Hostinger\EasyOnboarding\Admin;
|
||||
|
||||
use Hostinger\Surveys\SurveyManager;
|
||||
|
||||
class Surveys {
|
||||
const CHATBOT_SURVEY_NAME = 'chatbot';
|
||||
const CHATBOT_SURVEY_SCORE_QUESTION = 'How would you rate our AI chatbot? (1-10)';
|
||||
const CHATBOT_SURVEY_COMMENT_QUESTION = 'How would you rate your experience with the Chatbot? (Comment)';
|
||||
const CHATBOT_SURVEY_LOCATION = 'wp-admin';
|
||||
const SURVEY_PRIORITY = 999;
|
||||
|
||||
public function init() {
|
||||
add_filter( 'hostinger_add_surveys', [ $this, 'createSurveys' ] );
|
||||
}
|
||||
|
||||
public function createSurveys( $surveys ) {
|
||||
$scoreQuestion = esc_html__( self::CHATBOT_SURVEY_SCORE_QUESTION, 'hostinger-easy-onboarding' );
|
||||
$commentQuestion = esc_html__( self::CHATBOT_SURVEY_COMMENT_QUESTION, 'hostinger-easy-onboarding' );
|
||||
$chatbotSurvey = SurveyManager::addSurvey( self::CHATBOT_SURVEY_NAME, $scoreQuestion, $commentQuestion, self::CHATBOT_SURVEY_LOCATION, self::SURVEY_PRIORITY );
|
||||
$surveys[] = $chatbotSurvey;
|
||||
|
||||
return $surveys;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Package initially was written by Martynas U. (martynas.umbraziunas@hostinger.com). You can ping him in Slack for support.
|
||||
@@ -0,0 +1 @@
|
||||
.hts-survey-wrapper{background:#fff;border:1px solid #dadce0;border-radius:4px 4px 0 0;bottom:0;box-shadow:0 0 12px rgba(29,30,32,.16);display:none;left:160px;margin-top:2rem;max-width:500px;padding:24px 32px;position:fixed}@media (max-width:960px){.hts-survey-wrapper{left:40px}}@media (max-width:780px){.hts-survey-wrapper{left:0}}.hts-survey-wrapper .close-btn{cursor:pointer;position:absolute;right:10px;top:10px}.hts-survey-wrapper .close-btn svg{height:20px;width:20px}@media (max-width:400px){.hts-survey-wrapper{padding:24px 15px}}@media (max-width:370px){.hts-survey-wrapper{padding:24px 10px}}.hts-survey-wrapper #hts-questionsLeft{color:#727586;display:none;font-size:14px;font-weight:400;line-height:24px}#hostinger-feedback-survey{direction:ltr}#hostinger-feedback-survey .sd-root-modern form textarea{border:1px solid #dadce0;border-radius:4px;color:#727586;padding:12px 16px;width:100%}#hostinger-feedback-survey .sd-root-modern form textarea:focus{border:1px solid #673de6}#hostinger-feedback-survey .sd-root-modern form .sd-question__header h5{font-size:19px;font-weight:700;letter-spacing:0;line-height:32px;margin-bottom:24px;margin-top:0;text-align:left}@media (max-width:450px){#hostinger-feedback-survey .sd-root-modern form .sd-question__header h5{font-size:16px;line-height:24px}}#hostinger-feedback-survey .sd-root-modern form .sd-btn{background:#673de6;border:none;border-radius:4px;color:#fff;cursor:pointer;flex-grow:0;font-weight:700;line-height:24px;margin:25px 0 0;padding:8px 24px;text-decoration:none}@media (max-width:450px){#hostinger-feedback-survey .sd-root-modern form .sd-btn{font-size:13px;padding:5px 15px}}#hostinger-feedback-survey .sd-root-modern form .sd-btn:hover{background:#5025d1}#hostinger-feedback-survey .sd-root-modern form .sd-action-bar{display:flex;justify-content:flex-end;margin:10px 0;position:relative}@media (max-width:450px){#hostinger-feedback-survey .sd-root-modern form .sd-action-bar{margin:5px 0}}#hostinger-feedback-survey .sd-root-modern form .sd-action-bar #sv-nav-prev{left:0;position:absolute;top:0}#hostinger-feedback-survey .sd-root-modern form .sd-rating{display:flex;justify-content:space-between;position:relative}#hostinger-feedback-survey .sd-root-modern form .sd-rating fieldset{align-items:center;display:flex;justify-content:space-between;width:100%}#hostinger-feedback-survey .sd-root-modern form .sd-rating .sd-rating__item--selected{background-color:#ebe4ff;border:1px solid #673de6}#hostinger-feedback-survey .sd-root-modern form .sd-rating .sd-rating__min-text{bottom:-25px;left:0;position:absolute}#hostinger-feedback-survey .sd-root-modern form .sd-rating .sd-rating__item-text{color:#727586;font-size:14px;font-weight:400;line-height:24px}#hostinger-feedback-survey .sd-root-modern form .sd-rating .sd-rating__max-text{bottom:-25px;position:absolute;right:0}#hostinger-feedback-survey .sd-root-modern form .sd-rating__item{align-items:center;border:1px solid #dadce0;border-radius:100%;color:#673de6;cursor:pointer;display:flex;height:30px;justify-content:center;margin:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:30px}#hostinger-feedback-survey .sd-root-modern form .sd-rating__item:hover{background-color:#ebe4ff;border:1px solid #673de6}#hostinger-feedback-survey .sd-root-modern form .sd-rating__item .sd-rating__item-text,#hostinger-feedback-survey .sd-root-modern form .sd-rating__item input{margin:0}#hostinger-feedback-survey .sd-root-modern form .sv-visuallyhidden[type=radio]{opacity:0;pointer-events:none;position:absolute}#hostinger-feedback-survey .sd-root-modern form .sd-rating__item-text{margin-left:5px}#hostinger-feedback-survey .sd-root-modern form .sd-remaining-character-counter{color:#727586;font-size:14px;font-weight:400;line-height:24px}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "hostinger/hostinger-wp-surveys",
|
||||
"description": "A PHP package with surveys for WordPress plugins",
|
||||
"license": "proprietary",
|
||||
"type": "library",
|
||||
"version": "1.1.7",
|
||||
"require": {
|
||||
"php": ">=8.0",
|
||||
"hostinger/hostinger-wp-helper": "dev-main"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3.0",
|
||||
"brain/monkey": "^2.6",
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"10up/wp_mock": "^1.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "git@github.com:hostinger/hostinger-wp-helper.git"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Surveys\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hostinger\\Surveys\\Tests\\": "tests/phpunit"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Mohamed Doukkali\n"
|
||||
"Language-Team: Arabic\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-13 09:37+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: ar\n"
|
||||
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100 >= 3 "
|
||||
"&& n%100<=10 ? 3 : n%100 >= 11 && n%100<=99 ? 4 : 5;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "التالي"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "السابق"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "إرسال"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "شكرًا لك على إكمال الاستبيان!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "الجواب مطلوب"
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "سيئ"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "ممتاز"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "السؤال"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "من"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: German\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-16 10:55+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: de_DE\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Weiter"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Vorherige"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Abschicken"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Vielen Dank für die Teilnahme an der Umfrage!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Antwort erforderlich."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Schlecht"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Ausgezeichnet"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Frage"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "von"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Spanish (Spain)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-15 18:05+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: es_ES\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Siguiente"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Anterior"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Enviar"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Gracias por completar la encuesta."
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Respuesta requerida."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Deficiente"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Excelente"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Pregunta"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "de"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: French (France)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-13 11:11+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: fr_FR\n"
|
||||
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Suivant"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Précédent"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Soumettre"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Merci d'avoir répondu au questionnaire !"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Réponse requise."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Faible"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Excellent"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Question"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "de "
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Hindi\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-13 09:29+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: hi_IN\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "अगला"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "पिछला"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "सबमिट करें"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "सर्वे पूरा करने के लिए धन्यवाद!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "प्रतिक्रिया आवश्यक है"
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "खराब"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "बहुत अच्छे"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "सवाल"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "का"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Indonesian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-16 03:37+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: id_ID\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Selanjutnya"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Sebelumnya"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Kirim"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Terima kasih telah mengisi survei ini!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Wajib diisi."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Tidak puas"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Sangat puas"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Pertanyaan"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "dari"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Italian\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-13 09:58+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: it_IT\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Successivo"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Precedente"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Invia"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Grazie per aver completato il sondaggio!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "È richiesta una risposta."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Scarso"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Eccellente"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Domanda"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "di"
|
||||
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Milda\n"
|
||||
"Language-Team: Lietuvių kalba\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-16 07:15+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: lt_LT\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10 >= 2 "
|
||||
"&&(n%100<10||n%100 >= 20)? 1 : 2);\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Toliau"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Ankstesnis"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Pateikti"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Dėkojame, kad užpildei apklausą!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Atsakyti privaloma."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Prastai"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Puikiai"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Klausimas"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "iš"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Dutch\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 02:45+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: nl_NL\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Volgende"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Vorige"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Indienen"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Bedankt voor het invullen van de enquête!"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Reactie vereist"
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Slecht"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Uitstekend"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Vraag"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "van"
|
||||
Binary file not shown.
@@ -0,0 +1,53 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Portuguese (Brazil)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-15 14:57+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: pt_BR\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Próximo"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Anterior"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Enviar"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr ""
|
||||
"Obrigado por completar a pesquisa!\n"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Resposta obrigátoria."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Ruim"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Excelente"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Pergunta"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "de"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Português\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 04:09+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: pt_PT\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Próximo"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Anterior"
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Submeter"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Obrigado por completar o inquérito !"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Resposta obrigatória."
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Mau"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Excelente"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Questão"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "de"
|
||||
Binary file not shown.
@@ -0,0 +1,52 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Hostinger WordPress Surveys package\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Türkçe\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"POT-Creation-Date: 2024-05-13T05:29:33+00:00\n"
|
||||
"PO-Revision-Date: 2024-05-14 12:47+0000\n"
|
||||
"X-Generator: Loco https://localise.biz/\n"
|
||||
"X-Domain: hostinger-wp-surveys\n"
|
||||
"Language: tr_TR\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Loco-Version: 2.6.7; wp-6.4.4"
|
||||
|
||||
#: src/SurveyManager.php:189
|
||||
msgid "Excellent"
|
||||
msgstr "Harika"
|
||||
|
||||
#: src/SurveyManager.php:166
|
||||
msgid "Next"
|
||||
msgstr "Sonraki"
|
||||
|
||||
#: src/SurveyManager.php:243
|
||||
msgid "of "
|
||||
msgstr "-"
|
||||
|
||||
#: src/SurveyManager.php:188
|
||||
msgid "Poor"
|
||||
msgstr "Kötü"
|
||||
|
||||
#: src/SurveyManager.php:167
|
||||
msgid "Previous"
|
||||
msgstr "Önceki"
|
||||
|
||||
#: src/SurveyManager.php:237
|
||||
msgid "Question"
|
||||
msgstr "Soru"
|
||||
|
||||
#: src/SurveyManager.php:178
|
||||
msgid "Response required."
|
||||
msgstr "Yanıt gerekiyor."
|
||||
|
||||
#: src/SurveyManager.php:168
|
||||
msgid "Submit"
|
||||
msgstr "Gönder"
|
||||
|
||||
#: src/SurveyManager.php:169
|
||||
msgid "Thank you for completing the survey !"
|
||||
msgstr "Anketi tamamladığınız için teşekkür ederiz!"
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user