Browse Source

* Fixed namespace in function_exists

Visman 5 years ago
parent
commit
c196267568

+ 2 - 2
app/Core/Cache/FileCache.php

@@ -161,9 +161,9 @@ class FileCache implements ProviderCacheInterface
      */
     protected function invalidate($file)
     {
-        if (\function_exists('opcache_invalidate')) {
+        if (\function_exists('\\opcache_invalidate')) {
             \opcache_invalidate($file, true);
-        } elseif (\function_exists('apc_delete_file')) {
+        } elseif (\function_exists('\\apc_delete_file')) {
             \apc_delete_file($file);
         }
     }

+ 1 - 1
app/Core/File.php

@@ -119,7 +119,7 @@ class File
      */
     protected function filterName($name)
     {
-        if (\function_exists('\transliterator_transliterate')) {
+        if (\function_exists('\\transliterator_transliterate')) {
             $name = \transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $name);
         }
 

+ 2 - 2
app/Core/Files.php

@@ -175,10 +175,10 @@ class Files
     public function isImage($file)
     {
         if (\is_string($file)) {
-            if (\function_exists('\exif_imagetype')) {
+            if (\function_exists('\\exif_imagetype')) {
                 $type = \exif_imagetype($file);
             } elseif (
-                \function_exists('\getimagesize')
+                \function_exists('\\getimagesize')
                 && false !== ($type = @\getimagesize($file))
                 && $type[0] > 0
                 && $type[1] > 0

+ 1 - 1
app/Core/Image.php

@@ -39,7 +39,7 @@ class Image extends File
     {
         parent::__construct($path, $options);
 
-        if (! \extension_loaded('gd') || ! \function_exists('\imagecreatetruecolor')) {
+        if (! \extension_loaded('gd') || ! \function_exists('\\imagecreatetruecolor')) {
             throw new FileException('GD library not connected');
         }
 

+ 1 - 1
app/Core/Mail.php

@@ -120,7 +120,7 @@ class Mail
             $ip          = null;
             $domainASCII = $domain = \mb_strtolower($domain, 'UTF-8');
 
-            if (\preg_match('%[\x80-\xFF]%', $domain) && \function_exists('\idn_to_ascii')) {
+            if (\preg_match('%[\x80-\xFF]%', $domain) && \function_exists('\\idn_to_ascii')) {
                 $domainASCII = \idn_to_ascii($domain, 0, \INTL_IDNA_VARIANT_UTS46);
             }
 

+ 3 - 3
app/Core/Secury.php

@@ -75,13 +75,13 @@ class Secury
     public function randomKey($len)
     {
         $key = '';
-        if (\function_exists('random_bytes')) {
+        if (\function_exists('\\random_bytes')) {
             $key .= (string) \random_bytes($len);
         }
-        if (\strlen($key) < $len && \function_exists('mcrypt_create_iv')) {
+        if (\strlen($key) < $len && \function_exists('\\mcrypt_create_iv')) {
             $key .= (string) \mcrypt_create_iv($len, \MCRYPT_DEV_URANDOM);
         }
-        if (\strlen($key) < $len && \function_exists('openssl_random_pseudo_bytes')) {
+        if (\strlen($key) < $len && \function_exists('\\openssl_random_pseudo_bytes')) {
             $tmp = (string) \openssl_random_pseudo_bytes($len, $strong);
             if ($strong) {
                 $key .= $tmp;

+ 2 - 2
app/Models/Pages/Admin/Statistics.php

@@ -100,13 +100,13 @@ class Statistics extends Admin
         $this->tOther    = $stat;
 
         // Check for the existence of various PHP opcode caches/optimizers
-        if (\ini_get('opcache.enable') && \function_exists('opcache_invalidate')) {
+        if (\ini_get('opcache.enable') && \function_exists('\\opcache_invalidate')) {
             $this->accelerator = 'Zend OPcache';
             $this->linkAcc     = 'https://secure.php.net/opcache/';
         } elseif (\ini_get('wincache.fcenabled')) {
             $this->accelerator = 'Windows Cache for PHP';
             $this->linkAcc     = 'https://secure.php.net/wincache/';
-        } elseif (\ini_get('apc.enabled') && \function_exists('apc_delete_file')) {
+        } elseif (\ini_get('apc.enabled') && \function_exists('\\apc_delete_file')) {
             $this->accelerator = 'Alternative PHP Cache (APC)'; //???? частичная эмуляция APCu
             $this->linkAcc     = 'https://secure.php.net/apc/';
         } elseif (\ini_get('xcache.cacher')) {