Changeset 3031216
- Timestamp:
- 02/04/2024 07:38:55 PM (6 months ago)
- Location:
- arvancloud-object-storage
- Files:
-
- 4 added
- 28 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
arvancloud-object-storage/tags/1.3.0/README.txt
r2952379 r3031216 5 5 Tested up to: 6.2 6 6 Requires PHP: 7.1 7 Stable tag: 1. 2.37 Stable tag: 1. 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 48 48 49 49 == Changelog == 50 51 52 53 54 50 55 = 1.2.3 - 2023-08-11 = 51 56 * fix: Check for thumbnails file existence -
arvancloud-object-storage/tags/1.3.0/admin/partials/partial-set-api-key.php
r2915892 r3031216 77 77 'secret-key' => '**************************************', 78 78 'endpoint-url' => '*********************', 79 79 80 ) ) ); 80 81 </textarea> … … 125 126 126 127 </div> 128 129 130 131 132 133 134 135 127 136 128 137 <p><?php echo __( "", 'arvancloud-object-storage' ) ?></p> -
arvancloud-object-storage/tags/1.3.0/admin/partials/partial-settings-tab.php
r2939988 r3031216 7 7 die; 8 8 } 9 9 10 10 11 … … 38 39 39 40 ?> 41 42 43 44 45 46 47 48 49 50 51 52 40 53 54 41 55 <div class="obs-box-outline-title mb-4"> 42 56 <?php _e( 'Settings', 'arvancloud-object-storage' ) ?> … … 97 111 <div class="obs-box-outline d-flex align-items-center justify-content-between"> 98 112 <div> 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 99 136 <div class="obs-box-outline-title"><?php _e( "Sync attachment deletion", 'arvancloud-object-storage' ) ?> 100 137 </div> … … 121 158 </form> 122 159 <br /> 160 161 162 163 123 164 124 165 125 -
arvancloud-object-storage/tags/1.3.0/admin/partials/partial-settings.php
r2871671 r3031216 74 74 } 75 75 Partials::bucket_list()::footer()->die(); 76 77 76 } 78 79 80 77 ?> 81 78 </div> -
arvancloud-object-storage/tags/1.3.0/inc/Admin/Admin.php
r2952379 r3031216 80 80 81 81 wp_enqueue_style( $this->plugin_name, ACS_PLUGIN_ROOT_URL . 'assets/css/main.css', array(), $this->version, 'all' ); 82 82 if(isset($_GET['page']) and $_GET['page'] == ACS_SLUG) 83 wp_enqueue_style('tagify', ACS_PLUGIN_ROOT_URL . 'assets/css/tagify.css', array(), $this->version, 'all' ); 84 83 85 } 84 86 … … 129 131 wp_enqueue_script( 'clipboard' ); 130 132 } 131 133 if(isset($_GET['page']) and $_GET['page'] == ACS_SLUG) 134 wp_enqueue_script('tagify', ACS_PLUGIN_ROOT_URL . 'assets/js/tagify.min.js', array( 'jquery' ), $this->version, false ); 132 135 } 133 136 … … 254 257 $access_key = sanitize_key( $_POST[ 'access-key' ] ); 255 258 $secret_key = sanitize_key( $_POST[ 'secret-key' ] ); 259 256 260 257 261 $parsed_url = parse_url($_POST[ 'endpoint-url' ]); … … 274 278 return; 275 279 } 280 281 282 283 284 276 285 277 286 if( empty($endpoint_url) || !wp_http_validate_url($endpoint_url) ) … … 285 294 $options[ 'secret-key' ] = $secret_key; 286 295 $options[ 'endpoint-url' ] = wp_http_validate_url($endpoint_url); 296 287 297 288 298 if ( ! empty( $_POST[ 'secret-key' ] ) && __( "-- not shown --", 'arvancloud-object-storage' ) === $_POST[ 'secret-key' ] ) { … … 327 337 $config = json_decode(ARVANCLOUD_STORAGE_SETTINGS, true); 328 338 $endpoint_url = $config['endpoint-url']??''; 339 340 341 342 343 344 329 345 330 346 if( empty($endpoint_url) || !wp_http_validate_url($endpoint_url) ) … … 409 425 $settings = [ 410 426 'keep-local-files' => isset( $_POST['keep-local-files'] ) ?: false, 411 'sync-attachment-deletion' => isset( $_POST['sync-attachment-deletion'] ) ?: false 427 'sync-attachment-deletion' => isset( $_POST['sync-attachment-deletion'] ) ?: false, 428 'file_ext' => isset( $_POST['file_ext'] ) ?str_replace('\\','',$_POST['file_ext']): '', 429 'file_f_size' => isset( $_POST['file_f_size'] ) ?$_POST['file_f_size']: '', 430 'file_t_size' => isset( $_POST['file_t_size'] ) ?$_POST['file_t_size']: '', 412 431 ]; 413 432 … … 441 460 public function upload_media_to_storage( $post_id, $force_upload = false ) { 442 461 462 443 463 $query_vars = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); 444 445 464 $result = []; 446 465 parse_str($query_vars, $result); … … 456 475 return; 457 476 } 477 478 458 479 459 480 if( $force_upload || ( is_numeric( $post_id ) && !wp_attachment_is_image( $post_id ) ) ) { … … 518 539 } 519 540 } 520 521 541 return true; 522 542 } 523 524 } 525 543 } 526 544 } 527 545 … … 548 566 549 567 $upload_dir = wp_upload_dir(); 568 569 550 570 $basename = basename( $args['file'] ); 551 571 $path = str_replace( $basename, "", $args['file'] ); … … 553 573 $post_id = attachment_url_to_postid($url); 554 574 if(!file_exists($upload_dir['basedir'] . '/' . $args['file'])) 555 return; 575 return $args; 576 577 556 578 $this->upload_media_to_storage( $upload_dir['basedir'] . '/' . $args['file'], true ); 557 579 (S3Singletone::get_instance())->get_s3client()->putObjectTagging([ … … 576 598 if(!file_exists($file)) 577 599 return; 600 601 578 602 $this->upload_media_to_storage( $file, true ); 579 603 … … 857 881 foreach ( $object_ids as $post_id ) { 858 882 sleep( 2 ); // Delay execution 859 883 if(!self::check_valid_attachment($post_id)) 884 return; 885 860 886 if( wp_attachment_is_image( $post_id ) ) { 861 887 $file = wp_get_attachment_metadata($post_id); … … 1350 1376 1351 1377 foreach ( $post_ids as $post_id ) { 1378 1379 1380 1352 1381 $file = wp_get_attachment_metadata($post_id); 1353 1382 … … 1611 1640 1612 1641 foreach ( $object_ids as $post_id ) { 1642 1643 1613 1644 $one_percent++; 1614 1645 $storage_file_url = get_post_meta( $post_id, 'acs_storage_file_url' ); … … 1836 1867 } 1837 1868 } 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1838 1891 } -
arvancloud-object-storage/tags/1.3.0/inc/S3Singletone.php
r2871671 r3031216 17 17 18 18 $this->args = [ 19 'region' => 'region',19 'region' => 'region', 20 20 'version' => '2006-03-01', 21 21 'endpoint' => $credentials['endpoint-url']??'https://s3.ir-thr-at1.arvanstorage.com', -
arvancloud-object-storage/tags/1.3.0/inc/Storage.php
r2915892 r3031216 127 127 $plugin_admin = new Admin( $this->get_plugin_name(), $this->get_version() ); 128 128 129 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );129 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 130 130 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); 131 131 $this->loader->add_action( 'admin_menu', $plugin_admin, 'setup_admin_menu' ); -
arvancloud-object-storage/tags/1.3.0/vendor/autoload.php
r2952379 r3031216 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d269::getLoader();25 return ComposerAutoloaderInit::getLoader(); -
arvancloud-object-storage/tags/1.3.0/vendor/bin/jp.php
r2930578 r3031216 113 113 || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) 114 114 ) { 115 return include("phpvfscomposer://" . __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php'); 115 include("phpvfscomposer://" . __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php'); 116 exit(0); 116 117 } 117 118 } 118 119 119 returninclude __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php';120 include __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php'; -
arvancloud-object-storage/tags/1.3.0/vendor/composer/ClassLoader.php
r2930578 r3031216 46 46 private static $includeFile; 47 47 48 /** @var string|null*/48 /** @var */ 49 49 private $vendorDir; 50 50 51 51 // PSR-4 52 52 /** 53 * @var array<string, array<string, int>> 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 54 55 */ 55 56 private $prefixLengthsPsr4 = array(); 56 57 /** 57 * @var array<string, list<string>> 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 58 60 */ 59 61 private $prefixDirsPsr4 = array(); 60 62 /** 61 * @var list<string> 63 * @var array[] 64 * @psalm-var array<string, string> 62 65 */ 63 66 private $fallbackDirsPsr4 = array(); … … 65 68 // PSR-0 66 69 /** 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 70 * @var array[] 71 * @psalm-var array<string, array<string, string[]>> 72 72 */ 73 73 private $prefixesPsr0 = array(); 74 74 /** 75 * @var list<string> 75 * @var array[] 76 * @psalm-var array<string, string> 76 77 */ 77 78 private $fallbackDirsPsr0 = array(); … … 81 82 82 83 /** 83 * @var array<string, string> 84 * @var string[] 85 * @psalm-var array<string, string> 84 86 */ 85 87 private $classMap = array(); … … 89 91 90 92 /** 91 * @var array<string, bool> 93 * @var bool[] 94 * @psalm-var array<string, bool> 92 95 */ 93 96 private $missingClasses = array(); 94 97 95 /** @var string|null*/98 /** @var */ 96 99 private $apcuPrefix; 97 100 98 101 /** 99 * @var array<string, self>102 * @var 100 103 */ 101 104 private static $registeredLoaders = array(); 102 105 103 106 /** 104 * @param string|null$vendorDir107 * @param $vendorDir 105 108 */ 106 109 public function __construct($vendorDir = null) … … 111 114 112 115 /** 113 * @return array<string, list<string>>116 * @return 114 117 */ 115 118 public function getPrefixes() … … 123 126 124 127 /** 125 * @return array<string, list<string>> 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 126 130 */ 127 131 public function getPrefixesPsr4() … … 131 135 132 136 /** 133 * @return list<string> 137 * @return array[] 138 * @psalm-return array<string, string> 134 139 */ 135 140 public function getFallbackDirs() … … 139 144 140 145 /** 141 * @return list<string> 146 * @return array[] 147 * @psalm-return array<string, string> 142 148 */ 143 149 public function getFallbackDirsPsr4() … … 147 153 148 154 /** 149 * @return array<string, string> Array of classname => path 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 150 157 */ 151 158 public function getClassMap() … … 155 162 156 163 /** 157 * @param array<string, string> $classMap Class to filename map 164 * @param string[] $classMap Class to filename map 165 * @psalm-param array<string, string> $classMap 158 166 * 159 167 * @return void … … 172 180 * appending or prepending to the ones previously set for this prefix. 173 181 * 174 * @param string 175 * @param list<string>|string $paths The PSR-0 root directories176 * @param bool 182 * @param string $prefix The prefix 183 * @param |string $paths The PSR-0 root directories 184 * @param bool $prepend Whether to prepend the directories 177 185 * 178 186 * @return void … … 180 188 public function add($prefix, $paths, $prepend = false) 181 189 { 182 $paths = (array) $paths;183 190 if (!$prefix) { 184 191 if ($prepend) { 185 192 $this->fallbackDirsPsr0 = array_merge( 186 $paths,193 $paths, 187 194 $this->fallbackDirsPsr0 188 195 ); … … 190 197 $this->fallbackDirsPsr0 = array_merge( 191 198 $this->fallbackDirsPsr0, 192 $paths199 $paths 193 200 ); 194 201 } … … 199 206 $first = $prefix[0]; 200 207 if (!isset($this->prefixesPsr0[$first][$prefix])) { 201 $this->prefixesPsr0[$first][$prefix] = $paths;208 $this->prefixesPsr0[$first][$prefix] = $paths; 202 209 203 210 return; … … 205 212 if ($prepend) { 206 213 $this->prefixesPsr0[$first][$prefix] = array_merge( 207 $paths,214 $paths, 208 215 $this->prefixesPsr0[$first][$prefix] 209 216 ); … … 211 218 $this->prefixesPsr0[$first][$prefix] = array_merge( 212 219 $this->prefixesPsr0[$first][$prefix], 213 $paths220 $paths 214 221 ); 215 222 } … … 220 227 * appending or prepending to the ones previously set for this namespace. 221 228 * 222 * @param string 223 * @param list<string>|string $paths The PSR-4 base directories224 * @param bool 229 * @param string $prefix The prefix/namespace, with trailing '\\' 230 * @param |string $paths The PSR-4 base directories 231 * @param bool $prepend Whether to prepend the directories 225 232 * 226 233 * @throws \InvalidArgumentException … … 230 237 public function addPsr4($prefix, $paths, $prepend = false) 231 238 { 232 $paths = (array) $paths;233 239 if (!$prefix) { 234 240 // Register directories for the root namespace. 235 241 if ($prepend) { 236 242 $this->fallbackDirsPsr4 = array_merge( 237 $paths,243 $paths, 238 244 $this->fallbackDirsPsr4 239 245 ); … … 241 247 $this->fallbackDirsPsr4 = array_merge( 242 248 $this->fallbackDirsPsr4, 243 $paths249 $paths 244 250 ); 245 251 } … … 251 257 } 252 258 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 253 $this->prefixDirsPsr4[$prefix] = $paths;259 $this->prefixDirsPsr4[$prefix] = $paths; 254 260 } elseif ($prepend) { 255 261 // Prepend directories for an already registered namespace. 256 262 $this->prefixDirsPsr4[$prefix] = array_merge( 257 $paths,263 $paths, 258 264 $this->prefixDirsPsr4[$prefix] 259 265 ); … … 262 268 $this->prefixDirsPsr4[$prefix] = array_merge( 263 269 $this->prefixDirsPsr4[$prefix], 264 $paths270 $paths 265 271 ); 266 272 } … … 271 277 * replacing any others previously set for this prefix. 272 278 * 273 * @param string 274 * @param list<string>|string $paths The PSR-0 base directories279 * @param string $prefix The prefix 280 * @param |string $paths The PSR-0 base directories 275 281 * 276 282 * @return void … … 289 295 * replacing any others previously set for this namespace. 290 296 * 291 * @param string 292 * @param list<string>|string $paths The PSR-4 base directories297 * @param string $prefix The prefix/namespace, with trailing '\\' 298 * @param |string $paths The PSR-4 base directories 293 299 * 294 300 * @throws \InvalidArgumentException … … 476 482 477 483 /** 478 * Returns the currently registered loaders keyed by their corresponding vendor directories.479 * 480 * @return array<string, self>484 * Returns the currently registered loaders ed by their corresponding vendor directories. 485 * 486 * @return 481 487 */ 482 488 public static function getRegisteredLoaders() -
arvancloud-object-storage/tags/1.3.0/vendor/composer/autoload_real.php
r2952379 r3031216 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d2695 class ComposerAutoloaderInit 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d269', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d269', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 53647cd09e77fef9105e230254b8d269::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
arvancloud-object-storage/tags/1.3.0/vendor/composer/autoload_static.php
r2952379 r3031216 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 53647cd09e77fef9105e230254b8d2697 class ComposerStaticInit 8 8 { 9 9 public static $files = array ( … … 1161 1161 { 1162 1162 return \Closure::bind(function () use ($loader) { 1163 $loader->prefixLengthsPsr4 = ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$prefixLengthsPsr4;1164 $loader->prefixDirsPsr4 = ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$prefixDirsPsr4;1165 $loader->classMap = ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$classMap;1163 $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4; 1164 $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4; 1165 $loader->classMap = ComposerStaticInit::$classMap; 1166 1166 1167 1167 }, null, ClassLoader::class); -
arvancloud-object-storage/tags/1.3.0/vendor/composer/installed.php
r2952379 r3031216 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' dee4894fd789e60f5693a74312fdbdd3ded7e4bd',6 'reference' => '', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 59 59 'pretty_version' => 'dev-master', 60 60 'version' => 'dev-master', 61 'reference' => ' dee4894fd789e60f5693a74312fdbdd3ded7e4bd',61 'reference' => '', 62 62 'type' => 'library', 63 63 'install_path' => __DIR__ . '/../../', -
arvancloud-object-storage/tags/1.3.0/wp-arvancloud-storage.php
r2952379 r3031216 10 10 * Plugin URI: https://www.arvancloud.com/fa/products/cloud-storage 11 11 * Description: Using ArvanCloud Storage Plugin you can offload, back up and upload your WordPress files and databases directly to your ArvanCloud object storage bucket. This easy-to-use plugin allows you to back up, restore and store your files simply and securely to a cost-effective, unlimited cloud storage. No need for expensive hosting services anymore. 12 * Version: 1. 2.312 * Version: 1. 13 13 * Author: Khorshid, ArvanCloud 14 14 * Author URI: https://www.arvancloud.com/en/products/cloud-storage … … 28 28 } 29 29 30 define( 'ACS_VERSION', '1. 2.3' );30 define( 'ACS_VERSION', '1.' ); 31 31 define( 'ACS_NAME', __( 'ArvanCloud Storage', 'arvancloud-object-storage' ) ); 32 32 define( 'ACS_SLUG', 'wp-arvancloud-storage'); -
arvancloud-object-storage/trunk/README.txt
r2952379 r3031216 5 5 Tested up to: 6.2 6 6 Requires PHP: 7.1 7 Stable tag: 1. 2.37 Stable tag: 1. 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 48 48 49 49 == Changelog == 50 51 52 53 54 50 55 = 1.2.3 - 2023-08-11 = 51 56 * fix: Check for thumbnails file existence -
arvancloud-object-storage/trunk/admin/partials/partial-set-api-key.php
r2915892 r3031216 77 77 'secret-key' => '**************************************', 78 78 'endpoint-url' => '*********************', 79 79 80 ) ) ); 80 81 </textarea> … … 125 126 126 127 </div> 128 129 130 131 132 133 134 135 127 136 128 137 <p><?php echo __( "", 'arvancloud-object-storage' ) ?></p> -
arvancloud-object-storage/trunk/admin/partials/partial-settings-tab.php
r2939988 r3031216 7 7 die; 8 8 } 9 9 10 10 11 … … 38 39 39 40 ?> 41 42 43 44 45 46 47 48 49 50 51 52 40 53 54 41 55 <div class="obs-box-outline-title mb-4"> 42 56 <?php _e( 'Settings', 'arvancloud-object-storage' ) ?> … … 97 111 <div class="obs-box-outline d-flex align-items-center justify-content-between"> 98 112 <div> 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 99 136 <div class="obs-box-outline-title"><?php _e( "Sync attachment deletion", 'arvancloud-object-storage' ) ?> 100 137 </div> … … 121 158 </form> 122 159 <br /> 160 161 162 163 123 164 124 165 125 -
arvancloud-object-storage/trunk/admin/partials/partial-settings.php
r2871671 r3031216 74 74 } 75 75 Partials::bucket_list()::footer()->die(); 76 77 76 } 78 79 80 77 ?> 81 78 </div> -
arvancloud-object-storage/trunk/inc/Admin/Admin.php
r2952379 r3031216 80 80 81 81 wp_enqueue_style( $this->plugin_name, ACS_PLUGIN_ROOT_URL . 'assets/css/main.css', array(), $this->version, 'all' ); 82 82 if(isset($_GET['page']) and $_GET['page'] == ACS_SLUG) 83 wp_enqueue_style('tagify', ACS_PLUGIN_ROOT_URL . 'assets/css/tagify.css', array(), $this->version, 'all' ); 84 83 85 } 84 86 … … 129 131 wp_enqueue_script( 'clipboard' ); 130 132 } 131 133 if(isset($_GET['page']) and $_GET['page'] == ACS_SLUG) 134 wp_enqueue_script('tagify', ACS_PLUGIN_ROOT_URL . 'assets/js/tagify.min.js', array( 'jquery' ), $this->version, false ); 132 135 } 133 136 … … 254 257 $access_key = sanitize_key( $_POST[ 'access-key' ] ); 255 258 $secret_key = sanitize_key( $_POST[ 'secret-key' ] ); 259 256 260 257 261 $parsed_url = parse_url($_POST[ 'endpoint-url' ]); … … 274 278 return; 275 279 } 280 281 282 283 284 276 285 277 286 if( empty($endpoint_url) || !wp_http_validate_url($endpoint_url) ) … … 285 294 $options[ 'secret-key' ] = $secret_key; 286 295 $options[ 'endpoint-url' ] = wp_http_validate_url($endpoint_url); 296 287 297 288 298 if ( ! empty( $_POST[ 'secret-key' ] ) && __( "-- not shown --", 'arvancloud-object-storage' ) === $_POST[ 'secret-key' ] ) { … … 327 337 $config = json_decode(ARVANCLOUD_STORAGE_SETTINGS, true); 328 338 $endpoint_url = $config['endpoint-url']??''; 339 340 341 342 343 344 329 345 330 346 if( empty($endpoint_url) || !wp_http_validate_url($endpoint_url) ) … … 409 425 $settings = [ 410 426 'keep-local-files' => isset( $_POST['keep-local-files'] ) ?: false, 411 'sync-attachment-deletion' => isset( $_POST['sync-attachment-deletion'] ) ?: false 427 'sync-attachment-deletion' => isset( $_POST['sync-attachment-deletion'] ) ?: false, 428 'file_ext' => isset( $_POST['file_ext'] ) ?str_replace('\\','',$_POST['file_ext']): '', 429 'file_f_size' => isset( $_POST['file_f_size'] ) ?$_POST['file_f_size']: '', 430 'file_t_size' => isset( $_POST['file_t_size'] ) ?$_POST['file_t_size']: '', 412 431 ]; 413 432 … … 441 460 public function upload_media_to_storage( $post_id, $force_upload = false ) { 442 461 462 443 463 $query_vars = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); 444 445 464 $result = []; 446 465 parse_str($query_vars, $result); … … 456 475 return; 457 476 } 477 478 458 479 459 480 if( $force_upload || ( is_numeric( $post_id ) && !wp_attachment_is_image( $post_id ) ) ) { … … 518 539 } 519 540 } 520 521 541 return true; 522 542 } 523 524 } 525 543 } 526 544 } 527 545 … … 548 566 549 567 $upload_dir = wp_upload_dir(); 568 569 550 570 $basename = basename( $args['file'] ); 551 571 $path = str_replace( $basename, "", $args['file'] ); … … 553 573 $post_id = attachment_url_to_postid($url); 554 574 if(!file_exists($upload_dir['basedir'] . '/' . $args['file'])) 555 return; 575 return $args; 576 577 556 578 $this->upload_media_to_storage( $upload_dir['basedir'] . '/' . $args['file'], true ); 557 579 (S3Singletone::get_instance())->get_s3client()->putObjectTagging([ … … 576 598 if(!file_exists($file)) 577 599 return; 600 601 578 602 $this->upload_media_to_storage( $file, true ); 579 603 … … 857 881 foreach ( $object_ids as $post_id ) { 858 882 sleep( 2 ); // Delay execution 859 883 if(!self::check_valid_attachment($post_id)) 884 return; 885 860 886 if( wp_attachment_is_image( $post_id ) ) { 861 887 $file = wp_get_attachment_metadata($post_id); … … 1350 1376 1351 1377 foreach ( $post_ids as $post_id ) { 1378 1379 1380 1352 1381 $file = wp_get_attachment_metadata($post_id); 1353 1382 … … 1611 1640 1612 1641 foreach ( $object_ids as $post_id ) { 1642 1643 1613 1644 $one_percent++; 1614 1645 $storage_file_url = get_post_meta( $post_id, 'acs_storage_file_url' ); … … 1836 1867 } 1837 1868 } 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1838 1891 } -
arvancloud-object-storage/trunk/inc/S3Singletone.php
r2871671 r3031216 17 17 18 18 $this->args = [ 19 'region' => 'region',19 'region' => 'region', 20 20 'version' => '2006-03-01', 21 21 'endpoint' => $credentials['endpoint-url']??'https://s3.ir-thr-at1.arvanstorage.com', -
arvancloud-object-storage/trunk/inc/Storage.php
r2915892 r3031216 127 127 $plugin_admin = new Admin( $this->get_plugin_name(), $this->get_version() ); 128 128 129 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );129 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 130 130 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); 131 131 $this->loader->add_action( 'admin_menu', $plugin_admin, 'setup_admin_menu' ); -
arvancloud-object-storage/trunk/vendor/autoload.php
r2952379 r3031216 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d269::getLoader();25 return ComposerAutoloaderInit::getLoader(); -
arvancloud-object-storage/trunk/vendor/bin/jp.php
r2930578 r3031216 113 113 || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) 114 114 ) { 115 return include("phpvfscomposer://" . __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php'); 115 include("phpvfscomposer://" . __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php'); 116 exit(0); 116 117 } 117 118 } 118 119 119 returninclude __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php';120 include __DIR__ . '/..'.'/mtdowling/jmespath.php/bin/jp.php'; -
arvancloud-object-storage/trunk/vendor/composer/ClassLoader.php
r2930578 r3031216 46 46 private static $includeFile; 47 47 48 /** @var string|null*/48 /** @var */ 49 49 private $vendorDir; 50 50 51 51 // PSR-4 52 52 /** 53 * @var array<string, array<string, int>> 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 54 55 */ 55 56 private $prefixLengthsPsr4 = array(); 56 57 /** 57 * @var array<string, list<string>> 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 58 60 */ 59 61 private $prefixDirsPsr4 = array(); 60 62 /** 61 * @var list<string> 63 * @var array[] 64 * @psalm-var array<string, string> 62 65 */ 63 66 private $fallbackDirsPsr4 = array(); … … 65 68 // PSR-0 66 69 /** 67 * List of PSR-0 prefixes 68 * 69 * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) 70 * 71 * @var array<string, array<string, list<string>>> 70 * @var array[] 71 * @psalm-var array<string, array<string, string[]>> 72 72 */ 73 73 private $prefixesPsr0 = array(); 74 74 /** 75 * @var list<string> 75 * @var array[] 76 * @psalm-var array<string, string> 76 77 */ 77 78 private $fallbackDirsPsr0 = array(); … … 81 82 82 83 /** 83 * @var array<string, string> 84 * @var string[] 85 * @psalm-var array<string, string> 84 86 */ 85 87 private $classMap = array(); … … 89 91 90 92 /** 91 * @var array<string, bool> 93 * @var bool[] 94 * @psalm-var array<string, bool> 92 95 */ 93 96 private $missingClasses = array(); 94 97 95 /** @var string|null*/98 /** @var */ 96 99 private $apcuPrefix; 97 100 98 101 /** 99 * @var array<string, self>102 * @var 100 103 */ 101 104 private static $registeredLoaders = array(); 102 105 103 106 /** 104 * @param string|null$vendorDir107 * @param $vendorDir 105 108 */ 106 109 public function __construct($vendorDir = null) … … 111 114 112 115 /** 113 * @return array<string, list<string>>116 * @return 114 117 */ 115 118 public function getPrefixes() … … 123 126 124 127 /** 125 * @return array<string, list<string>> 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 126 130 */ 127 131 public function getPrefixesPsr4() … … 131 135 132 136 /** 133 * @return list<string> 137 * @return array[] 138 * @psalm-return array<string, string> 134 139 */ 135 140 public function getFallbackDirs() … … 139 144 140 145 /** 141 * @return list<string> 146 * @return array[] 147 * @psalm-return array<string, string> 142 148 */ 143 149 public function getFallbackDirsPsr4() … … 147 153 148 154 /** 149 * @return array<string, string> Array of classname => path 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 150 157 */ 151 158 public function getClassMap() … … 155 162 156 163 /** 157 * @param array<string, string> $classMap Class to filename map 164 * @param string[] $classMap Class to filename map 165 * @psalm-param array<string, string> $classMap 158 166 * 159 167 * @return void … … 172 180 * appending or prepending to the ones previously set for this prefix. 173 181 * 174 * @param string 175 * @param list<string>|string $paths The PSR-0 root directories176 * @param bool 182 * @param string $prefix The prefix 183 * @param |string $paths The PSR-0 root directories 184 * @param bool $prepend Whether to prepend the directories 177 185 * 178 186 * @return void … … 180 188 public function add($prefix, $paths, $prepend = false) 181 189 { 182 $paths = (array) $paths;183 190 if (!$prefix) { 184 191 if ($prepend) { 185 192 $this->fallbackDirsPsr0 = array_merge( 186 $paths,193 $paths, 187 194 $this->fallbackDirsPsr0 188 195 ); … … 190 197 $this->fallbackDirsPsr0 = array_merge( 191 198 $this->fallbackDirsPsr0, 192 $paths199 $paths 193 200 ); 194 201 } … … 199 206 $first = $prefix[0]; 200 207 if (!isset($this->prefixesPsr0[$first][$prefix])) { 201 $this->prefixesPsr0[$first][$prefix] = $paths;208 $this->prefixesPsr0[$first][$prefix] = $paths; 202 209 203 210 return; … … 205 212 if ($prepend) { 206 213 $this->prefixesPsr0[$first][$prefix] = array_merge( 207 $paths,214 $paths, 208 215 $this->prefixesPsr0[$first][$prefix] 209 216 ); … … 211 218 $this->prefixesPsr0[$first][$prefix] = array_merge( 212 219 $this->prefixesPsr0[$first][$prefix], 213 $paths220 $paths 214 221 ); 215 222 } … … 220 227 * appending or prepending to the ones previously set for this namespace. 221 228 * 222 * @param string 223 * @param list<string>|string $paths The PSR-4 base directories224 * @param bool 229 * @param string $prefix The prefix/namespace, with trailing '\\' 230 * @param |string $paths The PSR-4 base directories 231 * @param bool $prepend Whether to prepend the directories 225 232 * 226 233 * @throws \InvalidArgumentException … … 230 237 public function addPsr4($prefix, $paths, $prepend = false) 231 238 { 232 $paths = (array) $paths;233 239 if (!$prefix) { 234 240 // Register directories for the root namespace. 235 241 if ($prepend) { 236 242 $this->fallbackDirsPsr4 = array_merge( 237 $paths,243 $paths, 238 244 $this->fallbackDirsPsr4 239 245 ); … … 241 247 $this->fallbackDirsPsr4 = array_merge( 242 248 $this->fallbackDirsPsr4, 243 $paths249 $paths 244 250 ); 245 251 } … … 251 257 } 252 258 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 253 $this->prefixDirsPsr4[$prefix] = $paths;259 $this->prefixDirsPsr4[$prefix] = $paths; 254 260 } elseif ($prepend) { 255 261 // Prepend directories for an already registered namespace. 256 262 $this->prefixDirsPsr4[$prefix] = array_merge( 257 $paths,263 $paths, 258 264 $this->prefixDirsPsr4[$prefix] 259 265 ); … … 262 268 $this->prefixDirsPsr4[$prefix] = array_merge( 263 269 $this->prefixDirsPsr4[$prefix], 264 $paths270 $paths 265 271 ); 266 272 } … … 271 277 * replacing any others previously set for this prefix. 272 278 * 273 * @param string 274 * @param list<string>|string $paths The PSR-0 base directories279 * @param string $prefix The prefix 280 * @param |string $paths The PSR-0 base directories 275 281 * 276 282 * @return void … … 289 295 * replacing any others previously set for this namespace. 290 296 * 291 * @param string 292 * @param list<string>|string $paths The PSR-4 base directories297 * @param string $prefix The prefix/namespace, with trailing '\\' 298 * @param |string $paths The PSR-4 base directories 293 299 * 294 300 * @throws \InvalidArgumentException … … 476 482 477 483 /** 478 * Returns the currently registered loaders keyed by their corresponding vendor directories.479 * 480 * @return array<string, self>484 * Returns the currently registered loaders ed by their corresponding vendor directories. 485 * 486 * @return 481 487 */ 482 488 public static function getRegisteredLoaders() -
arvancloud-object-storage/trunk/vendor/composer/autoload_real.php
r2952379 r3031216 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d2695 class ComposerAutoloaderInit 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d269', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit 53647cd09e77fef9105e230254b8d269', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit 53647cd09e77fef9105e230254b8d269::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInit::getInitializer($loader)); 33 33 34 34 $loader->register(true); 35 35 36 $filesToLoad = \Composer\Autoload\ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$files;36 $filesToLoad = \Composer\Autoload\ComposerStaticInit::$files; 37 37 $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { 38 38 if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { -
arvancloud-object-storage/trunk/vendor/composer/autoload_static.php
r2952379 r3031216 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit 53647cd09e77fef9105e230254b8d2697 class ComposerStaticInit 8 8 { 9 9 public static $files = array ( … … 1161 1161 { 1162 1162 return \Closure::bind(function () use ($loader) { 1163 $loader->prefixLengthsPsr4 = ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$prefixLengthsPsr4;1164 $loader->prefixDirsPsr4 = ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$prefixDirsPsr4;1165 $loader->classMap = ComposerStaticInit 53647cd09e77fef9105e230254b8d269::$classMap;1163 $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4; 1164 $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4; 1165 $loader->classMap = ComposerStaticInit::$classMap; 1166 1166 1167 1167 }, null, ClassLoader::class); -
arvancloud-object-storage/trunk/vendor/composer/installed.php
r2952379 r3031216 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' dee4894fd789e60f5693a74312fdbdd3ded7e4bd',6 'reference' => '', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 59 59 'pretty_version' => 'dev-master', 60 60 'version' => 'dev-master', 61 'reference' => ' dee4894fd789e60f5693a74312fdbdd3ded7e4bd',61 'reference' => '', 62 62 'type' => 'library', 63 63 'install_path' => __DIR__ . '/../../', -
arvancloud-object-storage/trunk/wp-arvancloud-storage.php
r2952379 r3031216 10 10 * Plugin URI: https://www.arvancloud.com/fa/products/cloud-storage 11 11 * Description: Using ArvanCloud Storage Plugin you can offload, back up and upload your WordPress files and databases directly to your ArvanCloud object storage bucket. This easy-to-use plugin allows you to back up, restore and store your files simply and securely to a cost-effective, unlimited cloud storage. No need for expensive hosting services anymore. 12 * Version: 1. 2.312 * Version: 1. 13 13 * Author: Khorshid, ArvanCloud 14 14 * Author URI: https://www.arvancloud.com/en/products/cloud-storage … … 28 28 } 29 29 30 define( 'ACS_VERSION', '1. 2.3' );30 define( 'ACS_VERSION', '1.' ); 31 31 define( 'ACS_NAME', __( 'ArvanCloud Storage', 'arvancloud-object-storage' ) ); 32 32 define( 'ACS_SLUG', 'wp-arvancloud-storage');
Note: See TracChangeset
for help on using the changeset viewer.