diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d700963 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +# Cache +/wp-content/cache/ +/wp-content/ai1wm-backups/ +/wp-content/languages/ + +# Backups +/wp-content/backup*/ +/wp-content/updraft/ + +# Logs +*.log +debug.log + +# Archivos del sistema +.DS_Store +Thumbs.db + +# IDE +.vscode/ +.idea/ + +# Configuración local +wp-config.php \ No newline at end of file diff --git a/wp-content/.htaccess b/wp-content/.htaccess new file mode 100644 index 0000000..ebf4108 --- /dev/null +++ b/wp-content/.htaccess @@ -0,0 +1,54 @@ + +# BEGIN CompressX +# Las directivas (líneas) entre "BEGIN CompressX" y "END CompressX" son +# generadas dinámicamente y solo deberían ser modificadas mediante filtros de WordPress. +# Cualquier cambio en las directivas que hay entre esos marcadores serán sobrescritas. + +RewriteEngine On +RewriteOptions Inherit +RewriteCond %{QUERY_STRING} original$ +RewriteRule . - [L] +RewriteCond %{HTTP_ACCEPT} image/avif +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.avif -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.avif -f +RewriteRule (.+)\.avif /wp-content/compressx-nextgen/$1.avif [NC,T=image/avif,L] +RewriteCond %{HTTP_ACCEPT} image/avif +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.webp.avif -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.webp.avif -f +RewriteRule (.+)\.webp /wp-content/compressx-nextgen/$1.webp.avif [NC,T=image/avif,L] +RewriteCond %{HTTP_ACCEPT} image/avif +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpg.avif -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpg.avif -f +RewriteRule (.+)\.jpg$ /wp-content/compressx-nextgen/$1.jpg.avif [NC,T=image/avif,L] +RewriteCond %{HTTP_ACCEPT} image/avif +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.png.avif -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.png.avif -f +RewriteRule (.+)\.png$ /wp-content/compressx-nextgen/$1.png.avif [NC,T=image/avif,L] +RewriteCond %{HTTP_ACCEPT} image/avif +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpeg.avif -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpeg.avif -f +RewriteRule (.+)\.jpeg$ /wp-content/compressx-nextgen/$1.jpeg.avif [NC,T=image/avif,L] +RewriteCond %{HTTP_ACCEPT} image/webp +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.webp -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.webp -f +RewriteRule (.+)\.webp /wp-content/compressx-nextgen/$1.webp [NC,T=image/webp,L] +RewriteCond %{HTTP_ACCEPT} image/webp +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpg.webp -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpg.webp -f +RewriteRule (.+)\.jpg$ /wp-content/compressx-nextgen/$1.jpg.webp [NC,T=image/webp,L] +RewriteCond %{HTTP_ACCEPT} image/webp +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.png.webp -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.png.webp -f +RewriteRule (.+)\.png$ /wp-content/compressx-nextgen/$1.png.webp [NC,T=image/webp,L] +RewriteCond %{HTTP_ACCEPT} image/webp +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpeg.webp -f [OR] +RewriteCond %{DOCUMENT_ROOT}/wp-content/compressx-nextgen/$1.jpeg.webp -f +RewriteRule (.+)\.jpeg$ /wp-content/compressx-nextgen/$1.jpeg.webp [NC,T=image/webp,L] + + + +Header always set Cache-Control "private" +Header append Vary "Accept" + + +# END CompressX \ No newline at end of file diff --git a/wp-content/compressx-nextgen/.htaccess b/wp-content/compressx-nextgen/.htaccess new file mode 100644 index 0000000..c9d0b95 --- /dev/null +++ b/wp-content/compressx-nextgen/.htaccess @@ -0,0 +1,16 @@ + +# BEGIN CompressX Webp +# Las directivas (líneas) entre "BEGIN CompressX Webp" y "END CompressX Webp" son +# generadas dinámicamente y solo deberían ser modificadas mediante filtros de WordPress. +# Cualquier cambio en las directivas que hay entre esos marcadores serán sobrescritas. + +AddType image/avif .avif +AddType image/webp .webp + + +ExpiresActive On +ExpiresByType image/avif "access plus 1 year" +ExpiresByType image/webp "access plus 1 year" + +Options -Indexes +# END CompressX Webp \ No newline at end of file diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-120x93.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-120x93.jpg.avif new file mode 100644 index 0000000..898d4aa Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-120x93.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-120x93.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-120x93.jpg.webp new file mode 100644 index 0000000..4525473 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-120x93.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-150x150.jpg.avif new file mode 100644 index 0000000..2dd670a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-150x150.jpg.webp new file mode 100644 index 0000000..fde514c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-1536x1184.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-1536x1184.jpg.avif new file mode 100644 index 0000000..a7bca2b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-1536x1184.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-1536x1184.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-1536x1184.jpg.webp new file mode 100644 index 0000000..58b9685 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-1536x1184.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-156x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-156x120.jpg.avif new file mode 100644 index 0000000..19a048f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-156x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-156x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-156x120.jpg.webp new file mode 100644 index 0000000..3fa8585 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-156x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-250x193.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-250x193.jpg.avif new file mode 100644 index 0000000..4b912db Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-250x193.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-250x193.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-250x193.jpg.webp new file mode 100644 index 0000000..404ed21 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-250x193.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x200.jpg.avif new file mode 100644 index 0000000..e562a7a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x200.jpg.webp new file mode 100644 index 0000000..837b0c0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x400.jpg.avif new file mode 100644 index 0000000..8a06798 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x400.jpg.webp new file mode 100644 index 0000000..7ae41fb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x540.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x540.jpg.avif new file mode 100644 index 0000000..ee3ae29 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x540.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x540.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x540.jpg.webp new file mode 100644 index 0000000..2e77341 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-700x540.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-768x592.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-768x592.jpg.avif new file mode 100644 index 0000000..a229479 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-768x592.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-768x592.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-768x592.jpg.webp new file mode 100644 index 0000000..f00b8c4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-768x592.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-900x1100.jpg.avif new file mode 100644 index 0000000..0b99405 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-900x1100.jpg.webp new file mode 100644 index 0000000..a6160b8 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual.jpg.avif new file mode 100644 index 0000000..69dfced Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/audiovisual.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual.jpg.webp new file mode 100644 index 0000000..11e7cf3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/audiovisual.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-120x95.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-120x95.jpg.avif new file mode 100644 index 0000000..4bacdb0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-120x95.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-120x95.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-120x95.jpg.webp new file mode 100644 index 0000000..531d9db Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-120x95.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-150x150.jpg.avif new file mode 100644 index 0000000..ccd1fd2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-150x150.jpg.webp new file mode 100644 index 0000000..65d2020 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-152x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-152x120.jpg.avif new file mode 100644 index 0000000..245f294 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-152x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-152x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-152x120.jpg.webp new file mode 100644 index 0000000..d55f775 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-152x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-1536x1210.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-1536x1210.jpg.avif new file mode 100644 index 0000000..b742901 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-1536x1210.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-1536x1210.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-1536x1210.jpg.webp new file mode 100644 index 0000000..4878b8d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-1536x1210.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-250x197.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-250x197.jpg.avif new file mode 100644 index 0000000..60f3343 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-250x197.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-250x197.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-250x197.jpg.webp new file mode 100644 index 0000000..f1796bd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-250x197.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x200.jpg.avif new file mode 100644 index 0000000..93d7400 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x200.jpg.webp new file mode 100644 index 0000000..e8f6cfa Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x400.jpg.avif new file mode 100644 index 0000000..8817ebf Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x400.jpg.webp new file mode 100644 index 0000000..08fdeb2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x551.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x551.jpg.avif new file mode 100644 index 0000000..89e7fa6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x551.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x551.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x551.jpg.webp new file mode 100644 index 0000000..7fc5e89 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-700x551.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-768x605.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-768x605.jpg.avif new file mode 100644 index 0000000..1e400de Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-768x605.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-768x605.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-768x605.jpg.webp new file mode 100644 index 0000000..0d81e59 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-768x605.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-900x1100.jpg.avif new file mode 100644 index 0000000..ad2c524 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-900x1100.jpg.webp new file mode 100644 index 0000000..82cef06 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/business-sports.jpg.avif new file mode 100644 index 0000000..c6b78c5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/business-sports.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/business-sports.jpg.webp new file mode 100644 index 0000000..4b2c15e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/business-sports.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-120x149.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-120x149.png.avif new file mode 100644 index 0000000..efde7d7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-120x149.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-120x149.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-120x149.png.webp new file mode 100644 index 0000000..183ab6a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-120x149.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-150x150.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-150x150.png.avif new file mode 100644 index 0000000..50fdfc6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-150x150.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-150x150.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-150x150.png.webp new file mode 100644 index 0000000..293d84d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-150x150.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-250x310.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-250x310.png.avif new file mode 100644 index 0000000..cd7a8f7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-250x310.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-250x310.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-250x310.png.webp new file mode 100644 index 0000000..69495bc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-250x310.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x200.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x200.png.avif new file mode 100644 index 0000000..ba62bb0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x200.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x200.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x200.png.webp new file mode 100644 index 0000000..9492cde Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x200.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x400.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x400.png.avif new file mode 100644 index 0000000..e9992e2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x400.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x400.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x400.png.webp new file mode 100644 index 0000000..1633c32 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x400.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x869.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x869.png.avif new file mode 100644 index 0000000..7db71c1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x869.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x869.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x869.png.webp new file mode 100644 index 0000000..232ad74 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-700x869.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-768x953.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-768x953.png.avif new file mode 100644 index 0000000..44b9835 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-768x953.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-768x953.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-768x953.png.webp new file mode 100644 index 0000000..89625db Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-768x953.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-900x1100.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-900x1100.png.avif new file mode 100644 index 0000000..7303c81 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-900x1100.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-900x1100.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-900x1100.png.webp new file mode 100644 index 0000000..478f9cf Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-900x1100.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-97x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-97x120.png.avif new file mode 100644 index 0000000..11636ff Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-97x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-97x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-97x120.png.webp new file mode 100644 index 0000000..33d8390 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula-97x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula.png.avif new file mode 100644 index 0000000..5d1662c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula.png.webp new file mode 100644 index 0000000..dc7d21c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-cholula.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-120x149.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-120x149.png.avif new file mode 100644 index 0000000..07452a1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-120x149.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-120x149.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-120x149.png.webp new file mode 100644 index 0000000..10e412c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-120x149.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-150x150.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-150x150.png.avif new file mode 100644 index 0000000..9ad922c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-150x150.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-150x150.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-150x150.png.webp new file mode 100644 index 0000000..3cd5deb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-150x150.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-250x310.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-250x310.png.avif new file mode 100644 index 0000000..d040c20 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-250x310.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-250x310.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-250x310.png.webp new file mode 100644 index 0000000..0f3217c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-250x310.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x200.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x200.png.avif new file mode 100644 index 0000000..1db2e71 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x200.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x200.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x200.png.webp new file mode 100644 index 0000000..71af371 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x200.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x400.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x400.png.avif new file mode 100644 index 0000000..519f6b5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x400.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x400.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x400.png.webp new file mode 100644 index 0000000..22adcae Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x400.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x869.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x869.png.avif new file mode 100644 index 0000000..e132b22 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x869.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x869.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x869.png.webp new file mode 100644 index 0000000..46f28ad Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-700x869.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-768x953.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-768x953.png.avif new file mode 100644 index 0000000..679733e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-768x953.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-768x953.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-768x953.png.webp new file mode 100644 index 0000000..88afa09 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-768x953.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-900x1100.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-900x1100.png.avif new file mode 100644 index 0000000..2821bcb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-900x1100.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-900x1100.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-900x1100.png.webp new file mode 100644 index 0000000..ed21141 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-900x1100.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-97x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-97x120.png.avif new file mode 100644 index 0000000..a13f721 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-97x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-97x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-97x120.png.webp new file mode 100644 index 0000000..ea2a0da Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe-97x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe.png.avif new file mode 100644 index 0000000..5ba6a45 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe.png.webp new file mode 100644 index 0000000..34caf58 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-santafe.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-120x149.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-120x149.png.avif new file mode 100644 index 0000000..7692e08 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-120x149.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-120x149.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-120x149.png.webp new file mode 100644 index 0000000..b606936 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-120x149.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-150x150.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-150x150.png.avif new file mode 100644 index 0000000..dee83e6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-150x150.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-150x150.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-150x150.png.webp new file mode 100644 index 0000000..a77339f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-150x150.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-250x310.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-250x310.png.avif new file mode 100644 index 0000000..3bd2c4a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-250x310.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-250x310.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-250x310.png.webp new file mode 100644 index 0000000..eea6e8e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-250x310.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x200.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x200.png.avif new file mode 100644 index 0000000..3a39b28 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x200.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x200.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x200.png.webp new file mode 100644 index 0000000..36d1820 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x200.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x400.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x400.png.avif new file mode 100644 index 0000000..6f775ed Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x400.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x400.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x400.png.webp new file mode 100644 index 0000000..543fce8 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x400.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x869.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x869.png.avif new file mode 100644 index 0000000..c2e5b8b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x869.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x869.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x869.png.webp new file mode 100644 index 0000000..9a489c0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-700x869.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-768x953.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-768x953.png.avif new file mode 100644 index 0000000..43dc621 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-768x953.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-768x953.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-768x953.png.webp new file mode 100644 index 0000000..1ec6797 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-768x953.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-900x1100.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-900x1100.png.avif new file mode 100644 index 0000000..8c4baba Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-900x1100.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-900x1100.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-900x1100.png.webp new file mode 100644 index 0000000..438e637 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-900x1100.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-97x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-97x120.png.avif new file mode 100644 index 0000000..aa4ba7e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-97x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-97x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-97x120.png.webp new file mode 100644 index 0000000..c574ff5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite-97x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite.png.avif new file mode 100644 index 0000000..e6f5820 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite.png.webp new file mode 100644 index 0000000..64ea39a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-satelite.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-120x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-120x120.png.avif new file mode 100644 index 0000000..78779da Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-120x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-120x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-120x120.png.webp new file mode 100644 index 0000000..874f920 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-120x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-150x150.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-150x150.png.avif new file mode 100644 index 0000000..8925577 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-150x150.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-150x150.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-150x150.png.webp new file mode 100644 index 0000000..9d99002 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-150x150.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-250x250.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-250x250.png.avif new file mode 100644 index 0000000..d091d5e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-250x250.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-250x250.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-250x250.png.webp new file mode 100644 index 0000000..a9ef631 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-250x250.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x200.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x200.png.avif new file mode 100644 index 0000000..9916f73 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x200.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x200.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x200.png.webp new file mode 100644 index 0000000..59740ca Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x200.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x400.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x400.png.avif new file mode 100644 index 0000000..d98c509 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x400.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x400.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x400.png.webp new file mode 100644 index 0000000..2e3a3d4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x400.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x700.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x700.png.avif new file mode 100644 index 0000000..b2ea3d7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x700.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x700.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x700.png.webp new file mode 100644 index 0000000..8414f6f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-700x700.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-768x768.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-768x768.png.avif new file mode 100644 index 0000000..a262c6b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-768x768.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-768x768.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-768x768.png.webp new file mode 100644 index 0000000..6fe64f7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-768x768.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-900x1024.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-900x1024.png.avif new file mode 100644 index 0000000..8cef2d2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-900x1024.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-900x1024.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-900x1024.png.webp new file mode 100644 index 0000000..7c4dadc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle-900x1024.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle.png.avif new file mode 100644 index 0000000..1bd1115 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-valle.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle.png.webp new file mode 100644 index 0000000..9e60ce4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-valle.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-120x149.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-120x149.png.avif new file mode 100644 index 0000000..60255ad Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-120x149.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-120x149.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-120x149.png.webp new file mode 100644 index 0000000..a2953dc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-120x149.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-150x150.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-150x150.png.avif new file mode 100644 index 0000000..50d51b7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-150x150.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-150x150.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-150x150.png.webp new file mode 100644 index 0000000..b1483ea Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-150x150.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-250x310.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-250x310.png.avif new file mode 100644 index 0000000..87a9c6d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-250x310.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-250x310.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-250x310.png.webp new file mode 100644 index 0000000..a677bfe Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-250x310.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x200.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x200.png.avif new file mode 100644 index 0000000..de823c6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x200.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x200.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x200.png.webp new file mode 100644 index 0000000..a3b727b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x200.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x400.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x400.png.avif new file mode 100644 index 0000000..e14a51f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x400.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x400.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x400.png.webp new file mode 100644 index 0000000..4f7f9db Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x400.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x869.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x869.png.avif new file mode 100644 index 0000000..5b4efa3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x869.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x869.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x869.png.webp new file mode 100644 index 0000000..3b70fea Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-700x869.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-768x953.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-768x953.png.avif new file mode 100644 index 0000000..cd34d87 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-768x953.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-768x953.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-768x953.png.webp new file mode 100644 index 0000000..aef0d13 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-768x953.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-900x1100.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-900x1100.png.avif new file mode 100644 index 0000000..e3d22f5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-900x1100.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-900x1100.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-900x1100.png.webp new file mode 100644 index 0000000..7fc376b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-900x1100.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-97x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-97x120.png.avif new file mode 100644 index 0000000..0c1f27b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-97x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-97x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-97x120.png.webp new file mode 100644 index 0000000..fa63a3f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan-97x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan.png.avif new file mode 100644 index 0000000..8070c48 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan.png.webp new file mode 100644 index 0000000..78bd5fb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/campus-zapopan.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-120x91.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-120x91.jpg.avif new file mode 100644 index 0000000..39f4b19 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-120x91.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-120x91.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-120x91.jpg.webp new file mode 100644 index 0000000..e8216d7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-120x91.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-150x150.jpg.avif new file mode 100644 index 0000000..6c2f5bd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-150x150.jpg.webp new file mode 100644 index 0000000..12c8e36 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-1536x1160.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-1536x1160.jpg.avif new file mode 100644 index 0000000..4b85f7b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-1536x1160.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-1536x1160.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-1536x1160.jpg.webp new file mode 100644 index 0000000..6945a93 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-1536x1160.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-159x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-159x120.jpg.avif new file mode 100644 index 0000000..79ca543 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-159x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-159x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-159x120.jpg.webp new file mode 100644 index 0000000..96a04d4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-159x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-250x189.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-250x189.jpg.avif new file mode 100644 index 0000000..e236ce4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-250x189.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-250x189.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-250x189.jpg.webp new file mode 100644 index 0000000..4f1137d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-250x189.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x200.jpg.avif new file mode 100644 index 0000000..08730cb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x200.jpg.webp new file mode 100644 index 0000000..80fbe71 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x400.jpg.avif new file mode 100644 index 0000000..465bdaf Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x400.jpg.webp new file mode 100644 index 0000000..de35de6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x529.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x529.jpg.avif new file mode 100644 index 0000000..e656f3e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x529.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x529.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x529.jpg.webp new file mode 100644 index 0000000..fbd477f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-700x529.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-768x580.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-768x580.jpg.avif new file mode 100644 index 0000000..92da25d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-768x580.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-768x580.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-768x580.jpg.webp new file mode 100644 index 0000000..17015d1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-768x580.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-900x1100.jpg.avif new file mode 100644 index 0000000..3874a76 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-900x1100.jpg.webp new file mode 100644 index 0000000..9c00ce0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad.jpg.avif new file mode 100644 index 0000000..ea69fbc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad.jpg.webp new file mode 100644 index 0000000..bf6687c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciberseguridad.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-120x103.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-120x103.jpg.avif new file mode 100644 index 0000000..ae8a61f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-120x103.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-120x103.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-120x103.jpg.webp new file mode 100644 index 0000000..89d8bb5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-120x103.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-140x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-140x120.jpg.avif new file mode 100644 index 0000000..1436d67 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-140x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-140x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-140x120.jpg.webp new file mode 100644 index 0000000..dd305d4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-140x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-150x150.jpg.avif new file mode 100644 index 0000000..f0b328b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-150x150.jpg.webp new file mode 100644 index 0000000..94bc3eb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-1536x1313.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-1536x1313.jpg.avif new file mode 100644 index 0000000..133429e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-1536x1313.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-1536x1313.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-1536x1313.jpg.webp new file mode 100644 index 0000000..69130f5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-1536x1313.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-250x214.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-250x214.jpg.avif new file mode 100644 index 0000000..06c895d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-250x214.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-250x214.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-250x214.jpg.webp new file mode 100644 index 0000000..d6e4a18 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-250x214.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x200.jpg.avif new file mode 100644 index 0000000..b5c3056 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x200.jpg.webp new file mode 100644 index 0000000..2ab031a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x400.jpg.avif new file mode 100644 index 0000000..44bae5f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x400.jpg.webp new file mode 100644 index 0000000..fbff6a4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x599.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x599.jpg.avif new file mode 100644 index 0000000..569a722 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x599.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x599.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x599.jpg.webp new file mode 100644 index 0000000..cee835e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-700x599.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-768x657.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-768x657.jpg.avif new file mode 100644 index 0000000..b63163b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-768x657.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-768x657.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-768x657.jpg.webp new file mode 100644 index 0000000..64d85eb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-768x657.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-900x1100.jpg.avif new file mode 100644 index 0000000..c73b9cb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-900x1100.jpg.webp new file mode 100644 index 0000000..735e012 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte.jpg.avif new file mode 100644 index 0000000..4691e36 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte.jpg.webp new file mode 100644 index 0000000..ca0f292 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/ciencias-deporte.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-120x84.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-120x84.jpg.avif new file mode 100644 index 0000000..300ef0e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-120x84.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-120x84.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-120x84.jpg.webp new file mode 100644 index 0000000..be393cc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-120x84.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-150x150.jpg.avif new file mode 100644 index 0000000..962986b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-150x150.jpg.webp new file mode 100644 index 0000000..24eea01 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-1536x1075.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-1536x1075.jpg.avif new file mode 100644 index 0000000..d010f60 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-1536x1075.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-1536x1075.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-1536x1075.jpg.webp new file mode 100644 index 0000000..1464fdc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-1536x1075.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-171x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-171x120.jpg.avif new file mode 100644 index 0000000..74c9c98 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-171x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-171x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-171x120.jpg.webp new file mode 100644 index 0000000..4bcdce1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-171x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-250x175.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-250x175.jpg.avif new file mode 100644 index 0000000..b24b482 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-250x175.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-250x175.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-250x175.jpg.webp new file mode 100644 index 0000000..1c9196d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-250x175.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x200.jpg.avif new file mode 100644 index 0000000..9ba5ac4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x200.jpg.webp new file mode 100644 index 0000000..9c95cd1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x400.jpg.avif new file mode 100644 index 0000000..dcc7eba Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x400.jpg.webp new file mode 100644 index 0000000..bd90e1c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x490.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x490.jpg.avif new file mode 100644 index 0000000..404250c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x490.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x490.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x490.jpg.webp new file mode 100644 index 0000000..4c3d380 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-700x490.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-768x538.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-768x538.jpg.avif new file mode 100644 index 0000000..c97837b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-768x538.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-768x538.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-768x538.jpg.webp new file mode 100644 index 0000000..9953998 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-768x538.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-900x1100.jpg.avif new file mode 100644 index 0000000..ed97a54 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-900x1100.jpg.webp new file mode 100644 index 0000000..10136f3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica.jpg.avif new file mode 100644 index 0000000..b3d06df Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica.jpg.webp new file mode 100644 index 0000000..34041d6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/creacion-artistica.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-120x120.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-120x120.webp new file mode 100644 index 0000000..e8d4322 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-120x120.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-120x120.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-120x120.webp.avif new file mode 100644 index 0000000..6a168ff Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-120x120.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-150x150.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-150x150.webp new file mode 100644 index 0000000..1798fab Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-150x150.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-150x150.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-150x150.webp.avif new file mode 100644 index 0000000..2f62a6a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-150x150.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-180x180.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-180x180.webp new file mode 100644 index 0000000..e127f5a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-180x180.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-180x180.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-180x180.webp.avif new file mode 100644 index 0000000..15d5777 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-180x180.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-192x192.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-192x192.webp new file mode 100644 index 0000000..a9c391b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-192x192.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-192x192.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-192x192.webp.avif new file mode 100644 index 0000000..5c2b8ec Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-192x192.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-250x250.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-250x250.webp new file mode 100644 index 0000000..f8d9347 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-250x250.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-250x250.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-250x250.webp.avif new file mode 100644 index 0000000..966a72c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-250x250.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-270x270.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-270x270.webp new file mode 100644 index 0000000..0753946 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-270x270.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-270x270.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-270x270.webp.avif new file mode 100644 index 0000000..a3ab58f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-270x270.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-32x32.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-32x32.webp new file mode 100644 index 0000000..086c223 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-32x32.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x200.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x200.webp new file mode 100644 index 0000000..4e5d87c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x200.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x200.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x200.webp.avif new file mode 100644 index 0000000..7e00f4a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x200.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x400.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x400.webp new file mode 100644 index 0000000..7f5f3d0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x400.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x400.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x400.webp.avif new file mode 100644 index 0000000..bc1a4b2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-512x400.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-64x64.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-64x64.webp new file mode 100644 index 0000000..a0ae528 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-64x64.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-64x64.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-64x64.webp.avif new file mode 100644 index 0000000..052fb3d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura-64x64.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura.webp b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura.webp new file mode 100644 index 0000000..9ba5f3c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura.webp.avif new file mode 100644 index 0000000..62b70cd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/cropped-letraAobscura.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-120x117.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-120x117.jpg.avif new file mode 100644 index 0000000..ad3400b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-120x117.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-120x117.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-120x117.jpg.webp new file mode 100644 index 0000000..498d9d0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-120x117.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-123x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-123x120.jpg.avif new file mode 100644 index 0000000..cc58ef0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-123x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-123x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-123x120.jpg.webp new file mode 100644 index 0000000..dac32ce Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-123x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-150x150.jpg.avif new file mode 100644 index 0000000..f654e84 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-150x150.jpg.webp new file mode 100644 index 0000000..cf95600 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-1536x1504.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-1536x1504.jpg.avif new file mode 100644 index 0000000..f39e2c5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-1536x1504.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-1536x1504.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-1536x1504.jpg.webp new file mode 100644 index 0000000..6e026ab Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-1536x1504.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-250x245.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-250x245.jpg.avif new file mode 100644 index 0000000..f53bd64 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-250x245.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-250x245.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-250x245.jpg.webp new file mode 100644 index 0000000..221b4d2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-250x245.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x200.jpg.avif new file mode 100644 index 0000000..71087dd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x200.jpg.webp new file mode 100644 index 0000000..33bf6df Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x400.jpg.avif new file mode 100644 index 0000000..d760398 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x400.jpg.webp new file mode 100644 index 0000000..0e6c4a0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x685.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x685.jpg.avif new file mode 100644 index 0000000..7d8648f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x685.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x685.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x685.jpg.webp new file mode 100644 index 0000000..77f1600 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-700x685.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-768x752.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-768x752.jpg.avif new file mode 100644 index 0000000..fa06a96 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-768x752.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-768x752.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-768x752.jpg.webp new file mode 100644 index 0000000..c45e2d2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-768x752.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-900x1100.jpg.avif new file mode 100644 index 0000000..0e23928 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-900x1100.jpg.webp new file mode 100644 index 0000000..090733a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo.jpg.avif new file mode 100644 index 0000000..dca4faa Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo.jpg.webp new file mode 100644 index 0000000..7926043 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisio-suelo.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-120x89.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-120x89.jpg.avif new file mode 100644 index 0000000..3e13d31 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-120x89.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-120x89.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-120x89.jpg.webp new file mode 100644 index 0000000..9659864 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-120x89.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-150x150.jpg.avif new file mode 100644 index 0000000..e3cac4e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-150x150.jpg.webp new file mode 100644 index 0000000..327bc3f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-1536x1139.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-1536x1139.jpg.avif new file mode 100644 index 0000000..82d3e74 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-1536x1139.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-1536x1139.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-1536x1139.jpg.webp new file mode 100644 index 0000000..c62c023 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-1536x1139.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-162x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-162x120.jpg.avif new file mode 100644 index 0000000..d055971 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-162x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-162x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-162x120.jpg.webp new file mode 100644 index 0000000..592affe Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-162x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-250x185.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-250x185.jpg.avif new file mode 100644 index 0000000..24bafee Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-250x185.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-250x185.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-250x185.jpg.webp new file mode 100644 index 0000000..fa543ff Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-250x185.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x200.jpg.avif new file mode 100644 index 0000000..93152ac Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x200.jpg.webp new file mode 100644 index 0000000..e8ada08 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x400.jpg.avif new file mode 100644 index 0000000..43c119c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x400.jpg.webp new file mode 100644 index 0000000..c4c5f59 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x519.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x519.jpg.avif new file mode 100644 index 0000000..543f006 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x519.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x519.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x519.jpg.webp new file mode 100644 index 0000000..2ccc68f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-700x519.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-768x570.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-768x570.jpg.avif new file mode 100644 index 0000000..7b0644b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-768x570.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-768x570.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-768x570.jpg.webp new file mode 100644 index 0000000..10630cd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-768x570.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-900x1100.jpg.avif new file mode 100644 index 0000000..25c1cf5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-900x1100.jpg.webp new file mode 100644 index 0000000..c28acf3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia.jpg.avif new file mode 100644 index 0000000..a1d9712 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia.jpg.webp new file mode 100644 index 0000000..6fdb190 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/fisioterapia.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7-120x27.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/image-7-120x27.png.avif new file mode 100644 index 0000000..7d387ca Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7-120x27.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7-120x27.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/image-7-120x27.png.webp new file mode 100644 index 0000000..dd55a38 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7-120x27.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7-150x85.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/image-7-150x85.png.avif new file mode 100644 index 0000000..4cb283d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7-150x85.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7-150x85.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/image-7-150x85.png.webp new file mode 100644 index 0000000..a64c68b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7-150x85.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7-250x56.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/image-7-250x56.png.avif new file mode 100644 index 0000000..ea00c8a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7-250x56.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7-250x56.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/image-7-250x56.png.webp new file mode 100644 index 0000000..088714b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7-250x56.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/image-7.png.avif new file mode 100644 index 0000000..a3ebd11 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/image-7.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/image-7.png.webp new file mode 100644 index 0000000..eafa6fa Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/image-7.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-115x120.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-115x120.webp new file mode 100644 index 0000000..e59e24c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-115x120.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-115x120.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-115x120.webp.avif new file mode 100644 index 0000000..5d0dd9f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-115x120.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-120x125.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-120x125.webp new file mode 100644 index 0000000..b8ead86 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-120x125.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-120x125.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-120x125.webp.avif new file mode 100644 index 0000000..edd6e5e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-120x125.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-150x150.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-150x150.webp new file mode 100644 index 0000000..2a96f38 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-150x150.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-150x150.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-150x150.webp.avif new file mode 100644 index 0000000..2e40319 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-150x150.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-250x261.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-250x261.webp new file mode 100644 index 0000000..2d5f139 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-250x261.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-250x261.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-250x261.webp.avif new file mode 100644 index 0000000..f1efff3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-250x261.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x200.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x200.webp new file mode 100644 index 0000000..881c204 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x200.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x200.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x200.webp.avif new file mode 100644 index 0000000..0a33698 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x200.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x400.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x400.webp new file mode 100644 index 0000000..1a66e68 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x400.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x400.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x400.webp.avif new file mode 100644 index 0000000..2170617 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura-629x400.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura.webp b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura.webp new file mode 100644 index 0000000..e8643e5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura.webp.avif b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura.webp.avif new file mode 100644 index 0000000..19407dd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/letraAobscura.webp.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-120x81.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-120x81.jpg.avif new file mode 100644 index 0000000..0ee4218 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-120x81.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-120x81.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-120x81.jpg.webp new file mode 100644 index 0000000..254bd74 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-120x81.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-150x150.jpg.avif new file mode 100644 index 0000000..b907207 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-150x150.jpg.webp new file mode 100644 index 0000000..026b9a0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-1536x1033.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-1536x1033.jpg.avif new file mode 100644 index 0000000..3885b60 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-1536x1033.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-1536x1033.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-1536x1033.jpg.webp new file mode 100644 index 0000000..9733505 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-1536x1033.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-179x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-179x120.jpg.avif new file mode 100644 index 0000000..fd08a72 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-179x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-179x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-179x120.jpg.webp new file mode 100644 index 0000000..9f59601 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-179x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-250x168.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-250x168.jpg.avif new file mode 100644 index 0000000..7e38c94 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-250x168.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-250x168.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-250x168.jpg.webp new file mode 100644 index 0000000..7e8f048 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-250x168.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x200.jpg.avif new file mode 100644 index 0000000..c2dc27c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x200.jpg.webp new file mode 100644 index 0000000..df2bdde Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x400.jpg.avif new file mode 100644 index 0000000..c3aeebd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x400.jpg.webp new file mode 100644 index 0000000..e0774dd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x471.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x471.jpg.avif new file mode 100644 index 0000000..3ce4e14 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x471.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x471.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x471.jpg.webp new file mode 100644 index 0000000..98380bb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-700x471.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-768x516.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-768x516.jpg.avif new file mode 100644 index 0000000..8321923 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-768x516.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-768x516.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-768x516.jpg.webp new file mode 100644 index 0000000..19d2672 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-768x516.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios-900x1100.jpg.avif new file mode 100644 index 0000000..d5c6cd4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios-900x1100.jpg.webp new file mode 100644 index 0000000..b414fdb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/negocios.jpg.avif new file mode 100644 index 0000000..57b5b6c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/negocios.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/negocios.jpg.webp new file mode 100644 index 0000000..2d43736 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/negocios.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-120x26.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-120x26.png.avif new file mode 100644 index 0000000..d3eee74 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-120x26.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-120x26.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-120x26.png.webp new file mode 100644 index 0000000..e3dc2cf Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-120x26.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-150x150.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-150x150.png.avif new file mode 100644 index 0000000..57df0f6 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-150x150.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-150x150.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-150x150.png.webp new file mode 100644 index 0000000..638e718 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-150x150.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-250x54.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-250x54.png.avif new file mode 100644 index 0000000..c4c2715 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-250x54.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-250x54.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-250x54.png.webp new file mode 100644 index 0000000..bcb6c98 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-250x54.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-480x104.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-480x104.png.avif new file mode 100644 index 0000000..bf5b854 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-480x104.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-480x104.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-480x104.png.webp new file mode 100644 index 0000000..4da06e0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-480x104.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x152.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x152.png.avif new file mode 100644 index 0000000..993bd1d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x152.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x152.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x152.png.webp new file mode 100644 index 0000000..4fa815c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x152.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x181.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x181.png.avif new file mode 100644 index 0000000..cca9030 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x181.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x181.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x181.png.webp new file mode 100644 index 0000000..5a01178 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-700x181.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-768x167.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-768x167.png.avif new file mode 100644 index 0000000..84c5f94 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-768x167.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1-768x167.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-768x167.png.webp new file mode 100644 index 0000000..fa9846c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1-768x167.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-1.png.avif new file mode 100644 index 0000000..f848f0f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-1.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-1.png.webp new file mode 100644 index 0000000..66be8c4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-1.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-120x25.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-120x25.png.avif new file mode 100644 index 0000000..4bcfa3d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-120x25.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-120x25.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-120x25.png.webp new file mode 100644 index 0000000..14dc09e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-120x25.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-150x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-150x120.png.avif new file mode 100644 index 0000000..e176e8b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-150x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-150x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-150x120.png.webp new file mode 100644 index 0000000..5fcf293 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-150x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-250x51.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-250x51.png.avif new file mode 100644 index 0000000..1390207 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-250x51.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-250x51.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-250x51.png.webp new file mode 100644 index 0000000..535563c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-250x51.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-480x98.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-480x98.png.avif new file mode 100644 index 0000000..d723edf Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-480x98.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2-480x98.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-480x98.png.webp new file mode 100644 index 0000000..5f3d64f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2-480x98.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-2.png.avif new file mode 100644 index 0000000..daf5bc1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-2.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-2.png.webp new file mode 100644 index 0000000..748f752 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-2.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-120x43.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-120x43.png.avif new file mode 100644 index 0000000..34d7f5d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-120x43.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-120x43.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-120x43.png.webp new file mode 100644 index 0000000..4725bbb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-120x43.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-150x134.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-150x134.png.avif new file mode 100644 index 0000000..34f3314 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-150x134.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-150x134.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-150x134.png.webp new file mode 100644 index 0000000..5b377b9 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-150x134.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-250x90.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-250x90.png.avif new file mode 100644 index 0000000..cec4e48 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-250x90.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-250x90.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-250x90.png.webp new file mode 100644 index 0000000..4c4fbcd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-250x90.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-332x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-332x120.png.avif new file mode 100644 index 0000000..9ed66cb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-332x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3-332x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-332x120.png.webp new file mode 100644 index 0000000..37a8976 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3-332x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-3.png.avif new file mode 100644 index 0000000..8090700 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-3.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-3.png.webp new file mode 100644 index 0000000..f4ab27d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-3.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-120x42.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-120x42.png.avif new file mode 100644 index 0000000..881cd51 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-120x42.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-120x42.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-120x42.png.webp new file mode 100644 index 0000000..ea4411d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-120x42.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-150x130.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-150x130.png.avif new file mode 100644 index 0000000..2bb8edc Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-150x130.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-150x130.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-150x130.png.webp new file mode 100644 index 0000000..e8a097d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-150x130.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-250x88.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-250x88.png.avif new file mode 100644 index 0000000..d7316a3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-250x88.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-250x88.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-250x88.png.webp new file mode 100644 index 0000000..d60d25a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-250x88.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-342x120.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-342x120.png.avif new file mode 100644 index 0000000..01c8da9 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-342x120.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4-342x120.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-342x120.png.webp new file mode 100644 index 0000000..dca0e13 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4-342x120.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4.png.avif b/wp-content/compressx-nextgen/uploads/2026/10/partner-4.png.avif new file mode 100644 index 0000000..06cc2a3 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4.png.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/partner-4.png.webp b/wp-content/compressx-nextgen/uploads/2026/10/partner-4.png.webp new file mode 100644 index 0000000..1e9591f Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/partner-4.png.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-120x90.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-120x90.jpg.avif new file mode 100644 index 0000000..7c646d1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-120x90.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-120x90.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-120x90.jpg.webp new file mode 100644 index 0000000..62bf70d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-120x90.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-150x150.jpg.avif new file mode 100644 index 0000000..256a593 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-150x150.jpg.webp new file mode 100644 index 0000000..5dbbc28 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-1536x1154.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-1536x1154.jpg.avif new file mode 100644 index 0000000..d69d5cd Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-1536x1154.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-1536x1154.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-1536x1154.jpg.webp new file mode 100644 index 0000000..d2fe11e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-1536x1154.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-160x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-160x120.jpg.avif new file mode 100644 index 0000000..2c13309 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-160x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-160x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-160x120.jpg.webp new file mode 100644 index 0000000..78359f9 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-160x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-250x188.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-250x188.jpg.avif new file mode 100644 index 0000000..ba324e7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-250x188.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-250x188.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-250x188.jpg.webp new file mode 100644 index 0000000..1eef997 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-250x188.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x200.jpg.avif new file mode 100644 index 0000000..76da8b7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x200.jpg.webp new file mode 100644 index 0000000..0bec3a1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x400.jpg.avif new file mode 100644 index 0000000..e84c482 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x400.jpg.webp new file mode 100644 index 0000000..ab3d9ee Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x526.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x526.jpg.avif new file mode 100644 index 0000000..c20d77b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x526.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x526.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x526.jpg.webp new file mode 100644 index 0000000..068ae66 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-700x526.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-768x577.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-768x577.jpg.avif new file mode 100644 index 0000000..9160e1e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-768x577.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-768x577.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-768x577.jpg.webp new file mode 100644 index 0000000..c3c202e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-768x577.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-900x1100.jpg.avif new file mode 100644 index 0000000..cb1482b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-900x1100.jpg.webp new file mode 100644 index 0000000..82a6a7c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/periodismo.jpg.avif new file mode 100644 index 0000000..8435042 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/periodismo.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/periodismo.jpg.webp new file mode 100644 index 0000000..fa4ce4c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/periodismo.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-120x84.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-120x84.jpg.avif new file mode 100644 index 0000000..08eae32 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-120x84.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-120x84.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-120x84.jpg.webp new file mode 100644 index 0000000..75de191 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-120x84.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-150x150.jpg.avif new file mode 100644 index 0000000..04d5541 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-150x150.jpg.webp new file mode 100644 index 0000000..5997e8b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-1536x1076.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-1536x1076.jpg.avif new file mode 100644 index 0000000..71d64a5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-1536x1076.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-1536x1076.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-1536x1076.jpg.webp new file mode 100644 index 0000000..fb0921b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-1536x1076.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-171x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-171x120.jpg.avif new file mode 100644 index 0000000..6926944 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-171x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-171x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-171x120.jpg.webp new file mode 100644 index 0000000..a3f9195 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-171x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-250x175.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-250x175.jpg.avif new file mode 100644 index 0000000..a8d413e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-250x175.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-250x175.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-250x175.jpg.webp new file mode 100644 index 0000000..5fe3a93 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-250x175.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x200.jpg.avif new file mode 100644 index 0000000..7897eea Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x200.jpg.webp new file mode 100644 index 0000000..4b6af20 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x400.jpg.avif new file mode 100644 index 0000000..59287d1 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x400.jpg.webp new file mode 100644 index 0000000..d3261c9 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x490.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x490.jpg.avif new file mode 100644 index 0000000..f6183ab Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x490.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x490.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x490.jpg.webp new file mode 100644 index 0000000..d313b1b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-700x490.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-768x538.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-768x538.jpg.avif new file mode 100644 index 0000000..d8de9b0 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-768x538.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-768x538.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-768x538.jpg.webp new file mode 100644 index 0000000..1a24bd8 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-768x538.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-900x1100.jpg.avif new file mode 100644 index 0000000..9302657 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-900x1100.jpg.webp new file mode 100644 index 0000000..f0b9fed Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical.jpg.avif new file mode 100644 index 0000000..8030621 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical.jpg.webp new file mode 100644 index 0000000..e2fd8ad Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/produccion-musical.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-120x77.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-120x77.jpg.avif new file mode 100644 index 0000000..710fa57 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-120x77.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-120x77.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-120x77.jpg.webp new file mode 100644 index 0000000..2c55fd5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-120x77.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-150x150.jpg.avif new file mode 100644 index 0000000..8aa45f5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-150x150.jpg.webp new file mode 100644 index 0000000..c615206 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-1536x981.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-1536x981.jpg.avif new file mode 100644 index 0000000..0f7ea0d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-1536x981.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-1536x981.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-1536x981.jpg.webp new file mode 100644 index 0000000..13002ea Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-1536x981.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-188x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-188x120.jpg.avif new file mode 100644 index 0000000..c1ac00b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-188x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-188x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-188x120.jpg.webp new file mode 100644 index 0000000..8dd20b7 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-188x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-250x160.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-250x160.jpg.avif new file mode 100644 index 0000000..b60b91e Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-250x160.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-250x160.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-250x160.jpg.webp new file mode 100644 index 0000000..52a6c1b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-250x160.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x200.jpg.avif new file mode 100644 index 0000000..d7cee6d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x200.jpg.webp new file mode 100644 index 0000000..ccfd6d5 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x400.jpg.avif new file mode 100644 index 0000000..d6d7e66 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x400.jpg.webp new file mode 100644 index 0000000..718cced Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x447.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x447.jpg.avif new file mode 100644 index 0000000..945b015 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x447.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x447.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x447.jpg.webp new file mode 100644 index 0000000..98492cb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-700x447.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-768x491.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-768x491.jpg.avif new file mode 100644 index 0000000..5db0488 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-768x491.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-768x491.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-768x491.jpg.webp new file mode 100644 index 0000000..19d6331 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-768x491.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-900x1100.jpg.avif new file mode 100644 index 0000000..932816b Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-900x1100.jpg.webp new file mode 100644 index 0000000..6ab4f39 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion.jpg.avif new file mode 100644 index 0000000..22ea3af Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/readaptacion.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion.jpg.webp new file mode 100644 index 0000000..2882a8a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/readaptacion.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-120x82.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-120x82.jpg.avif new file mode 100644 index 0000000..d329214 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-120x82.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-120x82.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-120x82.jpg.webp new file mode 100644 index 0000000..92c14de Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-120x82.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-150x150.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-150x150.jpg.avif new file mode 100644 index 0000000..589a907 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-150x150.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-150x150.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-150x150.jpg.webp new file mode 100644 index 0000000..31b85be Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-150x150.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-1536x1052.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-1536x1052.jpg.avif new file mode 100644 index 0000000..9bd1022 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-1536x1052.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-1536x1052.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-1536x1052.jpg.webp new file mode 100644 index 0000000..14c9c68 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-1536x1052.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-175x120.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-175x120.jpg.avif new file mode 100644 index 0000000..656cb35 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-175x120.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-175x120.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-175x120.jpg.webp new file mode 100644 index 0000000..80dc4c8 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-175x120.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-250x171.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-250x171.jpg.avif new file mode 100644 index 0000000..c709343 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-250x171.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-250x171.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-250x171.jpg.webp new file mode 100644 index 0000000..0ecbb1c Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-250x171.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-700x200.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-700x200.jpg.avif new file mode 100644 index 0000000..f63412d Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-700x200.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-700x200.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-700x200.jpg.webp new file mode 100644 index 0000000..83d5292 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-700x200.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-700x400.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-700x400.jpg.avif new file mode 100644 index 0000000..e15b964 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-700x400.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-700x400.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-700x400.jpg.webp new file mode 100644 index 0000000..b8d4664 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-700x400.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-700x480.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-700x480.jpg.avif new file mode 100644 index 0000000..73e1b72 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-700x480.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-700x480.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-700x480.jpg.webp new file mode 100644 index 0000000..db61ce4 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-700x480.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-768x526.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-768x526.jpg.avif new file mode 100644 index 0000000..b80cb81 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-768x526.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-768x526.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-768x526.jpg.webp new file mode 100644 index 0000000..8165f18 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-768x526.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-900x1100.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software-900x1100.jpg.avif new file mode 100644 index 0000000..6bb3fcb Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-900x1100.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software-900x1100.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software-900x1100.jpg.webp new file mode 100644 index 0000000..ea03eb8 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software-900x1100.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software.jpg.avif b/wp-content/compressx-nextgen/uploads/2026/10/software.jpg.avif new file mode 100644 index 0000000..cd6fa40 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software.jpg.avif differ diff --git a/wp-content/compressx-nextgen/uploads/2026/10/software.jpg.webp b/wp-content/compressx-nextgen/uploads/2026/10/software.jpg.webp new file mode 100644 index 0000000..5fc75b2 Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/2026/10/software.jpg.webp differ diff --git a/wp-content/compressx-nextgen/uploads/compressx_test.png.webp b/wp-content/compressx-nextgen/uploads/compressx_test.png.webp new file mode 100644 index 0000000..bc1bf2a Binary files /dev/null and b/wp-content/compressx-nextgen/uploads/compressx_test.png.webp differ diff --git a/wp-content/compressx/log/.htaccess b/wp-content/compressx/log/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/wp-content/compressx/log/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/wp-content/compressx/log/compressx_20261005_log.txt b/wp-content/compressx/log/compressx_20261005_log.txt new file mode 100644 index 0000000..b7e8330 --- /dev/null +++ b/wp-content/compressx/log/compressx_20261005_log.txt @@ -0,0 +1,1015 @@ +[2026-10-06 05:14:51][notice]Add attachment images id:18 +==================================================== +open log file: 2026-10-06 05:14:51 +[2026-10-06 05:14:51][notice]Start optimizing new media images id:18 +[2026-10-06 05:14:51][notice] Start WebP conversion ciencias-deporte.jpg +[2026-10-06 05:14:52][notice] Converting ciencias-deporte.jpg to WebP succeeded. +[2026-10-06 05:14:52][notice] Start WebP conversion ciencias-deporte-250x214.jpg +[2026-10-06 05:14:52][notice] Converting ciencias-deporte-250x214.jpg to WebP succeeded. +[2026-10-06 05:14:52][notice] Start WebP conversion ciencias-deporte-700x599.jpg +[2026-10-06 05:14:52][notice] Converting ciencias-deporte-700x599.jpg to WebP succeeded. +[2026-10-06 05:14:52][notice] Start WebP conversion ciencias-deporte-150x150.jpg +[2026-10-06 05:14:52][notice] Converting ciencias-deporte-150x150.jpg to WebP succeeded. +[2026-10-06 05:14:52][notice] Start WebP conversion ciencias-deporte-768x657.jpg +[2026-10-06 05:14:52][notice] Converting ciencias-deporte-768x657.jpg to WebP succeeded. +[2026-10-06 05:14:52][notice] Start WebP conversion ciencias-deporte-1536x1313.jpg +[2026-10-06 05:14:52][notice] Converting ciencias-deporte-1536x1313.jpg to WebP succeeded. +[2026-10-06 05:14:53][notice] Start WebP conversion ciencias-deporte-120x103.jpg +[2026-10-06 05:14:53][notice] Converting ciencias-deporte-120x103.jpg to WebP succeeded. +[2026-10-06 05:14:53][notice] Start WebP conversion ciencias-deporte-700x200.jpg +[2026-10-06 05:14:53][notice] Converting ciencias-deporte-700x200.jpg to WebP succeeded. +[2026-10-06 05:14:53][notice] Start WebP conversion ciencias-deporte-700x400.jpg +[2026-10-06 05:14:53][notice] Converting ciencias-deporte-700x400.jpg to WebP succeeded. +[2026-10-06 05:14:53][notice] Start WebP conversion ciencias-deporte-900x1100.jpg +[2026-10-06 05:14:53][notice] Converting ciencias-deporte-900x1100.jpg to WebP succeeded. +[2026-10-06 05:14:53][notice] Start WebP conversion ciencias-deporte-140x120.jpg +[2026-10-06 05:14:53][notice] Converting ciencias-deporte-140x120.jpg to WebP succeeded. +[2026-10-06 05:14:53][notice] Start AVIF conversion:ciencias-deporte.jpg +[2026-10-06 05:15:02][notice] Converting ciencias-deporte.jpg to AVIF succeeded. +[2026-10-06 05:15:02][notice] Start AVIF conversion:ciencias-deporte-250x214.jpg +[2026-10-06 05:15:03][notice] Converting ciencias-deporte-250x214.jpg to AVIF succeeded. +[2026-10-06 05:15:03][notice] Start AVIF conversion:ciencias-deporte-700x599.jpg +[2026-10-06 05:15:06][notice] Converting ciencias-deporte-700x599.jpg to AVIF succeeded. +[2026-10-06 05:15:06][notice] Start AVIF conversion:ciencias-deporte-150x150.jpg +[2026-10-06 05:15:07][notice] Converting ciencias-deporte-150x150.jpg to AVIF succeeded. +[2026-10-06 05:15:07][notice] Start AVIF conversion:ciencias-deporte-768x657.jpg +[2026-10-06 05:15:10][notice] Converting ciencias-deporte-768x657.jpg to AVIF succeeded. +[2026-10-06 05:15:10][notice] Start AVIF conversion:ciencias-deporte-1536x1313.jpg +[2026-10-06 05:15:16][notice] Converting ciencias-deporte-1536x1313.jpg to AVIF succeeded. +[2026-10-06 05:15:16][notice] Start AVIF conversion:ciencias-deporte-120x103.jpg +[2026-10-06 05:15:17][notice] Converting ciencias-deporte-120x103.jpg to AVIF succeeded. +[2026-10-06 05:15:17][notice] Start AVIF conversion:ciencias-deporte-700x200.jpg +[2026-10-06 05:15:19][notice] Converting ciencias-deporte-700x200.jpg to AVIF succeeded. +[2026-10-06 05:15:19][notice] Start AVIF conversion:ciencias-deporte-700x400.jpg +[2026-10-06 05:15:21][notice] Converting ciencias-deporte-700x400.jpg to AVIF succeeded. +[2026-10-06 05:15:21][notice] Start AVIF conversion:ciencias-deporte-900x1100.jpg +[2026-10-06 05:15:26][notice] Converting ciencias-deporte-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:15:26][notice] Start AVIF conversion:ciencias-deporte-140x120.jpg +[2026-10-06 05:15:27][notice] Converting ciencias-deporte-140x120.jpg to AVIF succeeded. +[2026-10-06 05:15:30][notice]Add attachment images id:19 +==================================================== +open log file: 2026-10-06 05:15:30 +[2026-10-06 05:15:30][notice]Start optimizing new media images id:19 +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports.jpg +[2026-10-06 05:15:30][notice] Converting business-sports.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-250x197.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-250x197.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-700x551.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-700x551.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-150x150.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-150x150.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-768x605.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-768x605.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-1536x1210.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-1536x1210.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-120x95.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-120x95.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-700x200.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-700x200.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-700x400.jpg +[2026-10-06 05:15:30][notice] Converting business-sports-700x400.jpg to WebP succeeded. +[2026-10-06 05:15:30][notice] Start WebP conversion business-sports-900x1100.jpg +[2026-10-06 05:15:31][notice] Converting business-sports-900x1100.jpg to WebP succeeded. +[2026-10-06 05:15:31][notice] Start WebP conversion business-sports-152x120.jpg +[2026-10-06 05:15:31][notice] Converting business-sports-152x120.jpg to WebP succeeded. +[2026-10-06 05:15:31][notice] Start AVIF conversion:business-sports.jpg +[2026-10-06 05:15:38][notice] Converting business-sports.jpg to AVIF succeeded. +[2026-10-06 05:15:38][notice] Start AVIF conversion:business-sports-250x197.jpg +[2026-10-06 05:15:38][notice] Converting business-sports-250x197.jpg to AVIF succeeded. +[2026-10-06 05:15:38][notice] Start AVIF conversion:business-sports-700x551.jpg +[2026-10-06 05:15:41][notice] Converting business-sports-700x551.jpg to AVIF succeeded. +[2026-10-06 05:15:41][notice] Start AVIF conversion:business-sports-150x150.jpg +[2026-10-06 05:15:41][notice] Converting business-sports-150x150.jpg to AVIF succeeded. +[2026-10-06 05:15:41][notice] Start AVIF conversion:business-sports-768x605.jpg +[2026-10-06 05:15:43][notice] Converting business-sports-768x605.jpg to AVIF succeeded. +[2026-10-06 05:15:43][notice] Start AVIF conversion:business-sports-1536x1210.jpg +[2026-10-06 05:15:48][notice] Converting business-sports-1536x1210.jpg to AVIF succeeded. +[2026-10-06 05:15:48][notice] Start AVIF conversion:business-sports-120x95.jpg +[2026-10-06 05:15:49][notice] Converting business-sports-120x95.jpg to AVIF succeeded. +[2026-10-06 05:15:49][notice] Start AVIF conversion:business-sports-700x200.jpg +[2026-10-06 05:15:50][notice] Converting business-sports-700x200.jpg to AVIF succeeded. +[2026-10-06 05:15:50][notice] Start AVIF conversion:business-sports-700x400.jpg +[2026-10-06 05:15:51][notice] Converting business-sports-700x400.jpg to AVIF succeeded. +[2026-10-06 05:15:51][notice] Start AVIF conversion:business-sports-900x1100.jpg +[2026-10-06 05:15:54][notice] Converting business-sports-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:15:54][notice] Start AVIF conversion:business-sports-152x120.jpg +[2026-10-06 05:15:55][notice] Converting business-sports-152x120.jpg to AVIF succeeded. +[2026-10-06 05:15:57][notice]Add attachment images id:20 +==================================================== +open log file: 2026-10-06 05:15:57 +[2026-10-06 05:15:57][notice]Start optimizing new media images id:20 +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-250x185.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-250x185.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-700x519.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-700x519.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-150x150.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-150x150.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-768x570.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-768x570.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-1536x1139.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-1536x1139.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-120x89.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-120x89.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-700x200.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-700x200.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-700x400.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-700x400.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-900x1100.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-900x1100.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start WebP conversion fisioterapia-162x120.jpg +[2026-10-06 05:15:57][notice] Converting fisioterapia-162x120.jpg to WebP succeeded. +[2026-10-06 05:15:57][notice] Start AVIF conversion:fisioterapia.jpg +[2026-10-06 05:16:02][notice] Converting fisioterapia.jpg to AVIF succeeded. +[2026-10-06 05:16:02][notice] Start AVIF conversion:fisioterapia-250x185.jpg +[2026-10-06 05:16:02][notice] Converting fisioterapia-250x185.jpg to AVIF succeeded. +[2026-10-06 05:16:02][notice] Start AVIF conversion:fisioterapia-700x519.jpg +[2026-10-06 05:16:04][notice] Converting fisioterapia-700x519.jpg to AVIF succeeded. +[2026-10-06 05:16:04][notice] Start AVIF conversion:fisioterapia-150x150.jpg +[2026-10-06 05:16:04][notice] Converting fisioterapia-150x150.jpg to AVIF succeeded. +[2026-10-06 05:16:04][notice] Start AVIF conversion:fisioterapia-768x570.jpg +[2026-10-06 05:16:06][notice] Converting fisioterapia-768x570.jpg to AVIF succeeded. +[2026-10-06 05:16:06][notice] Start AVIF conversion:fisioterapia-1536x1139.jpg +[2026-10-06 05:16:09][notice] Converting fisioterapia-1536x1139.jpg to AVIF succeeded. +[2026-10-06 05:16:09][notice] Start AVIF conversion:fisioterapia-120x89.jpg +[2026-10-06 05:16:10][notice] Converting fisioterapia-120x89.jpg to AVIF succeeded. +[2026-10-06 05:16:10][notice] Start AVIF conversion:fisioterapia-700x200.jpg +[2026-10-06 05:16:11][notice] Converting fisioterapia-700x200.jpg to AVIF succeeded. +[2026-10-06 05:16:11][notice] Start AVIF conversion:fisioterapia-700x400.jpg +[2026-10-06 05:16:12][notice] Converting fisioterapia-700x400.jpg to AVIF succeeded. +[2026-10-06 05:16:12][notice] Start AVIF conversion:fisioterapia-900x1100.jpg +[2026-10-06 05:16:15][notice] Converting fisioterapia-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:16:15][notice] Start AVIF conversion:fisioterapia-162x120.jpg +[2026-10-06 05:16:15][notice] Converting fisioterapia-162x120.jpg to AVIF succeeded. +[2026-10-06 05:16:17][notice]Add attachment images id:21 +==================================================== +open log file: 2026-10-06 05:16:17 +[2026-10-06 05:16:17][notice]Start optimizing new media images id:21 +[2026-10-06 05:16:17][notice] Start WebP conversion produccion-musical.jpg +[2026-10-06 05:16:17][notice] Converting produccion-musical.jpg to WebP succeeded. +[2026-10-06 05:16:17][notice] Start WebP conversion produccion-musical-250x175.jpg +[2026-10-06 05:16:17][notice] Converting produccion-musical-250x175.jpg to WebP succeeded. +[2026-10-06 05:16:17][notice] Start WebP conversion produccion-musical-700x490.jpg +[2026-10-06 05:16:17][notice] Converting produccion-musical-700x490.jpg to WebP succeeded. +[2026-10-06 05:16:17][notice] Start WebP conversion produccion-musical-150x150.jpg +[2026-10-06 05:16:17][notice] Converting produccion-musical-150x150.jpg to WebP succeeded. +[2026-10-06 05:16:17][notice] Start WebP conversion produccion-musical-768x538.jpg +[2026-10-06 05:16:17][notice] Converting produccion-musical-768x538.jpg to WebP succeeded. +[2026-10-06 05:16:17][notice] Start WebP conversion produccion-musical-1536x1076.jpg +[2026-10-06 05:16:18][notice] Converting produccion-musical-1536x1076.jpg to WebP succeeded. +[2026-10-06 05:16:18][notice] Start WebP conversion produccion-musical-120x84.jpg +[2026-10-06 05:16:18][notice] Converting produccion-musical-120x84.jpg to WebP succeeded. +[2026-10-06 05:16:18][notice] Start WebP conversion produccion-musical-700x200.jpg +[2026-10-06 05:16:18][notice] Converting produccion-musical-700x200.jpg to WebP succeeded. +[2026-10-06 05:16:18][notice] Start WebP conversion produccion-musical-700x400.jpg +[2026-10-06 05:16:18][notice] Converting produccion-musical-700x400.jpg to WebP succeeded. +[2026-10-06 05:16:18][notice] Start WebP conversion produccion-musical-900x1100.jpg +[2026-10-06 05:16:18][notice] Converting produccion-musical-900x1100.jpg to WebP succeeded. +[2026-10-06 05:16:18][notice] Start WebP conversion produccion-musical-171x120.jpg +[2026-10-06 05:16:18][notice] Converting produccion-musical-171x120.jpg to WebP succeeded. +[2026-10-06 05:16:18][notice] Start AVIF conversion:produccion-musical.jpg +[2026-10-06 05:16:23][notice] Converting produccion-musical.jpg to AVIF succeeded. +[2026-10-06 05:16:23][notice] Start AVIF conversion:produccion-musical-250x175.jpg +[2026-10-06 05:16:24][notice] Converting produccion-musical-250x175.jpg to AVIF succeeded. +[2026-10-06 05:16:24][notice] Start AVIF conversion:produccion-musical-700x490.jpg +[2026-10-06 05:16:26][notice] Converting produccion-musical-700x490.jpg to AVIF succeeded. +[2026-10-06 05:16:26][notice] Start AVIF conversion:produccion-musical-150x150.jpg +[2026-10-06 05:16:26][notice] Converting produccion-musical-150x150.jpg to AVIF succeeded. +[2026-10-06 05:16:26][notice] Start AVIF conversion:produccion-musical-768x538.jpg +[2026-10-06 05:16:28][notice] Converting produccion-musical-768x538.jpg to AVIF succeeded. +[2026-10-06 05:16:28][notice] Start AVIF conversion:produccion-musical-1536x1076.jpg +[2026-10-06 05:16:34][notice] Converting produccion-musical-1536x1076.jpg to AVIF succeeded. +[2026-10-06 05:16:34][notice] Start AVIF conversion:produccion-musical-120x84.jpg +[2026-10-06 05:16:34][notice] Converting produccion-musical-120x84.jpg to AVIF succeeded. +[2026-10-06 05:16:34][notice] Start AVIF conversion:produccion-musical-700x200.jpg +[2026-10-06 05:16:34][notice] Converting produccion-musical-700x200.jpg to AVIF succeeded. +[2026-10-06 05:16:34][notice] Start AVIF conversion:produccion-musical-700x400.jpg +[2026-10-06 05:16:36][notice] Converting produccion-musical-700x400.jpg to AVIF succeeded. +[2026-10-06 05:16:36][notice] Start AVIF conversion:produccion-musical-900x1100.jpg +[2026-10-06 05:16:40][notice] Converting produccion-musical-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:16:40][notice] Start AVIF conversion:produccion-musical-171x120.jpg +[2026-10-06 05:16:40][notice] Converting produccion-musical-171x120.jpg to AVIF succeeded. +[2026-10-06 05:16:43][notice]Add attachment images id:22 +==================================================== +open log file: 2026-10-06 05:16:43 +[2026-10-06 05:16:43][notice]Start optimizing new media images id:22 +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-250x193.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-250x193.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-700x540.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-700x540.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-150x150.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-150x150.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-768x592.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-768x592.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-1536x1184.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-1536x1184.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-120x93.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-120x93.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-700x200.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-700x200.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-700x400.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-700x400.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-900x1100.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-900x1100.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start WebP conversion audiovisual-156x120.jpg +[2026-10-06 05:16:43][notice] Converting audiovisual-156x120.jpg to WebP succeeded. +[2026-10-06 05:16:43][notice] Start AVIF conversion:audiovisual.jpg +[2026-10-06 05:16:49][notice] Converting audiovisual.jpg to AVIF succeeded. +[2026-10-06 05:16:49][notice] Start AVIF conversion:audiovisual-250x193.jpg +[2026-10-06 05:16:50][notice] Converting audiovisual-250x193.jpg to AVIF succeeded. +[2026-10-06 05:16:50][notice] Start AVIF conversion:audiovisual-700x540.jpg +[2026-10-06 05:16:52][notice] Converting audiovisual-700x540.jpg to AVIF succeeded. +[2026-10-06 05:16:52][notice] Start AVIF conversion:audiovisual-150x150.jpg +[2026-10-06 05:16:53][notice] Converting audiovisual-150x150.jpg to AVIF succeeded. +[2026-10-06 05:16:53][notice] Start AVIF conversion:audiovisual-768x592.jpg +[2026-10-06 05:16:55][notice] Converting audiovisual-768x592.jpg to AVIF succeeded. +[2026-10-06 05:16:55][notice] Start AVIF conversion:audiovisual-1536x1184.jpg +[2026-10-06 05:17:01][notice] Converting audiovisual-1536x1184.jpg to AVIF succeeded. +[2026-10-06 05:17:01][notice] Start AVIF conversion:audiovisual-120x93.jpg +[2026-10-06 05:17:01][notice] Converting audiovisual-120x93.jpg to AVIF succeeded. +[2026-10-06 05:17:01][notice] Start AVIF conversion:audiovisual-700x200.jpg +[2026-10-06 05:17:03][notice] Converting audiovisual-700x200.jpg to AVIF succeeded. +[2026-10-06 05:17:03][notice] Start AVIF conversion:audiovisual-700x400.jpg +[2026-10-06 05:17:05][notice] Converting audiovisual-700x400.jpg to AVIF succeeded. +[2026-10-06 05:17:05][notice] Start AVIF conversion:audiovisual-900x1100.jpg +[2026-10-06 05:17:10][notice] Converting audiovisual-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:17:10][notice] Start AVIF conversion:audiovisual-156x120.jpg +[2026-10-06 05:17:10][notice] Converting audiovisual-156x120.jpg to AVIF succeeded. +[2026-10-06 05:17:12][notice]Add attachment images id:23 +==================================================== +open log file: 2026-10-06 05:17:12 +[2026-10-06 05:17:12][notice]Start optimizing new media images id:23 +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-250x175.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-250x175.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-700x490.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-700x490.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-150x150.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-150x150.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-768x538.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-768x538.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-1536x1075.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-1536x1075.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-120x84.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-120x84.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-700x200.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-700x200.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-700x400.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-700x400.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-900x1100.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-900x1100.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start WebP conversion creacion-artistica-171x120.jpg +[2026-10-06 05:17:12][notice] Converting creacion-artistica-171x120.jpg to WebP succeeded. +[2026-10-06 05:17:12][notice] Start AVIF conversion:creacion-artistica.jpg +[2026-10-06 05:17:17][notice] Converting creacion-artistica.jpg to AVIF succeeded. +[2026-10-06 05:17:17][notice] Start AVIF conversion:creacion-artistica-250x175.jpg +[2026-10-06 05:17:17][notice] Converting creacion-artistica-250x175.jpg to AVIF succeeded. +[2026-10-06 05:17:17][notice] Start AVIF conversion:creacion-artistica-700x490.jpg +[2026-10-06 05:17:19][notice] Converting creacion-artistica-700x490.jpg to AVIF succeeded. +[2026-10-06 05:17:19][notice] Start AVIF conversion:creacion-artistica-150x150.jpg +[2026-10-06 05:17:19][notice] Converting creacion-artistica-150x150.jpg to AVIF succeeded. +[2026-10-06 05:17:19][notice] Start AVIF conversion:creacion-artistica-768x538.jpg +[2026-10-06 05:17:21][notice] Converting creacion-artistica-768x538.jpg to AVIF succeeded. +[2026-10-06 05:17:21][notice] Start AVIF conversion:creacion-artistica-1536x1075.jpg +[2026-10-06 05:17:24][notice] Converting creacion-artistica-1536x1075.jpg to AVIF succeeded. +[2026-10-06 05:17:24][notice] Start AVIF conversion:creacion-artistica-120x84.jpg +[2026-10-06 05:17:24][notice] Converting creacion-artistica-120x84.jpg to AVIF succeeded. +[2026-10-06 05:17:24][notice] Start AVIF conversion:creacion-artistica-700x200.jpg +[2026-10-06 05:17:26][notice] Converting creacion-artistica-700x200.jpg to AVIF succeeded. +[2026-10-06 05:17:26][notice] Start AVIF conversion:creacion-artistica-700x400.jpg +[2026-10-06 05:17:27][notice] Converting creacion-artistica-700x400.jpg to AVIF succeeded. +[2026-10-06 05:17:27][notice] Start AVIF conversion:creacion-artistica-900x1100.jpg +[2026-10-06 05:17:30][notice] Converting creacion-artistica-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:17:30][notice] Start AVIF conversion:creacion-artistica-171x120.jpg +[2026-10-06 05:17:31][notice] Converting creacion-artistica-171x120.jpg to AVIF succeeded. +[2026-10-06 05:17:33][notice]Add attachment images id:24 +==================================================== +open log file: 2026-10-06 05:17:33 +[2026-10-06 05:17:33][notice]Start optimizing new media images id:24 +[2026-10-06 05:17:33][notice] Start WebP conversion software.jpg +[2026-10-06 05:17:33][notice] Converting software.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-250x171.jpg +[2026-10-06 05:17:33][notice] Converting software-250x171.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-700x480.jpg +[2026-10-06 05:17:33][notice] Converting software-700x480.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-150x150.jpg +[2026-10-06 05:17:33][notice] Converting software-150x150.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-768x526.jpg +[2026-10-06 05:17:33][notice] Converting software-768x526.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-1536x1052.jpg +[2026-10-06 05:17:33][notice] Converting software-1536x1052.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-120x82.jpg +[2026-10-06 05:17:33][notice] Converting software-120x82.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-700x200.jpg +[2026-10-06 05:17:33][notice] Converting software-700x200.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-700x400.jpg +[2026-10-06 05:17:33][notice] Converting software-700x400.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-900x1100.jpg +[2026-10-06 05:17:33][notice] Converting software-900x1100.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start WebP conversion software-175x120.jpg +[2026-10-06 05:17:33][notice] Converting software-175x120.jpg to WebP succeeded. +[2026-10-06 05:17:33][notice] Start AVIF conversion:software.jpg +[2026-10-06 05:17:39][notice] Converting software.jpg to AVIF succeeded. +[2026-10-06 05:17:39][notice] Start AVIF conversion:software-250x171.jpg +[2026-10-06 05:17:39][notice] Converting software-250x171.jpg to AVIF succeeded. +[2026-10-06 05:17:39][notice] Start AVIF conversion:software-700x480.jpg +[2026-10-06 05:17:41][notice] Converting software-700x480.jpg to AVIF succeeded. +[2026-10-06 05:17:41][notice] Start AVIF conversion:software-150x150.jpg +[2026-10-06 05:17:41][notice] Converting software-150x150.jpg to AVIF succeeded. +[2026-10-06 05:17:41][notice] Start AVIF conversion:software-768x526.jpg +[2026-10-06 05:17:44][notice] Converting software-768x526.jpg to AVIF succeeded. +[2026-10-06 05:17:44][notice] Start AVIF conversion:software-1536x1052.jpg +[2026-10-06 05:17:49][notice] Converting software-1536x1052.jpg to AVIF succeeded. +[2026-10-06 05:17:49][notice] Start AVIF conversion:software-120x82.jpg +[2026-10-06 05:17:49][notice] Converting software-120x82.jpg to AVIF succeeded. +[2026-10-06 05:17:49][notice] Start AVIF conversion:software-700x200.jpg +[2026-10-06 05:17:50][notice] Converting software-700x200.jpg to AVIF succeeded. +[2026-10-06 05:17:50][notice] Start AVIF conversion:software-700x400.jpg +[2026-10-06 05:17:52][notice] Converting software-700x400.jpg to AVIF succeeded. +[2026-10-06 05:17:52][notice] Start AVIF conversion:software-900x1100.jpg +[2026-10-06 05:17:56][notice] Converting software-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:17:56][notice] Start AVIF conversion:software-175x120.jpg +[2026-10-06 05:17:56][notice] Converting software-175x120.jpg to AVIF succeeded. +[2026-10-06 05:17:58][notice]Add attachment images id:25 +==================================================== +open log file: 2026-10-06 05:17:58 +[2026-10-06 05:17:58][notice]Start optimizing new media images id:25 +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-250x189.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-250x189.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-700x529.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-700x529.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-150x150.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-150x150.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-768x580.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-768x580.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-1536x1160.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-1536x1160.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-120x91.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-120x91.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-700x200.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-700x200.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-700x400.jpg +[2026-10-06 05:17:58][notice] Converting ciberseguridad-700x400.jpg to WebP succeeded. +[2026-10-06 05:17:58][notice] Start WebP conversion ciberseguridad-900x1100.jpg +[2026-10-06 05:17:59][notice] Converting ciberseguridad-900x1100.jpg to WebP succeeded. +[2026-10-06 05:17:59][notice] Start WebP conversion ciberseguridad-159x120.jpg +[2026-10-06 05:17:59][notice] Converting ciberseguridad-159x120.jpg to WebP succeeded. +[2026-10-06 05:17:59][notice] Start AVIF conversion:ciberseguridad.jpg +[2026-10-06 05:18:04][notice] Converting ciberseguridad.jpg to AVIF succeeded. +[2026-10-06 05:18:04][notice] Start AVIF conversion:ciberseguridad-250x189.jpg +[2026-10-06 05:18:05][notice] Converting ciberseguridad-250x189.jpg to AVIF succeeded. +[2026-10-06 05:18:05][notice] Start AVIF conversion:ciberseguridad-700x529.jpg +[2026-10-06 05:18:06][notice] Converting ciberseguridad-700x529.jpg to AVIF succeeded. +[2026-10-06 05:18:06][notice] Start AVIF conversion:ciberseguridad-150x150.jpg +[2026-10-06 05:18:07][notice] Converting ciberseguridad-150x150.jpg to AVIF succeeded. +[2026-10-06 05:18:07][notice] Start AVIF conversion:ciberseguridad-768x580.jpg +[2026-10-06 05:18:09][notice] Converting ciberseguridad-768x580.jpg to AVIF succeeded. +[2026-10-06 05:18:09][notice] Start AVIF conversion:ciberseguridad-1536x1160.jpg +[2026-10-06 05:18:18][notice] Converting ciberseguridad-1536x1160.jpg to AVIF succeeded. +[2026-10-06 05:18:18][notice] Start AVIF conversion:ciberseguridad-120x91.jpg +[2026-10-06 05:18:19][notice] Converting ciberseguridad-120x91.jpg to AVIF succeeded. +[2026-10-06 05:18:19][notice] Start AVIF conversion:ciberseguridad-700x200.jpg +[2026-10-06 05:18:22][notice] Converting ciberseguridad-700x200.jpg to AVIF succeeded. +[2026-10-06 05:18:22][notice] Start AVIF conversion:ciberseguridad-700x400.jpg +[2026-10-06 05:18:25][notice] Converting ciberseguridad-700x400.jpg to AVIF succeeded. +[2026-10-06 05:18:25][notice] Start AVIF conversion:ciberseguridad-900x1100.jpg +[2026-10-06 05:18:31][notice] Converting ciberseguridad-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:18:31][notice] Start AVIF conversion:ciberseguridad-159x120.jpg +[2026-10-06 05:18:31][notice] Converting ciberseguridad-159x120.jpg to AVIF succeeded. +[2026-10-06 05:18:35][notice]Add attachment images id:26 +==================================================== +open log file: 2026-10-06 05:18:35 +[2026-10-06 05:18:35][notice]Start optimizing new media images id:26 +[2026-10-06 05:18:35][notice] Start WebP conversion periodismo.jpg +[2026-10-06 05:18:35][notice] Converting periodismo.jpg to WebP succeeded. +[2026-10-06 05:18:35][notice] Start WebP conversion periodismo-250x188.jpg +[2026-10-06 05:18:35][notice] Converting periodismo-250x188.jpg to WebP succeeded. +[2026-10-06 05:18:35][notice] Start WebP conversion periodismo-700x526.jpg +[2026-10-06 05:18:35][notice] Converting periodismo-700x526.jpg to WebP succeeded. +[2026-10-06 05:18:35][notice] Start WebP conversion periodismo-150x150.jpg +[2026-10-06 05:18:35][notice] Converting periodismo-150x150.jpg to WebP succeeded. +[2026-10-06 05:18:35][notice] Start WebP conversion periodismo-768x577.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-768x577.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start WebP conversion periodismo-1536x1154.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-1536x1154.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start WebP conversion periodismo-120x90.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-120x90.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start WebP conversion periodismo-700x200.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-700x200.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start WebP conversion periodismo-700x400.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-700x400.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start WebP conversion periodismo-900x1100.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-900x1100.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start WebP conversion periodismo-160x120.jpg +[2026-10-06 05:18:36][notice] Converting periodismo-160x120.jpg to WebP succeeded. +[2026-10-06 05:18:36][notice] Start AVIF conversion:periodismo.jpg +[2026-10-06 05:18:44][notice] Converting periodismo.jpg to AVIF succeeded. +[2026-10-06 05:18:44][notice] Start AVIF conversion:periodismo-250x188.jpg +[2026-10-06 05:18:45][notice] Converting periodismo-250x188.jpg to AVIF succeeded. +[2026-10-06 05:18:45][notice] Start AVIF conversion:periodismo-700x526.jpg +[2026-10-06 05:18:50][notice] Converting periodismo-700x526.jpg to AVIF succeeded. +[2026-10-06 05:18:50][notice] Start AVIF conversion:periodismo-150x150.jpg +[2026-10-06 05:18:51][notice] Converting periodismo-150x150.jpg to AVIF succeeded. +[2026-10-06 05:18:51][notice] Start AVIF conversion:periodismo-768x577.jpg +[2026-10-06 05:18:56][notice] Converting periodismo-768x577.jpg to AVIF succeeded. +[2026-10-06 05:18:56][notice] Start AVIF conversion:periodismo-1536x1154.jpg +[2026-10-06 05:19:08][notice] Converting periodismo-1536x1154.jpg to AVIF succeeded. +[2026-10-06 05:19:08][notice] Start AVIF conversion:periodismo-120x90.jpg +[2026-10-06 05:19:08][notice] Converting periodismo-120x90.jpg to AVIF succeeded. +[2026-10-06 05:19:08][notice] Start AVIF conversion:periodismo-700x200.jpg +[2026-10-06 05:19:10][notice] Converting periodismo-700x200.jpg to AVIF succeeded. +[2026-10-06 05:19:10][notice] Start AVIF conversion:periodismo-700x400.jpg +[2026-10-06 05:19:14][notice] Converting periodismo-700x400.jpg to AVIF succeeded. +[2026-10-06 05:19:14][notice] Start AVIF conversion:periodismo-900x1100.jpg +[2026-10-06 05:19:17][notice] Converting periodismo-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:19:17][notice] Start AVIF conversion:periodismo-160x120.jpg +[2026-10-06 05:19:17][notice] Converting periodismo-160x120.jpg to AVIF succeeded. +[2026-10-06 05:19:20][notice]Add attachment images id:27 +==================================================== +open log file: 2026-10-06 05:19:20 +[2026-10-06 05:19:20][notice]Start optimizing new media images id:27 +[2026-10-06 05:19:20][notice] Start WebP conversion readaptacion.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-250x160.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-250x160.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-700x447.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-700x447.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-150x150.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-150x150.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-768x491.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-768x491.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-1536x981.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-1536x981.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-120x77.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-120x77.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-700x200.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-700x200.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-700x400.jpg +[2026-10-06 05:19:21][notice] Converting readaptacion-700x400.jpg to WebP succeeded. +[2026-10-06 05:19:21][notice] Start WebP conversion readaptacion-900x1100.jpg +[2026-10-06 05:19:22][notice] Converting readaptacion-900x1100.jpg to WebP succeeded. +[2026-10-06 05:19:22][notice] Start WebP conversion readaptacion-188x120.jpg +[2026-10-06 05:19:22][notice] Converting readaptacion-188x120.jpg to WebP succeeded. +[2026-10-06 05:19:22][notice] Start AVIF conversion:readaptacion.jpg +[2026-10-06 05:19:30][notice] Converting readaptacion.jpg to AVIF succeeded. +[2026-10-06 05:19:30][notice] Start AVIF conversion:readaptacion-250x160.jpg +[2026-10-06 05:19:31][notice] Converting readaptacion-250x160.jpg to AVIF succeeded. +[2026-10-06 05:19:31][notice] Start AVIF conversion:readaptacion-700x447.jpg +[2026-10-06 05:19:35][notice] Converting readaptacion-700x447.jpg to AVIF succeeded. +[2026-10-06 05:19:35][notice] Start AVIF conversion:readaptacion-150x150.jpg +[2026-10-06 05:19:36][notice] Converting readaptacion-150x150.jpg to AVIF succeeded. +[2026-10-06 05:19:36][notice] Start AVIF conversion:readaptacion-768x491.jpg +[2026-10-06 05:19:40][notice] Converting readaptacion-768x491.jpg to AVIF succeeded. +[2026-10-06 05:19:40][notice] Start AVIF conversion:readaptacion-1536x981.jpg +[2026-10-06 05:19:48][notice] Converting readaptacion-1536x981.jpg to AVIF succeeded. +[2026-10-06 05:19:48][notice] Start AVIF conversion:readaptacion-120x77.jpg +[2026-10-06 05:19:48][notice] Converting readaptacion-120x77.jpg to AVIF succeeded. +[2026-10-06 05:19:48][notice] Start AVIF conversion:readaptacion-700x200.jpg +[2026-10-06 05:19:51][notice] Converting readaptacion-700x200.jpg to AVIF succeeded. +[2026-10-06 05:19:51][notice] Start AVIF conversion:readaptacion-700x400.jpg +[2026-10-06 05:19:54][notice] Converting readaptacion-700x400.jpg to AVIF succeeded. +[2026-10-06 05:19:54][notice] Start AVIF conversion:readaptacion-900x1100.jpg +[2026-10-06 05:20:01][notice] Converting readaptacion-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:20:01][notice] Start AVIF conversion:readaptacion-188x120.jpg +[2026-10-06 05:20:02][notice] Converting readaptacion-188x120.jpg to AVIF succeeded. +[2026-10-06 05:20:06][notice]Add attachment images id:28 +==================================================== +open log file: 2026-10-06 05:20:06 +[2026-10-06 05:20:06][notice]Start optimizing new media images id:28 +[2026-10-06 05:20:06][notice] Start WebP conversion negocios.jpg +[2026-10-06 05:20:07][notice] Converting negocios.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-250x168.jpg +[2026-10-06 05:20:07][notice] Converting negocios-250x168.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-700x471.jpg +[2026-10-06 05:20:07][notice] Converting negocios-700x471.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-150x150.jpg +[2026-10-06 05:20:07][notice] Converting negocios-150x150.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-768x516.jpg +[2026-10-06 05:20:07][notice] Converting negocios-768x516.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-1536x1033.jpg +[2026-10-06 05:20:07][notice] Converting negocios-1536x1033.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-120x81.jpg +[2026-10-06 05:20:07][notice] Converting negocios-120x81.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-700x200.jpg +[2026-10-06 05:20:07][notice] Converting negocios-700x200.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-700x400.jpg +[2026-10-06 05:20:07][notice] Converting negocios-700x400.jpg to WebP succeeded. +[2026-10-06 05:20:07][notice] Start WebP conversion negocios-900x1100.jpg +[2026-10-06 05:20:08][notice] Converting negocios-900x1100.jpg to WebP succeeded. +[2026-10-06 05:20:08][notice] Start WebP conversion negocios-179x120.jpg +[2026-10-06 05:20:08][notice] Converting negocios-179x120.jpg to WebP succeeded. +[2026-10-06 05:20:08][notice] Start AVIF conversion:negocios.jpg +[2026-10-06 05:20:19][notice] Converting negocios.jpg to AVIF succeeded. +[2026-10-06 05:20:19][notice] Start AVIF conversion:negocios-250x168.jpg +[2026-10-06 05:20:20][notice] Converting negocios-250x168.jpg to AVIF succeeded. +[2026-10-06 05:20:20][notice] Start AVIF conversion:negocios-700x471.jpg +[2026-10-06 05:20:23][notice] Converting negocios-700x471.jpg to AVIF succeeded. +[2026-10-06 05:20:23][notice] Start AVIF conversion:negocios-150x150.jpg +[2026-10-06 05:20:23][notice] Converting negocios-150x150.jpg to AVIF succeeded. +[2026-10-06 05:20:23][notice] Start AVIF conversion:negocios-768x516.jpg +[2026-10-06 05:20:26][notice] Converting negocios-768x516.jpg to AVIF succeeded. +[2026-10-06 05:20:26][notice] Start AVIF conversion:negocios-1536x1033.jpg +[2026-10-06 05:20:36][notice] Converting negocios-1536x1033.jpg to AVIF succeeded. +[2026-10-06 05:20:36][notice] Start AVIF conversion:negocios-120x81.jpg +[2026-10-06 05:20:36][notice] Converting negocios-120x81.jpg to AVIF succeeded. +[2026-10-06 05:20:36][notice] Start AVIF conversion:negocios-700x200.jpg +[2026-10-06 05:20:38][notice] Converting negocios-700x200.jpg to AVIF succeeded. +[2026-10-06 05:20:38][notice] Start AVIF conversion:negocios-700x400.jpg +[2026-10-06 05:20:40][notice] Converting negocios-700x400.jpg to AVIF succeeded. +[2026-10-06 05:20:40][notice] Start AVIF conversion:negocios-900x1100.jpg +[2026-10-06 05:20:47][notice] Converting negocios-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:20:47][notice] Start AVIF conversion:negocios-179x120.jpg +[2026-10-06 05:20:48][notice] Converting negocios-179x120.jpg to AVIF succeeded. +[2026-10-06 05:20:51][notice]Add attachment images id:29 +==================================================== +open log file: 2026-10-06 05:20:51 +[2026-10-06 05:20:51][notice]Start optimizing new media images id:29 +[2026-10-06 05:20:51][notice] Start WebP conversion fisio-suelo.jpg +[2026-10-06 05:20:52][notice] Converting fisio-suelo.jpg to WebP succeeded. +[2026-10-06 05:20:52][notice] Start WebP conversion fisio-suelo-250x245.jpg +[2026-10-06 05:20:52][notice] Converting fisio-suelo-250x245.jpg to WebP succeeded. +[2026-10-06 05:20:52][notice] Start WebP conversion fisio-suelo-700x685.jpg +[2026-10-06 05:20:52][notice] Converting fisio-suelo-700x685.jpg to WebP succeeded. +[2026-10-06 05:20:52][notice] Start WebP conversion fisio-suelo-150x150.jpg +[2026-10-06 05:20:52][notice] Converting fisio-suelo-150x150.jpg to WebP succeeded. +[2026-10-06 05:20:52][notice] Start WebP conversion fisio-suelo-768x752.jpg +[2026-10-06 05:20:52][notice] Converting fisio-suelo-768x752.jpg to WebP succeeded. +[2026-10-06 05:20:52][notice] Start WebP conversion fisio-suelo-1536x1504.jpg +[2026-10-06 05:20:53][notice] Converting fisio-suelo-1536x1504.jpg to WebP succeeded. +[2026-10-06 05:20:53][notice] Start WebP conversion fisio-suelo-120x117.jpg +[2026-10-06 05:20:53][notice] Converting fisio-suelo-120x117.jpg to WebP succeeded. +[2026-10-06 05:20:53][notice] Start WebP conversion fisio-suelo-700x200.jpg +[2026-10-06 05:20:53][notice] Converting fisio-suelo-700x200.jpg to WebP succeeded. +[2026-10-06 05:20:53][notice] Start WebP conversion fisio-suelo-700x400.jpg +[2026-10-06 05:20:53][notice] Converting fisio-suelo-700x400.jpg to WebP succeeded. +[2026-10-06 05:20:53][notice] Start WebP conversion fisio-suelo-900x1100.jpg +[2026-10-06 05:20:53][notice] Converting fisio-suelo-900x1100.jpg to WebP succeeded. +[2026-10-06 05:20:53][notice] Start WebP conversion fisio-suelo-123x120.jpg +[2026-10-06 05:20:53][notice] Converting fisio-suelo-123x120.jpg to WebP succeeded. +[2026-10-06 05:20:53][notice] Start AVIF conversion:fisio-suelo.jpg +[2026-10-06 05:21:04][notice] Converting fisio-suelo.jpg to AVIF succeeded. +[2026-10-06 05:21:04][notice] Start AVIF conversion:fisio-suelo-250x245.jpg +[2026-10-06 05:21:05][notice] Converting fisio-suelo-250x245.jpg to AVIF succeeded. +[2026-10-06 05:21:05][notice] Start AVIF conversion:fisio-suelo-700x685.jpg +[2026-10-06 05:21:09][notice] Converting fisio-suelo-700x685.jpg to AVIF succeeded. +[2026-10-06 05:21:09][notice] Start AVIF conversion:fisio-suelo-150x150.jpg +[2026-10-06 05:21:10][notice] Converting fisio-suelo-150x150.jpg to AVIF succeeded. +[2026-10-06 05:21:10][notice] Start AVIF conversion:fisio-suelo-768x752.jpg +[2026-10-06 05:21:16][notice] Converting fisio-suelo-768x752.jpg to AVIF succeeded. +[2026-10-06 05:21:16][notice] Start AVIF conversion:fisio-suelo-1536x1504.jpg +[2026-10-06 05:21:24][notice] Converting fisio-suelo-1536x1504.jpg to AVIF succeeded. +[2026-10-06 05:21:24][notice] Start AVIF conversion:fisio-suelo-120x117.jpg +[2026-10-06 05:21:24][notice] Converting fisio-suelo-120x117.jpg to AVIF succeeded. +[2026-10-06 05:21:24][notice] Start AVIF conversion:fisio-suelo-700x200.jpg +[2026-10-06 05:21:26][notice] Converting fisio-suelo-700x200.jpg to AVIF succeeded. +[2026-10-06 05:21:26][notice] Start AVIF conversion:fisio-suelo-700x400.jpg +[2026-10-06 05:21:28][notice] Converting fisio-suelo-700x400.jpg to AVIF succeeded. +[2026-10-06 05:21:28][notice] Start AVIF conversion:fisio-suelo-900x1100.jpg +[2026-10-06 05:21:34][notice] Converting fisio-suelo-900x1100.jpg to AVIF succeeded. +[2026-10-06 05:21:34][notice] Start AVIF conversion:fisio-suelo-123x120.jpg +[2026-10-06 05:21:34][notice] Converting fisio-suelo-123x120.jpg to AVIF succeeded. +[2026-10-06 05:21:37][notice]Add attachment images id:30 +==================================================== +open log file: 2026-10-06 05:21:37 +[2026-10-06 05:21:37][notice]Start optimizing new media images id:30 +[2026-10-06 05:21:37][notice] Start WebP conversion campus-valle.png +[2026-10-06 05:21:38][notice] Converting campus-valle.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-250x250.png +[2026-10-06 05:21:38][notice] Converting campus-valle-250x250.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-700x700.png +[2026-10-06 05:21:38][notice] Converting campus-valle-700x700.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-150x150.png +[2026-10-06 05:21:38][notice] Converting campus-valle-150x150.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-768x768.png +[2026-10-06 05:21:38][notice] Converting campus-valle-768x768.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-120x120.png +[2026-10-06 05:21:38][notice] Converting campus-valle-120x120.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-700x200.png +[2026-10-06 05:21:38][notice] Converting campus-valle-700x200.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-700x400.png +[2026-10-06 05:21:38][notice] Converting campus-valle-700x400.png to WebP succeeded. +[2026-10-06 05:21:38][notice] Start WebP conversion campus-valle-900x1024.png +[2026-10-06 05:21:39][notice] Converting campus-valle-900x1024.png to WebP succeeded. +[2026-10-06 05:21:39][notice] Start WebP conversion campus-valle-120x120.png +[2026-10-06 05:21:39][notice] Converting campus-valle-120x120.png to WebP succeeded. +[2026-10-06 05:21:39][notice] Start AVIF conversion:campus-valle.png +[2026-10-06 05:21:46][notice] Converting campus-valle.png to AVIF succeeded. +[2026-10-06 05:21:46][notice] Start AVIF conversion:campus-valle-250x250.png +[2026-10-06 05:21:47][notice] Converting campus-valle-250x250.png to AVIF succeeded. +[2026-10-06 05:21:47][notice] Start AVIF conversion:campus-valle-700x700.png +[2026-10-06 05:21:54][notice] Converting campus-valle-700x700.png to AVIF succeeded. +[2026-10-06 05:21:54][notice] Start AVIF conversion:campus-valle-150x150.png +[2026-10-06 05:21:55][notice] Converting campus-valle-150x150.png to AVIF succeeded. +[2026-10-06 05:21:55][notice] Start AVIF conversion:campus-valle-768x768.png +[2026-10-06 05:22:00][notice] Converting campus-valle-768x768.png to AVIF succeeded. +[2026-10-06 05:22:00][notice] Start AVIF conversion:campus-valle-120x120.png +[2026-10-06 05:22:00][notice] Converting campus-valle-120x120.png to AVIF succeeded. +[2026-10-06 05:22:00][notice] Start AVIF conversion:campus-valle-700x200.png +[2026-10-06 05:22:02][notice] Converting campus-valle-700x200.png to AVIF succeeded. +[2026-10-06 05:22:02][notice] Start AVIF conversion:campus-valle-700x400.png +[2026-10-06 05:22:04][notice] Converting campus-valle-700x400.png to AVIF succeeded. +[2026-10-06 05:22:04][notice] Start AVIF conversion:campus-valle-900x1024.png +[2026-10-06 05:22:09][notice] Converting campus-valle-900x1024.png to AVIF succeeded. +[2026-10-06 05:22:09][notice] Start AVIF conversion:campus-valle-120x120.png +[2026-10-06 05:22:09][notice] Converting campus-valle-120x120.png to AVIF succeeded. +[2026-10-06 05:22:12][notice]Add attachment images id:31 +==================================================== +open log file: 2026-10-06 05:22:12 +[2026-10-06 05:22:12][notice]Start optimizing new media images id:31 +[2026-10-06 05:22:12][notice] Start WebP conversion campus-zapopan.png +[2026-10-06 05:22:12][notice] Converting campus-zapopan.png to WebP succeeded. +[2026-10-06 05:22:12][notice] Start WebP conversion campus-zapopan-250x310.png +[2026-10-06 05:22:12][notice] Converting campus-zapopan-250x310.png to WebP succeeded. +[2026-10-06 05:22:12][notice] Start WebP conversion campus-zapopan-700x869.png +[2026-10-06 05:22:12][notice] Converting campus-zapopan-700x869.png to WebP succeeded. +[2026-10-06 05:22:12][notice] Start WebP conversion campus-zapopan-150x150.png +[2026-10-06 05:22:12][notice] Converting campus-zapopan-150x150.png to WebP succeeded. +[2026-10-06 05:22:12][notice] Start WebP conversion campus-zapopan-768x953.png +[2026-10-06 05:22:13][notice] Converting campus-zapopan-768x953.png to WebP succeeded. +[2026-10-06 05:22:13][notice] Start WebP conversion campus-zapopan-120x149.png +[2026-10-06 05:22:13][notice] Converting campus-zapopan-120x149.png to WebP succeeded. +[2026-10-06 05:22:13][notice] Start WebP conversion campus-zapopan-700x200.png +[2026-10-06 05:22:13][notice] Converting campus-zapopan-700x200.png to WebP succeeded. +[2026-10-06 05:22:13][notice] Start WebP conversion campus-zapopan-700x400.png +[2026-10-06 05:22:13][notice] Converting campus-zapopan-700x400.png to WebP succeeded. +[2026-10-06 05:22:13][notice] Start WebP conversion campus-zapopan-900x1100.png +[2026-10-06 05:22:13][notice] Converting campus-zapopan-900x1100.png to WebP succeeded. +[2026-10-06 05:22:13][notice] Start WebP conversion campus-zapopan-97x120.png +[2026-10-06 05:22:13][notice] Converting campus-zapopan-97x120.png to WebP succeeded. +[2026-10-06 05:22:13][notice] Start AVIF conversion:campus-zapopan.png +[2026-10-06 05:22:18][notice] Converting campus-zapopan.png to AVIF succeeded. +[2026-10-06 05:22:18][notice] Start AVIF conversion:campus-zapopan-250x310.png +[2026-10-06 05:22:19][notice] Converting campus-zapopan-250x310.png to AVIF succeeded. +[2026-10-06 05:22:19][notice] Start AVIF conversion:campus-zapopan-700x869.png +[2026-10-06 05:22:23][notice] Converting campus-zapopan-700x869.png to AVIF succeeded. +[2026-10-06 05:22:23][notice] Start AVIF conversion:campus-zapopan-150x150.png +[2026-10-06 05:22:23][notice] Converting campus-zapopan-150x150.png to AVIF succeeded. +[2026-10-06 05:22:23][notice] Start AVIF conversion:campus-zapopan-768x953.png +[2026-10-06 05:22:28][notice] Converting campus-zapopan-768x953.png to AVIF succeeded. +[2026-10-06 05:22:28][notice] Start AVIF conversion:campus-zapopan-120x149.png +[2026-10-06 05:22:28][notice] Converting campus-zapopan-120x149.png to AVIF succeeded. +[2026-10-06 05:22:28][notice] Start AVIF conversion:campus-zapopan-700x200.png +[2026-10-06 05:22:30][notice] Converting campus-zapopan-700x200.png to AVIF succeeded. +[2026-10-06 05:22:30][notice] Start AVIF conversion:campus-zapopan-700x400.png +[2026-10-06 05:22:32][notice] Converting campus-zapopan-700x400.png to AVIF succeeded. +[2026-10-06 05:22:32][notice] Start AVIF conversion:campus-zapopan-900x1100.png +[2026-10-06 05:22:36][notice] Converting campus-zapopan-900x1100.png to AVIF succeeded. +[2026-10-06 05:22:36][notice] Start AVIF conversion:campus-zapopan-97x120.png +[2026-10-06 05:22:36][notice] Converting campus-zapopan-97x120.png to AVIF succeeded. +[2026-10-06 05:22:39][notice]Add attachment images id:32 +==================================================== +open log file: 2026-10-06 05:22:39 +[2026-10-06 05:22:39][notice]Start optimizing new media images id:32 +[2026-10-06 05:22:39][notice] Start WebP conversion campus-satelite.png +[2026-10-06 05:22:39][notice] Converting campus-satelite.png to WebP succeeded. +[2026-10-06 05:22:39][notice] Start WebP conversion campus-satelite-250x310.png +[2026-10-06 05:22:39][notice] Converting campus-satelite-250x310.png to WebP succeeded. +[2026-10-06 05:22:39][notice] Start WebP conversion campus-satelite-700x869.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-700x869.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-150x150.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-150x150.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-768x953.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-768x953.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-120x149.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-120x149.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-700x200.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-700x200.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-700x400.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-700x400.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-900x1100.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-900x1100.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start WebP conversion campus-satelite-97x120.png +[2026-10-06 05:22:40][notice] Converting campus-satelite-97x120.png to WebP succeeded. +[2026-10-06 05:22:40][notice] Start AVIF conversion:campus-satelite.png +[2026-10-06 05:22:45][notice] Converting campus-satelite.png to AVIF succeeded. +[2026-10-06 05:22:45][notice] Start AVIF conversion:campus-satelite-250x310.png +[2026-10-06 05:22:46][notice] Converting campus-satelite-250x310.png to AVIF succeeded. +[2026-10-06 05:22:46][notice] Start AVIF conversion:campus-satelite-700x869.png +[2026-10-06 05:22:50][notice] Converting campus-satelite-700x869.png to AVIF succeeded. +[2026-10-06 05:22:50][notice] Start AVIF conversion:campus-satelite-150x150.png +[2026-10-06 05:22:51][notice] Converting campus-satelite-150x150.png to AVIF succeeded. +[2026-10-06 05:22:51][notice] Start AVIF conversion:campus-satelite-768x953.png +[2026-10-06 05:22:55][notice] Converting campus-satelite-768x953.png to AVIF succeeded. +[2026-10-06 05:22:55][notice] Start AVIF conversion:campus-satelite-120x149.png +[2026-10-06 05:22:56][notice] Converting campus-satelite-120x149.png to AVIF succeeded. +[2026-10-06 05:22:56][notice] Start AVIF conversion:campus-satelite-700x200.png +[2026-10-06 05:22:57][notice] Converting campus-satelite-700x200.png to AVIF succeeded. +[2026-10-06 05:22:57][notice] Start AVIF conversion:campus-satelite-700x400.png +[2026-10-06 05:23:03][notice] Converting campus-satelite-700x400.png to AVIF succeeded. +[2026-10-06 05:23:03][notice] Start AVIF conversion:campus-satelite-900x1100.png +[2026-10-06 05:23:15][notice] Converting campus-satelite-900x1100.png to AVIF succeeded. +[2026-10-06 05:23:15][notice] Start AVIF conversion:campus-satelite-97x120.png +[2026-10-06 05:23:16][notice] Converting campus-satelite-97x120.png to AVIF succeeded. +[2026-10-06 05:23:22][notice]Add attachment images id:33 +==================================================== +open log file: 2026-10-06 05:23:22 +[2026-10-06 05:23:22][notice]Start optimizing new media images id:33 +[2026-10-06 05:23:22][notice] Start WebP conversion campus-cholula.png +[2026-10-06 05:23:23][notice] Converting campus-cholula.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-250x310.png +[2026-10-06 05:23:23][notice] Converting campus-cholula-250x310.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-700x869.png +[2026-10-06 05:23:23][notice] Converting campus-cholula-700x869.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-150x150.png +[2026-10-06 05:23:23][notice] Converting campus-cholula-150x150.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-768x953.png +[2026-10-06 05:23:23][notice] Converting campus-cholula-768x953.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-120x149.png +[2026-10-06 05:23:23][notice] Converting campus-cholula-120x149.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-700x200.png +[2026-10-06 05:23:23][notice] Converting campus-cholula-700x200.png to WebP succeeded. +[2026-10-06 05:23:23][notice] Start WebP conversion campus-cholula-700x400.png +[2026-10-06 05:23:24][notice] Converting campus-cholula-700x400.png to WebP succeeded. +[2026-10-06 05:23:24][notice] Start WebP conversion campus-cholula-900x1100.png +[2026-10-06 05:23:24][notice] Converting campus-cholula-900x1100.png to WebP succeeded. +[2026-10-06 05:23:24][notice] Start WebP conversion campus-cholula-97x120.png +[2026-10-06 05:23:24][notice] Converting campus-cholula-97x120.png to WebP succeeded. +[2026-10-06 05:23:24][notice] Start AVIF conversion:campus-cholula.png +[2026-10-06 05:23:33][notice] Converting campus-cholula.png to AVIF succeeded. +[2026-10-06 05:23:33][notice] Start AVIF conversion:campus-cholula-250x310.png +[2026-10-06 05:23:35][notice] Converting campus-cholula-250x310.png to AVIF succeeded. +[2026-10-06 05:23:35][notice] Start AVIF conversion:campus-cholula-700x869.png +[2026-10-06 05:23:42][notice] Converting campus-cholula-700x869.png to AVIF succeeded. +[2026-10-06 05:23:42][notice] Start AVIF conversion:campus-cholula-150x150.png +[2026-10-06 05:23:43][notice] Converting campus-cholula-150x150.png to AVIF succeeded. +[2026-10-06 05:23:43][notice] Start AVIF conversion:campus-cholula-768x953.png +[2026-10-06 05:23:51][notice] Converting campus-cholula-768x953.png to AVIF succeeded. +[2026-10-06 05:23:51][notice] Start AVIF conversion:campus-cholula-120x149.png +[2026-10-06 05:23:51][notice] Converting campus-cholula-120x149.png to AVIF succeeded. +[2026-10-06 05:23:51][notice] Start AVIF conversion:campus-cholula-700x200.png +[2026-10-06 05:23:55][notice] Converting campus-cholula-700x200.png to AVIF succeeded. +[2026-10-06 05:23:55][notice] Start AVIF conversion:campus-cholula-700x400.png +[2026-10-06 05:23:59][notice] Converting campus-cholula-700x400.png to AVIF succeeded. +[2026-10-06 05:23:59][notice] Start AVIF conversion:campus-cholula-900x1100.png +[2026-10-06 05:24:06][notice] Converting campus-cholula-900x1100.png to AVIF succeeded. +[2026-10-06 05:24:06][notice] Start AVIF conversion:campus-cholula-97x120.png +[2026-10-06 05:24:07][notice] Converting campus-cholula-97x120.png to AVIF succeeded. +[2026-10-06 05:24:12][notice]Add attachment images id:34 +==================================================== +open log file: 2026-10-06 05:24:12 +[2026-10-06 05:24:12][notice]Start optimizing new media images id:34 +[2026-10-06 05:24:12][notice] Start WebP conversion campus-santafe.png +[2026-10-06 05:24:12][notice] Converting campus-santafe.png to WebP succeeded. +[2026-10-06 05:24:12][notice] Start WebP conversion campus-santafe-250x310.png +[2026-10-06 05:24:12][notice] Converting campus-santafe-250x310.png to WebP succeeded. +[2026-10-06 05:24:12][notice] Start WebP conversion campus-santafe-700x869.png +[2026-10-06 05:24:12][notice] Converting campus-santafe-700x869.png to WebP succeeded. +[2026-10-06 05:24:12][notice] Start WebP conversion campus-santafe-150x150.png +[2026-10-06 05:24:12][notice] Converting campus-santafe-150x150.png to WebP succeeded. +[2026-10-06 05:24:12][notice] Start WebP conversion campus-santafe-768x953.png +[2026-10-06 05:24:13][notice] Converting campus-santafe-768x953.png to WebP succeeded. +[2026-10-06 05:24:13][notice] Start WebP conversion campus-santafe-120x149.png +[2026-10-06 05:24:13][notice] Converting campus-santafe-120x149.png to WebP succeeded. +[2026-10-06 05:24:13][notice] Start WebP conversion campus-santafe-700x200.png +[2026-10-06 05:24:13][notice] Converting campus-santafe-700x200.png to WebP succeeded. +[2026-10-06 05:24:13][notice] Start WebP conversion campus-santafe-700x400.png +[2026-10-06 05:24:13][notice] Converting campus-santafe-700x400.png to WebP succeeded. +[2026-10-06 05:24:13][notice] Start WebP conversion campus-santafe-900x1100.png +[2026-10-06 05:24:13][notice] Converting campus-santafe-900x1100.png to WebP succeeded. +[2026-10-06 05:24:13][notice] Start WebP conversion campus-santafe-97x120.png +[2026-10-06 05:24:13][notice] Converting campus-santafe-97x120.png to WebP succeeded. +[2026-10-06 05:24:13][notice] Start AVIF conversion:campus-santafe.png +[2026-10-06 05:24:21][notice] Converting campus-santafe.png to AVIF succeeded. +[2026-10-06 05:24:21][notice] Start AVIF conversion:campus-santafe-250x310.png +[2026-10-06 05:24:23][notice] Converting campus-santafe-250x310.png to AVIF succeeded. +[2026-10-06 05:24:23][notice] Start AVIF conversion:campus-santafe-700x869.png +[2026-10-06 05:24:30][notice] Converting campus-santafe-700x869.png to AVIF succeeded. +[2026-10-06 05:24:30][notice] Start AVIF conversion:campus-santafe-150x150.png +[2026-10-06 05:24:31][notice] Converting campus-santafe-150x150.png to AVIF succeeded. +[2026-10-06 05:24:31][notice] Start AVIF conversion:campus-santafe-768x953.png +[2026-10-06 05:24:39][notice] Converting campus-santafe-768x953.png to AVIF succeeded. +[2026-10-06 05:24:39][notice] Start AVIF conversion:campus-santafe-120x149.png +[2026-10-06 05:24:40][notice] Converting campus-santafe-120x149.png to AVIF succeeded. +[2026-10-06 05:24:40][notice] Start AVIF conversion:campus-santafe-700x200.png +[2026-10-06 05:24:43][notice] Converting campus-santafe-700x200.png to AVIF succeeded. +[2026-10-06 05:24:43][notice] Start AVIF conversion:campus-santafe-700x400.png +[2026-10-06 05:24:47][notice] Converting campus-santafe-700x400.png to AVIF succeeded. +[2026-10-06 05:24:47][notice] Start AVIF conversion:campus-santafe-900x1100.png +[2026-10-06 05:24:55][notice] Converting campus-santafe-900x1100.png to AVIF succeeded. +[2026-10-06 05:24:55][notice] Start AVIF conversion:campus-santafe-97x120.png +[2026-10-06 05:24:55][notice] Converting campus-santafe-97x120.png to AVIF succeeded. +[2026-10-06 05:24:56][notice]Add attachment images id:35 +==================================================== +open log file: 2026-10-06 05:24:56 +[2026-10-06 05:24:56][notice]Start optimizing new media images id:35 +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1.png +[2026-10-06 05:24:56][notice] Converting partner-1.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-250x54.png +[2026-10-06 05:24:56][notice] Converting partner-1-250x54.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-700x152.png +[2026-10-06 05:24:56][notice] Converting partner-1-700x152.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-150x150.png +[2026-10-06 05:24:56][notice] Converting partner-1-150x150.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-768x167.png +[2026-10-06 05:24:56][notice] Converting partner-1-768x167.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-120x26.png +[2026-10-06 05:24:56][notice] Converting partner-1-120x26.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-700x181.png +[2026-10-06 05:24:56][notice] Converting partner-1-700x181.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-700x181.png +[2026-10-06 05:24:56][notice] Converting partner-1-700x181.png to WebP succeeded. +[2026-10-06 05:24:56][notice] Start WebP conversion partner-1-480x104.png +[2026-10-06 05:24:56][notice] Converting partner-1-480x104.png to WebP succeeded. +[2026-10-06 05:24:57][notice] Start AVIF conversion:partner-1.png +[2026-10-06 05:25:00][notice] Converting partner-1.png to AVIF succeeded. +[2026-10-06 05:25:00][notice] Start AVIF conversion:partner-1-250x54.png +[2026-10-06 05:25:01][notice] Converting partner-1-250x54.png to AVIF succeeded. +[2026-10-06 05:25:01][notice] Start AVIF conversion:partner-1-700x152.png +[2026-10-06 05:25:03][notice] Converting partner-1-700x152.png to AVIF succeeded. +[2026-10-06 05:25:03][notice] Start AVIF conversion:partner-1-150x150.png +[2026-10-06 05:25:04][notice] Converting partner-1-150x150.png to AVIF succeeded. +[2026-10-06 05:25:04][notice] Start AVIF conversion:partner-1-768x167.png +[2026-10-06 05:25:08][notice] Converting partner-1-768x167.png to AVIF succeeded. +[2026-10-06 05:25:08][notice] Start AVIF conversion:partner-1-120x26.png +[2026-10-06 05:25:08][notice] Converting partner-1-120x26.png to AVIF succeeded. +[2026-10-06 05:25:08][notice] Start AVIF conversion:partner-1-700x181.png +[2026-10-06 05:25:11][notice] Converting partner-1-700x181.png to AVIF succeeded. +[2026-10-06 05:25:11][notice] Start AVIF conversion:partner-1-700x181.png +[2026-10-06 05:25:15][notice] Converting partner-1-700x181.png to AVIF succeeded. +[2026-10-06 05:25:15][notice] Start AVIF conversion:partner-1-480x104.png +[2026-10-06 05:25:16][notice] Converting partner-1-480x104.png to AVIF succeeded. +[2026-10-06 05:25:16][notice]Add attachment images id:36 +==================================================== +open log file: 2026-10-06 05:25:16 +[2026-10-06 05:25:16][notice]Start optimizing new media images id:36 +[2026-10-06 05:25:16][notice] Start WebP conversion partner-2.png +[2026-10-06 05:25:16][notice] Converting partner-2.png to WebP succeeded. +[2026-10-06 05:25:16][notice] Start WebP conversion partner-2-250x51.png +[2026-10-06 05:25:16][notice] Converting partner-2-250x51.png to WebP succeeded. +[2026-10-06 05:25:16][notice] Start WebP conversion partner-2-150x120.png +[2026-10-06 05:25:16][notice] Converting partner-2-150x120.png to WebP succeeded. +[2026-10-06 05:25:16][notice] Start WebP conversion partner-2-120x25.png +[2026-10-06 05:25:16][notice] Converting partner-2-120x25.png to WebP succeeded. +[2026-10-06 05:25:16][notice] Start WebP conversion partner-2-480x98.png +[2026-10-06 05:25:16][notice] Converting partner-2-480x98.png to WebP succeeded. +[2026-10-06 05:25:16][notice] Start AVIF conversion:partner-2.png +[2026-10-06 05:25:18][notice] Converting partner-2.png to AVIF succeeded. +[2026-10-06 05:25:19][notice] Start AVIF conversion:partner-2-250x51.png +[2026-10-06 05:25:19][notice] Converting partner-2-250x51.png to AVIF succeeded. +[2026-10-06 05:25:19][notice] Start AVIF conversion:partner-2-150x120.png +[2026-10-06 05:25:20][notice] Converting partner-2-150x120.png to AVIF succeeded. +[2026-10-06 05:25:20][notice] Start AVIF conversion:partner-2-120x25.png +[2026-10-06 05:25:20][notice] Converting partner-2-120x25.png to AVIF succeeded. +[2026-10-06 05:25:20][notice] Start AVIF conversion:partner-2-480x98.png +[2026-10-06 05:25:22][notice] Converting partner-2-480x98.png to AVIF succeeded. +[2026-10-06 05:25:22][notice]Add attachment images id:37 +==================================================== +open log file: 2026-10-06 05:25:22 +[2026-10-06 05:25:22][notice]Start optimizing new media images id:37 +[2026-10-06 05:25:22][notice] Start WebP conversion partner-3.png +[2026-10-06 05:25:22][notice] Converting partner-3.png to WebP succeeded. +[2026-10-06 05:25:22][notice] Start WebP conversion partner-3-250x90.png +[2026-10-06 05:25:22][notice] Converting partner-3-250x90.png to WebP succeeded. +[2026-10-06 05:25:22][notice] Start WebP conversion partner-3-150x134.png +[2026-10-06 05:25:22][notice] Converting partner-3-150x134.png to WebP succeeded. +[2026-10-06 05:25:22][notice] Start WebP conversion partner-3-120x43.png +[2026-10-06 05:25:22][notice] Converting partner-3-120x43.png to WebP succeeded. +[2026-10-06 05:25:22][notice] Start WebP conversion partner-3-332x120.png +[2026-10-06 05:25:22][notice] Converting partner-3-332x120.png to WebP succeeded. +[2026-10-06 05:25:22][notice] Start AVIF conversion:partner-3.png +[2026-10-06 05:25:24][notice] Converting partner-3.png to AVIF succeeded. +[2026-10-06 05:25:24][notice] Start AVIF conversion:partner-3-250x90.png +[2026-10-06 05:25:24][notice] Converting partner-3-250x90.png to AVIF succeeded. +[2026-10-06 05:25:24][notice] Start AVIF conversion:partner-3-150x134.png +[2026-10-06 05:25:25][notice] Converting partner-3-150x134.png to AVIF succeeded. +[2026-10-06 05:25:25][notice] Start AVIF conversion:partner-3-120x43.png +[2026-10-06 05:25:25][notice] Converting partner-3-120x43.png to AVIF succeeded. +[2026-10-06 05:25:25][notice] Start AVIF conversion:partner-3-332x120.png +[2026-10-06 05:25:26][notice] Converting partner-3-332x120.png to AVIF succeeded. +[2026-10-06 05:25:27][notice]Add attachment images id:38 +==================================================== +open log file: 2026-10-06 05:25:27 +[2026-10-06 05:25:27][notice]Start optimizing new media images id:38 +[2026-10-06 05:25:27][notice] Start WebP conversion partner-4.png +[2026-10-06 05:25:27][notice] Converting partner-4.png to WebP succeeded. +[2026-10-06 05:25:27][notice] Start WebP conversion partner-4-250x88.png +[2026-10-06 05:25:27][notice] Converting partner-4-250x88.png to WebP succeeded. +[2026-10-06 05:25:27][notice] Start WebP conversion partner-4-150x130.png +[2026-10-06 05:25:27][notice] Converting partner-4-150x130.png to WebP succeeded. +[2026-10-06 05:25:27][notice] Start WebP conversion partner-4-120x42.png +[2026-10-06 05:25:27][notice] Converting partner-4-120x42.png to WebP succeeded. +[2026-10-06 05:25:27][notice] Start WebP conversion partner-4-342x120.png +[2026-10-06 05:25:27][notice] Converting partner-4-342x120.png to WebP succeeded. +[2026-10-06 05:25:27][notice] Start AVIF conversion:partner-4.png +[2026-10-06 05:25:28][notice] Converting partner-4.png to AVIF succeeded. +[2026-10-06 05:25:28][notice] Start AVIF conversion:partner-4-250x88.png +[2026-10-06 05:25:28][notice] Converting partner-4-250x88.png to AVIF succeeded. +[2026-10-06 05:25:28][notice] Start AVIF conversion:partner-4-150x130.png +[2026-10-06 05:25:29][notice] Converting partner-4-150x130.png to AVIF succeeded. +[2026-10-06 05:25:29][notice] Start AVIF conversion:partner-4-120x42.png +[2026-10-06 05:25:29][notice] Converting partner-4-120x42.png to AVIF succeeded. +[2026-10-06 05:25:29][notice] Start AVIF conversion:partner-4-342x120.png +[2026-10-06 05:25:30][notice] Converting partner-4-342x120.png to AVIF succeeded. +[2026-10-06 05:25:30][notice]Add attachment images id:39 +[2026-10-06 05:25:31][notice]Add attachment images id:40 +[2026-10-06 05:25:31][notice]Add attachment images id:41 +==================================================== +open log file: 2026-10-06 05:25:31 +[2026-10-06 05:25:31][notice]Start optimizing new media images id:41 +[2026-10-06 05:25:31][notice] Start WebP conversion sello.png +[2026-10-06 05:25:31][notice] Converting sello.png to WebP succeeded. +[2026-10-06 05:25:31][notice] Start WebP conversion sello-250x56.png +[2026-10-06 05:25:31][notice] Converting sello-250x56.png to WebP succeeded. +[2026-10-06 05:25:31][notice] Start WebP conversion sello-150x85.png +[2026-10-06 05:25:31][notice] Converting sello-150x85.png to WebP succeeded. +[2026-10-06 05:25:31][notice] Start WebP conversion sello-120x27.png +[2026-10-06 05:25:31][notice] Converting sello-120x27.png to WebP succeeded. +[2026-10-06 05:25:31][notice] Start AVIF conversion:sello.png +[2026-10-06 05:25:31][notice] Converting sello.png to AVIF succeeded. +[2026-10-06 05:25:31][notice] Start AVIF conversion:sello-250x56.png +[2026-10-06 05:25:32][notice] Converting sello-250x56.png to AVIF succeeded. +[2026-10-06 05:25:32][notice] Start AVIF conversion:sello-150x85.png +[2026-10-06 05:25:32][notice] Converting sello-150x85.png to AVIF succeeded. +[2026-10-06 05:25:32][notice] Start AVIF conversion:sello-120x27.png +[2026-10-06 05:25:32][notice] Converting sello-120x27.png to AVIF succeeded. +[2026-10-06 05:45:20][notice]Add attachment images id:43 +==================================================== +open log file: 2026-10-06 05:45:20 +[2026-10-06 05:45:20][notice]Start optimizing new media images id:43 +[2026-10-06 05:45:20][notice] Start WebP conversion letraAobscura.webp +[2026-10-06 05:45:20][notice] Converting letraAobscura.webp to WebP succeeded. +[2026-10-06 05:45:20][notice] Start WebP conversion letraAobscura-250x261.webp +[2026-10-06 05:45:20][notice] Converting letraAobscura-250x261.webp to WebP succeeded. +[2026-10-06 05:45:20][notice] Start WebP conversion letraAobscura-150x150.webp +[2026-10-06 05:45:20][notice] Converting letraAobscura-150x150.webp to WebP succeeded. +[2026-10-06 05:45:20][notice] Start WebP conversion letraAobscura-120x125.webp +[2026-10-06 05:45:21][notice] Converting letraAobscura-120x125.webp to WebP succeeded. +[2026-10-06 05:45:21][notice] Start WebP conversion letraAobscura-629x200.webp +[2026-10-06 05:45:21][notice] Converting letraAobscura-629x200.webp to WebP succeeded. +[2026-10-06 05:45:21][notice] Start WebP conversion letraAobscura-629x400.webp +[2026-10-06 05:45:21][notice] Converting letraAobscura-629x400.webp to WebP succeeded. +[2026-10-06 05:45:21][notice] Start WebP conversion letraAobscura-115x120.webp +[2026-10-06 05:45:21][notice] Converting letraAobscura-115x120.webp to WebP succeeded. +[2026-10-06 05:45:21][notice] Start AVIF conversion:letraAobscura.webp +[2026-10-06 05:45:26][notice] Converting letraAobscura.webp to AVIF succeeded. +[2026-10-06 05:45:26][notice] Start AVIF conversion:letraAobscura-250x261.webp +[2026-10-06 05:45:28][notice] Converting letraAobscura-250x261.webp to AVIF succeeded. +[2026-10-06 05:45:28][notice] Start AVIF conversion:letraAobscura-150x150.webp +[2026-10-06 05:45:30][notice] Converting letraAobscura-150x150.webp to AVIF succeeded. +[2026-10-06 05:45:30][notice] Start AVIF conversion:letraAobscura-120x125.webp +[2026-10-06 05:45:30][notice] Converting letraAobscura-120x125.webp to AVIF succeeded. +[2026-10-06 05:45:30][notice] Start AVIF conversion:letraAobscura-629x200.webp +[2026-10-06 05:45:32][notice] Converting letraAobscura-629x200.webp to AVIF succeeded. +[2026-10-06 05:45:32][notice] Start AVIF conversion:letraAobscura-629x400.webp +[2026-10-06 05:45:35][notice] Converting letraAobscura-629x400.webp to AVIF succeeded. +[2026-10-06 05:45:35][notice] Start AVIF conversion:letraAobscura-115x120.webp +[2026-10-06 05:45:36][notice] Converting letraAobscura-115x120.webp to AVIF succeeded. +[2026-10-06 05:45:45][notice]Add attachment images id:44 +==================================================== +open log file: 2026-10-06 05:45:45 +[2026-10-06 05:45:45][notice]Start optimizing new media images id:44 +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-250x250.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-250x250.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-150x150.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-150x150.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-120x120.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-120x120.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-512x200.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-512x200.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-512x400.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-512x400.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-120x120.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-120x120.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-270x270.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-270x270.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-192x192.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-192x192.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-180x180.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-180x180.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-64x64.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-64x64.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start WebP conversion cropped-letraAobscura-32x32.webp +[2026-10-06 05:45:45][notice] Converting cropped-letraAobscura-32x32.webp to WebP succeeded. +[2026-10-06 05:45:45][notice] Start AVIF conversion:cropped-letraAobscura.webp +[2026-10-06 05:45:48][notice] Converting cropped-letraAobscura.webp to AVIF succeeded. +[2026-10-06 05:45:48][notice] Start AVIF conversion:cropped-letraAobscura-250x250.webp +[2026-10-06 05:45:49][notice] Converting cropped-letraAobscura-250x250.webp to AVIF succeeded. +[2026-10-06 05:45:49][notice] Start AVIF conversion:cropped-letraAobscura-150x150.webp +[2026-10-06 05:45:49][notice] Converting cropped-letraAobscura-150x150.webp to AVIF succeeded. +[2026-10-06 05:45:49][notice] Start AVIF conversion:cropped-letraAobscura-120x120.webp +[2026-10-06 05:45:50][notice] Converting cropped-letraAobscura-120x120.webp to AVIF succeeded. +[2026-10-06 05:45:50][notice] Start AVIF conversion:cropped-letraAobscura-512x200.webp +[2026-10-06 05:45:51][notice] Converting cropped-letraAobscura-512x200.webp to AVIF succeeded. +[2026-10-06 05:45:51][notice] Start AVIF conversion:cropped-letraAobscura-512x400.webp +[2026-10-06 05:45:54][notice] Converting cropped-letraAobscura-512x400.webp to AVIF succeeded. +[2026-10-06 05:45:54][notice] Start AVIF conversion:cropped-letraAobscura-120x120.webp +[2026-10-06 05:45:54][notice] Converting cropped-letraAobscura-120x120.webp to AVIF succeeded. +[2026-10-06 05:45:54][notice] Start AVIF conversion:cropped-letraAobscura-270x270.webp +[2026-10-06 05:45:55][notice] Converting cropped-letraAobscura-270x270.webp to AVIF succeeded. +[2026-10-06 05:45:55][notice] Start AVIF conversion:cropped-letraAobscura-192x192.webp +[2026-10-06 05:45:55][notice] Converting cropped-letraAobscura-192x192.webp to AVIF succeeded. +[2026-10-06 05:45:55][notice] Start AVIF conversion:cropped-letraAobscura-180x180.webp +[2026-10-06 05:45:56][notice] Converting cropped-letraAobscura-180x180.webp to AVIF succeeded. +[2026-10-06 05:45:56][notice] Start AVIF conversion:cropped-letraAobscura-64x64.webp +[2026-10-06 05:45:56][notice] Converting cropped-letraAobscura-64x64.webp to AVIF succeeded. +[2026-10-06 05:45:56][notice] Start AVIF conversion:cropped-letraAobscura-32x32.webp +[2026-10-06 05:45:56][notice] Converting cropped-letraAobscura-32x32.webp to AVIF succeeded. +[2026-10-06 05:45:56][notice] AVIF size larger than original size, deleting file cropped-letraAobscura-32x32.webp.avif. diff --git a/wp-content/compressx/log/compressx_20261006_log.txt b/wp-content/compressx/log/compressx_20261006_log.txt new file mode 100644 index 0000000..55c25ac --- /dev/null +++ b/wp-content/compressx/log/compressx_20261006_log.txt @@ -0,0 +1,21 @@ +[2026-10-06 18:41:02][notice]Add attachment images id:47 +[2026-10-06 23:07:10][notice]Add attachment images id:48 +==================================================== +open log file: 2026-10-06 23:07:10 +[2026-10-06 23:07:10][notice]Start optimizing new media images id:48 +[2026-10-06 23:07:10][notice] Start WebP conversion image-7.png +[2026-10-06 23:07:10][notice] Converting image-7.png to WebP succeeded. +[2026-10-06 23:07:10][notice] Start WebP conversion image-7-250x56.png +[2026-10-06 23:07:10][notice] Converting image-7-250x56.png to WebP succeeded. +[2026-10-06 23:07:10][notice] Start WebP conversion image-7-150x85.png +[2026-10-06 23:07:10][notice] Converting image-7-150x85.png to WebP succeeded. +[2026-10-06 23:07:10][notice] Start WebP conversion image-7-120x27.png +[2026-10-06 23:07:10][notice] Converting image-7-120x27.png to WebP succeeded. +[2026-10-06 23:07:10][notice] Start AVIF conversion:image-7.png +[2026-10-06 23:07:11][notice] Converting image-7.png to AVIF succeeded. +[2026-10-06 23:07:11][notice] Start AVIF conversion:image-7-250x56.png +[2026-10-06 23:07:11][notice] Converting image-7-250x56.png to AVIF succeeded. +[2026-10-06 23:07:11][notice] Start AVIF conversion:image-7-150x85.png +[2026-10-06 23:07:11][notice] Converting image-7-150x85.png to AVIF succeeded. +[2026-10-06 23:07:11][notice] Start AVIF conversion:image-7-120x27.png +[2026-10-06 23:07:12][notice] Converting image-7-120x27.png to AVIF succeeded. diff --git a/wp-content/compressx/log/index.html b/wp-content/compressx/log/index.html new file mode 100644 index 0000000..e69de29 diff --git a/wp-content/plugins/centro-de-funciones/functions/clear-header.php b/wp-content/plugins/centro-de-funciones/functions/clear-header.php index 454ea92..af0efda 100644 --- a/wp-content/plugins/centro-de-funciones/functions/clear-header.php +++ b/wp-content/plugins/centro-de-funciones/functions/clear-header.php @@ -83,7 +83,8 @@ function alcastromol_dequeue_frontend_jquery() { global $pagenow; - if (is_admin() || in_array($pagenow, ['wp-login.php', 'wp-register.php'], true)) { + // El iframe del Customizer es front, pero sus scripts dependen de jQuery. + if (is_admin() || is_customize_preview() || in_array($pagenow, ['wp-login.php', 'wp-register.php'], true)) { return; } diff --git a/wp-content/plugins/centro-de-funciones/functions/tailwindcss/css-dev/input.css b/wp-content/plugins/centro-de-funciones/functions/tailwindcss/css-dev/input.css index bc325e5..f28ae56 100644 --- a/wp-content/plugins/centro-de-funciones/functions/tailwindcss/css-dev/input.css +++ b/wp-content/plugins/centro-de-funciones/functions/tailwindcss/css-dev/input.css @@ -7,4 +7,76 @@ max-width: 1440px; margin: 0 auto; } + + .amerike-input, + .wpcf7-form-control.amerike-input { + width: 100%; + height: 40px; + border-radius: 10px; + border: 1px solid #353535; + background-color: #111111; + padding: 0 12px; + color: #fff; + font-size: 14px; + outline: none; + } + + select.amerike-input { + appearance: none; + padding-right: 36px; + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill='none'%3E%3Cpath d='M3.3 5.4 7.5 9.6 11.7 5.4' stroke='%23fff' stroke-linecap='square'/%3E%3C/svg%3E"); + background-repeat: no-repeat; + background-position: right 12px center; + } + + textarea.amerike-input, + textarea.wpcf7-form-control.amerike-input { + height: auto; + min-height: 140px; + padding-top: 12px; + background-image: none; + } + + .wpcf7-form-control-wrap { + display: block; + } + + .wpcf7-not-valid-tip { + margin-top: 4px; + color: #ff6a14; + font-size: 12px; + } + + .wpcf7-acceptance .wpcf7-list-item { + margin: 0; + } + + @media (max-width: 1119px) { + .site-menu { + display: none; + position: absolute; + left: 0; + right: 0; + top: calc(100% + 8px); + transform: none; + flex-direction: column; + align-items: stretch; + gap: 4px; + border-radius: 20px; + border: 1px solid rgba(196, 196, 196, 0.2); + background: rgba(0, 0, 0, 0.92); + padding: 12px; + } + + .site-menu.is-open { + display: flex; + } + } +} + +@media (prefers-reduced-motion: reduce) { + .animate-marquee, + .animate-glow-drift { + animation: none !important; + } } \ No newline at end of file diff --git a/wp-content/plugins/centro-de-funciones/functions/tailwindcss/tailwind.config.js b/wp-content/plugins/centro-de-funciones/functions/tailwindcss/tailwind.config.js index 24dca36..bf1fc6b 100644 --- a/wp-content/plugins/centro-de-funciones/functions/tailwindcss/tailwind.config.js +++ b/wp-content/plugins/centro-de-funciones/functions/tailwindcss/tailwind.config.js @@ -2,7 +2,7 @@ module.exports = { "content": [ "./cache/*.{php,html,js}", - "C:/laragon/www/tvacapulco/wp-content/themes/tvacapulco/**/*.{php,html,js}" + "C:/laragon/www/amerike/wp-content/themes/amerike/**/*.{php,html,js}" ], "theme": { "screens": { @@ -52,13 +52,48 @@ module.exports = { "muted": "#6B6B6B", "line": "#E6E6E6", "soft": "#F5F5F5" + }, + "amerike": { + "ink": "#090909", + "card": "#151515", + "panel": "#191919", + "field": "#111111", + "line": "#353535", + "muted": "#555555", + "purple": "#6f5091", + "green": "#309b42", + "orange": "#ff6a14", + "cyan": "#00a9e0", + "yellow": "#ffd100" } }, "fontFamily": { "sans": [ - "Inter", + "flama", "sans-serif" ] + }, + "keyframes": { + "marquee": { + "0%": { + "transform": "translateX(0)" + }, + "100%": { + "transform": "translateX(-50%)" + } + }, + "glow-drift": { + "0%, 100%": { + "transform": "translate3d(0,0,0) scale(1)" + }, + "50%": { + "transform": "translate3d(4%, -3%, 0) scale(1.06)" + } + } + }, + "animation": { + "marquee": "marquee 32s linear infinite", + "glow-drift": "glow-drift 18s ease-in-out infinite" } } }, diff --git a/wp-content/plugins/compressx/compressx.php b/wp-content/plugins/compressx/compressx.php new file mode 100644 index 0000000..c8dc8c8 --- /dev/null +++ b/wp-content/plugins/compressx/compressx.php @@ -0,0 +1,78 @@ +create_uploads_dir(); + + $options=get_option('compressx_general_settings',array()); + $image_load=isset($options['image_load'])?$options['image_load']:'htaccess'; + if ($image_load == "htaccess") + { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite=new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules(); + } + else if($image_load == "compat_htaccess") + { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite=new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules_ex(); + } + +} + +function compressx_deactivation_action() +{ + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite=new CompressX_Webp_Rewrite(); + $rewrite->remove_rewrite_rule(); +} + +register_activation_hook(__FILE__, 'compressx_actvation_action'); +register_deactivation_hook(__FILE__, 'compressx_deactivation_action'); +require plugin_dir_path( __FILE__ ) . 'includes/class-compressx.php'; + +function compressx_run() +{ + $compressx = new CompressX(); + $GLOBALS['compressx'] = $compressx; +} +compressx_run(); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/assets/compressx_test.png b/wp-content/plugins/compressx/includes/assets/compressx_test.png new file mode 100644 index 0000000..ef20a5d Binary files /dev/null and b/wp-content/plugins/compressx/includes/assets/compressx_test.png differ diff --git a/wp-content/plugins/compressx/includes/assets/compressx_test.png.webp b/wp-content/plugins/compressx/includes/assets/compressx_test.png.webp new file mode 100644 index 0000000..bc1bf2a Binary files /dev/null and b/wp-content/plugins/compressx/includes/assets/compressx_test.png.webp differ diff --git a/wp-content/plugins/compressx/includes/class-compressx-auto-optimization.php b/wp-content/plugins/compressx/includes/class-compressx-auto-optimization.php new file mode 100644 index 0000000..c69533b --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-auto-optimization.php @@ -0,0 +1,188 @@ +auto_opt_ids=array(); + + add_action( 'add_attachment', array( $this, 'add_auto_opt_id' ), 1000 ); + add_filter( 'wp_generate_attachment_metadata', array( $this, 'update_auto_opt_id_status' ), 1000, 2 ); + add_filter( 'wp_update_attachment_metadata', array( $this, 'auto_optimize' ), 1000, 2 ); + + add_filter( 'compressx_allowed_image_auto_optimization', array( $this, 'allowed_image_auto_optimization' ), 10 ); + } + + public function allowed_image_auto_optimization() + { + $is_auto=CompressX_Options::get_option('compressx_auto_optimize',false); + + if($is_auto) + { + return true; + } + else + { + return false; + } + } + + public function add_auto_opt_id($attachment_id) + { + $is_auto=apply_filters('compressx_allowed_image_auto_optimization',false); + + if($is_auto) + { + $this->auto_opt_ids[$attachment_id]=0; + } + } + + public function update_auto_opt_id_status($metadata, $attachment_id) + { + if(isset( $this->auto_opt_ids[$attachment_id])) + { + if ( ! wp_attachment_is_image( $attachment_id ) ) + { + unset($this->auto_opt_ids[$attachment_id]); + } + else + { + $this->WriteLog('Add attachment images id:'.$attachment_id,'notice'); + $this->auto_opt_ids[$attachment_id]=1; + } + } + + return $metadata; + } + + public function auto_optimize($metadata, $attachment_id) + { + $is_auto=apply_filters('compressx_allowed_image_auto_optimization',false); + + if($is_auto) + { + if(isset($this->auto_opt_ids[$attachment_id])&&$this->auto_opt_ids[$attachment_id]) + { + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png", + "image/webp", + "image/avif"); + + $mime_type=get_post_mime_type($attachment_id); + if(in_array($mime_type,$supported_mime_types)) + { + if($this->is_excludes($attachment_id)) + { + $this->WriteLog('Exclude attachment images id:'.$attachment_id,'notice'); + return $metadata; + } + + set_time_limit(300); + delete_transient('compressx_set_global_stats'); + $ret=$this->do_optimize_image($attachment_id,$metadata); + if(isset($ret['meta'])) + { + return $ret['meta']; + } + } + } + } + + return $metadata; + } + + public function is_excludes($attachment_id) + { + $exclude_regex_folder=CompressX_Options::get_excludes(); + + if(CompressX_Image_Opt_Method::exclude_path($attachment_id,$exclude_regex_folder)) + { + return true; + } + else + { + return false; + } + } + + public function WriteLog($log,$type) + { + if (is_a($this->log, 'CompressX_Log')) + { + $this->log->WriteLog($log,$type); + } + else + { + $this->log=new CompressX_Log(); + $this->log->OpenLogFile(); + $this->log->WriteLog($log,$type); + } + } + + public function do_optimize_image($attachment_id,$metadata) + { + $general_options=CompressX_Options::get_general_settings(); + $quality_options=CompressX_Options::get_quality_option(); + $options=array_merge($general_options,$quality_options); + + $this->log=new CompressX_Log(); + $this->log->CreateLogFile(); + + $this->WriteLog('Start optimizing new media images id:'.$attachment_id,'notice'); + + $file_path = get_attached_file( $attachment_id ); + if(empty($file_path)) + { + CompressX_Image_Opt_Method::WriteLog($this->log,'Image:'.$attachment_id.' failed. Error: failed to get get_attached_file','notice'); + $error='Image:'.$attachment_id.' failed. Error: failed to get get_attached_file'; + CompressX_Image_Meta_V2::update_image_failed($attachment_id,$error); + $ret['result']='success'; + $ret['meta']=$metadata; + return $ret; + } + + if(!file_exists($file_path)) + { + CompressX_Image_Opt_Method::WriteLog($this->log,'Image:'.$attachment_id.' failed. Error: file not exists '.$file_path,'notice'); + + $error='Image:'.$attachment_id.' failed. Error: file not exists '.$file_path; + CompressX_Image_Meta_V2::update_image_failed($attachment_id,$error); + $ret['result']='success'; + $ret['meta']=$metadata; + return $ret; + } + + CompressX_Image_Meta_V2::update_image_progressing($attachment_id); + + $image=new Compressx_Image($attachment_id,$options); + + $ret=$image->resize_ex($metadata); + if($ret['result']=='success') + { + $metadata=$ret['meta']; + } + + if($image->convert()) + { + CompressX_Image_Meta_V2::update_image_meta_status($attachment_id,'optimized'); + do_action('compressx_uploading_add_watermark',$attachment_id); + do_action('compressx_after_optimize_image',$attachment_id); + } + else + { + CompressX_Image_Meta_V2::update_image_meta_status($attachment_id,'failed'); + } + + CompressX_Image_Meta_V2::delete_image_progressing($attachment_id); + + $ret['result']='success'; + $ret['meta']=$metadata; + return $ret; + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-cloudflare-cdn.php b/wp-content/plugins/compressx/includes/class-compressx-cloudflare-cdn.php new file mode 100644 index 0000000..dd3f30a --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-cloudflare-cdn.php @@ -0,0 +1,86 @@ +options=$options; + } + + public function purge_cache() + { + if(empty($this->options['zone_id'])) + { + $ret['result']='failed'; + $ret['error']=__('Zone ID is required, please enter a valid Zone ID','compressx'); + return $ret; + } + + if(empty($this->options['email'])) + { + $ret['result']='failed'; + $ret['error']=__('Cloudflare email is required, please enter your Cloudflare email.','compressx'); + return $ret; + } + + if(empty($this->options['api_key'])) + { + $ret['result']='failed'; + $ret['error']=__('Global API key is required, please enter your Cloudflare global API key.','compressx'); + return $ret; + } + + $zone_id=$this->options['zone_id']; + $email = $this->options['email']; + $api_key = $this->options['api_key']; + + $headers = array( + 'Content-Type' => 'application/json' + ); + + $headers["X-Auth-Email"] = $email; + $headers["X-Auth-Key"] = $api_key; + + $args['method'] = 'POST'; + $args['body'] = wp_json_encode( array( 'purge_everything' => true ) ); + $args['headers'] = $headers; + $response = wp_remote_post( + esc_url_raw( "https://api.cloudflare.com/client/v4/zones/{$zone_id}/purge_cache" ), + $args + ); + + if ( is_wp_error( $response ) ) + { + $ret['result']='failed'; + $ret['error']=__('Connecting to Cloudflare failed:','compressx').$response->get_error_message(); + return $ret; + } + + $response_body = wp_remote_retrieve_body($response); + $json = json_decode( $response_body, true); + + if( $json['success'] == false ) + { + + $error = array(); + + foreach($json['errors'] as $single_error) + { + $error[] = "{$single_error['message']} (err code: {$single_error['code']})"; + } + + $error = implode(' - ', $error); + + $ret['result']='failed'; + $ret['error']=__('Connecting to Cloudflare failed:','compressx').$error; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-custom-imgoptim-task.php b/wp-content/plugins/compressx/includes/class-compressx-custom-imgoptim-task.php new file mode 100644 index 0000000..47fe065 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-custom-imgoptim-task.php @@ -0,0 +1,458 @@ +get_task(); + CompressX_Custom_Image_Meta::check_custom_table(); + } + + public function update_task() + { + CompressX_Options::update_option('compressx_custom_image_opt_task',$this->task); + $this->get_task(); + } + + public function get_task() + { + $this->task=CompressX_Options::get_option('compressx_custom_image_opt_task',array()); + } + + public function init_task($force=false) + { + $this->task=array(); + + $this->task['log']=uniqid('cx-'); + $this->log=new CompressX_Log(); + $this->log->CreateLogFile(); + + $this->init_options(); + $this->task['options']['force']=$force; + + $this->task['images']=$this->get_need_optimize_images(); + + if(empty($this->task['images'])) + { + $ret['result']='failed'; + $ret['error']=__('No unoptimized images found.','compressx'); + $this->update_task(); + return $ret; + } + + $this->task['status']='init'; + $this->task['last_update_time']=time(); + $this->task['retry']=0; + + $this->task['opt_images']=0; + $this->task['failed_images']=0; + + $this->task['error']=''; + $this->update_task(); + + $ret['result']='success'; + $ret["test"]=$this->task; + return $ret; + } + + public function WriteLog($log,$type) + { + if (is_a($this->log, 'CompressX_Log')) + { + $this->log->WriteLog($log,$type); + } + else + { + $this->log=new CompressX_Log(); + $this->log->OpenLogFile(); + $this->log->WriteLog($log,$type); + } + } + + public function init_options() + { + $general_options=CompressX_Options::get_general_settings(); + $quality_options=CompressX_Options::get_quality_option(); + $this->task['options']=array_merge($general_options,$quality_options); + + } + + public function get_need_optimize_images() + { + $images=CompressX_Options::get_option("compressx_need_optimized_custom_images",array()); + $need_optimize_images=array(); + $index=0; + foreach ($images as $path) + { + $image['id']=$index; + $image['finished']=1; + $image['path']=$path; + $image['force']=0; + $status=CompressX_Custom_Image_Meta::get_image_status($path); + + if($this->task['options']['convert_to_webp']) + { + $image['convert_webp_status']=$status['convert_webp_status']; + $image['finished']=0; + } + + if($this->task['options']['convert_to_avif']) + { + $image['convert_avif_status']=$status['convert_avif_status']; + $image['finished']=0; + } + + if($image['finished']==0) + { + $need_optimize_images[$index]=$image; + $index++; + } + } + return $need_optimize_images; + } + + public function get_task_status() + { + if(empty($this->task)) + { + $ret['result']='failed'; + $ret['error']=__('All image(s) optimized successfully.','compressx'); + return $ret; + } + + if($this->task['status']=='error') + { + $ret['result']='failed'; + $ret['error']=$this->task['error']; + } + else if($this->task['status']=='completed') + { + $ret['result']='success'; + $ret['status']='completed'; + } + else if($this->task['status']=='finished') + { + $ret['result']='success'; + $ret['status']='finished'; + } + else if($this->task['status']=='timeout') + { + $ret['result']='success'; + $ret['status']='completed'; + } + else if($this->task['status']=='init') + { + $ret['result']='success'; + $ret['status']='completed'; + } + else + { + $ret['result']='success'; + $ret['status']='running'; + } + return $ret; + } + + public function do_optimize_image() + { + $this->task['status']='running'; + $this->task['last_update_time']=time(); + $this->update_task(); + + if(empty($this->task)||!isset($this->task['images'])) + { + $ret['result']='success'; + return $ret; + } + + $image_id=false; + $need_reset=false; + foreach ($this->task['images'] as $image) + { + if($image['finished']==0) + { + $image_id=$image['id']; + if($this->task['options']['force']&&$image['force']==0) + { + $need_reset=true; + } + break; + } + } + + if($image_id===false) + { + $ret['result']='success'; + + $this->task['status']='finished'; + $this->task['last_update_time']=time(); + $this->update_task(); + return $ret; + } + + if($need_reset) + { + $ret=$this->reset_optimize_image($image_id); + if($ret['result']=='success') + { + $this->task['images'][$image_id]['force']=1; + $this->update_task(); + } + } + + $this->WriteLog('Start optimizing custom images id:'.$image_id,'notice'); + $ret=$this->optimize_image($image_id); + + if($ret['result']=='success') + { + $this->WriteLog('Optimizing custom image id:'.$image_id.' succeeded.','notice'); + $this->task['images'][$image_id]['finished']=1; + $this->task['status']='completed'; + $this->task['last_update_time']=time(); + $this->task['retry']=0; + $this->update_task(); + + $ret['result']='success'; + $ret['test']=$this->task; + return $ret; + } + else + { + $this->WriteLog('Optimizing images failed. Error:'.$ret['error'],'error'); + + $this->task['status']='error'; + $this->task['error']=$ret['error']; + $this->task['last_update_time']=time(); + $this->update_task(); + return $ret; + } + } + + public function reset_optimize_image($image_id) + { + $filename=$this->get_image_path($image_id); + CompressX_Custom_Image_Meta::generate_custom_image_meta($filename,$this->task['options']); + + $ret['result']='success'; + return $ret; + } + + public function optimize_image($image_id) + { + if (is_a($this->log, 'CompressX_Log')) + { + // + } + else + { + $this->log=new CompressX_Log(); + $this->log->OpenLogFile(); + } + + $has_error=false; + $filename=$this->get_image_path($image_id); + $this->get_custom_image_meta($filename); + + if(CompressX_Image_Opt_Method::custom_convert_to_webp($filename,$this->task['options'],$this->log)===false) + { + $has_error=true; + } + + if(CompressX_Image_Opt_Method::custom_convert_to_avif($filename,$this->task['options'],$this->log)===false) + { + $has_error=true; + } + + if($has_error) + { + $this->task['failed_images']++; + $this->update_task(); } + else + { + $this->task['opt_images']++; + $this->update_task(); + } + + + $ret['result']='success'; + return $ret; + } + + public function get_image_path($image_id) + { + $image=$this->task['images'][$image_id]; + return CompressX_Image_Method::transfer_path($image['path']); + } + + public function get_custom_image_meta($filename) + { + $filename=CompressX_Image_Method::transfer_path($filename); + $meta=CompressX_Custom_Image_Meta::get_custom_image_meta($filename); + if(empty($meta)) + { + $meta=CompressX_Custom_Image_Meta::generate_custom_image_meta($filename,$this->task['options']); + } + + return $meta; + } + + public function get_task_progress() + { + $this->get_task(); + + if(empty($this->task)) + { + $ret['result']='failed'; + $ret['error']=__('All image(s) optimized successfully.','compressx'); + $ret['percent']=0; + $ret['timeout']=0; + $ret['log']=__('All image(s) optimized successfully.','compressx'); + return $ret; + } + + if(isset($this->task['images'])) + { + $ret['total_images']=sizeof($this->task['images']); + } + else + { + $ret['total_images']=0; + } + + $ret['optimized_images']=0; + if(isset($this->task['images'])) + { + foreach ($this->task['images'] as $image) + { + if($image['finished']) + { + $ret['optimized_images']++; + } + } + } + + $percent= intval(($ret['optimized_images']/$ret['total_images'])*100); + + $ret['log']=sprintf( + '%1$d images found | Processed:%2$d/%3$d (%4$d%%)', + $ret['total_images'],$ret['optimized_images'],$ret['total_images'],$percent); + + if(isset($this->task['status'])) + { + if($this->task['status']=='error') + { + $ret['result']='failed'; + $ret['error']=$this->task['error']; + $ret['timeout']=0; + $ret['percent']= intval(($ret['optimized_images']/$ret['total_images'])*100); + $ret['log']=$this->task['error']; + } + else if($this->task['status']=='finished') + { + $ret['result']='success'; + $ret['continue']=0; + $ret['finished']=1; + $ret['timeout']=0; + $ret['percent']= 100; + $ret['log']=__('Finish Optimizing images.','compressx'); + + $dismiss=CompressX_Options::get_option('compressx_rating_dismiss',false); + if($dismiss===false) + { + $ret['show_review']=1; + } + else if($dismiss==0) + { + $ret['show_review']=0; + } + else if($dismisstask['status']=='completed') + { + $ret['result']='success'; + $ret['continue']=0; + $ret['finished']=0; + $ret['timeout']=0; + $ret['percent']= intval(($ret['optimized_images']/$ret['total_images'])*100); + } + else + { + if(isset($this->task['last_update_time'])) + { + if(time()-$this->task['last_update_time']>180) + { + $this->task['last_update_time']=time(); + $this->task['retry']++; + $this->task['status']='timeout'; + $this->update_task(); + if($this->task['retry']<3) + { + $ret['timeout']=1; + } + else + { + $ret['timeout']=0; + $this->task=array(); + $this->update_task(); + } + + $ret['result']='failed'; + $ret['error']=__('Task timed out','compressx'); + $ret['percent']=0; + $ret['retry']=$this->task['retry']; + $ret['log']='task time out'; + } + else + { + $ret['continue']=1; + $ret['finished']=0; + $ret['timeout']=0; + $ret['running_time']=time()-$this->task['last_update_time']; + $ret['result']='success'; + $ret['percent']= intval(($ret['optimized_images']/$ret['total_images'])*100); + } + } + else + { + $ret['result']='failed'; + $ret['error']='Not start task'; + $ret['timeout']=0; + $ret['percent']=0; + $ret['log']='Not start task'; + } + } + } + else + { + $ret['result']='failed'; + $ret['error']='Not start task'; + $ret['timeout']=0; + $ret['percent']=0; + $ret['log']='Not start task'; + } + + return $ret; + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-default-folder.php b/wp-content/plugins/compressx/includes/class-compressx-default-folder.php new file mode 100644 index 0000000..c996777 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-default-folder.php @@ -0,0 +1,46 @@ +create_htaccess(); + } + + public function create_htaccess() + { + $htaccess_file= WP_CONTENT_DIR."/compressx-nextgen/.htaccess"; + $line[]=''; + $line[]='AddType image/avif .avif'; + $line[]='AddType image/webp .webp'; + $line[]=''; + + $line[]=''; + $line[]='ExpiresActive On'; + $line[]='ExpiresByType image/avif "access plus 1 year"'; + $line[]='ExpiresByType image/webp "access plus 1 year"'; + $line[]=''; + $line[]='Options -Indexes'; + insert_with_markers($htaccess_file,'CompressX Webp',$line); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-i18n.php b/wp-content/plugins/compressx/includes/class-compressx-i18n.php new file mode 100644 index 0000000..4be0707 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-i18n.php @@ -0,0 +1,22 @@ + $max_timeout_limit || $processed > $max_count) { + $finished = false; + break; + } + } + + $need_optimize_images = self::get_need_optimize_images_count($force); + + $ret['result'] = 'success'; + $ret['finished'] = $finished; + $ret['offset'] = $last_id; + //$max_image_count=CompressX_Image_Method::get_max_image_count(); + global $wpdb; + $max_image_id = (int) $wpdb->get_var(" + SELECT MAX(ID) FROM {$wpdb->posts} WHERE post_type='attachment' +"); + $progress = min(100, round(($last_id / $max_image_id) * 100, 2)); + $ret['progress'] = sprintf('Scanning up to ID %1$d of %2$d, Found %3$d (%4$s%%)', + $last_id, $max_image_id, $need_optimize_images, $progress + ); + + return $ret; + } + + //scan + public static function scan_unoptimized_images_v2($force, $start_row) + { + $convert_to_webp=CompressX_Image_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Method::get_convert_to_avif(); + + $time_start=time(); + $max_timeout_limit=15; + $finished=true; + $options = CompressX_Options::get_option( + 'compressx_general_settings', + array() + ); + + $page = isset($options['scan_images_page']) + ? $options['scan_images_page'] + : 500; + + $max_count=10000; + + $count = 0; + $last_id = (int) $start_row; + $processed = 0; + + while (true) + { + $result = self::scan_unoptimized_image_by_cursor_v2( + $page, + $last_id, + $convert_to_webp, + $convert_to_avif, + $force + ); + + if (empty($result['last_id'])) { + $finished = true; + break; + } + + $last_id = $result['last_id']; + $processed += $result['count']; + + $time_spend = time() - $time_start; + if ($time_spend > $max_timeout_limit || $processed > $max_count) { + $finished = false; + break; + } + } + + // percent + global $wpdb; + $total_attachments = self::get_total_attachments_cached(); + + $scanned_attachments = self::get_scanned_attachments($last_id); + + $percent = $total_attachments > 0 + ? min(100, round(($scanned_attachments / $total_attachments) * 100, 2)) + : 100; + + // need optimize images + $need_optimize_images = self::get_need_optimize_images_count($force); + + $progress_text = sprintf( + '%1$d / %2$d scanned', + $scanned_attachments, + $total_attachments + ); + + $ret = [ + 'result' => 'success', + 'finished' => $finished, + 'offset' => $last_id, + 'found' => $need_optimize_images, + 'progress_text' => $progress_text, + 'progress_percent' => $percent, + 'last_id' => $last_id + ]; + + return $ret; + } + + private static function get_total_attachments_cached() + { + global $wpdb; + + $mime_types = array( + 'image/jpg', + 'image/jpeg', + 'image/png', + 'image/webp', + 'image/avif' + ); + + $placeholders = implode(',', array_fill(0, count($mime_types), '%s')); + + $query = " + SELECT COUNT(1) + FROM {$wpdb->posts} + WHERE post_type='attachment' + AND post_mime_type IN ($placeholders) + "; + + $query = $wpdb->prepare($query, $mime_types); + + return (int) $wpdb->get_var($query); + } + + public static function scan_unoptimized_image_by_cursor($limit, $last_id, $convert_to_webp, $convert_to_avif, $force) + { + if (!$convert_to_webp && !$convert_to_avif) + { + return ['count' => 0, 'last_id' => 0]; + } + + global $wpdb; + + $mime_types = ["image/jpg", "image/jpeg", "image/png", "image/webp", "image/avif"]; + $placeholders = implode(',', array_fill(0, count($mime_types), '%s')); + + $subquery = " + SELECT ID,post_mime_type + FROM {$wpdb->posts} + WHERE post_type = 'attachment' + AND post_mime_type IN ($placeholders) + AND ID > %d + ORDER BY ID ASC + LIMIT %d + "; + $args = array_merge($mime_types, [$last_id, $limit]); + + if ($force) { + $status_filter = "1=1"; + } else { + $status_filter = "(pm.status IS NULL OR pm.status NOT IN ('pending', 'skip'))"; + } + + $meta_table=CompressX_Image_Meta_V2::table_name(); + $outer_query = " + SELECT p.ID,p.post_mime_type,pm.attachment_id + FROM ($subquery) p + LEFT JOIN {$meta_table} pm + ON p.ID = pm.attachment_id + WHERE $status_filter + "; + + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + $query = $wpdb->prepare($outer_query, $args); + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + $result = $wpdb->get_results($query, OBJECT_K); + + if (empty($result)) { + return ['count' => 0, 'last_id' => 0]; + } + + $processed = 0; + $max_id = 0; + $exclude = CompressX_Options::get_excludes(); + + foreach ($result as $image) + { + $image_id = (int) $image->ID; + $max_id = max($max_id, $image_id); + $processed++; + + $meta=CompressX_Image_Meta_V2::get_image_meta($image_id); + + if (self::should_skip($image_id)) + { + CompressX_Image_Meta_V2::update_image_meta_status($image_id, 'skip'); + continue; + } + + if(isset($meta['status'])&&$meta['status']=='optimized') + { + continue; + } + + $type=$image->post_mime_type; + $file_path = get_post_meta($image_id, '_wp_attached_file', true); + + if (empty($file_path)) + { + continue; + } + + if (self::should_exclude_by_path($file_path, $exclude)) + { + CompressX_Image_Meta_V2::update_image_meta_status( + $image_id, + 'skip' + ); + + continue; + } + + $need_opt = false; + + if ($convert_to_webp) + { + if ($type != 'image/avif') + { + if( !isset($meta['webp_converted']) ||$meta['webp_converted']==0) + { + $need_opt = true; + } + } + } + + if ($convert_to_avif) + { + if( !isset($meta['avif_converted']) ||$meta['avif_converted']==0) + { + $need_opt = true; + } + } + + if ($need_opt) + { + CompressX_Image_Meta_V2::update_image_meta_status($image_id, 'pending'); + } + } + + return [ + 'count' => $processed, + 'last_id' => $max_id, + ]; + } + + public static function should_skip($image_id) + { + if ( ! self::check_sellvia_environment() ) + { + return false; + } + + $is_sellvia = get_post_meta($image_id, '_wp_sellvia_attached_file', true); + if ($is_sellvia === '1') + { + return true; + } + else + { + return false; + } + } + + public static function get_need_optimize_images_count($force) + { + global $wpdb; + + $meta_table = CompressX_Image_Meta_V2::table_name(); + + if ($force) { + $statuses = ['pending', 'optimized', 'failed']; + } else { + $statuses = ['pending', 'failed']; + } + + $placeholders = implode(',', array_fill(0, count($statuses), '%s')); + + return (int) $wpdb->get_var($wpdb->prepare(" + SELECT COUNT(attachment_id) + FROM {$meta_table} + WHERE status IN ($placeholders) + ", $statuses)); + } + + public static function get_need_optimize_images_by_cursor($last_id = 0, $limit = 200, $force = false) + { + global $wpdb; + + $meta_table=CompressX_Image_Meta_V2::table_name(); + + if ($force) + { + return $wpdb->get_col($wpdb->prepare(" + SELECT pm.attachment_id + FROM {$meta_table} pm + WHERE pm.status IN ('pending', 'optimized', 'failed') + AND pm.attachment_id > %d + ORDER BY pm.attachment_id ASC + LIMIT %d + ", $last_id, $limit)); + } + else + { + return $wpdb->get_col($wpdb->prepare(" + SELECT pm.attachment_id + FROM {$meta_table} pm + WHERE pm.status IN ('pending', 'failed') + AND pm.attachment_id > %d + ORDER BY pm.attachment_id ASC + LIMIT %d + ", $last_id, $limit)); + } + } + + private static function get_scanned_attachments($last_id) + { + global $wpdb; + + $mime_types = array( + 'image/jpg', + 'image/jpeg', + 'image/png', + 'image/webp', + 'image/avif' + ); + + $placeholders = implode(',', array_fill(0, count($mime_types), '%s')); + + $query = " + SELECT COUNT(1) + FROM {$wpdb->posts} + WHERE post_type='attachment' + AND post_mime_type IN ($placeholders) + AND ID <= %d + "; + + $args = array_merge($mime_types, array($last_id)); + + $query = $wpdb->prepare($query, $args); + + return (int) $wpdb->get_var($query); + } + + public static function scan_unoptimized_image_by_cursor_v2($limit, $last_id, $convert_to_webp, $convert_to_avif, $force) + { + if (!$convert_to_webp && !$convert_to_avif) + { + return array( + 'count' => 0, + 'last_id' => 0 + ); + } + + global $wpdb; + + $limit = max(1, (int)$limit); + $last_id = max(0, (int)$last_id); + + $mime_types = array( + 'image/jpg', + 'image/jpeg', + 'image/png', + 'image/webp', + 'image/avif' + ); + + $placeholders = implode(',', array_fill(0, count($mime_types), '%s')); + + if ($force) + { + $status_filter = "1=1"; + } + else + { + $status_filter = "(pm.status IS NULL OR pm.status NOT IN ('pending', 'skip'))"; + } + + $meta_table = CompressX_Image_Meta_V2::table_name(); + + $sql = " + SELECT + p.ID, + p.post_mime_type, + pm.status, + pm.webp_converted, + pm.avif_converted, + af.meta_value AS attached_file + FROM {$wpdb->posts} p + LEFT JOIN {$meta_table} pm + ON p.ID = pm.attachment_id + LEFT JOIN {$wpdb->postmeta} af + ON af.post_id = p.ID + AND af.meta_key = '_wp_attached_file' + WHERE p.post_type = 'attachment' + AND p.post_mime_type IN ($placeholders) + AND p.ID > %d + AND {$status_filter} + ORDER BY p.ID ASC + LIMIT %d + "; + + $args = array_merge( + $mime_types, + array( + $last_id, + $limit + ) + ); + + $query = $wpdb->prepare($sql, $args); + + $result = $wpdb->get_results($query); + + if (empty($result)) + { + return array( + 'count' => 0, + 'last_id' => 0 + ); + } + + $processed = 0; + $max_id = 0; + $exclude = CompressX_Options::get_excludes(); + + foreach ($result as $image) + { + $image_id = (int)$image->ID; + + $max_id = max($max_id, $image_id); + $processed++; + + $status = isset($image->status) + ? (string)$image->status + : ''; + + $webp_converted = isset($image->webp_converted) + ? (int)$image->webp_converted + : 0; + + $avif_converted = isset($image->avif_converted) + ? (int)$image->avif_converted + : 0; + + + if (self::should_skip($image_id)) + { + CompressX_Image_Meta_V2::update_image_meta_status( + $image_id, + 'skip' + ); + + continue; + } + + + if ($status === 'optimized') + { + continue; + } + + + $file_path = isset($image->attached_file) + ? (string)$image->attached_file + : ''; + + if (empty($file_path)) + { + continue; + } + + if (self::should_exclude_by_path($file_path, $exclude)) + { + CompressX_Image_Meta_V2::update_image_meta_status( + $image_id, + 'skip' + ); + + continue; + } + + $type = (string)$image->post_mime_type; + + $need_opt = false; + + + if ($convert_to_webp && $type !== 'image/avif' && $webp_converted === 0) + { + $need_opt = true; + } + + + if ($convert_to_avif && $avif_converted === 0) + { + $need_opt = true; + } + + + if ($need_opt) + { + CompressX_Image_Meta_V2::update_image_meta_status( + $image_id, + 'pending' + ); + } + } + + + return array( + 'count' => $processed, + 'last_id' => $max_id, + ); + } + + public static function get_attached_file_by_meta_value($file) + { + if (empty($file)) + { + return false; + } + + if ( + 0 !== strpos($file, '/') && + !preg_match('|^.:\\\\|', $file) && + !preg_match('|^[a-zA-Z]:/|', $file) + ) + { + $uploads = wp_get_upload_dir(); + + if (false === $uploads['error']) + { + $file = $uploads['basedir'] . '/' . ltrim($file, '/'); + } + } + + return $file; + } + + public static function should_exclude_by_path($relative_file, $exclude) + { + if (empty($relative_file) || empty($exclude)) + { + return false; + } + + $file_path = self::get_attached_file_by_meta_value($relative_file); + + if (empty($file_path)) + { + return false; + } + + return CompressX_Image_Method::exclude_path_ex( + $file_path, + $exclude + ); + } +} diff --git a/wp-content/plugins/compressx/includes/class-compressx-image.php b/wp-content/plugins/compressx/includes/class-compressx-image.php new file mode 100644 index 0000000..30cdf12 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-image.php @@ -0,0 +1,406 @@ +image_id=$image_id; + $this->options=$options; + + $this->log = CompressX_Log_Ex::get_instance(); + + if(!CompressX_Image_Meta_V2::has_image_meta($this->image_id)) + { + CompressX_Image_Meta_V2::generate_images_meta($this->image_id, $this->options); + } + } + + public function resize() + { + if(CompressX_Image_Meta_V2::get_image_meta_value($this->image_id,'resize_status')==0) + { + if(CompressX_Image_Opt_Method::resize($this->image_id,$this->options,$this->log)) + { + CompressX_Image_Meta_V2::update_images_meta_value($this->image_id,'resize_status',1); + } + } + } + + public function resize_ex($metadata) + { + if(CompressX_Image_Meta_V2::get_image_meta_value($this->image_id,'resize_status')==0) + { + $ret=CompressX_Image_Opt_Method::resize_ex($this->image_id,$this->options,$metadata,$this->log); + if($ret['result']=='success') + { + CompressX_Image_Meta_V2::update_images_meta_value($this->image_id,'resize_status',1); + return $ret; + } + } + + $ret['result']='success'; + $ret['meta']=$metadata; + return $ret; + } + + public function convert() + { + $has_error=false; + + if($this->convert_to_webp()===false) + { + $has_error=true; + } + + if($this->convert_to_avif()===false) + { + $has_error=true; + } + + return !$has_error; + } + + public function convert_to_webp() + { + if(CompressX_Image_Method::is_exclude_webp($this->image_id,$this->options)) + { + return true; + } + if(!$this->need_convert_to_webp()) + { + return true; + } + + if(CompressX_Image_Meta_V2::get_image_meta_webp_converted($this->image_id)==1) + { + return true; + } + + $success=true; + $has_convert=true; + + $size =CompressX_Image_Meta_V2::get_image_meta_value($this->image_id,'size'); + $uploads=wp_get_upload_dir(); + $file_path = get_attached_file( $this->image_id ); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + foreach ($size as $size_key=>$size_meta) + { + if($size_meta['convert_webp_status']==1||$this->skip_size($size_key)) + { + continue; + } + + if($size_key=="og") + { + $filename= $file_path; + } + else if(CompressX_Image_Opt_Method::is_elementor_thumbs($size_key)) + { + $filename = $uploads['basedir'].'/'.$size_meta['file']; + } + else + { + $filename= path_join( dirname( $file_path ), $size_meta['file'] ); + } + + CompressX_Image_Opt_Method::WriteLog($this->log,'Start WebP conversion '.basename($filename),'notice'); + + if(!file_exists($filename)) + { + CompressX_Image_Opt_Method::WriteLog($this->log,'File '.basename($filename).' not exist,so skip convert.','notice'); + $size_meta['convert_webp_status']=1; + $size_meta['status']='optimized'; + CompressX_Image_Meta_V2::update_image_meta_size($this->image_id,$size_key,$size_meta); + continue; + } + + $nextgen_path=CompressX_Image_Opt_Method::get_output_path($filename); + if($type=="webp") + { + $des_filename=$nextgen_path; + } + else + { + $des_filename=$nextgen_path.'.webp'; + } + + $ret=$this->_convert_webp($filename,$des_filename); + + if($ret['result']=='success') + { + $webp_converted_size=filesize($des_filename); + $file_size=filesize($filename); + if($this->options['auto_remove_larger_format']&&$webp_converted_size>$file_size) + { + @wp_delete_file($des_filename); + CompressX_Image_Opt_Method::WriteLog($this->log,'WebP size larger than original size, deleting file '.basename($des_filename).'.','notice'); + $size_meta['webp_converted_size']=$file_size; + } + else + { + $size_meta['webp_converted_size']=$webp_converted_size; + } + $size_meta['file_size']=$file_size; + $size_meta['convert_webp_status']=1; + $size_meta['status']='optimized'; + CompressX_Image_Meta_V2::update_image_meta_size($this->image_id,$size_key,$size_meta); + } + else + { + $size_meta['convert_webp_status']=0; + $size_meta['status']='failed'; + $size_meta['error']=$ret['error']; + CompressX_Image_Meta_V2::update_image_meta_size($this->image_id,$size_key,$size_meta); + + $success=false; + $has_convert=false; + } + } + + if($has_convert) + { + CompressX_Image_Meta_V2::update_webp_image_converted($this->image_id); + //CompressX_Image_Meta_V2::update_image_meta_webp_converted($this->image_id,1); + } + + return $success; + } + + public function convert_to_avif() + { + if(CompressX_Image_Method::is_exclude_avif($this->image_id,$this->options)) + { + return true; + } + + if(!$this->need_convert_to_avif()) + { + return true; + } + + if(CompressX_Image_Meta_V2::get_image_meta_avif_converted($this->image_id)==1) + { + return true; + } + + $success=true; + $has_convert=true; + + $size =CompressX_Image_Meta_V2::get_image_meta_value($this->image_id,'size'); + $uploads=wp_get_upload_dir(); + $file_path = get_attached_file( $this->image_id ); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + foreach ($size as $size_key=>$size_meta) + { + if($size_meta['convert_avif_status']==1||$this->skip_size($size_key)) + { + continue; + } + + if($size_key=="og") + { + $filename= $file_path; + } + else if(CompressX_Image_Opt_Method::is_elementor_thumbs($size_key)) + { + $filename = $uploads['basedir'].'/'.$size_meta['file']; + } + else + { + $filename= path_join( dirname( $file_path ), $size_meta['file'] ); + } + + $nextgen_path=CompressX_Image_Opt_Method::get_output_path($filename); + if($type=="avif") + { + $des_filename=$nextgen_path; + } + else + { + $des_filename=$nextgen_path.'.avif'; + } + + CompressX_Image_Opt_Method::WriteLog($this->log,'Start AVIF conversion:'.basename($filename),'notice'); + + if(!file_exists($filename)) + { + CompressX_Image_Opt_Method::WriteLog($this->log,'File '.basename($filename).' not exist,so skip convert.','notice'); + $size_meta['convert_avif_status']=1; + $size_meta['status']='optimized'; + CompressX_Image_Meta_V2::update_image_meta_size($this->image_id,$size_key,$size_meta); + + continue; + } + + $ret=$this->_convert_avif($filename,$des_filename); + + if($ret['result']=='success') + { + $avif_converted_size=filesize($des_filename); + $file_size=filesize($filename); + if($this->options['auto_remove_larger_format']&&$avif_converted_size>$file_size) + { + @wp_delete_file($des_filename); + CompressX_Image_Opt_Method::WriteLog($this->log,'AVIF size larger than original size, deleting file '.basename($des_filename).'.','notice'); + $size_meta['avif_converted_size']=$file_size; + } + else + { + $size_meta['avif_converted_size']=$avif_converted_size; + } + $size_meta['file_size']=$file_size; + $size_meta['convert_avif_status']=1; + $size_meta['status']='optimized'; + CompressX_Image_Meta_V2::update_image_meta_size($this->image_id,$size_key,$size_meta); + } + else + { + $size_meta['convert_avif_status']=0; + $size_meta['status']='failed'; + $size_meta['error']=$ret['error']; + CompressX_Image_Meta_V2::update_image_meta_size($this->image_id,$size_key,$size_meta); + + $success=false; + $has_convert=false; + } + } + + if($has_convert) + { + //CompressX_Image_Meta_V2::update_image_meta_avif_converted($this->image_id,1); + CompressX_Image_Meta_V2::update_avif_image_converted($this->image_id); + } + + return $success; + } + + public function _convert_webp($filename,$des_filename) + { + if($this->options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::convert_webp_gd_ex($filename,$des_filename,$this->options); + } + else if($this->options['converter_method']=='imagick') + { + $ret=CompressX_Image_Opt_Method::convert_webp_imagick_ex($filename,$des_filename,$this->options); + } + else + { + $ret=CompressX_Image_Opt_Method::convert_webp_gd_ex($filename,$des_filename,$this->options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($this->log,'Converting '.basename($filename).' to WebP succeeded.','notice'); + } + else + { + CompressX_Image_Opt_Method::WriteLog($this->log,'Converting '.basename($filename).' to WebP failed. Error:'.$ret['error'],'notice'); + } + return $ret; + } + + public function _convert_avif($filename,$des_filename) + { + if($this->options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::convert_avif_gd_ex($filename,$des_filename,$this->options); + } + else if($this->options['converter_method']=='imagick') + { + $ret=CompressX_Image_Opt_Method::convert_avif_imagick_ex($filename,$des_filename,$this->options); + } + else + { + $ret=CompressX_Image_Opt_Method::convert_avif_gd_ex($filename,$des_filename,$this->options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($this->log,'Converting '.basename($filename).' to AVIF succeeded.','notice'); + } + else + { + CompressX_Image_Opt_Method::WriteLog($this->log,'Converting '.basename($filename).' to AVIF failed. Error:'.$ret['error'],'notice'); + } + + return $ret; + } + + public function need_compress() + { + $file_path = get_attached_file($this->image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='webp') + { + return $this->options['compressed_webp']; + } + else if($type=='avif') + { + return $this->options['compressed_avif']; + } + + return false; + } + + public function skip_size($size_key) + { + if(isset($this->options['skip_size'])&&isset($this->options['skip_size'][$size_key])) + { + return $this->options['skip_size'][$size_key]; + } + + return false; + } + + public function need_convert_to_webp_ex() + { + $file_path = get_attached_file($this->image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='webp'||$type=='avif') + { + return false; + } + + return $this->options['convert_to_webp']; + } + + public function need_convert_to_avif_ex() + { + $file_path = get_attached_file($this->image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='avif') + { + return false; + } + + return $this->options['convert_to_avif']; + } + + public function need_convert_to_webp() + { + $file_path = get_attached_file($this->image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='avif') + { + return false; + } + + return $this->options['convert_to_webp']; + } + + public function need_convert_to_avif() + { + return $this->options['convert_to_avif']; + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-imgoptim-task.php b/wp-content/plugins/compressx/includes/class-compressx-imgoptim-task.php new file mode 100644 index 0000000..13ce808 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-imgoptim-task.php @@ -0,0 +1,771 @@ +get_task(); + } + + public function update_task() + { + CompressX_Options::update_option('compressx_image_opt_task',$this->task); + $this->get_task(); + } + + public function get_task() + { + $this->task=CompressX_Options::get_option('compressx_image_opt_task',array()); + } + + public function init_task($force=false) + { + $this->task=array(); + + $offset=get_option('gmt_offset'); + $localtime = time() + $offset * 60 * 60; + $this->task['log']=uniqid('compressx_').'_'.gmdate('Ymd',$localtime).'_log.txt'; + + $this->log=CompressX_Log_Ex::get_instance(); + $this->log->CreateLogFile($this->task['log']); + + $this->init_options(); + + $this->task['options']['force']=$force; + $this->task['offset']=0; + + if(!$this->get_need_optimize_images()) + { + $ret['result']='failed'; + $ret['no_unoptimized_images']=true; + $ret['error']=__('No unoptimized images found.','compressx'); + $this->update_task(); + return $ret; + } + + $this->task['status']='init'; + $this->task['last_update_time']=time(); + $this->task['retry']=0; + $this->task['total_retry']=0; + + //$this->task['total_images']=CompressX_Options::get_option("compressx_need_optimized_images",0); + $this->task['total_images']=CompressX_Image_Scanner::get_need_optimize_images_count($force); + $this->task['optimized_images']=0; + $this->task['skipped_images']=0; + $this->task['opt_images']=0; + $this->task['failed_images']=0; + + $this->task['current_image']=0; + $this->task['current_file']=''; + + $this->task['error']=''; + $this->task['update_error_list']=false; + $this->update_task(); + + $ret['result']='success'; + $ret["test"]=$this->task; + return $ret; + } + + public function init_options() + { + $general_options=CompressX_Options::get_general_settings(); + $quality_options=CompressX_Options::get_quality_option(); + $this->task['options']=array_merge($general_options,$quality_options); + + $this->task['options']['exclude']=CompressX_Options::get_excludes(); + } + + public function OpenLog() + { + $this->log=CompressX_Log_Ex::get_instance(); + $this->log->OpenLogFile($this->task['log']); + } + + public function WriteLog($log,$type) + { + if (is_a($this->log, 'CompressX_Log_Ex')) + { + $this->log->WriteLog($log,$type); + } + else + { + $this->log=CompressX_Log_Ex::get_instance(); + $this->log->OpenLogFile($this->task['log']); + $this->log->WriteLog($log,$type); + } + } + + public function get_log_file() + { + if(isset($this->task['log'])) + { + return $this->task['log']; + } + else + { + return ""; + } + } + + public function get_need_optimize_images() + { + $ret=$this->init_optimize_images(); + if($ret['finished']&&empty($this->task['images'])) + { + return false; + } + else + { + return true; + } + } + + public function get_task_status() + { + if(empty($this->task)) + { + $ret['result']='failed'; + $ret['error']=__('All image(s) optimized successfully.','compressx'); + return $ret; + } + + if($this->task['status']=='error') + { + $ret['result']='failed'; + $ret['error']=$this->task['error']; + } + else if($this->task['status']=='completed') + { + $ret['result']='success'; + $ret['status']='completed'; + } + else if($this->task['status']=='finished') + { + $ret['result']='success'; + $ret['status']='finished'; + } + else if($this->task['status']=='timeout') + { + $ret['result']='success'; + $ret['status']='completed'; + } + else if($this->task['status']=='init') + { + $ret['result']='success'; + $ret['status']='completed'; + } + else + { + $ret['result']='success'; + $ret['status']='running'; + } + return $ret; + } + + public function init_optimize_images() + { + $this->task['images']=array(); + + $max_count=200; + $force=$this->task['options']['force']; + $start_row=$this->task['offset']; + $image_ids=CompressX_Image_Scanner::get_need_optimize_images_by_cursor($start_row,$max_count,$force); + if(!empty($image_ids)) + { + $last_id=$this->task['offset']; + foreach ($image_ids as $image_id) + { + $image['id']=$image_id; + $image['finished']=0; + $this->task['images'][$image['id']]=$image; + $last_id = $image_id; + } + $this->task['offset'] = $last_id; + $this->update_task(); + } + + if (empty($image_ids)||count($image_ids) < $max_count) + { + $finished=true; + } + else + { + $finished=false; + } + $ret['result']='success'; + $ret['finished']=$finished; + return $ret; + } + + public function get_need_optimize_image() + { + if(!empty($this->task['images'])) + { + foreach ($this->task['images'] as $image) + { + if($image['finished']==0) + { + $ret['result']='success'; + $ret['finished']=false; + $ret['image_id']=$image['id']; + return $ret; + } + } + } + + $this->task['images']=array(); + $ret=$this->init_optimize_images(); + + if($ret['finished']&&empty($this->task['images'])) + { + $ret['result']='success'; + $ret['finished']=true; + $ret['image_id']=false; + return $ret; + } + else + { + if(empty($this->task['images'])) + { + $ret['result']='success'; + $ret['finished']=false; + $ret['image_id']=false; + return $ret; + } + else + { + foreach ($this->task['images'] as $image) + { + if($image['finished']==0) + { + $ret['result']='success'; + $ret['finished']=false; + $ret['image_id']=$image['id']; + return $ret; + } + } + + $ret['result']='success'; + $ret['finished']=false; + $ret['image_id']=false; + return $ret; + } + } + } + + public function do_optimize_image() + { + $this->OpenLog(); + + if($this->check_timeout()) + { + $this->WriteLog('Optimizing image failed. Error:task timeout','error'); + + $this->task['status']='error'; + $this->task['error']='task timeout'; + $this->task['last_update_time']=time(); + $this->update_task(); + + $ret['result']='failed'; + $ret['error']='task timeout'; + return $ret; + } + + $this->task['status']='running'; + $this->task['last_update_time']=time(); + $this->update_task(); + + $converter_images_pre_request=$this->task['options']['converter_images_pre_request']; + + $time_start=time(); + $max_timeout_limit=90; + for ($i=0;$i<$converter_images_pre_request;$i++) + { + $ret=$this->get_need_optimize_image(); + if($ret['finished']&&$ret['image_id']===false) + { + $ret['result']='success'; + + $this->task['status']='finished'; + $this->task['last_update_time']=time(); + delete_transient('compressx_set_global_stats'); + $this->update_task(); + + do_action('compressx_purge_cache'); + + return $ret; + } + else if($ret['image_id']===false) + { + break; + } + else + { + $image_id=$ret['image_id']; + } + + $this->task['status']='running'; + $this->task['last_update_time']=time(); + $this->update_task(); + + if(CompressX_Image_Method::exclude_path($image_id,$this->task['options']['exclude'])) + { + CompressX_Image_Meta_V2::update_image_meta_status($image_id,'skip'); + $this->WriteLog('Exclude images: id:'.$image_id,'notice'); + $this->task['images'][$image_id]['finished']=1; + $this->task['last_update_time']=time(); + $this->task['retry']=0; + $this->task['total_retry']=0; + $this->task['skipped_images']++; + $this->update_task(); + } + else + { + if($this->task['options']['force']) + { + CompressX_Image_Meta_V2::generate_images_meta($image_id,$this->task['options']); + } + + $this->WriteLog('Start optimizing images: id:'.$image_id,'notice'); + + $ret=$this->optimize_image($image_id); + + if($ret['result']=='success') + { + $this->WriteLog('Optimizing image id:'.$image_id.' succeeded.','notice'); + + $this->task['images'][$image_id]['finished']=1; + $this->task['last_update_time']=time(); + $this->task['retry']=0; + $this->task['total_retry']=0; + $this->task['optimized_images']++; + $this->update_task(); + + do_action('compressx_after_optimize_image',$image_id); + } + else + { + $this->WriteLog('Optimizing image failed. Error:'.$ret['error'],'error'); + + $this->task['status']='error'; + $this->task['error']=$ret['error']; + $this->task['last_update_time']=time(); + $this->update_task(); + return $ret; + } + } + + + $time_spend=time()-$time_start; + if($time_spend>$max_timeout_limit) + { + break; + } + } + + delete_transient('compressx_set_global_stats'); + + $time_spend=time()-$time_start; + $this->WriteLog('End request cost time:'.$time_spend.'.','notice'); + $this->task['status']='completed'; + $this->task['last_update_time']=time(); + $this->update_task(); + $ret['result']='success'; + $ret['test']=$this->task; + return $ret; + } + + public function skip_current_image() + { + $image_id=$this->task['current_image']; + if(isset($this->task['images'][$image_id])) + { + $this->task['images'][$image_id]['finished']=1; + $this->task['last_update_time']=time(); + $this->task['failed_images']++; + + CompressX_Image_Meta_V2::update_image_meta_status($image_id,'failed'); + + $this->update_task(); + + $this->WriteLog('skip current timout image:'.$image_id,'error'); + return true; + } + else + { + return false; + } + } + + public function optimize_image($image_id) + { + $this->task['current_image']=$image_id; + $file_path = get_attached_file( $image_id ); + $abs_root=CompressX_Image_Method::transfer_path(ABSPATH); + $attachment_dir=CompressX_Image_Method::transfer_path($file_path); + $this->task['current_file']=str_replace($abs_root,'',$attachment_dir); + $this->update_task(); + + $image=new Compressx_Image($image_id,$this->task['options']); + + if(empty($file_path)) + { + $this->WriteLog('Image:'.$image_id.' failed. Error: failed to get get_attached_file','notice'); + + $this->task['failed_images']++; + $this->update_task(); + + $error='Image:'.$image_id.' failed. Error: failed to get get_attached_file'; + CompressX_Image_Meta_V2::update_image_failed($image_id,$error); + + $ret['result']='success'; + return $ret; + } + + if(!file_exists($file_path)) + { + $this->WriteLog('Image:'.$image_id.' failed. Error: file not exists '.$file_path,'notice'); + + $this->task['failed_images']++; + $this->update_task(); + + $error='Image:'.$image_id.' failed. Error: file not exists '.$file_path; + CompressX_Image_Meta_V2::update_image_failed($image_id,$error); + + $ret['result']='success'; + return $ret; + } + + if(!$this->check_file_mime_content_type($file_path)) + { + $this->WriteLog('Image:'.$image_id.' failed. Error: mime content type not support','notice'); + + $error='Image:'.$image_id.' failed. Error: mime content type not support'; + + $this->task['failed_images']++; + $this->update_task(); + CompressX_Image_Meta_V2::update_image_failed($image_id,$error); + + $ret['result']='success'; + return $ret; + } + + CompressX_Image_Meta_V2::update_image_progressing($image_id); + + $image->resize(); + + if($image->convert()) + { + $this->task['opt_images']++; + $this->update_task(); + CompressX_Image_Meta_V2::update_image_meta_status($image_id,'optimized'); + } + else + { + $this->task['failed_images']++; + $this->update_task(); + CompressX_Image_Meta_V2::update_image_meta_status($image_id,'failed'); + } + CompressX_Image_Meta_V2::delete_image_progressing($image_id); + + $ret['result']='success'; + return $ret; + } + + public function check_file_mime_content_type($file_path) + { + if(function_exists( 'mime_content_type' )) + { + $type=mime_content_type($file_path); + if($type=="text/html") + { + return false; + } + else + { + return true; + } + } + else + { + return true; + } + } + + public function get_task_progress() + { + $this->get_task(); + + if(empty($this->task)) + { + $ret['result']='failed'; + $ret['error']=__('Finish optimizing images.','compressx'); + $ret['percent']=0; + $ret['timeout']=0; + $ret['log']=__('All image(s) optimized successfully.','compressx'); + return $ret; + } + + if(isset($this->task['total_images'])) + { + $ret['total_images']=$this->task['total_images']; + } + else + { + $ret['total_images']=0; + } + + $ret['optimized_images']=0; + if(isset($this->task['optimized_images'])) + { + $ret['optimized_images']=$this->task['optimized_images']; + } + + if($ret['total_images']>0) + { + $percent= intval(($ret['optimized_images']/$ret['total_images'])*100); + } + else + { + $percent=0; + } + + $ret['log']=sprintf( + '%1$d images found | Processed:%2$d/%3$d (%4$d%%)', + $ret['total_images'],$this->task['optimized_images'],$ret['total_images'],$percent); + + $sub_total=sizeof($this->task['images']); + $sub_optimized_images=0; + foreach ($this->task['images'] as $image) + { + if($image['finished']==1) + { + $sub_optimized_images++; + } + } + + if($sub_total>0) + { + $sub_percent= intval(($sub_optimized_images/$sub_total)*100); + } + else + { + $sub_percent=0; + } + + + if(!empty($this->task['current_file'])) + { + $ret['sub_log']=sprintf( + 'Current Subtask: %1$d/%2$d | Processing:%3$s', + $sub_optimized_images,$sub_total,basename($this->task['current_file'])); + } + else + { + $ret['sub_log']=sprintf( + 'Current Subtask: %1$d/%2$d ', + $sub_optimized_images,$sub_total); + } + + $ret['sub_log_ex']=sprintf( + '%1$d / %2$d', + $sub_optimized_images,$sub_total); + + $ret['percent']= $sub_percent; + //$ret['sub_log']='Current Subtask: '.$sub_optimized_images.'/'.$sub_total; + + + if(isset($this->task['status'])) + { + if($this->task['status']=='error') + { + $ret['result']='failed'; + $ret['error']=$this->task['error']; + $ret['timeout']=0; + $ret['log']=$this->task['error']; + } + else if($this->task['status']=='finished') + { + $ret['result']='success'; + $ret['continue']=0; + $ret['finished']=1; + $ret['timeout']=0; + $ret['percent']= 100; + + $ret['message']=sprintf( + 'Total optimized images:%1$d Succeeded:%2$d Failed:%3$d', + $ret['total_images'],$this->task['opt_images'],$this->task['failed_images']); + + //$ret['message']='Total optimized images:'.$ret['total_images'].' Succeeded:'.$this->task['opt_images'].' Failed:'.$this->task['failed_images']; + + $dismiss=CompressX_Options::get_option('compressx_rating_dismiss',false); + if($dismiss===false) + { + $ret['show_review']=1; + } + else if($dismiss==0) + { + $ret['show_review']=0; + } + else if($dismisstask['status']=='completed') + { + $ret['result']='success'; + $ret['continue']=0; + $ret['finished']=0; + $ret['timeout']=0; + $ret['message']=sprintf( + 'Total optimized images:%1$d Succeeded:%2$d Failed:%3$d', + $ret['total_images'],$this->task['opt_images'],$this->task['failed_images']); + } + else + { + if(isset($this->task['last_update_time'])) + { + if(time()-$this->task['last_update_time']>120) + { + $this->task['last_update_time']=time(); + $this->task['retry']++; + $this->task['total_retry']++; + $this->task['status']='timeout'; + $this->update_task(); + + $ret['timeout']=1; + + $ret['result']='failed'; + $ret['error']='Task timeout'; + $ret['percent']=0; + $ret['continue']=0; + $ret['finished']=0; + $ret['retry']=$this->task['retry']; + $ret['log']='task time out'; + } + else + { + $ret['continue']=1; + $ret['finished']=0; + $ret['timeout']=0; + $ret['running_time']=time()-$this->task['last_update_time']; + $ret['result']='success'; + } + } + else + { + $ret['result']='failed'; + $ret['error']='not start task'; + $ret['timeout']=0; + $ret['percent']=0; + $ret['log']='not start task'; + } + } + } + else + { + $ret['result']='failed'; + $ret['error']='not start task'; + $ret['timeout']=0; + $ret['percent']=0; + $ret['log']='not start task'; + } + + $ret['test']=$this->task; + return $ret; + } + + public function get_task_progress_ex() + { + $ret = $this->get_task_progress(); + + if ($ret['result'] !== 'success') { + return $ret; + } + + $total = intval($ret['total_images']); + $optimized = intval($ret['optimized_images']); + $failed = intval($this->task['failed_images']); + $skipped = intval($this->task['skipped_images']); + + $remaining = max(0, $total - $optimized - $failed - $skipped); + + $ret["progress_text"] = sprintf( + '%1$d / %2$d images optimized', + $optimized, + $total + ); + + $ret["progress_percent"] =intval( + $total > 0 ? round(($optimized / $total) * 100, 2) : 0); + + $ret["sub_progress_text"] = $ret["sub_log_ex"]; + + $ret["sub_progress_percent"] = intval($ret["percent"]); + + $ret["optimized"] = $optimized; + $ret["errors"] = $failed; + $ret["remaining"] = $remaining; + + return $ret; + } + + + + public function check_timeout() + { + if(isset($this->task['status'])) + { + if($this->task['status']=='timeout') + { + if($this->task['retry']>3&&$this->task['total_retry']<10) + { + if($this->skip_current_image()) + { + return false; + } + else + { + return true; + } + } + else if($this->task['total_retry']>10) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-log.php b/wp-content/plugins/compressx/includes/class-compressx-log.php new file mode 100644 index 0000000..0c679e4 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-log.php @@ -0,0 +1,1245 @@ +log_file_handle=false; + } + + public function fopen($filename,$mode) + { + return @fopen($filename,$mode); + } + + public function fwrite($handle,$text) + { + if($handle) + { + return @fwrite($handle,$text ); + } + else + { + return false; + } + } + + public function CreateLogFile($file_name='') + { + if(empty($file_name)) + { + $offset=get_option('gmt_offset'); + $localtime = time() + $offset * 60 * 60; + $file_name='compressx_'.gmdate('Ymd',$localtime).'_log.txt'; + } + + $this->log_file=$this->GetSaveLogFolder().$file_name; + $this->log_file_handle = $this->fopen($this->log_file, 'a'); + if($this->log_file_handle===false) + { + return false; + } + $text="====================================================\n"; + $time =gmdate("Y-m-d H:i:s",time()); + $text.='open log file: '.$time."\n"; + $this->fwrite($this->log_file_handle,$text); + return $this->log_file; + } + + public function OpenLogFile($file_name='') + { + if(empty($file_name)) + { + $offset=get_option('gmt_offset'); + $localtime = time() + $offset * 60 * 60; + $file_name='compressx_'.gmdate('Ymd',$localtime).'_log.txt'; + } + + $this->log_file=$this->GetSaveLogFolder().$file_name; + + $this->log_file_handle = $this->fopen($this->log_file, 'a'); + + return $this->log_file; + } + + public function WriteLog($log,$type) + { + if ($this->log_file_handle) + { + $time =gmdate("Y-m-d H:i:s",time()); + $text='['.$time.']'.'['.$type.']'.$log."\n"; + $this->fwrite($this->log_file_handle,$text ); + } + } + + public function GetlastLog() + { + if(empty($file_name)) + { + $offset=get_option('gmt_offset'); + $localtime = time() + $offset * 60 * 60; + $file_name='compressx_'.gmdate('Ymd',$localtime).'_log.txt'; + } + + $this->log_file=$this->GetSaveLogFolder().$file_name; + $file = file($this->log_file); + $text=''; + for ($i = max(0, count($file)-1); $i < count($file); $i++) + { + $text.= $file[$i] . "\n"; + } + return $text; + } + + public function GetSaveLogFolder() + { + $path=WP_CONTENT_DIR.'/compressx/'.'log'; + + if(!is_dir($path)) + { + wp_mkdir_p($path); + $this->fopen($path.DIRECTORY_SEPARATOR.'index.html', 'x'); + $tempfile=$this->fopen($path.DIRECTORY_SEPARATOR.'.htaccess', 'x'); + if($tempfile) + { + $text="deny from all"; + $this->fwrite($tempfile,$text ); + } + } + + return $path.'/'; + } + + public function get_logs() + { + $dir=$this->GetSaveLogFolder(); + + $files = scandir($dir, SCANDIR_SORT_DESCENDING); + + $log_files=array(); + + $regex='#^compressx.*_log.txt#'; + foreach ($files as $filename) + { + if(preg_match($regex,$filename)) + { + $log_files[] = $dir.DIRECTORY_SEPARATOR.$filename; + } + + if(sizeof($log_files)>=5) + { + break; + } + } + + return $log_files; + } +} + +class CompressX_Log_Ex +{ + private static $instance = null; + + public $log_file = ''; + public $log_file_handle = false; + + private function __construct() {} + + public static function get_instance() + { + if (self::$instance === null) { + self::$instance = new self(); + } + return self::$instance; + } + + public function fopen($filename,$mode) + { + return @fopen($filename,$mode); + } + + public function fwrite($handle,$text) + { + if($handle) + { + return @fwrite($handle,$text ); + } + else + { + return false; + } + } + + public function CreateLogFile($file_name = '') + { + if ($this->log_file_handle && !empty($this->log_file)) { + return $this->log_file; + } + + if (empty($file_name)) { + $offset = get_option('gmt_offset'); + $localtime = time() + $offset * 3600; + $file_name = 'compressx_' . gmdate('Ymd', $localtime) . '_log.txt'; + } + + $this->log_file = $this->GetSaveLogFolder() . $file_name; + $this->log_file_handle = $this->fopen($this->log_file, 'a'); + + if ($this->log_file_handle === false) { + return false; + } + + $this->write_open_header(); + return $this->log_file; + } + + public function OpenLogFile($file_name = '') + { + if (empty($file_name)) { + $offset = get_option('gmt_offset'); + $localtime = time() + $offset * 3600; + $file_name = 'compressx_' . gmdate('Ymd', $localtime) . '_log.txt'; + } + + $this->log_file = $this->GetSaveLogFolder() . $file_name; + $this->log_file_handle = $this->fopen($this->log_file, 'a'); + + return $this->log_file; + } + + public function use_log_file($file_name) + { + $this->log_file = $this->GetSaveLogFolder() . $file_name; + + if (!$this->log_file_handle) { + $this->log_file_handle = $this->fopen($this->log_file, 'a'); + $this->write_open_header(); + } + return $this->log_file; + } + + public function WriteLog($log, $type) + { + if (!$this->ensure_handle_open()) { + return; + } + + $time = gmdate("Y-m-d H:i:s", time()); + $text = '[' . $time . '][' . $type . '] ' . $log . "\n"; + + $this->fwrite($this->log_file_handle, $text); + } + + public function GetlastLog() + { + if (empty($this->log_file)) { + return ''; + } + + if (!file_exists($this->log_file)) { + return ''; + } + + $file = file($this->log_file); + $text = $file[count($file) - 1] ?? ''; + + return $text; + } + + public function get_log_content($offset) + { + $file = $this->log_file; + if (!file_exists($file)) { + return [ + 'result' => 'success', + 'offset' => 0, + 'content' => '' + ]; + } + + $fp = $this->fopen($file, 'r'); + if (!$fp) { + return [ + 'result' => 'success', + 'offset' => 0, + 'content' => '' + ]; + } + + if ($offset > 0) { + fseek($fp, $offset); + } + + $content = ''; + while (!feof($fp)) { + $content .= fgets($fp); + } + + $new_offset = ftell($fp); + fclose($fp); + + return [ + 'result' => 'success', + 'offset' => $new_offset, + 'content' => $content + ]; + } + + public function GetSaveLogFolder() + { + $path = WP_CONTENT_DIR . '/compressx/log'; + + if (!is_dir($path)) { + wp_mkdir_p($path); + @file_put_contents($path . '/index.html', ''); + @file_put_contents($path . '/.htaccess', "deny from all"); + } + + return $path . '/'; + } + + private function ensure_handle_open() + { + if ($this->log_file_handle) + { + return true; + } + + if (!empty($this->log_file)) + { + $this->log_file_handle = $this->fopen($this->log_file, 'a'); + return (bool)$this->log_file_handle; + } + + $this->OpenLogFile(); + return (bool)$this->log_file_handle; + } + + private function write_open_header() + { + $text = "====================================================\n"; + $time = gmdate("Y-m-d H:i:s", time()); + $text .= "open log file: {$time}\n"; + $this->fwrite($this->log_file_handle, $text); + } + + public function get_logs() + { + $dir = $this->GetSaveLogFolder(); + $files = scandir($dir, SCANDIR_SORT_DESCENDING); + + $log_files = []; + $regex = '#^compressx.*_log.txt#'; + + foreach ($files as $filename) { + if (preg_match($regex, $filename)) { + $log_files[] = $dir . '/' . $filename; + } + if (count($log_files) >= 5) { + break; + } + } + return $log_files; + } +} + + +if ( ! class_exists( 'WP_List_Table' ) ) +{ + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); +} + +class CompressX_Log_List extends WP_List_Table +{ + public $page_num; + public $log_list; + + public function __construct( $args = array() ) + { + parent::__construct( + array( + 'plural' => 'log', + 'screen' => 'log' + ) + ); + } + + + + public function get_columns() + { + $columns = array(); + $columns['cx_date'] = __('Data and Time','compressx'); + $columns['cx_log_file_name'] =__( 'Log File Name', 'compressx' ); + $columns['cx_size'] = __( 'Log Size', 'compressx' ); + $columns['cx_log_actions'] = __( 'Actions', 'compressx' ); + + + return $columns; + } + + public function set_log_list($log_list, $page_num=1) + { + $this->log_list=$log_list; + $this->page_num=$page_num; + } + + public function get_pagenum() + { + if($this->page_num=='first') + { + $this->page_num=1; + } + else if($this->page_num=='last') + { + $this->page_num=$this->_pagination_args['total_pages']; + } + $pagenum = $this->page_num ? $this->page_num : 0; + + if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) + { + $pagenum = $this->_pagination_args['total_pages']; + } + + return max( 1, $pagenum ); + } + + public function prepare_items() + { + $columns = $this->get_columns(); + $hidden = array(); + $sortable = array(); + $this->_column_headers = array($columns, $hidden, $sortable); + + $total_items =sizeof($this->log_list); + + $this->set_pagination_args( + array( + 'total_items' => $total_items, + 'per_page' => 30, + ) + ); + } + + public function has_items() + { + return !empty($this->log_list); + } + + public function _column_cx_date( $log ) + { + echo ''.esc_html($log['date']).''; + } + + public function _column_cx_log_file_name( $log ) + { + echo ''.esc_html($log['file_name']).''; + } + + public function _column_cx_size( $log ) + { + echo ''.esc_html(size_format($log['size'],2)).''; + } + + public function _column_cx_log_actions( $log ) + { + ?> + + | + | + + + _display_rows( $this->log_list ); + } + + private function _display_rows($log_list) + { + $page=$this->get_pagenum(); + + $page_log_list=array(); + $count=0; + while ( $count<$page ) + { + $page_log_list = array_splice( $log_list, 0, 30); + $count++; + } + foreach ( $page_log_list as $log) + { + $this->single_row($log); + } + } + + public function single_row($log) + { + ?> + + single_row_columns( $log ); ?> + + _args['plural'] ); + $css_type = 'padding:0 0 1em 0;'; + } + else if( 'bottom' === $which ) { + $css_type = 'display: none;'; + } + + $total_pages = $this->_pagination_args['total_pages']; + if ( $total_pages >1) + { + ?> +
+
+ + + to + + + +
+ extra_tablenav( $which ); + $this->pagination( $which ); + ?> + +
+
+ display_tablenav( 'top' ); + + $this->screen->render_screen_reader_content( 'heading_list' ); + + $total_pages = $this->_pagination_args['total_pages']; + if ( $total_pages <= 1) + { + ?> +
+
+ + + to + + + +
+
+ + + + + print_column_headers(); ?> + + + + + display_rows_or_placeholder(); ?> + + + + + print_column_headers(); ?> + + + +
+ display_tablenav( 'bottom' ); + } + + public function print_column_headers( $with_id = true ) + { + list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); + + if(isset($_SERVER['HTTP_HOST'])) + $HTTP_HOST=sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])); + else + $HTTP_HOST=""; + + if(isset($_SERVER['REQUEST_URI'])) + $REQUEST_URI=sanitize_text_field(wp_unslash($_SERVER['REQUEST_URI'])); + else + $REQUEST_URI=""; + + $current_url = set_url_scheme( 'http://' .$HTTP_HOST . $REQUEST_URI ); + $current_url = remove_query_arg( 'paged', $current_url ); + + // When users click on a column header to sort by other columns. + if ( isset( $_GET['orderby'] ) ) { + $current_orderby = $_GET['orderby']; + // In the initial view there's no orderby parameter. + } else { + $current_orderby = ''; + } + + // Not in the initial view and descending order. + if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { + $current_order = 'desc'; + } else { + // The initial view is not always 'asc', we'll take care of this below. + $current_order = 'asc'; + } + + if ( ! empty( $columns['cb'] ) ) { + static $cb_counter = 1; + $columns['cb'] = ' + '; + ++$cb_counter; + } + + foreach ( $columns as $column_key => $column_display_name ) + { + $class = array( 'manage-column', "column-$column_key" ); + $aria_sort_attr = ''; + $abbr_attr = ''; + $order_text = ''; + + if ( in_array( $column_key, $hidden, true ) ) { + $class[] = 'hidden'; + } + + if ( 'cb' === $column_key ) { + $class[] = 'check-column'; + } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) { + $class[] = 'num'; + } + + if ( isset( $sortable[ $column_key ] ) ) { + $orderby = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : ''; + $desc_first = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false; + $abbr = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : ''; + $orderby_text = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : ''; + $initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : ''; + + /* + * We're in the initial view and there's no $_GET['orderby'] then check if the + * initial sorting information is set in the sortable columns and use that. + */ + if ( '' === $current_orderby && $initial_order ) { + // Use the initially sorted column $orderby as current orderby. + $current_orderby = $orderby; + // Use the initially sorted column asc/desc order as initial order. + $current_order = $initial_order; + } + + /* + * True in the initial view when an initial orderby is set via get_sortable_columns() + * and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby. + */ + if ( $current_orderby === $orderby ) { + // The sorted column. The `aria-sort` attribute must be set only on the sorted column. + if ( 'asc' === $current_order ) { + $order = 'desc'; + $aria_sort_attr = ' aria-sort="ascending"'; + } else { + $order = 'asc'; + $aria_sort_attr = ' aria-sort="descending"'; + } + + $class[] = 'sorted'; + $class[] = $current_order; + } else { + // The other sortable columns. + $order = strtolower( $desc_first ); + + if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) { + $order = $desc_first ? 'desc' : 'asc'; + } + + $class[] = 'sortable'; + $class[] = 'desc' === $order ? 'asc' : 'desc'; + + $asc_text = 'Sort ascending.' ; + $desc_text = 'Sort descending.'; + $order_text = 'asc' === $order ? $asc_text : $desc_text; + } + + if ( '' !== $order_text ) { + $order_text = ' ' . $order_text . ''; + } + + // Print an 'abbr' attribute if a value is provided via get_sortable_columns(). + $abbr_attr = $abbr ? ' abbr="' . esc_attr( $abbr ) . '"' : ''; + + $column_display_name = sprintf( + '' . + '%2$s' . + '' . + '' . + '' . + '' . + '%3$s' . + '', + esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ), + $column_display_name, + $order_text + ); + } + + $tag = ( 'cb' === $column_key ) ? 'td' : 'th'; + $scope = ( 'th' === $tag ) ? 'scope="col"' : ''; + $id = $with_id ? "id='$column_key'" : ''; + + if ( ! empty( $class ) ) { + $class = "class='" . implode( ' ', $class ) . "'"; + } + + echo wp_kses_post("<$tag $scope $id $class $aria_sort_attr $abbr_attr>$column_display_name"); + } + } + + protected function get_table_classes() { + $mode = get_user_setting( 'posts_list_mode', 'list' ); + + $mode_class = esc_attr( 'table-view-' . $mode ); + + return array( 'cx-table','widefat', 'striped', $this->_args['plural'] ); + } +} + +class CompressX_Log_List_V2 extends WP_List_Table +{ + public $page_num; + public $log_list; + + public function __construct( $args = array() ) + { + parent::__construct( + array( + 'plural' => 'log', + 'screen' => 'log' + ) + ); + } + + + + public function get_columns() + { + $columns = array(); + $columns['cx_date'] = __('Date & Time','compressx'); + $columns['cx_log_file_name'] =__( 'Log File Name', 'compressx' ); + $columns['cx_size'] = __( 'Size', 'compressx' ); + $columns['cx_log_actions'] = __( 'Actions', 'compressx' ); + + return $columns; + } + + public function set_log_list($log_list, $page_num=1) + { + $this->log_list=$log_list; + $this->page_num=$page_num; + } + + public function get_pagenum() + { + if($this->page_num=='first') + { + $this->page_num=1; + } + else if($this->page_num=='last') + { + $this->page_num=$this->_pagination_args['total_pages']; + } + $pagenum = $this->page_num ? $this->page_num : 0; + + if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) + { + $pagenum = $this->_pagination_args['total_pages']; + } + + return max( 1, $pagenum ); + } + + public function prepare_items() + { + $columns = $this->get_columns(); + $hidden = array(); + $sortable = array(); + $this->_column_headers = array($columns, $hidden, $sortable); + + $total_items =sizeof($this->log_list); + + $this->set_pagination_args( + array( + 'total_items' => $total_items, + 'per_page' => 30, + ) + ); + } + + public function has_items() + { + return !empty($this->log_list); + } + + public function _column_cx_date( $log ) + { + echo ''.esc_html($log['date']).''; + } + + public function _column_cx_log_file_name( $log ) + { + echo ''.esc_html($log['file_name']).''; + } + + public function _column_cx_size( $log ) + { + echo ''.esc_html(size_format($log['size'],2)).''; + } + + public function _column_cx_log_actions( $log ) + { + ?> + + + + + + _display_rows( $this->log_list ); + } + + private function _display_rows($log_list) + { + $page=$this->get_pagenum(); + + $page_log_list=array(); + $count=0; + while ( $count<$page ) + { + $page_log_list = array_splice( $log_list, 0, 30); + $count++; + } + foreach ( $page_log_list as $log) + { + $this->single_row($log); + } + } + + public function single_row($log) + { + ?> + + single_row_columns( $log ); ?> + + _args['plural'] ); + $css_type = 'padding:0 0 1em 0;'; + } + else if( 'bottom' === $which ) { + $css_type = 'display: none;'; + } + + $total_pages = $this->_pagination_args['total_pages']; + if ( $total_pages >1) + { + ?> +
+
+ + + to + + + +
+ extra_tablenav( $which ); + $this->pagination( $which ); + ?> + +
+
+ _pagination_args ) ) { + return; + } + + $total_items = isset( $this->_pagination_args['total_items'] ) ? (int) $this->_pagination_args['total_items'] : 0; + $total_pages = isset( $this->_pagination_args['total_pages'] ) ? (int) $this->_pagination_args['total_pages'] : 0; + $infinite_scroll = false; + + if ( isset( $this->_pagination_args['infinite_scroll'] ) ) { + $infinite_scroll = $this->_pagination_args['infinite_scroll']; + } + + if ( 'top' === $which && $total_pages > 1 ) { + $this->screen->render_screen_reader_content( 'heading_pagination' ); + } + + $output = '' . sprintf( + _n( '%s item', '%s items', $total_items ), + number_format_i18n( $total_items ) + ) . ''; + + $current = (int) $this->get_pagenum(); + + if ( $current < 1 ) { + $current = 1; + } + + if ( $total_pages > 0 && $current > $total_pages ) { + $current = $total_pages; + } + + $page_links = array(); + + $total_pages_before = ''; + $total_pages_after = ''; + + $disable_first = false; + $disable_last = false; + $disable_prev = false; + $disable_next = false; + + if ( 1 === $current ) { + $disable_first = true; + $disable_prev = true; + } + + if ( $total_pages === $current ) { + $disable_last = true; + $disable_next = true; + } + + /* + * First page. + * Existing JS does not read value from .first-page. + * It directly sends page = 'first'. + */ + if ( $disable_first ) { + $page_links[] = ''; + } else { + $page_links[] = sprintf( + "%s", + esc_html__( 'First page' ), + '«' + ); + } + + /* + * Previous page. + * Existing JS reads value and then uses page - 1. + * Therefore value must be the current page, not the target page. + */ + if ( $disable_prev ) { + $page_links[] = ''; + } else { + $page_links[] = sprintf( + "%s", + esc_attr( $current ), + esc_html__( 'Previous page' ), + '‹' + ); + } + + if ( 'bottom' === $which ) { + $html_current_page = $current; + $total_pages_before = '' . esc_html__( 'Current Page' ) . ''; + } else { + $html_current_page = sprintf( + "%s", + '', + esc_attr( $current ), + strlen( (string) $total_pages ) + ); + } + + $html_total_pages = sprintf( + "%s", + number_format_i18n( $total_pages ) + ); + + $page_links[] = $total_pages_before . sprintf( + _x( '%1$s of %2$s', 'paging' ), + $html_current_page, + $html_total_pages + ) . $total_pages_after; + + /* + * Next page. + * Existing JS reads value and then uses page + 1. + * Therefore value must be the current page, not the target page. + */ + if ( $disable_next ) { + $page_links[] = ''; + } else { + $page_links[] = sprintf( + "%s", + esc_attr( $current ), + esc_html__( 'Next page' ), + '›' + ); + } + + /* + * Last page. + * Existing JS does not read value from .last-page. + * It directly sends page = 'last'. + */ + if ( $disable_last ) { + $page_links[] = ''; + } else { + $page_links[] = sprintf( + "%s", + esc_attr( $total_pages ), + esc_html__( 'Last page' ), + '»' + ); + } + + $pagination_links_class = 'pagination-links'; + + if ( ! empty( $infinite_scroll ) ) { + $pagination_links_class .= ' hide-if-js'; + } + + $output .= "\n" . implode( "\n", $page_links ) . ''; + + if ( $total_pages ) { + $page_class = $total_pages < 2 ? ' one-page' : ''; + } else { + $page_class = ' no-pages'; + } + + $this->_pagination = "
" . $output . '
'; + + echo $this->_pagination; + } + + public function display() + { + $this->display_tablenav( 'top' ); + + $this->screen->render_screen_reader_content( 'heading_list' ); + + $total_pages = $this->_pagination_args['total_pages']; + if ( $total_pages <= 1) + { + ?> +
+
+ + + to + + + +
+
+ + + + + print_column_headers(); ?> + + + + + display_rows_or_placeholder(); ?> + + + + + print_column_headers(); ?> + + + +
+ display_tablenav( 'bottom' ); + } + + public function print_column_headers( $with_id = true ) + { + list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); + + $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); + $current_url = remove_query_arg( 'paged', $current_url ); + + // When users click on a column header to sort by other columns. + if ( isset( $_GET['orderby'] ) ) { + $current_orderby = $_GET['orderby']; + // In the initial view there's no orderby parameter. + } else { + $current_orderby = ''; + } + + // Not in the initial view and descending order. + if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { + $current_order = 'desc'; + } else { + // The initial view is not always 'asc', we'll take care of this below. + $current_order = 'asc'; + } + + if ( ! empty( $columns['cb'] ) ) { + static $cb_counter = 1; + $columns['cb'] = ' + '; + ++$cb_counter; + } + + foreach ( $columns as $column_key => $column_display_name ) + { + $class = array( 'manage-column', "column-$column_key" ); + $aria_sort_attr = ''; + $abbr_attr = ''; + $order_text = ''; + + if ( in_array( $column_key, $hidden, true ) ) { + $class[] = 'hidden'; + } + + if ( 'cb' === $column_key ) { + $class[] = 'check-column'; + } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) { + $class[] = 'num'; + } + + if ( isset( $sortable[ $column_key ] ) ) { + $orderby = isset( $sortable[ $column_key ][0] ) ? $sortable[ $column_key ][0] : ''; + $desc_first = isset( $sortable[ $column_key ][1] ) ? $sortable[ $column_key ][1] : false; + $abbr = isset( $sortable[ $column_key ][2] ) ? $sortable[ $column_key ][2] : ''; + $orderby_text = isset( $sortable[ $column_key ][3] ) ? $sortable[ $column_key ][3] : ''; + $initial_order = isset( $sortable[ $column_key ][4] ) ? $sortable[ $column_key ][4] : ''; + + /* + * We're in the initial view and there's no $_GET['orderby'] then check if the + * initial sorting information is set in the sortable columns and use that. + */ + if ( '' === $current_orderby && $initial_order ) { + // Use the initially sorted column $orderby as current orderby. + $current_orderby = $orderby; + // Use the initially sorted column asc/desc order as initial order. + $current_order = $initial_order; + } + + /* + * True in the initial view when an initial orderby is set via get_sortable_columns() + * and true in the sorted views when the actual $_GET['orderby'] is equal to $orderby. + */ + if ( $current_orderby === $orderby ) { + // The sorted column. The `aria-sort` attribute must be set only on the sorted column. + if ( 'asc' === $current_order ) { + $order = 'desc'; + $aria_sort_attr = ' aria-sort="ascending"'; + } else { + $order = 'asc'; + $aria_sort_attr = ' aria-sort="descending"'; + } + + $class[] = 'sorted'; + $class[] = $current_order; + } else { + // The other sortable columns. + $order = strtolower( $desc_first ); + + if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) { + $order = $desc_first ? 'desc' : 'asc'; + } + + $class[] = 'sortable'; + $class[] = 'desc' === $order ? 'asc' : 'desc'; + + /* translators: Hidden accessibility text. */ + $asc_text = 'Sort ascending.'; + /* translators: Hidden accessibility text. */ + $desc_text = 'Sort descending.'; + $order_text = 'asc' === $order ? $asc_text : $desc_text; + } + + if ( '' !== $order_text ) { + $order_text = ' ' . $order_text . ''; + } + + // Print an 'abbr' attribute if a value is provided via get_sortable_columns(). + $abbr_attr = $abbr ? ' abbr="' . esc_attr( $abbr ) . '"' : ''; + + $column_display_name = sprintf( + '' . + '%2$s' . + '' . + '' . + '' . + '' . + '%3$s' . + '', + esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ), + $column_display_name, + $order_text + ); + } + + $tag = ( 'cb' === $column_key ) ? 'td' : 'th'; + $scope = ( 'th' === $tag ) ? 'scope="col"' : ''; + $id = $with_id ? "id='$column_key'" : ''; + + $class[] = 'compressx-v2-px-4'; + $class[] = 'compressx-v2-py-2'; + + if ( ! empty( $class ) ) { + $class = "class='" . implode( ' ', $class ) . "'"; + } + + echo wp_kses_post("<$tag $scope $id $class $aria_sort_attr $abbr_attr>$column_display_name"); + } + } + + protected function get_table_classes() { + $mode = get_user_setting( 'posts_list_mode', 'list' ); + + $mode_class = esc_attr( 'table-view-' . $mode ); + + return array( 'cx-table','widefat', 'striped','compressx-v2-text-sm', $this->_args['plural'] ); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-manual-optimization.php b/wp-content/plugins/compressx/includes/class-compressx-manual-optimization.php new file mode 100644 index 0000000..49ac46f --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-manual-optimization.php @@ -0,0 +1,286 @@ +ajax_check_security('compressx-can-convert'); + + if(!isset($_POST['id'])) + { + die(); + } + + $id=sanitize_key($_POST['id']); + + if(isset($_POST['page'])&&is_string($_POST['page'])) + { + $page=sanitize_text_field($_POST['page']); + } + else + { + $page='media'; + } + + try + { + CompressX_Image_Opt_Method::delete_image($id); + + if($page=='edit') + { + $html='

'.__('CompressX', 'compressx').'

'; + } + else + { + $html=''; + } + + if(!CompressX_Image_Meta_V2::is_image_optimized($id)) + { + if($this->is_image_progressing($id)) + { + $html.= "".__('Converting...', 'compressx').""; + } + else + { + $html.= "".__('Convert','compressx').""; + + if($this->is_image_processing_failed($id)) + { + $meta=CompressX_Image_Meta_V2::get_image_meta($id); + foreach ($meta['size'] as $size_key => $size_data) + { + if(!empty($size_data['error'])) + { + $html.='

'; + $html.="".esc_html($size_data['error']).""; + break; + } + } + } + } + } + else + { + $convert_size=CompressX_Image_Meta_V2::get_webp_converted_size($id); + $og_size=CompressX_Image_Meta_V2::get_og_size($id); + if($og_size>0) + { + if($convert_size>0) + { + $webp_percent = round(100 - ($convert_size / $og_size) * 100, 2); + } + else if(CompressX_Image_Meta_V2::is_avif_image($id)) + { + $webp_percent=0; + } + else + { + $webp_percent=0; + } + } + else + { + $webp_percent=0; + } + + $avif_size=CompressX_Image_Meta_V2::get_avif_converted_size($id); + if($og_size>0) + { + if($avif_size>0) + { + $avif_percent = round(100 - ($avif_size / $og_size) * 100, 2); + } + else + { + $avif_percent=0; + } + } + else + { + $avif_percent=0; + } + + $meta=CompressX_Image_Meta_V2::get_image_meta($id); + $thumbnail_counts=count($meta['size']); + + $html.='
    '; + $html.= '
  • '.__('Original','compressx').' : '.size_format($og_size,2).'
  • '; + $html.= '
  • '.__('Webp','compressx').' : '.size_format($convert_size,2).' '.__('Saved','compressx').' : '.$webp_percent.'%
  • '; + $html.= '
  • '.__('AVIF','compressx').' : '.size_format($avif_size,2).' '.__('Saved','compressx').' : '.$avif_percent.'%
  • '; + $html.= '
  • '.__('Thumbnails generated','compressx').' : '.$thumbnail_counts.'
  • '; + $html.="
  • Delete + + +
    + +

    + ".__('Delete the WebP and AVIF images generated by CompressX.','compressx')."
    +

    + +
    +
    +
  • "; + $html.='
'; + } + + $ret[$id]['html']=$html; + $ret['result']='success'; + + echo wp_json_encode($ret); + } + catch (Exception $error) + { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + //error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + } + die(); + } + + public function opt_single_image() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + if(!isset($_POST['id'])) + { + die(); + } + + $id=sanitize_key($_POST['id']); + delete_transient('compressx_set_global_stats'); + + set_time_limit(180); + + $this->log=new CompressX_Log(); + $this->log->CreateLogFile(); + + $this->do_optimize_image($id); + + die(); + } + + public function do_optimize_image($attachment_id) + { + $this->WriteLog('Start optimizing image id:'.$attachment_id,'notice'); + + $general_options=CompressX_Options::get_general_settings(); + $quality_options=CompressX_Options::get_quality_option(); + $options=array_merge($general_options,$quality_options); + + CompressX_Image_Meta_V2::update_image_progressing($attachment_id); + + $image=new Compressx_Image($attachment_id,$options); + $file_path = get_attached_file( $attachment_id ); + if(empty($file_path)) + { + $this->WriteLog('Image:'.$attachment_id.' failed. Error: failed to get get_attached_file','notice'); + + $error='Image:'.$attachment_id.' failed. Error: failed to get get_attached_file'; + CompressX_Image_Meta_V2::update_image_failed($attachment_id,$error); + CompressX_Image_Meta_V2::delete_image_progressing($attachment_id); + CompressX_Image_Meta_V2::update_image_meta_status($attachment_id,'failed'); + $ret['result']='success'; + return $ret; + } + + if(!file_exists($file_path)) + { + $this->WriteLog('Image:'.$attachment_id.' failed. Error: file not exists '.$file_path,'notice'); + + $error='Image:'.$attachment_id.' failed. Error: file not exists '.$file_path; + CompressX_Image_Meta_V2::update_image_failed($attachment_id,$error); + CompressX_Image_Meta_V2::delete_image_progressing($attachment_id); + CompressX_Image_Meta_V2::update_image_meta_status($attachment_id,'failed'); + $ret['result']='success'; + return $ret; + } + + $image->resize(); + + if($image->convert()) + { + CompressX_Image_Meta_V2::delete_image_progressing($attachment_id); + CompressX_Image_Meta_V2::update_image_meta_status($attachment_id,'optimized'); + do_action('compressx_purge_cache'); + do_action('compressx_after_optimize_image',$attachment_id); + } + else + { + CompressX_Image_Meta_V2::delete_image_progressing($attachment_id); + CompressX_Image_Meta_V2::update_image_meta_status($attachment_id,'failed'); + } + + $ret['result']='success'; + return $ret; + } + + public function WriteLog($log,$type) + { + if (is_a($this->log, 'CompressX_Log')) + { + $this->log->WriteLog($log,$type); + } + else + { + $this->log=new CompressX_Log(); + $this->log->OpenLogFile(); + $this->log->WriteLog($log,$type); + } + } + + public function is_image_processing_failed($post_id) + { + $status=CompressX_Image_Meta_V2::get_image_meta_status($post_id); + + if(empty($status)) + { + return false; + } + else + { + if($status=='failed') + { + return true; + } + else + { + return false; + } + } + } + + public function is_image_progressing($post_id) + { + $progressing=CompressX_Image_Meta_V2::get_image_progressing($post_id); + + if(empty($progressing)) + { + return false; + } + else + { + $current_time=time(); + if(($current_time-$progressing)>180) + { + return false; + } + else + { + return true; + } + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-media-replace.php b/wp-content/plugins/compressx/includes/class-compressx-media-replace.php new file mode 100644 index 0000000..0b2e378 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-media-replace.php @@ -0,0 +1,427 @@ +init_options($options); + if (! wp_attachment_is_image($attachment_id)) + { + $ret['result']="failed"; + $ret['error']="Attachment is not an image"; + + return $ret; + } + + $ret = []; + + if (!file_exists($replace_path)) + { + $ret['result']="failed"; + $ret['error']="Replace image file not found"; + + return $ret; + } + + $original_file_path = wp_get_original_image_path( $attachment_id ); + + if (!file_exists($original_file_path)) + { + $ret['result']="failed"; + $ret['error']="Original image file not found"; + return $ret; + } + + $old_attachment_meta = wp_get_attachment_metadata($attachment_id); + if (! is_array($old_attachment_meta)) + { + $old_attachment_meta = []; + } + + $ret = $this->replace_original_image($original_file_path, $replace_path); + if ($ret['result']=='failed') + { + return $ret; + } + + $ret = $this->build_new_size_metadata($old_attachment_meta); + if ($ret['result']=='failed') + { + return $ret; + } + + $new_size_meta=$ret['new_size_meta']; + + $this->cleanup_old_derivatives($original_file_path,$old_attachment_meta); + + $ret = $this->generate_and_update_metadata($attachment_id, $original_file_path ,$new_size_meta); + if ($ret['result']=='failed') + { + return $ret; + } + + $new_attachment_meta = wp_get_attachment_metadata($attachment_id); + if ( !empty( $new_attachment_meta['original_image'] ) ) + { + $pathinfo = pathinfo($original_file_path); + $scaled = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-scaled.' . ($pathinfo['extension'] ?? ''); + if (!empty($pathinfo['extension']) && file_exists($scaled)) + { + update_attached_file($attachment_id, $scaled); + } + } + else + { + update_attached_file($attachment_id, $original_file_path); + } + + wp_delete_file($replace_path); + $ret['result']='success'; + return $ret; + } + + public function init_options($options) + { + $this->options = wp_parse_args($options, [ + 'thumbnail_generation' => 'default_fill', + 'backup' => false, + ]); + } + + protected function rename( $source, $destination ) + { + + if ( ! file_exists( $source ) ) { + return false; + } + + global $wp_filesystem; + + if ( empty( $wp_filesystem ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + WP_Filesystem(); + } + + if ( empty( $wp_filesystem ) ) { + return false; + } + + return $wp_filesystem->move( $source, $destination, true ); + } + + protected function is_writable( $dir ) { + + global $wp_filesystem; + + if ( empty( $wp_filesystem ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + WP_Filesystem(); + } + + if ( empty( $wp_filesystem ) ) { + return false; + } + + return $wp_filesystem->is_writable( $dir ); + } + + protected function replace_original_image($original_file_path, $replace_path) + { + $ret = ['result' => 'failed']; + + $dir = dirname($original_file_path); + if (!is_dir($dir) || !$this->is_writable($dir)) + { + $ret['error'] = 'Original directory not writable'; + return $ret; + } + if (!file_exists($original_file_path)) { + $ret['error'] = 'Original image file not found before swap'; + return $ret; + } + if (!file_exists($replace_path)) { + $ret['error'] = 'Replace image file not found'; + return $ret; + } + + // 1) move replace file into same directory first (atomic rename needs same FS) + $new_temp = trailingslashit($dir) . basename($original_file_path) . '.__new_' . wp_generate_password(6, false, false); + + if (!$this->rename($replace_path, $new_temp)) + { + if (!@copy($replace_path, $new_temp)) + { + $ret['error'] = 'Failed to move replace file into target directory'; + return $ret; + } + @wp_delete_file($replace_path); + } + + // 2) old -> bak + $bak = trailingslashit($dir) . basename($original_file_path) . '.__bak_' . gmdate('Ymd_His'); + if (!$this->rename($original_file_path, $bak)) + { + @wp_delete_file($new_temp); + $ret['error'] = 'Failed to create bak file (rename old -> bak failed)'; + return $ret; + } + + // 3) new_temp -> old + if (!$this->rename($new_temp, $original_file_path)) + { + // rollback immediately + $this->rename($bak, $original_file_path); + @wp_delete_file($new_temp); + $ret['error'] = 'Failed to replace original file (rename new -> old failed)'; + return $ret; + } + + @wp_delete_file($bak); + + $ret['result'] = 'success'; + return $ret; + } + + protected function build_new_size_metadata($old_attachment_meta) + { + $ret = ['result' => 'failed']; + + $thumbnail_generation = (string) $this->options['thumbnail_generation']; + + // 1) Collect "current registered sizes" + $registered = function_exists('wp_get_registered_image_subsizes') + ? wp_get_registered_image_subsizes() + : []; + + $plan_new = []; + foreach ($registered as $name => $cfg) + { + $w = isset($cfg['width']) ? (int) $cfg['width'] : 0; + $h = isset($cfg['height']) ? (int) $cfg['height'] : 0; + + // drop sizes with no constraint + if ($w <= 0 && $h <= 0) + { + continue; + } + + $plan_new[$name] = [ + 'width' => max(0, $w), + 'height' => max(0, $h), + 'crop' => isset($cfg['crop']) ? (bool) $cfg['crop'] : false + ]; + } + + // 2) Collect "old sizes" from attachment metadata + $plan_old = []; + if (isset($old_attachment_meta['sizes']) && is_array($old_attachment_meta['sizes'])) + { + foreach ($old_attachment_meta['sizes'] as $name => $data) + { + if (!is_array($data)) + { + continue; + } + + $w = isset($data['width']) ? (int) $data['width'] : 0; + $h = isset($data['height']) ? (int) $data['height'] : 0; + + if ($w <= 0 || $h <= 0) + { + continue; + } + + // Old meta does not store crop; we'll decide later by strategy. + $plan_old[$name] = [ + 'width' => $w, + 'height' => $h, + 'crop' => true + ]; + } + } + + // 3) Build final plan by mode + if ($thumbnail_generation === 'match_original') + { + $plan = $plan_old; + } + //elseif ($thumbnail_generation === 'force_old') + //{ + // $plan = $plan_old; + //} + elseif ($thumbnail_generation === 'default_fill') + { + $plan = $plan_new; + foreach ($plan_old as $name => $cfg) + { + if (isset($plan[$name])) + { + $w = $plan[$name]['width']; + $h = $plan[$name]['height']; + if ($w != $cfg['width']||$h != $cfg['height']) + { + $plan[$name] = $cfg; + } + } + else + { + $plan[$name] = $cfg; + } + } + } + else + { + $ret['error'] = 'Invalid mode'; + return $ret; + } + + //Final validation + foreach ($plan as $name => $cfg) + { + $w = $cfg['width']; + $h = $cfg['height']; + if ($w == 0 || $h == 0) + { + $plan[$name]['crop']=false; + } + } + + $ret['result'] = 'success'; + $ret['new_size_meta'] = $plan; + + return $ret; + } + + protected function generate_and_update_metadata($attachment_id, $original_file_path, $new_size_meta) + { + $ret = ['result' => 'failed']; + + if (!file_exists($original_file_path)) + { + $ret['error'] = 'Original image file not found'; + return $ret; + } + + $this->sizes=$new_size_meta; + $this->current_file_path=$original_file_path; + + add_filter( 'intermediate_image_sizes_advanced', array( $this, 'regen_thumbnails_sizes' ), 10, 2 ); + if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) + { + include(ABSPATH . 'wp-admin/includes/image.php'); + } + $new_metadata = wp_generate_attachment_metadata( $attachment_id, $original_file_path ); + + remove_filter( 'intermediate_image_sizes_advanced', array( $this, 'regen_thumbnails_sizes' ), 10 ); + + wp_update_attachment_metadata( $attachment_id, $new_metadata ); + + $ret['result']='success'; + return $ret; + } + + public function regen_thumbnails_sizes($sizes, $fullsize_metadata) + { + if (!is_array($this->sizes) || empty($this->sizes)) + { + return $sizes; + } + + $full_w = isset($fullsize_metadata['width']) ? (int)$fullsize_metadata['width'] : 0; + $full_h = isset($fullsize_metadata['height']) ? (int)$fullsize_metadata['height'] : 0; + + if ($full_w <= 0 || $full_h <= 0) + { + // Can't reason; fallback to WP sizes + return $sizes; + } + + $new_sizes = []; + + foreach ( $this->sizes as $size => $size_data ) + { + if (!is_array($size_data)) { + continue; + } + + $tw = isset($size_data['width']) ? (int)$size_data['width'] : 0; + $th = isset($size_data['height']) ? (int)$size_data['height'] : 0; + $crop = !empty($size_data['crop']); + + // invalid + if ($tw <= 0 && $th <= 0) { + continue; + } + + // if any side is 0, force non-crop (consistent with your build step) + if ($tw === 0 || $th === 0) { + $crop = false; + } + + // Use WP core helper to decide if thumbnail can be generated without upscaling / invalid dims + $dims = image_resize_dimensions( + $full_w, + $full_h, + ($tw > 0 ? $tw : null), + ($th > 0 ? $th : null), + $crop + ); + + if (!$dims) + { + // skip this size (missing) + continue; + } + + $new_sizes[$size] = [ + 'width' => ($tw > 0 ? $tw : null), + 'height' => ($th > 0 ? $th : null), + 'crop' => $crop, + ]; + } + + return $new_sizes; + } + + protected function cleanup_old_derivatives($original_file_path,$old_attachment_meta) + { + $ret = ['result' => 'success']; + + $dir = trailingslashit(dirname($original_file_path)); + + // 1) Delete sizes from old meta + if (isset($old_attachment_meta['sizes']) && is_array($old_attachment_meta['sizes'])) + { + foreach ($old_attachment_meta['sizes'] as $size_name => $data) + { + if (!is_array($data) || empty($data['file'])) + { + continue; + } + $file = $dir . wp_basename($data['file']); + if (file_exists($file)) + { + @wp_delete_file($file); + } + } + } + + if ( !empty( $old_attachment_meta['original_image'] ) ) + { + $pathinfo = pathinfo($original_file_path); + $scaled = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-scaled.' . ($pathinfo['extension'] ?? ''); + if (!empty($pathinfo['extension']) && file_exists($scaled)) + { + @wp_delete_file($scaled); + } + } + + return $ret; + } + +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-options.php b/wp-content/plugins/compressx/includes/class-compressx-options.php new file mode 100644 index 0000000..b24f5d8 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-options.php @@ -0,0 +1,374 @@ + ['enable'=>false,'webp' => 90, 'avif' => 65], + 'wc_product_gallery_images' => ['enable'=>false,'webp' => 80, 'avif' => 55], + 'wc_variation_images' => ['enable'=>false,'webp' => 80, 'avif' => 55], + 'wc_product_category_images' => ['enable'=>false,'webp' => 75, 'avif' => 50], + ]; + + return $list; + } + + public static function get_default_advanced_quality_option() + { + $list= [ + // core + 'site_logo' => ['enable'=>false,'webp' => 90, 'avif' => 80], + 'header_background' => ['enable'=>false,'webp' => 85, 'avif' => 60], + 'featured_post' => ['enable'=>false,'webp' => 88, 'avif' => 62], + 'featured_page' => ['enable'=>false,'webp' => 88, 'avif' => 62], + 'sidebar_widget' => ['enable'=>false,'webp' => 75, 'avif' => 50], + 'acf_image_fields' => ['enable'=>false,'webp' => 80, 'avif' => 55], + ]; + + return $list; + } + + public static function get_interface_version() + { + return "v2"; + /* + $options = self::get_option('compressx_general_settings', array()); + if(empty($options)) + { + return "v2"; + } + + return isset($options['interface_version']) ? $options['interface_version'] : 'v2';*/ + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-picture-load.php b/wp-content/plugins/compressx/includes/class-compressx-picture-load.php new file mode 100644 index 0000000..5555e89 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-picture-load.php @@ -0,0 +1,666 @@ +get_images( $content ); + + if ( empty( $images ) ) + { + return $content; + } + foreach ( $images as $image ) + { + $tag = $this->build_picture_tag( $image ); + $content = str_replace( $image['tag'], $tag, $content ); + } + + return $content; + } + + protected function get_images( $content ) + { + if ( preg_match( '/(?=/is', $content, $body ) ) + { + $content = $body[0]; + } + + $content = preg_replace( '//Uis', '', $content ); + + $content = preg_replace('#(.*?)#is', '', $content); + + if ( ! preg_match_all( '//isU', $content, $matches ) ) + { + return array(); + } + + $images = array_map(array($this, 'process_image'), $matches[0] ); + $images = array_filter( $images ); + + if ( ! $images || ! is_array( $images ) ) + { + return array(); + } + + return $images; + } + + public function process_image($image) + { + $attributes=$this->get_attribute($image); + + $src=$this->get_src($attributes); + + $srcset=$this->get_srcset($attributes); + + $style=$this->get_style($attributes); + + if ( empty($src)&&empty($srcset) ) + { + return false; + } + + $data=array( + 'tag' => $image, + 'attributes' => $attributes, + 'src' => $src, + 'srcset' => $srcset, + 'style' => $style, + ); + + return $data; + } + + protected function build_picture_tag( $image ) + { + $to_remove = array( + 'alt' => '', + 'height' => '', + 'width' => '', + 'data-lazy-src' => '', + 'data-src' => '', + 'src' => '', + 'data-lazy-srcset' => '', + 'data-srcset' => '', + 'srcset' => '', + 'data-lazy-sizes' => '', + 'data-sizes' => '', + 'sizes' => '', + 'style' => '', + ); + + $attributes = array_diff_key( $image['attributes'], $to_remove ); + + $output = 'picture_build_attributes( $attributes ) . ">"; + $output .= $this->build_source_tag_ex( $image ); + + $output .= $this->build_img_tag( $image ); + $output .= ""; + + return $output; + } + + protected function picture_build_attributes( $attributes ) + { + if ( ! $attributes || ! is_array( $attributes ) ) + { + return ''; + } + + $out = ''; + + foreach ( $attributes as $attribute => $value ) + { + $out .= ' ' . $attribute . '="' . esc_attr( $value ) . '"'; + } + + return $out; + } + + protected function build_attributes( $attributes ) + { + if ( ! $attributes || ! is_array( $attributes ) ) + { + return ''; + } + + $out = ''; + + foreach ( $attributes as $attribute => $value ) + { + $out .= ' ' . $attribute . '="' . esc_attr( $value ) . '"'; + } + + return $out; + } + + protected function build_source_attributes( $image, $image_type ) + { + $mime_type = ''; + $url = ''; + + switch ( $image_type ) { + case 'webp': + $mime_type = 'image/webp'; + $url = 'webp_url'; + break; + case 'avif': + $mime_type = 'image/avif'; + $url = 'avif_url'; + break; + } + + $srcset_source = ! empty( $image['srcset']['srcset_attr'] ) ? $image['srcset']['srcset_attr'] : $image['src']['src_attr'] . 'set'; + + $attributes = [ + 'type' => $mime_type, + $srcset_source => array(), + ]; + + /* + if ( ! empty( $image['srcset'] ) ) + { + foreach ( $image['srcset'] as $srcset ) + { + if ( empty( $srcset[ $url ] ) ) + { + continue; + } + + $attributes[ $srcset_source ][] = $srcset[ $url ] . ' ' . $srcset['descriptor']; + } + }*/ + + if ( ! empty( $image['srcset']['srcs'] ) ) + { + foreach ( $image['srcset']['srcs'] as $srcset ) + { + if (! empty( $srcset[$url] ) ) + { + $attributes[ $srcset_source ][] = $srcset[$url] . ' ' . $srcset['descriptor']; + } + + } + } + else if ( ! empty( $image['srcset'] ) ) + { + foreach ( $image['srcset'] as $srcset ) + { + if ( empty( $srcset[ $url ] ) ) + { + continue; + } + + $attributes[ $srcset_source ][] = $srcset[ $url ] . ' ' . $srcset['descriptor']; + } + } + + + if ( empty( $attributes[ $srcset_source ] ) && empty( $image['src'][ $url ] ) ) { + return []; + } + + + if ( empty( $attributes[ $srcset_source ] ) ) { + $attributes[ $srcset_source ][] = $image['src'][ $url ]; + } + + $attributes[ $srcset_source ] = implode( ', ', $attributes[ $srcset_source ] ); + + foreach ( [ 'data-lazy-srcset', 'data-srcset', 'srcset' ] as $srcset_attr ) { + if ( ! empty( $image['attributes'][ $srcset_attr ] ) && $srcset_attr !== $srcset_source ) { + $attributes[ $srcset_attr ] = $image['attributes'][ $srcset_attr ]; + } + } + + if ( 'srcset' !== $srcset_source && empty( $attributes['srcset'] ) && ! empty( $image['attributes']['src'] ) ) { + // Lazyload: the "src" attr should contain a placeholder (a data image or a blank.gif ). + $attributes['srcset'] = $image['attributes']['src']; + } + + foreach ( [ 'data-lazy-sizes', 'data-sizes', 'sizes' ] as $sizes_attr ) { + if ( ! empty( $image['attributes'][ $sizes_attr ] ) ) { + $attributes[ $sizes_attr ] = $image['attributes'][ $sizes_attr ]; + } + } + + return $attributes; + } + + protected function build_source_tag_ex( $image ) + { + $source = ''; + + foreach ( [ 'avif', 'webp' ] as $image_type ) + { + $attributes = $this->build_source_attributes( $image, $image_type ); + + if ( empty( $attributes ) ) { + continue; + } + + $source .= 'build_attributes( $attributes ) . "/>"; + } + + return $source; + } + + protected function build_img_tag( $image ) + { + /*$to_remove = array( + 'class' => '', + 'id' => '', + 'style' => '', + 'title' => '', + );*/ + $to_remove = array( + 'id' => '', + 'title' => '', + ); + + $attributes = array_diff_key( $image['attributes'], $to_remove ); + + return 'build_attributes( $attributes ) . "/>"; + } + + public function get_attribute($image) + { + if (function_exists("mb_convert_encoding")) + { + $image = mb_encode_numericentity($image, [0x80, 0x10FFFF, 0, ~0], 'UTF-8'); + //$image = mb_convert_encoding($image, 'HTML-ENTITIES', 'UTF-8'); + } + + if (class_exists('DOMDocument')) + { + $dom = new \DOMDocument(); + @$dom->loadHTML($image); + $image = $dom->getElementsByTagName('img')->item(0); + $attributes = array(); + + /* This can happen with mismatches, or extremely malformed HTML. + In customer case, a javascript that did for (i */ + if (! is_object($image)) + return false; + + foreach ($image->attributes as $attr) + { + $attributes[$attr->nodeName] = $attr->nodeValue; + } + return $attributes; + } + else + { + $atts_pattern = '/(?[^\s"\']+)\s*=\s*(["\'])\s*(?.*?)\s*\2/s'; + + if ( ! preg_match_all( $atts_pattern, $image, $tmp_attributes, PREG_SET_ORDER ) ) + { + return false; + } + + $attributes = array(); + + foreach ( $tmp_attributes as $attribute ) + { + $attributes[ $attribute['name'] ] = $attribute['value']; + } + + return $attributes; + } + + } + + public function get_src($attributes) + { + $src_source = false; + $data_tag=array( 'data-lazy-src','data-src', 'src'); + + foreach ( $data_tag as $src_attr ) + { + if ( ! empty( $attributes[ $src_attr ] ) ) + { + $src_source = $src_attr; + break; + } + } + + if ( ! $src_source ) + { + // No src attribute. + return false; + } + + $extensions = array( + 'jpg|jpeg|jpe' => 'image/jpeg', + 'png' => 'image/png', + 'webp' => 'image/webp', + 'avif' => 'image/avif', + ); + $extensions = array_keys( $extensions ); + $extensions = implode( '|', $extensions ); + + if ( ! preg_match( '@^(?(?:(?:https?:)?//|/).+\.(?' . $extensions . '))(?\?.*)?$@i', $attributes[ $src_source ], $src ) ) + { + // Not a supported image format. + return false; + } + + $url = $src['src']; + $path_exist=false; + $exist_ret=$this->webp_exist($url); + if($exist_ret['result']=='success') + { + $path_exist=true; + $ret['webp_exist']=true; + $ret['webp_path']=$exist_ret['path']; + + $exist_ret['url'] .= ! empty( $src['query'] ) ? $src['query'] : ''; + $ret['webp_url']=$exist_ret['url']; + } + + + $exist_ret=$this->avif_exist($url); + if($exist_ret['result']=='success') + { + $path_exist=true; + $ret['avif_exist']=true; + $ret['avif_path']=$exist_ret['path']; + + $exist_ret['url'] .= ! empty( $src['query'] ) ? $src['query'] : ''; + $ret['avif_url']=$exist_ret['url']; + } + + if(!$path_exist) + { + return false; + } + $ret['src']=$attributes[ $src_source ]; + $ret['src_attr']=$src_source; + + + return $ret; + } + + public function webp_exist($url) + { + $upload=wp_upload_dir(); + if ( stripos( $url, $upload['baseurl'] ) === 0 ) + { + $path = str_replace($upload['baseurl'],$upload['basedir'],$url); + + $upload_root=CompressX_Image_Method::transfer_path($upload['basedir']); + $attachment_dir=$path; + $attachment_dir=CompressX_Image_Method::transfer_path($attachment_dir); + $sub_dir=str_replace($upload_root,'',$attachment_dir); + $sub_dir=untrailingslashit($sub_dir); + $compressx_path=WP_CONTENT_DIR."/compressx-nextgen/uploads".$sub_dir.'.webp'; + + $path = str_replace($upload['baseurl'],'',$url); + $url = content_url().'/compressx-nextgen/uploads'.$path.'.webp';; + } + else + { + $compressx_path=''; + $url=''; + } + + if(file_exists($compressx_path)) + { + $ret['result']='success'; + $ret['url']=$url; + $ret['path']=$compressx_path; + return $ret; + } + else + { + $ret['result']='failed'; + return $ret; + } + } + + public function avif_exist($url) + { + $upload=wp_upload_dir(); + if ( stripos( $url, $upload['baseurl'] ) === 0 ) + { + $path = str_replace($upload['baseurl'],$upload['basedir'],$url); + + $upload_root=CompressX_Image_Method::transfer_path($upload['basedir']); + $attachment_dir=$path; + $attachment_dir=CompressX_Image_Method::transfer_path($attachment_dir); + $sub_dir=str_replace($upload_root,'',$attachment_dir); + $sub_dir=untrailingslashit($sub_dir); + $compressx_path=WP_CONTENT_DIR."/compressx-nextgen/uploads".$sub_dir.'.avif'; + + $path = str_replace($upload['baseurl'],'',$url); + $url = content_url().'/compressx-nextgen/uploads'.$path.'.avif'; + } + else + { + $compressx_path=''; + $url=''; + } + + if(file_exists($compressx_path)) + { + $ret['result']='success'; + $ret['url']=$url; + $ret['path']=$compressx_path; + return $ret; + } + else + { + $ret['result']='failed'; + return $ret; + } + } + + public function get_srcset($attributes) + { + $srcset_source = false; + $upload=wp_upload_dir(); + $data_tag=array('data-lazy-srcset', 'data-srcset', 'srcset'); + + $extensions = array( + 'jpg|jpeg|jpe' => 'image/jpeg', + 'png' => 'image/png', + //'gif' => 'image/gif', + ); + $extensions = array_keys( $extensions ); + $extensions = implode( '|', $extensions ); + + foreach ( $data_tag as $srcset_attr ) + { + if ( ! empty( $attributes[ $srcset_attr ] ) ) + { + $srcset_source = $srcset_attr; + break; + } + } + + $ret['srcset_attr']=$srcset_source; + $ret['srcs']=array(); + if ( $srcset_source ) + { + $srcset = explode( ',', $attributes[ $srcset_source ] ); + + foreach ( $srcset as $srcs ) + { + $srcs = preg_split( '/\s+/', trim( $srcs ) ); + + if ( count( $srcs ) > 2 ) + { + $descriptor = array_pop( $srcs ); + $srcs = array(implode( ' ', $srcs ), $descriptor); + } + + if ( empty( $srcs[1] ) ) + { + $srcs[1] = '1x'; + } + + if ( ! preg_match( '@^(?(?:https?:)?//.+\.(?' . $extensions . '))(?\?.*)?$@i', $srcs[0], $src ) ) + { + continue; + } + + $url = $src['src']; + $path_exist=false; + $exist_ret=$this->webp_exist($url); + if($exist_ret['result']=='success') + { + $path_exist=true; + $ret['webp_exist']=true; + $ret['webp_path']=$exist_ret['path']; + + $exist_ret['url'] .= ! empty( $src['query'] ) ? $src['query'] : ''; + $ret['webp_url']=$exist_ret['url']; + + $tmp_srcset=array( + 'url' => $srcs[0], + 'descriptor' => $srcs[1], + 'webp_exists'=>$path_exist + ); + + $tmp_srcset['webp_path']=$ret['webp_path']; + $tmp_srcset['webp_url']=$ret['webp_url']; + + $ret['srcs'][]=$tmp_srcset; + } + + $exist_ret=$this->avif_exist($url); + if($exist_ret['result']=='success') + { + $path_exist=true; + $ret['avif_exist']=true; + $ret['avif_path']=$exist_ret['path']; + + $exist_ret['url'] .= ! empty( $src['query'] ) ? $src['query'] : ''; + $ret['avif_url']=$exist_ret['url']; + + $tmp_srcset=array( + 'url' => $srcs[0], + 'descriptor' => $srcs[1], + 'webp_exists'=>$path_exist + ); + + $tmp_srcset['avif_path']=$ret['avif_path']; + $tmp_srcset['avif_url']=$ret['avif_url']; + + $ret['srcs'][]=$tmp_srcset; + } + + /* + if($path_exist) + { + $tmp_srcset=array( + 'url' => $srcs[0], + 'descriptor' => $srcs[1], + 'webp_exists'=>$path_exist + ); + + $tmp_srcset['webp_path']=$ret['webp_path']; + $tmp_srcset['webp_url']=$ret['webp_url']; + + $ret['srcs'][]=$tmp_srcset; + } + else + { + //$path_exist=false; + continue; + }*/ + } + } + else + { + return false; + } + + if(empty($ret['srcs'])) + return false; + + return $ret; + } + + public function get_style($attributes) + { + $style_attr='style'; + if ( empty( $attributes[ $style_attr ] ) ) + { + // No style. + return false; + } + + return $attributes[ $style_attr ]; + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-rewrite-checker.php b/wp-content/plugins/compressx/includes/class-compressx-rewrite-checker.php new file mode 100644 index 0000000..dc03d8e --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-rewrite-checker.php @@ -0,0 +1,261 @@ +og_test_file='/includes/assets/compressx_test.png'; + $this->og_test_webp_file='/includes/assets/compressx_test.png.webp'; + $this->test_file='compressx_test.png'; + $this->test_webp_file='compressx_test.png.webp'; + } + + public function test() + { + $upload_dir = wp_upload_dir(); + $path = $upload_dir['basedir'] . '/' . $this->test_file; + if (!file_exists($path)) { + $og_path = COMPRESSX_DIR . $this->og_test_file; + copy($og_path, $path); + } + + $path2 = WP_CONTENT_DIR . '/compressx-nextgen/uploads/' . $this->test_webp_file; + + if (!file_exists($path2)) { + $og_path = COMPRESSX_DIR . $this->og_test_webp_file; + copy($og_path, $path2); + } + + $og_size = filesize($path); + $test_size = $this->get_test_size(); + if ($test_size === false) + { + return false; + } + else if($test_size===401) + { + return true; + } + + + if ($og_size > $test_size) + { + return true; + } + else + { + if($this->is_cf_cached()) + { + return true; + } + return false; + } + } + + public function is_cf_cached() + { + $upload_dir = wp_upload_dir(); + $url=$upload_dir['baseurl'].'/'. $this->test_file; + $headers['Accept']='image/webp,image/*'; + foreach ( wp_get_nocache_headers() as $header_key => $header_value ) + { + $headers[$header_key] =$header_value; + } + $args['headers']= $headers; + $response=wp_remote_request($url,$args); + if(!is_wp_error($response)) + { + if(isset($response['headers']['cf-cache-status'])) + { + if($response['headers']['cf-cache-status']=='HIT') + { + return true; + } + } + + return false; + } + else + { + return false; + } + } + + public function test_ex() + { + $upload_dir = wp_upload_dir(); + $path = $upload_dir['basedir'] . '/' . $this->test_file; + if (!file_exists($path)) { + $og_path = COMPRESSX_DIR . $this->og_test_file; + copy($og_path, $path); + } + + $path2 = WP_CONTENT_DIR . '/compressx-nextgen/uploads/' . $this->test_webp_file; + + if (!file_exists($path2)) { + $og_path = COMPRESSX_DIR . $this->og_test_webp_file; + copy($og_path, $path2); + } + + $og_size = filesize($path); + $ret = $this->get_test_size_ex(); + if ($ret['result'] === 'success') + { + $test_size=$ret['size']; + if ($og_size > $test_size) + { + $ret['result']='success'; + return $ret; + } + else + { + if($this->is_cf_cached()) + { + $ret['result']='failed'; + $ret['error']='image cached by cloudflare'; + return $ret; + } + else + { + $ret['result']='failed'; + $ret['error']='htaccess rewrite not work'; + return $ret; + } + } + } + else + { + return $ret; + } + } + + public function get_test_size() + { + $upload_dir = wp_upload_dir(); + $url=$upload_dir['baseurl'].'/'. $this->test_file; + return $this->get_remote_url($url); + } + + public function get_test_size_ex() + { + $upload_dir = wp_upload_dir(); + $url=$upload_dir['baseurl'].'/'. $this->test_file; + $headers['Accept']='image/webp,image/*'; + foreach ( wp_get_nocache_headers() as $header_key => $header_value ) + { + $headers[$header_key] =$header_value; + } + $args['headers']= $headers; + $response=wp_remote_request($url,$args); + if(!is_wp_error($response)) + { + if($response['response']['code']==200) + { + $ret['result']='success'; + $ret['size']=strlen($response['body']); + return $ret; + } + else + { + $ret['result']='failed'; + $ret['error']=$response['response']['message']; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error'] =$response->get_error_message() ; + return $ret; + } + } + + public function get_remote_url($url) + { + $headers['Accept']='image/webp,image/*'; + foreach ( wp_get_nocache_headers() as $header_key => $header_value ) + { + $headers[$header_key] =$header_value; + } + $args['headers']= $headers; + $response=wp_remote_request($url,$args); + if(!is_wp_error($response)) + { + if($response['response']['code']==200) + { + return strlen($response['body']); + } + else if($response['response']['code']==401) + { + return 401; + } + } + else + { + return false; + } + + return false; + } + + public function is_apache() + { + $server = strtolower( sanitize_text_field($_SERVER['SERVER_SOFTWARE'])); + if ( strpos( $server, 'apache' ) !== false ) + { + return true; + } + else + { + return false; + } + } + + public function is_nginx() + { + $server = strtolower( sanitize_text_field($_SERVER['SERVER_SOFTWARE'])); + if ( strpos( $server, 'nginx' ) !== false ) + { + return true; + } + else + { + return false; + } + } + + public function is_litespeed() + { + $server = strtolower( sanitize_text_field($_SERVER['SERVER_SOFTWARE'])); + if ( strpos( $server, 'litespeed' ) !== false ) + { + return true; + } + else + { + return false; + } + } + + public function is_active_cache() + { + $current = get_option( 'active_plugins', array() ); + + $cache='wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php'; + + if (($key = array_search($cache, $current)) !== false) + { + return true; + } + else + { + return false; + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-stats-manager.php b/wp-content/plugins/compressx/includes/class-compressx-stats-manager.php new file mode 100644 index 0000000..ad7fa5a --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-stats-manager.php @@ -0,0 +1,337 @@ +ajax_check_security('compressx-can-convert'); + $cached = get_transient(self::TRANSIENT_KEY); + + if ($cached) + { + $data=get_option(self::OPTION_KEY); + wp_send_json_success([ + 'message' => 'Cached data available', + 'status' => 'cached', + 'cached' => $data, + ]); + } + + delete_option(self::OPTION_KEY); + delete_option(self::PROGRESS_KEY); + delete_transient(self::TRANSIENT_KEY); + + update_option(self::PROGRESS_KEY, [ + 'offset' => 0, + '_legacy_offset'=>0, + 'accumulated' => [], + 'state' => 'wait', + ]); + + wp_send_json_success(['status' => 'started']); + } + + public static function ajax_continue() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + $progress = get_option(self::PROGRESS_KEY); + if (!$progress || $progress['state'] !== 'wait') { + wp_send_json_error('Task not ready or already running.'); + } + + $progress['state'] = 'running'; + update_option(self::PROGRESS_KEY, $progress); + + //self::process_batch(self::BATCH_SIZE, $progress['offset'], $progress['accumulated']); + self::process_batch(self::BATCH_SIZE, $progress['offset'], $progress['_legacy_offset'],$progress['accumulated']); + + wp_send_json_success(['status' => 'processing']); + } + + public static function ajax_get() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + $progress = get_option(self::PROGRESS_KEY); + if ($progress) { + if ($progress['state'] === 'running') { + wp_send_json_success(['status' => 'executing']); + } + if ($progress['state'] === 'wait') { + wp_send_json_success(['status' => 'in_progress']); + } + } + + $final = get_option(self::OPTION_KEY); + if ($final) wp_send_json_success(array_merge(['status' => 'done'], $final)); + + wp_send_json_success(['status' => 'not_started']); + } + + public static function process_batch($batch_size, $offset,$legacy_offset, $accumulated) + { + global $wpdb; + + $start_time = time(); + + $data = wp_parse_args($accumulated, [ + 'converted_webp' => 0, + 'converted_avif' => 0, + 'total_count' => 0, + 'original_total_webp' => 0, + 'original_total_avif' => 0, + 'webp_total' => 0, + 'avif_total' => 0, + ]); + CompressX_Image_Meta_V2::ensure_table(); + $meta_table = CompressX_Image_Meta_V2::table_name(); + while (true) + { + $results = $wpdb->get_results($wpdb->prepare(" + SELECT m.attachment_id, + m.status, + m.og_file_size, + m.webp_converted, + m.avif_converted, + m.webp_converted_size, + m.avif_converted_size + FROM {$meta_table} m + INNER JOIN {$wpdb->posts} p + ON m.attachment_id = p.ID + WHERE p.post_type = 'attachment' + ORDER BY m.id ASC + LIMIT %d OFFSET %d +", $batch_size, $offset), ARRAY_A); + + $count_this_batch = count($results); + if ($count_this_batch === 0) break; + + foreach ($results as $row) + { + $status = $row['status'] ?? ''; + if ($status === 'skip') + { + continue; + } + + $original = (int)($row['og_file_size'] ?? 0); + + if (!empty($row['webp_converted'])) + { + $webp = (int)($row['webp_converted_size'] ?? 0); + $data['converted_webp']++; + if ($original > 0 && $webp > 0 && $webp <= $original) + { + $data['original_total_webp'] += $original; + $data['webp_total'] += $webp; + } + } + + if (!empty($row['avif_converted'])) + { + $avif = (int)($row['avif_converted_size'] ?? 0); + $data['converted_avif']++; + if ($original > 0 && $avif > 0 && $avif <= $original) + { + $data['original_total_avif'] += $original; + $data['avif_total'] += $avif; + } + } + + $data['total_count']++; + } + + $offset += $batch_size; + if ((time() - $start_time) >= self::MAX_DURATION) + { + update_option(self::PROGRESS_KEY, [ + 'offset' => $offset, + '_legacy_offset'=> $legacy_offset, + 'accumulated' => $data, + 'state' => 'wait', + ]); + return; + } + } + + while (true) + { + $legacy_results = $wpdb->get_results($wpdb->prepare(" + SELECT pm.post_id, pm.meta_value + FROM {$wpdb->postmeta} pm + INNER JOIN {$wpdb->posts} p + ON pm.post_id = p.ID + LEFT JOIN {$meta_table} m + ON m.attachment_id = pm.post_id + WHERE pm.meta_key = %s + AND p.post_type = 'attachment' + AND m.attachment_id IS NULL + ORDER BY pm.post_id ASC + LIMIT %d OFFSET %d + ", self::META_KEY, $batch_size, $legacy_offset), ARRAY_A); + + $count_this_batch = count($legacy_results); + if ($count_this_batch === 0) { + break; + } + + foreach ($legacy_results as $row) + { + $image_id = (int)$row['post_id']; + $meta = maybe_unserialize($row['meta_value']); + if (!is_array($meta)) { + continue; + } + + CompressX_Image_Meta_V2::upgrade_image_meta($image_id); + + $status = $meta['status'] ?? ''; + if ($status === 'skip') + { + continue; + } + + $original = isset($meta['og_file_size']) ? (int)$meta['og_file_size'] : 0; + + if (!empty($meta['webp_converted']) && (int)$meta['webp_converted'] === 1) + { + $webp = isset($meta['webp_converted_size']) ? (int)$meta['webp_converted_size'] : 0; + $data['converted_webp']++; + if ($original > 0 && $webp > 0 && $webp <= $original) + { + $data['original_total_webp'] += $original; + $data['webp_total'] += $webp; + } + } + + if (!empty($meta['avif_converted']) && (int)$meta['avif_converted'] === 1) + { + $avif = isset($meta['avif_converted_size']) ? (int)$meta['avif_converted_size'] : 0; + $data['converted_avif']++; + if ($original > 0 && $avif > 0 && $avif <= $original) + { + $data['original_total_avif'] += $original; + $data['avif_total'] += $avif; + } + } + + $data['total_count']++; + } + + $legacy_offset += $batch_size; + + if ((time() - $start_time) >= self::MAX_DURATION) + { + update_option(self::PROGRESS_KEY, [ + 'offset' => $offset, + '_legacy_offset' =>$legacy_offset, + 'accumulated' => $data, + 'state' => 'wait', + 'phase' => 'legacy', + ]); + return; + } + } + + + CompressX_Options::delete_option(self::PROGRESS_KEY); + + $webp_saved = $data['original_total_webp'] - $data['webp_total']; + $avif_saved = $data['original_total_avif'] - $data['avif_total']; + + $percent_webp = $data['original_total_webp'] > 0 ? ($webp_saved / $data['original_total_webp']) * 100 : 0; + $percent_avif = $data['original_total_avif'] > 0 ? ($avif_saved / $data['original_total_avif']) * 100 : 0; + + $max_webp_count=self::get_max_webp_image_count(); + $max_avif_count=self::get_max_avif_image_count(); + $conversion_webp = $max_webp_count > 0 ? ($data['converted_webp'] / $max_webp_count) * 100 : 0; + $conversion_avif = $max_avif_count > 0 ? ($data['converted_avif'] / $max_avif_count) * 100 : 0; + + $final = [ + 'conversion_webp_percent' => round($conversion_webp, 2), + 'conversion_avif_percent' => round($conversion_avif, 2), + 'space_saved_webp_percent' => round($percent_webp, 2), + 'space_saved_avif_percent' => round($percent_avif, 2), + 'converted_webp' => $data['converted_webp'], + 'converted_avif' => $data['converted_avif'], + 'total_count' => $data['total_count'], + 'saved_webp_size' => $webp_saved, + 'saved_avif_size' => $avif_saved, + 'webp_total' => $data['webp_total'], + 'avif_total' => $data['avif_total'], + 'webp_total_fomat' => size_format($data['webp_total'],2), + 'avif_total_fomat' => size_format($data['avif_total'],2), + 'original_total_webp' => $data['original_total_webp'], + 'original_total_avif' => $data['original_total_avif'], + 'calculated_at' => time(), + ]; + + set_transient(self::TRANSIENT_KEY, $final, MINUTE_IN_SECONDS * 10); + } + + public static function get_max_webp_image_count() + { + global $wpdb; + + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png", + "image/webp",); + + //$supported_mime_types=apply_filters('compressx_supported_mime_types',$supported_mime_types); + + $result=$wpdb->get_results( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type IN (%s,%s,%s,%s) ",$supported_mime_types),ARRAY_N); + if($result && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } + + public static function get_max_avif_image_count() + { + global $wpdb; + + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png", + "image/webp", + "image/avif"); + + //$supported_mime_types=apply_filters('compressx_supported_mime_types',$supported_mime_types); + + $result=$wpdb->get_results($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type IN (%s,%s,%s,%s,%s) ",$supported_mime_types),ARRAY_N); + if($result && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx-webp-rewrite.php b/wp-content/plugins/compressx/includes/class-compressx-webp-rewrite.php new file mode 100644 index 0000000..80c92f8 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx-webp-rewrite.php @@ -0,0 +1,623 @@ +create_wp_content_rules(); + $this->create_uploads_rules(); + } + + public function create_rewrite_rules_ex() + { + $this->create_wp_content_rules_ex(); + $this->create_uploads_rules_ex(); + } + public function transfer_path($path) + { + return preg_replace( '/(\/|\\\\)/', '/', rtrim( $path, '\/' ) ); + } + + public function get_wordpress_root() + { + if( defined('WP_CONTENT_DIR')) + { + $path=dirname(WP_CONTENT_DIR); + } + else + { + $path=ABSPATH; + } + + return $this->transfer_path($path); + } + + public function create_wp_content_rules() + { + $document_root=$this->transfer_path($_SERVER['DOCUMENT_ROOT']); + $document_root_real=$this->transfer_path(realpath( $_SERVER['DOCUMENT_ROOT'] )); + $wordpress_root=$this->get_wordpress_root(); + + $root_path = trim( str_replace( $document_root_real ?: '', '', $wordpress_root ?: '' ), '\/' ); + $root_suffix = str_replace( '//', '/', sprintf( '/%s/', $root_path ) ); + + //$document_root2='%{DOCUMENT_ROOT}'.str_replace($document_root,'',$wordpress_root); + $document_root2=( $document_root !== $document_root_real ) ? ( $wordpress_root . '/' ) : ( '%{DOCUMENT_ROOT}' . $root_suffix ); + + $document_root3=str_replace($document_root,'',$wordpress_root); + + $upload_root = wp_parse_url( content_url() ); + $upload_root = $upload_root['path'].'/compressx-nextgen'; + $upload_root2=str_replace($document_root3,'',$upload_root); + + $path=WP_CONTENT_DIR; + $htaccess_file=$path . '/.htaccess'; + + $line[]=''; + $line[]='RewriteEngine On'; + $line[]='RewriteOptions Inherit'; + $line[]='RewriteCond %{QUERY_STRING} original$'; + + $line[]='RewriteRule . - [L]'; + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.avif -f'; + $line[]='RewriteRule (.+)\.avif '.$upload_root.'/$1.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.avif -f'; + $line[]='RewriteRule (.+)\.avif '.$upload_root.'/$1.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.avif -f'; + $line[]='RewriteRule (.+)\.avif '.$upload_root.'/$1.avif [NC,T=image/avif,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp.avif -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp.avif -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.webp.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp.avif -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp.avif [NC,T=image/avif,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.avif -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.avif -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.avif -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.avif [NC,T=image/avif,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.avif -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.avif -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.png.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.avif -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.avif [NC,T=image/avif,L]'; + } + + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.avif -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.avif -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpeg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.avif -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.avif [NC,T=image/avif,L]'; + } + + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp [NC,T=image/webp,L]'; + } + + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.webp -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.webp -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.webp -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.webp [NC,T=image/webp,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.webp -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.webp -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.png.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.webp -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.webp [NC,T=image/webp,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.webp -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.webp -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpeg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.webp -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.webp [NC,T=image/webp,L]'; + } + + $options=CompressX_Options::get_option('compressx_general_settings',array()); + $disable_cache_control=isset($options['disable_cache_control'])?$options['disable_cache_control']:false; + if(!$disable_cache_control) + { + $line[]=''; + $line[]=''; + $line[]=''; + $line[]='Header always set Cache-Control "private"'; + $line[]='Header append Vary "Accept"'; + $line[]=''; + $line[]=''; + } + + insert_with_markers($htaccess_file,'CompressX',$line); + } + + public function create_uploads_rules() + { + $document_root=$this->transfer_path($_SERVER['DOCUMENT_ROOT']); + $document_root_real=$this->transfer_path(realpath( $_SERVER['DOCUMENT_ROOT'] )); + + $wordpress_root=$this->get_wordpress_root(); + $root_path = trim( str_replace( $document_root_real ?: '', '', $wordpress_root ?: '' ), '\/' ); + $root_suffix = str_replace( '//', '/', sprintf( '/%s/', $root_path ) ); + + //$document_root2='%{DOCUMENT_ROOT}'.str_replace($document_root,'',$wordpress_root); + $document_root2=( $document_root !== $document_root_real ) ? ( $wordpress_root . '/' ) : ( '%{DOCUMENT_ROOT}' . $root_suffix ); + + $document_root3=str_replace($document_root,'',$wordpress_root); + + $upload_dir = wp_upload_dir(); + $path=$upload_dir['basedir']; + + $upload_root = wp_parse_url( content_url() ); + $upload_root = $upload_root['path'].'/compressx-nextgen/uploads'; + $upload_root2=str_replace($document_root3,'',$upload_root); + + $htaccess_file=$path . '/.htaccess'; + + $line[]=''; + $line[]='RewriteEngine On'; + $line[]='RewriteOptions Inherit'; + $line[]='RewriteCond %{QUERY_STRING} original$'; + $line[]='RewriteRule . - [L]'; + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.avif -f'; + $line[]='RewriteRule (.+)\.avif '.$upload_root.'/$1.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.avif -f'; + $line[]='RewriteRule (.+)\.avif '.$upload_root.'/$1.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.avif -f'; + $line[]='RewriteRule (.+)\.avif '.$upload_root.'/$1.avif [NC,T=image/avif,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp.avif -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp.avif -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.webp.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp.avif -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp.avif [NC,T=image/avif,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.avif -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.avif -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.avif -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.avif [NC,T=image/avif,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.avif -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.avif -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.png.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.avif -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.avif [NC,T=image/avif,L]'; + } + + + $line[]='RewriteCond %{HTTP_ACCEPT} image/avif'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.avif -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.avif [NC,T=image/avif,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.avif -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.avif [NC,T=image/avif,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpeg.avif -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.avif -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.avif [NC,T=image/avif,L]'; + } + + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.webp -f'; + $line[]='RewriteRule (.+)\.webp '.$upload_root.'/$1.webp [NC,T=image/webp,L]'; + } + + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.webp -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.webp -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpg.webp -f'; + $line[]='RewriteRule (.+)\.jpg$ '.$upload_root.'/$1.jpg.webp [NC,T=image/webp,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.webp -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.png.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.webp -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.png.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.png.webp -f'; + $line[]='RewriteRule (.+)\.png$ '.$upload_root.'/$1.png.webp [NC,T=image/webp,L]'; + } + + $line[]='RewriteCond %{HTTP_ACCEPT} image/webp'; + + if($document_root2=='%{DOCUMENT_ROOT}') + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.webp -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.webp [NC,T=image/webp,L]'; + } + elseif ( strpos( $document_root, '%{DOCUMENT_ROOT}' ) !== false ) + { + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root.'/$1.jpeg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.webp -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.webp [NC,T=image/webp,L]'; + } + else + { + $line[]='RewriteCond '.untrailingslashit($document_root2).$upload_root2.'/$1.jpeg.webp -f [OR]'; + $line[]='RewriteCond %{DOCUMENT_ROOT}'.$upload_root2.'/$1.jpeg.webp -f'; + $line[]='RewriteRule (.+)\.jpeg$ '.$upload_root.'/$1.jpeg.webp [NC,T=image/webp,L]'; + } + + $line[]=''; + insert_with_markers($htaccess_file,'CompressX',$line); + } + + public function remove_rewrite_rule() + { + $path=WP_CONTENT_DIR; + $htaccess_file=$path . '/.htaccess'; + insert_with_markers($htaccess_file,'CompressX',''); + + $upload_dir = wp_upload_dir(); + $path=$upload_dir['basedir']; + $htaccess_file=$path . '/.htaccess'; + insert_with_markers($htaccess_file,'CompressX',''); + } + + public function create_wp_content_rules_ex() + { + $doc_root = rtrim(str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']), '/'); + $abs_path = rtrim(str_replace('\\', '/', ABSPATH), '/'); + $prefix = ''; + if (strpos($abs_path, $doc_root) === 0) { + $subdir = substr($abs_path, strlen($doc_root)); + $prefix = rtrim($subdir, '/'); + } + $prefix = $prefix ? '/' . ltrim($prefix, '/') : ''; + $disable_cache_control = isset($options['disable_cache_control']) ? $options['disable_cache_control'] : false; + + $lines = []; + $lines[] = ''; + $lines[] = 'RewriteEngine On'; + $lines[] = 'RewriteCond %{QUERY_STRING} original$'; + $lines[] = 'RewriteRule . - [L]'; + $lines[] = ''; + + // AVIF + $lines[] = '# AVIF'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/$1.$2 -f'; + $lines[] = 'RewriteRule ^(?:.*wp-content/)?(.+)\.(avif)$ ' . $prefix . '/wp-content/compressx-nextgen/$1.$2 [T=image/avif,L]'; + $lines[] = ''; + + // WebP + $lines[] = '# WebP'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/$1.$2 -f'; + $lines[] = 'RewriteRule ^(?:.*wp-content/)?(.+)\.(webp)$ ' . $prefix . '/wp-content/compressx-nextgen/$1.$2 [T=image/webp,L]'; + $lines[] = ''; + + // JPG/PNG → AVIF + $lines[] = '# JPG/PNG → AVIF'; + $lines[] = 'RewriteCond %{HTTP_ACCEPT} image/avif'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/$1.$2.avif -f'; + $lines[] = 'RewriteRule ^(?:.*wp-content/)?(.+)\.(jpe?g|png)$ ' . $prefix . '/wp-content/compressx-nextgen/$1.$2.avif [T=image/avif,L]'; + $lines[] = ''; + + // JPG/PNG → WebP + $lines[] = '# JPG/PNG → WebP'; + $lines[] = 'RewriteCond %{HTTP_ACCEPT} image/webp'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/$1.$2.webp -f'; + $lines[] = 'RewriteRule ^(?:.*wp-content/)?(.+)\.(jpe?g|png)$ ' . $prefix . '/wp-content/compressx-nextgen/$1.$2.webp [T=image/webp,L]'; + $lines[] = ''; + + $lines[] = ''; + + if (!$disable_cache_control) { + $lines[] = ''; + $lines[] = ''; + $lines[] = 'Header always set Cache-Control "private"'; + $lines[] = 'Header append Vary "Accept"'; + $lines[] = ''; + $lines[] = ''; + } + + $target_path = WP_CONTENT_DIR . '/.htaccess'; + insert_with_markers($target_path, 'CompressX', $lines); + } + + public function create_uploads_rules_ex() + { + $doc_root = rtrim(str_replace(['\\', '/'], '/', $_SERVER['DOCUMENT_ROOT']), '/'); + $abs_path = rtrim(str_replace(['\\', '/'], '/', ABSPATH), '/'); + $prefix = ''; + if (strpos($abs_path, $doc_root) === 0) { + $subdir = substr($abs_path, strlen($doc_root)); + $prefix = rtrim($subdir, '/'); + } + $prefix = $prefix ? '/' . ltrim($prefix, '/') : ''; + + $upload_dir = wp_get_upload_dir(); + $upload_basedir = rtrim(str_replace(['\\', '/'], '/', $upload_dir['basedir']), '/'); + $wp_content_dir = rtrim(str_replace(['\\', '/'], '/', WP_CONTENT_DIR), '/'); + $upload_relative_path = ltrim(str_replace($wp_content_dir, '', $upload_basedir), '/'); + $upload_prefix = $prefix . '/wp-content/compressx-nextgen/' . $upload_relative_path; + $upload_folder = trim(str_replace($abs_path, '', $upload_basedir), '/'); + + $filename_match = '(.+)'; + $upload_rule_base = '^(?:.*' . preg_quote($upload_folder, '/') . '/)?' . $filename_match . '\.(%s)$'; + + $lines = []; + $lines[] = ''; + $lines[] = 'RewriteEngine On'; + $lines[] = 'RewriteCond %{QUERY_STRING} original$'; + $lines[] = 'RewriteRule . - [L]'; + $lines[] = ''; + + // + $lines[] = '# AVIF'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/' . $upload_relative_path . '/$1.$2 -f'; + $lines[] = 'RewriteRule ' . sprintf($upload_rule_base, 'avif') . ' ' . $upload_prefix . '/$1.avif [T=image/avif,L]'; + $lines[] = ''; + + // + $lines[] = '# WebP'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/' . $upload_relative_path . '/$1.$2 -f'; + $lines[] = 'RewriteRule ' . sprintf($upload_rule_base, 'webp') . ' ' . $upload_prefix . '/$1.webp [T=image/webp,L]'; + $lines[] = ''; + + // JPG/PNG → AVIF + $lines[] = '# JPG/PNG → AVIF'; + $lines[] = 'RewriteCond %{HTTP_ACCEPT} image/avif'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/' . $upload_relative_path . '/$1.$2.avif -f'; + $lines[] = 'RewriteRule ' . sprintf($upload_rule_base, 'jpe?g|png') . ' ' . $upload_prefix . '/$1.$2.avif [T=image/avif,L]'; + $lines[] = ''; + + // JPG/PNG → WebP + $lines[] = '# JPG/PNG → WebP'; + $lines[] = 'RewriteCond %{HTTP_ACCEPT} image/webp'; + + $lines[] = 'RewriteCond %{DOCUMENT_ROOT}' . $prefix . '/wp-content/compressx-nextgen/' . $upload_relative_path . '/$1.$2.webp -f'; + $lines[] = 'RewriteRule ' . sprintf($upload_rule_base, 'jpe?g|png') . ' ' . $upload_prefix . '/$1.$2.webp [T=image/webp,L]'; + $lines[] = ''; + + $lines[] = ''; + + $target_path = $upload_basedir . '/.htaccess'; + insert_with_markers($target_path, 'CompressX', $lines); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/class-compressx.php b/wp-content/plugins/compressx/includes/class-compressx.php new file mode 100644 index 0000000..7bbef02 --- /dev/null +++ b/wp-content/plugins/compressx/includes/class-compressx.php @@ -0,0 +1,303 @@ +load_method(); + $this->load_meta(); + $this->load_dependencies(); + $this->load_admin(); + + $this->load_hooks(); + } + + public function load_method() + { + include_once COMPRESSX_DIR . '/includes/method/class-compressx-image-method.php'; + include_once COMPRESSX_DIR . '/includes/method/class-compressx-image-opt-method.php'; + //include_once COMPRESSX_DIR . '/deprecated/class-compressx-image-opt-method-deprecated.php'; + } + + public function load_meta() + { + //include_once COMPRESSX_DIR . '/includes/meta/class-compressx-image-meta.php'; + include_once COMPRESSX_DIR . '/includes/meta/class-compressx-image-meta-v2.php'; + include_once COMPRESSX_DIR . '/includes/meta/class-compressx-custom-image-meta.php'; + } + + public function load_dependencies() + { + include_once COMPRESSX_DIR . '/includes/class-compressx-image.php'; + include_once COMPRESSX_DIR . '/includes/class-compressx-options.php'; + include_once COMPRESSX_DIR . '/includes/class-compressx-imgoptim-task.php'; + include_once COMPRESSX_DIR . '/includes/class-compressx-image-scanner.php'; + + include_once COMPRESSX_DIR . '/includes/class-compressx-custom-imgoptim-task.php'; + include_once COMPRESSX_DIR. '/includes/class-compressx-log.php'; + include_once COMPRESSX_DIR . '/includes/class-compressx-auto-optimization.php'; + new CompressX_Auto_Optimization(); + include_once COMPRESSX_DIR . '/includes/class-compressx-picture-load.php'; + new CompressX_Picture_Load(); + include_once COMPRESSX_DIR . '/includes/class-compressx-stats-manager.php'; + CompressX_Stats_Manager::init(); + + // Load Task Manager V2 System + //$this->load_task_system_v2(); + } + + public function load_hooks() + { + add_action( 'delete_attachment', array( $this, 'delete_images' ), 20 ); + + $plugin_basename = plugin_basename( plugin_dir_path( __DIR__ ) . 'compressx.php' ); + add_filter('plugin_action_links_' . $plugin_basename, array( $this,'add_action_links')); + + add_action( 'wp_ajax_compressx_dissmiss_conflict_notice', array( $this, 'dissmiss_conflict_notice' ), 20 ); + add_action('compressx_purge_cache_event',array( $this,'purge_cache_event')); + add_action('compressx_purge_cache',array( $this,'purge_cache')); + add_action('compressx_after_optimize_image', array($this, 'update_latest_image'),10,2); + } + + public function load_admin() + { + if(is_admin()) + { + include_once COMPRESSX_DIR . '/includes/display/class-compressx-display.php'; + new CompressX_Display(); + + include_once COMPRESSX_DIR . '/includes/display/class-compressx-custom-media-lib.php'; + new CompressX_Custom_Media_Lib(); + + include_once COMPRESSX_DIR . '/includes/class-compressx-manual-optimization.php'; + new CompressX_Manual_Optimization(); + + add_action( 'admin_notices', array( $this, 'optimizer_conflicts' ) ); + add_action('in_admin_header',array( $this,'hide_notices'), 99); + + $this->set_locale(); + } + } + + public function ajax_check_security($role='manage_options') + { + check_ajax_referer( 'compressx_ajax', 'nonce' ); + $check=is_admin()&¤t_user_can('manage_options'); + $check=apply_filters('compressx_ajax_check_security',$check,$role); + if(!$check) + { + die(); + } + } + + public function hide_notices() + { + if(is_multisite()) + { + $screen_ids[]='toplevel_page_CompressX-network'; + } + else + { + $screen_ids[]='toplevel_page_'.COMPRESSX_SLUG; + $screen_ids[]='compressx_page_settings-compressx'; + $screen_ids[]='compressx_page_info-compressx'; + $screen_ids[]='compressx_page_logs-compressx'; + $screen_ids[]='compressx_page_cdn-compressx'; + $screen_ids[]='compressx_page_addons-compressx'; + } + + $screen_ids=apply_filters('compressx_get_screen_ids',$screen_ids); + + if(in_array(get_current_screen()->id,$screen_ids)) + { + remove_all_actions('admin_notices'); + add_action( 'admin_notices', array( $this, 'optimizer_conflicts' ) ); + } + } + + private function set_locale() + { + require_once COMPRESSX_DIR . '/includes/class-compressx-i18n.php'; + $plugin_i18n = new CompressX_i18n(); + add_action('init',array( $plugin_i18n,'load_plugin_textdomain')); + } + + public function dissmiss_conflict_notice() + { + update_option('compressx_dissmiss_conflict_notice', true,false); + wp_send_json_success(); + } + + public function optimizer_conflicts() + { + if ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) + { + return; + } + + if ( is_network_admin() ) + { + return; + } + + if ( ! current_user_can( 'manage_options' ) ) + { + return; + } + + $dissmiss=CompressX_Options::get_option('compressx_dissmiss_conflict_notice'); + if($dissmiss) + { + return; + } + + include_once ABSPATH . 'wp-admin/includes/plugin.php'; + + $plugins=array(); + $plugins["wp-smush"]="wp-smushit/wp-smush.php"; + $plugins["wp-smush-pro"]="wp-smush-pro/wp-smush.php"; + $plugins["kraken"]="kraken-image-optimizer/kraken.php"; + $plugins["tinypng"]="tiny-compress-images/tiny-compress-images.php"; + $plugins["shortpixel"]="shortpixel-image-optimiser/wp-shortpixel.php"; + $plugins["ewww"]="ewww-image-optimizer/ewww-image-optimizer.php"; + $plugins["ewww-cloud"]="ewww-image-optimizer-cloud/ewww-image-optimizer-cloud.php"; + $plugins["imagerecycle"]="imagerecycle-pdf-image-compression/wp-image-recycle.php"; + $plugins["imagify"]="imagify/imagify.php"; + $plugins["webp-converter-for-media"]="webp-converter-for-media/webp-converter-for-media.php"; + $plugins["optimole-wp"]="optimole-wp/optimole-wp.php"; + $plugins["wp-optimize"]="wp-optimize/wp-optimize.php"; + $plugins["wpvivid-imgoptim"]="wpvivid-imgoptim/wpvivid-imgoptim.php"; + + $plugins = array_filter( $plugins, 'is_plugin_active' ); + + if(empty($plugins)) + { + return; + } + + $plugins_names=array(); + foreach ( $plugins as $plugin ) + { + $plugin_data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin,false,false ); + $plugins_names[] = $plugin_data['Name']; + } + + $plugins_names = implode( ', ', $plugins_names ); + + ?> +
+

+ Multiple image optimization plugins detected +

+

+ + + +

+

+ Go to Plugins page + + Dismiss +

+
+ + Settings', + ); + } + else + { + $settings_link = array( + 'Settings', + ); + } + + return array_merge( $settings_link, $links ); + } + + public function delete_images( $image_id ) + { + if ( empty( $image_id ) ) + { + return; + } + + CompressX_Image_Method::delete_image($image_id); + } + + public function purge_cache_event() + { + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + + $options=CompressX_Options::get_option('compressx_general_settings',array()); + + $setting=$options['cf_cdn']; + + $cdn=new CompressX_CloudFlare_CDN($setting); + + $cdn->purge_cache(); + die(); + } + + public function purge_cache() + { + $options=CompressX_Options::get_option('compressx_general_settings',array()); + + if(isset($options['cf_cdn']['auto_purge_cache_after_manual'])&&$options['cf_cdn']['auto_purge_cache_after_manual']) + { + $timestamp =wp_next_scheduled('compressx_purge_cache_event'); + if($timestamp===false) + { + wp_schedule_single_event(time()+300,'compressx_purge_cache_event'); + } + return; + } + + if(isset($options['cf_cdn']['auto_purge_cache'])&&$options['cf_cdn']['auto_purge_cache']) + { + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + $setting=$options['cf_cdn']; + $cdn=new CompressX_CloudFlare_CDN($setting); + $cdn->purge_cache(); + } + } + + public function update_latest_image($image_id) + { + CompressX_Options::update_option('compressx_latest_bulk_image',$image_id); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-addons.php b/wp-content/plugins/compressx/includes/display/class-compressx-addons.php new file mode 100644 index 0000000..26a80fc --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-addons.php @@ -0,0 +1,142 @@ + +
+
+ output_nav(); + $this->output_header(); + $this->output_addons(); + $this->output_footer(); + ?> +
+
+ +
+
+
+
Addons (Pro Only)
+
+
+
+
+ +
+
+
Advanced Compression Level Settings
+ Maximize image optimization with smart algorithms that reduce file size while preserving visual quality. Ideal for users who want the best balance of speed and image clarity for their site +
+
+
+
+ +
+
+
Remove JPG/PNG Thumbnails
+ Automatically delete original JPG/PNG thumbnails after converting them to WebP or AVIF to free up disk space. +
+
+
+
+ +
+
+
Cron Support
+ Automates your image optimization workflows with a robust cron system, flexibly scheduling AVIF/WebP conversions for new, existing, and popular images. +
+ +
+
+
+ +
+
+
Thumbnails Generation/reGeneration
+ Regenerate thumbnails (WebP, AVIF, JPG, or PNG) for your website images based on your settings. Add custom thumbnail sizes. Remove unused and orphan thumbnails and their metadata. +
+
+
+
+ +
+
+
WP-CLI
+ Use WP-CLI to efficiently convert images in your WordPress media library. You can choose to convert all images, or a specific image, or convert the latest n images(coming soon). +
+ +
+
+
+ +
+
+
Watermark
+ Add watermarks to your images during the process of uploading, bulk WebP/AVIF conversion, and thumbnail regeneration (WebP, AVIF, JPG, or PNG). +
+ +
+
+
+ +
+
+
CDN Integration
+ Integrate with Cloudflare pro to convert and serve your website images as WebP/AVIF formats. Enable ‘Vary for images’ to dynamically serve correct variants. +
+ +
+
+
+ +
+
+
Roles and Capabilities
+ Control CompressX Pro settings and features by setting a super admin. The super admin can grant access for other user roles include admin. +
+ +
+
+
+ +
+
+
Multisite Support
+ Coming soon.. +
+
+
+
+
+ +
+
+ output_nav(); + $this->output_header(); + $this->output_advanced_custom_compression_level(); + $this->output_footer(); + ?> +
+
+ +
+
+
+
+
Advanced Custom Compression Level Settings
+
+
+
+
+ + Global compression level + +

+ Webp + AVIF +

+
+
+
+ + Compression Levels by Categories have higher priority than the global compression level. + This means that images assigned to specific categories will use their category's compression level to be processed, while all other images will fall back to the global compression setting.
+ You can choose which image categories should receive special compression treatment. +
+
+
+
+
+

+ Compression Levels by Category (WordPress Standard Image Types) + (Pro only) +

+
+
+
Image Usage Type
+
Webp/AVIF
+
Recommended Compression Level
+
+ get_advanced_custom_compression_list(); + foreach ($list as $item) + { + if($item['enable']) + { + $quality_enbale="checked"; + } + else + { + $quality_enbale=""; + } + ?> +
+
+ option="cx_advanced_quality_enable" name="" disabled> + +
+
+ + +
+
+ + + +
+
+ + +
+

+ Compression Levels by Category (WooCommerce Image Type) + (Pro only) +

+
+
+
Image Usage Type
+
Webp/AVIF
+
Recommended Compression Level
+
+ get_advanced_custom_woocommerce_compression_list(); + foreach ($list as $item) + { + if($item['enable']) + { + $quality_enbale="checked"; + } + else + { + $quality_enbale=""; + } + ?> +
+
+ option="cx_advanced_quality_enable" name="" disabled> + +
+
+ + +
+
+ + + +
+
+ + +
+
High Quality
+
Balanced Quality
+
Medium Quality
+
Aggressive Quality
+
+
+ +
+
+
+
+ + $item) + { + $item['type']=$type; + $item['display']=$this->get_advanced_quality_display_name($type); + $item['description']=$this->get_advanced_quality_description($type); + $display_list[]=$item; + } + + return $display_list; + } + + public function get_advanced_custom_woocommerce_compression_list() + { + $advanced_quality_list=CompressX_Options::get_default_advanced_woocommerce_quality_option(); + $display_list=array(); + foreach ($advanced_quality_list as $type=>$item) + { + $item['type']=$type; + $item['display']=$this->get_advanced_quality_display_name($type); + $item['description']=$this->get_advanced_quality_description($type); + $display_list[]=$item; + } + + return $display_list; + } + + public function get_advanced_quality_display_name($type) + { + $list= [ + // core + 'site_logo' => ['display' => 'Site logo'], + 'header_background' => ['display' => 'Header background image'], + 'featured_post' => ['display' => 'Featured image (Post)'], + 'featured_page' => ['display' => 'Featured image (Page)'], + 'sidebar_widget' => ['display' => 'Image in sidebar'], + 'acf_image_fields' => ['display' => 'Image field used via ACF(Advanced Custom Fields)'], + + // WooCommerce + 'wc_product_featured_images' => ['display' => 'Product featured image'], + 'wc_product_gallery_images' => ['display' => 'Product gallery image'], + 'wc_variation_images' => ['display' => 'Variation-specific image'], + 'wc_product_category_images' => ['display' => 'Category image (taxonomy thumbnail)'], + ]; + return isset($list[$type]['display'])?$list[$type]['display']:''; + } + + public function get_advanced_quality_description($type) + { + $list= [ + // core + 'site_logo' => ['level' => 'high','text'=>'Webp (90+), AVIF (90+)---branding clarity is essential'], + 'header_background' => ['level' => 'mid','text'=>'Webp (75-85), AVIF (75-85)---may span full width, retain clarity'], + 'featured_post' => ['level' => 'high','text'=>'Webp (85-90), AVIF (85-90)---visually impactful, often shared'], + 'featured_page' => ['level' => 'high','text'=>'Webp (85-90), AVIF (85-90)---visually impactful, often shared'], + 'sidebar_widget' => ['level' => 'aggressive','text'=>'Webp (60-75), AVIF (60-75)---small visual element'], + 'acf_image_fields' => ['level' => 'balanced','text'=>'Webp (70-80), AVIF (70-80)---depends on context, often supportive'], + + // WooCommerce + 'wc_product_featured_images' => ['level' => 'high','text'=>'Webp (85-90), AVIF (85-90)---brand/visual integrity important'], + 'wc_product_gallery_images' => ['level' => 'mid','text'=>'Webp (75-85), AVIF (75-85)---visual but secondary to main image'], + 'wc_variation_images' => ['level' => 'mid','text'=>'Webp (75-85), AVIF (75-85)---often similar to gallery use'], + 'wc_product_category_images' => ['level' => 'balanced','text'=>'Webp (70-80), AVIF (70-80)---smaller, not full focus'], + ]; + + if(isset($list[$type])) + { + $html=''; + if($list[$type]['level']=='high') + { + $html.=''; + $html.='High'; + } + else if($list[$type]['level']=='mid') + { + $html.=''; + $html.='Medium'; + } + else if($list[$type]['level']=='aggressive') + { + $html.=''; + $html.='Aggressive'; + } + else if($list[$type]['level']=='balanced') + { + $html.=''; + $html.='Balanced'; + } + + $html.=': '.$list[$type]['text'].''; + return $html; + } + else + { + return ''; + } + } + + public function save_compression() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-general-settings'); + + if(!isset($_POST['webp_quality'])) + { + die(); + } + + if(!isset($_POST['avif_quality'])) + { + die(); + } + + $webp_quality = sanitize_text_field($_POST['webp_quality']); + $avif_quality = sanitize_text_field($_POST['avif_quality']); + + $options=CompressX_Options::get_option('compressx_quality',array()); + + $options['quality_webp']=intval($webp_quality); + $options['quality_avif']=intval($avif_quality); + + CompressX_Options::update_option('compressx_quality',$options); + + $ret['result']='success'; + echo wp_json_encode($ret); + die(); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-bulk-action.php b/wp-content/plugins/compressx/includes/display/class-compressx-bulk-action.php new file mode 100644 index 0000000..cdb262f --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-bulk-action.php @@ -0,0 +1,123 @@ +ajax_check_security('compressx-can-convert'); + + $force=isset($_POST['force'])?sanitize_key($_POST['force']):'0'; + if($force=='1') + { + $force=true; + } + else + { + $force=false; + } + + $start_row=isset($_POST['offset'])?sanitize_key($_POST['offset']):0; + + $ret=CompressX_Image_Scanner::scan_unoptimized_images($force,$start_row); + + echo wp_json_encode($ret); + + die(); + } + + public function init_bulk_optimization_task() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + $force=isset($_POST['force'])?sanitize_key($_POST['force']):'0'; + if($force=='1') + { + $force=true; + } + else + { + $force=false; + } + + $task=new CompressX_ImgOptim_Task(); + $ret=$task->init_task($force); + echo wp_json_encode($ret); + die(); + } + + public function run_optimize() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + set_time_limit(120); + $task=new CompressX_ImgOptim_Task(); + + $ret=$task->get_task_status(); + + if($ret['result']=='success'&&$ret['status']=='completed') + { + $this->flush($ret); + $task->do_optimize_image(); + //echo wp_json_encode($ret); + } + else + { + echo wp_json_encode($ret); + } + + die(); + } + + private function flush($ret) + { + $json=wp_json_encode($ret); + if(!headers_sent()) + { + header('Content-Length: '.strlen($json)); + header('Connection: close'); + header('Content-Encoding: none'); + } + + + if (session_id()) + session_write_close(); + echo wp_json_encode($ret); + + if(function_exists('fastcgi_finish_request')) + { + fastcgi_finish_request(); + } + else + { + ob_flush(); + flush(); + } + } + + public function get_opt_progress() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + $task=new CompressX_ImgOptim_Task(); + + $result=$task->get_task_progress(); + + echo wp_json_encode($result); + + die(); + } +} diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-cdn.php b/wp-content/plugins/compressx/includes/display/class-compressx-cdn.php new file mode 100644 index 0000000..f69635a --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-cdn.php @@ -0,0 +1,387 @@ + +
+
+ output_nav(); + $this->output_header(); + $this->output_cdn(); + $this->output_footer(); + ?> +
+
+ +
+
+
+
+
+
+
+
+
+ + + +

+ +

+ + + +

+ +

+ + + +

+ +

+ + + +

+ > + +

+

+ > + +

+
+
+
+ +

My Profile > API Tokens > Global API Key.','compressx')?>

+ The website overview > API section.','compressx')?> +
+
+
+

+ + + + +

+
+
+
+
+ +
+
+
+ + ajax_check_security('compressx-can-use-cdn'); + + if(isset($_POST['setting'])&&!empty($_POST['setting'])) + { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) + { + $ret['result']='failed'; + $ret['error']='json decode failed'; + echo wp_json_encode($ret); + die(); + } + + if($this->need_test($setting)) + { + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + $cdn=new CompressX_CloudFlare_CDN($setting); + + $ret=$cdn->purge_cache(); + + if($ret['result']!='success') + { + echo wp_json_encode($ret); + die(); + } + } + + $options=CompressX_Options::get_option('compressx_general_settings',array()); + + $options['cf_cdn']['zone_id']=$setting['zone_id']; + $options['cf_cdn']['email']=$setting['email']; + $options['cf_cdn']['api_key']=$setting['api_key']; + if(isset($setting['auto_purge_cache'])) + { + $options['cf_cdn']['auto_purge_cache']=$setting['auto_purge_cache']; + } + else + { + $options['cf_cdn']['auto_purge_cache']=false; + } + + if(isset($setting['auto_purge_cache_after_manual'])) + { + $options['cf_cdn']['auto_purge_cache_after_manual']=$setting['auto_purge_cache_after_manual']; + } + else + { + $options['cf_cdn']['auto_purge_cache_after_manual']=false; + } + + CompressX_Options::update_option('compressx_general_settings',$options); + + $ret['result']='success'; + echo wp_json_encode($ret); + die(); + } + else + { + die(); + } + } + + public function need_test($setting) + { + if(isset($setting['auto_purge_cache'])&&$setting['auto_purge_cache']) + { + return true; + } + + if(isset($setting['auto_purge_cache_after_manual'])&&$setting['auto_purge_cache_after_manual']) + { + return true; + } + + return false; + } + + public function purge_cache() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-cdn'); + + if(isset($_POST['setting'])&&!empty($_POST['setting'])) + { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) + { + $ret['result']='failed'; + $ret['error']='json decode failed'; + echo wp_json_encode($ret); + die(); + } + + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + + $cdn=new CompressX_CloudFlare_CDN($setting); + + $ret=$cdn->purge_cache(); + + echo wp_json_encode($ret); + die(); + } + else + { + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + + $options=CompressX_Options::get_option('compressx_general_settings',array()); + + $setting=$options['cf_cdn']; + + $cdn=new CompressX_CloudFlare_CDN($setting); + + $ret=$cdn->purge_cache(); + + echo wp_json_encode($ret); + die(); + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-custom-bulk-action.php b/wp-content/plugins/compressx/includes/display/class-compressx-custom-bulk-action.php new file mode 100644 index 0000000..9852f73 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-custom-bulk-action.php @@ -0,0 +1,676 @@ +support_extension=array(); + $this->support_extension[]='jpg'; + $this->support_extension[]='jpeg'; + $this->support_extension[]='png'; + $this->support_extension[]='webp'; + + add_action('wp_ajax_compressx_get_custom_tree_dir_ex', array($this, 'get_custom_tree_dir_ex')); + add_action('wp_ajax_compressx_add_include_folders', array($this, 'add_include_folders')); + add_action('wp_ajax_compressx_remove_include_folders', array($this, 'remove_include_folders')); + // + add_action('wp_ajax_compressx_start_scan_custom_images', array($this, 'start_scan_custom_images')); + add_action('wp_ajax_compressx_init_custom_bulk_optimization_task', array($this, 'init_custom_bulk_optimization_task')); + add_action('wp_ajax_compressx_run_custom_optimize', array($this, 'run_custom_optimize')); + add_action('wp_ajax_compressx_get_custom_opt_progress', array($this, 'get_custom_opt_progress')); + add_action('wp_ajax_compressx_get_dir_info', array($this, 'get_dir_info')); + // + add_action('cx_output_custom_bulk',array($this, 'output_custom_bulk')); + } + + public function output_custom_bulk() + { + CompressX_Custom_Image_Meta::check_custom_table(); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + $stats=$this->get_custom_stats($includes); + $found=$stats['files']; + $saved=$stats['saved']; + $processed=$stats['processed_files']; + ?> +
+
+
+
+
+
+
+ +
+
+ output_custom_folders(); + ?> +
+
+ + | + % | + + +
+
+ + + +
+
+ +
+
+
+
+
+
+ get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif); + } + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + return $stats; + } + + public function get_folder_stats($path,&$stats,$convert_to_webp,$convert_to_avif) + { + try { + $count=0; + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + + foreach ($rii as $file) + { + if ($file->isDir()) + { + continue; + } + + if($this->is_support_extension($file->getExtension())) + { + $filename=$path.'/'.$file->getFilename(); + $filename=$this->transfer_path($filename); + + $type=pathinfo($filename, PATHINFO_EXTENSION); + + if($convert_to_webp&&$type!="webp") + { + if(CompressX_Custom_Image_Meta::is_convert_webp($filename)) + { + $stats['processed_files']++; + $stats['processed']+=CompressX_Custom_Image_Meta::get_convert_webp_size($filename); + } + + $count++; + $stats['files']++; + $stats['total']+=$file->getSize(); + } + else if($convert_to_avif&&$type!="avif") + { + if(CompressX_Custom_Image_Meta::is_convert_avif($filename)) + { + $stats['processed_files']++; + $stats['processed']+=CompressX_Custom_Image_Meta::get_convert_avif_size($filename); + } + + $count++; + $stats['files']++; + $stats['total']+=$file->getSize(); + } + } + } + return $count; + } + catch (Exception $exception) + { + return 0; + } + + } + + public function is_support_extension($extension) + { + if(in_array($extension,$this->support_extension)) + { + return true; + } + else + { + return false; + } + } + + public function output_custom_folders() + { + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + + $convert_to_avif=CompressX_Options::get_option('compressx_output_format_avif',1); + + if($convert_to_avif&&CompressX_Image_Opt_Method::is_support_avif()) + { + $convert_to_avif=true; + } + else + { + $convert_to_avif=false; + } + + ?> +
+
+ + wp-content: + +
+
+
+
+ + + + +
+
    + +
  • + + get_children_count($include,$convert_to_avif).')')?> + +
  • + +
+
+
+
+ ajax_check_security('compressx-can-bulk-custom-convert'); + + try{ + $node_array = array(); + + if ($_POST['tree_node']['node']['id'] == '#') + { + $path = ABSPATH; + + if (!empty($_POST['tree_node']['path'])) + { + $path = sanitize_text_field($_POST['tree_node']['path']); + } + } else { + $path = sanitize_text_field($_POST['tree_node']['node']['id']); + } + + $path = trailingslashit(str_replace('\\', '/', realpath($path))); + + if ($dh = opendir($path)) + { + while (substr($path, -1) == '/') + { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) + { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) + { + if (is_dir($path . '/' . $value)) + { + if(!$this->is_media_folder($path . '/' . $value)) + { + $node['children'] = $this->has_children($path . '/' . $value); + $node['id'] = $path . '/' . $value; + $node['icon'] = 'dashicons dashicons-category cx-icon-color-techblue'; + $node['text'] =''.$value.''; + $node['text'] .=''; + $node_array[] = $node; + } + } + else{ + continue; + } + } + } + } + + $ret['nodes'] = $node_array; + echo wp_json_encode($ret); + } + catch (Exception $error) { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + //error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + } + die(); + } + + public function has_children($path) + { + if ($dh = opendir($path)) + { + while (substr($path, -1) == '/') + { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) + { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) + { + if (is_dir($path . '/' . $value)) + { + return true; + } + } + } + } + + return false; + } + + public function is_media_folder($path) + { + $upload_dir = wp_upload_dir(); + $base_dir = $upload_dir['basedir']; + $base_dir = trailingslashit(str_replace('\\', '/', realpath($base_dir))); + $path=str_replace( $base_dir, '', $path ); + $path_arr = explode( '/', $path ); + + if ( count( $path_arr ) >= 1) + { + if(is_numeric( $path_arr[0] ) && $path_arr[0] > 1950 && $path_arr[0] < 2050) + { + return true; + } + } + + $path=$this->transfer_path($path); + $upload_root=$this->transfer_path($upload_dir['basedir']); + $compressx1=$this->transfer_path(WP_CONTENT_DIR.'/compressx'); + $compressx2=$this->transfer_path(WP_CONTENT_DIR.'/compressx-nextgen'); + + if($path==$compressx1) + { + return true; + } + else if($path==$compressx2) + { + return true; + } + else if($path==$upload_root) + { + return true; + } + + return false; + } + + public function get_children_count($path,$convert_to_avif) + { + try { + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + $files = 0; + + /** @var SplFileInfo $file */ + foreach ($rii as $file) + { + if ($file->isDir()) + { + continue; + } + + if($this->is_support_extension($file->getExtension())) + { + $filename=$path.'/'.$file->getFilename(); + $type=pathinfo($filename, PATHINFO_EXTENSION); + + if($type=='webp'&&$convert_to_avif) + { + $files++; + } + else + { + $files++; + } + + } + + } + + return $files; + } + catch (Exception $e) + { + return 0; + } + } + + public function add_include_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + + $new_include = sanitize_text_field($_POST['id']); + + $new_includes[$new_include]=$new_include; + + $includes=array_merge($includes,$new_includes); + + CompressX_Options::update_option('compressx_custom_includes',$includes); + + $stats=array(); + + $stats['files']=0; + $stats['saved']=0; + $stats['processed_files']=0; + $stats['total']=0; + $stats['processed']=0; + + $convert_to_webp=CompressX_Image_Opt_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Opt_Method::get_convert_to_avif(); + + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + + $html='
    '; + foreach ($includes as $include) + { + $path=str_replace($abs_path,'',$include); + $html.= '
  • '. + ''.$path.'('.$this->get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif).')'.''. + '
  • '; + } + $html.='
      '; + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + $ret['result']='success'; + $ret['html']=$html; + $ret['found']=$stats['files']; + $ret['saved']=$stats['saved']; + $ret['processed']=$stats['processed_files']; + + echo wp_json_encode($ret); + die(); + } + + public function get_dir_info() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + + $stats=array(); + + $stats['files']=0; + $stats['saved']=0; + $stats['processed_files']=0; + $stats['total']=0; + $stats['processed']=0; + + $convert_to_webp=CompressX_Image_Opt_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Opt_Method::get_convert_to_avif(); + + foreach ($includes as $include) + { + $this->get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif); + } + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + $ret['result']='success'; + $ret['found']=$stats['files']; + $ret['saved']=$stats['saved']; + $ret['processed']=$stats['processed_files']; + + echo wp_json_encode($ret); + die(); + } + + public function remove_include_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + + $id = sanitize_text_field($_POST['id']); + unset($includes[$id]); + + CompressX_Options::update_option('compressx_custom_includes',$includes); + + $stats=array(); + + $stats['files']=0; + $stats['saved']=0; + $stats['processed_files']=0; + $stats['total']=0; + $stats['processed']=0; + + $convert_to_webp=CompressX_Image_Opt_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Opt_Method::get_convert_to_avif(); + + foreach ($includes as $include) + { + $this->get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif); + } + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + $ret['result']='success'; + $ret['found']=$stats['files']; + $ret['saved']=$stats['saved']; + $ret['processed']=$stats['processed_files']; + + echo wp_json_encode($ret); + die(); + } + + public function start_scan_custom_images() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + if(empty($includes)) + { + $ret['result']='failed'; + $ret['error']='Please select at least one folder to process.'; + echo wp_json_encode($ret); + die(); + } + + CompressX_Options::update_option("compressx_need_optimized_custom_images",array()); + + $images=array(); + + foreach ($includes as $include) + { + $this->get_folder_images($images,$include); + } + + CompressX_Options::update_option("compressx_need_optimized_custom_images",$images); + + $ret['result']='success'; + $ret['progress']=sprintf( + 'Scanning: %1$d Found | View Log', + sizeof($images)); + $ret['finished']=true; + $ret['test']=$includes; + + echo wp_json_encode($ret); + + die(); + } + + public function get_folder_images(&$images,$path) + { + if(is_dir($path)) + { + $handler = opendir($path); + if($handler!==false) + { + while (($filename = readdir($handler)) !== false) + { + if ($filename != "." && $filename != "..") + { + if (is_dir($path . DIRECTORY_SEPARATOR . $filename)) + { + $this->get_folder_images($images, $path . DIRECTORY_SEPARATOR . $filename); + } + else + { + if($this->check_image($path . DIRECTORY_SEPARATOR . $filename)) + { + $images[] = $path . DIRECTORY_SEPARATOR . $filename; + } + } + } + } + if($handler) + @closedir($handler); + } + } + } + + public function check_image($file) + { + if ( ! file_exists( $file )) + { + return false; + } + $extension = array('jpg', 'jpeg', 'png','webp','avif'); + + $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); + + if ( !in_array( $ext, $extension, true ) ) + { + return false; + } + + return true; + } + + public function init_custom_bulk_optimization_task() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $force=isset($_POST['force'])?sanitize_key($_POST['force']):'0'; + if($force=='1') + { + $force=true; + } + else + { + $force=false; + } + + $task=new CompressX_Custom_ImgOptim_Task(); + $ret=$task->init_task($force); + echo wp_json_encode($ret); + die(); + } + + public function run_custom_optimize() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + set_time_limit(180); + + $task=new CompressX_Custom_ImgOptim_Task(); + + $ret=$task->get_task_status(); + + if($ret['result']=='success'&&$ret['status']=='completed') + { + $ret=$task->do_optimize_image(); + echo wp_json_encode($ret); + } + else + { + echo wp_json_encode($ret); + } + die(); + } + + public function get_custom_opt_progress() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $task=new CompressX_Custom_ImgOptim_Task(); + + $result=$task->get_task_progress(); + + echo wp_json_encode($result); + + die(); + } + + private function transfer_path($path) + { + $path = str_replace('\\','/',$path); + $values = explode('/',$path); + return implode(DIRECTORY_SEPARATOR,$values); + } +} diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-custom-media-lib.php b/wp-content/plugins/compressx/includes/display/class-compressx-custom-media-lib.php new file mode 100644 index 0000000..762031b --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-custom-media-lib.php @@ -0,0 +1,324 @@ +optimize_action_columns( $id ); + } + } + + public function optimize_action_columns($id) + { + $allowed_mime_types = CompressX_Image_Opt_Method::supported_mime_types_ex(); + + if ( ! wp_attachment_is_image( $id ) || ! in_array( get_post_mime_type( $id ),$allowed_mime_types ) ) + { + return __('Not support','compressx'); + } + + $html=$this->output_item($id); + return $html; + } + + public function submitbox() + { + global $post; + $id=$post->ID; + + $allowed_mime_types = CompressX_Image_Method::supported_mime_types_ex(); + + if ( ! wp_attachment_is_image( $post->ID ) || ! in_array( get_post_mime_type( $post->ID ),$allowed_mime_types ) ) + { + echo esc_html__('Not support','compressx'); + return; + } + + if($this->is_skipped($id)) + { + echo esc_html__('Skipped','compressx'); + return; + } + + $html=$this->output_item_edit($id); + echo $html; + } + + public function attachment_fields_to_edit(array $response, \WP_Post $attachment) + { + $source_post_id = (string) isset( $_REQUEST['post_id'])?$_REQUEST['post_id']:''; + if ( $source_post_id !== '0' ) + { + return $response; + } + + $allowed_mime_types = CompressX_Image_Method::supported_mime_types_ex(); + + if ( ! wp_attachment_is_image( $attachment->ID ) || ! in_array( get_post_mime_type( $attachment->ID ),$allowed_mime_types ) ) + { + return $response; + } + + $html=$this->output_item_attachment($attachment->ID); + $response['compat']['meta'] .=$html; + + return $response; + } + + public function output_item($id) + { + if($this->is_skipped($id)) + { + return __('Skipped','compressx'); + } + + $html='
      '; + $html.='
        '; + $html.=$this->output_item_detail($id); + $html.=$this->output_item_action($id); + $html.='
      '; + $html.='
      '; + return $html; + } + + public function output_item_edit($id) + { + if($this->is_skipped($id)) + { + return __('Skipped','compressx'); + } + + $html='

      ' . esc_html__('CompressX','compressx') . '

      '; + $html.='
        '; + $html.=$this->output_item_detail($id); + $html.=$this->output_item_action($id); + $html.='
      '; + $html.='
      '; + return $html; + } + + public function output_item_attachment($id) + { + $html='

      ' . esc_html__('CompressX','compressx') . '

      '; + $html.='
        '; + $html.=$this->output_item_detail($id); + $html.=$this->output_item_action($id); + $html.='
      '; + $html.='
      '; + return $html; + } + + public function output_item_detail($id) + { + $html=''; + $og_size=CompressX_Image_Meta_V2::get_og_size($id); + if(empty($og_size)) + { + $file_path = get_attached_file( $id ); + if(file_exists($file_path)) + $og_size=filesize($file_path); + else + $og_size=0; + } + + $html.='
    • Original : '.esc_html(size_format($og_size,2)).'
    • '; + + $webp_size=CompressX_Image_Meta_V2::get_webp_converted_size($id); + if($webp_size>0&&$og_size>$webp_size) + { + $webp_percent = round(100 - ($webp_size / $og_size) * 100, 2); + } + else + { + $webp_percent=0; + } + + $html.='
    • Webp : '.esc_html(size_format($webp_size,2)).' Saved : '.esc_html($webp_percent).'%
    • '; + + $avif_size=CompressX_Image_Meta_V2::get_avif_converted_size($id); + + if($avif_size>0&&$og_size>$avif_size) + { + $avif_percent = round(100 - ($avif_size / $og_size) * 100, 2); + } + else + { + $avif_percent=0; + } + + $html.='
    • AVIF : '.esc_html(size_format($avif_size,2)).' Saved : '.esc_html($avif_percent).'%
    • '; + + $meta=CompressX_Image_Meta_V2::get_image_meta($id); + if(isset($meta['size'])&&!empty($meta['size'])) + { + $thumbnail_counts=count($meta['size']); + } + else + { + $thumbnail_counts=0; + } + $html.='
    • Thumbnails generated : '.esc_html($thumbnail_counts).'
    • '; + + return $html; + } + + public function output_item_action($id) + { + $html='
    • '; + $html.=''; + if($this->is_image_progressing($id)) + { + $html.='Progressing'; + } + else + { + $html.='Apply'; + } + + $html.='
    • '; + return $html; + } + + public function is_skipped($image_id) + { + if(CompressX_Image_Meta_V2::get_image_meta_status($image_id)==='skip') + { + return true; + } + else + { + return false; + } + } + + public function is_image_progressing($post_id) + { + $progressing=CompressX_Image_Meta_V2::get_image_progressing($post_id); + + if(empty($progressing)) + { + return false; + } + else + { + $current_time=time(); + if(($current_time-$progressing)>180) + { + return false; + } + else + { + return true; + } + } + } + + public function get_opt_single_image_progress() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + if(!isset($_POST['ids'])||!is_string($_POST['ids'])) + { + die(); + } + + $ids=sanitize_text_field($_POST['ids']); + $ids=json_decode($ids,true); + + $running=false; + + if(isset($_POST['page'])) + { + $page=sanitize_text_field($_POST['page']); + } + else + { + $page='media'; + } + + foreach ($ids as $id) + { + if(!CompressX_Image_Meta_V2::is_image_optimized($id)) + { + if($this->is_image_progressing($id)) + { + $running=true; + break; + } + } + } + + $ret['result']='success'; + if($running) + { + $ret['continue']=1; + $ret['finished']=0; + } + else + { + $ret['continue']=0; + $ret['finished']=1; + } + + foreach ($ids as $id) + { + if($page=='edit') + { + $html=$this->output_item_edit($id); + } + else + { + $html=$this->output_item($id); + } + + $ret[$id]['html']=$html; + } + + echo wp_json_encode($ret); + + die(); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-dashboard.php b/wp-content/plugins/compressx/includes/display/class-compressx-dashboard.php new file mode 100644 index 0000000..c8058d5 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-dashboard.php @@ -0,0 +1,2014 @@ + +
      +
      + output_nav(); + $this->output_header(); + $this->output_notice(); + $this->output_review(); + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-convert')) { + $this->output_bulk_and_settings(); + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-use-general-settings')) { + $this->output_others_settings(); + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-use-thumbnail-settings')) { + $this->output_thumbnail_settings(); + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-use-exclude')) { + $this->output_exclude(); + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-bulk-custom-convert')) { + do_action("cx_output_custom_bulk"); + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-delete')) { + $this->output_delete_images(); + } + + $this->output_footer(); + ?> +
      +
      + +
      +
      +
      +
      + +
      +
      +
      Compressx.io has successfully processed of images, and it's completely free.
      +

      +
      +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + + + + test(); + } else { + $result = true; + } + + if (!$result || $has_notice) { + ?> +
      +
      +
      + +

      + + +

      + is_active_cache()) { + ?> +

      + +

      + is_apache()) { + ?> +

      + How-to: Config Apache htaccess Rules', 'compressx')) ?> +

      + is_nginx()) { + ?> +

      + How-to: Config Nginx htaccess Rules', 'compressx')) ?> +

      + is_litespeed()) { + ?> +

      + +

      + +

      + +

      + +
      +
      +
      + +
      +
      +
      +
      + images + +
      +
      +
      +
      + images + +
      +
      +
      +
      + ajax_check_security('compressx-can-convert'); + + $stats = CompressX_Image_Meta_V2::get_global_stats(); + + $ret['result'] = 'success'; + $ret['html'] = "
      +
      +
      +
      + " . $stats['webp_converted_percent'] . "% images + Outputted to WEBP +
      +
      +
      +
      + " . $stats['avif_converted_percent'] . "% images + Outputted to AVIF +
      +
      +
      +
      "; + $ret['webp_saved'] = $stats['avif_saved_percent'] . '%'; + $ret['avif_saved'] = $stats['webp_saved_percent'] . '%'; + //webp_saved + //avif_saved + echo wp_json_encode($ret); + + die(); + } + + public function compressx_hide_notice() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + CompressX_Options::update_option('compressx_hide_notice', true); + + die(); + } + + public function compressx_rating_dismiss() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-convert'); + + if (isset($_POST['value'])) { + $value = sanitize_text_field($_POST['value']); + if ($value == 'ask_me_later') { + $time = time() + 259200; + CompressX_Options::update_option('compressx_rating_dismiss', $time); + } + if ($value == 'close') { + $time = time() + 604800; + CompressX_Options::update_option('compressx_rating_dismiss', $time); + } else if ($value == 'already') { + CompressX_Options::update_option('compressx_rating_dismiss', 0); + } else if ($value == 'dismiss') { + CompressX_Options::update_option('compressx_rating_dismiss', 0); + } + } + + die(); + } + + public function delete_files() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-delete'); + + global $wpdb; + + $where['meta_key'] = "compressx_image_meta_status"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_webp_converted"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_avif_converted"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_compressed"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_og_file_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_webp_converted_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_avif_converted_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_compressed_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta"; + $wpdb->delete($wpdb->postmeta, $where); + + delete_transient('compressx_set_global_stats'); + + $table_name = $wpdb->prefix . "compressx_files_opt_meta"; + $wpdb->get_results("TRUNCATE TABLE $table_name", ARRAY_A); + CompressX_Image_Meta_V2::delete_all_image_meta(); + $this->_delete_files(); + + $ret['result'] = "success"; + echo wp_json_encode($ret); + die(); + } + + public function _delete_files() + { + $path = WP_CONTENT_DIR . '/compressx-nextgen'; + $this->deleteDir($path); + + include_once COMPRESSX_DIR . '/includes/class-compressx-default-folder.php'; + $dir = new CompressX_default_folder(); + $dir->create_uploads_dir(); + } + + public function deleteDir( $dirPath ) + { + if ( ! is_dir( $dirPath ) ) { + return false; + } + + global $wp_filesystem; + if ( empty( $wp_filesystem ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + WP_Filesystem(); + } + + if ( empty( $wp_filesystem ) ) { + return false; + } + + // Recursive delete. + return $wp_filesystem->rmdir( $dirPath, true ); + } + + + public function output_bulk_and_settings() + { + ?> +
      +
      + +
      + output_convert_setting(); ?> + output_bulk(); ?> +
      +
      +
      + + output_custom_compression_setting(); + } + + public function output_convert_setting() + { + $is_auto = CompressX_Options::get_option('compressx_auto_optimize', false); + + if ($is_auto) { + $is_auto = 'checked'; + } else { + $is_auto = ''; + } + + $options = CompressX_Options::get_option('compressx_quality', array()); + $quality = isset($options['quality']) ? $options['quality'] : 'lossy'; + + if ($quality == "lossless") { + $quality_lossless = "checked"; + $quality_lossy_minus = ""; + $quality_lossy = ""; + $quality_lossy_plus = ""; + $quality_lossy_super = ""; + $quality_custom = ""; + $quality_custom_notice = "display:none"; + } else if ($quality == "lossy_minus") { + $quality_lossless = ""; + $quality_lossy_minus = "checked"; + $quality_lossy = ""; + $quality_lossy_plus = ""; + $quality_lossy_super = ""; + $quality_custom = ""; + $quality_custom_notice = "display:none"; + } else if ($quality == "lossy") { + $quality_lossless = ""; + $quality_lossy_minus = ""; + $quality_lossy = "checked"; + $quality_lossy_plus = ""; + $quality_lossy_super = ""; + $quality_custom = ""; + $quality_custom_notice = "display:none"; + } else if ($quality == "lossy_plus") { + $quality_lossless = ""; + $quality_lossy_minus = ""; + $quality_lossy = ""; + $quality_lossy_plus = "checked"; + $quality_lossy_super = ""; + $quality_custom = ""; + $quality_custom_notice = "display:none"; + } else if ($quality == "lossy_super") { + $quality_lossless = ""; + $quality_lossy_minus = ""; + $quality_lossy = ""; + $quality_lossy_plus = ""; + $quality_lossy_super = "checked"; + $quality_custom = ""; + $quality_custom_notice = "display:none"; + } else { + $quality_lossless = ""; + $quality_lossy_minus = ""; + $quality_lossy = ""; + $quality_lossy_plus = ""; + $quality_lossy_super = ""; + $quality_custom = "checked"; + $quality_custom_notice = ""; + } + + if (CompressX_Image_Opt_Method::is_support_gd()) { + $is_support_gd = ""; + } else { + $is_support_gd = "disabled"; + } + + if (CompressX_Image_Opt_Method::is_support_imagick()) { + $is_support_imagick = ""; + } else { + $is_support_imagick = "disabled"; + } + + $converter_method = CompressX_Options::get_option('compressx_converter_method', false); + + if (empty($converter_method)) { + $converter_method = CompressX_Image_Opt_Method::set_default_compress_server(); + } + + if ($converter_method == "gd") { + $gd_checked = "checked"; + $imagick_checked = ""; + } else if ($converter_method == "imagick") { + $gd_checked = ""; + $imagick_checked = "checked"; + } else { + $gd_checked = ""; + $imagick_checked = ""; + } + + $convert_to_webp = CompressX_Options::get_option('compressx_output_format_webp', 'not init'); + if ($convert_to_webp === 'not init') { + $convert_to_webp = CompressX_Image_Opt_Method::set_default_output_format_webp(); + } + + $convert_to_avif = CompressX_Options::get_option('compressx_output_format_avif', 'not init'); + if ($convert_to_avif === 'not init') { + $convert_to_avif = CompressX_Image_Opt_Method::set_default_output_format_avif(); + } + + if ($convert_to_webp) { + $convert_to_webp = 'checked'; + } else { + $convert_to_webp = ''; + } + + if ($convert_to_avif) { + $convert_to_avif = 'checked'; + } else { + $convert_to_avif = ''; + } + + + if (CompressX_Image_Opt_Method::is_current_support_webp()) { + $webp_support = ''; + } else { + $convert_to_webp = ''; + $webp_support = 'disabled'; + } + + if (CompressX_Image_Opt_Method::is_current_support_avif()) { + $avif_support = ''; + } else { + $convert_to_avif = ''; + $avif_support = 'disabled'; + } + + $compression_level_url = admin_url() . 'admin.php?page=compression-level-compressx'; + + $cached = get_transient("compressx_set_global_stats"); + + if ($cached) { + $cx_webp_saved = $cached['space_saved_webp_percent'] . '%'; + $cx_avif_saved = $cached['space_saved_avif_percent'] . '%'; + } else { + $cx_webp_saved = '0%'; + $cx_avif_saved = '0%'; + } + ?> +
      +
      +
      + +
      +
      + Total Savings: AVIF: | + Webp: +
      +
      +
      +
      +
      +
      + + + +
      + +

      +
      +
      + +

      + +
      +
      + "> +
      +
      + + > + + GD + + + > + + Imagick + + +
      +
      + + + + > + + Webp + + + + + > + + AVIF + + + +
      + +

      +
      +
      + +

      + +
      +
      + +
      +
      +
      +
      + + Watermark + + + + (Pro only) + + + +
      + +

      + Enable this option to automatically tag newly uploaded images, making them ready for batch watermarking. This feature allows you to easily identify and process recent uploads for watermark application, streamlining your image protection process. +

      + +
      +
      +

      + + + + Mark New Uploads for Watermarking + + (Pro only) + +

      +
      +
      +
      +
      +
      +
      + + + +
      + +

      + Choose the most appropriate compression level. The 5 compression levels are increasing from lossless to lossy. The default level is the Thumb, which is suitable for most situations. You can customize the compression level for WebP and AVIF formats.
      + Lossless: A compression level of 99
      + : A compression level of 90
      + : The default level. A compression level of 80
      + : A compression level of 70
      + Lossy: A compression level of 60
      + Custom: Customize the compression level +

      + +
      +
      +
      +
      +
      + > + + + > + + + > + + + > + + + > + + + > + + + +
      + +
      +
      +
      +
      +
      + +
      +
      +
      +
      + + + +
      +
      +
      +
      +
      + + Global compression level + +

      + Webp + + AVIF +

      +

      ">Advanced compression level

      +
      +
      +
      +
      + +
      +
      +
      +
      + +
      +
      +
      + +
      +
      + + + + + +
      + +

      + +

      + +
      +
      +
      +
      +
      + output_overview(); ?> +
      + +
      + $_wp_additional_image_sizes[$size_key]['width'], + 'height' => $_wp_additional_image_sizes[$size_key]['height'], + 'crop' => $_wp_additional_image_sizes[$size_key]['crop'], + ); + if (isset($options['skip_size'][$size_key]) && $options['skip_size'][$size_key]) { + $image_sizes[$size_key]['skip'] = true; + } else { + $image_sizes[$size_key]['skip'] = false; + } + } + } + + if (! isset($sizes['medium_large']) || empty($sizes['medium_large'])) { + $width = intval(get_option('medium_large_size_w')); + $height = intval(get_option('medium_large_size_h')); + + $image_sizes['medium_large'] = array( + 'width' => $width, + 'height' => $height, + ); + + if (isset($options['skip_size']['medium_large']) && $options['skip_size']['medium_large']) { + $image_sizes['medium_large']['skip'] = true; + } else { + $image_sizes['medium_large']['skip'] = false; + } + } + + ?> +
      +
      +
      +
      +
      +
      +
      +
      +
      + $size) { + if ($showed > $max_show) { + $style = "display:none"; + if (!$show_more) { + $show_more = true; + ?> + More... + + + + > + + +
      +
      +
      +
      + +
      +
      +
      +
      + +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +

      + + + + + +

      + Enter the text Delete and click Go to confirm the deletion. +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + +
      +

      + + > + +

      +

      + + > + +

      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +

      + + > + +

      +

      + + > + +

      +

      + + > + +

      +
      +
      +
      + +

      + +

      +

      + tags with tags. You can use it when .htaccess can not take effect on your server. For example, if you are not able to restart an OpenLiteSpeed server which is required for .htaccess to take effect. This method works for most browsers but does not support images in CSS.', 'compressx') ?> +

      +
      +
      +
      +
      +
      +
      + +
      +

      + + > + +

      +

      + + > + +

      +
      +
      +
      + You may use the options when:
      + 1. Your image library is ImageMagick 6.x. PNG images may lose transparent background when being converted to AVIF with ImageMagick 6.x. Then you can choose not to convert PNG to AVIF. A higher ImageMagick version like 7 does not have the issue.
      + 2. You don't want to convert PNG to WebP or AVIF because you want to keep the transparent background. +
      +
      +
      +
      +
      +
      + +
      +

      + + > + +

      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +

      + + + + +

      +
      +
      +
      + + + +
      +
      +
      +
      +
      +
      + +
      +

      + + > + +

      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +
      +

      + > + +

      + px + px +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      + +
      +

      + + > + +

      +
      +
      +
      + +
      +
      +
      +
      + +
      +
      +
      + + +
      +
      +
      +
      +
      +
      + +
      + +
      + +
      +
      +
      + + + +
      +
      +
      +
      + + + Media files inside these folders will NOT be processed + +
      +
        + +
      • + + get_children_count($exclude) . ') images') ?> + +
      • + +
      +
      +
      +
      +
      + + + + +
      +
      +
      +
      +
      +ajax_check_security('compressx-can-use-general-settings'); + + if (isset($_POST['setting']) && !empty($_POST['setting'])) { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) { + $ret['result'] = 'failed'; + $ret['error'] = 'json decode failed'; + echo wp_json_encode($ret); + die(); + } + + if (isset($setting['auto_optimize'])) { + if ($setting['auto_optimize'] == '1') { + $options = true; + } else { + $options = false; + } + + if (CompressX_Options::get_option('compressx_show_review', false) === false) { + CompressX_Options::update_option('compressx_show_review', time() + 259200); + } + + CompressX_Options::update_option('compressx_auto_optimize', $options); + } + + if (isset($setting['convert_to_webp'])) { + if ($setting['convert_to_webp'] == '1') { + $options = 1; + } else { + $options = 0; + } + + CompressX_Options::update_option('compressx_output_format_webp', $options); + } + + if (isset($setting['convert_to_avif'])) { + if ($setting['convert_to_avif'] == '1') { + $options = 1; + } else { + $options = 0; + } + + CompressX_Options::update_option('compressx_output_format_avif', $options); + } + + if (isset($setting['quality'])) { + $options['quality'] = $setting['quality']; + if ($options['quality'] == "custom") { + $options['quality_webp'] = isset($setting['quality_webp']) ? $setting['quality_webp'] : 80; + $options['quality_avif'] = isset($setting['quality_avif']) ? $setting['quality_avif'] : 60; + } + + CompressX_Options::update_option('compressx_quality', $options); + } + + if (isset($setting['converter_method'])) { + $converter_method = $setting['converter_method']; + CompressX_Options::update_option('compressx_converter_method', $converter_method); + + $convert_to_webp = CompressX_Options::get_option('compressx_output_format_webp', 1); + + if ($convert_to_webp) { + $ret['check_webp'] = true; + } else { + $ret['check_webp'] = false; + } + + $convert_to_avif = CompressX_Options::get_option('compressx_output_format_avif', 1); + + if ($convert_to_avif) { + $ret['check_avif'] = true; + } else { + $ret['check_avif'] = false; + } + + if ($converter_method == 'gd') { + if (CompressX_Image_Method::is_support_gd_webp()) { + $ret['disable_webp'] = false; + } else { + $ret['disable_webp'] = true; + $ret['check_webp'] = false; + } + + if (CompressX_Image_Method::is_support_gd_avif()) { + $ret['disable_avif'] = false; + } else { + $ret['disable_avif'] = true; + $ret['check_avif'] = false; + } + } else if ($converter_method == 'imagick') { + if (CompressX_Image_Method::is_support_imagick_webp()) { + $ret['disable_webp'] = false; + } else { + $ret['disable_webp'] = true; + $ret['check_webp'] = false; + } + + if (CompressX_Image_Method::is_support_imagick_avif()) { + $ret['disable_avif'] = false; + } else { + $ret['disable_avif'] = true; + $ret['check_avif'] = false; + } + } else { + $ret['disable_webp'] = true; + $ret['check_webp'] = false; + $ret['disable_avif'] = true; + $ret['check_avif'] = false; + } + } + /* + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite=new CompressX_Webp_Rewrite(); + + $upload_dir = wp_upload_dir(); + $rewrite->save_webp_rewrite_rule($upload_dir['basedir']); + */ + + $ret['result'] = 'success'; + echo wp_json_encode($ret); + die(); + } else { + die(); + } + } + + public function save_others_setting() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-general-settings'); + + if (isset($_POST['setting']) && !empty($_POST['setting'])) { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) { + $ret['result'] = 'failed'; + $ret['error'] = 'json decode failed'; + echo wp_json_encode($ret); + die(); + } + + $options = CompressX_Options::get_option('compressx_general_settings', array()); + + if (isset($setting['remove_exif'])) + $options['remove_exif'] = $setting['remove_exif']; + if (isset($setting['exclude_png'])) + $options['exclude_png'] = $setting['exclude_png']; + if (isset($setting['exclude_png_webp'])) + $options['exclude_png_webp'] = $setting['exclude_png_webp']; + // + if (isset($setting['auto_remove_larger_format'])) + $options['auto_remove_larger_format'] = $setting['auto_remove_larger_format']; + + $reset_rewrite = false; + $interface_version_changed = false; + + if (isset($setting['disable_cache_control'])) { + $reset_rewrite = true; + $options['disable_cache_control'] = $setting['disable_cache_control']; + } + + if (isset($setting['interface_version'])) { + $old_interface_version = isset($options['interface_version']) ? $options['interface_version'] : 'v1'; + if ($old_interface_version !== $setting['interface_version']) { + $interface_version_changed = true; + } + $options['interface_version'] = $setting['interface_version']; + } + + if (isset($setting['image_load'])) { + if (!isset($options['image_load'])) { + $options['image_load'] = 'htaccess'; + } + + if ($options['image_load'] != $setting['image_load']) + $reset_rewrite = true; + + $options['image_load'] = $setting['image_load']; + } + + + if (isset($setting['resize'])) + $options['resize']['enable'] = $setting['resize']; + if (isset($setting['resize_width'])) + $options['resize']['width'] = $setting['resize_width']; + if (isset($setting['resize_height'])) + $options['resize']['height'] = $setting['resize_height']; + + if (isset($setting['converter_images_pre_request'])) + $options['converter_images_pre_request'] = intval($setting['converter_images_pre_request']); + // + CompressX_Options::update_option('compressx_general_settings', $options); + + if (isset($setting['converter_method'])) { + $converter_method = $setting['converter_method']; + CompressX_Options::update_option('compressx_converter_method', $converter_method); + } + + if ($options['image_load'] == 'htaccess') { + if ($reset_rewrite) { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules(); + $ret['test'] = '1'; + } + } else if ($options['image_load'] == 'compat_htaccess') { + if ($reset_rewrite) { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules_ex(); + $ret['test'] = '1'; + } + } else { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->remove_rewrite_rule(); + } + + + $ret['result'] = 'success'; + + if ($interface_version_changed) + { + $ret['redirect_url']=true; + } + else + { + $ret['redirect_url']=false; + } + + echo wp_json_encode($ret); + die(); + } else { + die(); + } + } + + public function save_size_setting() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-thumbnail-settings'); + + if (isset($_POST['setting']) && !empty($_POST['setting'])) { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) { + $ret['result'] = 'failed'; + $ret['error'] = 'json decode failed'; + echo wp_json_encode($ret); + die(); + } + + $options = CompressX_Options::get_option('compressx_general_settings', array()); + + $intermediate_image_sizes = get_intermediate_image_sizes(); + + if (isset($setting['og'])) { + $options['skip_size']['og'] = !$setting['og']; + } else { + $options['skip_size']['og'] = false; + } + + foreach ($intermediate_image_sizes as $size_key) { + if (isset($setting[$size_key])) { + $options['skip_size'][$size_key] = !$setting[$size_key]; + } else { + $options['skip_size'][$size_key] = false; + } + } + + CompressX_Options::update_option('compressx_general_settings', $options); + + $ret['result'] = 'success'; + echo wp_json_encode($ret); + die(); + } else { + die(); + } + } + + public function get_custom_tree_dir() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + try { + $node_array = array(); + + if ($_POST['tree_node']['node']['id'] == '#') { + $path = ABSPATH; + + if (!empty($_POST['tree_node']['path'])) { + $path = sanitize_text_field($_POST['tree_node']['path']); + } + + /* + $node_array[] = array( + 'text' => basename($path), + 'children' => true, + 'id' => $path, + 'icon' => 'dashicons dashicons-category cx-icon-color-yellow', + 'state' => array( + 'opened' => true + ) + );*/ + } else { + $path = sanitize_text_field($_POST['tree_node']['node']['id']); + } + + $upload_dir = wp_upload_dir(); + $uploads_path = $upload_dir['basedir']; + $uploads_path = str_replace('\\', '/', $uploads_path); + $uploads_path = $uploads_path . '/'; + + if ($path == $uploads_path) { + $init = true; + $key = gmdate('Y', time()); + } else { + $init = false; + $key = gmdate('Y', time()); + } + + $path = trailingslashit(str_replace('\\', '/', realpath($path))); + + if ($dh = opendir($path)) { + while (substr($path, -1) == '/') { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) { + if (is_dir($path . '/' . $value)) { + $node['children'] = $this->has_children($path . '/' . $value); + $node['id'] = $path . '/' . $value; + if ($init) { + if ($value == $key) { + $node['state']['opened'] = true; + } + } + // + $node['icon'] = 'dashicons dashicons-open-folder cx-icon-color-techblue compressx-text'; + $node['children_count'] = $this->get_children_count($path . '/' . $value); + $node['text'] = $value . ',(' . $node['children_count'] . ') images'; + $node['text'] .= ''; + $node_array[] = $node; + + /* + if($this->is_media_folder($path . '/' . $value)) + { + $node['children'] = $this->has_children($path . '/' . $value); + $node['id'] = $path . '/' . $value; + if($init) + { + if($value==$key) + { + $node['state']['opened']=true; + } + } + // + $node['icon'] = 'dashicons dashicons-open-folder cx-icon-color-techblue compressx-text'; + $node['children_count']=$this->get_children_count($path . '/' . $value); + $node['text'] = $value.',('. $node['children_count'].') images'; + $node['text'] .=''; + $node_array[] = $node; + } + else + { + continue; + }*/ + } else { + //$node['text'] = $value; + //$node['children'] = true; + //$node['id'] = $path . '/' . $value; + //$node['icon'] = 'dashicons dashicons-media-default cx-icon-color-yellow'; + //$node_array[] = $node; + continue; + } + } + } + } + + $ret['nodes'] = $node_array; + echo wp_json_encode($ret); + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + echo wp_json_encode(array('result' => 'failed', 'error' => $message)); + } + die(); + } + + public function has_children($path) + { + if ($dh = opendir($path)) { + while (substr($path, -1) == '/') { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) { + if (is_dir($path . '/' . $value)) { + return true; + } + } + } + } + + return false; + } + + public function is_media_folder($path) + { + $upload_dir = wp_upload_dir(); + $base_dir = $upload_dir['basedir']; + $base_dir = trailingslashit(str_replace('\\', '/', realpath($base_dir))); + $path = str_replace($base_dir, '', $path); + $path_arr = explode('/', $path); + + if (count($path_arr) >= 1) { + if (is_numeric($path_arr[0]) && $path_arr[0] > 1950 && $path_arr[0] < 2050) { + return true; + } + } + + return false; + } + + public function get_children_count($path) + { + try { + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + $files = 0; + + /** @var SplFileInfo $file */ + foreach ($rii as $file) { + if ($file->isDir()) { + continue; + } + + $files++; + } + + return $files; + } catch (Exception $e) { + return 0; + } + } + + public function add_exclude_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + $json_excludes = sanitize_text_field($_POST['excludes']); + $json_excludes = stripslashes($json_excludes); + $new_excludes = json_decode($json_excludes, true); + + CompressX_Options::update_option('compressx_media_excludes', $new_excludes); + + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + $html = '
        '; + foreach ($new_excludes as $exclude) { + $path = str_replace($abs_path, '', $exclude); + $html .= '
      • ' . + '' . $path . ',(' . $this->get_children_count($exclude) . ') images' . '' . + '
      • '; + } + $html .= '
          '; + $ret['result'] = 'success'; + $ret['html'] = $html; + echo wp_json_encode($ret); + die(); + } + + public function add_exclude_folder() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + $exclude = sanitize_text_field($_POST['id']); + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + $path = str_replace($abs_path, '', $exclude); + + $html = '
        • ' . + '' . $path . ',(' . $this->get_children_count($exclude) . ') images' . '' . + '
        • '; + $ret['result'] = 'success'; + $ret['html'] = $html; + echo wp_json_encode($ret); + die(); + } + + public function remove_exclude_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + $excludes = CompressX_Options::get_option('compressx_media_excludes', array()); + + $id = sanitize_text_field($_POST['id']); + unset($excludes[$id]); + + CompressX_Options::update_option('compressx_media_excludes', $excludes); + + $ret['result'] = 'success'; + + echo wp_json_encode($ret); + die(); + } +} diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-display.php b/wp-content/plugins/compressx/includes/display/class-compressx-display.php new file mode 100644 index 0000000..b63e3a6 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-display.php @@ -0,0 +1,891 @@ +load_v2(); + /* + $interface_version = CompressX_Options::get_interface_version(); + if($interface_version === 'v2') + { + $this->load_v2(); + } + else + { + $this->load(); + }*/ + } + + /* + public function load() + { + include_once COMPRESSX_DIR . '/includes/display/class-compressx-dashboard.php'; + include_once COMPRESSX_DIR . '/includes/display/class-compressx-bulk-action.php'; + include_once COMPRESSX_DIR . '/includes/display/class-compressx-custom-bulk-action.php'; + include_once COMPRESSX_DIR . '/includes/display/class-compressx-cdn.php'; + include_once COMPRESSX_DIR . '/includes/display/class-compressx-logs.php'; + include_once COMPRESSX_DIR . '/includes/display/class-compressx-system-info.php'; + include_once COMPRESSX_DIR . '/includes/display/class-compressx-addons.php'; + + $this->dashboard=new CompressX_Dashboard(); + $this->bulk_action=new CompressX_Bulk_Action(); + $this->custom_bulk_action=new CompressX_Custom_Bulk_Action(); + $this->cdn=new CompressX_CDN(); + $this->log=new CompressX_Logs(); + $this->system_info=new CompressX_System_Info(); + $this->addons=new CompressX_Addons(); + + add_action('admin_enqueue_scripts',array( $this,'enqueue_styles')); + add_action('admin_enqueue_scripts',array( $this,'enqueue_scripts')); + + add_action('compressx_output_nav',array( $this,'output_nav')); + add_action('compressx_output_header',array( $this,'output_header')); + add_action('compressx_output_footer',array( $this,'output_footer')); + + if(is_multisite()) + { + add_action('network_admin_menu',array( $this,'add_plugin_network_admin_menu')); + } + else + { + add_action('admin_menu',array( $this,'add_plugin_admin_menu')); + } + } + */ + + public function load_v2() + { + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-image-optimization-display.php'; + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-bulk-optimization-display.php'; + + $this->image_optimization=new CompressX_Image_Optimization_Display(); + + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-settings-display.php'; + $this->settings=new CompressX_Settings_Display(); + + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-cdn-display.php'; + $this->cdn=new CompressX_CDN_Display(); + + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-system-info-display.php'; + $this->system_info=new CompressX_System_Info_Display(); + + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-addons-display.php'; + $this->addons=new CompressX_Addons_Display(); + + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-custom-bulk-action-v2.php'; + $this->custom_bulk_action=new CompressX_Custom_Bulk_Action_V2(); + // + include_once COMPRESSX_DIR . '/includes/display_v2/class-compressx-media-replace-display.php'; + $this->media_replace=new CompressX_Media_Replace_Display(); + + add_action('admin_enqueue_scripts',array( $this,'enqueue_styles_v2')); + add_action('admin_enqueue_scripts',array( $this,'enqueue_scripts_v2')); + + add_action('compressx_output_nav',array( $this,'output_nav')); + add_action('compressx_output_header',array( $this,'output_header')); + add_action('compressx_output_footer',array( $this,'output_footer_v2')); + + if(is_multisite()) + { + add_action('network_admin_menu',array( $this,'add_plugin_network_admin_menu')); + } + else + { + add_action('admin_menu',array( $this,'add_plugin_admin_menu_v2')); + add_action('admin_menu',array( $this,'add_media_replace_menu')); + add_action('submenu_file', array($this, 'hide_media_replace_menu')); + } + } + + public function enqueue_styles() + { + if(is_multisite()) + { + $screen_ids[]='toplevel_page_CompressX-network'; + } + else + { + $screen_ids[]='toplevel_page_'.COMPRESSX_SLUG; + $screen_ids[]='compressx_page_info-compressx'; + $screen_ids[]='compressx_page_logs-compressx'; + $screen_ids[]='compressx_page_cdn-compressx'; + $screen_ids[]='compressx_page_addons-compressx'; + $screen_ids[]='compressx_page_compression-level-compressx'; + } + + $screen_ids=apply_filters('compressx_get_screen_ids',$screen_ids); + + if(in_array(get_current_screen()->id,$screen_ids)) + { + wp_enqueue_style(COMPRESSX_SLUG.'jstree', COMPRESSX_URL . '/includes/display/js/jstree/dist/themes/default/style.min.css', array(), COMPRESSX_VERSION, 'all'); + wp_enqueue_style(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/css/compressx-style.css', array(), COMPRESSX_VERSION, 'all'); + wp_enqueue_style(COMPRESSX_SLUG.'-percentage-circle-style', COMPRESSX_URL . '/includes/display/css/compressx-percentage-circle-style.css', array(), COMPRESSX_VERSION, 'all'); + } + else if(get_current_screen()->id=='upload'||get_current_screen()->id=='attachment') + { + wp_enqueue_style(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/css/compressx-media.css', array(), COMPRESSX_VERSION, 'all'); + } + } + + public function enqueue_scripts() + { + $screen_ids[]='toplevel_page_'.COMPRESSX_SLUG; + $screen_ids[]='compressx_page_info-compressx'; + $screen_ids[]='compressx_page_logs-compressx'; + $screen_ids[]='compressx_page_cdn-compressx'; + $screen_ids[]='compressx_page_compression-level-compressx'; + $screen_ids=apply_filters('compressx_get_screen_ids',$screen_ids); + + if(in_array(get_current_screen()->id,$screen_ids)) + { + wp_enqueue_script(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/js/compressx.js', array('jquery'), COMPRESSX_VERSION, false); + wp_enqueue_script(COMPRESSX_SLUG.'jstree', COMPRESSX_URL . '/includes/display/js/jstree/dist/jstree.min.js', array('jquery'), COMPRESSX_VERSION, false); + + wp_localize_script(COMPRESSX_SLUG, 'compressx_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce'=>wp_create_nonce('compressx_ajax'))); + + wp_enqueue_script('plupload-all'); + } + else if(get_current_screen()->id=='upload'||get_current_screen()->id=='attachment') + { + wp_enqueue_script(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/js/compressx.js', array('jquery'), COMPRESSX_VERSION, false); + wp_enqueue_script(COMPRESSX_SLUG.'_media', COMPRESSX_URL . '/includes/display/js/optimize.js', array('jquery'), COMPRESSX_VERSION, true); + wp_localize_script(COMPRESSX_SLUG, 'compressx_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce'=>wp_create_nonce('compressx_ajax'))); + } + + $toplevel_screen_id='toplevel_page_'.COMPRESSX_SLUG; + $toplevel_screen_id=apply_filters('compressx_get_screen_id',$toplevel_screen_id); + if(get_current_screen()->id==$toplevel_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + + $upload_dir = wp_upload_dir(); + $path = $upload_dir['basedir']; + $path = str_replace('\\','/',$path); + $uploads_path = $path.'/'; + + $path = WP_CONTENT_DIR; + $path = str_replace('\\','/',$path); + $custom_root_path = $path.'/'; + + if(CompressX_Image_Opt_Method::check_imagick_avif()) + { + wp_localize_script(COMPRESSX_SLUG, 'compressx_alert', array('imagick_avif' => false)); + } + else + { + wp_localize_script(COMPRESSX_SLUG, 'compressx_alert', array('imagick_avif' => true)); + } + + wp_localize_script(COMPRESSX_SLUG, 'compressx_uploads_root', array('path' => $uploads_path,'custom_path'=>$custom_root_path)); + wp_enqueue_script(COMPRESSX_SLUG.'_setting', COMPRESSX_URL . '/includes/display/js/compressx_setting.js', array('jquery'), COMPRESSX_VERSION, $arg); + wp_enqueue_script(COMPRESSX_SLUG.'_custom_bulk', COMPRESSX_URL . '/includes/display/js/compressx_custom_bulk.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + + $cdn_screen_id='compressx_page_cdn-compressx'; + $cdn_screen_id=apply_filters('compressx_get_screen_id',$cdn_screen_id); + if(get_current_screen()->id=='compressx_page_cdn-compressx') + { + $arg=array(); + $arg['in_footer']=true; + + wp_enqueue_script(COMPRESSX_SLUG.'_setting', COMPRESSX_URL . '/includes/display/js/compressx_setting.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + + $logs_screen_id='compressx_page_logs-compressx'; + $logs_screen_id=apply_filters('compressx_get_screen_id',$logs_screen_id); + if(get_current_screen()->id==$logs_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + + wp_enqueue_script(COMPRESSX_SLUG.'_logs', COMPRESSX_URL . '/includes/display/js/compressx_log.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + + $info_screen_id='compressx_page_info-compressx'; + $info_screen_id=apply_filters('compressx_get_screen_id',$info_screen_id); + if(get_current_screen()->id==$info_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + wp_enqueue_script(COMPRESSX_SLUG.'_systeminfo', COMPRESSX_URL . '/includes/display/js/compressx_system_info.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + } + + public function enqueue_styles_v2() + { + if(is_multisite()) + { + $screen_ids[]='toplevel_page_CompressX-network'; + } + else + { + $screen_ids[]='toplevel_page_'.COMPRESSX_SLUG; + $screen_ids[]='compressx_page_image-optimization-compressx'; + $screen_ids[]='compressx_page_settings-compressx'; + $screen_ids[]='compressx_page_cdn-compressx'; + $screen_ids[]='compressx_page_info-compressx'; + $screen_ids[]='compressx_page_addons-compressx'; + //Replace Media + $screen_ids[]='media_page_media-replace-compressx'; + } + + $screen_ids=apply_filters('compressx_get_screen_ids',$screen_ids); + + if(in_array(get_current_screen()->id,$screen_ids)) + { + wp_enqueue_style(COMPRESSX_SLUG.'jstree', COMPRESSX_URL . '/includes/display/js/jstree/dist/themes/default/style.min.css', array(), COMPRESSX_VERSION, 'all'); + wp_enqueue_style(COMPRESSX_SLUG.'_v2', COMPRESSX_URL . '/includes/display_v2/css/compressx-style-v2.css', array(), COMPRESSX_VERSION, 'all'); + wp_enqueue_style(COMPRESSX_SLUG.'-percentage-circle-style', COMPRESSX_URL . '/includes/display/css/compressx-percentage-circle-style.css', array(), COMPRESSX_VERSION, 'all'); + wp_enqueue_style(COMPRESSX_SLUG.'-twentytwenty', COMPRESSX_URL . '/includes/display_v2/css/twentytwenty/twentytwenty.css', array(), COMPRESSX_VERSION); + wp_enqueue_style(COMPRESSX_SLUG.'-folder-tree', COMPRESSX_URL . '/includes/display_v2/css/compressx-folder-tree.css', array(), COMPRESSX_VERSION, 'all'); + + } + else if(get_current_screen()->id=='upload'||get_current_screen()->id=='attachment') + { + wp_enqueue_style(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/css/compressx-media.css', array(), COMPRESSX_VERSION, 'all'); + } + } + + public function enqueue_scripts_v2() + { + $screen_ids[]='toplevel_page_'.COMPRESSX_SLUG; + $screen_ids[]='compressx_page_image-optimization-compressx'; + $screen_ids[]='compressx_page_settings-compressx'; + $screen_ids[]='compressx_page_cdn-compressx'; + $screen_ids[]='compressx_page_info-compressx'; + $screen_ids[]='compressx_page_addons-compressx'; + + $screen_ids[]='media_page_media-replace-compressx'; + + $screen_ids=apply_filters('compressx_get_screen_ids',$screen_ids); + + if(in_array(get_current_screen()->id,$screen_ids)) + { + wp_enqueue_script(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/js/compressx.js', array('jquery'), COMPRESSX_VERSION, false); + wp_enqueue_script(COMPRESSX_SLUG.'jstree', COMPRESSX_URL . '/includes/display/js/jstree/dist/jstree.min.js', array('jquery'), COMPRESSX_VERSION, false); + + wp_localize_script(COMPRESSX_SLUG, 'compressx_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce'=>wp_create_nonce('compressx_ajax'))); + + wp_enqueue_script('plupload-all'); + } + else if(get_current_screen()->id=='upload'||get_current_screen()->id=='attachment') + { + wp_enqueue_script(COMPRESSX_SLUG, COMPRESSX_URL . '/includes/display/js/compressx.js', array('jquery'), COMPRESSX_VERSION, false); + wp_enqueue_script(COMPRESSX_SLUG.'_media', COMPRESSX_URL . '/includes/display/js/optimize.js', array('jquery'), COMPRESSX_VERSION, true); + wp_localize_script(COMPRESSX_SLUG, 'compressx_ajax_object', array('ajax_url' => admin_url('admin-ajax.php'),'ajax_nonce'=>wp_create_nonce('compressx_ajax'))); + } + + $toplevel_screen_id='toplevel_page_'.COMPRESSX_SLUG; + $toplevel_screen_id=apply_filters('compressx_get_screen_id',$toplevel_screen_id); + if(get_current_screen()->id==$toplevel_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + if(CompressX_Image_Opt_Method::check_imagick_avif()) + { + $imagick_avif=false; + } + else + { + $imagick_avif=true; + } + + if(CompressX_Image_Method::is_support_gd_webp()) + { + $support_gd_webp=true; + } + else + { + $support_gd_webp=false; + } + + if(CompressX_Image_Method::is_support_imagick_webp()) + { + $support_imagick_webp=true; + } + else + { + $support_imagick_webp=false; + } + + if(CompressX_Image_Method::is_support_gd_avif()) + { + $support_gd_avif=true; + } + else + { + $support_gd_avif=false; + } + + if(CompressX_Image_Method::is_support_imagick_avif()) + { + $support_imagick_avif=true; + } + else + { + $support_imagick_avif=false; + } + + wp_localize_script(COMPRESSX_SLUG, 'compressx_alert', + array('imagick_avif' => $imagick_avif, + 'support_gd_webp'=>$support_gd_webp, + 'support_imagick_webp'=>$support_imagick_webp, + 'support_gd_avif'=>$support_gd_avif, + 'support_imagick_avif'=>$support_imagick_avif, + ) + ); + wp_enqueue_script('compressx-jquery-event-move', COMPRESSX_URL . '/includes/display/js/twentytwenty/jquery.event.move.js', array('jquery'), COMPRESSX_VERSION, $arg); + wp_enqueue_script('compressx-twentytwenty', COMPRESSX_URL . '/includes/display/js/twentytwenty/jquery.twentytwenty.js', array('jquery', 'compressx-jquery-event-move'), COMPRESSX_VERSION, $arg); + + wp_enqueue_script(COMPRESSX_SLUG.'_image_optimization', COMPRESSX_URL . '/includes/display_v2/js/compressx_image_optimization.js', array('jquery'), COMPRESSX_VERSION, $arg); + wp_localize_script( + COMPRESSX_SLUG . '_image_optimization', + 'compressx_image_optimization_i18n', + array( + 'enable_webp_confirm' => __( 'Are you sure to enable WebP as output format? This will convert your images to WebP format.', 'compressx' ), + 'disable_webp_confirm' => __( 'Are you sure to disable WebP as output format?', 'compressx' ), + 'imagick6_avif_warning' => __( 'We detect that you use ImageMagick 6.x, this version has a known bug that can cause AVIF conversion timeout. Enabling AVIF conversion with this version is not recommended. Are you sure you wish to proceed?', 'compressx' ), + 'enable_avif_confirm' => __( 'Are you sure to enable AVIF as output format? This will convert your images to AVIF format.', 'compressx' ), + 'disable_avif_confirm' => __( 'Are you sure to disable AVIF as output format?', 'compressx' ), + 'supported' => __( 'Supported', 'compressx' ), + 'unsupported' => __( 'Unsupported', 'compressx' ), + 'failed_save' => __( 'Failed to save settings.', 'compressx' ), + 'save_error' => __( 'An error occurred while saving settings.', 'compressx' ), + ) + ); + wp_enqueue_script(COMPRESSX_SLUG.'_comparison', COMPRESSX_URL . '/includes/display_v2/js/compressx_image_comparison.js', array('jquery'), COMPRESSX_VERSION, $arg); + + wp_enqueue_script(COMPRESSX_SLUG.'_bulk', COMPRESSX_URL . '/includes/display_v2/js/compressx_bulk.js', array('jquery'), COMPRESSX_VERSION, $arg); + wp_localize_script( + COMPRESSX_SLUG . '_bulk', + 'compressx_bulk_i18n', + array( + 'cancel_confirm' => __( 'Are you sure to cancel this progressing?', 'compressx' ), + 'pause_confirm' => __( 'Are you sure to pause this progressing?', 'compressx' ), + 'delete_log_confirm' => __( 'Are you sure you want to delete this log file?', 'compressx' ), + 'leave_page_confirm' => __( 'Are you sure you want to leave this page?', 'compressx' ), + 'optimization_success' => __( 'Optimization Success', 'compressx' ), + ) + ); + wp_enqueue_script('compressx-chart', COMPRESSX_URL . '/includes/display_v2/js/chart.umd.min.js', array('jquery'), COMPRESSX_VERSION, $arg); + + + } + + $settings_screen_id='compressx_page_settings-compressx'; + $settings_screen_id=apply_filters('compressx_get_screen_id',$settings_screen_id); + if(get_current_screen()->id==$settings_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + + $upload_dir = wp_upload_dir(); + $path = $upload_dir['basedir']; + $path = str_replace('\\','/',$path); + $uploads_path = $path.'/'; + + $path = WP_CONTENT_DIR; + $path = str_replace('\\','/',$path); + $custom_root_path = $path.'/'; + + wp_localize_script(COMPRESSX_SLUG, 'compressx_uploads_root', array('path' => $uploads_path,'custom_path'=>$custom_root_path)); + wp_enqueue_script(COMPRESSX_SLUG.'_setting', COMPRESSX_URL . '/includes/display_v2/js/compressx_setting.js', array('jquery'), COMPRESSX_VERSION, $arg); + wp_enqueue_script(COMPRESSX_SLUG.'_custom_bulk', COMPRESSX_URL . '/includes/display/js/compressx_custom_bulk.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + + $cdn_screen_id='compressx_page_cdn-compressx'; + $cdn_screen_id=apply_filters('compressx_get_screen_id',$cdn_screen_id); + if(get_current_screen()->id==$cdn_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + + wp_enqueue_script(COMPRESSX_SLUG.'_cdn', COMPRESSX_URL . '/includes/display_v2/js/compressx_cdn.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + + $logs_screen_id='compressx_page_info-compressx'; + $logs_screen_id=apply_filters('compressx_get_screen_id',$logs_screen_id); + if(get_current_screen()->id==$logs_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + + wp_enqueue_script(COMPRESSX_SLUG.'_logs', COMPRESSX_URL . '/includes/display_v2/js/compressx_log.js', array('jquery'), COMPRESSX_VERSION, $arg); + } + + $media_replace_id='media_page_media-replace-compressx'; + if(get_current_screen()->id==$media_replace_id) + { + if (array_key_exists("attachment_id", $_GET) && intval($_GET["attachment_id"]) > 0) + { + $attachment_id = intval($_GET["attachment_id"]); + } + else + { + $attachment_id=0; + } + + $mime_type=get_post_mime_type($attachment_id); + $file = get_attached_file($attachment_id); + $ft = wp_check_filetype($file); + $ext = !empty($ft['ext']) ? $ft['ext'] : ''; + $type = $ext ? strtoupper($ext) : '-'; + + $url=admin_url("post.php?post=$attachment_id&action=edit"); + wp_localize_script('CompressX', 'compressx_media_replace', array('redirect_url' => $url,'type'=>$type)); + + $arg=array(); + $arg['in_footer']=true; + wp_enqueue_script('CompressX_media_replace', COMPRESSX_URL . '/includes/display_v2/js/compressx_media-replace.js', array('jquery'), COMPRESSX_VERSION, $arg); + return; + } + + /* + $info_screen_id='compressx_page_info-compressx'; + $info_screen_id=apply_filters('compressx_get_screen_id',$info_screen_id); + if(get_current_screen()->id==$info_screen_id) + { + $arg=array(); + $arg['in_footer']=true; + wp_enqueue_script(COMPRESSX_SLUG.'_systeminfo', COMPRESSX_URL . '/includes/display/js/compressx_system_info.js', array('jquery'), COMPRESSX_VERSION, $arg); + }*/ + } + + public function add_plugin_network_admin_menu() + { + if(apply_filters('compressx_support_mu',false)) + { + return; + } + $menu['page_title']= 'CompressX'; + $menu['menu_title']= 'CompressX'; + $menu['capability']='manage_options'; + $menu['menu_slug']=COMPRESSX_SLUG; + $menu['function']=array($this, 'mu_display'); + $menu['icon_url']='dashicons-images-alt2'; + $menu['position']=100; + + add_menu_page( $menu['page_title'],$menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['function'], $menu['icon_url'], $menu['position']); + } + + public function add_plugin_admin_menu() + { + $menu['page_title']= 'CompressX'; + $menu['menu_title']= 'CompressX'; + $menu['capability']='manage_options'; + $menu['menu_slug']=COMPRESSX_SLUG; + $menu['function']=array($this->dashboard, 'display'); + $menu['icon_url']='dashicons-images-alt2'; + $menu['position']=100; + $menu = apply_filters('compressx_get_main_admin_menus', $menu); + + add_menu_page( $menu['page_title'],$menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['function'], $menu['icon_url'], $menu['position']); + + $submenu['parent_slug']=COMPRESSX_SLUG; + $submenu['page_title']="Settings"; + $submenu['menu_title']="Settings"; + $submenu['capability']="manage_options"; + $submenu['index']=1; + $submenu['menu_slug']=COMPRESSX_SLUG; + $submenu['function']=array($this->dashboard, 'display'); + + $submenus[ $submenu['menu_slug']]=$submenu; + + if(apply_filters('compressx_current_user_can',true,'compressx-can-use-cdn')) + { + $submenu['parent_slug']=COMPRESSX_SLUG; + $submenu['page_title']="CDN Integration"; + $submenu['menu_title']="CDN Integration"; + $submenu['capability']="manage_options"; + $submenu['menu_slug']="cdn-compressx"; + $submenu['index']=3; + $submenu['function']=array($this->cdn, 'display'); + + $submenus[$submenu['menu_slug']]=$submenu; + } + + if(apply_filters('compressx_current_user_can',true,'compressx-can-use-logs')) + { + $submenu['parent_slug']=COMPRESSX_SLUG; + $submenu['page_title']="Logs"; + $submenu['menu_title']="Logs"; + if(apply_filters('compressx_current_user_has',false,'compressx-can-use-logs')) + { + $submenu['capability']="compressx-can-use-logs"; + } + else + { + $submenu['capability']="manage_options"; + } + $submenu['menu_slug']="logs-compressx"; + $submenu['index']=19; + $submenu['function']=array($this->log, 'display'); + + $submenus[$submenu['menu_slug']]=$submenu; + } + + if(apply_filters('compressx_current_user_can',true,'compressx-can-use-system-info')) + { + $submenu['parent_slug']=COMPRESSX_SLUG; + $submenu['page_title']="System Information"; + $submenu['menu_title']="System Information"; + if(apply_filters('compressx_current_user_has',false,'compressx-can-use-system-info')) + { + $submenu['capability']="compressx-can-use-system-info"; + } + else + { + $submenu['capability']="manage_options"; + } + $submenu['menu_slug']="info-compressx"; + $submenu['index']=20; + $submenu['function']=array($this->system_info, 'display'); + + $submenus[$submenu['menu_slug']]=$submenu; + } + + $submenu['parent_slug']=COMPRESSX_SLUG; + $submenu['page_title']="Addons"; + $submenu['menu_title']="Addons"; + $submenu['capability']="manage_options"; + $submenu['menu_slug']="addons-compressx"; + $submenu['index']=21; + $submenu['function']=array($this->addons, 'display'); + + $submenus[$submenu['menu_slug']]=$submenu; + + $submenus = apply_filters('compressx_get_admin_menus', $submenus); + usort($submenus, function ($a, $b) + { + if ($a['index'] == $b['index']) + return 0; + + if ($a['index'] > $b['index']) + return 1; + else + return -1; + }); + + foreach ($submenus as $submenu) + { + add_submenu_page( + $submenu['parent_slug'], + $submenu['page_title'], + $submenu['menu_title'], + $submenu['capability'], + $submenu['menu_slug'], + $submenu['function']); + } + } + + public function add_plugin_admin_menu_v2() + { + $menu['page_title']= 'CompressX'; + $menu['menu_title']= 'CompressX'; + $menu['capability']='manage_options'; + $menu['menu_slug']=COMPRESSX_SLUG; + $menu['function']=array($this->image_optimization, 'display'); + $menu['icon_url']='dashicons-images-alt2'; + $menu['position']=100; + $menu = apply_filters('compressx_get_main_admin_menus', $menu); + + add_menu_page( $menu['page_title'],$menu['menu_title'], $menu['capability'], $menu['menu_slug'], $menu['function'], $menu['icon_url'], $menu['position']); + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-convert')) + { + $submenu['parent_slug'] = COMPRESSX_SLUG; + $submenu['page_title'] = "Image Optimization"; + $submenu['menu_title'] = "Image Optimization"; + if (apply_filters('compressx_current_user_has', false, 'compressx-can-convert')) + { + $submenu['capability'] = "compressx-can-convert"; + } else { + $submenu['capability'] = "manage_options"; + } + $submenu['index'] = 1; + $submenu['menu_slug'] = COMPRESSX_SLUG; + $submenu['function'] = array($this->image_optimization, 'display'); + $submenus[$submenu['menu_slug']] = $submenu; + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-use-general-settings') || apply_filters('compressx_current_user_can', true, 'compressx-can-use-thumbnail-settings')) { + $submenu['parent_slug'] = COMPRESSX_SLUG; + $submenu['page_title'] = "Global Settings"; + $submenu['menu_title'] = "Settings"; + $submenu['capability'] = "manage_options"; + $submenu['menu_slug'] = "settings-compressx"; + $submenu['index'] = 2; + $submenu['function'] = array($this->settings, 'display'); + + $submenus[$submenu['menu_slug']] = $submenu; + } + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-use-cdn')) { + $submenu['parent_slug'] = COMPRESSX_SLUG; + $submenu['page_title'] = "CDN Support"; + $submenu['menu_title'] = "CDN Support"; + if (apply_filters('compressx_current_user_has', false, 'compressx-can-use-cdn')) { + $submenu['capability'] = "compressx-can-use-cdn"; + } else { + $submenu['capability'] = "manage_options"; + } + $submenu['menu_slug'] = "cdn-compressx"; + $submenu['index'] = 3; + $submenu['function'] = array($this->cdn, 'display'); + + $submenus[$submenu['menu_slug']] = $submenu; + } + + + if (apply_filters('compressx_current_user_can', true, 'compressx-can-use-system-info')) { + $submenu['parent_slug'] = COMPRESSX_SLUG; + $submenu['page_title'] = "Logs & System Information"; + $submenu['menu_title'] = "Logs & System Info"; + if (apply_filters('compressx_current_user_has', false, 'compressx-can-use-system-info')) { + $submenu['capability'] = "compressx-can-use-system-info"; + } else { + $submenu['capability'] = "manage_options"; + } + $submenu['menu_slug'] = "info-compressx"; + $submenu['index'] = 19; + $submenu['function'] = array($this->system_info, 'display'); + + $submenus[$submenu['menu_slug']] = $submenu; + } + + $submenu['parent_slug']=COMPRESSX_SLUG; + $submenu['page_title']="Addons"; + $submenu['menu_title']="Addons"; + $submenu['capability']="manage_options"; + $submenu['menu_slug']="addons-compressx"; + $submenu['index']=21; + $submenu['function']=array($this->addons, 'display'); + $submenus[$submenu['menu_slug']] = $submenu; + + $submenus = apply_filters('compressx_get_admin_menus', $submenus); + usort($submenus, function ($a, $b) + { + if ($a['index'] == $b['index']) + return 0; + + if ($a['index'] > $b['index']) + return 1; + else + return -1; + }); + + foreach ($submenus as $submenu) + { + add_submenu_page( + $submenu['parent_slug'], + $submenu['page_title'], + $submenu['menu_title'], + $submenu['capability'], + $submenu['menu_slug'], + $submenu['function']); + } + } + + public function add_media_replace_menu() + { + $has=false; + if(apply_filters('compressx_pro_media_replace',$has)) + { + return; + } + $submenu['parent_slug']='upload.php'; + $submenu['page_title']="Replace Media"; + $submenu['menu_title']="Replace Media"; + $submenu['capability']="upload_files"; + $submenu['menu_slug']="media-replace-compressx"; + $submenu['function']=array($this->media_replace, 'display'); + + add_submenu_page( $submenu['parent_slug'],$submenu['page_title'], $submenu['menu_title'], $submenu['capability'], $submenu['menu_slug'], $submenu['function']); + } + + public function hide_media_replace_menu($submenu_file) + { + $has=false; + if(apply_filters('compressx_pro_media_replace',$has)) + { + return $submenu_file; + } + + global $plugin_page; + // Select another submenu item to highlight (optional). + if ( $plugin_page && $plugin_page == 'media-replace-compressx' ) + { + $submenu_file = 'upload.php'; + } + + // Hide the submenu. + + remove_submenu_page( 'upload.php', 'media-replace-compressx' ); + + return $submenu_file; + } + + public function mu_display() + { + ?> +
          +
          + output_nav(); + $this->output_header(); + ?> +
          +
          +
          +

          + Currently, AVIF, WebP Converter Plugin (CompressX.io) does not support WordPress Multisite. +

          +
          +
          +
          +
          +
          + + + response[COMPRESSX_NAME])) + { + $plugin_data = $plugins->response[COMPRESSX_NAME]; + $latest_version = $plugin_data->new_version; + if(version_compare($latest_version,COMPRESSX_VERSION,'>')) + { + return true; + } + } + } + + + return false; + } + + public function latest_version() + { + $plugins = get_site_transient('update_plugins'); + if (isset($plugins->response[COMPRESSX_NAME])) + { + $plugin_data = $plugins->response[COMPRESSX_NAME]; + return $plugin_data->new_version; + } + else + { + return ''; + } + } + + public function output_header() + { + ?> +
          +
          + +
          +
          + +
          +
          +
          If you like our plugin, a + + + + + will help us a lot, thanks in advance! +
          +
          +
          + true, + 'review_url' => 'https://wordpress.org/support/plugin/compressx/reviews', + 'review_text' => __('Enjoying CompressX? Please', 'compressx') . + '' . + __('leave us a', 'compressx') . ' ' . + '★★★★★ ' . + __('review', 'compressx') . + ' — ' . + __('it helps a lot!', 'compressx'), + 'container_class' => 'compressx-v2-border-t compressx-v2-pt-4 compressx-v2-text-center', + 'text_class' => 'compressx-v2-text-sm compressx-v2-text-gray-600' + ); + + $args=$defaults; + + if (!$args['show_review_link']) + { + return; + } + ?> + +
          +

          + +

          +
          + +
          +
          + output_nav(); + $this->output_header(); + $this->output_logs(); + $this->output_footer(); + ?> +
          +
          + +
          +
          +
          +
          +
          + + +
          +
          + get_log_list(); + //$log_list=new CompressX_Log_List(); + //$log_list->set_log_list($list); + //$log_list->prepare_items(); + //$log_list->display(); + ?> +
          +
          +
          +
          +
          +
          + + GetSaveLogFolder(); + $files=array(); + $handler=opendir($dir); + $regex='#^compressx.*_log.txt#'; + if($handler!==false) + { + while(($filename=readdir($handler))!==false) + { + if($filename != "." && $filename != "..") + { + if(is_dir($dir.$filename)) + { + continue; + }else{ + if(preg_match($regex,$filename)) + { + $files[$filename] = $dir.$filename; + } + } + } + } + if($handler) + @closedir($handler); + } + + foreach ($files as $file) + { + $handle = @fopen($file, "r"); + if ($handle) + { + $log_file['file_name']=basename($file); + if(preg_match('/compressx-(.*?)_/', basename($file), $matches)) + { + $id= $matches[0]; + $id=substr($id,0,strlen($id)-1); + $log_file['id']=$id; + } + $log_file['path']=$file; + $log_file['size']=filesize($file); + $log_file['name']=basename($file); + $log_file['time']=filemtime($file); + + $offset=get_option('gmt_offset'); + $localtime = $log_file['time'] + $offset * 60 * 60; + $log_file['date']=gmdate('M-d-y H:i',$localtime); + + $line = fgets($handle); + if($line!==false) + { + $pos=strpos($line,'Log created: '); + if($pos!==false) + { + $log_file['time']=substr ($line,$pos+strlen('Log created: ')); + } + } + + fclose($handle); + $log_list[basename($file)]=$log_file; + } + } + + $log_list =$this->sort_list($log_list); + + return $log_list; + } + + public function get_log_list_ex($start_date,$start_time,$end_date,$end_time) + { + if(empty($start_date)) + { + $start=0; + } + else if(empty($start_time)) + { + $start=strtotime($start_date); + } + else + { + $start=strtotime($start_date.' '.$start_time); + } + + if($start>0) + { + $offset=get_option('gmt_offset'); + $start = $start - $offset * 60 * 60; + } + + if(empty($end_date)) + { + $end=0; + } + else if(empty($end_time)) + { + $end=strtotime($end_date); + } + else + { + $end=strtotime($end_date.' '.$end_time); + } + + if($end>0) + { + $offset=get_option('gmt_offset'); + $end = $end - $offset * 60 * 60; + } + + + $log_list=array(); + $log=new CompressX_Log(); + $dir=$log->GetSaveLogFolder(); + $files=array(); + $handler=opendir($dir); + $regex='#^compressx.*_log.txt#'; + if($handler!==false) + { + while(($filename=readdir($handler))!==false) + { + if($filename != "." && $filename != "..") + { + if(is_dir($dir.$filename)) + { + continue; + }else{ + if(preg_match($regex,$filename)) + { + $files[$filename] = $dir.$filename; + } + } + } + } + if($handler) + @closedir($handler); + } + + foreach ($files as $file) + { + $handle = @fopen($file, "r"); + if ($handle) + { + $log_file['file_name']=basename($file); + if(preg_match('/compressx-(.*?)_/', basename($file), $matches)) + { + $id= $matches[0]; + $id=substr($id,0,strlen($id)-1); + $log_file['id']=$id; + } + $log_file['path']=$file; + $log_file['size']=filesize($file); + $log_file['name']=basename($file); + $log_file['time']=preg_replace('/[^0-9]/', '', basename($file)); + + $offset=get_option('gmt_offset'); + $localtime = strtotime($log_file['time']) + $offset * 60 * 60; + $log_file['date']=gmdate('M-d-y H:i',$localtime); + + $line = fgets($handle); + if($line!==false) + { + $pos=strpos($line,'Log created: '); + if($pos!==false) + { + $log_file['time']=substr ($line,$pos+strlen('Log created: ')); + } + } + + fclose($handle); + + if($start>0&&$end>0) + { + if($localtime>=$start&&$localtime<=$end) + { + $log_list[basename($file)]=$log_file; + } + } + else if($start>0) + { + if($localtime>=$start) + { + $log_list[basename($file)]=$log_file; + } + } + else if($end>0) + { + if($localtime<=$end) + { + $log_list[basename($file)]=$log_file; + } + } + else + { + $log_list[basename($file)]=$log_file; + } + } + } + + $log_list =$this->sort_list($log_list); + + return $log_list; + } + + public function sort_list($list) + { + uasort ($list,function($a, $b) + { + if($a['time']>$b['time']) + { + return -1; + } + else if($a['time']===$b['time']) + { + return 0; + } + else + { + return 1; + } + }); + + return $list; + } + + public function get_logs_list() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + if(isset($_POST['start_date'])) + { + $start_date=sanitize_key($_POST['start_date']); + } + else + { + $start_date=''; + } + + if(isset($_POST['start_time'])) + { + $start_time=sanitize_key($_POST['start_time']); + } + else + { + $start_time=''; + } + + if(isset($_POST['end_date'])) + { + $end_date=sanitize_key($_POST['end_date']); + } + else + { + $end_date=''; + } + + if(isset($_POST['end_time'])) + { + $end_time=sanitize_key($_POST['end_time']); + } + else + { + $end_time=''; + } + + if(isset($_POST['page'])) + { + $page=sanitize_key($_POST['page']); + } + else + { + $page=0; + } + + $list=$this->get_log_list_ex($start_date,$start_time,$end_date,$end_time); + $log_list=new CompressX_Log_List(); + $log_list->set_log_list($list,$page); + $log_list->prepare_items(); + ob_start(); + $log_list->display(); + $json['result'] = 'success'; + $json['html'] = ob_get_clean(); + + echo wp_json_encode($json); + die(); + } + + public function open_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try + { + if(!isset($_POST['filename'])) + { + die(); + } + + $file_name=sanitize_text_field($_POST['filename']); + $loglist=$this->get_log_list(); + if(!empty($loglist)) + { + if(isset($loglist[$file_name])) + { + $log=$loglist[$file_name]; + } + else + { + $json['result'] = 'failed'; + $json['error'] =__('The log not found ','compressx').$file_name; + echo wp_json_encode($json); + die(); + } + + $path=$log['path']; + if (!file_exists($path)) + { + $json['result'] = 'failed'; + $json['error'] = __('The log not found ','compressx').$file_name; + echo wp_json_encode($json); + die(); + } + + $file = fopen($path, 'r'); + + if (!$file) { + $json['result'] = 'failed'; + $json['error'] = __('Unable to open the log file.','compressx'); + echo wp_json_encode($json); + die(); + } + + $offset=get_option('gmt_offset'); + $localtime = strtotime($log['time']) + $offset * 60 * 60; + $buffer = 'Open log file created:'.gmdate('Y-m-d',$localtime).' '.PHP_EOL; + while (!feof($file)) { + $buffer .= fread($file, 1024); + } + fclose($file); + + $json['result'] = 'success'; + $json['html'] = $buffer; + echo wp_json_encode($json); + die(); + } + else + { + $json['result'] = 'failed'; + $json['error'] = 'The log not found.'; + echo wp_json_encode($json); + die(); + } + } + catch (Exception $error) + { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + } + die(); + } + + public function download_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + $admin_url = admin_url(); + + try + { + if (isset($_REQUEST['log'])) + { + $log = sanitize_text_field($_REQUEST['log']); + $log = basename($log); + $loglist=$this->get_log_list(); + + if(isset($loglist[$log])) + { + $log=$loglist[$log]; + } + else + { + $message= 'Log does not exist. It might have been deleted or lost during a website migration.'; + echo esc_html($message); + die(); + } + + $path=$log['path']; + + if (!file_exists($path)) + { + $message= 'Log does not exist. It might have been deleted or lost during a website migration.'; + echo esc_html($message); + die(); + } + + if (file_exists($path)) + { + if (session_id()) + session_write_close(); + + $size = filesize($path); + if (!headers_sent()) + { + header('Content-Description: File Transfer'); + header('Content-Type: text'); + header('Content-Disposition: attachment; filename="' . basename($path) . '"'); + header('Cache-Control: must-revalidate'); + header('Content-Length: ' . $size); + header('Content-Transfer-Encoding: binary'); + } + + ob_end_clean(); + readfile($path); + exit; + } + else + { + echo esc_html(' file not found.'); + die(); + } + + } else { + $message = 'Reading the log failed. Please try again.'; + echo esc_html($message); + die(); + } + } + catch (Exception $error) + { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + echo esc_html($message); + die(); + } + } + + public function delete_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try + { + if(!isset($_POST['filename'])) + { + die(); + } + + $file_name=sanitize_text_field($_POST['filename']); + $loglist=$this->get_log_list(); + if(!empty($loglist)) + { + if(isset($loglist[$file_name])) + { + $log=$loglist[$file_name]; + } + else + { + $json['result'] = 'failed'; + $json['error'] = __('The log not found ','compressx').$file_name; + echo wp_json_encode($json); + die(); + } + + $path=$log['path']; + @wp_delete_file($path); + + $list=$this->get_log_list(); + $log_list=new CompressX_Log_List(); + $log_list->set_log_list($list); + $log_list->prepare_items(); + ob_start(); + $log_list->display(); + $json['result'] = 'success'; + $json['html'] = ob_get_clean(); + + echo wp_json_encode($json); + die(); + } + else + { + $json['result'] = 'failed'; + $json['error'] = __('The log not found ','compressx'); + echo wp_json_encode($json); + die(); + } + } + catch (Exception $error) + { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + } + die(); + } + + public function delete_all_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try + { + $loglist=$this->get_log_list(); + if(!empty($loglist)) + { + foreach ($loglist as $log) + { + $path=$log['path']; + @wp_delete_file($path); + } + + $list=$this->get_log_list(); + $log_list=new CompressX_Log_List(); + $log_list->set_log_list($list); + $log_list->prepare_items(); + ob_start(); + $log_list->display(); + $json['result'] = 'success'; + $json['html'] = ob_get_clean(); + + echo wp_json_encode($json); + die(); + } + else + { + $json['result'] = 'failed'; + $json['error'] = __('The log not found ','compressx'); + echo wp_json_encode($json); + die(); + } + } + catch (Exception $error) + { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + } + die(); + } + */ + + +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/class-compressx-system-info.php b/wp-content/plugins/compressx/includes/display/class-compressx-system-info.php new file mode 100644 index 0000000..3ff830d --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/class-compressx-system-info.php @@ -0,0 +1,616 @@ + +
          +
          + output_nav(); + $this->output_header(); + $this->output_debug(); + $this->output_footer(); + ?> +
          +
          + +
          +
          +
          +
          +
          + +
          +
          + +
          +
          + + + + + + + +
          +
          + +
          +
          + + + +
          +
          +
          + +
          +
          + +
          +
          +
          +
          +
          +
          +
          +
          + output_debug_info(); + ?> +
          +
          +
          + +
          +
          + : +
          +
          + + + + + + + + get_debug_info(); + if(!empty($debug_info)) + { + foreach ($debug_info as $key=>$value) + { + if($key=='setting') + continue; + + $website_value=''; + if (is_array($value)) + { + foreach ($value as $arr_value) + { + if (empty($website_value)) + { + $website_value = $website_value . $arr_value; + } else { + $website_value = $website_value . ', ' . $arr_value; + } + } + } + else + { + if($value === true || $value === false) + { + if($value === true) { + $website_value = 'true'; + } + else{ + $website_value = 'false'; + } + } + else { + $website_value = $value; + } + } + ?> + + + + + + +
          +
          +
          + get_domain(); + $debug_info['Server name']=$_SERVER['SERVER_NAME']; + $debug_info['Web Server'] = sanitize_text_field($_SERVER["SERVER_SOFTWARE"]); + $debug_info['CompressX version'] = COMPRESSX_VERSION; + $debug_info['Wordpress version'] = $wp_version; + + $debug_info['PHP version'] = phpversion(); + + if( !function_exists( 'gd_info' )) + { + $debug_info['GD extension']=__("GD extension is not installed or enabled.",'compressx'); + } + else + { + $debug_info['GD extension']=__("The GD extension has been properly installed.",'compressx'); + + $info=gd_info(); + $debug_info['GD Version']=isset($info['GD Version'])?$info['GD Version']:''; + $debug_info['GD WebP Support']=isset($info['WebP Support'])?$info['WebP Support']:false; + $debug_info['GD AVIF Support']=isset($info['AVIF Support'])?$info['AVIF Support']:false; + } + + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + $debug_info['Imagick extension']=__("The imagick extension has been properly installed.",'compressx'); + $debug_info['Imagick Version']=\Imagick::getVersion(); + + if( \Imagick::queryformats( 'WEBP' )) + { + $debug_info['Imagick WebP Support']=true; + } + else + { + $debug_info['Imagick WebP Support']=false; + } + + if( \Imagick::queryformats( 'AVIF' )) + { + $debug_info['Imagick AVIF Support']=true; + } + else + { + $debug_info['Imagick AVIF Support']=false; + } + + } + else + { + $debug_info['Imagick extension']=__("Imagick extension is not installed or enabled.",'compressx'); + } + + $debug_info['active_plugins'] = get_option('active_plugins'); + $debug_info['active_theme'] = wp_get_theme()->get_template(); + + $debug_info['memory_current'] = size_format(memory_get_usage(),2); + $debug_info['memory_peak'] = size_format(memory_get_peak_usage(),2); + $debug_info['memory_limit'] = ini_get('memory_limit'); + + include_once COMPRESSX_DIR . '/includes/class-compressx-rewrite-checker.php'; + $test=new CompressX_Rewrite_Checker(); + $result=$test->test_ex(); + if($result['result']=='success') + { + $debug_info['Rewrite rules test'] = 'success'; + } + else + { + $debug_info['Rewrite rules test'] = $result['error']; + } + + $options=get_option('compressx_general_settings',array()); + $debug_info['setting']=$options; + + $quality_options=get_option('compressx_quality',array()); + $converter_method=get_option('compressx_converter_method',false); + $output_format_webp=get_option('compressx_output_format_webp',1); + $output_format_avif=get_option('compressx_output_format_avif',1); + $debug_info['setting']['quality']=$quality_options; + $debug_info['setting']['output_format_webp']=$output_format_webp; + $debug_info['setting']['output_format_avif']=$output_format_avif; + $debug_info['setting']['converter_method']=$converter_method; + $debug_info['setting']=wp_json_encode($debug_info['setting']); + return $debug_info; + } + + public function get_domain() + { + global $wpdb; + $home_url = home_url(); + $db_home_url = home_url(); + $home_url_sql = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->options WHERE option_name = %s", 'home' ) ); + foreach ( $home_url_sql as $home ) + { + $db_home_url = untrailingslashit($home->option_value); + } + + if($home_url === $db_home_url) + { + $domain = $home_url; + } + else + { + $domain = $db_home_url; + } + + return strtolower($domain); + } + + public function output_footer() + { + do_action('compressx_output_footer'); + } + + public function get_website_info() + { + try + { + $version = COMPRESSX_VERSION; + $ret['result'] = 'success'; + $ret['data']['version'] = $version; + $ret['data']['home_url'] = get_home_url(); + $ret['data']['abspath'] = ABSPATH; + $ret['data']['wp_content_path'] = WP_CONTENT_DIR; + $ret['data']['wp_plugin_path'] = WP_PLUGIN_DIR; + $ret['data']['active_plugins'] = get_option('active_plugins'); + + global $wp_version; + $ret['wp_version'] = $wp_version; + if (is_multisite()) { + $ret['data']['multisite'] = 'enable'; + } else { + $ret['data']['multisite'] = 'disable'; + } + $ret['data']['web_server'] = sanitize_text_field($_SERVER["SERVER_SOFTWARE"]); + $ret['data']['php_version'] = phpversion(); + global $wpdb; + $ret['data']['mysql_version'] = $wpdb->db_version(); + if (defined('WP_DEBUG')) { + $ret['data']['wp_debug'] = WP_DEBUG; + } else { + $ret['wp_debug'] = false; + } + $ret['data']['language'] = get_bloginfo('language'); + $ret['data']['upload_max_filesize'] = ini_get("upload_max_filesize"); + + $current_offset = get_option( 'gmt_offset' ); + $timezone = get_option( 'timezone_string' ); + + if ( false !== strpos( $timezone, 'Etc/GMT' ) ) { + $timezone = ''; + } + + if ( empty( $timezone ) ) { + if ( 0 == $current_offset ) { + $timezone = 'UTC+0'; + } elseif ( $current_offset < 0 ) { + $timezone = 'UTC' . $current_offset; + } else { + $timezone = 'UTC+' . $current_offset; + } + } + + $ret['data']['max_execution_time'] = ini_get("max_execution_time"); + $ret['data']['max_input_vars'] = ini_get("max_input_vars"); + $ret['data']['max_input_vars'] = ini_get("max_input_vars"); + $ret['data']['timezone'] = $timezone;//date_default_timezone_get(); + if(function_exists('php_uname')) + { + $ret['data']['OS'] = php_uname(); + } + $ret['data']['memory_current'] = size_format(memory_get_usage(),2); + $ret['data']['memory_peak'] = size_format(memory_get_peak_usage(),2); + $ret['data']['memory_limit'] = ini_get('memory_limit'); + $ret['data']['post_max_size'] = ini_get('post_max_size'); + $ret['data']['allow_url_fopen'] = ini_get('allow_url_fopen'); + $ret['data']['safe_mode'] = ini_get('safe_mode'); + $ret['data']['pcre.backtrack_limit'] = ini_get('pcre.backtrack_limit'); + $extensions = get_loaded_extensions(); + if (array_search('exif', $extensions)) { + $ret['data']['exif'] = 'support'; + } else { + $ret['data']['exif'] = 'not support'; + } + + if (array_search('xml', $extensions)) { + $ret['data']['xml'] = 'support'; + } else { + $ret['data']['xml'] = 'not support'; + } + + if (array_search('suhosin', $extensions)) { + $ret['data']['suhosin'] = 'support'; + } else { + $ret['data']['suhosin'] = 'not support'; + } + + if (array_search('gd', $extensions)) { + $ret['data']['IPTC'] = 'support'; + } else { + $ret['data']['IPTC'] = 'not support'; + } + + $ret['data']['extensions'] = $extensions; + + if (function_exists('apache_get_modules')) { + $ret['data']['apache_modules'] = apache_get_modules(); + } else { + $ret['data']['apache_modules'] = array(); + } + + if (array_search('pdo_mysql', $extensions)) + { + $ret['data']['pdo_mysql'] = 'support'; + } else { + $ret['data']['pdo_mysql'] = 'not support'; + } + + $ret['data']['mysql_mode'] = ''; + global $wpdb; + $result = $wpdb->get_results('SELECT @@SESSION.sql_mode', ARRAY_A); + foreach ($result as $row) + { + $ret['data']['mysql_mode'] = $row["@@SESSION.sql_mode"]; + } + + if (!class_exists('PclZip')) include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php'); + if (!class_exists('PclZip')) + { + $ret['data']['PclZip'] = 'not support'; + } else { + $ret['data']['PclZip'] = 'support'; + } + + if (is_multisite() && !defined('MULTISITE')) { + $prefix = $wpdb->base_prefix; + } else { + $prefix = $wpdb->get_blog_prefix(0); + } + + $ret['data']['wp_prefix'] = $prefix; + + $sapi_type = php_sapi_name(); + + if ($sapi_type == 'cgi-fcgi' || $sapi_type == ' fpm-fcgi') { + $ret['data']['fast_cgi'] = 'On'; + } else { + $ret['data']['fast_cgi'] = 'Off'; + } + } + catch (Exception $error) { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + return array('result'=>'failed','error'=>$message); + } + return $ret; + } + + public function create_debug_package() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-system-info'); + + try + { + if (!class_exists('PclZip')) + include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php'); + + $backup_path="compressx"; + + $path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_debug.zip'; + if(!is_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path)) + { + wp_mkdir_p(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path); + @fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path.DIRECTORY_SEPARATOR.'index.html', 'x'); + $tempfile=@fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path.DIRECTORY_SEPARATOR.'.htaccess', 'x'); + if($tempfile) + { + $text="deny from all"; + fwrite($tempfile,$text ); + fclose($tempfile); + } + } + + if (file_exists($path)) { + @wp_delete_file($path); + } + + + $archive = new PclZip($path); + + $server_info = wp_json_encode($this->get_debug_info()); + $server_file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_server_info.json'; + if (file_exists($server_file_path)) { + @wp_delete_file($server_file_path); + } + $server_file = fopen($server_file_path, 'x'); + fclose($server_file); + file_put_contents($server_file_path, $server_info); + if (!$archive->add($server_file_path, PCLZIP_OPT_REMOVE_ALL_PATH)) + { + exit; + } + @wp_delete_file($server_file_path); + + $log=new CompressX_Log(); + $files=$log->get_logs(); + if(!empty($files)) + { + if(!$archive->add($files,PCLZIP_OPT_REMOVE_ALL_PATH)) + { + exit; + } + } + + if (session_id()) + session_write_close(); + + $size = filesize($path); + if (!headers_sent()) { + header('Content-Description: File Transfer'); + header('Content-Type: application/zip'); + header('Content-Disposition: attachment; filename="' . basename($path) . '"'); + header('Cache-Control: must-revalidate'); + header('Content-Length: ' . $size); + header('Content-Transfer-Encoding: binary'); + } + + + ob_end_clean(); + readfile($path); + @wp_delete_file($path); + } + catch (Exception $error) { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + die(); + } + exit; + } + + public function send_debug_info() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-system-info'); + + try + { + if (!isset($_POST['user_mail']) || empty($_POST['user_mail'])) + { + $ret['result'] = 'failed'; + $ret['error'] = __('User\'s email address is required.', 'compressx'); + } + else + { + $pattern = '/^[a-z0-9]+([._-][a-z0-9]+)*@([0-9a-z]+\.[a-z]{2,14}(\.[a-z]{2})?)$/i'; + if (!preg_match($pattern, $_POST['user_mail'])) + { + $ret['result'] = 'failed'; + $ret['error'] = __('Please enter a valid email address.', 'compressx'); + } + else + { + $user_mail=sanitize_email($_POST['user_mail']); + $comment=sanitize_text_field($_POST['comment']); + + $ret =$this->_send_debug_info($user_mail,$comment); + } + } + echo wp_json_encode($ret); + die(); + } + catch (Exception $error) + { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + die(); + } + } + + public function _send_debug_info($user_email,$comment) + { + $send_to = 'support@compressx.io'; + $subject = 'Debug Information'; + $body = '
          User\'s email: '.$user_email.'.
          '; + $body .= '
          Comment: '.$comment.'.
          '; + $headers = array('Content-Type: text/html; charset=UTF-8'); + + if (!class_exists('PclZip')) + include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php'); + + $backup_path="compressx"; + + $path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_debug.zip'; + if(!is_dir(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path)) + { + wp_mkdir_p(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path); + @fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path.DIRECTORY_SEPARATOR.'index.html', 'x'); + $tempfile=@fopen(WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$backup_path.DIRECTORY_SEPARATOR.'.htaccess', 'x'); + if($tempfile) + { + $text="deny from all"; + fwrite($tempfile,$text ); + fclose($tempfile); + } + } + + if (file_exists($path)) { + @wp_delete_file($path); + } + + $archive = new PclZip($path); + + $server_info = wp_json_encode($this->get_debug_info()); + $server_file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_server_info.json'; + if (file_exists($server_file_path)) + { + @wp_delete_file($server_file_path); + } + $server_file = fopen($server_file_path, 'x'); + fclose($server_file); + file_put_contents($server_file_path, $server_info); + $archive->add($server_file_path, PCLZIP_OPT_REMOVE_ALL_PATH); + @wp_delete_file($server_file_path); + + $log=new CompressX_Log(); + $files=$log->get_logs(); + if(!empty($files)) + { + $archive->add($files,PCLZIP_OPT_REMOVE_ALL_PATH); + } + + $attachments[] = $path; + + if(wp_mail( $send_to, $subject, $body,$headers,$attachments)===false) + { + $ret['result']='failed'; + $ret['error']=__('Unable to send email. Please check the configuration of email server.', 'compressx'); + } + else + { + $ret['result']='success'; + } + + @wp_delete_file($path); + return $ret; + } + */ +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/css/compressx-media.css b/wp-content/plugins/compressx/includes/display/css/compressx-media.css new file mode 100644 index 0000000..0fb99d4 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/css/compressx-media.css @@ -0,0 +1,56 @@ +.compressx-tooltip { + display:inline-block; + position:relative; + text-align:left; +} +/* tooltip - bottom */ +.compressx-bottom { + min-width:300px; + top:40px; + left:50%; + transform:translate(-50%, 0); + padding:10px 20px; + color:#444444; + background-color:#fff; + font-weight:normal; + font-size:13px; + border-radius:8px; + position:absolute; + z-index:99999999; + box-sizing:border-box; + box-shadow:0 1px 8px rgba(0,0,0,0.2); + visibility:hidden; opacity:0; transition:opacity 0.4s; +} +.compressx-dashicons-help a{ + color: #888; +} +.compressx-dashicons-help a:hover{ + color: #575757; +} +.compressx-dashicons-help:hover .compressx-bottom { + visibility:visible; opacity:1; +} +.compressx-dashicons-white:hover .compressx-bottom{ + visibility:visible; opacity:1; +} +.compressx-tooltip .compressx-bottom i { + position:absolute; + bottom:100%; + left:50%; + margin-left:-12px; + width:24px; + height:12px; + overflow:hidden; +} + +.compressx-tooltip .compressx-bottom i::after { + content:''; + position:absolute; + width:12px; + height:12px; + left:50%; + transform:translate(-50%,50%) rotate(45deg); + background-color:#fff; + box-shadow:0 1px 8px rgba(0,0,0,0.5); +} +/* tooltip - left */ \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/css/compressx-percentage-circle-style.css b/wp-content/plugins/compressx/includes/display/css/compressx-percentage-circle-style.css new file mode 100644 index 0000000..74b05bf --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/css/compressx-percentage-circle-style.css @@ -0,0 +1,879 @@ +/**************************************************************** + * + * CSS Percentage Circle + * Author: Andre Firchow + * +*****************************************************************/ +.rect-auto, .c100.p51 .slice, .c100.p52 .slice, .c100.p53 .slice, .c100.p54 .slice, .c100.p55 .slice, .c100.p56 .slice, .c100.p57 .slice, .c100.p58 .slice, .c100.p59 .slice, .c100.p60 .slice, .c100.p61 .slice, .c100.p62 .slice, .c100.p63 .slice, .c100.p64 .slice, .c100.p65 .slice, .c100.p66 .slice, .c100.p67 .slice, .c100.p68 .slice, .c100.p69 .slice, .c100.p70 .slice, .c100.p71 .slice, .c100.p72 .slice, .c100.p73 .slice, .c100.p74 .slice, .c100.p75 .slice, .c100.p76 .slice, .c100.p77 .slice, .c100.p78 .slice, .c100.p79 .slice, .c100.p80 .slice, .c100.p81 .slice, .c100.p82 .slice, .c100.p83 .slice, .c100.p84 .slice, .c100.p85 .slice, .c100.p86 .slice, .c100.p87 .slice, .c100.p88 .slice, .c100.p89 .slice, .c100.p90 .slice, .c100.p91 .slice, .c100.p92 .slice, .c100.p93 .slice, .c100.p94 .slice, .c100.p95 .slice, .c100.p96 .slice, .c100.p97 .slice, .c100.p98 .slice, .c100.p99 .slice, .c100.p100 .slice { + clip: rect(auto, auto, auto, auto); +} + +.pie, .c100 .bar, .c100.p51 .fill, .c100.p52 .fill, .c100.p53 .fill, .c100.p54 .fill, .c100.p55 .fill, .c100.p56 .fill, .c100.p57 .fill, .c100.p58 .fill, .c100.p59 .fill, .c100.p60 .fill, .c100.p61 .fill, .c100.p62 .fill, .c100.p63 .fill, .c100.p64 .fill, .c100.p65 .fill, .c100.p66 .fill, .c100.p67 .fill, .c100.p68 .fill, .c100.p69 .fill, .c100.p70 .fill, .c100.p71 .fill, .c100.p72 .fill, .c100.p73 .fill, .c100.p74 .fill, .c100.p75 .fill, .c100.p76 .fill, .c100.p77 .fill, .c100.p78 .fill, .c100.p79 .fill, .c100.p80 .fill, .c100.p81 .fill, .c100.p82 .fill, .c100.p83 .fill, .c100.p84 .fill, .c100.p85 .fill, .c100.p86 .fill, .c100.p87 .fill, .c100.p88 .fill, .c100.p89 .fill, .c100.p90 .fill, .c100.p91 .fill, .c100.p92 .fill, .c100.p93 .fill, .c100.p94 .fill, .c100.p95 .fill, .c100.p96 .fill, .c100.p97 .fill, .c100.p98 .fill, .c100.p99 .fill, .c100.p100 .fill { + position: absolute; + border: 0.08em solid #175cff; + width: 0.84em; + height: 0.84em; + clip: rect(0em, 0.5em, 1em, 0em); + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + -ms-border-radius: 50%; + -o-border-radius: 50%; + border-radius: 50%; + -webkit-transform: rotate(0deg); + -moz-transform: rotate(0deg); + -ms-transform: rotate(0deg); + -o-transform: rotate(0deg); + transform: rotate(0deg); +} + +.pie-fill, .c100.p51 .bar:after, .c100.p51 .fill, .c100.p52 .bar:after, .c100.p52 .fill, .c100.p53 .bar:after, .c100.p53 .fill, .c100.p54 .bar:after, .c100.p54 .fill, .c100.p55 .bar:after, .c100.p55 .fill, .c100.p56 .bar:after, .c100.p56 .fill, .c100.p57 .bar:after, .c100.p57 .fill, .c100.p58 .bar:after, .c100.p58 .fill, .c100.p59 .bar:after, .c100.p59 .fill, .c100.p60 .bar:after, .c100.p60 .fill, .c100.p61 .bar:after, .c100.p61 .fill, .c100.p62 .bar:after, .c100.p62 .fill, .c100.p63 .bar:after, .c100.p63 .fill, .c100.p64 .bar:after, .c100.p64 .fill, .c100.p65 .bar:after, .c100.p65 .fill, .c100.p66 .bar:after, .c100.p66 .fill, .c100.p67 .bar:after, .c100.p67 .fill, .c100.p68 .bar:after, .c100.p68 .fill, .c100.p69 .bar:after, .c100.p69 .fill, .c100.p70 .bar:after, .c100.p70 .fill, .c100.p71 .bar:after, .c100.p71 .fill, .c100.p72 .bar:after, .c100.p72 .fill, .c100.p73 .bar:after, .c100.p73 .fill, .c100.p74 .bar:after, .c100.p74 .fill, .c100.p75 .bar:after, .c100.p75 .fill, .c100.p76 .bar:after, .c100.p76 .fill, .c100.p77 .bar:after, .c100.p77 .fill, .c100.p78 .bar:after, .c100.p78 .fill, .c100.p79 .bar:after, .c100.p79 .fill, .c100.p80 .bar:after, .c100.p80 .fill, .c100.p81 .bar:after, .c100.p81 .fill, .c100.p82 .bar:after, .c100.p82 .fill, .c100.p83 .bar:after, .c100.p83 .fill, .c100.p84 .bar:after, .c100.p84 .fill, .c100.p85 .bar:after, .c100.p85 .fill, .c100.p86 .bar:after, .c100.p86 .fill, .c100.p87 .bar:after, .c100.p87 .fill, .c100.p88 .bar:after, .c100.p88 .fill, .c100.p89 .bar:after, .c100.p89 .fill, .c100.p90 .bar:after, .c100.p90 .fill, .c100.p91 .bar:after, .c100.p91 .fill, .c100.p92 .bar:after, .c100.p92 .fill, .c100.p93 .bar:after, .c100.p93 .fill, .c100.p94 .bar:after, .c100.p94 .fill, .c100.p95 .bar:after, .c100.p95 .fill, .c100.p96 .bar:after, .c100.p96 .fill, .c100.p97 .bar:after, .c100.p97 .fill, .c100.p98 .bar:after, .c100.p98 .fill, .c100.p99 .bar:after, .c100.p99 .fill, .c100.p100 .bar:after, .c100.p100 .fill { + -webkit-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -o-transform: rotate(180deg); + transform: rotate(180deg); +} + +.c100 { + position: relative; + font-size: 120px; + width: 1em; + height: 1em; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + -ms-border-radius: 50%; + -o-border-radius: 50%; + border-radius: 50%; + float: left; + margin: 0 0.1em 0.1em 0; + background-color: #cccccc; +} +.c100 *, .c100 *:before, .c100 *:after { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} +.c100.center { + float: none; + margin: 0 auto; +} +.c100.big { + font-size: 240px; +} +.c100.small { + font-size: 80px; +} +.c100 > span { + position: absolute; + width: 100%; + z-index: 1; + left: 0; + top: 0; + width: 5em; + line-height: 5em; + font-size: 0.2em; + color: #cccccc; + display: block; + text-align: center; + white-space: nowrap; + -webkit-transition-property: all; + -moz-transition-property: all; + -o-transition-property: all; + transition-property: all; + -webkit-transition-duration: 0.2s; + -moz-transition-duration: 0.2s; + -o-transition-duration: 0.2s; + transition-duration: 0.2s; + -webkit-transition-timing-function: ease-out; + -moz-transition-timing-function: ease-out; + -o-transition-timing-function: ease-out; + transition-timing-function: ease-out; +} +.c100:after { + position: absolute; + top: 0.08em; + left: 0.08em; + display: block; + content: " "; + -webkit-border-radius: 50%; + -moz-border-radius: 50%; + -ms-border-radius: 50%; + -o-border-radius: 50%; + border-radius: 50%; + background-color: whitesmoke; + width: 0.84em; + height: 0.84em; + -webkit-transition-property: all; + -moz-transition-property: all; + -o-transition-property: all; + transition-property: all; + -webkit-transition-duration: 0.2s; + -moz-transition-duration: 0.2s; + -o-transition-duration: 0.2s; + transition-duration: 0.2s; + -webkit-transition-timing-function: ease-in; + -moz-transition-timing-function: ease-in; + -o-transition-timing-function: ease-in; + transition-timing-function: ease-in; +} +.c100 .slice { + position: absolute; + width: 1em; + height: 1em; + clip: rect(0em, 1em, 1em, 0.5em); +} +.c100.p1 .bar { + -webkit-transform: rotate(3.6deg); + -moz-transform: rotate(3.6deg); + -ms-transform: rotate(3.6deg); + -o-transform: rotate(3.6deg); + transform: rotate(3.6deg); +} +.c100.p2 .bar { + -webkit-transform: rotate(7.2deg); + -moz-transform: rotate(7.2deg); + -ms-transform: rotate(7.2deg); + -o-transform: rotate(7.2deg); + transform: rotate(7.2deg); +} +.c100.p3 .bar { + -webkit-transform: rotate(10.8deg); + -moz-transform: rotate(10.8deg); + -ms-transform: rotate(10.8deg); + -o-transform: rotate(10.8deg); + transform: rotate(10.8deg); +} +.c100.p4 .bar { + -webkit-transform: rotate(14.4deg); + -moz-transform: rotate(14.4deg); + -ms-transform: rotate(14.4deg); + -o-transform: rotate(14.4deg); + transform: rotate(14.4deg); +} +.c100.p5 .bar { + -webkit-transform: rotate(18deg); + -moz-transform: rotate(18deg); + -ms-transform: rotate(18deg); + -o-transform: rotate(18deg); + transform: rotate(18deg); +} +.c100.p6 .bar { + -webkit-transform: rotate(21.6deg); + -moz-transform: rotate(21.6deg); + -ms-transform: rotate(21.6deg); + -o-transform: rotate(21.6deg); + transform: rotate(21.6deg); +} +.c100.p7 .bar { + -webkit-transform: rotate(25.2deg); + -moz-transform: rotate(25.2deg); + -ms-transform: rotate(25.2deg); + -o-transform: rotate(25.2deg); + transform: rotate(25.2deg); +} +.c100.p8 .bar { + -webkit-transform: rotate(28.8deg); + -moz-transform: rotate(28.8deg); + -ms-transform: rotate(28.8deg); + -o-transform: rotate(28.8deg); + transform: rotate(28.8deg); +} +.c100.p9 .bar { + -webkit-transform: rotate(32.4deg); + -moz-transform: rotate(32.4deg); + -ms-transform: rotate(32.4deg); + -o-transform: rotate(32.4deg); + transform: rotate(32.4deg); +} +.c100.p10 .bar { + -webkit-transform: rotate(36deg); + -moz-transform: rotate(36deg); + -ms-transform: rotate(36deg); + -o-transform: rotate(36deg); + transform: rotate(36deg); +} +.c100.p11 .bar { + -webkit-transform: rotate(39.6deg); + -moz-transform: rotate(39.6deg); + -ms-transform: rotate(39.6deg); + -o-transform: rotate(39.6deg); + transform: rotate(39.6deg); +} +.c100.p12 .bar { + -webkit-transform: rotate(43.2deg); + -moz-transform: rotate(43.2deg); + -ms-transform: rotate(43.2deg); + -o-transform: rotate(43.2deg); + transform: rotate(43.2deg); +} +.c100.p13 .bar { + -webkit-transform: rotate(46.8deg); + -moz-transform: rotate(46.8deg); + -ms-transform: rotate(46.8deg); + -o-transform: rotate(46.8deg); + transform: rotate(46.8deg); +} +.c100.p14 .bar { + -webkit-transform: rotate(50.4deg); + -moz-transform: rotate(50.4deg); + -ms-transform: rotate(50.4deg); + -o-transform: rotate(50.4deg); + transform: rotate(50.4deg); +} +.c100.p15 .bar { + -webkit-transform: rotate(54deg); + -moz-transform: rotate(54deg); + -ms-transform: rotate(54deg); + -o-transform: rotate(54deg); + transform: rotate(54deg); +} +.c100.p16 .bar { + -webkit-transform: rotate(57.6deg); + -moz-transform: rotate(57.6deg); + -ms-transform: rotate(57.6deg); + -o-transform: rotate(57.6deg); + transform: rotate(57.6deg); +} +.c100.p17 .bar { + -webkit-transform: rotate(61.2deg); + -moz-transform: rotate(61.2deg); + -ms-transform: rotate(61.2deg); + -o-transform: rotate(61.2deg); + transform: rotate(61.2deg); +} +.c100.p18 .bar { + -webkit-transform: rotate(64.8deg); + -moz-transform: rotate(64.8deg); + -ms-transform: rotate(64.8deg); + -o-transform: rotate(64.8deg); + transform: rotate(64.8deg); +} +.c100.p19 .bar { + -webkit-transform: rotate(68.4deg); + -moz-transform: rotate(68.4deg); + -ms-transform: rotate(68.4deg); + -o-transform: rotate(68.4deg); + transform: rotate(68.4deg); +} +.c100.p20 .bar { + -webkit-transform: rotate(72deg); + -moz-transform: rotate(72deg); + -ms-transform: rotate(72deg); + -o-transform: rotate(72deg); + transform: rotate(72deg); +} +.c100.p21 .bar { + -webkit-transform: rotate(75.6deg); + -moz-transform: rotate(75.6deg); + -ms-transform: rotate(75.6deg); + -o-transform: rotate(75.6deg); + transform: rotate(75.6deg); +} +.c100.p22 .bar { + -webkit-transform: rotate(79.2deg); + -moz-transform: rotate(79.2deg); + -ms-transform: rotate(79.2deg); + -o-transform: rotate(79.2deg); + transform: rotate(79.2deg); +} +.c100.p23 .bar { + -webkit-transform: rotate(82.8deg); + -moz-transform: rotate(82.8deg); + -ms-transform: rotate(82.8deg); + -o-transform: rotate(82.8deg); + transform: rotate(82.8deg); +} +.c100.p24 .bar { + -webkit-transform: rotate(86.4deg); + -moz-transform: rotate(86.4deg); + -ms-transform: rotate(86.4deg); + -o-transform: rotate(86.4deg); + transform: rotate(86.4deg); +} +.c100.p25 .bar { + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -o-transform: rotate(90deg); + transform: rotate(90deg); +} +.c100.p26 .bar { + -webkit-transform: rotate(93.6deg); + -moz-transform: rotate(93.6deg); + -ms-transform: rotate(93.6deg); + -o-transform: rotate(93.6deg); + transform: rotate(93.6deg); +} +.c100.p27 .bar { + -webkit-transform: rotate(97.2deg); + -moz-transform: rotate(97.2deg); + -ms-transform: rotate(97.2deg); + -o-transform: rotate(97.2deg); + transform: rotate(97.2deg); +} +.c100.p28 .bar { + -webkit-transform: rotate(100.8deg); + -moz-transform: rotate(100.8deg); + -ms-transform: rotate(100.8deg); + -o-transform: rotate(100.8deg); + transform: rotate(100.8deg); +} +.c100.p29 .bar { + -webkit-transform: rotate(104.4deg); + -moz-transform: rotate(104.4deg); + -ms-transform: rotate(104.4deg); + -o-transform: rotate(104.4deg); + transform: rotate(104.4deg); +} +.c100.p30 .bar { + -webkit-transform: rotate(108deg); + -moz-transform: rotate(108deg); + -ms-transform: rotate(108deg); + -o-transform: rotate(108deg); + transform: rotate(108deg); +} +.c100.p31 .bar { + -webkit-transform: rotate(111.6deg); + -moz-transform: rotate(111.6deg); + -ms-transform: rotate(111.6deg); + -o-transform: rotate(111.6deg); + transform: rotate(111.6deg); +} +.c100.p32 .bar { + -webkit-transform: rotate(115.2deg); + -moz-transform: rotate(115.2deg); + -ms-transform: rotate(115.2deg); + -o-transform: rotate(115.2deg); + transform: rotate(115.2deg); +} +.c100.p33 .bar { + -webkit-transform: rotate(118.8deg); + -moz-transform: rotate(118.8deg); + -ms-transform: rotate(118.8deg); + -o-transform: rotate(118.8deg); + transform: rotate(118.8deg); +} +.c100.p34 .bar { + -webkit-transform: rotate(122.4deg); + -moz-transform: rotate(122.4deg); + -ms-transform: rotate(122.4deg); + -o-transform: rotate(122.4deg); + transform: rotate(122.4deg); +} +.c100.p35 .bar { + -webkit-transform: rotate(126deg); + -moz-transform: rotate(126deg); + -ms-transform: rotate(126deg); + -o-transform: rotate(126deg); + transform: rotate(126deg); +} +.c100.p36 .bar { + -webkit-transform: rotate(129.6deg); + -moz-transform: rotate(129.6deg); + -ms-transform: rotate(129.6deg); + -o-transform: rotate(129.6deg); + transform: rotate(129.6deg); +} +.c100.p37 .bar { + -webkit-transform: rotate(133.2deg); + -moz-transform: rotate(133.2deg); + -ms-transform: rotate(133.2deg); + -o-transform: rotate(133.2deg); + transform: rotate(133.2deg); +} +.c100.p38 .bar { + -webkit-transform: rotate(136.8deg); + -moz-transform: rotate(136.8deg); + -ms-transform: rotate(136.8deg); + -o-transform: rotate(136.8deg); + transform: rotate(136.8deg); +} +.c100.p39 .bar { + -webkit-transform: rotate(140.4deg); + -moz-transform: rotate(140.4deg); + -ms-transform: rotate(140.4deg); + -o-transform: rotate(140.4deg); + transform: rotate(140.4deg); +} +.c100.p40 .bar { + -webkit-transform: rotate(144deg); + -moz-transform: rotate(144deg); + -ms-transform: rotate(144deg); + -o-transform: rotate(144deg); + transform: rotate(144deg); +} +.c100.p41 .bar { + -webkit-transform: rotate(147.6deg); + -moz-transform: rotate(147.6deg); + -ms-transform: rotate(147.6deg); + -o-transform: rotate(147.6deg); + transform: rotate(147.6deg); +} +.c100.p42 .bar { + -webkit-transform: rotate(151.2deg); + -moz-transform: rotate(151.2deg); + -ms-transform: rotate(151.2deg); + -o-transform: rotate(151.2deg); + transform: rotate(151.2deg); +} +.c100.p43 .bar { + -webkit-transform: rotate(154.8deg); + -moz-transform: rotate(154.8deg); + -ms-transform: rotate(154.8deg); + -o-transform: rotate(154.8deg); + transform: rotate(154.8deg); +} +.c100.p44 .bar { + -webkit-transform: rotate(158.4deg); + -moz-transform: rotate(158.4deg); + -ms-transform: rotate(158.4deg); + -o-transform: rotate(158.4deg); + transform: rotate(158.4deg); +} +.c100.p45 .bar { + -webkit-transform: rotate(162deg); + -moz-transform: rotate(162deg); + -ms-transform: rotate(162deg); + -o-transform: rotate(162deg); + transform: rotate(162deg); +} +.c100.p46 .bar { + -webkit-transform: rotate(165.6deg); + -moz-transform: rotate(165.6deg); + -ms-transform: rotate(165.6deg); + -o-transform: rotate(165.6deg); + transform: rotate(165.6deg); +} +.c100.p47 .bar { + -webkit-transform: rotate(169.2deg); + -moz-transform: rotate(169.2deg); + -ms-transform: rotate(169.2deg); + -o-transform: rotate(169.2deg); + transform: rotate(169.2deg); +} +.c100.p48 .bar { + -webkit-transform: rotate(172.8deg); + -moz-transform: rotate(172.8deg); + -ms-transform: rotate(172.8deg); + -o-transform: rotate(172.8deg); + transform: rotate(172.8deg); +} +.c100.p49 .bar { + -webkit-transform: rotate(176.4deg); + -moz-transform: rotate(176.4deg); + -ms-transform: rotate(176.4deg); + -o-transform: rotate(176.4deg); + transform: rotate(176.4deg); +} +.c100.p50 .bar { + -webkit-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -o-transform: rotate(180deg); + transform: rotate(180deg); +} +.c100.p51 .bar { + -webkit-transform: rotate(183.6deg); + -moz-transform: rotate(183.6deg); + -ms-transform: rotate(183.6deg); + -o-transform: rotate(183.6deg); + transform: rotate(183.6deg); +} +.c100.p52 .bar { + -webkit-transform: rotate(187.2deg); + -moz-transform: rotate(187.2deg); + -ms-transform: rotate(187.2deg); + -o-transform: rotate(187.2deg); + transform: rotate(187.2deg); +} +.c100.p53 .bar { + -webkit-transform: rotate(190.8deg); + -moz-transform: rotate(190.8deg); + -ms-transform: rotate(190.8deg); + -o-transform: rotate(190.8deg); + transform: rotate(190.8deg); +} +.c100.p54 .bar { + -webkit-transform: rotate(194.4deg); + -moz-transform: rotate(194.4deg); + -ms-transform: rotate(194.4deg); + -o-transform: rotate(194.4deg); + transform: rotate(194.4deg); +} +.c100.p55 .bar { + -webkit-transform: rotate(198deg); + -moz-transform: rotate(198deg); + -ms-transform: rotate(198deg); + -o-transform: rotate(198deg); + transform: rotate(198deg); +} +.c100.p56 .bar { + -webkit-transform: rotate(201.6deg); + -moz-transform: rotate(201.6deg); + -ms-transform: rotate(201.6deg); + -o-transform: rotate(201.6deg); + transform: rotate(201.6deg); +} +.c100.p57 .bar { + -webkit-transform: rotate(205.2deg); + -moz-transform: rotate(205.2deg); + -ms-transform: rotate(205.2deg); + -o-transform: rotate(205.2deg); + transform: rotate(205.2deg); +} +.c100.p58 .bar { + -webkit-transform: rotate(208.8deg); + -moz-transform: rotate(208.8deg); + -ms-transform: rotate(208.8deg); + -o-transform: rotate(208.8deg); + transform: rotate(208.8deg); +} +.c100.p59 .bar { + -webkit-transform: rotate(212.4deg); + -moz-transform: rotate(212.4deg); + -ms-transform: rotate(212.4deg); + -o-transform: rotate(212.4deg); + transform: rotate(212.4deg); +} +.c100.p60 .bar { + -webkit-transform: rotate(216deg); + -moz-transform: rotate(216deg); + -ms-transform: rotate(216deg); + -o-transform: rotate(216deg); + transform: rotate(216deg); +} +.c100.p61 .bar { + -webkit-transform: rotate(219.6deg); + -moz-transform: rotate(219.6deg); + -ms-transform: rotate(219.6deg); + -o-transform: rotate(219.6deg); + transform: rotate(219.6deg); +} +.c100.p62 .bar { + -webkit-transform: rotate(223.2deg); + -moz-transform: rotate(223.2deg); + -ms-transform: rotate(223.2deg); + -o-transform: rotate(223.2deg); + transform: rotate(223.2deg); +} +.c100.p63 .bar { + -webkit-transform: rotate(226.8deg); + -moz-transform: rotate(226.8deg); + -ms-transform: rotate(226.8deg); + -o-transform: rotate(226.8deg); + transform: rotate(226.8deg); +} +.c100.p64 .bar { + -webkit-transform: rotate(230.4deg); + -moz-transform: rotate(230.4deg); + -ms-transform: rotate(230.4deg); + -o-transform: rotate(230.4deg); + transform: rotate(230.4deg); +} +.c100.p65 .bar { + -webkit-transform: rotate(234deg); + -moz-transform: rotate(234deg); + -ms-transform: rotate(234deg); + -o-transform: rotate(234deg); + transform: rotate(234deg); +} +.c100.p66 .bar { + -webkit-transform: rotate(237.6deg); + -moz-transform: rotate(237.6deg); + -ms-transform: rotate(237.6deg); + -o-transform: rotate(237.6deg); + transform: rotate(237.6deg); +} +.c100.p67 .bar { + -webkit-transform: rotate(241.2deg); + -moz-transform: rotate(241.2deg); + -ms-transform: rotate(241.2deg); + -o-transform: rotate(241.2deg); + transform: rotate(241.2deg); +} +.c100.p68 .bar { + -webkit-transform: rotate(244.8deg); + -moz-transform: rotate(244.8deg); + -ms-transform: rotate(244.8deg); + -o-transform: rotate(244.8deg); + transform: rotate(244.8deg); +} +.c100.p69 .bar { + -webkit-transform: rotate(248.4deg); + -moz-transform: rotate(248.4deg); + -ms-transform: rotate(248.4deg); + -o-transform: rotate(248.4deg); + transform: rotate(248.4deg); +} +.c100.p70 .bar { + -webkit-transform: rotate(252deg); + -moz-transform: rotate(252deg); + -ms-transform: rotate(252deg); + -o-transform: rotate(252deg); + transform: rotate(252deg); +} +.c100.p71 .bar { + -webkit-transform: rotate(255.6deg); + -moz-transform: rotate(255.6deg); + -ms-transform: rotate(255.6deg); + -o-transform: rotate(255.6deg); + transform: rotate(255.6deg); +} +.c100.p72 .bar { + -webkit-transform: rotate(259.2deg); + -moz-transform: rotate(259.2deg); + -ms-transform: rotate(259.2deg); + -o-transform: rotate(259.2deg); + transform: rotate(259.2deg); +} +.c100.p73 .bar { + -webkit-transform: rotate(262.8deg); + -moz-transform: rotate(262.8deg); + -ms-transform: rotate(262.8deg); + -o-transform: rotate(262.8deg); + transform: rotate(262.8deg); +} +.c100.p74 .bar { + -webkit-transform: rotate(266.4deg); + -moz-transform: rotate(266.4deg); + -ms-transform: rotate(266.4deg); + -o-transform: rotate(266.4deg); + transform: rotate(266.4deg); +} +.c100.p75 .bar { + -webkit-transform: rotate(270deg); + -moz-transform: rotate(270deg); + -ms-transform: rotate(270deg); + -o-transform: rotate(270deg); + transform: rotate(270deg); +} +.c100.p76 .bar { + -webkit-transform: rotate(273.6deg); + -moz-transform: rotate(273.6deg); + -ms-transform: rotate(273.6deg); + -o-transform: rotate(273.6deg); + transform: rotate(273.6deg); +} +.c100.p77 .bar { + -webkit-transform: rotate(277.2deg); + -moz-transform: rotate(277.2deg); + -ms-transform: rotate(277.2deg); + -o-transform: rotate(277.2deg); + transform: rotate(277.2deg); +} +.c100.p78 .bar { + -webkit-transform: rotate(280.8deg); + -moz-transform: rotate(280.8deg); + -ms-transform: rotate(280.8deg); + -o-transform: rotate(280.8deg); + transform: rotate(280.8deg); +} +.c100.p79 .bar { + -webkit-transform: rotate(284.4deg); + -moz-transform: rotate(284.4deg); + -ms-transform: rotate(284.4deg); + -o-transform: rotate(284.4deg); + transform: rotate(284.4deg); +} +.c100.p80 .bar { + -webkit-transform: rotate(288deg); + -moz-transform: rotate(288deg); + -ms-transform: rotate(288deg); + -o-transform: rotate(288deg); + transform: rotate(288deg); +} +.c100.p81 .bar { + -webkit-transform: rotate(291.6deg); + -moz-transform: rotate(291.6deg); + -ms-transform: rotate(291.6deg); + -o-transform: rotate(291.6deg); + transform: rotate(291.6deg); +} +.c100.p82 .bar { + -webkit-transform: rotate(295.2deg); + -moz-transform: rotate(295.2deg); + -ms-transform: rotate(295.2deg); + -o-transform: rotate(295.2deg); + transform: rotate(295.2deg); +} +.c100.p83 .bar { + -webkit-transform: rotate(298.8deg); + -moz-transform: rotate(298.8deg); + -ms-transform: rotate(298.8deg); + -o-transform: rotate(298.8deg); + transform: rotate(298.8deg); +} +.c100.p84 .bar { + -webkit-transform: rotate(302.4deg); + -moz-transform: rotate(302.4deg); + -ms-transform: rotate(302.4deg); + -o-transform: rotate(302.4deg); + transform: rotate(302.4deg); +} +.c100.p85 .bar { + -webkit-transform: rotate(306deg); + -moz-transform: rotate(306deg); + -ms-transform: rotate(306deg); + -o-transform: rotate(306deg); + transform: rotate(306deg); +} +.c100.p86 .bar { + -webkit-transform: rotate(309.6deg); + -moz-transform: rotate(309.6deg); + -ms-transform: rotate(309.6deg); + -o-transform: rotate(309.6deg); + transform: rotate(309.6deg); +} +.c100.p87 .bar { + -webkit-transform: rotate(313.2deg); + -moz-transform: rotate(313.2deg); + -ms-transform: rotate(313.2deg); + -o-transform: rotate(313.2deg); + transform: rotate(313.2deg); +} +.c100.p88 .bar { + -webkit-transform: rotate(316.8deg); + -moz-transform: rotate(316.8deg); + -ms-transform: rotate(316.8deg); + -o-transform: rotate(316.8deg); + transform: rotate(316.8deg); +} +.c100.p89 .bar { + -webkit-transform: rotate(320.4deg); + -moz-transform: rotate(320.4deg); + -ms-transform: rotate(320.4deg); + -o-transform: rotate(320.4deg); + transform: rotate(320.4deg); +} +.c100.p90 .bar { + -webkit-transform: rotate(324deg); + -moz-transform: rotate(324deg); + -ms-transform: rotate(324deg); + -o-transform: rotate(324deg); + transform: rotate(324deg); +} +.c100.p91 .bar { + -webkit-transform: rotate(327.6deg); + -moz-transform: rotate(327.6deg); + -ms-transform: rotate(327.6deg); + -o-transform: rotate(327.6deg); + transform: rotate(327.6deg); +} +.c100.p92 .bar { + -webkit-transform: rotate(331.2deg); + -moz-transform: rotate(331.2deg); + -ms-transform: rotate(331.2deg); + -o-transform: rotate(331.2deg); + transform: rotate(331.2deg); +} +.c100.p93 .bar { + -webkit-transform: rotate(334.8deg); + -moz-transform: rotate(334.8deg); + -ms-transform: rotate(334.8deg); + -o-transform: rotate(334.8deg); + transform: rotate(334.8deg); +} +.c100.p94 .bar { + -webkit-transform: rotate(338.4deg); + -moz-transform: rotate(338.4deg); + -ms-transform: rotate(338.4deg); + -o-transform: rotate(338.4deg); + transform: rotate(338.4deg); +} +.c100.p95 .bar { + -webkit-transform: rotate(342deg); + -moz-transform: rotate(342deg); + -ms-transform: rotate(342deg); + -o-transform: rotate(342deg); + transform: rotate(342deg); +} +.c100.p96 .bar { + -webkit-transform: rotate(345.6deg); + -moz-transform: rotate(345.6deg); + -ms-transform: rotate(345.6deg); + -o-transform: rotate(345.6deg); + transform: rotate(345.6deg); +} +.c100.p97 .bar { + -webkit-transform: rotate(349.2deg); + -moz-transform: rotate(349.2deg); + -ms-transform: rotate(349.2deg); + -o-transform: rotate(349.2deg); + transform: rotate(349.2deg); +} +.c100.p98 .bar { + -webkit-transform: rotate(352.8deg); + -moz-transform: rotate(352.8deg); + -ms-transform: rotate(352.8deg); + -o-transform: rotate(352.8deg); + transform: rotate(352.8deg); +} +.c100.p99 .bar { + -webkit-transform: rotate(356.4deg); + -moz-transform: rotate(356.4deg); + -ms-transform: rotate(356.4deg); + -o-transform: rotate(356.4deg); + transform: rotate(356.4deg); +} +.c100.p100 .bar { + -webkit-transform: rotate(360deg); + -moz-transform: rotate(360deg); + -ms-transform: rotate(360deg); + -o-transform: rotate(360deg); + transform: rotate(360deg); +} +.c100:hover { + cursor: default; +} +.c100:hover > span { + width: 3.33em; + line-height: 3.33em; + font-size: 0.3em; + color: #307bbb; +} +.c100:hover:after { + top: 0.04em; + left: 0.04em; + width: 0.92em; + height: 0.92em; +} +.c100.dark { + background-color: #777777; +} +.c100.dark .bar, +.c100.dark .fill { + border-color: #c6ff00 !important; +} +.c100.dark > span { + color: #777777; +} +.c100.dark:after { + background-color: #666666; +} +.c100.dark:hover > span { + color: #c6ff00; +} +.c100.green .bar, .c100.green .fill { + border-color: #4db53c !important; +} +.c100.green:hover > span { + color: #4db53c; +} +.c100.green.dark .bar, .c100.green.dark .fill { + border-color: #5fd400 !important; +} +.c100.green.dark:hover > span { + color: #5fd400; +} +.c100.orange .bar, .c100.orange .fill { + border-color: #dd9d22 !important; +} +.c100.orange:hover > span { + color: #dd9d22; +} +.c100.orange.dark .bar, .c100.orange.dark .fill { + border-color: #e08833 !important; +} +.c100.orange.dark:hover > span { + color: #e08833; +} diff --git a/wp-content/plugins/compressx/includes/display/css/compressx-style.css b/wp-content/plugins/compressx/includes/display/css/compressx-style.css new file mode 100644 index 0000000..5372fa8 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/css/compressx-style.css @@ -0,0 +1,1716 @@ + +#compressx-root { + --color-background: #fff; + --color-bg-block:#f7f9fc; + --color-white:#fff; + --color-background-test:#000; + --color-title:#0B163F; + --color-text:#575757; + --color-blue:#0B163F; + --color-light-blue:#175cff; + --color-light-blue-2:#104bd4; + --color-tech-blue:#018fd1; + --color-dark-green:#198754; + --color-dark-yellow:orange; + --color-dark-orange:orange; + --color-text-light:#6b8fac; + --color-dark-red:#FF3951; + --color-light-grey:#F8F9FA; + --color-dark-grey:#f0f0f0; + --color-grey:#ddd; + --color-notification:rgba(234,241,255,.52); + --color-grey-blue:#CEDDFF; + --color-grey-black:#888; + --container-width-lg: 1200px; + --container-mini-height:1000px; + --color-light-green:#8bc34a; + + --font-family: "Poppins", Sans-serif; + line-height: 1.5; +} +#compressx-wrap { + + box-sizing: border-box; + margin-top: 1.5rem; + padding-bottom: 5rem; + width: calc(100% - 20px) !important; + min-height: var(--container-mini-height); + padding-left: 1rem; + padding-right: 1rem; + border-radius: 6px; +} +.custom-shape-divider-bottom-1723692648 { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + overflow: hidden; + line-height: 0; + transform: rotate(180deg); +} + +.custom-shape-divider-bottom-1723692648 svg { + position: relative; + display: block; + width: calc(100% + 1.3px); + height: 181px; +} + +.custom-shape-divider-bottom-1723692648 .shape-fill { + fill: #FFFFFF; +} +#compressx-wrap .cx-radio-toolbar label { + display: inline-block; + background-color: var(--color-dark-grey); + padding: 0.3rem 0.5rem; + font-size: 0.8rem; + border: 1px solid var(--color-grey); + border-radius: 0.2rem; + cursor: pointer; +} +#compressx-wrap .cx-radio-toolbar input[type="radio"]:checked + label { + background-color: var(--color-light-blue); + border-color: var(--color-light-blue); + color:var(--color-background); +} +#compressx-wrap .cx-radio-toolbar input[type="radio"] { + opacity: 0; + position: fixed; + width: 0; +} +#compressx-wrap .cx-thumbnail-sizes{ + padding:1rem 0; +} +#compressx-wrap a{ + color: var(--color-light-blue); +} +#compressx-wrap a:hover{ + color: var(--color-title); +} +.compressx-container{ + max-width: var(--container-width-lg); + margin: 0 auto; +} +h1,h2,h3,h4,h5{ + line-height: 1; + text-shadow: rgba(0,0,0,.01) 0 0 1px; +} +h1 { + font-size:2.4rem; + color: var(--color-title); + +} +h2 { + font-size:2rem; + color: var(--color-title); + font-family: var(--font-family); +} +h3 { + font-size:1.6rem; + color: var(--color-title); +} +h4 { + font-size:1.3rem; + color: var(--color-title); +} +h5 { + font-size:1.2rem; + color: var(--color-title); + line-height: 0; +} + +a { + color:var(--color-text); + text-decoration: none; +} +/*****************************Nav*****************************************/ +#compressx-wrap nav{ + max-width: var(--container-width-lg); + background-color: var(--color-bg-block); + border-bottom: 2px solid var(--color-grey); + margin: 0 auto; +} + +/*============================Toggle Button==============================*/ +/* The switch - the box around the slider */ +.compressx-container .cx-switch { + position: relative; + display: inline-block; + width: 40px; + height: 20px; +} + +/* Hide default HTML checkbox */ +.compressx-container .cx-switch input { + opacity: 0; + width: 0; + height: 0; +} + +/* The slider */ +.compressx-container .cx-slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: #ccc; + -webkit-transition: .4s; + transition: .4s; +} + +.compressx-container .cx-slider:before { + position: absolute; + content: ""; + height: 14px; + width: 14px; + left: 3px; + bottom: 3px; + background-color: white; + -webkit-transition: .4s; + transition: .4s; +} + +.compressx-container input:checked + .cx-slider { + background-color: var(--color-light-blue); +} + +.compressx-container input:focus + .cx-slider { + box-shadow: 0 0 1px #2196F3; +} + +.compressx-container input:checked + .cx-slider:before { + -webkit-transform: translateX(20px); + -ms-transform: translateX(20px); + transform: translateX(20px); +} +/* Rounded sliders */ +.compressx-container .cx-slider.cx-round { + border-radius: 20px; +} + +.compressx-container .cx-slider.cx-round:before { + border-radius: 50%; +} + +.compressx-container .cx-button { + background-color: var(--color-light-blue); + border-color: var(--color-light-blue); +} +.compressx-container .cx-button:hover { + background-color: var(--color-light-blue-2); + border-color: var(--color-light-blue-2); + color:var(--color-background) +} +.compressx-container .cx-button:focus{ + background-color: var(--color-light-blue-2); + border-color: var(--color-light-blue-2); + color:var(--color-background) +} +.compressx-container .cx-button-light { + background-color: var(--color-background); + border-color: var(--color-light-blue); + color:var(--color-light-blue) +} +.compressx-container .cx-button-light:hover { + background-color: var(--color-light-blue); + color:var(--color-background); +} +.compressx-spacing{ + padding:0.5rem 0; +} +/*============================Toggle Button==============================*/ + +/* ============================ Navbar ==================================*/ + + +.compressx-menu{ + display: flex; + justify-content: space-between; + align-items: center; +} +.compressx-menu h2 { + padding:0 2rem; +} +.compressx-menu ul { + display:flex; + align-items: center; + gap:2rem; + padding:0 2rem; +} +.compressx-license{ + max-width: 500px; + min-width: 380px; + margin: auto; +} +.compressx-pro-version{ + background-color: var(--color-notification); +} +.compressx-menu .cx-menu-ul-mini{ + display: none; +} +/*===============================Header==================================*/ +.compressx-container .compressx-servers{ + background-color: var(--color-bg-block); + padding: 1rem; + border-left: 1px solid var(--color-grey); + border-right: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + border-radius: 0px 0px 6px 6px; + +} +.compressx-container .compressx-servers h5{ + font-size: 0.8rem; + color: var(--color-title); +} +.compressx-container .compressx-servers-header{ + padding-top: 0.1rem; + display: flex; + justify-content: space-between; + align-items: center; +} +.compressx-header{ + padding-bottom: 1rem; +} +.compressx-section{ + padding-bottom: 1rem; +} + +.compressx-bulk-process article { + background-color: var(--color-bg-block); + padding:1.5rem 1rem; + border:1px solid var(--color-grey); + border-radius: 3px; +} +.compressx-header-block{ + display:grid; + grid-template-columns: 5fr 2fr; + gap:1rem; +} +.compressx-header-custom-block{ + display:grid; + grid-template-columns: 2fr 1fr 1fr; + gap:1rem; +} + +.compressx-header-custom-block article { + padding:1.5rem 1rem; + border:1px solid #fff; + box-shadow:1px 5px 10px 5px rgba(0, 0, 0, 0.04); + border-radius: 3px; +} +.compressx-header-block article { + background-color: var(--color-background); + padding:1rem 1rem; + border:1px solid var(--color-grey); + border-radius: 3px; +} + +.compressx-bulk-log article{ + background-color: var(--color-background); + padding:1rem 1rem; + border:1px solid var(--color-grey); + border-radius: 3px; +} +.compressx-header-block .cx-stopandpause{ + display: grid; + grid-template-columns: 1fr 1fr; + gap:1rem; +} +.compressx-bg-list{ + background-color: var(--color-bg-block); + padding: 1rem 0; +} +.compressx-header-block .cx-overview .cx-title, +.compressx-header-custom-block .cx-overview .cx-title, +.compressx-bulk-log .cx-title, +.compressx-logs .cx-title{ + color: var(--color-title); + font-size: 1rem; + font-weight: 500; + border-bottom: 2px solid var(--color-grey); + padding-bottom: 1rem; + margin-bottom: 1rem; + position: relative; +} +.compressx-header-block .cx-overview .cx-title .cx-processedsize, +.compressx-bulk-log .cx-title .cx-bulk-opt-results, +.compressx-logs .cx-title .cx-bulk-opt-results{ + font-size: 0.7rem; + position: absolute; + top:0; + right: 0; +} +.cx-overview .cx-bulkoptimization-uploads{ + font-size:0.7em; + color: var(--color-text); +} +.compressx-header-block .cx-overview .cx-title .cx-processedsize .cx-sizevalue{ + font-size: 0.8rem; + font-weight: 600; + color: var(--color-title); +} +.compressx-header-block .cx-overview .cx-title .cx-bulkcx{ + background-color: var(--color-light-blue); + padding: 0.2rem 0.5rem; + border-radius: 3px; + font-size: 0.8rem; + font-weight: 400; +} +.compressx-header-block .cx-overview .cx-title .cx-bulkcx a{ + color:var(--color-background) !important; +} +.compressx-header-block .cx-overview .cx-title .cx-bulkcx:hover{ + color: var(--color-background); + background-color: var(--color-title); +} +.compressx-header-block .cx-overview_body{ + display:grid; + grid-template-columns: repeat(5,1fr); + gap:1rem; + padding-left: 1rem; + padding-bottom: 1rem; + border-bottom: 1px solid var(--color-dark-grey); +} +.compressx-header-block .cx-overview_body-free{ + display:grid; + grid-template-columns: repeat(2,1fr); + gap:0.5rem; + border-bottom: 1px solid var(--color-dark-grey); + padding-bottom: 1rem; +} + +.compressx-header-block .cx-overview_body-webp-free{ + display:grid; + grid-template-columns: repeat(2,1fr); + gap:0.5rem; +} +.compressx-header-block .cx-process-webp{ + width: 9rem; + height: 9rem; + border-radius: 50%; + border: 1px solid var(--color-grey); + margin: 0 auto; + display : flex; + align-items : center; +} + +.compressx-header-block .cx-process-position{ + width:80%; + margin:25% auto; +} + +.compressx-header-block .cx-process-media-type{ + display: block; + font-size: 0.8rem; + font-weight: 600; +} +.compressx-header-block .cx-porcess-media-files-label{ + display: block; + font-size: 0.8rem; +} +.compressx-header-block .cx-overview_body .cx-pro{ + font-size: 0.6rem; +} +.compressx-header-block .cx-overview_body .cx-subtitle{ + display: block; + padding: 0.5rem 0; + font-size: 0.8rem; + font-weight: 600; +} + +.compressx-header-block .cx-overview_body .cx-percent, +.compressx-header-block .cx-overview_body .cx-processed{ + display: block; + font-size: 1.2rem; + font-weight: 600; + color: var(--color-title); + padding:0.8rem 0 0.2rem 0; +} +.compressx-header-block .cx-overview_body-free .cx-percent, +.compressx-header-block .cx-overview_body-free .cx-processed{ + display: block; + font-size: 1.3rem; + font-weight: 600; + color: var(--color-title); + padding:0.2rem 0 0.2rem 0; + text-align: center; +} +.compressx-header-block .cx-overview_body-free .cx-processed-percentage{ + display: block; + color: var(--color-title); + padding:0.2rem 0 0.2rem 0; + text-align: center; +} +.compressx-header-block .cx-overview_body-free .cx-percent-sign, +.compressx-header-block .cx-overview_body .cx-percent-sign{ + font-size: 0.8rem; +} +.compressx-header-block .cx-overview_body .cx-savings, +.compressx-header-block .cx-overview_body .cx-processing{ + color: var(--color-grey-black); +} +.compressx-header-block .cx-overview_body-free .cx-savings, +.compressx-header-block .cx-overview_body-free .cx-processing{ + display: block; + color: var(--color-grey-black); + text-align: center; +} +.compressx-header-block .cx-overview_footer{ + padding: 1rem 0 0; +} +.compressx-header-block .cx-media-selected{ + background-color: var(--color-notification); + padding:1rem 1rem 0.5rem 1rem; + border-radius: 4px; + margin-top: 1rem; + margin-bottom: 1rem; +} +.compressx-header-block .cx-medialib, +.compressx-header-block .cx-customlib, +.compressx-header-block .cx-strategy, +.compressx-header-block .cx-resizing, +.compressx-header-block .cx-backup, +.compressx-header-block .cx-Lazyload +{ + display:flex; + justify-content: space-between; + border-bottom:1px solid var(--color-dark-grey); + padding-bottom: 0.2rem; + margin-bottom: 0.8rem; + +} +.compressx-header-block .cx-background{ + padding:1rem 0; +} +.compressx-header-block .bulk-optimization{ + background-color: var(--color-grey-blue); +} + +.compressx-header-block .cx-servertime, +.compressx-header-block .cx-apiserver, +.compressx-header-block .cx-version, +.compressx-header-block .cx-activated { + display: block; + margin-bottom: 0.3rem; +} + +.compressx-header-block .cx-toactivate, +.compressx-header-block .cx-activatedinfo{ + margin-top: 1rem; + padding: 0.5rem 0.5rem 0.2rem 0.5rem; + border-radius: 4px; + background-color: var(--color-notification); +} + + +.compressx-header-block .cx-toactivate .cx-toactivate-des, +.compressx-header-block .cx-toactivate .cx-tokeninput, +.compressx-header-block .cx-toactivate .cx-chooseplan{ + display: block; + margin-bottom: 0.5rem; +} +.compressx-header-block .cx-toactivate .cx-chooseplan{ + font-size: 1rem; +} + +.compressx-logs article { + background-color: var(--color-background); + border: 1px solid var(--color-grey); + padding:1rem 1rem; + border-radius: 3px; +} +/*===============================Header Ends==================================*/ + + +/*=============================Compressx Notification========================================*/ +.compressx-notification{ + background-color: var(--color-bg-block); + border: 1px solid var(--color-grey); + border-radius: 6px; + padding: 1rem; +} +.compressx-notification-5-star{ + float: left; + width:3rem; + height:3rem; + padding-top:1rem; + padding-right:1rem; + padding-bottom:1rem; + padding-left:1rem; + border:1px solid #dddddd; + border-radius: 50%; + color:#175cff +} +.compressx-notification .cx-api{ + display: grid; + grid-template-columns: repeat(2,1fr); + gap:1rem; +} +.compressx-notification .cx-rating{ + display: grid; + grid-template-columns: repeat(4,1fr); + gap:1rem; + padding-top: 1rem; + padding-bottom: 1rem; +} +.compressx-notification .cx-rating-btn{ + padding:0.4rem 1rem; + font-size: 0.9rem; + color:var(--color-background); + background-color: var(--color-light-blue); + border-radius: 3px; + cursor: pointer; +} +.compressx-notification .cx-rating-btn:hover{ + color: #fff; + background-color: var(--color-light-blue-2); +} +/*=============================Compressx Notification Ends========================================*/ + +/*=============================Compressx General Settings========================================*/ +.compressx-hr{ + display: block; + unicode-bidi: isolate; + overflow: hidden; + margin: 0.75rem 0 0.75rem 0; + border: 0; + border-top: 1px solid #dcdcde; + border-bottom: 1px solid #f6f7f7 +} +.compressx-general-settings{ + background-color: var(--color-background); + padding:0 1rem 1rem; + border:1px solid var(--color-grey); + border-radius: 3px; +} + +.compressx-general-settings .compress-new-images{ + padding: 1rem 0; + border-bottom: 1px solid var(--color-light-grey); +} +.compressx-general-settings-header{ + border-bottom: 2px solid var(--color-grey); + padding-top: 0.1rem; +} +.compressx-general-settings-footer{ + padding:1rem 0 0 0; + margin-top:1rem; + border-top:2px solid var(--color-grey); + +} +.compressx-general-settings-body h5, +.compressx-general-settings-header h5{ + font-size: 0.8rem; + color: var(--color-title); +} +.compressx-general-settings-advanced { + padding: 1rem 0 0 0; + border-top: 1px solid var(--color-grey); +} +.compressx-general-settings-body{ + margin:1rem 0; +} +.compressx-general-settings-file-list{ + padding:1rem 0; +} +.compressx-general-settings-body-grid, +.compressx-addons-grid{ + display:grid; + grid-template-columns: repeat(2,1fr); + gap:1rem; +} +.compressx-3-cols{ + display:grid; + grid-template-columns: repeat(3,1fr); + gap:1rem; +} +.compressx-margin-top{ + margin-top: 1rem; +} +.compressx-margin-bottom{ + margin-bottom: 1rem; +} +.compressx-padding-mini{ + padding:0.5rem +} +.compressx-padding-top{ + padding-top: 1rem; +} +.compressx-padding-right{ + padding-right: 1rem; +} +.compressx-padding-bottom{ + padding-bottom: 1rem; +} +.compressx-padding-left{ + padding-left: 1rem; +} +.compressx-padding-top-mini{ + padding-top: 0.5rem; +} +.compressx-padding-right-mini{ + padding-right: 0.5rem; +} +.compressx-padding-bottom-mini{ + padding-bottom: 0.5rem; +} +.compressx-padding-left-mini{ + padding-left: 0.5rem; +} +.compressx-dot-border, +.compressx-general-settings-body .cx-library-select{ + margin: 0.5rem 0; + border:1px dashed #cfcbcb; + padding:0.5rem; +} +.compressx-border-solid{ + border: 1px solid var(--color-grey); +} +.compressx-overflow{ + overflow: auto; + min-height: 50px; + max-height:250px; +} +.compressx-general-settings-body .cx-library-support-yes{ + color: var(--color-light-green); +} +.compressx-general-settings-body .cx-library-support-no{ + color: var(--color-dark-red); +} +.compressx-general-settings-body label{ + + grid-row-gap:1rem; +} +.compressx-general-settings-body .servers{ + padding:1rem 0 0 1rem; +} +.compressx-general-settings-body .servers label{ + float: left; + padding-right:1rem; +} +.compressx-general-settings-body .others{ + padding:1rem 0 0 1rem; +} +.compressx-general-settings-body .others span{ + display: block; + padding:0 0 1rem 0; +} + +.compressx-general-settings-body .compressing-converting{ + margin-top: 1rem; + padding: 0 1rem; +} +.compressx-general-settings-body .compressx-lazyload{ + margin-top: 1rem; + padding: 0 1rem; +} + + +.compressx-general-settings-body .compressing-strategy{ + padding: 1rem 0; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + margin-bottom: 1rem; +} +.compressx-general-settings-body .compressing-strategy-custom{ + border-left: 4px solid var(--color-grey); + padding-left: 1rem; +} +.compressx-general-settings-body .custom-jpgpng{ + display:block; + padding:0 0 1rem 0; +} +.compressx-general-settings-body .custom-jpgpng input{ + width:3rem; +} +.compressx-general-settings-body .custom-webp{ + display:block; + padding:0 0 1rem 0; +} +.compressx-general-settings-body .custom-avif{ + display:block; + padding:0 0 1rem 0; +} +.compressx-general-settings-body .custom-gif{ + display:block; + padding:0 0 1rem 0; +} +.compressx-general-settings-body .custom-pdf{ + display:block; + padding:0 0 1rem 0; +} +.compressx-general-settings-body .cx-title{ + padding:0.3rem 0.5rem; +} +.compressx-general-settings-body .cx-medialibrary-rules, +.compressx-general-settings-body .cx-custom-rules{ + padding-left:2rem; +} + +.compressx-general-settings-body .cx-uploads-advanced{ + display: block; + padding:0.5rem 0; + margin-top: 1rem; + margin-bottom: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); +} +.compressx-general-settings-body .cx-uploads-rules, +.compressx-general-settings-body .cx-mediafolder-rules{ + display:grid; + grid-template-columns: 1fr 2fr; + gap:1rem; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-icon-color-yellow{ + color:var(--color-dark-yellow); + font-size:1rem; + padding-top: 0.1rem; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-icon-color-techblue{ + color:var(--color-tech-blue); + font-size:1rem; + padding-top: 0.1rem; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included{ + position: relative; + padding: 1rem 0; + border-radius: 10px; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer li, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list li { + position: relative; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer .cx-remove-rule, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list .cx-remove-rule{ + position: absolute; + right:0; + cursor:pointer; + color: var(--color-grey-black); + font-size: 1rem; + padding-top: 0.1rem; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list{ + margin-top: 1rem; + border: 1px solid var(--color-grey); + border-radius: 4px; + padding: 0 0.5rem; + height: 200px; + overflow-y: auto; + overflow-x: auto; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list ul{ + padding: 0; +} +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list li:nth-child(odd), +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer li:nth-child(odd){ + background-color: var(--color-light-grey); +} + +.compressx-general-settings-body .different-sizes span{ + display: block; + padding:1rem 0 0 1rem; +} +.compressx-general-settings-body .width span{ + display: block; + padding:1rem 0 0 1rem; +} + +.compressx-general-settings-body .rules{ + padding: 1rem 0; +} +.compressx-general-settings-body .rules span{ + display: block; + grid-row-gap:1rem; +} +.compressx-general-settings-body textarea{ + width:100%; + height:100px; + text-align:left; + border:1px solid var(--color-grey); +} + +.compressing-converting-information{ + border: 1px solid var(--color-grey); + border-radius: 3px; + background-color: var(--color-notification); + padding: 1rem; +} +.compressx-compression-level{ + display: flex; + gap: 20px; + margin: 20px 0; + flex-wrap: wrap; +} + +.compressx-compression-level-items{ + display: flex; + align-items: center; + gap: 8px; +} +.compressx-compression-level-item-high{ + width: 16px; + height: 16px; + display: inline-block; + vertical-align:middle; + border-radius: 2px; +} +.compressing-converting-information .dashicons-lightbulb{ + color:var(--color-light-blue); +} +.compressx-4-cols{ + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 1rem; +} +.compressx-4-cols-single-col{ + padding: 0rem 1rem 1rem 1rem; + border: 1px solid var(--color-grey); + background-color: var(--color-bg-block); + border-radius: 3px; +} +.compressx-4-cols-single-col h5{ + font-size: 1rem; + color: var(--color-light-blue-2); +} +/******************************Compressx table******************************************************/ +.compressx-table{ + margin-bottom: 1rem; +} +.compressx-table-5-cols-header{ + display: grid; + grid-template-columns: 2fr 1fr 1fr 1fr 1fr; + gap: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-5-cols-body{ + display: grid; + grid-template-columns: 2fr 1fr 1fr 1fr 1fr; + gap: 1rem; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + padding-left: 0.5rem; +} +.compressx-table-5-cols-body:hover{ + display: grid; + grid-template-columns: 2fr 1fr 1fr 1fr 1frr; + gap: 1rem; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + background-color: var(--color-notification); + padding-left: 0.5rem; +} +.compressx-table-5-cols-footer{ + display: grid; + grid-template-columns: 2fr 1fr 1fr 1fr 1fr; + gap: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-4-cols-header{ + display: grid; + grid-template-columns: 2fr 1fr 2fr 1fr; + gap: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-4-cols-body{ + display: grid; + grid-template-columns: 2fr 1fr 2fr 1fr; + gap: 1rem; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + padding-left: 0.5rem; +} +.compressx-table-4-cols-body:hover{ + display: grid; + grid-template-columns: 2fr 1fr 2fr 1fr; + gap: 1rem; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + background-color: var(--color-notification); + padding-left: 0.5rem; +} +.compressx-table-4-cols-footer{ + display: grid; + grid-template-columns: 2fr 1fr 3fr; + gap: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-3-cols-header{ + display: grid; + grid-template-columns: 2fr 1fr 1fr; + gap: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-3-cols-body{ + display: grid; + grid-template-columns: 2fr 1fr 1fr; + gap: 1rem; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + padding-left: 0.5rem; +} +.compressx-table-3-cols-body:hover{ + display: grid; + grid-template-columns: 2fr 1fr 1fr; + gap: 1rem; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + background-color: var(--color-notification); + padding-left: 0.5rem; +} +.compressx-table-3-cols-footer{ + display: grid; + grid-template-columns: 2fr 1fr 1fr; + gap: 1rem; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-2-cols-header{ + display: flex; + justify-content: space-between; + align-items: center; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-2-cols-body{ + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + padding-left: 0.5rem; +} +.compressx-table-2-cols-body:hover{ + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid var(--color-dark-grey); + padding: 1rem 0; + background-color: var(--color-notification); + padding-left: 0.5rem; +} +.compressx-table-2-cols-footer{ + display: flex; + justify-content: space-between; + align-items: center; + border-top: 1px solid var(--color-grey); + border-bottom: 1px solid var(--color-grey); + background-color:var(--color-light-grey); + padding: 0.5rem; +} +.compressx-table-row{ + display: inline-flex; + align-items: center; + gap: 10px; +} +/*=============================Compressx Bulk Optimization========================================*/ + +.compressx-bulk-process{ + margin-top: 1rem; + margin-bottom: 1rem; +} +.compressx-bulk-process .cx-process-bar{ + padding: 1rem 0 0 0; +} +.compressx-bulk-process .cx-process-bar-100{ + display: block; + width: 100%; + height: .2rem; + background-color: var(--color-grey); + border-radius: 2px; +} + +.compressx-bulk-process .cx-process-bar-percentage{ + display: block; + width: 48%; + height: .2rem; + background-color: var(--color-dark-green); + border-radius: 2px; +} +.cx-watermark-list{ + display: grid; + grid-template-columns: repeat(1, 1fr); + gap:1rem; + padding: 1rem 0; + max-height: 250px; + overflow: auto; + margin-bottom: 1rem; +} +.cx-thumbnails-formats{ + display: grid; + grid-template-columns: repeat(4, 1fr); + gap:1rem; + padding: 1rem 0; +} +.cx-watermark-postion table{ + border:1px solid var(--color-grey); + border-collapse: collapse; + width: 150px; + margin-top: 1rem; + text-align: center; +} +.cx-watermark-postion tr{ + border:1px solid var(--color-grey); +} +.cx-watermark-postion td{ + border:1px solid var(--color-grey); +} +/*=============================Compressx step bar starts=====================================*/ +.compressx-bulk-process .cx-stepper-wrapper { + margin-top: auto; + display: flex; + justify-content: space-between; + margin-bottom: 20px; +} +.compressx-bulk-process .cx-stepper-item { + position: relative; + display: flex; + flex-direction: column; + align-items: center; + flex: 1; + +@media (max-width: 768px) { + font-size: 12px; +} +} + +.compressx-bulk-process .cx-stepper-item::before { + position: absolute; + content: ""; + border-bottom: 2px solid #ccc; + width: 100%; + top: 20px; + left: -50%; + z-index: 2; +} + +.compressx-bulk-process .cx-stepper-item::after { + position: absolute; + content: ""; + border-bottom: 2px solid #ccc; + width: 100%; + top: 20px; + left: 50%; + z-index: 2; +} + +.compressx-bulk-process .cx-stepper-item .cx-step-counter { + position: relative; + z-index: 5; + display: flex; + justify-content: center; + align-items: center; + width: 40px; + height: 40px; + border-radius: 50%; + background: #ccc; + margin-bottom: 6px; +} + +.compressx-bulk-process .cx-stepper-item.cx-active { + font-weight: bold; +} + +.compressx-bulk-process .cx-stepper-item.completed .cx-step-counter { + background-color: var(--color-dark-green); +} + +.compressx-bulk-process .cx-stepper-item.cx-completed::after { + position: absolute; + content: ""; + border-bottom: 2px solid var(--color-dark-green); + width: 100%; + top: 20px; + left: 50%; + z-index: 3; +} + +.compressx-bulk-process .cx-stepper-item:first-child::before { + content: none; +} +.compressx-bulk-process .cx-stepper-item:last-child::after { + content: none; +} +/*=============================Compressx step bar ends=======================================*/ +/******************************CompressX Offload**********************************************/ +.cx-offload-border-bottom{ + border-bottom: 1px solid var(--color-grey); + margin-bottom: 1rem; +} +/*=============================Compressx Addons Starts========================================*/ +.compressx-container .cx-addons { + border: 1px solid var(--color-grey); + border-radius: 6px; + background-color: var(--color-background); + padding: 1rem; +} +.compressx-container .cx-addons .cx-addons-icon-block { + width:5rem; + height: 5rem; + padding-top:0.5rem; + float: left; +} +.compressx-container .cx-addons .cx-addons-icon-block .compressx-icon-style { + font-size: 3rem; + color: var(--color-light-blue); +} +.compressx-container .cx-addons h5{ + font-size: 0.8rem; + color: var(--color-title); +} +/*=============================Compressx Addons End========================================*/ + +/******************************Compressx Advanced Rules************************************/ +.compresx-add-advanced-rules-section{ + + margin-bottom: 1rem; +} +/*=============================Compressx Lazyload========================================*/ +.compressx-general-settings-body .compressx-lazyload .compressx-lazyload-information{ + border: 1px solid var(--color-grey); + border-radius: 10px; + background-color: var(--color-notification); + padding: 1rem; +} +.compressx-general-settings-body .compressx-lazyload .compressx-lazyload-information .dashicons-lightbulb{ + color:var(--color-light-blue); +} + +.compressx-general-settings-body .compressx-lazyload-settings, +.compressx-general-settings-body .compressx-lazyload-location, +.compressx-general-settings-body .compressx-lazyload-compat, +.compressx-general-settings-body .compressx-lazyload-insert, +.compressx-general-settings-body .compressx-lazyload-exclude +{ + border-left: 4px solid var(--color-grey); + padding-left: 1rem !important; + padding:0 0 0 0; + margin-bottom: 0.5rem; +} +.compressx-general-settings-body .compressx-lazyload-settings .media-type, +.compressx-general-settings-body .compressx-lazyload-location .lazyload-location, +.compressx-general-settings-body .compressx-lazyload-compat .compat, +.compressx-general-settings-body .compressx-lazyload-insert .insert, +.compressx-general-settings-body .compressx-lazyload-exclude .exclude +{ + display: block; + padding:0 0 0.5rem 0; +} +.compressx-general-settings-body .compressx-lazyload-settings .media-type span, +.compressx-general-settings-body .compressx-lazyload-location .lazyload-location span, +.compressx-general-settings-body .compressx-lazyload-compat .compat span, +.compressx-general-settings-body .compressx-lazyload-insert .insert span, +.compressx-general-settings-body .compressx-lazyload-exclude .exclude span +{ + padding-right: 1rem; +} +/*==============================Logs Table Style=================================*/ + +.compressx-bulk-log .cx-table, +.compressx-logs .cx-table{ + border-radius: 4px; + border:1px solid var(--color-grey); +} +.compressx-bulk-log .cx-icon-success, +.compressx-logs .cx-icon-success{ + color: var(--color-light-green); +} + +.compressx-bulk-log .cx-icon-warning, +.compressx-logs .cx-icon-warning{ + color: var(--color-dark-orange); +} +.compressx-bulk-log .cx-icon-error, +.compressx-logs .cx-icon-error{ + color:var(--color-dark-red); +} +.compressx-bulk-log .cx-icon-fatal-error, +.compressx-logs .cx-icon-fatal-error{ + color: var(--color-dark-red); +} +.compressx-bulk-log .cx-table-header th, +.compressx-bulk-log .cx-table-footer th, +.compressx-logs .cx-table-header td, +.compressx-logs .cx-table-header th, +.compressx-logs .cx-table-footer td, +.compressx-logs .cx-table-footer th{ + font-size: 0.75rem !important; +} +/**************************Compression Test***********************************/ +.compressx-container .cx-compression-level{ + padding: 0.3rem 0.4rem; + color: var(--color-grey-black); + border: 1px solid var(--color-grey-black); + + border-radius: 0.3rem; +} +.compressx-container .cx-compression-level-custom{ + background-color: var(--color-notification); + border: 1px solid var(--color-grey); + padding:0.8rem 1rem; + border-radius: 0.25rem; +} +.compressx-container .cx-uploaded-test{ + padding: 0.5rem 0; + border-top:1px solid var(--color-grey); + border-bottom:1px solid var(--color-grey); + margin-bottom: 1rem; +} +.compressx-container .cx-upload-block{ + margin-bottom: 1rem; +} +.compressx-container .cx-display-test{ + margin-bottom: 1rem; +} +.compressx-container .cx-display-result{ + padding: 0.5rem 0 0.5rem 0.5rem; +} +.compressx-container .cx-display-images{ + box-shadow: 1px 2px 2px 5px rgba(0, 0, 0, 0.01); +} +.cx-switch-user-cap{ + padding-bottom: 1rem; +} +/*************************Tooltip*********************************************/ +/* tooltip */ +.compressx-tooltip { + display:inline-block; + position:relative; + text-align:left; +} +/* tooltip - top */ +.compressx-top { + min-width:300px; + top:-20px; + left:50%; + transform:translate(-50%, -100%); + padding:10px 20px; + color:#444444; + background-color:#ffffff; + font-weight:normal; + font-size:13px; + border-radius:8px; + position:absolute; + z-index:99999999; + box-sizing:border-box; + box-shadow:0 1px 8px rgba(0,0,0,0.2); + visibility:hidden; opacity:0; transition:opacity 0.8s; +} + +.compressx-tooltip:hover .compressx-top { + visibility:visible; opacity:1; +} + +.compressx-tooltip .compressx-top i { + position:absolute; + top:100%; + left:50%; + margin-left:-12px; + width:24px; + height:12px; + overflow:hidden; +} + +.compressx-tooltip .compressx-top i::after { + content:''; + position:absolute; + width:12px; + height:12px; + left:50%; + transform:translate(-50%,-50%) rotate(45deg); + background-color:#ffffff; + box-shadow:0 1px 8px rgba(0,0,0,0.5); +} + +/* tooltip - bottom */ +.compressx-bottom { + min-width:300px; + top:40px; + left:50%; + transform:translate(-50%, 0); + padding:10px 20px; + color:#444444; + background-color:#fff; + font-weight:normal; + font-size:13px; + border-radius:8px; + position:absolute; + z-index:99999999; + box-sizing:border-box; + box-shadow:0 1px 8px rgba(0,0,0,0.2); + visibility:hidden; opacity:0; transition:opacity 0.4s; +} +.compressx-dashicons-help a{ + color: var(--color-grey-black)!important; +} +.compressx-dashicons-help a:hover{ + color: var(--color-text)!important; +} +.compressx-dashicons-help:hover .compressx-bottom { + visibility:visible; opacity:1; +} +.compressx-dashicons-white:hover .compressx-bottom{ + visibility:visible; opacity:1; +} +.compressx-tooltip .compressx-bottom i { + position:absolute; + bottom:100%; + left:50%; + margin-left:-12px; + width:24px; + height:12px; + overflow:hidden; +} + +.compressx-tooltip .compressx-bottom i::after { + content:''; + position:absolute; + width:12px; + height:12px; + left:50%; + transform:translate(-50%,50%) rotate(45deg); + background-color:#fff; + box-shadow:0 1px 8px rgba(0,0,0,0.5); +} +/* tooltip - left */ +.compressx-left { + min-width:300px; + top:50%; + right:100%; + margin-right:20px; + transform:translate(0, -50%); + padding:10px 20px; + color:#444444; + background-color:#ffffff; + font-weight:normal; + font-size:13px; + border-radius:8px; + position:absolute; + z-index:99999999; + box-sizing:border-box; + box-shadow:0 1px 8px rgba(0,0,0,0.2); + visibility:hidden; opacity:0; transition:opacity 0.8s; +} + +.compressx-tooltip:hover .compressx-left { + visibility:visible; opacity:1; +} + +.compressx-tooltip .compressx-left i { + position:absolute; + top:50%; + left:100%; + margin-top:-12px; + width:12px; + height:24px; + overflow:hidden; +} + +.compressx-tooltip .compressx-left i::after { + content:''; + position:absolute; + width:12px; + height:12px; + left:0; + top:50%; + transform:translate(-50%,-50%) rotate(-45deg); + background-color:#fff; + box-shadow:0 1px 8px rgba(0,0,0,0.5); +} +/* tooltip - right */ +.compressx-right { + min-width:300px; + top:50%; + left:100%; + margin-left:20px; + transform:translate(0, -50%); + padding:10px 20px; + color:#444444; + background-color:#ffffff; + font-weight:normal; + font-size:13px; + border-radius:8px; + position:absolute; + z-index:99999999; + box-sizing:border-box; + box-shadow:0 1px 8px rgba(0,0,0,0.2); + visibility:hidden; + opacity:0; + transition:opacity 0.8s; +} + +.compressx-tooltip:hover .compressx-right { + visibility:visible; opacity:1; +} +.compressx-installer-list li{ + padding:0.2em 0; +} +.compressx-tooltip .compressx-right i { + position:absolute; + top:50%; + right:100%; + margin-top:-12px; + width:12px; + height:24px; + overflow:hidden; +} + +.compressx-tooltip .compressx-right i::after { + content:''; + position:absolute; + width:12px; + height:12px; + left:0; + top:50%; + transform:translate(50%,-50%) rotate(-45deg); + background-color:#ffffff; + box-shadow:0 1px 8px rgba(0,0,0,0.5); +} +/* The switch - the box around the slider */ +.compressx-switch { + position: relative; + display: inline-block; + width: 32px; + height: 16px; +} + +/* Hide default HTML checkbox */ +.compressx-switch input { + opacity: 0; + width: 0; + height: 0; +} + +/* The slider */ +.compressx-slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0px; + background-color: #ccc; + -webkit-transition: .4s; + transition: .4s; +} + +.compressx-slider:before { + position: absolute; + content: ""; + height: 12px; + width: 12px; + left: 2px; + bottom: 2px; + background-color: white; + -webkit-transition: .4s; + transition: .4s; +} + +input:checked + .compressx-slider { + background-color: var(--color-light-blue); +} + +input:focus + .compressx-slider { + box-shadow: 0 0 1px var(--color-light-blue); +} + + +input:checked + .compressx-slider:before { + -webkit-transform: translateX(16px); + -ms-transform: translateX(16px); + transform: translateX(16px); +} + +/* Rounded sliders */ +.compressx-slider.compressx-round { + border-radius: 16px; +} + +.compressx-slider.compressx-round:before { + border-radius: 50%; +} +/*==============================Logs Table Style=================================*/ +/* pc width > 1024px */ + +/* ipad pro */ +@media screen and (max-width: 1024px) { + + #compressx-wrap{ + padding-left: 1rem; + padding-right: 1rem; + } + .compressx-container{ + width: 100%; + margin: 0 auto; + box-sizing: border-box; + } + .compressx-menu{ + padding: 0 1rem; + } + .compressx-container .compressx-servers-header{ + padding-top: 0.1rem; + display: block; + } + .compressx-notification .cx-rating{ + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 1rem; + padding-top: 1rem; + padding-bottom: 1rem; + text-align: center; + } + .tablenav .tablenav-pages { + float: left; + padding-top:1rem; + margin: 0 0 9px; + width: 100%; + } + .compressx-container .compressx-servers-header-api{ + width: 100%; + margin-bottom: 1rem; + } + .compressx-header-block{ + display:grid; + grid-template-columns: 1fr; + + } + .compressx-container .cx-table-overflow{ + overflow: auto; + border: 0 !important; + } +} +/* ipad */ +@media screen and (max-width: 768px) { + #compressx-wrap{ + padding-left: 1rem; + padding-right: 1rem; + } + .compressx-notification .cx-rating{ + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 1rem; + padding-top: 1rem; + padding-bottom: 1rem; + text-align: center; + } + .compressx-container{ + width: 100%; + margin: 0 auto; + } + .compressx-container .compressx-servers-header{ + padding-top: 0.1rem; + display: block; + } + .compressx-container .compressx-servers-header-api{ + width: 100%; + margin-bottom: 1rem; + } + .compressx-general-settings-body-grid, + .compressx-addons-grid{ + display:grid; + grid-template-columns: 1fr; + gap:1rem; + } + .compressx-general-settings-body-grid-768{ + border: 1px solid var(--color-grey); + padding-bottom: 1rem; + } + .compressx-container .cx-logs-table{ + overflow-y: auto; + } + .compressx-general-settings-body .cx-uploads-rules, + .compressx-general-settings-body .cx-mediafolder-rules{ + display: grid; + grid-template-columns: 1fr; + gap: 1rem; + } +} +/* iphone 12 13 14pro */ +@media screen and (max-width: 430px) { + body { + + .compressx-container{ + width: 100%; + margin: 0 auto; + } + .compressx-notification .cx-rating{ + display: grid; + grid-template-columns: repeat(1, 1fr); + gap: 1rem; + padding-top: 1rem; + padding-bottom: 1rem; + text-align: center; + } + .compressx-container .compressx-servers-header{ + padding-top: 0.1rem; + display: block; + } + .compressx-container .compressx-servers-header-api{ + width: 100%; + margin-bottom: 1rem; + } + .compressx-header-block .cx-overview_body{ + display:grid; + grid-template-columns: 1fr 1fr; + gap:1rem; + } + .compressx-header-block .cx-overview_body-free{ + display:grid; + grid-template-columns: 1fr; + padding:0 0 1rem 0; + } + .compressx-general-settings-body .others{ + padding:0; + } + .compressx-general-settings-body .compressx-lazyload { + padding: 0; + } + .compressx-header-block .cx-overview_body-webp-free{ + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 0.5rem; + } + .compressx-header-block .cx-processedsize{ + display: none; + } + .compressx-menu .cx-menu-ul-large{ + display: none; + } + .compressx-menu .cx-menu-ul-mini{ + display: inline-block; + } + .compressx-general-settings-body .cx-uploads-rules, + .compressx-general-settings-body .cx-mediafolder-rules{ + display:grid; + grid-template-columns: 1fr; + gap:1rem; + } + .compressx-bulk-log .cx-title .cx-bulk-opt-results{ + display: none; + } + +} +} + diff --git a/wp-content/plugins/compressx/includes/display/css/compressx-twentytwenty-custom.css b/wp-content/plugins/compressx/includes/display/css/compressx-twentytwenty-custom.css new file mode 100644 index 0000000..996927c --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/css/compressx-twentytwenty-custom.css @@ -0,0 +1,102 @@ +/* Custom styles for TwentyTwenty integration with CompressX */ + +/* Ensure TwentyTwenty container fits properly */ +.twentytwenty-container { + position: relative !important; + width: 100% !important; + height: 100% !important; + min-height: 280px; + background: #ffffff !important; + border-radius: 6px; + overflow: hidden; +} + +/* Ensure images maintain aspect ratio */ +.twentytwenty-container img { + max-width: 100% !important; + height: auto !important; + display: block; +} + +/* Override any conflicting flex styles */ +.twentytwenty-container.compressx-v2-flex { + display: block !important; +} + +/* Ensure proper overlay positioning */ +.twentytwenty-overlay { + background: rgba(0, 0, 0, 0) !important; +} + +/* Custom handle styling to match CompressX theme */ +.twentytwenty-handle { + border: 3px solid #3b82f6 !important; + background: #ffffff !important; +} + +.twentytwenty-handle:before, +.twentytwenty-handle:after { + background: #3b82f6 !important; +} + +/* Enhanced visibility */ +.twentytwenty-container::before { + content: ''; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: #ffffff; + z-index: -1; +} + +/* Improved image visibility */ +.twentytwenty-container img { + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); +} + +/* Better overlay contrast */ +.twentytwenty-overlay { + background: rgba(0, 0, 0, 0) !important; + color: #ffffff !important; + font-weight: 600 !important; +} + +/* Responsive adjustments */ +@media (max-width: 768px) { + .twentytwenty-container { + min-height: 200px; + } + + .twentytwenty-overlay { + font-size: 11px !important; + } +} + +/* Prevent FOUC (Flash of Unstyled Content) */ +.cx-comparison-placeholder { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; +} + +/* Loading state */ +.twentytwenty-container.loading { + opacity: 0.7; +} + +.twentytwenty-container.loading::after { + content: "Loading..."; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + background: rgba(255, 255, 255, 0.9); + padding: 10px 20px; + border-radius: 4px; + font-size: 14px; + color: #666; +} diff --git a/wp-content/plugins/compressx/includes/display/css/twentytwenty/twentytwenty.css b/wp-content/plugins/compressx/includes/display/css/twentytwenty/twentytwenty.css new file mode 100644 index 0000000..e42c889 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/css/twentytwenty/twentytwenty.css @@ -0,0 +1,206 @@ +.twentytwenty-horizontal .twentytwenty-handle:before, .twentytwenty-horizontal .twentytwenty-handle:after, .twentytwenty-vertical .twentytwenty-handle:before, .twentytwenty-vertical .twentytwenty-handle:after { + content: " "; + display: block; + background: white; + position: absolute; + z-index: 30; + -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-horizontal .twentytwenty-handle:before, .twentytwenty-horizontal .twentytwenty-handle:after { + width: 3px; + height: 9999px; + left: 50%; + margin-left: -1.5px; } + +.twentytwenty-vertical .twentytwenty-handle:before, .twentytwenty-vertical .twentytwenty-handle:after { + width: 9999px; + height: 3px; + top: 50%; + margin-top: -1.5px; } + +.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay { + position: absolute; + top: 0; + width: 100%; + height: 100%; } + +.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay { + -webkit-transition-duration: 0.5s; + -moz-transition-duration: 0.5s; + transition-duration: 0.5s; } + +.twentytwenty-before-label, .twentytwenty-after-label { + -webkit-transition-property: opacity; + -moz-transition-property: opacity; + transition-property: opacity; } + +.twentytwenty-before-label:before, .twentytwenty-after-label:before { + color: white; + font-size: 13px; + letter-spacing: 0.1em; } + +.twentytwenty-before-label:before, .twentytwenty-after-label:before { + position: absolute; + background: rgba(255, 255, 255, 0.2); + line-height: 38px; + padding: 0 20px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; } + +.twentytwenty-horizontal .twentytwenty-before-label:before, .twentytwenty-horizontal .twentytwenty-after-label:before { + top: 50%; + margin-top: -19px; } + +.twentytwenty-vertical .twentytwenty-before-label:before, .twentytwenty-vertical .twentytwenty-after-label:before { + left: 50%; + margin-left: -45px; + text-align: center; + width: 90px; } + +.twentytwenty-left-arrow, .twentytwenty-right-arrow, .twentytwenty-up-arrow, .twentytwenty-down-arrow { + width: 0; + height: 0; + border: 6px inset transparent; + position: absolute; } + +.twentytwenty-left-arrow, .twentytwenty-right-arrow { + top: 50%; + margin-top: -6px; } + +.twentytwenty-up-arrow, .twentytwenty-down-arrow { + left: 50%; + margin-left: -6px; } + +.twentytwenty-container { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + z-index: 0; + overflow: hidden; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; } + .twentytwenty-container img { + max-width: 100%; + position: absolute; + top: 0; + display: block; } + .twentytwenty-container.active .twentytwenty-overlay, .twentytwenty-container.active :hover.twentytwenty-overlay { + background: rgba(0, 0, 0, 0); } + .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-before-label, + .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-after-label, .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-before-label, + .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-after-label { + opacity: 0; } + .twentytwenty-container * { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; } + +.twentytwenty-before-label { + opacity: 0; } + .twentytwenty-before-label:before { + content: attr(data-content); } + +.twentytwenty-after-label { + opacity: 0; } + .twentytwenty-after-label:before { + content: attr(data-content); } + +.twentytwenty-horizontal .twentytwenty-before-label:before { + left: 10px; } + +.twentytwenty-horizontal .twentytwenty-after-label:before { + right: 10px; } + +.twentytwenty-vertical .twentytwenty-before-label:before { + top: 10px; } + +.twentytwenty-vertical .twentytwenty-after-label:before { + bottom: 10px; } + +.twentytwenty-overlay { + -webkit-transition-property: background; + -moz-transition-property: background; + transition-property: background; + background: rgba(0, 0, 0, 0); + z-index: 25; } + .twentytwenty-overlay:hover { + background: rgba(0, 0, 0, 0.5); } + .twentytwenty-overlay:hover .twentytwenty-after-label { + opacity: 1; } + .twentytwenty-overlay:hover .twentytwenty-before-label { + opacity: 1; } + +.twentytwenty-before { + z-index: 20; } + +.twentytwenty-after { + z-index: 10; } + +.twentytwenty-handle { + height: 38px; + width: 38px; + position: absolute; + left: 50%; + top: 50%; + margin-left: -22px; + margin-top: -22px; + border: 3px solid white; + -webkit-border-radius: 1000px; + -moz-border-radius: 1000px; + border-radius: 1000px; + -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + z-index: 40; + cursor: pointer; } + +.twentytwenty-horizontal .twentytwenty-handle:before { + bottom: 50%; + margin-bottom: 22px; + -webkit-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } +.twentytwenty-horizontal .twentytwenty-handle:after { + top: 50%; + margin-top: 22px; + -webkit-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-vertical .twentytwenty-handle:before { + left: 50%; + margin-left: 22px; + -webkit-box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } +.twentytwenty-vertical .twentytwenty-handle:after { + right: 50%; + margin-right: 22px; + -webkit-box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-left-arrow { + border-right: 6px solid white; + left: 50%; + margin-left: -17px; } + +.twentytwenty-right-arrow { + border-left: 6px solid white; + right: 50%; + margin-right: -17px; } + +.twentytwenty-up-arrow { + border-bottom: 6px solid white; + top: 50%; + margin-top: -17px; } + +.twentytwenty-down-arrow { + border-top: 6px solid white; + bottom: 50%; + margin-bottom: -17px; } diff --git a/wp-content/plugins/compressx/includes/display/js/compressx.js b/wp-content/plugins/compressx/includes/display/js/compressx.js new file mode 100644 index 0000000..3ba48f8 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/compressx.js @@ -0,0 +1,74 @@ + +function compressx_post_request(ajax_data, callback, error_callback, time_out) +{ + if(typeof time_out === 'undefined') time_out = 30000; + ajax_data.nonce=compressx_ajax_object.ajax_nonce; + jQuery.ajax({ + type: "post", + url: compressx_ajax_object.ajax_url, + data: ajax_data, + success: function (data) { + callback(data); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + error_callback(XMLHttpRequest, textStatus, errorThrown); + }, + timeout: time_out + }); +} + +function compressx_output_ajaxerror(action, textStatus, errorThrown){ + //action = 'trying to establish communication with your server'; + var error_msg = "compressx_request: "+ textStatus + "(" + errorThrown + "): an error occurred when " + action + ". " + + "It could be because the request did not reach or the server did not respond. Please try again later."; + return error_msg; +} + +function compressx_ajax_data_transfer(data_type) +{ + var json = {}; + jQuery('input:checkbox[option='+data_type+']').each(function() { + var value = '0'; + var key = jQuery(this).prop('name'); + if(jQuery(this).prop('checked')) { + value = '1'; + } + else { + value = '0'; + } + json[key]=value; + }); + jQuery('input:radio[option='+data_type+']').each(function() { + if(jQuery(this).prop('checked')) + { + var key = jQuery(this).prop('name'); + var value = jQuery(this).prop('value'); + json[key]=value; + } + }); + jQuery('input:text[option='+data_type+']').each(function(){ + var obj = {}; + var key = jQuery(this).prop('name'); + var value = jQuery(this).val(); + json[key]=value; + }); + jQuery('textarea[option='+data_type+']').each(function(){ + var obj = {}; + var key = jQuery(this).prop('name'); + var value = jQuery(this).val(); + json[key]=value; + }); + jQuery('input:password[option='+data_type+']').each(function(){ + var obj = {}; + var key = jQuery(this).prop('name'); + var value = jQuery(this).val(); + json[key]=value; + }); + jQuery('select[option='+data_type+']').each(function(){ + var obj = {}; + var key = jQuery(this).prop('name'); + var value = jQuery(this).val(); + json[key]=value; + }); + return JSON.stringify(json); +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/compressx_custom_bulk.js b/wp-content/plugins/compressx/includes/display/js/compressx_custom_bulk.js new file mode 100644 index 0000000..2772c08 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/compressx_custom_bulk.js @@ -0,0 +1,426 @@ + +var cx_cancel_custom_bulk_optimization=false; + +jQuery('#compressx_start_custom_bulk_optimization').click(function() +{ + compressx_start_custom_bulk_optimization(); +}); + +jQuery('#compressx_cancel_custom_bulk_optimization').click(function() +{ + var descript = 'Are you sure to cancel this progressing?'; + + var ret = confirm(descript); + if(ret === true) + { + cx_cancel_custom_bulk_optimization=true; + jQuery('#compressx_cancel_custom_bulk_optimization').css({'pointer-events': 'none', 'opacity': '0.4'}); + } +}); + +function compressx_custom_bulk_optimization_canceled() +{ + jQuery('#cx_custom_bulk_progress_text').hide(); + + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_cancel_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + + compressx_get_dir_info(); +} + +function compressx_start_custom_bulk_optimization() +{ + var ajax_data = { + 'action': 'compressx_start_scan_custom_images', + }; + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#cx_custom_bulk_progress_text').show(); + jQuery('#cx_custom_bulk_progress_text').html("Processing..."); + jQuery('#cx_custom_overview').hide(); + + jQuery('#compressx_cancel_custom_bulk_optimization').show(); + jQuery('#compressx_start_custom_bulk_optimization').hide(); + cx_cancel_custom_bulk_optimization=false; + + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_custom_bulk_optimization) + { + compressx_custom_bulk_optimization_canceled(); + alert("The process has been canceled"); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + if(jsonarray.finished==true) + { + jQuery('#cx_custom_bulk_progress_text').html(jsonarray.progress); + compressx_init_custom_bulk_optimization_task(); + } + } + else + { + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_bulk_progress_text').hide(); + jQuery('#cx_custom_overview').show(); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + alert(jsonarray.error); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_bulk_progress_text').hide(); + jQuery('#cx_custom_overview').show(); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('scan images', textStatus, errorThrown); + alert(error_message); + }); +} + +function compressx_init_custom_bulk_optimization_task() +{ + var force="0"; + + if(jQuery('#cx_custom_force_optimization').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + + var ajax_data = { + 'action': 'compressx_init_custom_bulk_optimization_task', + 'force':force + }; + jQuery('#compressx_bulk_progress_step2').addClass("cx-active"); + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_custom_bulk_optimization) + { + compressx_custom_bulk_optimization_canceled(); + alert("The process has been canceled"); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + compressx_run_custom_optimize(); + } + else + { + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_bulk_progress_text').hide(); + jQuery('#cx_custom_overview').show(); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + alert(jsonarray.error); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_bulk_progress_text').hide(); + jQuery('#cx_custom_overview').show(); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('start bulk optimization', textStatus, errorThrown); + alert(error_message); + }); +} + +function compressx_run_custom_optimize() +{ + var ajax_data = { + 'action': 'compressx_run_custom_optimize', + }; + + compressx_post_request(ajax_data, function (data) + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + compressx_get_custom_optimize_task_status(); + } + else + { + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_bulk_progress_text').hide(); + jQuery('#cx_custom_overview').show(); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + alert(jsonarray.error); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + compressx_get_custom_optimize_task_status(); + }); +} + +function compressx_get_custom_optimize_task_status() +{ + var ajax_data = { + 'action': 'compressx_get_custom_opt_progress' + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === 'success') + { + jQuery('#cx_custom_bulk_progress_text').html(jsonarray.log); + if(jsonarray.continue) + { + setTimeout(function () + { + compressx_get_custom_optimize_task_status(); + }, 1000); + } + else if(jsonarray.finished) + { + compressx_get_dir_info(); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#cx_custom_bulk_progress_text').hide(); + jQuery('#cx_custom_overview').show(); + + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + compressx_custom_show_review_box(jsonarray); + } + else + { + if(cx_cancel_custom_bulk_optimization) + { + compressx_custom_bulk_optimization_canceled(); + alert("The process has been canceled"); + return; + } + compressx_run_custom_optimize(); + } + } + else if (jsonarray.result === 'failed') + { + if(jsonarray.timeout) + { + if(cx_cancel_custom_bulk_optimization) + { + compressx_custom_bulk_optimization_canceled(); + alert("The process has been canceled"); + return; + } + compressx_run_custom_optimize(); + } + else + { + alert(jsonarray.error); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#cx_custom_bulk_progress_text').hide(); + + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_overview').show(); + } + } + } + catch(err) + { + alert(err); + jQuery('#compressx_start_custom_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#cx_custom_bulk_progress_text').hide(); + + jQuery('#compressx_cancel_custom_bulk_optimization').hide(); + jQuery('#compressx_start_custom_bulk_optimization').show(); + + jQuery('#cx_custom_overview').show(); + } + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + setTimeout(function () + { + compressx_get_custom_optimize_task_status(); + }, 1000); + }); +} + +function compressx_custom_show_review_box(jsonarray) +{ + if(jsonarray.show_review) + { + jQuery('#cx_rating_box').show(); + jQuery('#cx_size_of_opt_images').html(jsonarray.opt_size); + } +} + +function compressx_get_dir_info() +{ + var ajax_data = { + 'action': 'compressx_get_dir_info', + }; + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + jQuery('#cx_custom_founds').html(jsonarray.found); + jQuery('#cx_custom_total_saving').html(jsonarray.saved); + jQuery('#cx_custom_processed').html(jsonarray.processed); + } + } + catch (err) + { + //alert(err); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +} + +function compressx_init_custom_exclude_tree() +{ + jQuery('#compressx_custom_include_js_tree').on('activate_node.jstree', function (event, data) { + }).jstree({ + "core": { + "check_callback": true, + "multiple": true, + "data": function (node_id, callback) { + var tree_node = { + 'node': node_id, + 'path': compressx_uploads_root.custom_path + }; + var ajax_data = { + 'action': 'compressx_get_custom_tree_dir_ex', + 'tree_node': tree_node, + }; + ajax_data.nonce=compressx_ajax_object.ajax_nonce; + jQuery.ajax({ + type: "post", + url: compressx_ajax_object.ajax_url, + data: ajax_data, + success: function (data) { + var jsonarray = jQuery.parseJSON(data); + callback.call(this, jsonarray.nodes); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + //alert("error"); + }, + timeout: 30000 + }); + }, + 'themes': { + 'stripes': true + } + }, + "plugins": ["sort"], + "sort": function(a, b) { + a1 = this.get_node(a); + b1 = this.get_node(b); + if (a1.icon === b1.icon) { + return (a1.text.toLowerCase() > b1.text.toLowerCase()) ? 1 : -1; + } else { + return (a1.icon > b1.icon) ? 1 : -1; + } + }, + }); +} + +jQuery(document).ready(function () +{ + compressx_init_custom_exclude_tree(); +}); + +jQuery('#compressx_custom_include_js_tree').on('click', '.cx-add-custom-include-tree', function() +{ + var id=jQuery(this).data("id"); + var ajax_data = { + 'action': 'compressx_add_include_folders', + 'id': id, + }; + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + jQuery('#cx_custom_founds').html(jsonarray.found); + jQuery('#cx_custom_total_saving').html(jsonarray.saved); + jQuery('#cx_custom_processed').html(jsonarray.processed); + jQuery('#compressx_include_dir_node').html(jsonarray.html); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); + +}); + +jQuery('#compressx_include_dir_node').on('click', '.cx-remove-custom-include-tree', function() +{ + var id=jQuery(this).data("id"); + var node=jQuery(this).parent(); + var ajax_data = { + 'action': 'compressx_remove_include_folders', + 'id': id, + }; + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + jQuery('#cx_custom_founds').html(jsonarray.found); + jQuery('#cx_custom_total_saving').html(jsonarray.saved); + jQuery('#cx_custom_processed').html(jsonarray.processed); + node.remove(); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); + +}); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/compressx_log.js b/wp-content/plugins/compressx/includes/display/js/compressx_log.js new file mode 100644 index 0000000..cdf7f2a --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/compressx_log.js @@ -0,0 +1,297 @@ +jQuery('#cx_edit_apiserver').click(function() +{ + jQuery('#cx_apiserver').hide(); + jQuery('#cx_apiserver_edit').show(); +}); + +jQuery('#cx_apiserver_edit_btn').click(function() +{ + jQuery('#cx_apiserver_edit_progress').show(); + var api_server=jQuery('#cx_apiserver_select').val(); + var ajax_data = { + 'action': 'compressx_set_api_server', + 'api_server': api_server, + }; + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'none', 'opacity': '0.4'}); + compressx_post_request(ajax_data, function (data) + { + jQuery('#cx_apiserver_edit_progress').hide(); + try + { + var jsonarray = jQuery.parseJSON(data); + + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'auto', 'opacity': '1'}); + if (jsonarray.result === 'success') + { + // + jQuery('#cx_apiserver_text').html(jsonarray.html); + jQuery('#cx_apiserver').show(); + jQuery('#cx_apiserver_edit').hide(); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#cx_apiserver_edit_progress').hide(); + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('set api server', textStatus, errorThrown); + alert(error_message); + }); +}); + +jQuery('#cx_log_list').on("click",'#cx_log_search_by_date',function() +{ + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + + compressx_get_logs_list(start_date,start_time,end_date,end_time); + +}); + +jQuery('#cx_log_list').on("click",'.first-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + compressx_get_logs_list(start_date,start_time,end_date,end_time,'first'); +}); + +jQuery('#cx_log_list').on("click",'.prev-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + var page=parseInt(jQuery(this).attr('value')); + compressx_get_logs_list(start_date,start_time,end_date,end_time,page-1); +}); + +jQuery('#cx_log_list').on("click",'.next-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + var page=parseInt(jQuery(this).attr('value')); + compressx_get_logs_list(start_date,start_time,end_date,end_time,page+1); +}); + +jQuery('#cx_log_list').on("click",'.last-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + compressx_get_logs_list(start_date,start_time,end_date,end_time,'last'); +}); + +jQuery('#cx_log_list').on("keypress", '.current-page', function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + if(event.keyCode === 13){ + var page = jQuery(this).val(); + compressx_get_logs_list(start_date,start_time,end_date,end_time,page); + } +}); + +function compressx_get_logs_list(start_date,start_time,end_date,end_time,page=0) +{ + var ajax_data = { + 'action':'compressx_get_logs_list', + 'start_date':start_date, + 'start_time':start_time, + 'end_date':end_date, + 'end_time':end_time, + 'page':page + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + jQuery('#cx_log_list').html(jsonarray.html); + jQuery('#cx_log_list').find('#cx_log_start_date').val(start_date); + jQuery('#cx_log_list').find('#cx_log_start_time').val(start_time); + jQuery('#cx_log_list').find('#cx_log_end_date').val(end_date); + jQuery('#cx_log_list').find('#cx_log_end_time').val(end_time); + } + else + { + alert(jsonarray.error); + } + } + catch(err) + { + alert(err); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('get logs list', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_close_log').click(function() +{ + jQuery('#cx_log_detail_section').hide(); +}); + +jQuery('#cx_log_list').on("click",'.cs-log-detail',function() +{ + var file_name = jQuery(this).closest('td').data('id'); + compressx_open_log(file_name); +}); + +function compressx_open_log(file_name) +{ + var ajax_data = { + 'action':'compressx_open_log', + 'filename':file_name + }; + + jQuery('#cx_log_name').html(file_name); + jQuery('#cx_read_optimize_log_content').html(""); + jQuery('#cx_log_detail_section').show(); + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + jQuery('#cx_read_optimize_log_content').html(jsonarray.html); + jQuery('html, body').animate({scrollTop: jQuery("#cx_log_scroll_test").offset().top}, 'slow'); + } + else + { + jQuery('#cx_read_optimize_log_content').html(jsonarray.error); + } + } + catch(err) + { + alert(err); + var div = "Reading the log failed. Please try again."; + jQuery('#cx_read_optimize_log_content').html(div); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('open log', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_log_list').on("click",'.cs-log-download',function() +{ + var file_name = jQuery(this).closest('td').data('id'); + compressx_download_log(file_name); +}); + +function compressx_download_log(file_name) +{ + location.href =ajaxurl+'?_wpnonce='+compressx_ajax_object.ajax_nonce+'&action=compressx_download_log&log='+file_name; +} + +jQuery('#cx_log_list').on("click",'.cs-log-delete',function() +{ + var file_name = jQuery(this).closest('td').data('id'); + + var descript = 'Are you sure to delete this log file?'; + + var ret = confirm(descript); + if(ret === true) + { + compressx_delete_log(file_name); + } + +}); + +function compressx_delete_log(file_name) +{ + var ajax_data = { + 'action':'compressx_delete_log', + 'filename':file_name + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + jQuery('#cx_log_list').html(jsonarray.html); + } + else + { + alert(jsonarray.error); + } + } + catch(err) + { + alert(err); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('delete log', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_empty_log').click(function() +{ + var descript = 'Are you sure to delete All log file?'; + + var ret = confirm(descript); + if(ret === true) + { + compressx_delete_all_log(); + } +}); + +function compressx_delete_all_log() +{ + var ajax_data = { + 'action':'compressx_delete_all_log', + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + jQuery('#cx_log_list').html(jsonarray.html); + } + else + { + alert(jsonarray.error); + } + } + catch(err) + { + alert(err); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('delete log', textStatus, errorThrown); + alert(error_message); + }); +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/compressx_setting.js b/wp-content/plugins/compressx/includes/display/js/compressx_setting.js new file mode 100644 index 0000000..2021f9d --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/compressx_setting.js @@ -0,0 +1,1111 @@ + +jQuery('#cx_enable_auto_optimize').click(function() +{ + var json = {}; + var value = '0'; + if(jQuery('#cx_enable_auto_optimize').prop('checked')) + { + value = '1'; + } + else { + value = '0'; + } + json['auto_optimize']=value; + var setting_data=JSON.stringify(json); + + var ajax_data = { + 'action': 'compressx_set_general_settings', + 'setting': setting_data, + }; + compressx_post_request(ajax_data, function (data) + { + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +}); + +jQuery('#cx_convert_to_webp').click(function() +{ + var value = '0'; + if(jQuery('#cx_convert_to_webp').prop('checked')) + { + value = '1'; + var descript = 'Are you sure to enable WebP as output format? This will convert your images to WebP format.'; + } + else { + value = '0'; + var descript = 'Are you sure to disable WebP as output format?'; + } + + var ret = confirm(descript); + if(ret === true) + { + var json = {}; + + + json['convert_to_webp']=value; + var setting_data=JSON.stringify(json); + + compressx_set_general_settings(setting_data); + } +}); + +jQuery('#cx_convert_to_avif').click(function() +{ + var value = '0'; + if(jQuery('#cx_convert_to_avif').prop('checked')) + { + if(jQuery('#cx_converter_method_imagick').prop('checked')) + { + if(compressx_alert.imagick_avif) + { + var descript = 'We detect that you use ImageMagick 6.x, this version has a known bug that can cause AVIF conversion timeout. Enabling AVIF conversion with this version is not recommended. Are you sure you wish to proceed?'; + } + else + { + var descript = 'Are you sure to enable AVIF as output format? This will convert your images to AVIF format.'; + } + } + else + { + var descript = 'Are you sure to enable AVIF as output format? This will convert your images to AVIF format.'; + } + + value = '1'; + } + else { + value = '0'; + var descript = 'Are you sure to disable AVIF as output format?'; + } + + var ret = confirm(descript); + if(ret === true) + { + var json = {}; + + + json['convert_to_avif']=value; + var setting_data=JSON.stringify(json); + + compressx_set_general_settings(setting_data); + } +}); + +function compressx_set_general_settings(setting_data) +{ + var ajax_data = { + 'action': 'compressx_set_general_settings', + 'setting': setting_data, + }; + compressx_post_request(ajax_data, function (data) + { + jQuery('#cx_save_convert_format').removeClass("hidden"); + setTimeout(function () + { + jQuery('#cx_save_convert_format').addClass( 'hidden' ); + }, 3000); + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +} + +//cx_close_custom_compression +jQuery('#cx_close_custom_compression').click(function() +{ + jQuery('#cx_compressing_strategy_custom').hide(); +}); + +jQuery('#cx_save_custom_quality').click(function() +{ + var json = {}; + json['quality']='custom'; + json['quality_webp']=jQuery('#cx_quality_webp').val(); + json['quality_avif']=jQuery('#cx_quality_avif').val(); + + var setting_data=JSON.stringify(json); + + var ajax_data = { + 'action': 'compressx_set_general_settings', + 'setting': setting_data, + }; + + jQuery('#cx_save_custom_quality').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#cx_save_custom_quality_progress').show(); + compressx_post_request(ajax_data, function (data) + { + jQuery('#cx_save_custom_quality_progress').hide(); + jQuery('#cx_compressing_strategy_custom').hide(); + jQuery('#cx_save_custom_quality').css({'pointer-events': 'auto', 'opacity': '1'}); + + jQuery('#cx_save_compression_level').removeClass("hidden"); + setTimeout(function () + { + jQuery('#cx_save_compression_level').addClass( 'hidden' ); + }, 3000); + + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#cx_save_custom_quality_progress').hide(); + jQuery('#cx_save_custom_quality').css({'pointer-events': 'auto', 'opacity': '1'}); + }); + +}); + +jQuery('#cx_radioCustom').click(function() +{ + jQuery('#cx_compressing_strategy_custom').show(); + + var json = {}; + json['quality']='custom'; + var setting_data=JSON.stringify(json); + + compressx_save_compression_settings(setting_data); +}); + +jQuery('#cx_radioLossless').click(function() +{ + jQuery('#cx_compressing_strategy_custom').hide(); + var json = {}; + json['quality']='lossless'; + var setting_data=JSON.stringify(json); + + compressx_save_compression_settings(setting_data); +}); + +jQuery('#cx_radioLossMinus').click(function() +{ + var json = {}; + json['quality']='lossy_minus'; + var setting_data=JSON.stringify(json); + + compressx_save_compression_settings(setting_data); + + jQuery('#cx_compressing_strategy_custom').hide(); +}); + +jQuery('#cx_radioLossy').click(function() +{ + var json = {}; + json['quality']='lossy'; + var setting_data=JSON.stringify(json); + + compressx_save_compression_settings(setting_data); + + jQuery('#cx_compressing_strategy_custom').hide(); +}); + +jQuery('#cx_radioLossyPlus').click(function() +{ + var json = {}; + json['quality']='lossy_plus'; + var setting_data=JSON.stringify(json); + + compressx_save_compression_settings(setting_data); + + jQuery('#cx_compressing_strategy_custom').hide(); +}); + +jQuery('#cx_radioLossySuper').click(function() +{ + var json = {}; + json['quality']='lossy_super'; + var setting_data=JSON.stringify(json); + + compressx_save_compression_settings(setting_data); + + jQuery('#cx_compressing_strategy_custom').hide(); +}); +//radioCustom +function compressx_save_compression_settings(setting_data) +{ + var ajax_data = { + 'action': 'compressx_set_general_settings', + 'setting': setting_data, + }; + compressx_post_request(ajax_data, function (data) + { + jQuery('#cx_save_compression_level').removeClass("hidden"); + setTimeout(function () + { + jQuery('#cx_save_compression_level').addClass( 'hidden' ); + }, 3000); + + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +} + + +var cx_cancel_bulk_optimization=false; + +jQuery('#compressx_close_progress').click(function() +{ + jQuery('#compressx_bulk_progress_2').hide(); +}); + +jQuery('#compressx_start_bulk_optimization').click(function() +{ + compressx_start_bulk_optimization(); +}); + +jQuery('#compressx_cancel_bulk_optimization').click(function() +{ + var descript = 'Are you sure to cancel this progressing?'; + + var ret = confirm(descript); + if(ret === true) + { + cx_cancel_bulk_optimization=true; + jQuery('#compressx_cancel_bulk_optimization').css({'pointer-events': 'none', 'opacity': '0.4'}); + } +}); + +function compressx_bulk_optimization_canceled(message) +{ + jQuery('#compressx_bulk_progress_part1').hide(); + jQuery('#compressx_bulk_progress_part2').show(); + jQuery('#compressx_bulk_progress_2_notice').html(message); + // + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_cancel_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + + compressx_update_overview(); +} + +function compressx_init_progress() +{ + jQuery('#compressx_bulk_progress_2').show(); + jQuery('#compressx_bulk_progress_part1').show(); + jQuery('#compressx_bulk_progress_part2').hide(); + jQuery('#compressx_bulk_progress_2_bar').width("0%"); + jQuery('#compressx_bulk_progress_step1').removeClass("cx-completed"); + jQuery('#compressx_bulk_progress_step2').removeClass("cx-completed"); + jQuery('#compressx_bulk_progress_step3').removeClass("cx-completed"); + jQuery('#compressx_bulk_progress_step1').addClass("cx-active"); + jQuery('#compressx_bulk_progress_step3').removeClass("cx-active"); + jQuery('#compressx_bulk_progress_sub_text').html(""); + jQuery('#compressx_bulk_progress_2_text').html("Processing..."); +} + +function compressx_progress_finish(message) +{ + jQuery('#compressx_bulk_progress_part1').hide(); + jQuery('#compressx_bulk_progress_part2').show(); + jQuery('#compressx_bulk_progress_2_notice').html(message); +} + +function compressx_show_review_box(jsonarray) +{ + if(jsonarray.show_review) + { + jQuery('#cx_rating_box').show(); + jQuery('#cx_size_of_opt_images').html(jsonarray.opt_size); + } +} + +function compressx_start_bulk_optimization() +{ + var force="0"; + + if(jQuery('#cx_force_optimization').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + + var ajax_data = { + 'action': 'compressx_start_scan_unoptimized_image', + 'force':force + }; + + cx_cancel_bulk_optimization=false; + + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_cancel_bulk_optimization').show(); + jQuery('#compressx_start_bulk_optimization').hide(); + // + compressx_init_progress(); + + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled("The process has been canceled"); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + if(jsonarray.finished==true) + { + jQuery('#compressx_bulk_progress_step1').addClass("cx-completed"); + jQuery('#compressx_bulk_progress_step1').removeClass("cx-active"); + jQuery('#compressx_bulk_progress_2_text').html(jsonarray.progress); + compressx_init_bulk_optimization_task(); + } + else + { + jQuery('#compressx_bulk_progress_2_text').html(jsonarray.progress); + compressx_scanning_images(jsonarray.offset); + } + } + else + { + compressx_progress_finish(jsonarray.error); + + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('scanning images', textStatus, errorThrown); + compressx_progress_finish(error_message); + }); +} + +function compressx_scanning_images(offset) +{ + var force="0"; + + if(jQuery('#cx_force_optimization').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + + var ajax_data = { + 'action': 'compressx_start_scan_unoptimized_image', + 'force':force, + 'offset':offset + }; + + cx_cancel_bulk_optimization=false; + + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled("The process has been canceled"); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + if(jsonarray.finished==true) + { + jQuery('#compressx_bulk_progress_step1').addClass("cx-completed"); + jQuery('#compressx_bulk_progress_step1').removeClass("cx-active"); + jQuery('#compressx_bulk_progress_2_text').html(jsonarray.progress); + compressx_init_bulk_optimization_task(); + } + else + { + jQuery('#compressx_bulk_progress_2_text').html(jsonarray.progress); + compressx_scanning_images(jsonarray.offset); + } + } + else + { + compressx_progress_finish(jsonarray.error); + + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('scanning images', textStatus, errorThrown); + compressx_progress_finish(error_message); + }); +} + +function compressx_init_bulk_optimization_task() +{ + // + var force="0"; + + if(jQuery('#cx_force_optimization').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + var ajax_data = { + 'action': 'compressx_init_bulk_optimization_task', + 'force':force + }; + jQuery('#compressx_bulk_progress_step2').addClass("cx-active"); + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled("The process has been canceled"); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + compressx_run_optimize(); + } + else + { + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + + compressx_progress_finish(jsonarray.error); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('start bulk optimization', textStatus, errorThrown); + compressx_progress_finish(error_message); + }); +} + +function compressx_run_optimize() +{ + var ajax_data = { + 'action': 'compressx_run_optimize', + }; + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + else + { + compressx_progress_finish(jsonarray.error); + + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + alert(jsonarray.error); + } + } + catch(err) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + compressx_get_optimize_task_status(); + }); +} + +function compressx_get_optimize_task_status() +{ + var ajax_data = { + 'action': 'compressx_get_opt_progress' + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === 'success') + { + jQuery('#compressx_bulk_progress_sub_text').html(jsonarray.sub_log); + jQuery('#compressx_bulk_progress_2_text').html(jsonarray.log); + jQuery('#compressx_bulk_progress_2_bar').width(jsonarray.percent+"%"); + //jQuery('#cx_overview').html(jsonarray.overview_html); + if(jsonarray.continue) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + else if(jsonarray.finished) + { + jQuery('#compressx_bulk_progress_step2').addClass("cx-completed"); + jQuery('#compressx_bulk_progress_step3').addClass("cx-completed"); + jQuery('#compressx_bulk_progress_step2').removeClass("cx-active"); + jQuery('#compressx_bulk_progress_step3').addClass("cx-active"); + + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + + compressx_progress_finish(jsonarray.message); + compressx_show_review_box(jsonarray); + compressx_update_overview(); + } + else + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(jsonarray.message); + return; + } + compressx_run_optimize(); + } + } + else if (jsonarray.result === 'failed') + { + if(jsonarray.timeout) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(jsonarray.message); + return; + } + compressx_run_optimize(); + } + else + { + jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + compressx_progress_finish(jsonarray.error); + + jQuery('#compressx_cancel_bulk_optimization').hide(); + jQuery('#compressx_start_bulk_optimization').show(); + } + } + } + catch(err) + { + //jQuery('#compressx_start_bulk_optimization').css({'pointer-events': 'auto', 'opacity': '1'}); + //compressx_progress_finish(err); + + //jQuery('#compressx_cancel_bulk_optimization').hide(); + //jQuery('#compressx_start_bulk_optimization').show(); + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + }); +} + +function compressx_update_overview() +{ + var ajax_data = { + 'action': 'compressx_start_stats', + }; + + compressx_post_request(ajax_data, function (response) + { + if (response.success) + { + if (response.data.status === 'cached') + { + const data = response.data; + if (data.cached.space_saved_webp_percent !== undefined) + { + jQuery('#cx_webp_saved').html(data.cached.space_saved_webp_percent+"%"); + jQuery('#cx_avif_saved').html(data.cached.space_saved_avif_percent+"%"); + jQuery('#cx_conversion_webp_percent').html(data.cached.conversion_webp_percent+"% images"); + jQuery('#cx_conversion_avif_percent').html(data.cached.conversion_avif_percent+"% images"); + } + } + else { + compressx_get_stats(); + } + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +} + +function compressx_start_statsloop() +{ + var ajax_data = { + 'action': 'compressx_continue_stats', + }; + + compressx_post_request(ajax_data, function (response) + { + if (response.success) + { + setTimeout(compressx_get_stats(), 2000); + } else { + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +} + +function compressx_get_stats() +{ + var ajax_data = { + 'action': 'compressx_get_stats', + }; + + compressx_post_request(ajax_data, function (response) + { + if (!response.success || !response.data) return; + + const data = response.data; + + if (data.status === 'done') { + jQuery('#cx_webp_saved').html(data.space_saved_webp_percent+"%"); + jQuery('#cx_avif_saved').html(data.space_saved_avif_percent+"%"); + + jQuery('#cx_conversion_webp_percent').html(data.conversion_webp_percent+"% images"); + jQuery('#cx_conversion_avif_percent').html(data.conversion_avif_percent+"% images"); + } else if (data.status === 'in_progress') { + compressx_start_statsloop(); + } else if (data.status === 'executing') { + setTimeout(compressx_get_stats, 2000); + } else if (data.status === 'not_started') { + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +} + +jQuery('#cx_show_more_size').click(function() +{ + jQuery('.cx-thumbnail-size').show(); + jQuery('#cx_show_more_size').hide(); +}); + +jQuery('#compressx_save_size').click(function() +{ + compressx_save_size_setting(); +}); + +function compressx_save_size_setting() +{ + var json = {}; + + var setting_data = compressx_ajax_data_transfer('size_setting'); + var json1 = JSON.parse(setting_data); + + jQuery.extend(json1, json); + setting_data=JSON.stringify(json1); + + var ajax_data = { + 'action': 'compressx_save_size_setting', + 'setting': setting_data, + }; + jQuery('#compressx_save_size').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_save_size_progress').show(); + // + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + jQuery('#compressx_save_size').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_size_progress').hide(); + if (jsonarray.result === 'success') + { + jQuery('#compressx_save_size_text').removeClass("hidden"); + setTimeout(function () + { + jQuery('#compressx_save_size_text').addClass( 'hidden' ); + }, 3000); + } + } + catch (err) + { + alert(err); + jQuery('#compressx_save_size').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_size_progress').hide(); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_save_size').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_size_progress').hide(); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); +} + + +jQuery('#cx_delete_file').click(function() +{ + compressx_delete_files(); +}); + +function compressx_delete_files() +{ + var confirm_text=jQuery('#cx_confirm_delete_file').val(); + if(confirm_text!="Delete") + { + alert('Please type the word "Delete" to confirm the deletion. Note that "Delete" is case sensitive.'); + return; + } + + var ajax_data = { + 'action': 'compressx_delete_files', + }; + jQuery('#cx_delete_file').css({'pointer-events': 'none', 'opacity': '0.4'}); + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + jQuery('#cx_delete_file').css({'pointer-events': 'auto', 'opacity': '1'}); + if (jsonarray.result === 'success') + { + jQuery('#cx_delete_file_success').removeClass("hidden"); + setTimeout(function () + { + jQuery('#cx_delete_file_success').addClass( 'hidden' ); + }, 3000); + compressx_update_overview(); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#cx_delete_file').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#cx_delete_file').css({'pointer-events': 'auto', 'opacity': '1'}); + }); +} + + +jQuery('#compressx_save_others').click(function() +{ + compressx_save_others(); +}); + +function compressx_save_others() +{ + var json = {}; + + var setting_data = compressx_ajax_data_transfer('others_setting'); + var json1 = JSON.parse(setting_data); + + jQuery.extend(json1, json); + setting_data=JSON.stringify(json1); + + var ajax_data = { + 'action': 'compressx_save_others_setting', + 'setting': setting_data, + }; + jQuery('#compressx_save_others').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_save_others_progress').show(); + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + jQuery('#compressx_save_others').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_others_progress').hide(); + if (jsonarray.result === 'success') + { + jQuery('#compressx_save_others_text').removeClass("hidden"); + if (jsonarray.redirect_url) + { + location.reload(); + } + else + { + setTimeout(function () + { + jQuery('#compressx_save_others_text').addClass( 'hidden' ); + }, 3000); + } + } + + } + catch (err) + { + alert(err); + jQuery('#compressx_save_others').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_others_progress').hide(); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_save_others').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_others_progress').hide(); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_edit_apiserver').click(function() +{ + jQuery('#cx_apiserver').hide(); + jQuery('#cx_apiserver_edit').show(); +}); + +jQuery('#cx_apiserver_edit_btn').click(function() +{ + jQuery('#cx_apiserver_edit_progress').show(); + var api_server=jQuery('#cx_apiserver_select').val(); + var ajax_data = { + 'action': 'compressx_set_api_server', + 'api_server': api_server, + }; + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'none', 'opacity': '0.4'}); + compressx_post_request(ajax_data, function (data) + { + jQuery('#cx_apiserver_edit_progress').hide(); + try + { + var jsonarray = jQuery.parseJSON(data); + + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'auto', 'opacity': '1'}); + if (jsonarray.result === 'success') + { + // + jQuery('#cx_apiserver_text').html(jsonarray.html); + jQuery('#cx_apiserver').show(); + jQuery('#cx_apiserver_edit').hide(); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#cx_apiserver_edit_progress').hide(); + jQuery('#cx_apiserver_edit_btn').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('set api server', textStatus, errorThrown); + alert(error_message); + }); +}); + +jQuery('#cx_hide_notice').click(function() +{ + jQuery('#cx_notice').hide(); + var ajax_data = { + 'action': 'compressx_hide_notice', + }; + compressx_post_request(ajax_data, function (data) + { + }, function (XMLHttpRequest, textStatus, errorThrown) + { + }); +}); + + +function compressx_init_exclude_tree() +{ + jQuery('#compressx_exclude_js_tree').on('activate_node.jstree', function (event, data) { + }).jstree({ + "core": { + "check_callback": true, + "multiple": true, + "data": function (node_id, callback) { + var tree_node = { + 'node': node_id, + 'path': compressx_uploads_root.path + }; + var ajax_data = { + 'action': 'compressx_get_custom_tree_dir', + 'tree_node': tree_node, + }; + ajax_data.nonce=compressx_ajax_object.ajax_nonce; + jQuery.ajax({ + type: "post", + url: compressx_ajax_object.ajax_url, + data: ajax_data, + success: function (data) { + var jsonarray = jQuery.parseJSON(data); + callback.call(this, jsonarray.nodes); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + //alert("error"); + }, + timeout: 30000 + }); + }, + 'themes': { + 'stripes': true + } + }, + "plugins": ["sort"], + "sort": function(a, b) { + a1 = this.get_node(a); + b1 = this.get_node(b); + if (a1.icon === b1.icon) { + return (a1.text.toLowerCase() > b1.text.toLowerCase()) ? 1 : -1; + } else { + return (a1.icon > b1.icon) ? 1 : -1; + } + }, + }); +} + +jQuery(document).ready(function () +{ + compressx_init_exclude_tree(); + compressx_update_overview(); +}); + +jQuery('#compressx_add_exclude_folders').click(function() +{ + compressx_add_exclude_folders(); +}); + +jQuery('#compressx_exclude_js_tree').on('click', '.cx-add-custom-exclude-tree', function() +{ + var id=jQuery(this).data("id"); + var node=jQuery(this).parent(); + + var select_folders = jQuery('#compressx_exclude_dir_node').find('.cx-remove-custom-exclude-tree'); + var json = {}; + var bfind=false; + + jQuery.each(select_folders, function () + { + var value=jQuery(this).data("id"); + if(value==id) + { + bfind=true; + } + }); + + if(bfind) + return; + + var ajax_data = { + 'action': 'compressx_add_exclude_folder', + 'id': id, + }; + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + jQuery('#compressx_exclude_dir_node').find('ul:first').append(jsonarray.html); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); + +}); + +jQuery('#compressx_exclude_dir_node').on('click', '.cx-remove-custom-exclude-tree', function() +{ + var id=jQuery(this).data("id"); + var node=jQuery(this).parent(); + node.remove(); +}); + +function compressx_add_exclude_folders() +{ + var select_folders = jQuery('#compressx_exclude_dir_node').find('.cx-remove-custom-exclude-tree'); + var json = {}; + jQuery.each(select_folders, function () + { + var value=jQuery(this).data("id"); + //var value = select_item.data( 'id' ); + json[value]=value; + }); + + var exclude_node=JSON.stringify(json); + var ajax_data = { + 'action': 'compressx_add_exclude_folders', + 'excludes': exclude_node, + }; + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_save_exclude_progress').show(); + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + jQuery('#compressx_save_exclude_progress').hide(); + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + if (jsonarray.result === 'success') + { + jQuery('#compressx_save_exclude_text').removeClass("hidden"); + setTimeout(function () + { + jQuery('#compressx_save_exclude_text').addClass( 'hidden' ); + }, 3000); + + jQuery('#compressx_exclude_dir_node').html(jsonarray.html); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_exclude_progress').hide(); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_add_exclude_folders').hide(); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/compressx_system_info.js b/wp-content/plugins/compressx/includes/display/js/compressx_system_info.js new file mode 100644 index 0000000..f7537a9 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/compressx_system_info.js @@ -0,0 +1,51 @@ + + +jQuery('#compressx_download_debug_info').click(function() +{ + cx_download_website_info(); +}); + +function cx_download_website_info() +{ + location.href =ajaxurl+'?_wpnonce='+compressx_ajax_object.ajax_nonce+'&action=compressx_create_debug_package'; +} + +jQuery('#compressx_debug_submit').click(function() +{ + cx_debug_submit(); +}); + +function cx_debug_submit() +{ + var user_mail = jQuery('#compressx_user_mail').val(); + var comment = jQuery('#compressx_debug_comment').val(); + + var ajax_data = { + 'action': 'compressx_send_debug_info', + 'user_mail': user_mail, + 'comment':comment + }; + compressx_post_request(ajax_data, function (data) { + try { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + jQuery('#compressx_debug_comment').html(""); + jQuery('#compressx_send_success_text').removeClass("hidden"); + setTimeout(function () + { + jQuery('#compressx_send_success_text').addClass( 'hidden' ); + }, 3000); + } + else { + alert(jsonarray.error); + } + } + catch (err) { + alert(err); + } + }, function (XMLHttpRequest, textStatus, errorThrown) { + var error_message = compressx_output_ajaxerror('sending debug information', textStatus, errorThrown); + alert(error_message); + }); +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/jstree.js b/wp-content/plugins/compressx/includes/display/js/jstree/dist/jstree.js new file mode 100644 index 0000000..00617ef --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/jstree/dist/jstree.js @@ -0,0 +1,8605 @@ +/*globals jQuery, define, module, exports, require, window, document, postMessage */ +(function (factory) { + "use strict"; + if (typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } + else if(typeof module !== 'undefined' && module.exports) { + module.exports = factory(require('jquery')); + } + else { + factory(jQuery); + } +}(function ($, undefined) { + "use strict"; +/*! + * jsTree 3.3.7 + * http://jstree.com/ + * + * Copyright (c) 2014 Ivan Bozhanov (http://vakata.com) + * + * Licensed same as jquery - under the terms of the MIT License + * http://www.opensource.org/licenses/mit-license.php + */ +/*! + * if using jslint please allow for the jQuery global and use following options: + * jslint: loopfunc: true, browser: true, ass: true, bitwise: true, continue: true, nomen: true, plusplus: true, regexp: true, unparam: true, todo: true, white: true + */ +/*jshint -W083 */ + + // prevent another load? maybe there is a better way? + if($.jstree) { + return; + } + + /** + * ### jsTree core functionality + */ + + // internal variables + var instance_counter = 0, + ccp_node = false, + ccp_mode = false, + ccp_inst = false, + themes_loaded = [], + src = $('script:last').attr('src'), + document = window.document; // local variable is always faster to access then a global + + /** + * holds all jstree related functions and variables, including the actual class and methods to create, access and manipulate instances. + * @name $.jstree + */ + $.jstree = { + /** + * specifies the jstree version in use + * @name $.jstree.version + */ + version : '3.3.7', + /** + * holds all the default options used when creating new instances + * @name $.jstree.defaults + */ + defaults : { + /** + * configure which plugins will be active on an instance. Should be an array of strings, where each element is a plugin name. The default is `[]` + * @name $.jstree.defaults.plugins + */ + plugins : [] + }, + /** + * stores all loaded jstree plugins (used internally) + * @name $.jstree.plugins + */ + plugins : {}, + path : src && src.indexOf('/') !== -1 ? src.replace(/\/[^\/]+$/,'') : '', + idregex : /[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g, + root : '#' + }; + + /** + * creates a jstree instance + * @name $.jstree.create(el [, options]) + * @param {DOMElement|jQuery|String} el the element to create the instance on, can be jQuery extended or a selector + * @param {Object} options options for this instance (extends `$.jstree.defaults`) + * @return {jsTree} the new instance + */ + $.jstree.create = function (el, options) { + var tmp = new $.jstree.core(++instance_counter), + opt = options; + options = $.extend(true, {}, $.jstree.defaults, options); + if(opt && opt.plugins) { + options.plugins = opt.plugins; + } + $.each(options.plugins, function (i, k) { + if(i !== 'core') { + tmp = tmp.plugin(k, options[k]); + } + }); + $(el).data('jstree', tmp); + tmp.init(el, options); + return tmp; + }; + /** + * remove all traces of jstree from the DOM and destroy all instances + * @name $.jstree.destroy() + */ + $.jstree.destroy = function () { + $('.jstree:jstree').jstree('destroy'); + $(document).off('.jstree'); + }; + /** + * the jstree class constructor, used only internally + * @private + * @name $.jstree.core(id) + * @param {Number} id this instance's index + */ + $.jstree.core = function (id) { + this._id = id; + this._cnt = 0; + this._wrk = null; + this._data = { + core : { + themes : { + name : false, + dots : false, + icons : false, + ellipsis : false + }, + selected : [], + last_error : {}, + working : false, + worker_queue : [], + focused : null + } + }; + }; + /** + * get a reference to an existing instance + * + * __Examples__ + * + * // provided a container with an ID of "tree", and a nested node with an ID of "branch" + * // all of there will return the same instance + * $.jstree.reference('tree'); + * $.jstree.reference('#tree'); + * $.jstree.reference($('#tree')); + * $.jstree.reference(document.getElementByID('tree')); + * $.jstree.reference('branch'); + * $.jstree.reference('#branch'); + * $.jstree.reference($('#branch')); + * $.jstree.reference(document.getElementByID('branch')); + * + * @name $.jstree.reference(needle) + * @param {DOMElement|jQuery|String} needle + * @return {jsTree|null} the instance or `null` if not found + */ + $.jstree.reference = function (needle) { + var tmp = null, + obj = null; + if(needle && needle.id && (!needle.tagName || !needle.nodeType)) { needle = needle.id; } + + if(!obj || !obj.length) { + try { obj = $(needle); } catch (ignore) { } + } + if(!obj || !obj.length) { + try { obj = $('#' + needle.replace($.jstree.idregex,'\\$&')); } catch (ignore) { } + } + if(obj && obj.length && (obj = obj.closest('.jstree')).length && (obj = obj.data('jstree'))) { + tmp = obj; + } + else { + $('.jstree').each(function () { + var inst = $(this).data('jstree'); + if(inst && inst._model.data[needle]) { + tmp = inst; + return false; + } + }); + } + return tmp; + }; + /** + * Create an instance, get an instance or invoke a command on a instance. + * + * If there is no instance associated with the current node a new one is created and `arg` is used to extend `$.jstree.defaults` for this new instance. There would be no return value (chaining is not broken). + * + * If there is an existing instance and `arg` is a string the command specified by `arg` is executed on the instance, with any additional arguments passed to the function. If the function returns a value it will be returned (chaining could break depending on function). + * + * If there is an existing instance and `arg` is not a string the instance itself is returned (similar to `$.jstree.reference`). + * + * In any other case - nothing is returned and chaining is not broken. + * + * __Examples__ + * + * $('#tree1').jstree(); // creates an instance + * $('#tree2').jstree({ plugins : [] }); // create an instance with some options + * $('#tree1').jstree('open_node', '#branch_1'); // call a method on an existing instance, passing additional arguments + * $('#tree2').jstree(); // get an existing instance (or create an instance) + * $('#tree2').jstree(true); // get an existing instance (will not create new instance) + * $('#branch_1').jstree().select_node('#branch_1'); // get an instance (using a nested element and call a method) + * + * @name $().jstree([arg]) + * @param {String|Object} arg + * @return {Mixed} + */ + $.fn.jstree = function (arg) { + // check for string argument + var is_method = (typeof arg === 'string'), + args = Array.prototype.slice.call(arguments, 1), + result = null; + if(arg === true && !this.length) { return false; } + this.each(function () { + // get the instance (if there is one) and method (if it exists) + var instance = $.jstree.reference(this), + method = is_method && instance ? instance[arg] : null; + // if calling a method, and method is available - execute on the instance + result = is_method && method ? + method.apply(instance, args) : + null; + // if there is no instance and no method is being called - create one + if(!instance && !is_method && (arg === undefined || $.isPlainObject(arg))) { + $.jstree.create(this, arg); + } + // if there is an instance and no method is called - return the instance + if( (instance && !is_method) || arg === true ) { + result = instance || false; + } + // if there was a method call which returned a result - break and return the value + if(result !== null && result !== undefined) { + return false; + } + }); + // if there was a method call with a valid return value - return that, otherwise continue the chain + return result !== null && result !== undefined ? + result : this; + }; + /** + * used to find elements containing an instance + * + * __Examples__ + * + * $('div:jstree').each(function () { + * $(this).jstree('destroy'); + * }); + * + * @name $(':jstree') + * @return {jQuery} + */ + $.expr.pseudos.jstree = $.expr.createPseudo(function(search) { + return function(a) { + return $(a).hasClass('jstree') && + $(a).data('jstree') !== undefined; + }; + }); + + /** + * stores all defaults for the core + * @name $.jstree.defaults.core + */ + $.jstree.defaults.core = { + /** + * data configuration + * + * If left as `false` the HTML inside the jstree container element is used to populate the tree (that should be an unordered list with list items). + * + * You can also pass in a HTML string or a JSON array here. + * + * It is possible to pass in a standard jQuery-like AJAX config and jstree will automatically determine if the response is JSON or HTML and use that to populate the tree. + * In addition to the standard jQuery ajax options here you can suppy functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node is being loaded, the return value of those functions will be used. + * + * The last option is to specify a function, that function will receive the node being loaded as argument and a second param which is a function which should be called with the result. + * + * __Examples__ + * + * // AJAX + * $('#tree').jstree({ + * 'core' : { + * 'data' : { + * 'url' : '/get/children/', + * 'data' : function (node) { + * return { 'id' : node.id }; + * } + * } + * }); + * + * // direct data + * $('#tree').jstree({ + * 'core' : { + * 'data' : [ + * 'Simple root node', + * { + * 'id' : 'node_2', + * 'text' : 'Root node with options', + * 'state' : { 'opened' : true, 'selected' : true }, + * 'children' : [ { 'text' : 'Child 1' }, 'Child 2'] + * } + * ] + * } + * }); + * + * // function + * $('#tree').jstree({ + * 'core' : { + * 'data' : function (obj, callback) { + * callback.call(this, ['Root 1', 'Root 2']); + * } + * }); + * + * @name $.jstree.defaults.core.data + */ + data : false, + /** + * configure the various strings used throughout the tree + * + * You can use an object where the key is the string you need to replace and the value is your replacement. + * Another option is to specify a function which will be called with an argument of the needed string and should return the replacement. + * If left as `false` no replacement is made. + * + * __Examples__ + * + * $('#tree').jstree({ + * 'core' : { + * 'strings' : { + * 'Loading ...' : 'Please wait ...' + * } + * } + * }); + * + * @name $.jstree.defaults.core.strings + */ + strings : false, + /** + * determines what happens when a user tries to modify the structure of the tree + * If left as `false` all operations like create, rename, delete, move or copy are prevented. + * You can set this to `true` to allow all interactions or use a function to have better control. + * + * __Examples__ + * + * $('#tree').jstree({ + * 'core' : { + * 'check_callback' : function (operation, node, node_parent, node_position, more) { + * // operation can be 'create_node', 'rename_node', 'delete_node', 'move_node', 'copy_node' or 'edit' + * // in case of 'rename_node' node_position is filled with the new node name + * return operation === 'rename_node' ? true : false; + * } + * } + * }); + * + * @name $.jstree.defaults.core.check_callback + */ + check_callback : false, + /** + * a callback called with a single object parameter in the instance's scope when something goes wrong (operation prevented, ajax failed, etc) + * @name $.jstree.defaults.core.error + */ + error : $.noop, + /** + * the open / close animation duration in milliseconds - set this to `false` to disable the animation (default is `200`) + * @name $.jstree.defaults.core.animation + */ + animation : 200, + /** + * a boolean indicating if multiple nodes can be selected + * @name $.jstree.defaults.core.multiple + */ + multiple : true, + /** + * theme configuration object + * @name $.jstree.defaults.core.themes + */ + themes : { + /** + * the name of the theme to use (if left as `false` the default theme is used) + * @name $.jstree.defaults.core.themes.name + */ + name : false, + /** + * the URL of the theme's CSS file, leave this as `false` if you have manually included the theme CSS (recommended). You can set this to `true` too which will try to autoload the theme. + * @name $.jstree.defaults.core.themes.url + */ + url : false, + /** + * the location of all jstree themes - only used if `url` is set to `true` + * @name $.jstree.defaults.core.themes.dir + */ + dir : false, + /** + * a boolean indicating if connecting dots are shown + * @name $.jstree.defaults.core.themes.dots + */ + dots : true, + /** + * a boolean indicating if node icons are shown + * @name $.jstree.defaults.core.themes.icons + */ + icons : true, + /** + * a boolean indicating if node ellipsis should be shown - this only works with a fixed with on the container + * @name $.jstree.defaults.core.themes.ellipsis + */ + ellipsis : false, + /** + * a boolean indicating if the tree background is striped + * @name $.jstree.defaults.core.themes.stripes + */ + stripes : false, + /** + * a string (or boolean `false`) specifying the theme variant to use (if the theme supports variants) + * @name $.jstree.defaults.core.themes.variant + */ + variant : false, + /** + * a boolean specifying if a reponsive version of the theme should kick in on smaller screens (if the theme supports it). Defaults to `false`. + * @name $.jstree.defaults.core.themes.responsive + */ + responsive : false + }, + /** + * if left as `true` all parents of all selected nodes will be opened once the tree loads (so that all selected nodes are visible to the user) + * @name $.jstree.defaults.core.expand_selected_onload + */ + expand_selected_onload : true, + /** + * if left as `true` web workers will be used to parse incoming JSON data where possible, so that the UI will not be blocked by large requests. Workers are however about 30% slower. Defaults to `true` + * @name $.jstree.defaults.core.worker + */ + worker : true, + /** + * Force node text to plain text (and escape HTML). Defaults to `false` + * @name $.jstree.defaults.core.force_text + */ + force_text : false, + /** + * Should the node be toggled if the text is double clicked. Defaults to `true` + * @name $.jstree.defaults.core.dblclick_toggle + */ + dblclick_toggle : true, + /** + * Should the loaded nodes be part of the state. Defaults to `false` + * @name $.jstree.defaults.core.loaded_state + */ + loaded_state : false, + /** + * Should the last active node be focused when the tree container is blurred and the focused again. This helps working with screen readers. Defaults to `true` + * @name $.jstree.defaults.core.restore_focus + */ + restore_focus : true, + /** + * Default keyboard shortcuts (an object where each key is the button name or combo - like 'enter', 'ctrl-space', 'p', etc and the value is the function to execute in the instance's scope) + * @name $.jstree.defaults.core.keyboard + */ + keyboard : { + 'ctrl-space': function (e) { + // aria defines space only with Ctrl + e.type = "click"; + $(e.currentTarget).trigger(e); + }, + 'enter': function (e) { + // enter + e.type = "click"; + $(e.currentTarget).trigger(e); + }, + 'left': function (e) { + // left + e.preventDefault(); + if(this.is_open(e.currentTarget)) { + this.close_node(e.currentTarget); + } + else { + var o = this.get_parent(e.currentTarget); + if(o && o.id !== $.jstree.root) { this.get_node(o, true).children('.jstree-anchor').focus(); } + } + }, + 'up': function (e) { + // up + e.preventDefault(); + var o = this.get_prev_dom(e.currentTarget); + if(o && o.length) { o.children('.jstree-anchor').focus(); } + }, + 'right': function (e) { + // right + e.preventDefault(); + if(this.is_closed(e.currentTarget)) { + this.open_node(e.currentTarget, function (o) { this.get_node(o, true).children('.jstree-anchor').focus(); }); + } + else if (this.is_open(e.currentTarget)) { + var o = this.get_node(e.currentTarget, true).children('.jstree-children')[0]; + if(o) { $(this._firstChild(o)).children('.jstree-anchor').focus(); } + } + }, + 'down': function (e) { + // down + e.preventDefault(); + var o = this.get_next_dom(e.currentTarget); + if(o && o.length) { o.children('.jstree-anchor').focus(); } + }, + '*': function (e) { + // aria defines * on numpad as open_all - not very common + this.open_all(); + }, + 'home': function (e) { + // home + e.preventDefault(); + var o = this._firstChild(this.get_container_ul()[0]); + if(o) { $(o).children('.jstree-anchor').filter(':visible').focus(); } + }, + 'end': function (e) { + // end + e.preventDefault(); + this.element.find('.jstree-anchor').filter(':visible').last().focus(); + }, + 'f2': function (e) { + // f2 - safe to include - if check_callback is false it will fail + e.preventDefault(); + this.edit(e.currentTarget); + } + } + }; + $.jstree.core.prototype = { + /** + * used to decorate an instance with a plugin. Used internally. + * @private + * @name plugin(deco [, opts]) + * @param {String} deco the plugin to decorate with + * @param {Object} opts options for the plugin + * @return {jsTree} + */ + plugin : function (deco, opts) { + var Child = $.jstree.plugins[deco]; + if(Child) { + this._data[deco] = {}; + Child.prototype = this; + return new Child(opts, this); + } + return this; + }, + /** + * initialize the instance. Used internally. + * @private + * @name init(el, optons) + * @param {DOMElement|jQuery|String} el the element we are transforming + * @param {Object} options options for this instance + * @trigger init.jstree, loading.jstree, loaded.jstree, ready.jstree, changed.jstree + */ + init : function (el, options) { + this._model = { + data : {}, + changed : [], + force_full_redraw : false, + redraw_timeout : false, + default_state : { + loaded : true, + opened : false, + selected : false, + disabled : false + } + }; + this._model.data[$.jstree.root] = { + id : $.jstree.root, + parent : null, + parents : [], + children : [], + children_d : [], + state : { loaded : false } + }; + + this.element = $(el).addClass('jstree jstree-' + this._id); + this.settings = options; + + this._data.core.ready = false; + this._data.core.loaded = false; + this._data.core.rtl = (this.element.css("direction") === "rtl"); + this.element[this._data.core.rtl ? 'addClass' : 'removeClass']("jstree-rtl"); + this.element.attr('role','tree'); + if(this.settings.core.multiple) { + this.element.attr('aria-multiselectable', true); + } + if(!this.element.attr('tabindex')) { + this.element.attr('tabindex','0'); + } + + this.bind(); + /** + * triggered after all events are bound + * @event + * @name init.jstree + */ + this.trigger("init"); + + this._data.core.original_container_html = this.element.find(" > ul > li").clone(true); + this._data.core.original_container_html + .find("li").addBack() + .contents().filter(function() { + return this.nodeType === 3 && (!this.nodeValue || /^\s+$/.test(this.nodeValue)); + }) + .remove(); + this.element.html("<"+"ul class='jstree-container-ul jstree-children' role='group'><"+"li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='tree-item'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + "
        "); + this.element.attr('aria-activedescendant','j' + this._id + '_loading'); + this._data.core.li_height = this.get_container_ul().children("li").first().outerHeight() || 24; + this._data.core.node = this._create_prototype_node(); + /** + * triggered after the loading text is shown and before loading starts + * @event + * @name loading.jstree + */ + this.trigger("loading"); + this.load_node($.jstree.root); + }, + /** + * destroy an instance + * @name destroy() + * @param {Boolean} keep_html if not set to `true` the container will be emptied, otherwise the current DOM elements will be kept intact + */ + destroy : function (keep_html) { + /** + * triggered before the tree is destroyed + * @event + * @name destroy.jstree + */ + this.trigger("destroy"); + if(this._wrk) { + try { + window.URL.revokeObjectURL(this._wrk); + this._wrk = null; + } + catch (ignore) { } + } + if(!keep_html) { this.element.empty(); } + this.teardown(); + }, + /** + * Create a prototype node + * @name _create_prototype_node() + * @return {DOMElement} + */ + _create_prototype_node : function () { + var _node = document.createElement('LI'), _temp1, _temp2; + _node.setAttribute('role', 'treeitem'); + _temp1 = document.createElement('I'); + _temp1.className = 'jstree-icon jstree-ocl'; + _temp1.setAttribute('role', 'presentation'); + _node.appendChild(_temp1); + _temp1 = document.createElement('A'); + _temp1.className = 'jstree-anchor'; + _temp1.setAttribute('href','#'); + _temp1.setAttribute('tabindex','-1'); + _temp2 = document.createElement('I'); + _temp2.className = 'jstree-icon jstree-themeicon'; + _temp2.setAttribute('role', 'presentation'); + _temp1.appendChild(_temp2); + _node.appendChild(_temp1); + _temp1 = _temp2 = null; + + return _node; + }, + _kbevent_to_func : function (e) { + var keys = { + 8: "Backspace", 9: "Tab", 13: "Return", 19: "Pause", 27: "Esc", + 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", + 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "Print", 45: "Insert", + 46: "Delete", 96: "Numpad0", 97: "Numpad1", 98: "Numpad2", 99 : "Numpad3", + 100: "Numpad4", 101: "Numpad5", 102: "Numpad6", 103: "Numpad7", + 104: "Numpad8", 105: "Numpad9", '-13': "NumpadEnter", 112: "F1", + 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", + 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "Numlock", + 145: "Scrolllock", 16: 'Shift', 17: 'Ctrl', 18: 'Alt', + 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', + 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a', + 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', + 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', + 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', + 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', + 186: ';', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', + 219: '[', 220: '\\',221: ']', 222: "'", 111: '/', 106: '*', 173: '-' + }; + var parts = []; + if (e.ctrlKey) { parts.push('ctrl'); } + if (e.altKey) { parts.push('alt'); } + if (e.shiftKey) { parts.push('shift'); } + parts.push(keys[e.which] || e.which); + parts = parts.sort().join('-').toLowerCase(); + + var kb = this.settings.core.keyboard, i, tmp; + for (i in kb) { + if (kb.hasOwnProperty(i)) { + tmp = i; + if (tmp !== '-' && tmp !== '+') { + tmp = tmp.replace('--', '-MINUS').replace('+-', '-MINUS').replace('++', '-PLUS').replace('-+', '-PLUS'); + tmp = tmp.split(/-|\+/).sort().join('-').replace('MINUS', '-').replace('PLUS', '+').toLowerCase(); + } + if (tmp === parts) { + return kb[i]; + } + } + } + return null; + }, + /** + * part of the destroying of an instance. Used internally. + * @private + * @name teardown() + */ + teardown : function () { + this.unbind(); + this.element + .removeClass('jstree') + .removeData('jstree') + .find("[class^='jstree']") + .addBack() + .attr("class", function () { return this.className.replace(/jstree[^ ]*|$/ig,''); }); + this.element = null; + }, + /** + * bind all events. Used internally. + * @private + * @name bind() + */ + bind : function () { + var word = '', + tout = null, + was_click = 0; + this.element + .on("dblclick.jstree", function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(document.selection && document.selection.empty) { + document.selection.empty(); + } + else { + if(window.getSelection) { + var sel = window.getSelection(); + try { + sel.removeAllRanges(); + sel.collapse(); + } catch (ignore) { } + } + } + }) + .on("mousedown.jstree", $.proxy(function (e) { + if(e.target === this.element[0]) { + e.preventDefault(); // prevent losing focus when clicking scroll arrows (FF, Chrome) + was_click = +(new Date()); // ie does not allow to prevent losing focus + } + }, this)) + .on("mousedown.jstree", ".jstree-ocl", function (e) { + e.preventDefault(); // prevent any node inside from losing focus when clicking the open/close icon + }) + .on("click.jstree", ".jstree-ocl", $.proxy(function (e) { + this.toggle_node(e.target); + }, this)) + .on("dblclick.jstree", ".jstree-anchor", $.proxy(function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(this.settings.core.dblclick_toggle) { + this.toggle_node(e.target); + } + }, this)) + .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { + e.preventDefault(); + if(e.currentTarget !== document.activeElement) { $(e.currentTarget).focus(); } + this.activate_node(e.currentTarget, e); + }, this)) + .on('keydown.jstree', '.jstree-anchor', $.proxy(function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(this._data.core.rtl) { + if(e.which === 37) { e.which = 39; } + else if(e.which === 39) { e.which = 37; } + } + var f = this._kbevent_to_func(e); + if (f) { + var r = f.call(this, e); + if (r === false || r === true) { + return r; + } + } + }, this)) + .on("load_node.jstree", $.proxy(function (e, data) { + if(data.status) { + if(data.node.id === $.jstree.root && !this._data.core.loaded) { + this._data.core.loaded = true; + if(this._firstChild(this.get_container_ul()[0])) { + this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); + } + /** + * triggered after the root node is loaded for the first time + * @event + * @name loaded.jstree + */ + this.trigger("loaded"); + } + if(!this._data.core.ready) { + setTimeout($.proxy(function() { + if(this.element && !this.get_container_ul().find('.jstree-loading').length) { + this._data.core.ready = true; + if(this._data.core.selected.length) { + if(this.settings.core.expand_selected_onload) { + var tmp = [], i, j; + for(i = 0, j = this._data.core.selected.length; i < j; i++) { + tmp = tmp.concat(this._model.data[this._data.core.selected[i]].parents); + } + tmp = $.vakata.array_unique(tmp); + for(i = 0, j = tmp.length; i < j; i++) { + this.open_node(tmp[i], false, 0); + } + } + this.trigger('changed', { 'action' : 'ready', 'selected' : this._data.core.selected }); + } + /** + * triggered after all nodes are finished loading + * @event + * @name ready.jstree + */ + this.trigger("ready"); + } + }, this), 0); + } + } + }, this)) + // quick searching when the tree is focused + .on('keypress.jstree', $.proxy(function (e) { + if(e.target.tagName && e.target.tagName.toLowerCase() === "input") { return true; } + if(tout) { clearTimeout(tout); } + tout = setTimeout(function () { + word = ''; + }, 500); + + var chr = String.fromCharCode(e.which).toLowerCase(), + col = this.element.find('.jstree-anchor').filter(':visible'), + ind = col.index(document.activeElement) || 0, + end = false; + word += chr; + + // match for whole word from current node down (including the current node) + if(word.length > 1) { + col.slice(ind).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().indexOf(word) === 0) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + + // match for whole word from the beginning of the tree + col.slice(0, ind).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().indexOf(word) === 0) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + } + // list nodes that start with that letter (only if word consists of a single char) + if(new RegExp('^' + chr.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '+$').test(word)) { + // search for the next node starting with that letter + col.slice(ind + 1).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().charAt(0) === chr) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + + // search from the beginning + col.slice(0, ind + 1).each($.proxy(function (i, v) { + if($(v).text().toLowerCase().charAt(0) === chr) { + $(v).focus(); + end = true; + return false; + } + }, this)); + if(end) { return; } + } + }, this)) + // THEME RELATED + .on("init.jstree", $.proxy(function () { + var s = this.settings.core.themes; + this._data.core.themes.dots = s.dots; + this._data.core.themes.stripes = s.stripes; + this._data.core.themes.icons = s.icons; + this._data.core.themes.ellipsis = s.ellipsis; + this.set_theme(s.name || "default", s.url); + this.set_theme_variant(s.variant); + }, this)) + .on("loading.jstree", $.proxy(function () { + this[ this._data.core.themes.dots ? "show_dots" : "hide_dots" ](); + this[ this._data.core.themes.icons ? "show_icons" : "hide_icons" ](); + this[ this._data.core.themes.stripes ? "show_stripes" : "hide_stripes" ](); + this[ this._data.core.themes.ellipsis ? "show_ellipsis" : "hide_ellipsis" ](); + }, this)) + .on('blur.jstree', '.jstree-anchor', $.proxy(function (e) { + this._data.core.focused = null; + $(e.currentTarget).filter('.jstree-hovered').mouseleave(); + this.element.attr('tabindex', '0'); + }, this)) + .on('focus.jstree', '.jstree-anchor', $.proxy(function (e) { + var tmp = this.get_node(e.currentTarget); + if(tmp && tmp.id) { + this._data.core.focused = tmp.id; + } + this.element.find('.jstree-hovered').not(e.currentTarget).mouseleave(); + $(e.currentTarget).mouseenter(); + this.element.attr('tabindex', '-1'); + }, this)) + .on('focus.jstree', $.proxy(function () { + if(+(new Date()) - was_click > 500 && !this._data.core.focused && this.settings.core.restore_focus) { + was_click = 0; + var act = this.get_node(this.element.attr('aria-activedescendant'), true); + if(act) { + act.find('> .jstree-anchor').focus(); + } + } + }, this)) + .on('mouseenter.jstree', '.jstree-anchor', $.proxy(function (e) { + this.hover_node(e.currentTarget); + }, this)) + .on('mouseleave.jstree', '.jstree-anchor', $.proxy(function (e) { + this.dehover_node(e.currentTarget); + }, this)); + }, + /** + * part of the destroying of an instance. Used internally. + * @private + * @name unbind() + */ + unbind : function () { + this.element.off('.jstree'); + $(document).off('.jstree-' + this._id); + }, + /** + * trigger an event. Used internally. + * @private + * @name trigger(ev [, data]) + * @param {String} ev the name of the event to trigger + * @param {Object} data additional data to pass with the event + */ + trigger : function (ev, data) { + if(!data) { + data = {}; + } + data.instance = this; + this.element.triggerHandler(ev.replace('.jstree','') + '.jstree', data); + }, + /** + * returns the jQuery extended instance container + * @name get_container() + * @return {jQuery} + */ + get_container : function () { + return this.element; + }, + /** + * returns the jQuery extended main UL node inside the instance container. Used internally. + * @private + * @name get_container_ul() + * @return {jQuery} + */ + get_container_ul : function () { + return this.element.children(".jstree-children").first(); + }, + /** + * gets string replacements (localization). Used internally. + * @private + * @name get_string(key) + * @param {String} key + * @return {String} + */ + get_string : function (key) { + var a = this.settings.core.strings; + if($.isFunction(a)) { return a.call(this, key); } + if(a && a[key]) { return a[key]; } + return key; + }, + /** + * gets the first child of a DOM node. Used internally. + * @private + * @name _firstChild(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _firstChild : function (dom) { + dom = dom ? dom.firstChild : null; + while(dom !== null && dom.nodeType !== 1) { + dom = dom.nextSibling; + } + return dom; + }, + /** + * gets the next sibling of a DOM node. Used internally. + * @private + * @name _nextSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _nextSibling : function (dom) { + dom = dom ? dom.nextSibling : null; + while(dom !== null && dom.nodeType !== 1) { + dom = dom.nextSibling; + } + return dom; + }, + /** + * gets the previous sibling of a DOM node. Used internally. + * @private + * @name _previousSibling(dom) + * @param {DOMElement} dom + * @return {DOMElement} + */ + _previousSibling : function (dom) { + dom = dom ? dom.previousSibling : null; + while(dom !== null && dom.nodeType !== 1) { + dom = dom.previousSibling; + } + return dom; + }, + /** + * get the JSON representation of a node (or the actual jQuery extended DOM node) by using any input (child DOM element, ID string, selector, etc) + * @name get_node(obj [, as_dom]) + * @param {mixed} obj + * @param {Boolean} as_dom + * @return {Object|jQuery} + */ + get_node : function (obj, as_dom) { + if(obj && obj.id) { + obj = obj.id; + } + if (obj instanceof jQuery && obj.length && obj[0].id) { + obj = obj[0].id; + } + var dom; + try { + if(this._model.data[obj]) { + obj = this._model.data[obj]; + } + else if(typeof obj === "string" && this._model.data[obj.replace(/^#/, '')]) { + obj = this._model.data[obj.replace(/^#/, '')]; + } + else if(typeof obj === "string" && (dom = $('#' + obj.replace($.jstree.idregex,'\\$&'), this.element)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { + obj = this._model.data[dom.closest('.jstree-node').attr('id')]; + } + else if((dom = this.element.find(obj)).length && this._model.data[dom.closest('.jstree-node').attr('id')]) { + obj = this._model.data[dom.closest('.jstree-node').attr('id')]; + } + else if((dom = this.element.find(obj)).length && dom.hasClass('jstree')) { + obj = this._model.data[$.jstree.root]; + } + else { + return false; + } + + if(as_dom) { + obj = obj.id === $.jstree.root ? this.element : $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); + } + return obj; + } catch (ex) { return false; } + }, + /** + * get the path to a node, either consisting of node texts, or of node IDs, optionally glued together (otherwise an array) + * @name get_path(obj [, glue, ids]) + * @param {mixed} obj the node + * @param {String} glue if you want the path as a string - pass the glue here (for example '/'), if a falsy value is supplied here, an array is returned + * @param {Boolean} ids if set to true build the path using ID, otherwise node text is used + * @return {mixed} + */ + get_path : function (obj, glue, ids) { + obj = obj.parents ? obj : this.get_node(obj); + if(!obj || obj.id === $.jstree.root || !obj.parents) { + return false; + } + var i, j, p = []; + p.push(ids ? obj.id : obj.text); + for(i = 0, j = obj.parents.length; i < j; i++) { + p.push(ids ? obj.parents[i] : this.get_text(obj.parents[i])); + } + p = p.reverse().slice(1); + return glue ? p.join(glue) : p; + }, + /** + * get the next visible node that is below the `obj` node. If `strict` is set to `true` only sibling nodes are returned. + * @name get_next_dom(obj [, strict]) + * @param {mixed} obj + * @param {Boolean} strict + * @return {jQuery} + */ + get_next_dom : function (obj, strict) { + var tmp; + obj = this.get_node(obj, true); + if(obj[0] === this.element[0]) { + tmp = this._firstChild(this.get_container_ul()[0]); + while (tmp && tmp.offsetHeight === 0) { + tmp = this._nextSibling(tmp); + } + return tmp ? $(tmp) : false; + } + if(!obj || !obj.length) { + return false; + } + if(strict) { + tmp = obj[0]; + do { + tmp = this._nextSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + return tmp ? $(tmp) : false; + } + if(obj.hasClass("jstree-open")) { + tmp = this._firstChild(obj.children('.jstree-children')[0]); + while (tmp && tmp.offsetHeight === 0) { + tmp = this._nextSibling(tmp); + } + if(tmp !== null) { + return $(tmp); + } + } + tmp = obj[0]; + do { + tmp = this._nextSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + if(tmp !== null) { + return $(tmp); + } + return obj.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first(); + }, + /** + * get the previous visible node that is above the `obj` node. If `strict` is set to `true` only sibling nodes are returned. + * @name get_prev_dom(obj [, strict]) + * @param {mixed} obj + * @param {Boolean} strict + * @return {jQuery} + */ + get_prev_dom : function (obj, strict) { + var tmp; + obj = this.get_node(obj, true); + if(obj[0] === this.element[0]) { + tmp = this.get_container_ul()[0].lastChild; + while (tmp && tmp.offsetHeight === 0) { + tmp = this._previousSibling(tmp); + } + return tmp ? $(tmp) : false; + } + if(!obj || !obj.length) { + return false; + } + if(strict) { + tmp = obj[0]; + do { + tmp = this._previousSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + return tmp ? $(tmp) : false; + } + tmp = obj[0]; + do { + tmp = this._previousSibling(tmp); + } while (tmp && tmp.offsetHeight === 0); + if(tmp !== null) { + obj = $(tmp); + while(obj.hasClass("jstree-open")) { + obj = obj.children(".jstree-children").first().children(".jstree-node:visible:last"); + } + return obj; + } + tmp = obj[0].parentNode.parentNode; + return tmp && tmp.className && tmp.className.indexOf('jstree-node') !== -1 ? $(tmp) : false; + }, + /** + * get the parent ID of a node + * @name get_parent(obj) + * @param {mixed} obj + * @return {String} + */ + get_parent : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + return obj.parent; + }, + /** + * get a jQuery collection of all the children of a node (node must be rendered), returns false on error + * @name get_children_dom(obj) + * @param {mixed} obj + * @return {jQuery} + */ + get_children_dom : function (obj) { + obj = this.get_node(obj, true); + if(obj[0] === this.element[0]) { + return this.get_container_ul().children(".jstree-node"); + } + if(!obj || !obj.length) { + return false; + } + return obj.children(".jstree-children").children(".jstree-node"); + }, + /** + * checks if a node has children + * @name is_parent(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_parent : function (obj) { + obj = this.get_node(obj); + return obj && (obj.state.loaded === false || obj.children.length > 0); + }, + /** + * checks if a node is loaded (its children are available) + * @name is_loaded(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_loaded : function (obj) { + obj = this.get_node(obj); + return obj && obj.state.loaded; + }, + /** + * check if a node is currently loading (fetching children) + * @name is_loading(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_loading : function (obj) { + obj = this.get_node(obj); + return obj && obj.state && obj.state.loading; + }, + /** + * check if a node is opened + * @name is_open(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_open : function (obj) { + obj = this.get_node(obj); + return obj && obj.state.opened; + }, + /** + * check if a node is in a closed state + * @name is_closed(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_closed : function (obj) { + obj = this.get_node(obj); + return obj && this.is_parent(obj) && !obj.state.opened; + }, + /** + * check if a node has no children + * @name is_leaf(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_leaf : function (obj) { + return !this.is_parent(obj); + }, + /** + * loads a node (fetches its children using the `core.data` setting). Multiple nodes can be passed to by using an array. + * @name load_node(obj [, callback]) + * @param {mixed} obj + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives two arguments - the node and a boolean status + * @return {Boolean} + * @trigger load_node.jstree + */ + load_node : function (obj, callback) { + var k, l, i, j, c; + if($.isArray(obj)) { + this._load_nodes(obj.slice(), callback); + return true; + } + obj = this.get_node(obj); + if(!obj) { + if(callback) { callback.call(this, obj, false); } + return false; + } + // if(obj.state.loading) { } // the node is already loading - just wait for it to load and invoke callback? but if called implicitly it should be loaded again? + if(obj.state.loaded) { + obj.state.loaded = false; + for(i = 0, j = obj.parents.length; i < j; i++) { + this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { + return $.inArray(v, obj.children_d) === -1; + }); + } + for(k = 0, l = obj.children_d.length; k < l; k++) { + if(this._model.data[obj.children_d[k]].state.selected) { + c = true; + } + delete this._model.data[obj.children_d[k]]; + } + if (c) { + this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { + return $.inArray(v, obj.children_d) === -1; + }); + } + obj.children = []; + obj.children_d = []; + if(c) { + this.trigger('changed', { 'action' : 'load_node', 'node' : obj, 'selected' : this._data.core.selected }); + } + } + obj.state.failed = false; + obj.state.loading = true; + this.get_node(obj, true).addClass("jstree-loading").attr('aria-busy',true); + this._load_node(obj, $.proxy(function (status) { + obj = this._model.data[obj.id]; + obj.state.loading = false; + obj.state.loaded = status; + obj.state.failed = !obj.state.loaded; + var dom = this.get_node(obj, true), i = 0, j = 0, m = this._model.data, has_children = false; + for(i = 0, j = obj.children.length; i < j; i++) { + if(m[obj.children[i]] && !m[obj.children[i]].state.hidden) { + has_children = true; + break; + } + } + if(obj.state.loaded && dom && dom.length) { + dom.removeClass('jstree-closed jstree-open jstree-leaf'); + if (!has_children) { + dom.addClass('jstree-leaf'); + } + else { + if (obj.id !== '#') { + dom.addClass(obj.state.opened ? 'jstree-open' : 'jstree-closed'); + } + } + } + dom.removeClass("jstree-loading").attr('aria-busy',false); + /** + * triggered after a node is loaded + * @event + * @name load_node.jstree + * @param {Object} node the node that was loading + * @param {Boolean} status was the node loaded successfully + */ + this.trigger('load_node', { "node" : obj, "status" : status }); + if(callback) { + callback.call(this, obj, status); + } + }, this)); + return true; + }, + /** + * load an array of nodes (will also load unavailable nodes as soon as they appear in the structure). Used internally. + * @private + * @name _load_nodes(nodes [, callback]) + * @param {array} nodes + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - the array passed to _load_nodes + */ + _load_nodes : function (nodes, callback, is_callback, force_reload) { + var r = true, + c = function () { this._load_nodes(nodes, callback, true); }, + m = this._model.data, i, j, tmp = []; + for(i = 0, j = nodes.length; i < j; i++) { + if(m[nodes[i]] && ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || (!is_callback && force_reload) )) { + if(!this.is_loading(nodes[i])) { + this.load_node(nodes[i], c); + } + r = false; + } + } + if(r) { + for(i = 0, j = nodes.length; i < j; i++) { + if(m[nodes[i]] && m[nodes[i]].state.loaded) { + tmp.push(nodes[i]); + } + } + if(callback && !callback.done) { + callback.call(this, tmp); + callback.done = true; + } + } + }, + /** + * loads all unloaded nodes + * @name load_all([obj, callback]) + * @param {mixed} obj the node to load recursively, omit to load all nodes in the tree + * @param {function} callback a function to be executed once loading all the nodes is complete, + * @trigger load_all.jstree + */ + load_all : function (obj, callback) { + if(!obj) { obj = $.jstree.root; } + obj = this.get_node(obj); + if(!obj) { return false; } + var to_load = [], + m = this._model.data, + c = m[obj.id].children_d, + i, j; + if(obj.state && !obj.state.loaded) { + to_load.push(obj.id); + } + for(i = 0, j = c.length; i < j; i++) { + if(m[c[i]] && m[c[i]].state && !m[c[i]].state.loaded) { + to_load.push(c[i]); + } + } + if(to_load.length) { + this._load_nodes(to_load, function () { + this.load_all(obj, callback); + }); + } + else { + /** + * triggered after a load_all call completes + * @event + * @name load_all.jstree + * @param {Object} node the recursively loaded node + */ + if(callback) { callback.call(this, obj); } + this.trigger('load_all', { "node" : obj }); + } + }, + /** + * handles the actual loading of a node. Used only internally. + * @private + * @name _load_node(obj [, callback]) + * @param {mixed} obj + * @param {function} callback a function to be executed once loading is complete, the function is executed in the instance's scope and receives one argument - a boolean status + * @return {Boolean} + */ + _load_node : function (obj, callback) { + var s = this.settings.core.data, t; + var notTextOrCommentNode = function notTextOrCommentNode () { + return this.nodeType !== 3 && this.nodeType !== 8; + }; + // use original HTML + if(!s) { + if(obj.id === $.jstree.root) { + return this._append_html_data(obj, this._data.core.original_container_html.clone(true), function (status) { + callback.call(this, status); + }); + } + else { + return callback.call(this, false); + } + // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false); + } + if($.isFunction(s)) { + return s.call(this, obj, $.proxy(function (d) { + if(d === false) { + callback.call(this, false); + } + else { + this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $($.parseHTML(d)).filter(notTextOrCommentNode) : d, function (status) { + callback.call(this, status); + }); + } + // return d === false ? callback.call(this, false) : callback.call(this, this[typeof d === 'string' ? '_append_html_data' : '_append_json_data'](obj, typeof d === 'string' ? $(d) : d)); + }, this)); + } + if(typeof s === 'object') { + if(s.url) { + s = $.extend(true, {}, s); + if($.isFunction(s.url)) { + s.url = s.url.call(this, obj); + } + if($.isFunction(s.data)) { + s.data = s.data.call(this, obj); + } + return $.ajax(s) + .done($.proxy(function (d,t,x) { + var type = x.getResponseHeader('Content-Type'); + if((type && type.indexOf('json') !== -1) || typeof d === "object") { + return this._append_json_data(obj, d, function (status) { callback.call(this, status); }); + //return callback.call(this, this._append_json_data(obj, d)); + } + if((type && type.indexOf('html') !== -1) || typeof d === "string") { + return this._append_html_data(obj, $($.parseHTML(d)).filter(notTextOrCommentNode), function (status) { callback.call(this, status); }); + // return callback.call(this, this._append_html_data(obj, $(d))); + } + this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : x }) }; + this.settings.core.error.call(this, this._data.core.last_error); + return callback.call(this, false); + }, this)) + .fail($.proxy(function (f) { + this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'core', 'id' : 'core_04', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id, 'xhr' : f }) }; + callback.call(this, false); + this.settings.core.error.call(this, this._data.core.last_error); + }, this)); + } + if ($.isArray(s)) { + t = $.extend(true, [], s); + } else if ($.isPlainObject(s)) { + t = $.extend(true, {}, s); + } else { + t = s; + } + if(obj.id === $.jstree.root) { + return this._append_json_data(obj, t, function (status) { + callback.call(this, status); + }); + } + else { + this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_05', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; + this.settings.core.error.call(this, this._data.core.last_error); + return callback.call(this, false); + } + //return callback.call(this, (obj.id === $.jstree.root ? this._append_json_data(obj, t) : false) ); + } + if(typeof s === 'string') { + if(obj.id === $.jstree.root) { + return this._append_html_data(obj, $($.parseHTML(s)).filter(notTextOrCommentNode), function (status) { + callback.call(this, status); + }); + } + else { + this._data.core.last_error = { 'error' : 'nodata', 'plugin' : 'core', 'id' : 'core_06', 'reason' : 'Could not load node', 'data' : JSON.stringify({ 'id' : obj.id }) }; + this.settings.core.error.call(this, this._data.core.last_error); + return callback.call(this, false); + } + //return callback.call(this, (obj.id === $.jstree.root ? this._append_html_data(obj, $(s)) : false) ); + } + return callback.call(this, false); + }, + /** + * adds a node to the list of nodes to redraw. Used only internally. + * @private + * @name _node_changed(obj [, callback]) + * @param {mixed} obj + */ + _node_changed : function (obj) { + obj = this.get_node(obj); + if (obj && $.inArray(obj.id, this._model.changed) === -1) { + this._model.changed.push(obj.id); + } + }, + /** + * appends HTML content to the tree. Used internally. + * @private + * @name _append_html_data(obj, data) + * @param {mixed} obj the node to append to + * @param {String} data the HTML string to parse and append + * @trigger model.jstree, changed.jstree + */ + _append_html_data : function (dom, data, cb) { + dom = this.get_node(dom); + dom.children = []; + dom.children_d = []; + var dat = data.is('ul') ? data.children() : data, + par = dom.id, + chd = [], + dpc = [], + m = this._model.data, + p = m[par], + s = this._data.core.selected.length, + tmp, i, j; + dat.each($.proxy(function (i, v) { + tmp = this._parse_model_from_html($(v), par, p.parents.concat()); + if(tmp) { + chd.push(tmp); + dpc.push(tmp); + if(m[tmp].children_d.length) { + dpc = dpc.concat(m[tmp].children_d); + } + } + }, this)); + p.children = chd; + p.children_d = dpc; + for(i = 0, j = p.parents.length; i < j; i++) { + m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); + } + /** + * triggered when new data is inserted to the tree model + * @event + * @name model.jstree + * @param {Array} nodes an array of node IDs + * @param {String} parent the parent ID of the nodes + */ + this.trigger('model', { "nodes" : dpc, 'parent' : par }); + if(par !== $.jstree.root) { + this._node_changed(par); + this.redraw(); + } + else { + this.get_container_ul().children('.jstree-initial-node').remove(); + this.redraw(true); + } + if(this._data.core.selected.length !== s) { + this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); + } + cb.call(this, true); + }, + /** + * appends JSON content to the tree. Used internally. + * @private + * @name _append_json_data(obj, data) + * @param {mixed} obj the node to append to + * @param {String} data the JSON object to parse and append + * @param {Boolean} force_processing internal param - do not set + * @trigger model.jstree, changed.jstree + */ + _append_json_data : function (dom, data, cb, force_processing) { + if(this.element === null) { return; } + dom = this.get_node(dom); + dom.children = []; + dom.children_d = []; + // *%$@!!! + if(data.d) { + data = data.d; + if(typeof data === "string") { + data = JSON.parse(data); + } + } + if(!$.isArray(data)) { data = [data]; } + var w = null, + args = { + 'df' : this._model.default_state, + 'dat' : data, + 'par' : dom.id, + 'm' : this._model.data, + 't_id' : this._id, + 't_cnt' : this._cnt, + 'sel' : this._data.core.selected + }, + func = function (data, undefined) { + if(data.data) { data = data.data; } + var dat = data.dat, + par = data.par, + chd = [], + dpc = [], + add = [], + df = data.df, + t_id = data.t_id, + t_cnt = data.t_cnt, + m = data.m, + p = m[par], + sel = data.sel, + tmp, i, j, rslt, + parse_flat = function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = d.id.toString(), + i, j, c, e, + tmp = { + id : tid, + text : d.text || '', + icon : d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : d.children || [], + children_d : d.children_d || [], + data : d.data, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tid; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + m[tmp.id] = tmp; + for(i = 0, j = tmp.children.length; i < j; i++) { + c = parse_flat(m[tmp.children[i]], tmp.id, ps); + e = m[c]; + tmp.children_d.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + delete d.data; + delete d.children; + m[tmp.id].original = d; + if(tmp.state.selected) { + add.push(tmp.id); + } + return tmp.id; + }, + parse_nest = function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = false, i, j, c, e, tmp; + do { + tid = 'j' + t_id + '_' + (++t_cnt); + } while(m[tid]); + + tmp = { + id : false, + text : typeof d === 'string' ? d : '', + icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : [], + children_d : [], + data : null, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.id) { tmp.id = d.id.toString(); } + if(d && d.text) { tmp.text = d.text; } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(tmp.li_attr.id && !tmp.id) { + tmp.id = tmp.li_attr.id.toString(); + } + if(!tmp.id) { + tmp.id = tid; + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tmp.id; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children.length) { + for(i = 0, j = d.children.length; i < j; i++) { + c = parse_nest(d.children[i], tmp.id, ps); + e = m[c]; + tmp.children.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + tmp.children_d = tmp.children_d.concat(tmp.children); + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + delete d.data; + delete d.children; + tmp.original = d; + m[tmp.id] = tmp; + if(tmp.state.selected) { + add.push(tmp.id); + } + return tmp.id; + }; + + if(dat.length && dat[0].id !== undefined && dat[0].parent !== undefined) { + // Flat JSON support (for easy import from DB): + // 1) convert to object (foreach) + for(i = 0, j = dat.length; i < j; i++) { + if(!dat[i].children) { + dat[i].children = []; + } + if(!dat[i].state) { + dat[i].state = {}; + } + m[dat[i].id.toString()] = dat[i]; + } + // 2) populate children (foreach) + for(i = 0, j = dat.length; i < j; i++) { + if (!m[dat[i].parent.toString()]) { + this._data.core.last_error = { 'error' : 'parse', 'plugin' : 'core', 'id' : 'core_07', 'reason' : 'Node with invalid parent', 'data' : JSON.stringify({ 'id' : dat[i].id.toString(), 'parent' : dat[i].parent.toString() }) }; + this.settings.core.error.call(this, this._data.core.last_error); + continue; + } + + m[dat[i].parent.toString()].children.push(dat[i].id.toString()); + // populate parent.children_d + p.children_d.push(dat[i].id.toString()); + } + // 3) normalize && populate parents and children_d with recursion + for(i = 0, j = p.children.length; i < j; i++) { + tmp = parse_flat(m[p.children[i]], par, p.parents.concat()); + dpc.push(tmp); + if(m[tmp].children_d.length) { + dpc = dpc.concat(m[tmp].children_d); + } + } + for(i = 0, j = p.parents.length; i < j; i++) { + m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); + } + // ?) three_state selection - p.state.selected && t - (if three_state foreach(dat => ch) -> foreach(parents) if(parent.selected) child.selected = true; + rslt = { + 'cnt' : t_cnt, + 'mod' : m, + 'sel' : sel, + 'par' : par, + 'dpc' : dpc, + 'add' : add + }; + } + else { + for(i = 0, j = dat.length; i < j; i++) { + tmp = parse_nest(dat[i], par, p.parents.concat()); + if(tmp) { + chd.push(tmp); + dpc.push(tmp); + if(m[tmp].children_d.length) { + dpc = dpc.concat(m[tmp].children_d); + } + } + } + p.children = chd; + p.children_d = dpc; + for(i = 0, j = p.parents.length; i < j; i++) { + m[p.parents[i]].children_d = m[p.parents[i]].children_d.concat(dpc); + } + rslt = { + 'cnt' : t_cnt, + 'mod' : m, + 'sel' : sel, + 'par' : par, + 'dpc' : dpc, + 'add' : add + }; + } + if(typeof window === 'undefined' || typeof window.document === 'undefined') { + postMessage(rslt); + } + else { + return rslt; + } + }, + rslt = function (rslt, worker) { + if(this.element === null) { return; } + this._cnt = rslt.cnt; + var i, m = this._model.data; + for (i in m) { + if (m.hasOwnProperty(i) && m[i].state && m[i].state.loading && rslt.mod[i]) { + rslt.mod[i].state.loading = true; + } + } + this._model.data = rslt.mod; // breaks the reference in load_node - careful + + if(worker) { + var j, a = rslt.add, r = rslt.sel, s = this._data.core.selected.slice(); + m = this._model.data; + // if selection was changed while calculating in worker + if(r.length !== s.length || $.vakata.array_unique(r.concat(s)).length !== r.length) { + // deselect nodes that are no longer selected + for(i = 0, j = r.length; i < j; i++) { + if($.inArray(r[i], a) === -1 && $.inArray(r[i], s) === -1) { + m[r[i]].state.selected = false; + } + } + // select nodes that were selected in the mean time + for(i = 0, j = s.length; i < j; i++) { + if($.inArray(s[i], r) === -1) { + m[s[i]].state.selected = true; + } + } + } + } + if(rslt.add.length) { + this._data.core.selected = this._data.core.selected.concat(rslt.add); + } + + this.trigger('model', { "nodes" : rslt.dpc, 'parent' : rslt.par }); + + if(rslt.par !== $.jstree.root) { + this._node_changed(rslt.par); + this.redraw(); + } + else { + // this.get_container_ul().children('.jstree-initial-node').remove(); + this.redraw(true); + } + if(rslt.add.length) { + this.trigger('changed', { 'action' : 'model', 'selected' : this._data.core.selected }); + } + cb.call(this, true); + }; + if(this.settings.core.worker && window.Blob && window.URL && window.Worker) { + try { + if(this._wrk === null) { + this._wrk = window.URL.createObjectURL( + new window.Blob( + ['self.onmessage = ' + func.toString()], + {type:"text/javascript"} + ) + ); + } + if(!this._data.core.working || force_processing) { + this._data.core.working = true; + w = new window.Worker(this._wrk); + w.onmessage = $.proxy(function (e) { + rslt.call(this, e.data, true); + try { w.terminate(); w = null; } catch(ignore) { } + if(this._data.core.worker_queue.length) { + this._append_json_data.apply(this, this._data.core.worker_queue.shift()); + } + else { + this._data.core.working = false; + } + }, this); + if(!args.par) { + if(this._data.core.worker_queue.length) { + this._append_json_data.apply(this, this._data.core.worker_queue.shift()); + } + else { + this._data.core.working = false; + } + } + else { + w.postMessage(args); + } + } + else { + this._data.core.worker_queue.push([dom, data, cb, true]); + } + } + catch(e) { + rslt.call(this, func(args), false); + if(this._data.core.worker_queue.length) { + this._append_json_data.apply(this, this._data.core.worker_queue.shift()); + } + else { + this._data.core.working = false; + } + } + } + else { + rslt.call(this, func(args), false); + } + }, + /** + * parses a node from a jQuery object and appends them to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_html(d [, p, ps]) + * @param {jQuery} d the jQuery object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_html : function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = [].concat(ps); } + if(p) { ps.unshift(p); } + var c, e, m = this._model.data, + data = { + id : false, + text : false, + icon : true, + parent : p, + parents : ps, + children : [], + children_d : [], + data : null, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }, i, tmp, tid; + for(i in this._model.default_state) { + if(this._model.default_state.hasOwnProperty(i)) { + data.state[i] = this._model.default_state[i]; + } + } + tmp = $.vakata.attributes(d, true); + $.each(tmp, function (i, v) { + v = $.trim(v); + if(!v.length) { return true; } + data.li_attr[i] = v; + if(i === 'id') { + data.id = v.toString(); + } + }); + tmp = d.children('a').first(); + if(tmp.length) { + tmp = $.vakata.attributes(tmp, true); + $.each(tmp, function (i, v) { + v = $.trim(v); + if(v.length) { + data.a_attr[i] = v; + } + }); + } + tmp = d.children("a").first().length ? d.children("a").first().clone() : d.clone(); + tmp.children("ins, i, ul").remove(); + tmp = tmp.html(); + tmp = $('
        ').html(tmp); + data.text = this.settings.core.force_text ? tmp.text() : tmp.html(); + tmp = d.data(); + data.data = tmp ? $.extend(true, {}, tmp) : null; + data.state.opened = d.hasClass('jstree-open'); + data.state.selected = d.children('a').hasClass('jstree-clicked'); + data.state.disabled = d.children('a').hasClass('jstree-disabled'); + if(data.data && data.data.jstree) { + for(i in data.data.jstree) { + if(data.data.jstree.hasOwnProperty(i)) { + data.state[i] = data.data.jstree[i]; + } + } + } + tmp = d.children("a").children(".jstree-themeicon"); + if(tmp.length) { + data.icon = tmp.hasClass('jstree-themeicon-hidden') ? false : tmp.attr('rel'); + } + if(data.state.icon !== undefined) { + data.icon = data.state.icon; + } + if(data.icon === undefined || data.icon === null || data.icon === "") { + data.icon = true; + } + tmp = d.children("ul").children("li"); + do { + tid = 'j' + this._id + '_' + (++this._cnt); + } while(m[tid]); + data.id = data.li_attr.id ? data.li_attr.id.toString() : tid; + if(tmp.length) { + tmp.each($.proxy(function (i, v) { + c = this._parse_model_from_html($(v), data.id, ps); + e = this._model.data[c]; + data.children.push(c); + if(e.children_d.length) { + data.children_d = data.children_d.concat(e.children_d); + } + }, this)); + data.children_d = data.children_d.concat(data.children); + } + else { + if(d.hasClass('jstree-closed')) { + data.state.loaded = false; + } + } + if(data.li_attr['class']) { + data.li_attr['class'] = data.li_attr['class'].replace('jstree-closed','').replace('jstree-open',''); + } + if(data.a_attr['class']) { + data.a_attr['class'] = data.a_attr['class'].replace('jstree-clicked','').replace('jstree-disabled',''); + } + m[data.id] = data; + if(data.state.selected) { + this._data.core.selected.push(data.id); + } + return data.id; + }, + /** + * parses a node from a JSON object (used when dealing with flat data, which has no nesting of children, but has id and parent properties) and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_flat_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_flat_json : function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = d.id.toString(), + m = this._model.data, + df = this._model.default_state, + i, j, c, e, + tmp = { + id : tid, + text : d.text || '', + icon : d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : d.children || [], + children_d : d.children_d || [], + data : d.data, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tid; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + m[tmp.id] = tmp; + for(i = 0, j = tmp.children.length; i < j; i++) { + c = this._parse_model_from_flat_json(m[tmp.children[i]], tmp.id, ps); + e = m[c]; + tmp.children_d.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + delete d.data; + delete d.children; + m[tmp.id].original = d; + if(tmp.state.selected) { + this._data.core.selected.push(tmp.id); + } + return tmp.id; + }, + /** + * parses a node from a JSON object and appends it to the in memory tree model. Used internally. + * @private + * @name _parse_model_from_json(d [, p, ps]) + * @param {Object} d the JSON object to parse + * @param {String} p the parent ID + * @param {Array} ps list of all parents + * @return {String} the ID of the object added to the model + */ + _parse_model_from_json : function (d, p, ps) { + if(!ps) { ps = []; } + else { ps = ps.concat(); } + if(p) { ps.unshift(p); } + var tid = false, i, j, c, e, m = this._model.data, df = this._model.default_state, tmp; + do { + tid = 'j' + this._id + '_' + (++this._cnt); + } while(m[tid]); + + tmp = { + id : false, + text : typeof d === 'string' ? d : '', + icon : typeof d === 'object' && d.icon !== undefined ? d.icon : true, + parent : p, + parents : ps, + children : [], + children_d : [], + data : null, + state : { }, + li_attr : { id : false }, + a_attr : { href : '#' }, + original : false + }; + for(i in df) { + if(df.hasOwnProperty(i)) { + tmp.state[i] = df[i]; + } + } + if(d && d.id) { tmp.id = d.id.toString(); } + if(d && d.text) { tmp.text = d.text; } + if(d && d.data && d.data.jstree && d.data.jstree.icon) { + tmp.icon = d.data.jstree.icon; + } + if(tmp.icon === undefined || tmp.icon === null || tmp.icon === "") { + tmp.icon = true; + } + if(d && d.data) { + tmp.data = d.data; + if(d.data.jstree) { + for(i in d.data.jstree) { + if(d.data.jstree.hasOwnProperty(i)) { + tmp.state[i] = d.data.jstree[i]; + } + } + } + } + if(d && typeof d.state === 'object') { + for (i in d.state) { + if(d.state.hasOwnProperty(i)) { + tmp.state[i] = d.state[i]; + } + } + } + if(d && typeof d.li_attr === 'object') { + for (i in d.li_attr) { + if(d.li_attr.hasOwnProperty(i)) { + tmp.li_attr[i] = d.li_attr[i]; + } + } + } + if(tmp.li_attr.id && !tmp.id) { + tmp.id = tmp.li_attr.id.toString(); + } + if(!tmp.id) { + tmp.id = tid; + } + if(!tmp.li_attr.id) { + tmp.li_attr.id = tmp.id; + } + if(d && typeof d.a_attr === 'object') { + for (i in d.a_attr) { + if(d.a_attr.hasOwnProperty(i)) { + tmp.a_attr[i] = d.a_attr[i]; + } + } + } + if(d && d.children && d.children.length) { + for(i = 0, j = d.children.length; i < j; i++) { + c = this._parse_model_from_json(d.children[i], tmp.id, ps); + e = m[c]; + tmp.children.push(c); + if(e.children_d.length) { + tmp.children_d = tmp.children_d.concat(e.children_d); + } + } + tmp.children_d = tmp.children_d.concat(tmp.children); + } + if(d && d.children && d.children === true) { + tmp.state.loaded = false; + tmp.children = []; + tmp.children_d = []; + } + delete d.data; + delete d.children; + tmp.original = d; + m[tmp.id] = tmp; + if(tmp.state.selected) { + this._data.core.selected.push(tmp.id); + } + return tmp.id; + }, + /** + * redraws all nodes that need to be redrawn. Used internally. + * @private + * @name _redraw() + * @trigger redraw.jstree + */ + _redraw : function () { + var nodes = this._model.force_full_redraw ? this._model.data[$.jstree.root].children.concat([]) : this._model.changed.concat([]), + f = document.createElement('UL'), tmp, i, j, fe = this._data.core.focused; + for(i = 0, j = nodes.length; i < j; i++) { + tmp = this.redraw_node(nodes[i], true, this._model.force_full_redraw); + if(tmp && this._model.force_full_redraw) { + f.appendChild(tmp); + } + } + if(this._model.force_full_redraw) { + f.className = this.get_container_ul()[0].className; + f.setAttribute('role','group'); + this.element.empty().append(f); + //this.get_container_ul()[0].appendChild(f); + } + if(fe !== null && this.settings.core.restore_focus) { + tmp = this.get_node(fe, true); + if(tmp && tmp.length && tmp.children('.jstree-anchor')[0] !== document.activeElement) { + tmp.children('.jstree-anchor').focus(); + } + else { + this._data.core.focused = null; + } + } + this._model.force_full_redraw = false; + this._model.changed = []; + /** + * triggered after nodes are redrawn + * @event + * @name redraw.jstree + * @param {array} nodes the redrawn nodes + */ + this.trigger('redraw', { "nodes" : nodes }); + }, + /** + * redraws all nodes that need to be redrawn or optionally - the whole tree + * @name redraw([full]) + * @param {Boolean} full if set to `true` all nodes are redrawn. + */ + redraw : function (full) { + if(full) { + this._model.force_full_redraw = true; + } + //if(this._model.redraw_timeout) { + // clearTimeout(this._model.redraw_timeout); + //} + //this._model.redraw_timeout = setTimeout($.proxy(this._redraw, this),0); + this._redraw(); + }, + /** + * redraws a single node's children. Used internally. + * @private + * @name draw_children(node) + * @param {mixed} node the node whose children will be redrawn + */ + draw_children : function (node) { + var obj = this.get_node(node), + i = false, + j = false, + k = false, + d = document; + if(!obj) { return false; } + if(obj.id === $.jstree.root) { return this.redraw(true); } + node = this.get_node(node, true); + if(!node || !node.length) { return false; } // TODO: quick toggle + + node.children('.jstree-children').remove(); + node = node[0]; + if(obj.children.length && obj.state.loaded) { + k = d.createElement('UL'); + k.setAttribute('role', 'group'); + k.className = 'jstree-children'; + for(i = 0, j = obj.children.length; i < j; i++) { + k.appendChild(this.redraw_node(obj.children[i], true, true)); + } + node.appendChild(k); + } + }, + /** + * redraws a single node. Used internally. + * @private + * @name redraw_node(node, deep, is_callback, force_render) + * @param {mixed} node the node to redraw + * @param {Boolean} deep should child nodes be redrawn too + * @param {Boolean} is_callback is this a recursion call + * @param {Boolean} force_render should children of closed parents be drawn anyway + */ + redraw_node : function (node, deep, is_callback, force_render) { + var obj = this.get_node(node), + par = false, + ind = false, + old = false, + i = false, + j = false, + k = false, + c = '', + d = document, + m = this._model.data, + f = false, + s = false, + tmp = null, + t = 0, + l = 0, + has_children = false, + last_sibling = false; + if(!obj) { return false; } + if(obj.id === $.jstree.root) { return this.redraw(true); } + deep = deep || obj.children.length === 0; + node = !document.querySelector ? document.getElementById(obj.id) : this.element[0].querySelector('#' + ("0123456789".indexOf(obj.id[0]) !== -1 ? '\\3' + obj.id[0] + ' ' + obj.id.substr(1).replace($.jstree.idregex,'\\$&') : obj.id.replace($.jstree.idregex,'\\$&')) ); //, this.element); + if(!node) { + deep = true; + //node = d.createElement('LI'); + if(!is_callback) { + par = obj.parent !== $.jstree.root ? $('#' + obj.parent.replace($.jstree.idregex,'\\$&'), this.element)[0] : null; + if(par !== null && (!par || !m[obj.parent].state.opened)) { + return false; + } + ind = $.inArray(obj.id, par === null ? m[$.jstree.root].children : m[obj.parent].children); + } + } + else { + node = $(node); + if(!is_callback) { + par = node.parent().parent()[0]; + if(par === this.element[0]) { + par = null; + } + ind = node.index(); + } + // m[obj.id].data = node.data(); // use only node's data, no need to touch jquery storage + if(!deep && obj.children.length && !node.children('.jstree-children').length) { + deep = true; + } + if(!deep) { + old = node.children('.jstree-children')[0]; + } + f = node.children('.jstree-anchor')[0] === document.activeElement; + node.remove(); + //node = d.createElement('LI'); + //node = node[0]; + } + node = this._data.core.node.cloneNode(true); + // node is DOM, deep is boolean + + c = 'jstree-node '; + for(i in obj.li_attr) { + if(obj.li_attr.hasOwnProperty(i)) { + if(i === 'id') { continue; } + if(i !== 'class') { + node.setAttribute(i, obj.li_attr[i]); + } + else { + c += obj.li_attr[i]; + } + } + } + if(!obj.a_attr.id) { + obj.a_attr.id = obj.id + '_anchor'; + } + node.setAttribute('aria-selected', !!obj.state.selected); + node.setAttribute('aria-level', obj.parents.length); + node.setAttribute('aria-labelledby', obj.a_attr.id); + if(obj.state.disabled) { + node.setAttribute('aria-disabled', true); + } + + for(i = 0, j = obj.children.length; i < j; i++) { + if(!m[obj.children[i]].state.hidden) { + has_children = true; + break; + } + } + if(obj.parent !== null && m[obj.parent] && !obj.state.hidden) { + i = $.inArray(obj.id, m[obj.parent].children); + last_sibling = obj.id; + if(i !== -1) { + i++; + for(j = m[obj.parent].children.length; i < j; i++) { + if(!m[m[obj.parent].children[i]].state.hidden) { + last_sibling = m[obj.parent].children[i]; + } + if(last_sibling !== obj.id) { + break; + } + } + } + } + + if(obj.state.hidden) { + c += ' jstree-hidden'; + } + if (obj.state.loading) { + c += ' jstree-loading'; + } + if(obj.state.loaded && !has_children) { + c += ' jstree-leaf'; + } + else { + c += obj.state.opened && obj.state.loaded ? ' jstree-open' : ' jstree-closed'; + node.setAttribute('aria-expanded', (obj.state.opened && obj.state.loaded) ); + } + if(last_sibling === obj.id) { + c += ' jstree-last'; + } + node.id = obj.id; + node.className = c; + c = ( obj.state.selected ? ' jstree-clicked' : '') + ( obj.state.disabled ? ' jstree-disabled' : ''); + for(j in obj.a_attr) { + if(obj.a_attr.hasOwnProperty(j)) { + if(j === 'href' && obj.a_attr[j] === '#') { continue; } + if(j !== 'class') { + node.childNodes[1].setAttribute(j, obj.a_attr[j]); + } + else { + c += ' ' + obj.a_attr[j]; + } + } + } + if(c.length) { + node.childNodes[1].className = 'jstree-anchor ' + c; + } + if((obj.icon && obj.icon !== true) || obj.icon === false) { + if(obj.icon === false) { + node.childNodes[1].childNodes[0].className += ' jstree-themeicon-hidden'; + } + else if(obj.icon.indexOf('/') === -1 && obj.icon.indexOf('.') === -1) { + node.childNodes[1].childNodes[0].className += ' ' + obj.icon + ' jstree-themeicon-custom'; + } + else { + node.childNodes[1].childNodes[0].style.backgroundImage = 'url("'+obj.icon+'")'; + node.childNodes[1].childNodes[0].style.backgroundPosition = 'center center'; + node.childNodes[1].childNodes[0].style.backgroundSize = 'auto'; + node.childNodes[1].childNodes[0].className += ' jstree-themeicon-custom'; + } + } + + if(this.settings.core.force_text) { + node.childNodes[1].appendChild(d.createTextNode(obj.text)); + } + else { + node.childNodes[1].innerHTML += obj.text; + } + + + if(deep && obj.children.length && (obj.state.opened || force_render) && obj.state.loaded) { + k = d.createElement('UL'); + k.setAttribute('role', 'group'); + k.className = 'jstree-children'; + for(i = 0, j = obj.children.length; i < j; i++) { + k.appendChild(this.redraw_node(obj.children[i], deep, true)); + } + node.appendChild(k); + } + if(old) { + node.appendChild(old); + } + if(!is_callback) { + // append back using par / ind + if(!par) { + par = this.element[0]; + } + for(i = 0, j = par.childNodes.length; i < j; i++) { + if(par.childNodes[i] && par.childNodes[i].className && par.childNodes[i].className.indexOf('jstree-children') !== -1) { + tmp = par.childNodes[i]; + break; + } + } + if(!tmp) { + tmp = d.createElement('UL'); + tmp.setAttribute('role', 'group'); + tmp.className = 'jstree-children'; + par.appendChild(tmp); + } + par = tmp; + + if(ind < par.childNodes.length) { + par.insertBefore(node, par.childNodes[ind]); + } + else { + par.appendChild(node); + } + if(f) { + t = this.element[0].scrollTop; + l = this.element[0].scrollLeft; + node.childNodes[1].focus(); + this.element[0].scrollTop = t; + this.element[0].scrollLeft = l; + } + } + if(obj.state.opened && !obj.state.loaded) { + obj.state.opened = false; + setTimeout($.proxy(function () { + this.open_node(obj.id, false, 0); + }, this), 0); + } + return node; + }, + /** + * opens a node, revealing its children. If the node is not loaded it will be loaded and opened once ready. + * @name open_node(obj [, callback, animation]) + * @param {mixed} obj the node to open + * @param {Function} callback a function to execute once the node is opened + * @param {Number} animation the animation duration in milliseconds when opening the node (overrides the `core.animation` setting). Use `false` for no animation. + * @trigger open_node.jstree, after_open.jstree, before_open.jstree + */ + open_node : function (obj, callback, animation) { + var t1, t2, d, t; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.open_node(obj[t1], callback, animation); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + animation = animation === undefined ? this.settings.core.animation : animation; + if(!this.is_closed(obj)) { + if(callback) { + callback.call(this, obj, false); + } + return false; + } + if(!this.is_loaded(obj)) { + if(this.is_loading(obj)) { + return setTimeout($.proxy(function () { + this.open_node(obj, callback, animation); + }, this), 500); + } + this.load_node(obj, function (o, ok) { + return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false); + }); + } + else { + d = this.get_node(obj, true); + t = this; + if(d.length) { + if(animation && d.children(".jstree-children").length) { + d.children(".jstree-children").stop(true, true); + } + if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) { + this.draw_children(obj); + //d = this.get_node(obj, true); + } + if(!animation) { + this.trigger('before_open', { "node" : obj }); + d[0].className = d[0].className.replace('jstree-closed', 'jstree-open'); + d[0].setAttribute("aria-expanded", true); + } + else { + this.trigger('before_open', { "node" : obj }); + d + .children(".jstree-children").css("display","none").end() + .removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true) + .children(".jstree-children").stop(true, true) + .slideDown(animation, function () { + this.style.display = ""; + if (t.element) { + t.trigger("after_open", { "node" : obj }); + } + }); + } + } + obj.state.opened = true; + if(callback) { + callback.call(this, obj, true); + } + if(!d.length) { + /** + * triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet) + * @event + * @name before_open.jstree + * @param {Object} node the opened node + */ + this.trigger('before_open', { "node" : obj }); + } + /** + * triggered when a node is opened (if there is an animation it will not be completed yet) + * @event + * @name open_node.jstree + * @param {Object} node the opened node + */ + this.trigger('open_node', { "node" : obj }); + if(!animation || !d.length) { + /** + * triggered when a node is opened and the animation is complete + * @event + * @name after_open.jstree + * @param {Object} node the opened node + */ + this.trigger("after_open", { "node" : obj }); + } + return true; + } + }, + /** + * opens every parent of a node (node should be loaded) + * @name _open_to(obj) + * @param {mixed} obj the node to reveal + * @private + */ + _open_to : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + var i, j, p = obj.parents; + for(i = 0, j = p.length; i < j; i+=1) { + if(i !== $.jstree.root) { + this.open_node(p[i], false, 0); + } + } + return $('#' + obj.id.replace($.jstree.idregex,'\\$&'), this.element); + }, + /** + * closes a node, hiding its children + * @name close_node(obj [, animation]) + * @param {mixed} obj the node to close + * @param {Number} animation the animation duration in milliseconds when closing the node (overrides the `core.animation` setting). Use `false` for no animation. + * @trigger close_node.jstree, after_close.jstree + */ + close_node : function (obj, animation) { + var t1, t2, t, d; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.close_node(obj[t1], animation); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + if(this.is_closed(obj)) { + return false; + } + animation = animation === undefined ? this.settings.core.animation : animation; + t = this; + d = this.get_node(obj, true); + + obj.state.opened = false; + /** + * triggered when a node is closed (if there is an animation it will not be complete yet) + * @event + * @name close_node.jstree + * @param {Object} node the closed node + */ + this.trigger('close_node',{ "node" : obj }); + if(!d.length) { + /** + * triggered when a node is closed and the animation is complete + * @event + * @name after_close.jstree + * @param {Object} node the closed node + */ + this.trigger("after_close", { "node" : obj }); + } + else { + if(!animation) { + d[0].className = d[0].className.replace('jstree-open', 'jstree-closed'); + d.attr("aria-expanded", false).children('.jstree-children').remove(); + this.trigger("after_close", { "node" : obj }); + } + else { + d + .children(".jstree-children").attr("style","display:block !important").end() + .removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded", false) + .children(".jstree-children").stop(true, true).slideUp(animation, function () { + this.style.display = ""; + d.children('.jstree-children').remove(); + if (t.element) { + t.trigger("after_close", { "node" : obj }); + } + }); + } + } + }, + /** + * toggles a node - closing it if it is open, opening it if it is closed + * @name toggle_node(obj) + * @param {mixed} obj the node to toggle + */ + toggle_node : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.toggle_node(obj[t1]); + } + return true; + } + if(this.is_closed(obj)) { + return this.open_node(obj); + } + if(this.is_open(obj)) { + return this.close_node(obj); + } + }, + /** + * opens all nodes within a node (or the tree), revealing their children. If the node is not loaded it will be loaded and opened once ready. + * @name open_all([obj, animation, original_obj]) + * @param {mixed} obj the node to open recursively, omit to open all nodes in the tree + * @param {Number} animation the animation duration in milliseconds when opening the nodes, the default is no animation + * @param {jQuery} reference to the node that started the process (internal use) + * @trigger open_all.jstree + */ + open_all : function (obj, animation, original_obj) { + if(!obj) { obj = $.jstree.root; } + obj = this.get_node(obj); + if(!obj) { return false; } + var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), i, j, _this; + if(!dom.length) { + for(i = 0, j = obj.children_d.length; i < j; i++) { + if(this.is_closed(this._model.data[obj.children_d[i]])) { + this._model.data[obj.children_d[i]].state.opened = true; + } + } + return this.trigger('open_all', { "node" : obj }); + } + original_obj = original_obj || dom; + _this = this; + dom = this.is_closed(obj) ? dom.find('.jstree-closed').addBack() : dom.find('.jstree-closed'); + dom.each(function () { + _this.open_node( + this, + function(node, status) { if(status && this.is_parent(node)) { this.open_all(node, animation, original_obj); } }, + animation || 0 + ); + }); + if(original_obj.find('.jstree-closed').length === 0) { + /** + * triggered when an `open_all` call completes + * @event + * @name open_all.jstree + * @param {Object} node the opened node + */ + this.trigger('open_all', { "node" : this.get_node(original_obj) }); + } + }, + /** + * closes all nodes within a node (or the tree), revealing their children + * @name close_all([obj, animation]) + * @param {mixed} obj the node to close recursively, omit to close all nodes in the tree + * @param {Number} animation the animation duration in milliseconds when closing the nodes, the default is no animation + * @trigger close_all.jstree + */ + close_all : function (obj, animation) { + if(!obj) { obj = $.jstree.root; } + obj = this.get_node(obj); + if(!obj) { return false; } + var dom = obj.id === $.jstree.root ? this.get_container_ul() : this.get_node(obj, true), + _this = this, i, j; + if(dom.length) { + dom = this.is_open(obj) ? dom.find('.jstree-open').addBack() : dom.find('.jstree-open'); + $(dom.get().reverse()).each(function () { _this.close_node(this, animation || 0); }); + } + for(i = 0, j = obj.children_d.length; i < j; i++) { + this._model.data[obj.children_d[i]].state.opened = false; + } + /** + * triggered when an `close_all` call completes + * @event + * @name close_all.jstree + * @param {Object} node the closed node + */ + this.trigger('close_all', { "node" : obj }); + }, + /** + * checks if a node is disabled (not selectable) + * @name is_disabled(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_disabled : function (obj) { + obj = this.get_node(obj); + return obj && obj.state && obj.state.disabled; + }, + /** + * enables a node - so that it can be selected + * @name enable_node(obj) + * @param {mixed} obj the node to enable + * @trigger enable_node.jstree + */ + enable_node : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.enable_node(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + obj.state.disabled = false; + this.get_node(obj,true).children('.jstree-anchor').removeClass('jstree-disabled').attr('aria-disabled', false); + /** + * triggered when an node is enabled + * @event + * @name enable_node.jstree + * @param {Object} node the enabled node + */ + this.trigger('enable_node', { 'node' : obj }); + }, + /** + * disables a node - so that it can not be selected + * @name disable_node(obj) + * @param {mixed} obj the node to disable + * @trigger disable_node.jstree + */ + disable_node : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.disable_node(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + obj.state.disabled = true; + this.get_node(obj,true).children('.jstree-anchor').addClass('jstree-disabled').attr('aria-disabled', true); + /** + * triggered when an node is disabled + * @event + * @name disable_node.jstree + * @param {Object} node the disabled node + */ + this.trigger('disable_node', { 'node' : obj }); + }, + /** + * determines if a node is hidden + * @name is_hidden(obj) + * @param {mixed} obj the node + */ + is_hidden : function (obj) { + obj = this.get_node(obj); + return obj.state.hidden === true; + }, + /** + * hides a node - it is still in the structure but will not be visible + * @name hide_node(obj) + * @param {mixed} obj the node to hide + * @param {Boolean} skip_redraw internal parameter controlling if redraw is called + * @trigger hide_node.jstree + */ + hide_node : function (obj, skip_redraw) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.hide_node(obj[t1], true); + } + if (!skip_redraw) { + this.redraw(); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + if(!obj.state.hidden) { + obj.state.hidden = true; + this._node_changed(obj.parent); + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when an node is hidden + * @event + * @name hide_node.jstree + * @param {Object} node the hidden node + */ + this.trigger('hide_node', { 'node' : obj }); + } + }, + /** + * shows a node + * @name show_node(obj) + * @param {mixed} obj the node to show + * @param {Boolean} skip_redraw internal parameter controlling if redraw is called + * @trigger show_node.jstree + */ + show_node : function (obj, skip_redraw) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.show_node(obj[t1], true); + } + if (!skip_redraw) { + this.redraw(); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + if(obj.state.hidden) { + obj.state.hidden = false; + this._node_changed(obj.parent); + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when an node is shown + * @event + * @name show_node.jstree + * @param {Object} node the shown node + */ + this.trigger('show_node', { 'node' : obj }); + } + }, + /** + * hides all nodes + * @name hide_all() + * @trigger hide_all.jstree + */ + hide_all : function (skip_redraw) { + var i, m = this._model.data, ids = []; + for(i in m) { + if(m.hasOwnProperty(i) && i !== $.jstree.root && !m[i].state.hidden) { + m[i].state.hidden = true; + ids.push(i); + } + } + this._model.force_full_redraw = true; + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when all nodes are hidden + * @event + * @name hide_all.jstree + * @param {Array} nodes the IDs of all hidden nodes + */ + this.trigger('hide_all', { 'nodes' : ids }); + return ids; + }, + /** + * shows all nodes + * @name show_all() + * @trigger show_all.jstree + */ + show_all : function (skip_redraw) { + var i, m = this._model.data, ids = []; + for(i in m) { + if(m.hasOwnProperty(i) && i !== $.jstree.root && m[i].state.hidden) { + m[i].state.hidden = false; + ids.push(i); + } + } + this._model.force_full_redraw = true; + if(!skip_redraw) { + this.redraw(); + } + /** + * triggered when all nodes are shown + * @event + * @name show_all.jstree + * @param {Array} nodes the IDs of all shown nodes + */ + this.trigger('show_all', { 'nodes' : ids }); + return ids; + }, + /** + * called when a node is selected by the user. Used internally. + * @private + * @name activate_node(obj, e) + * @param {mixed} obj the node + * @param {Object} e the related event + * @trigger activate_node.jstree, changed.jstree + */ + activate_node : function (obj, e) { + if(this.is_disabled(obj)) { + return false; + } + if(!e || typeof e !== 'object') { + e = {}; + } + + // ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node + this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null; + if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; } + if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); } + + if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) { + if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) { + this.deselect_node(obj, false, e); + } + else { + this.deselect_all(true); + this.select_node(obj, false, false, e); + this._data.core.last_clicked = this.get_node(obj); + } + } + else { + if(e.shiftKey) { + var o = this.get_node(obj).id, + l = this._data.core.last_clicked.id, + p = this.get_node(this._data.core.last_clicked.parent).children, + c = false, + i, j; + for(i = 0, j = p.length; i < j; i += 1) { + // separate IFs work whem o and l are the same + if(p[i] === o) { + c = !c; + } + if(p[i] === l) { + c = !c; + } + if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) { + if (!this.is_hidden(p[i])) { + this.select_node(p[i], true, false, e); + } + } + else { + this.deselect_node(p[i], true, e); + } + } + this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e }); + } + else { + if(!this.is_selected(obj)) { + this.select_node(obj, false, false, e); + } + else { + this.deselect_node(obj, false, e); + } + } + } + /** + * triggered when an node is clicked or intercated with by the user + * @event + * @name activate_node.jstree + * @param {Object} node + * @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object) + */ + this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e }); + }, + /** + * applies the hover state on a node, called when a node is hovered by the user. Used internally. + * @private + * @name hover_node(obj) + * @param {mixed} obj + * @trigger hover_node.jstree + */ + hover_node : function (obj) { + obj = this.get_node(obj, true); + if(!obj || !obj.length || obj.children('.jstree-hovered').length) { + return false; + } + var o = this.element.find('.jstree-hovered'), t = this.element; + if(o && o.length) { this.dehover_node(o); } + + obj.children('.jstree-anchor').addClass('jstree-hovered'); + /** + * triggered when an node is hovered + * @event + * @name hover_node.jstree + * @param {Object} node + */ + this.trigger('hover_node', { 'node' : this.get_node(obj) }); + setTimeout(function () { t.attr('aria-activedescendant', obj[0].id); }, 0); + }, + /** + * removes the hover state from a nodecalled when a node is no longer hovered by the user. Used internally. + * @private + * @name dehover_node(obj) + * @param {mixed} obj + * @trigger dehover_node.jstree + */ + dehover_node : function (obj) { + obj = this.get_node(obj, true); + if(!obj || !obj.length || !obj.children('.jstree-hovered').length) { + return false; + } + obj.children('.jstree-anchor').removeClass('jstree-hovered'); + /** + * triggered when an node is no longer hovered + * @event + * @name dehover_node.jstree + * @param {Object} node + */ + this.trigger('dehover_node', { 'node' : this.get_node(obj) }); + }, + /** + * select a node + * @name select_node(obj [, supress_event, prevent_open]) + * @param {mixed} obj an array can be used to select multiple nodes + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @param {Boolean} prevent_open if set to `true` parents of the selected node won't be opened + * @trigger select_node.jstree, changed.jstree + */ + select_node : function (obj, supress_event, prevent_open, e) { + var dom, t1, t2, th; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.select_node(obj[t1], supress_event, prevent_open, e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(!obj.state.selected) { + obj.state.selected = true; + this._data.core.selected.push(obj.id); + if(!prevent_open) { + dom = this._open_to(obj); + } + if(dom && dom.length) { + dom.attr('aria-selected', true).children('.jstree-anchor').addClass('jstree-clicked'); + } + /** + * triggered when an node is selected + * @event + * @name select_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this select_node + */ + this.trigger('select_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + if(!supress_event) { + /** + * triggered when selection changes + * @event + * @name changed.jstree + * @param {Object} node + * @param {Object} action the action that caused the selection to change + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this changed event + */ + this.trigger('changed', { 'action' : 'select_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + } + } + }, + /** + * deselect a node + * @name deselect_node(obj [, supress_event]) + * @param {mixed} obj an array can be used to deselect multiple nodes + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @trigger deselect_node.jstree, changed.jstree + */ + deselect_node : function (obj, supress_event, e) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.deselect_node(obj[t1], supress_event, e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(obj.state.selected) { + obj.state.selected = false; + this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, obj.id); + if(dom.length) { + dom.attr('aria-selected', false).children('.jstree-anchor').removeClass('jstree-clicked'); + } + /** + * triggered when an node is deselected + * @event + * @name deselect_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this deselect_node + */ + this.trigger('deselect_node', { 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + if(!supress_event) { + this.trigger('changed', { 'action' : 'deselect_node', 'node' : obj, 'selected' : this._data.core.selected, 'event' : e }); + } + } + }, + /** + * select all nodes in the tree + * @name select_all([supress_event]) + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @trigger select_all.jstree, changed.jstree + */ + select_all : function (supress_event) { + var tmp = this._data.core.selected.concat([]), i, j; + this._data.core.selected = this._model.data[$.jstree.root].children_d.concat(); + for(i = 0, j = this._data.core.selected.length; i < j; i++) { + if(this._model.data[this._data.core.selected[i]]) { + this._model.data[this._data.core.selected[i]].state.selected = true; + } + } + this.redraw(true); + /** + * triggered when all nodes are selected + * @event + * @name select_all.jstree + * @param {Array} selected the current selection + */ + this.trigger('select_all', { 'selected' : this._data.core.selected }); + if(!supress_event) { + this.trigger('changed', { 'action' : 'select_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); + } + }, + /** + * deselect all selected nodes + * @name deselect_all([supress_event]) + * @param {Boolean} supress_event if set to `true` the `changed.jstree` event won't be triggered + * @trigger deselect_all.jstree, changed.jstree + */ + deselect_all : function (supress_event) { + var tmp = this._data.core.selected.concat([]), i, j; + for(i = 0, j = this._data.core.selected.length; i < j; i++) { + if(this._model.data[this._data.core.selected[i]]) { + this._model.data[this._data.core.selected[i]].state.selected = false; + } + } + this._data.core.selected = []; + this.element.find('.jstree-clicked').removeClass('jstree-clicked').parent().attr('aria-selected', false); + /** + * triggered when all nodes are deselected + * @event + * @name deselect_all.jstree + * @param {Object} node the previous selection + * @param {Array} selected the current selection + */ + this.trigger('deselect_all', { 'selected' : this._data.core.selected, 'node' : tmp }); + if(!supress_event) { + this.trigger('changed', { 'action' : 'deselect_all', 'selected' : this._data.core.selected, 'old_selection' : tmp }); + } + }, + /** + * checks if a node is selected + * @name is_selected(obj) + * @param {mixed} obj + * @return {Boolean} + */ + is_selected : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + return obj.state.selected; + }, + /** + * get an array of all selected nodes + * @name get_selected([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + */ + get_selected : function (full) { + return full ? $.map(this._data.core.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.core.selected.slice(); + }, + /** + * get an array of all top level selected nodes (ignoring children of selected nodes) + * @name get_top_selected([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + */ + get_top_selected : function (full) { + var tmp = this.get_selected(true), + obj = {}, i, j, k, l; + for(i = 0, j = tmp.length; i < j; i++) { + obj[tmp[i].id] = tmp[i]; + } + for(i = 0, j = tmp.length; i < j; i++) { + for(k = 0, l = tmp[i].children_d.length; k < l; k++) { + if(obj[tmp[i].children_d[k]]) { + delete obj[tmp[i].children_d[k]]; + } + } + } + tmp = []; + for(i in obj) { + if(obj.hasOwnProperty(i)) { + tmp.push(i); + } + } + return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; + }, + /** + * get an array of all bottom level selected nodes (ignoring selected parents) + * @name get_bottom_selected([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + */ + get_bottom_selected : function (full) { + var tmp = this.get_selected(true), + obj = [], i, j; + for(i = 0, j = tmp.length; i < j; i++) { + if(!tmp[i].children.length) { + obj.push(tmp[i].id); + } + } + return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; + }, + /** + * gets the current state of the tree so that it can be restored later with `set_state(state)`. Used internally. + * @name get_state() + * @private + * @return {Object} + */ + get_state : function () { + var state = { + 'core' : { + 'open' : [], + 'loaded' : [], + 'scroll' : { + 'left' : this.element.scrollLeft(), + 'top' : this.element.scrollTop() + }, + /*! + 'themes' : { + 'name' : this.get_theme(), + 'icons' : this._data.core.themes.icons, + 'dots' : this._data.core.themes.dots + }, + */ + 'selected' : [] + } + }, i; + for(i in this._model.data) { + if(this._model.data.hasOwnProperty(i)) { + if(i !== $.jstree.root) { + if(this._model.data[i].state.loaded && this.settings.core.loaded_state) { + state.core.loaded.push(i); + } + if(this._model.data[i].state.opened) { + state.core.open.push(i); + } + if(this._model.data[i].state.selected) { + state.core.selected.push(i); + } + } + } + } + return state; + }, + /** + * sets the state of the tree. Used internally. + * @name set_state(state [, callback]) + * @private + * @param {Object} state the state to restore. Keep in mind this object is passed by reference and jstree will modify it. + * @param {Function} callback an optional function to execute once the state is restored. + * @trigger set_state.jstree + */ + set_state : function (state, callback) { + if(state) { + if(state.core && state.core.selected && state.core.initial_selection === undefined) { + state.core.initial_selection = this._data.core.selected.concat([]).sort().join(','); + } + if(state.core) { + var res, n, t, _this, i; + if(state.core.loaded) { + if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) { + delete state.core.loaded; + this.set_state(state, callback); + } + else { + this._load_nodes(state.core.loaded, function (nodes) { + delete state.core.loaded; + this.set_state(state, callback); + }); + } + return false; + } + if(state.core.open) { + if(!$.isArray(state.core.open) || !state.core.open.length) { + delete state.core.open; + this.set_state(state, callback); + } + else { + this._load_nodes(state.core.open, function (nodes) { + this.open_node(nodes, false, 0); + delete state.core.open; + this.set_state(state, callback); + }); + } + return false; + } + if(state.core.scroll) { + if(state.core.scroll && state.core.scroll.left !== undefined) { + this.element.scrollLeft(state.core.scroll.left); + } + if(state.core.scroll && state.core.scroll.top !== undefined) { + this.element.scrollTop(state.core.scroll.top); + } + delete state.core.scroll; + this.set_state(state, callback); + return false; + } + if(state.core.selected) { + _this = this; + if (state.core.initial_selection === undefined || + state.core.initial_selection === this._data.core.selected.concat([]).sort().join(',') + ) { + this.deselect_all(); + $.each(state.core.selected, function (i, v) { + _this.select_node(v, false, true); + }); + } + delete state.core.initial_selection; + delete state.core.selected; + this.set_state(state, callback); + return false; + } + for(i in state) { + if(state.hasOwnProperty(i) && i !== "core" && $.inArray(i, this.settings.plugins) === -1) { + delete state[i]; + } + } + if($.isEmptyObject(state.core)) { + delete state.core; + this.set_state(state, callback); + return false; + } + } + if($.isEmptyObject(state)) { + state = null; + if(callback) { callback.call(this); } + /** + * triggered when a `set_state` call completes + * @event + * @name set_state.jstree + */ + this.trigger('set_state'); + return false; + } + return true; + } + return false; + }, + /** + * refreshes the tree - all nodes are reloaded with calls to `load_node`. + * @name refresh() + * @param {Boolean} skip_loading an option to skip showing the loading indicator + * @param {Mixed} forget_state if set to `true` state will not be reapplied, if set to a function (receiving the current state as argument) the result of that function will be used as state + * @trigger refresh.jstree + */ + refresh : function (skip_loading, forget_state) { + this._data.core.state = forget_state === true ? {} : this.get_state(); + if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); } + this._cnt = 0; + this._model.data = {}; + this._model.data[$.jstree.root] = { + id : $.jstree.root, + parent : null, + parents : [], + children : [], + children_d : [], + state : { loaded : false } + }; + this._data.core.selected = []; + this._data.core.last_clicked = null; + this._data.core.focused = null; + + var c = this.get_container_ul()[0].className; + if(!skip_loading) { + this.element.html("<"+"ul class='"+c+"' role='group'><"+"li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='treeitem' id='j"+this._id+"_loading'><"+"a class='jstree-anchor' href='#'>" + this.get_string("Loading ...") + "
      "); + this.element.attr('aria-activedescendant','j'+this._id+'_loading'); + } + this.load_node($.jstree.root, function (o, s) { + if(s) { + this.get_container_ul()[0].className = c; + if(this._firstChild(this.get_container_ul()[0])) { + this.element.attr('aria-activedescendant',this._firstChild(this.get_container_ul()[0]).id); + } + this.set_state($.extend(true, {}, this._data.core.state), function () { + /** + * triggered when a `refresh` call completes + * @event + * @name refresh.jstree + */ + this.trigger('refresh'); + }); + } + this._data.core.state = null; + }); + }, + /** + * refreshes a node in the tree (reload its children) all opened nodes inside that node are reloaded with calls to `load_node`. + * @name refresh_node(obj) + * @param {mixed} obj the node + * @trigger refresh_node.jstree + */ + refresh_node : function (obj) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + var opened = [], to_load = [], s = this._data.core.selected.concat([]); + to_load.push(obj.id); + if(obj.state.opened === true) { opened.push(obj.id); } + this.get_node(obj, true).find('.jstree-open').each(function() { to_load.push(this.id); opened.push(this.id); }); + this._load_nodes(to_load, $.proxy(function (nodes) { + this.open_node(opened, false, 0); + this.select_node(s); + /** + * triggered when a node is refreshed + * @event + * @name refresh_node.jstree + * @param {Object} node - the refreshed node + * @param {Array} nodes - an array of the IDs of the nodes that were reloaded + */ + this.trigger('refresh_node', { 'node' : obj, 'nodes' : nodes }); + }, this), false, true); + }, + /** + * set (change) the ID of a node + * @name set_id(obj, id) + * @param {mixed} obj the node + * @param {String} id the new ID + * @return {Boolean} + * @trigger set_id.jstree + */ + set_id : function (obj, id) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + var i, j, m = this._model.data, old = obj.id; + id = id.toString(); + // update parents (replace current ID with new one in children and children_d) + m[obj.parent].children[$.inArray(obj.id, m[obj.parent].children)] = id; + for(i = 0, j = obj.parents.length; i < j; i++) { + m[obj.parents[i]].children_d[$.inArray(obj.id, m[obj.parents[i]].children_d)] = id; + } + // update children (replace current ID with new one in parent and parents) + for(i = 0, j = obj.children.length; i < j; i++) { + m[obj.children[i]].parent = id; + } + for(i = 0, j = obj.children_d.length; i < j; i++) { + m[obj.children_d[i]].parents[$.inArray(obj.id, m[obj.children_d[i]].parents)] = id; + } + i = $.inArray(obj.id, this._data.core.selected); + if(i !== -1) { this._data.core.selected[i] = id; } + // update model and obj itself (obj.id, this._model.data[KEY]) + i = this.get_node(obj.id, true); + if(i) { + i.attr('id', id); //.children('.jstree-anchor').attr('id', id + '_anchor').end().attr('aria-labelledby', id + '_anchor'); + if(this.element.attr('aria-activedescendant') === obj.id) { + this.element.attr('aria-activedescendant', id); + } + } + delete m[obj.id]; + obj.id = id; + obj.li_attr.id = id; + m[id] = obj; + /** + * triggered when a node id value is changed + * @event + * @name set_id.jstree + * @param {Object} node + * @param {String} old the old id + */ + this.trigger('set_id',{ "node" : obj, "new" : obj.id, "old" : old }); + return true; + }, + /** + * get the text value of a node + * @name get_text(obj) + * @param {mixed} obj the node + * @return {String} + */ + get_text : function (obj) { + obj = this.get_node(obj); + return (!obj || obj.id === $.jstree.root) ? false : obj.text; + }, + /** + * set the text value of a node. Used internally, please use `rename_node(obj, val)`. + * @private + * @name set_text(obj, val) + * @param {mixed} obj the node, you can pass an array to set the text on multiple nodes + * @param {String} val the new text value + * @return {Boolean} + * @trigger set_text.jstree + */ + set_text : function (obj, val) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.set_text(obj[t1], val); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + obj.text = val; + if(this.get_node(obj, true).length) { + this.redraw_node(obj.id); + } + /** + * triggered when a node text value is changed + * @event + * @name set_text.jstree + * @param {Object} obj + * @param {String} text the new value + */ + this.trigger('set_text',{ "obj" : obj, "text" : val }); + return true; + }, + /** + * gets a JSON representation of a node (or the whole tree) + * @name get_json([obj, options]) + * @param {mixed} obj + * @param {Object} options + * @param {Boolean} options.no_state do not return state information + * @param {Boolean} options.no_id do not return ID + * @param {Boolean} options.no_children do not include children + * @param {Boolean} options.no_data do not include node data + * @param {Boolean} options.no_li_attr do not include LI attributes + * @param {Boolean} options.no_a_attr do not include A attributes + * @param {Boolean} options.flat return flat JSON instead of nested + * @return {Object} + */ + get_json : function (obj, options, flat) { + obj = this.get_node(obj || $.jstree.root); + if(!obj) { return false; } + if(options && options.flat && !flat) { flat = []; } + var tmp = { + 'id' : obj.id, + 'text' : obj.text, + 'icon' : this.get_icon(obj), + 'li_attr' : $.extend(true, {}, obj.li_attr), + 'a_attr' : $.extend(true, {}, obj.a_attr), + 'state' : {}, + 'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data) + //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ), + }, i, j; + if(options && options.flat) { + tmp.parent = obj.parent; + } + else { + tmp.children = []; + } + if(!options || !options.no_state) { + for(i in obj.state) { + if(obj.state.hasOwnProperty(i)) { + tmp.state[i] = obj.state[i]; + } + } + } else { + delete tmp.state; + } + if(options && options.no_li_attr) { + delete tmp.li_attr; + } + if(options && options.no_a_attr) { + delete tmp.a_attr; + } + if(options && options.no_id) { + delete tmp.id; + if(tmp.li_attr && tmp.li_attr.id) { + delete tmp.li_attr.id; + } + if(tmp.a_attr && tmp.a_attr.id) { + delete tmp.a_attr.id; + } + } + if(options && options.flat && obj.id !== $.jstree.root) { + flat.push(tmp); + } + if(!options || !options.no_children) { + for(i = 0, j = obj.children.length; i < j; i++) { + if(options && options.flat) { + this.get_json(obj.children[i], options, flat); + } + else { + tmp.children.push(this.get_json(obj.children[i], options)); + } + } + } + return options && options.flat ? flat : (obj.id === $.jstree.root ? tmp.children : tmp); + }, + /** + * create a new node (do not confuse with load_node) + * @name create_node([par, node, pos, callback, is_loaded]) + * @param {mixed} par the parent node (to create a root node use either "#" (string) or `null`) + * @param {mixed} node the data for the new node (a valid JSON object, or a simple string with the name) + * @param {mixed} pos the index at which to insert the node, "first" and "last" are also supported, default is "last" + * @param {Function} callback a function to be called once the node is created + * @param {Boolean} is_loaded internal argument indicating if the parent node was succesfully loaded + * @return {String} the ID of the newly create node + * @trigger model.jstree, create_node.jstree + */ + create_node : function (par, node, pos, callback, is_loaded) { + if(par === null) { par = $.jstree.root; } + par = this.get_node(par); + if(!par) { return false; } + pos = pos === undefined ? "last" : pos; + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return this.load_node(par, function () { this.create_node(par, node, pos, callback, true); }); + } + if(!node) { node = { "text" : this.get_string('New node') }; } + if(typeof node === "string") { + node = { "text" : node }; + } else { + node = $.extend(true, {}, node); + } + if(node.text === undefined) { node.text = this.get_string('New node'); } + var tmp, dpc, i, j; + + if(par.id === $.jstree.root) { + if(pos === "before") { pos = "first"; } + if(pos === "after") { pos = "last"; } + } + switch(pos) { + case "before": + tmp = this.get_node(par.parent); + pos = $.inArray(par.id, tmp.children); + par = tmp; + break; + case "after" : + tmp = this.get_node(par.parent); + pos = $.inArray(par.id, tmp.children) + 1; + par = tmp; + break; + case "inside": + case "first": + pos = 0; + break; + case "last": + pos = par.children.length; + break; + default: + if(!pos) { pos = 0; } + break; + } + if(pos > par.children.length) { pos = par.children.length; } + if(!node.id) { node.id = true; } + if(!this.check("create_node", node, par, pos)) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + if(node.id === true) { delete node.id; } + node = this._parse_model_from_json(node, par.id, par.parents.concat()); + if(!node) { return false; } + tmp = this.get_node(node); + dpc = []; + dpc.push(node); + dpc = dpc.concat(tmp.children_d); + this.trigger('model', { "nodes" : dpc, "parent" : par.id }); + + par.children_d = par.children_d.concat(dpc); + for(i = 0, j = par.parents.length; i < j; i++) { + this._model.data[par.parents[i]].children_d = this._model.data[par.parents[i]].children_d.concat(dpc); + } + node = tmp; + tmp = []; + for(i = 0, j = par.children.length; i < j; i++) { + tmp[i >= pos ? i+1 : i] = par.children[i]; + } + tmp[pos] = node.id; + par.children = tmp; + + this.redraw_node(par, true); + /** + * triggered when a node is created + * @event + * @name create_node.jstree + * @param {Object} node + * @param {String} parent the parent's ID + * @param {Number} position the position of the new node among the parent's children + */ + this.trigger('create_node', { "node" : this.get_node(node), "parent" : par.id, "position" : pos }); + if(callback) { callback.call(this, this.get_node(node)); } + return node.id; + }, + /** + * set the text value of a node + * @name rename_node(obj, val) + * @param {mixed} obj the node, you can pass an array to rename multiple nodes to the same name + * @param {String} val the new text value + * @return {Boolean} + * @trigger rename_node.jstree + */ + rename_node : function (obj, val) { + var t1, t2, old; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.rename_node(obj[t1], val); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + old = obj.text; + if(!this.check("rename_node", obj, this.get_parent(obj), val)) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + this.set_text(obj, val); // .apply(this, Array.prototype.slice.call(arguments)) + /** + * triggered when a node is renamed + * @event + * @name rename_node.jstree + * @param {Object} node + * @param {String} text the new value + * @param {String} old the old value + */ + this.trigger('rename_node', { "node" : obj, "text" : val, "old" : old }); + return true; + }, + /** + * remove a node + * @name delete_node(obj) + * @param {mixed} obj the node, you can pass an array to delete multiple nodes + * @return {Boolean} + * @trigger delete_node.jstree, changed.jstree + */ + delete_node : function (obj) { + var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.delete_node(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + par = this.get_node(obj.parent); + pos = $.inArray(obj.id, par.children); + c = false; + if(!this.check("delete_node", obj, par, pos)) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + if(pos !== -1) { + par.children = $.vakata.array_remove(par.children, pos); + } + tmp = obj.children_d.concat([]); + tmp.push(obj.id); + for(i = 0, j = obj.parents.length; i < j; i++) { + this._model.data[obj.parents[i]].children_d = $.vakata.array_filter(this._model.data[obj.parents[i]].children_d, function (v) { + return $.inArray(v, tmp) === -1; + }); + } + for(k = 0, l = tmp.length; k < l; k++) { + if(this._model.data[tmp[k]].state.selected) { + c = true; + break; + } + } + if (c) { + this._data.core.selected = $.vakata.array_filter(this._data.core.selected, function (v) { + return $.inArray(v, tmp) === -1; + }); + } + /** + * triggered when a node is deleted + * @event + * @name delete_node.jstree + * @param {Object} node + * @param {String} parent the parent's ID + */ + this.trigger('delete_node', { "node" : obj, "parent" : par.id }); + if(c) { + this.trigger('changed', { 'action' : 'delete_node', 'node' : obj, 'selected' : this._data.core.selected, 'parent' : par.id }); + } + for(k = 0, l = tmp.length; k < l; k++) { + delete this._model.data[tmp[k]]; + } + if($.inArray(this._data.core.focused, tmp) !== -1) { + this._data.core.focused = null; + top = this.element[0].scrollTop; + lft = this.element[0].scrollLeft; + if(par.id === $.jstree.root) { + if (this._model.data[$.jstree.root].children[0]) { + this.get_node(this._model.data[$.jstree.root].children[0], true).children('.jstree-anchor').focus(); + } + } + else { + this.get_node(par, true).children('.jstree-anchor').focus(); + } + this.element[0].scrollTop = top; + this.element[0].scrollLeft = lft; + } + this.redraw_node(par, true); + return true; + }, + /** + * check if an operation is premitted on the tree. Used internally. + * @private + * @name check(chk, obj, par, pos) + * @param {String} chk the operation to check, can be "create_node", "rename_node", "delete_node", "copy_node" or "move_node" + * @param {mixed} obj the node + * @param {mixed} par the parent + * @param {mixed} pos the position to insert at, or if "rename_node" - the new name + * @param {mixed} more some various additional information, for example if a "move_node" operations is triggered by DND this will be the hovered node + * @return {Boolean} + */ + check : function (chk, obj, par, pos, more) { + obj = obj && obj.id ? obj : this.get_node(obj); + par = par && par.id ? par : this.get_node(par); + var tmp = chk.match(/^move_node|copy_node|create_node$/i) ? par : obj, + chc = this.settings.core.check_callback; + if(chk === "move_node" || chk === "copy_node") { + if((!more || !more.is_multi) && (obj.id === par.id || (chk === "move_node" && $.inArray(obj.id, par.children) === pos) || $.inArray(par.id, obj.children_d) !== -1)) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_01', 'reason' : 'Moving parent inside child', 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + } + if(tmp && tmp.data) { tmp = tmp.data; } + if(tmp && tmp.functions && (tmp.functions[chk] === false || tmp.functions[chk] === true)) { + if(tmp.functions[chk] === false) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_02', 'reason' : 'Node data prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return tmp.functions[chk]; + } + if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + return true; + }, + /** + * get the last error + * @name last_error() + * @return {Object} + */ + last_error : function () { + return this._data.core.last_error; + }, + /** + * move a node to a new parent + * @name move_node(obj, par [, pos, callback, is_loaded]) + * @param {mixed} obj the node to move, pass an array to move multiple nodes + * @param {mixed} par the new parent + * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` + * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position + * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded + * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance + * @trigger move_node.jstree + */ + move_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { + var t1, t2, old_par, old_pos, new_par, old_ins, is_multi, dpc, tmp, i, j, k, l, p; + + par = this.get_node(par); + pos = pos === undefined ? 0 : pos; + if(!par) { return false; } + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); }); + } + + if($.isArray(obj)) { + if(obj.length === 1) { + obj = obj[0]; + } + else { + //obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + if((tmp = this.move_node(obj[t1], par, pos, callback, is_loaded, false, origin))) { + par = tmp; + pos = "after"; + } + } + this.redraw(); + return true; + } + } + obj = obj && obj.id ? obj : this.get_node(obj); + + if(!obj || obj.id === $.jstree.root) { return false; } + + old_par = (obj.parent || $.jstree.root).toString(); + new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); + old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); + is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); + old_pos = old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1; + if(old_ins && old_ins._id) { + obj = old_ins._model.data[obj.id]; + } + + if(is_multi) { + if((tmp = this.copy_node(obj, par, pos, callback, is_loaded, false, origin))) { + if(old_ins) { old_ins.delete_node(obj); } + return tmp; + } + return false; + } + //var m = this._model.data; + if(par.id === $.jstree.root) { + if(pos === "before") { pos = "first"; } + if(pos === "after") { pos = "last"; } + } + switch(pos) { + case "before": + pos = $.inArray(par.id, new_par.children); + break; + case "after" : + pos = $.inArray(par.id, new_par.children) + 1; + break; + case "inside": + case "first": + pos = 0; + break; + case "last": + pos = new_par.children.length; + break; + default: + if(!pos) { pos = 0; } + break; + } + if(pos > new_par.children.length) { pos = new_par.children.length; } + if(!this.check("move_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + if(obj.parent === new_par.id) { + dpc = new_par.children.concat(); + tmp = $.inArray(obj.id, dpc); + if(tmp !== -1) { + dpc = $.vakata.array_remove(dpc, tmp); + if(pos > tmp) { pos--; } + } + tmp = []; + for(i = 0, j = dpc.length; i < j; i++) { + tmp[i >= pos ? i+1 : i] = dpc[i]; + } + tmp[pos] = obj.id; + new_par.children = tmp; + this._node_changed(new_par.id); + this.redraw(new_par.id === $.jstree.root); + } + else { + // clean old parent and up + tmp = obj.children_d.concat(); + tmp.push(obj.id); + for(i = 0, j = obj.parents.length; i < j; i++) { + dpc = []; + p = old_ins._model.data[obj.parents[i]].children_d; + for(k = 0, l = p.length; k < l; k++) { + if($.inArray(p[k], tmp) === -1) { + dpc.push(p[k]); + } + } + old_ins._model.data[obj.parents[i]].children_d = dpc; + } + old_ins._model.data[old_par].children = $.vakata.array_remove_item(old_ins._model.data[old_par].children, obj.id); + + // insert into new parent and up + for(i = 0, j = new_par.parents.length; i < j; i++) { + this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(tmp); + } + dpc = []; + for(i = 0, j = new_par.children.length; i < j; i++) { + dpc[i >= pos ? i+1 : i] = new_par.children[i]; + } + dpc[pos] = obj.id; + new_par.children = dpc; + new_par.children_d.push(obj.id); + new_par.children_d = new_par.children_d.concat(obj.children_d); + + // update object + obj.parent = new_par.id; + tmp = new_par.parents.concat(); + tmp.unshift(new_par.id); + p = obj.parents.length; + obj.parents = tmp; + + // update object children + tmp = tmp.concat(); + for(i = 0, j = obj.children_d.length; i < j; i++) { + this._model.data[obj.children_d[i]].parents = this._model.data[obj.children_d[i]].parents.slice(0,p*-1); + Array.prototype.push.apply(this._model.data[obj.children_d[i]].parents, tmp); + } + + if(old_par === $.jstree.root || new_par.id === $.jstree.root) { + this._model.force_full_redraw = true; + } + if(!this._model.force_full_redraw) { + this._node_changed(old_par); + this._node_changed(new_par.id); + } + if(!skip_redraw) { + this.redraw(); + } + } + if(callback) { callback.call(this, obj, new_par, pos); } + /** + * triggered when a node is moved + * @event + * @name move_node.jstree + * @param {Object} node + * @param {String} parent the parent's ID + * @param {Number} position the position of the node among the parent's children + * @param {String} old_parent the old parent of the node + * @param {Number} old_position the old position of the node + * @param {Boolean} is_multi do the node and new parent belong to different instances + * @param {jsTree} old_instance the instance the node came from + * @param {jsTree} new_instance the instance of the new parent + */ + this.trigger('move_node', { "node" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_pos, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); + return obj.id; + }, + /** + * copy a node to a new parent + * @name copy_node(obj, par [, pos, callback, is_loaded]) + * @param {mixed} obj the node to copy, pass an array to copy multiple nodes + * @param {mixed} par the new parent + * @param {mixed} pos the position to insert at (besides integer values, "first" and "last" are supported, as well as "before" and "after"), defaults to integer `0` + * @param {function} callback a function to call once the move is completed, receives 3 arguments - the node, the new parent and the position + * @param {Boolean} is_loaded internal parameter indicating if the parent node has been loaded + * @param {Boolean} skip_redraw internal parameter indicating if the tree should be redrawn + * @param {Boolean} instance internal parameter indicating if the node comes from another instance + * @trigger model.jstree copy_node.jstree + */ + copy_node : function (obj, par, pos, callback, is_loaded, skip_redraw, origin) { + var t1, t2, dpc, tmp, i, j, node, old_par, new_par, old_ins, is_multi; + + par = this.get_node(par); + pos = pos === undefined ? 0 : pos; + if(!par) { return false; } + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); }); + } + + if($.isArray(obj)) { + if(obj.length === 1) { + obj = obj[0]; + } + else { + //obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + if((tmp = this.copy_node(obj[t1], par, pos, callback, is_loaded, true, origin))) { + par = tmp; + pos = "after"; + } + } + this.redraw(); + return true; + } + } + obj = obj && obj.id ? obj : this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + + old_par = (obj.parent || $.jstree.root).toString(); + new_par = (!pos.toString().match(/^(before|after)$/) || par.id === $.jstree.root) ? par : this.get_node(par.parent); + old_ins = origin ? origin : (this._model.data[obj.id] ? this : $.jstree.reference(obj.id)); + is_multi = !old_ins || !old_ins._id || (this._id !== old_ins._id); + + if(old_ins && old_ins._id) { + obj = old_ins._model.data[obj.id]; + } + + if(par.id === $.jstree.root) { + if(pos === "before") { pos = "first"; } + if(pos === "after") { pos = "last"; } + } + switch(pos) { + case "before": + pos = $.inArray(par.id, new_par.children); + break; + case "after" : + pos = $.inArray(par.id, new_par.children) + 1; + break; + case "inside": + case "first": + pos = 0; + break; + case "last": + pos = new_par.children.length; + break; + default: + if(!pos) { pos = 0; } + break; + } + if(pos > new_par.children.length) { pos = new_par.children.length; } + if(!this.check("copy_node", obj, new_par, pos, { 'core' : true, 'origin' : origin, 'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id) })) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + node = old_ins ? old_ins.get_json(obj, { no_id : true, no_data : true, no_state : true }) : obj; + if(!node) { return false; } + if(node.id === true) { delete node.id; } + node = this._parse_model_from_json(node, new_par.id, new_par.parents.concat()); + if(!node) { return false; } + tmp = this.get_node(node); + if(obj && obj.state && obj.state.loaded === false) { tmp.state.loaded = false; } + dpc = []; + dpc.push(node); + dpc = dpc.concat(tmp.children_d); + this.trigger('model', { "nodes" : dpc, "parent" : new_par.id }); + + // insert into new parent and up + for(i = 0, j = new_par.parents.length; i < j; i++) { + this._model.data[new_par.parents[i]].children_d = this._model.data[new_par.parents[i]].children_d.concat(dpc); + } + dpc = []; + for(i = 0, j = new_par.children.length; i < j; i++) { + dpc[i >= pos ? i+1 : i] = new_par.children[i]; + } + dpc[pos] = tmp.id; + new_par.children = dpc; + new_par.children_d.push(tmp.id); + new_par.children_d = new_par.children_d.concat(tmp.children_d); + + if(new_par.id === $.jstree.root) { + this._model.force_full_redraw = true; + } + if(!this._model.force_full_redraw) { + this._node_changed(new_par.id); + } + if(!skip_redraw) { + this.redraw(new_par.id === $.jstree.root); + } + if(callback) { callback.call(this, tmp, new_par, pos); } + /** + * triggered when a node is copied + * @event + * @name copy_node.jstree + * @param {Object} node the copied node + * @param {Object} original the original node + * @param {String} parent the parent's ID + * @param {Number} position the position of the node among the parent's children + * @param {String} old_parent the old parent of the node + * @param {Number} old_position the position of the original node + * @param {Boolean} is_multi do the node and new parent belong to different instances + * @param {jsTree} old_instance the instance the node came from + * @param {jsTree} new_instance the instance of the new parent + */ + this.trigger('copy_node', { "node" : tmp, "original" : obj, "parent" : new_par.id, "position" : pos, "old_parent" : old_par, "old_position" : old_ins && old_ins._id && old_par && old_ins._model.data[old_par] && old_ins._model.data[old_par].children ? $.inArray(obj.id, old_ins._model.data[old_par].children) : -1,'is_multi' : (old_ins && old_ins._id && old_ins._id !== this._id), 'is_foreign' : (!old_ins || !old_ins._id), 'old_instance' : old_ins, 'new_instance' : this }); + return tmp.id; + }, + /** + * cut a node (a later call to `paste(obj)` would move the node) + * @name cut(obj) + * @param {mixed} obj multiple objects can be passed using an array + * @trigger cut.jstree + */ + cut : function (obj) { + if(!obj) { obj = this._data.core.selected.concat(); } + if(!$.isArray(obj)) { obj = [obj]; } + if(!obj.length) { return false; } + var tmp = [], o, t1, t2; + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + o = this.get_node(obj[t1]); + if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } + } + if(!tmp.length) { return false; } + ccp_node = tmp; + ccp_inst = this; + ccp_mode = 'move_node'; + /** + * triggered when nodes are added to the buffer for moving + * @event + * @name cut.jstree + * @param {Array} node + */ + this.trigger('cut', { "node" : obj }); + }, + /** + * copy a node (a later call to `paste(obj)` would copy the node) + * @name copy(obj) + * @param {mixed} obj multiple objects can be passed using an array + * @trigger copy.jstree + */ + copy : function (obj) { + if(!obj) { obj = this._data.core.selected.concat(); } + if(!$.isArray(obj)) { obj = [obj]; } + if(!obj.length) { return false; } + var tmp = [], o, t1, t2; + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + o = this.get_node(obj[t1]); + if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); } + } + if(!tmp.length) { return false; } + ccp_node = tmp; + ccp_inst = this; + ccp_mode = 'copy_node'; + /** + * triggered when nodes are added to the buffer for copying + * @event + * @name copy.jstree + * @param {Array} node + */ + this.trigger('copy', { "node" : obj }); + }, + /** + * get the current buffer (any nodes that are waiting for a paste operation) + * @name get_buffer() + * @return {Object} an object consisting of `mode` ("copy_node" or "move_node"), `node` (an array of objects) and `inst` (the instance) + */ + get_buffer : function () { + return { 'mode' : ccp_mode, 'node' : ccp_node, 'inst' : ccp_inst }; + }, + /** + * check if there is something in the buffer to paste + * @name can_paste() + * @return {Boolean} + */ + can_paste : function () { + return ccp_mode !== false && ccp_node !== false; // && ccp_inst._model.data[ccp_node]; + }, + /** + * copy or move the previously cut or copied nodes to a new parent + * @name paste(obj [, pos]) + * @param {mixed} obj the new parent + * @param {mixed} pos the position to insert at (besides integer, "first" and "last" are supported), defaults to integer `0` + * @trigger paste.jstree + */ + paste : function (obj, pos) { + obj = this.get_node(obj); + if(!obj || !ccp_mode || !ccp_mode.match(/^(copy_node|move_node)$/) || !ccp_node) { return false; } + if(this[ccp_mode](ccp_node, obj, pos, false, false, false, ccp_inst)) { + /** + * triggered when paste is invoked + * @event + * @name paste.jstree + * @param {String} parent the ID of the receiving node + * @param {Array} node the nodes in the buffer + * @param {String} mode the performed operation - "copy_node" or "move_node" + */ + this.trigger('paste', { "parent" : obj.id, "node" : ccp_node, "mode" : ccp_mode }); + } + ccp_node = false; + ccp_mode = false; + ccp_inst = false; + }, + /** + * clear the buffer of previously copied or cut nodes + * @name clear_buffer() + * @trigger clear_buffer.jstree + */ + clear_buffer : function () { + ccp_node = false; + ccp_mode = false; + ccp_inst = false; + /** + * triggered when the copy / cut buffer is cleared + * @event + * @name clear_buffer.jstree + */ + this.trigger('clear_buffer'); + }, + /** + * put a node in edit mode (input field to rename the node) + * @name edit(obj [, default_text, callback]) + * @param {mixed} obj + * @param {String} default_text the text to populate the input with (if omitted or set to a non-string value the node's text value is used) + * @param {Function} callback a function to be called once the text box is blurred, it is called in the instance's scope and receives the node, a status parameter (true if the rename is successful, false otherwise) and a boolean indicating if the user cancelled the edit. You can access the node's title using .text + */ + edit : function (obj, default_text, callback) { + var rtl, w, a, s, t, h1, h2, fn, tmp, cancel = false; + obj = this.get_node(obj); + if(!obj) { return false; } + if(!this.check("edit", obj, this.get_parent(obj))) { + this.settings.core.error.call(this, this._data.core.last_error); + return false; + } + tmp = obj; + default_text = typeof default_text === 'string' ? default_text : obj.text; + this.set_text(obj, ""); + obj = this._open_to(obj); + tmp.text = default_text; + + rtl = this._data.core.rtl; + w = this.element.width(); + this._data.core.focused = tmp.id; + a = obj.children('.jstree-anchor').focus(); + s = $(''); + /*! + oi = obj.children("i:visible"), + ai = a.children("i:visible"), + w1 = oi.width() * oi.length, + w2 = ai.width() * ai.length, + */ + t = default_text; + h1 = $("<"+"div />", { css : { "position" : "absolute", "top" : "-200px", "left" : (rtl ? "0px" : "-1000px"), "visibility" : "hidden" } }).appendTo(document.body); + h2 = $("<"+"input />", { + "value" : t, + "class" : "jstree-rename-input", + // "size" : t.length, + "css" : { + "padding" : "0", + "border" : "1px solid silver", + "box-sizing" : "border-box", + "display" : "inline-block", + "height" : (this._data.core.li_height) + "px", + "lineHeight" : (this._data.core.li_height) + "px", + "width" : "150px" // will be set a bit further down + }, + "blur" : $.proxy(function (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + var i = s.children(".jstree-rename-input"), + v = i.val(), + f = this.settings.core.force_text, + nv; + if(v === "") { v = t; } + h1.remove(); + s.replaceWith(a); + s.remove(); + t = f ? t : $('
      ').append($.parseHTML(t)).html(); + obj = this.get_node(obj); + this.set_text(obj, t); + nv = !!this.rename_node(obj, f ? $('
      ').text(v).text() : $('
      ').append($.parseHTML(v)).html()); + if(!nv) { + this.set_text(obj, t); // move this up? and fix #483 + } + this._data.core.focused = tmp.id; + setTimeout($.proxy(function () { + var node = this.get_node(tmp.id, true); + if(node.length) { + this._data.core.focused = tmp.id; + node.children('.jstree-anchor').focus(); + } + }, this), 0); + if(callback) { + callback.call(this, tmp, nv, cancel); + } + h2 = null; + }, this), + "keydown" : function (e) { + var key = e.which; + if(key === 27) { + cancel = true; + this.value = t; + } + if(key === 27 || key === 13 || key === 37 || key === 38 || key === 39 || key === 40 || key === 32) { + e.stopImmediatePropagation(); + } + if(key === 27 || key === 13) { + e.preventDefault(); + this.blur(); + } + }, + "click" : function (e) { e.stopImmediatePropagation(); }, + "mousedown" : function (e) { e.stopImmediatePropagation(); }, + "keyup" : function (e) { + h2.width(Math.min(h1.text("pW" + this.value).width(),w)); + }, + "keypress" : function(e) { + if(e.which === 13) { return false; } + } + }); + fn = { + fontFamily : a.css('fontFamily') || '', + fontSize : a.css('fontSize') || '', + fontWeight : a.css('fontWeight') || '', + fontStyle : a.css('fontStyle') || '', + fontStretch : a.css('fontStretch') || '', + fontVariant : a.css('fontVariant') || '', + letterSpacing : a.css('letterSpacing') || '', + wordSpacing : a.css('wordSpacing') || '' + }; + s.attr('class', a.attr('class')).append(a.contents().clone()).append(h2); + a.replaceWith(s); + h1.css(fn); + h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select(); + $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) { + if (h2 && e.target !== h2) { + $(h2).blur(); + } + }); + }, + + + /** + * changes the theme + * @name set_theme(theme_name [, theme_url]) + * @param {String} theme_name the name of the new theme to apply + * @param {mixed} theme_url the location of the CSS file for this theme. Omit or set to `false` if you manually included the file. Set to `true` to autoload from the `core.themes.dir` directory. + * @trigger set_theme.jstree + */ + set_theme : function (theme_name, theme_url) { + if(!theme_name) { return false; } + if(theme_url === true) { + var dir = this.settings.core.themes.dir; + if(!dir) { dir = $.jstree.path + '/themes'; } + theme_url = dir + '/' + theme_name + '/style.css'; + } + if(theme_url && $.inArray(theme_url, themes_loaded) === -1) { + $('head').append('<'+'link rel="stylesheet" href="' + theme_url + '" type="text/css" />'); + themes_loaded.push(theme_url); + } + if(this._data.core.themes.name) { + this.element.removeClass('jstree-' + this._data.core.themes.name); + } + this._data.core.themes.name = theme_name; + this.element.addClass('jstree-' + theme_name); + this.element[this.settings.core.themes.responsive ? 'addClass' : 'removeClass' ]('jstree-' + theme_name + '-responsive'); + /** + * triggered when a theme is set + * @event + * @name set_theme.jstree + * @param {String} theme the new theme + */ + this.trigger('set_theme', { 'theme' : theme_name }); + }, + /** + * gets the name of the currently applied theme name + * @name get_theme() + * @return {String} + */ + get_theme : function () { return this._data.core.themes.name; }, + /** + * changes the theme variant (if the theme has variants) + * @name set_theme_variant(variant_name) + * @param {String|Boolean} variant_name the variant to apply (if `false` is used the current variant is removed) + */ + set_theme_variant : function (variant_name) { + if(this._data.core.themes.variant) { + this.element.removeClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); + } + this._data.core.themes.variant = variant_name; + if(variant_name) { + this.element.addClass('jstree-' + this._data.core.themes.name + '-' + this._data.core.themes.variant); + } + }, + /** + * gets the name of the currently applied theme variant + * @name get_theme() + * @return {String} + */ + get_theme_variant : function () { return this._data.core.themes.variant; }, + /** + * shows a striped background on the container (if the theme supports it) + * @name show_stripes() + */ + show_stripes : function () { + this._data.core.themes.stripes = true; + this.get_container_ul().addClass("jstree-striped"); + /** + * triggered when stripes are shown + * @event + * @name show_stripes.jstree + */ + this.trigger('show_stripes'); + }, + /** + * hides the striped background on the container + * @name hide_stripes() + */ + hide_stripes : function () { + this._data.core.themes.stripes = false; + this.get_container_ul().removeClass("jstree-striped"); + /** + * triggered when stripes are hidden + * @event + * @name hide_stripes.jstree + */ + this.trigger('hide_stripes'); + }, + /** + * toggles the striped background on the container + * @name toggle_stripes() + */ + toggle_stripes : function () { if(this._data.core.themes.stripes) { this.hide_stripes(); } else { this.show_stripes(); } }, + /** + * shows the connecting dots (if the theme supports it) + * @name show_dots() + */ + show_dots : function () { + this._data.core.themes.dots = true; + this.get_container_ul().removeClass("jstree-no-dots"); + /** + * triggered when dots are shown + * @event + * @name show_dots.jstree + */ + this.trigger('show_dots'); + }, + /** + * hides the connecting dots + * @name hide_dots() + */ + hide_dots : function () { + this._data.core.themes.dots = false; + this.get_container_ul().addClass("jstree-no-dots"); + /** + * triggered when dots are hidden + * @event + * @name hide_dots.jstree + */ + this.trigger('hide_dots'); + }, + /** + * toggles the connecting dots + * @name toggle_dots() + */ + toggle_dots : function () { if(this._data.core.themes.dots) { this.hide_dots(); } else { this.show_dots(); } }, + /** + * show the node icons + * @name show_icons() + */ + show_icons : function () { + this._data.core.themes.icons = true; + this.get_container_ul().removeClass("jstree-no-icons"); + /** + * triggered when icons are shown + * @event + * @name show_icons.jstree + */ + this.trigger('show_icons'); + }, + /** + * hide the node icons + * @name hide_icons() + */ + hide_icons : function () { + this._data.core.themes.icons = false; + this.get_container_ul().addClass("jstree-no-icons"); + /** + * triggered when icons are hidden + * @event + * @name hide_icons.jstree + */ + this.trigger('hide_icons'); + }, + /** + * toggle the node icons + * @name toggle_icons() + */ + toggle_icons : function () { if(this._data.core.themes.icons) { this.hide_icons(); } else { this.show_icons(); } }, + /** + * show the node ellipsis + * @name show_icons() + */ + show_ellipsis : function () { + this._data.core.themes.ellipsis = true; + this.get_container_ul().addClass("jstree-ellipsis"); + /** + * triggered when ellisis is shown + * @event + * @name show_ellipsis.jstree + */ + this.trigger('show_ellipsis'); + }, + /** + * hide the node ellipsis + * @name hide_ellipsis() + */ + hide_ellipsis : function () { + this._data.core.themes.ellipsis = false; + this.get_container_ul().removeClass("jstree-ellipsis"); + /** + * triggered when ellisis is hidden + * @event + * @name hide_ellipsis.jstree + */ + this.trigger('hide_ellipsis'); + }, + /** + * toggle the node ellipsis + * @name toggle_icons() + */ + toggle_ellipsis : function () { if(this._data.core.themes.ellipsis) { this.hide_ellipsis(); } else { this.show_ellipsis(); } }, + /** + * set the node icon for a node + * @name set_icon(obj, icon) + * @param {mixed} obj + * @param {String} icon the new icon - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class + */ + set_icon : function (obj, icon) { + var t1, t2, dom, old; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.set_icon(obj[t1], icon); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + old = obj.icon; + obj.icon = icon === true || icon === null || icon === undefined || icon === '' ? true : icon; + dom = this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon"); + if(icon === false) { + dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); + this.hide_icon(obj); + } + else if(icon === true || icon === null || icon === undefined || icon === '') { + dom.removeClass('jstree-themeicon-custom ' + old).css("background","").removeAttr("rel"); + if(old === false) { this.show_icon(obj); } + } + else if(icon.indexOf("/") === -1 && icon.indexOf(".") === -1) { + dom.removeClass(old).css("background",""); + dom.addClass(icon + ' jstree-themeicon-custom').attr("rel",icon); + if(old === false) { this.show_icon(obj); } + } + else { + dom.removeClass(old).css("background",""); + dom.addClass('jstree-themeicon-custom').css("background", "url('" + icon + "') center center no-repeat").attr("rel",icon); + if(old === false) { this.show_icon(obj); } + } + return true; + }, + /** + * get the node icon for a node + * @name get_icon(obj) + * @param {mixed} obj + * @return {String} + */ + get_icon : function (obj) { + obj = this.get_node(obj); + return (!obj || obj.id === $.jstree.root) ? false : obj.icon; + }, + /** + * hide the icon on an individual node + * @name hide_icon(obj) + * @param {mixed} obj + */ + hide_icon : function (obj) { + var t1, t2; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.hide_icon(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj === $.jstree.root) { return false; } + obj.icon = false; + this.get_node(obj, true).children(".jstree-anchor").children(".jstree-themeicon").addClass('jstree-themeicon-hidden'); + return true; + }, + /** + * show the icon on an individual node + * @name show_icon(obj) + * @param {mixed} obj + */ + show_icon : function (obj) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.show_icon(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj === $.jstree.root) { return false; } + dom = this.get_node(obj, true); + obj.icon = dom.length ? dom.children(".jstree-anchor").children(".jstree-themeicon").attr('rel') : true; + if(!obj.icon) { obj.icon = true; } + dom.children(".jstree-anchor").children(".jstree-themeicon").removeClass('jstree-themeicon-hidden'); + return true; + } + }; + + // helpers + $.vakata = {}; + // collect attributes + $.vakata.attributes = function(node, with_values) { + node = $(node)[0]; + var attr = with_values ? {} : []; + if(node && node.attributes) { + $.each(node.attributes, function (i, v) { + if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; } + if(v.value !== null && $.trim(v.value) !== '') { + if(with_values) { attr[v.name] = v.value; } + else { attr.push(v.name); } + } + }); + } + return attr; + }; + $.vakata.array_unique = function(array) { + var a = [], i, j, l, o = {}; + for(i = 0, l = array.length; i < l; i++) { + if(o[array[i]] === undefined) { + a.push(array[i]); + o[array[i]] = true; + } + } + return a; + }; + // remove item from array + $.vakata.array_remove = function(array, from) { + array.splice(from, 1); + return array; + //var rest = array.slice((to || from) + 1 || array.length); + //array.length = from < 0 ? array.length + from : from; + //array.push.apply(array, rest); + //return array; + }; + // remove item from array + $.vakata.array_remove_item = function(array, item) { + var tmp = $.inArray(item, array); + return tmp !== -1 ? $.vakata.array_remove(array, tmp) : array; + }; + $.vakata.array_filter = function(c,a,b,d,e) { + if (c.filter) { + return c.filter(a, b); + } + d=[]; + for (e in c) { + if (~~e+''===e+'' && e>=0 && a.call(b,c[e],+e,c)) { + d.push(c[e]); + } + } + return d; + }; + + +/** + * ### Changed plugin + * + * This plugin adds more information to the `changed.jstree` event. The new data is contained in the `changed` event data property, and contains a lists of `selected` and `deselected` nodes. + */ + + $.jstree.plugins.changed = function (options, parent) { + var last = []; + this.trigger = function (ev, data) { + var i, j; + if(!data) { + data = {}; + } + if(ev.replace('.jstree','') === 'changed') { + data.changed = { selected : [], deselected : [] }; + var tmp = {}; + for(i = 0, j = last.length; i < j; i++) { + tmp[last[i]] = 1; + } + for(i = 0, j = data.selected.length; i < j; i++) { + if(!tmp[data.selected[i]]) { + data.changed.selected.push(data.selected[i]); + } + else { + tmp[data.selected[i]] = 2; + } + } + for(i = 0, j = last.length; i < j; i++) { + if(tmp[last[i]] === 1) { + data.changed.deselected.push(last[i]); + } + } + last = data.selected.slice(); + } + /** + * triggered when selection changes (the "changed" plugin enhances the original event with more data) + * @event + * @name changed.jstree + * @param {Object} node + * @param {Object} action the action that caused the selection to change + * @param {Array} selected the current selection + * @param {Object} changed an object containing two properties `selected` and `deselected` - both arrays of node IDs, which were selected or deselected since the last changed event + * @param {Object} event the event (if any) that triggered this changed event + * @plugin changed + */ + parent.trigger.call(this, ev, data); + }; + this.refresh = function (skip_loading, forget_state) { + last = []; + return parent.refresh.apply(this, arguments); + }; + }; + +/** + * ### Checkbox plugin + * + * This plugin renders checkbox icons in front of each node, making multiple selection much easier. + * It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up. + */ + + var _i = document.createElement('I'); + _i.className = 'jstree-icon jstree-checkbox'; + _i.setAttribute('role', 'presentation'); + /** + * stores all defaults for the checkbox plugin + * @name $.jstree.defaults.checkbox + * @plugin checkbox + */ + $.jstree.defaults.checkbox = { + /** + * a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`. + * @name $.jstree.defaults.checkbox.visible + * @plugin checkbox + */ + visible : true, + /** + * a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`. + * @name $.jstree.defaults.checkbox.three_state + * @plugin checkbox + */ + three_state : true, + /** + * a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`. + * @name $.jstree.defaults.checkbox.whole_node + * @plugin checkbox + */ + whole_node : true, + /** + * a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`. + * @name $.jstree.defaults.checkbox.keep_selected_style + * @plugin checkbox + */ + keep_selected_style : true, + /** + * This setting controls how cascading and undetermined nodes are applied. + * If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled, if 'undetermined' is in the string - undetermined nodes will be used. + * If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''. + * @name $.jstree.defaults.checkbox.cascade + * @plugin checkbox + */ + cascade : '', + /** + * This setting controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing. + * @name $.jstree.defaults.checkbox.tie_selection + * @plugin checkbox + */ + tie_selection : true, + + /** + * This setting controls if cascading down affects disabled checkboxes + * @name $.jstree.defaults.checkbox.cascade_to_disabled + * @plugin checkbox + */ + cascade_to_disabled : true, + + /** + * This setting controls if cascading down affects hidden checkboxes + * @name $.jstree.defaults.checkbox.cascade_to_hidden + * @plugin checkbox + */ + cascade_to_hidden : true + }; + $.jstree.plugins.checkbox = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + this._data.checkbox.uto = false; + this._data.checkbox.selected = []; + if(this.settings.checkbox.three_state) { + this.settings.checkbox.cascade = 'up+down+undetermined'; + } + this.element + .on("init.jstree", $.proxy(function () { + this._data.checkbox.visible = this.settings.checkbox.visible; + if(!this.settings.checkbox.keep_selected_style) { + this.element.addClass('jstree-checkbox-no-clicked'); + } + if(this.settings.checkbox.tie_selection) { + this.element.addClass('jstree-checkbox-selection'); + } + }, this)) + .on("loading.jstree", $.proxy(function () { + this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ](); + }, this)); + if(this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { + this.element + .on('changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () { + // only if undetermined is in setting + if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } + this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); + }, this)); + } + if(!this.settings.checkbox.tie_selection) { + this.element + .on('model.jstree', $.proxy(function (e, data) { + var m = this._model.data, + p = m[data.parent], + dpc = data.nodes, + i, j; + for(i = 0, j = dpc.length; i < j; i++) { + m[dpc[i]].state.checked = m[dpc[i]].state.checked || (m[dpc[i]].original && m[dpc[i]].original.state && m[dpc[i]].original.state.checked); + if(m[dpc[i]].state.checked) { + this._data.checkbox.selected.push(dpc[i]); + } + } + }, this)); + } + if(this.settings.checkbox.cascade.indexOf('up') !== -1 || this.settings.checkbox.cascade.indexOf('down') !== -1) { + this.element + .on('model.jstree', $.proxy(function (e, data) { + var m = this._model.data, + p = m[data.parent], + dpc = data.nodes, + chd = [], + c, i, j, k, l, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection; + + if(s.indexOf('down') !== -1) { + // apply down + if(p.state[ t ? 'selected' : 'checked' ]) { + for(i = 0, j = dpc.length; i < j; i++) { + m[dpc[i]].state[ t ? 'selected' : 'checked' ] = true; + } + + this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(dpc); + } + else { + for(i = 0, j = dpc.length; i < j; i++) { + if(m[dpc[i]].state[ t ? 'selected' : 'checked' ]) { + for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) { + m[m[dpc[i]].children_d[k]].state[ t ? 'selected' : 'checked' ] = true; + } + this._data[ t ? 'core' : 'checkbox' ].selected = this._data[ t ? 'core' : 'checkbox' ].selected.concat(m[dpc[i]].children_d); + } + } + } + } + + if(s.indexOf('up') !== -1) { + // apply up + for(i = 0, j = p.children_d.length; i < j; i++) { + if(!m[p.children_d[i]].children.length) { + chd.push(m[p.children_d[i]].parent); + } + } + chd = $.vakata.array_unique(chd); + for(k = 0, l = chd.length; k < l; k++) { + p = m[chd[k]]; + while(p && p.id !== $.jstree.root) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(c === j) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass( t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + p = this.get_node(p.parent); + } + } + } + + this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected); + }, this)) + .on(this.settings.checkbox.tie_selection ? 'select_node.jstree' : 'check_node.jstree', $.proxy(function (e, data) { + var self = this, + obj = data.node, + m = this._model.data, + par = this.get_node(obj.parent), + i, j, c, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, + sel = {}, cur = this._data[ t ? 'core' : 'checkbox' ].selected; + + for (i = 0, j = cur.length; i < j; i++) { + sel[cur[i]] = true; + } + + // apply down + if(s.indexOf('down') !== -1) { + //this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_unique(this._data[ t ? 'core' : 'checkbox' ].selected.concat(obj.children_d)); + var selectedIds = this._cascade_new_checked_state(obj.id, true); + var temp = obj.children_d.concat(obj.id); + for (i = 0, j = temp.length; i < j; i++) { + if (selectedIds.indexOf(temp[i]) > -1) { + sel[temp[i]] = true; + } + else { + delete sel[temp[i]]; + } + } + } + + // apply up + if(s.indexOf('up') !== -1) { + while(par && par.id !== $.jstree.root) { + c = 0; + for(i = 0, j = par.children.length; i < j; i++) { + c += m[par.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(c === j) { + par.state[ t ? 'selected' : 'checked' ] = true; + sel[par.id] = true; + //this._data[ t ? 'core' : 'checkbox' ].selected.push(par.id); + tmp = this.get_node(par, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + par = this.get_node(par.parent); + } + } + + cur = []; + for (i in sel) { + if (sel.hasOwnProperty(i)) { + cur.push(i); + } + } + this._data[ t ? 'core' : 'checkbox' ].selected = cur; + }, this)) + .on(this.settings.checkbox.tie_selection ? 'deselect_all.jstree' : 'uncheck_all.jstree', $.proxy(function (e, data) { + var obj = this.get_node($.jstree.root), + m = this._model.data, + i, j, tmp; + for(i = 0, j = obj.children_d.length; i < j; i++) { + tmp = m[obj.children_d[i]]; + if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { + tmp.original.state.undetermined = false; + } + } + }, this)) + .on(this.settings.checkbox.tie_selection ? 'deselect_node.jstree' : 'uncheck_node.jstree', $.proxy(function (e, data) { + var self = this, + obj = data.node, + dom = this.get_node(obj, true), + i, j, tmp, s = this.settings.checkbox.cascade, t = this.settings.checkbox.tie_selection, + cur = this._data[ t ? 'core' : 'checkbox' ].selected, sel = {}, + stillSelectedIds = [], + allIds = obj.children_d.concat(obj.id); + + // apply down + if(s.indexOf('down') !== -1) { + var selectedIds = this._cascade_new_checked_state(obj.id, false); + + cur = cur.filter(function(id) { + return allIds.indexOf(id) === -1 || selectedIds.indexOf(id) > -1; + }); + } + + // only apply up if cascade up is enabled and if this node is not selected + // (if all child nodes are disabled and cascade_to_disabled === false then this node will till be selected). + if(s.indexOf('up') !== -1 && cur.indexOf(obj.id) === -1) { + for(i = 0, j = obj.parents.length; i < j; i++) { + tmp = this._model.data[obj.parents[i]]; + tmp.state[ t ? 'selected' : 'checked' ] = false; + if(tmp && tmp.original && tmp.original.state && tmp.original.state.undetermined) { + tmp.original.state.undetermined = false; + } + tmp = this.get_node(obj.parents[i], true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + + cur = cur.filter(function(id) { + return obj.parents.indexOf(id) === -1; + }); + } + + this._data[ t ? 'core' : 'checkbox' ].selected = cur; + }, this)); + } + if(this.settings.checkbox.cascade.indexOf('up') !== -1) { + this.element + .on('delete_node.jstree', $.proxy(function (e, data) { + // apply up (whole handler) + var p = this.get_node(data.parent), + m = this._model.data, + i, j, c, tmp, t = this.settings.checkbox.tie_selection; + while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(j > 0 && c === j) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + p = this.get_node(p.parent); + } + }, this)) + .on('move_node.jstree', $.proxy(function (e, data) { + // apply up (whole handler) + var is_multi = data.is_multi, + old_par = data.old_parent, + new_par = this.get_node(data.parent), + m = this._model.data, + p, c, i, j, tmp, t = this.settings.checkbox.tie_selection; + if(!is_multi) { + p = this.get_node(old_par); + while(p && p.id !== $.jstree.root && !p.state[ t ? 'selected' : 'checked' ]) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(j > 0 && c === j) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + p = this.get_node(p.parent); + } + } + p = new_par; + while(p && p.id !== $.jstree.root) { + c = 0; + for(i = 0, j = p.children.length; i < j; i++) { + c += m[p.children[i]].state[ t ? 'selected' : 'checked' ]; + } + if(c === j) { + if(!p.state[ t ? 'selected' : 'checked' ]) { + p.state[ t ? 'selected' : 'checked' ] = true; + this._data[ t ? 'core' : 'checkbox' ].selected.push(p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + } + else { + if(p.state[ t ? 'selected' : 'checked' ]) { + p.state[ t ? 'selected' : 'checked' ] = false; + this._data[ t ? 'core' : 'checkbox' ].selected = $.vakata.array_remove_item(this._data[ t ? 'core' : 'checkbox' ].selected, p.id); + tmp = this.get_node(p, true); + if(tmp && tmp.length) { + tmp.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + break; + } + } + p = this.get_node(p.parent); + } + }, this)); + } + }; + /** + * get an array of all nodes whose state is "undetermined" + * @name get_undetermined([full]) + * @param {boolean} full: if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_undetermined = function (full) { + if (this.settings.checkbox.cascade.indexOf('undetermined') === -1) { + return []; + } + var i, j, k, l, o = {}, m = this._model.data, t = this.settings.checkbox.tie_selection, s = this._data[ t ? 'core' : 'checkbox' ].selected, p = [], tt = this, r = []; + for(i = 0, j = s.length; i < j; i++) { + if(m[s[i]] && m[s[i]].parents) { + for(k = 0, l = m[s[i]].parents.length; k < l; k++) { + if(o[m[s[i]].parents[k]] !== undefined) { + break; + } + if(m[s[i]].parents[k] !== $.jstree.root) { + o[m[s[i]].parents[k]] = true; + p.push(m[s[i]].parents[k]); + } + } + } + } + // attempt for server side undetermined state + this.element.find('.jstree-closed').not(':has(.jstree-children)') + .each(function () { + var tmp = tt.get_node(this), tmp2; + + if(!tmp) { return; } + + if(!tmp.state.loaded) { + if(tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) { + if(o[tmp.id] === undefined && tmp.id !== $.jstree.root) { + o[tmp.id] = true; + p.push(tmp.id); + } + for(k = 0, l = tmp.parents.length; k < l; k++) { + if(o[tmp.parents[k]] === undefined && tmp.parents[k] !== $.jstree.root) { + o[tmp.parents[k]] = true; + p.push(tmp.parents[k]); + } + } + } + } + else { + for(i = 0, j = tmp.children_d.length; i < j; i++) { + tmp2 = m[tmp.children_d[i]]; + if(!tmp2.state.loaded && tmp2.original && tmp2.original.state && tmp2.original.state.undetermined && tmp2.original.state.undetermined === true) { + if(o[tmp2.id] === undefined && tmp2.id !== $.jstree.root) { + o[tmp2.id] = true; + p.push(tmp2.id); + } + for(k = 0, l = tmp2.parents.length; k < l; k++) { + if(o[tmp2.parents[k]] === undefined && tmp2.parents[k] !== $.jstree.root) { + o[tmp2.parents[k]] = true; + p.push(tmp2.parents[k]); + } + } + } + } + } + }); + for (i = 0, j = p.length; i < j; i++) { + if(!m[p[i]].state[ t ? 'selected' : 'checked' ]) { + r.push(full ? m[p[i]] : p[i]); + } + } + return r; + }; + /** + * set the undetermined state where and if necessary. Used internally. + * @private + * @name _undetermined() + * @plugin checkbox + */ + this._undetermined = function () { + if(this.element === null) { return; } + var p = this.get_undetermined(false), i, j, s; + + this.element.find('.jstree-undetermined').removeClass('jstree-undetermined'); + for (i = 0, j = p.length; i < j; i++) { + s = this.get_node(p[i], true); + if(s && s.length) { + s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined'); + } + } + }; + this.redraw_node = function(obj, deep, is_callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if(obj) { + var i, j, tmp = null, icon = null; + for(i = 0, j = obj.childNodes.length; i < j; i++) { + if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { + tmp = obj.childNodes[i]; + break; + } + } + if(tmp) { + if(!this.settings.checkbox.tie_selection && this._model.data[obj.id].state.checked) { tmp.className += ' jstree-checked'; } + icon = _i.cloneNode(false); + if(this._model.data[obj.id].state.checkbox_disabled) { icon.className += ' jstree-checkbox-disabled'; } + tmp.insertBefore(icon, tmp.childNodes[0]); + } + } + if(!is_callback && this.settings.checkbox.cascade.indexOf('undetermined') !== -1) { + if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); } + this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50); + } + return obj; + }; + /** + * show the node checkbox icons + * @name show_checkboxes() + * @plugin checkbox + */ + this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); }; + /** + * hide the node checkbox icons + * @name hide_checkboxes() + * @plugin checkbox + */ + this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); }; + /** + * toggle the node icons + * @name toggle_checkboxes() + * @plugin checkbox + */ + this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } }; + /** + * checks if a node is in an undetermined state + * @name is_undetermined(obj) + * @param {mixed} obj + * @return {Boolean} + */ + this.is_undetermined = function (obj) { + obj = this.get_node(obj); + var s = this.settings.checkbox.cascade, i, j, t = this.settings.checkbox.tie_selection, d = this._data[ t ? 'core' : 'checkbox' ].selected, m = this._model.data; + if(!obj || obj.state[ t ? 'selected' : 'checked' ] === true || s.indexOf('undetermined') === -1 || (s.indexOf('down') === -1 && s.indexOf('up') === -1)) { + return false; + } + if(!obj.state.loaded && obj.original.state.undetermined === true) { + return true; + } + for(i = 0, j = obj.children_d.length; i < j; i++) { + if($.inArray(obj.children_d[i], d) !== -1 || (!m[obj.children_d[i]].state.loaded && m[obj.children_d[i]].original.state.undetermined)) { + return true; + } + } + return false; + }; + /** + * disable a node's checkbox + * @name disable_checkbox(obj) + * @param {mixed} obj an array can be used too + * @trigger disable_checkbox.jstree + * @plugin checkbox + */ + this.disable_checkbox = function (obj) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.disable_checkbox(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(!obj.state.checkbox_disabled) { + obj.state.checkbox_disabled = true; + if(dom && dom.length) { + dom.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-checkbox-disabled'); + } + /** + * triggered when an node's checkbox is disabled + * @event + * @name disable_checkbox.jstree + * @param {Object} node + * @plugin checkbox + */ + this.trigger('disable_checkbox', { 'node' : obj }); + } + }; + /** + * enable a node's checkbox + * @name disable_checkbox(obj) + * @param {mixed} obj an array can be used too + * @trigger enable_checkbox.jstree + * @plugin checkbox + */ + this.enable_checkbox = function (obj) { + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.enable_checkbox(obj[t1]); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(obj.state.checkbox_disabled) { + obj.state.checkbox_disabled = false; + if(dom && dom.length) { + dom.children('.jstree-anchor').children('.jstree-checkbox').removeClass('jstree-checkbox-disabled'); + } + /** + * triggered when an node's checkbox is enabled + * @event + * @name enable_checkbox.jstree + * @param {Object} node + * @plugin checkbox + */ + this.trigger('enable_checkbox', { 'node' : obj }); + } + }; + + this.activate_node = function (obj, e) { + if($(e.target).hasClass('jstree-checkbox-disabled')) { + return false; + } + if(this.settings.checkbox.tie_selection && (this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox'))) { + e.ctrlKey = true; + } + if(this.settings.checkbox.tie_selection || (!this.settings.checkbox.whole_node && !$(e.target).hasClass('jstree-checkbox'))) { + return parent.activate_node.call(this, obj, e); + } + if(this.is_disabled(obj)) { + return false; + } + if(this.is_checked(obj)) { + this.uncheck_node(obj, e); + } + else { + this.check_node(obj, e); + } + this.trigger('activate_node', { 'node' : this.get_node(obj) }); + }; + + /** + * Cascades checked state to a node and all its descendants. This function does NOT affect hidden and disabled nodes (or their descendants). + * However if these unaffected nodes are already selected their ids will be included in the returned array. + * @private + * @param {string} id the node ID + * @param {bool} checkedState should the nodes be checked or not + * @returns {Array} Array of all node id's (in this tree branch) that are checked. + */ + this._cascade_new_checked_state = function (id, checkedState) { + var self = this; + var t = this.settings.checkbox.tie_selection; + var node = this._model.data[id]; + var selectedNodeIds = []; + var selectedChildrenIds = [], i, j, selectedChildIds; + + if ( + (this.settings.checkbox.cascade_to_disabled || !node.state.disabled) && + (this.settings.checkbox.cascade_to_hidden || !node.state.hidden) + ) { + //First try and check/uncheck the children + if (node.children) { + for (i = 0, j = node.children.length; i < j; i++) { + var childId = node.children[i]; + selectedChildIds = self._cascade_new_checked_state(childId, checkedState); + selectedNodeIds = selectedNodeIds.concat(selectedChildIds); + if (selectedChildIds.indexOf(childId) > -1) { + selectedChildrenIds.push(childId); + } + } + } + + var dom = self.get_node(node, true); + + //A node's state is undetermined if some but not all of it's children are checked/selected . + var undetermined = selectedChildrenIds.length > 0 && selectedChildrenIds.length < node.children.length; + + if(node.original && node.original.state && node.original.state.undetermined) { + node.original.state.undetermined = undetermined; + } + + //If a node is undetermined then remove selected class + if (undetermined) { + node.state[ t ? 'selected' : 'checked' ] = false; + dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + //Otherwise, if the checkedState === true (i.e. the node is being checked now) and all of the node's children are checked (if it has any children), + //check the node and style it correctly. + else if (checkedState && selectedChildrenIds.length === node.children.length) { + node.state[ t ? 'selected' : 'checked' ] = checkedState; + selectedNodeIds.push(node.id); + + dom.attr('aria-selected', true).children('.jstree-anchor').addClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + else { + node.state[ t ? 'selected' : 'checked' ] = false; + dom.attr('aria-selected', false).children('.jstree-anchor').removeClass(t ? 'jstree-clicked' : 'jstree-checked'); + } + } + else { + selectedChildIds = this.get_checked_descendants(id); + + if (node.state[ t ? 'selected' : 'checked' ]) { + selectedChildIds.push(node.id); + } + + selectedNodeIds = selectedNodeIds.concat(selectedChildIds); + } + + return selectedNodeIds; + }; + + /** + * Gets ids of nodes selected in branch (of tree) specified by id (does not include the node specified by id) + * @name get_checked_descendants(obj) + * @param {string} id the node ID + * @return {Array} array of IDs + * @plugin checkbox + */ + this.get_checked_descendants = function (id) { + var self = this; + var t = self.settings.checkbox.tie_selection; + var node = self._model.data[id]; + + return node.children_d.filter(function(_id) { + return self._model.data[_id].state[ t ? 'selected' : 'checked' ]; + }); + }; + + /** + * check a node (only if tie_selection in checkbox settings is false, otherwise select_node will be called internally) + * @name check_node(obj) + * @param {mixed} obj an array can be used to check multiple nodes + * @trigger check_node.jstree + * @plugin checkbox + */ + this.check_node = function (obj, e) { + if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); } + var dom, t1, t2, th; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.check_node(obj[t1], e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(!obj.state.checked) { + obj.state.checked = true; + this._data.checkbox.selected.push(obj.id); + if(dom && dom.length) { + dom.children('.jstree-anchor').addClass('jstree-checked'); + } + /** + * triggered when an node is checked (only if tie_selection in checkbox settings is false) + * @event + * @name check_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this check_node + * @plugin checkbox + */ + this.trigger('check_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); + } + }; + /** + * uncheck a node (only if tie_selection in checkbox settings is false, otherwise deselect_node will be called internally) + * @name uncheck_node(obj) + * @param {mixed} obj an array can be used to uncheck multiple nodes + * @trigger uncheck_node.jstree + * @plugin checkbox + */ + this.uncheck_node = function (obj, e) { + if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); } + var t1, t2, dom; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.uncheck_node(obj[t1], e); + } + return true; + } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { + return false; + } + dom = this.get_node(obj, true); + if(obj.state.checked) { + obj.state.checked = false; + this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, obj.id); + if(dom.length) { + dom.children('.jstree-anchor').removeClass('jstree-checked'); + } + /** + * triggered when an node is unchecked (only if tie_selection in checkbox settings is false) + * @event + * @name uncheck_node.jstree + * @param {Object} node + * @param {Array} selected the current selection + * @param {Object} event the event (if any) that triggered this uncheck_node + * @plugin checkbox + */ + this.trigger('uncheck_node', { 'node' : obj, 'selected' : this._data.checkbox.selected, 'event' : e }); + } + }; + + /** + * checks all nodes in the tree (only if tie_selection in checkbox settings is false, otherwise select_all will be called internally) + * @name check_all() + * @trigger check_all.jstree, changed.jstree + * @plugin checkbox + */ + this.check_all = function () { + if(this.settings.checkbox.tie_selection) { return this.select_all(); } + var tmp = this._data.checkbox.selected.concat([]), i, j; + this._data.checkbox.selected = this._model.data[$.jstree.root].children_d.concat(); + for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { + if(this._model.data[this._data.checkbox.selected[i]]) { + this._model.data[this._data.checkbox.selected[i]].state.checked = true; + } + } + this.redraw(true); + /** + * triggered when all nodes are checked (only if tie_selection in checkbox settings is false) + * @event + * @name check_all.jstree + * @param {Array} selected the current selection + * @plugin checkbox + */ + this.trigger('check_all', { 'selected' : this._data.checkbox.selected }); + }; + /** + * uncheck all checked nodes (only if tie_selection in checkbox settings is false, otherwise deselect_all will be called internally) + * @name uncheck_all() + * @trigger uncheck_all.jstree + * @plugin checkbox + */ + this.uncheck_all = function () { + if(this.settings.checkbox.tie_selection) { return this.deselect_all(); } + var tmp = this._data.checkbox.selected.concat([]), i, j; + for(i = 0, j = this._data.checkbox.selected.length; i < j; i++) { + if(this._model.data[this._data.checkbox.selected[i]]) { + this._model.data[this._data.checkbox.selected[i]].state.checked = false; + } + } + this._data.checkbox.selected = []; + this.element.find('.jstree-checked').removeClass('jstree-checked'); + /** + * triggered when all nodes are unchecked (only if tie_selection in checkbox settings is false) + * @event + * @name uncheck_all.jstree + * @param {Object} node the previous selection + * @param {Array} selected the current selection + * @plugin checkbox + */ + this.trigger('uncheck_all', { 'selected' : this._data.checkbox.selected, 'node' : tmp }); + }; + /** + * checks if a node is checked (if tie_selection is on in the settings this function will return the same as is_selected) + * @name is_checked(obj) + * @param {mixed} obj + * @return {Boolean} + * @plugin checkbox + */ + this.is_checked = function (obj) { + if(this.settings.checkbox.tie_selection) { return this.is_selected(obj); } + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + return obj.state.checked; + }; + /** + * get an array of all checked nodes (if tie_selection is on in the settings this function will return the same as get_selected) + * @name get_checked([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_checked = function (full) { + if(this.settings.checkbox.tie_selection) { return this.get_selected(full); } + return full ? $.map(this._data.checkbox.selected, $.proxy(function (i) { return this.get_node(i); }, this)) : this._data.checkbox.selected; + }; + /** + * get an array of all top level checked nodes (ignoring children of checked nodes) (if tie_selection is on in the settings this function will return the same as get_top_selected) + * @name get_top_checked([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_top_checked = function (full) { + if(this.settings.checkbox.tie_selection) { return this.get_top_selected(full); } + var tmp = this.get_checked(true), + obj = {}, i, j, k, l; + for(i = 0, j = tmp.length; i < j; i++) { + obj[tmp[i].id] = tmp[i]; + } + for(i = 0, j = tmp.length; i < j; i++) { + for(k = 0, l = tmp[i].children_d.length; k < l; k++) { + if(obj[tmp[i].children_d[k]]) { + delete obj[tmp[i].children_d[k]]; + } + } + } + tmp = []; + for(i in obj) { + if(obj.hasOwnProperty(i)) { + tmp.push(i); + } + } + return full ? $.map(tmp, $.proxy(function (i) { return this.get_node(i); }, this)) : tmp; + }; + /** + * get an array of all bottom level checked nodes (ignoring selected parents) (if tie_selection is on in the settings this function will return the same as get_bottom_selected) + * @name get_bottom_checked([full]) + * @param {mixed} full if set to `true` the returned array will consist of the full node objects, otherwise - only IDs will be returned + * @return {Array} + * @plugin checkbox + */ + this.get_bottom_checked = function (full) { + if(this.settings.checkbox.tie_selection) { return this.get_bottom_selected(full); } + var tmp = this.get_checked(true), + obj = [], i, j; + for(i = 0, j = tmp.length; i < j; i++) { + if(!tmp[i].children.length) { + obj.push(tmp[i].id); + } + } + return full ? $.map(obj, $.proxy(function (i) { return this.get_node(i); }, this)) : obj; + }; + this.load_node = function (obj, callback) { + var k, l, i, j, c, tmp; + if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) { + tmp = this.get_node(obj); + if(tmp && tmp.state.loaded) { + for(k = 0, l = tmp.children_d.length; k < l; k++) { + if(this._model.data[tmp.children_d[k]].state.checked) { + c = true; + this._data.checkbox.selected = $.vakata.array_remove_item(this._data.checkbox.selected, tmp.children_d[k]); + } + } + } + } + return parent.load_node.apply(this, arguments); + }; + this.get_state = function () { + var state = parent.get_state.apply(this, arguments); + if(this.settings.checkbox.tie_selection) { return state; } + state.checkbox = this._data.checkbox.selected.slice(); + return state; + }; + this.set_state = function (state, callback) { + var res = parent.set_state.apply(this, arguments); + if(res && state.checkbox) { + if(!this.settings.checkbox.tie_selection) { + this.uncheck_all(); + var _this = this; + $.each(state.checkbox, function (i, v) { + _this.check_node(v); + }); + } + delete state.checkbox; + this.set_state(state, callback); + return false; + } + return res; + }; + this.refresh = function (skip_loading, forget_state) { + if(this.settings.checkbox.tie_selection) { + this._data.checkbox.selected = []; + } + return parent.refresh.apply(this, arguments); + }; + }; + + // include the checkbox plugin by default + // $.jstree.defaults.plugins.push("checkbox"); + + +/** + * ### Conditionalselect plugin + * + * This plugin allows defining a callback to allow or deny node selection by user input (activate node method). + */ + + /** + * a callback (function) which is invoked in the instance's scope and receives two arguments - the node and the event that triggered the `activate_node` call. Returning false prevents working with the node, returning true allows invoking activate_node. Defaults to returning `true`. + * @name $.jstree.defaults.checkbox.visible + * @plugin checkbox + */ + $.jstree.defaults.conditionalselect = function () { return true; }; + $.jstree.plugins.conditionalselect = function (options, parent) { + // own function + this.activate_node = function (obj, e) { + if(this.settings.conditionalselect.call(this, this.get_node(obj), e)) { + return parent.activate_node.call(this, obj, e); + } + }; + }; + + +/** + * ### Contextmenu plugin + * + * Shows a context menu when a node is right-clicked. + */ + + /** + * stores all defaults for the contextmenu plugin + * @name $.jstree.defaults.contextmenu + * @plugin contextmenu + */ + $.jstree.defaults.contextmenu = { + /** + * a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`. + * @name $.jstree.defaults.contextmenu.select_node + * @plugin contextmenu + */ + select_node : true, + /** + * a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used. + * @name $.jstree.defaults.contextmenu.show_at_node + * @plugin contextmenu + */ + show_at_node : true, + /** + * an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too). + * + * Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required). Once a menu item is activated the `action` function will be invoked with an object containing the following keys: item - the contextmenu item definition as seen below, reference - the DOM node that was used (the tree node), element - the contextmenu DOM element, position - an object with x/y properties indicating the position of the menu. + * + * * `separator_before` - a boolean indicating if there should be a separator before this item + * * `separator_after` - a boolean indicating if there should be a separator after this item + * * `_disabled` - a boolean indicating if this action should be disabled + * * `label` - a string - the name of the action (could be a function returning a string) + * * `title` - a string - an optional tooltip for the item + * * `action` - a function to be executed if this item is chosen, the function will receive + * * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class + * * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2) + * * `shortcut_label` - shortcut label (like for example `F2` for rename) + * * `submenu` - an object with the same structure as $.jstree.defaults.contextmenu.items which can be used to create a submenu - each key will be rendered as a separate option in a submenu that will appear once the current item is hovered + * + * @name $.jstree.defaults.contextmenu.items + * @plugin contextmenu + */ + items : function (o, cb) { // Could be an object directly + return { + "create" : { + "separator_before" : false, + "separator_after" : true, + "_disabled" : false, //(this.check("create_node", data.reference, {}, "last")), + "label" : "Create", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + inst.create_node(obj, {}, "last", function (new_node) { + try { + inst.edit(new_node); + } catch (ex) { + setTimeout(function () { inst.edit(new_node); },0); + } + }); + } + }, + "rename" : { + "separator_before" : false, + "separator_after" : false, + "_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")), + "label" : "Rename", + /*! + "shortcut" : 113, + "shortcut_label" : 'F2', + "icon" : "glyphicon glyphicon-leaf", + */ + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + inst.edit(obj); + } + }, + "remove" : { + "separator_before" : false, + "icon" : false, + "separator_after" : false, + "_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")), + "label" : "Delete", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + if(inst.is_selected(obj)) { + inst.delete_node(inst.get_selected()); + } + else { + inst.delete_node(obj); + } + } + }, + "ccp" : { + "separator_before" : true, + "icon" : false, + "separator_after" : false, + "label" : "Edit", + "action" : false, + "submenu" : { + "cut" : { + "separator_before" : false, + "separator_after" : false, + "label" : "Cut", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + if(inst.is_selected(obj)) { + inst.cut(inst.get_top_selected()); + } + else { + inst.cut(obj); + } + } + }, + "copy" : { + "separator_before" : false, + "icon" : false, + "separator_after" : false, + "label" : "Copy", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + if(inst.is_selected(obj)) { + inst.copy(inst.get_top_selected()); + } + else { + inst.copy(obj); + } + } + }, + "paste" : { + "separator_before" : false, + "icon" : false, + "_disabled" : function (data) { + return !$.jstree.reference(data.reference).can_paste(); + }, + "separator_after" : false, + "label" : "Paste", + "action" : function (data) { + var inst = $.jstree.reference(data.reference), + obj = inst.get_node(data.reference); + inst.paste(obj); + } + } + } + } + }; + } + }; + + $.jstree.plugins.contextmenu = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + + var last_ts = 0, cto = null, ex, ey; + this.element + .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { + this.get_container_ul().addClass('jstree-contextmenu'); + }, this)) + .on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e, data) { + if (e.target.tagName.toLowerCase() === 'input') { + return; + } + e.preventDefault(); + last_ts = e.ctrlKey ? +new Date() : 0; + if(data || cto) { + last_ts = (+new Date()) + 10000; + } + if(cto) { + clearTimeout(cto); + } + if(!this.is_loading(e.currentTarget)) { + this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e); + } + }, this)) + .on("click.jstree", ".jstree-anchor", $.proxy(function (e) { + if(this._data.contextmenu.visible && (!last_ts || (+new Date()) - last_ts > 250)) { // work around safari & macOS ctrl+click + $.vakata.context.hide(); + } + last_ts = 0; + }, this)) + .on("touchstart.jstree", ".jstree-anchor", function (e) { + if(!e.originalEvent || !e.originalEvent.changedTouches || !e.originalEvent.changedTouches[0]) { + return; + } + ex = e.originalEvent.changedTouches[0].clientX; + ey = e.originalEvent.changedTouches[0].clientY; + cto = setTimeout(function () { + $(e.currentTarget).trigger('contextmenu', true); + }, 750); + }) + .on('touchmove.vakata.jstree', function (e) { + if(cto && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0] && (Math.abs(ex - e.originalEvent.changedTouches[0].clientX) > 10 || Math.abs(ey - e.originalEvent.changedTouches[0].clientY) > 10)) { + clearTimeout(cto); + $.vakata.context.hide(); + } + }) + .on('touchend.vakata.jstree', function (e) { + if(cto) { + clearTimeout(cto); + } + }); + + /*! + if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) { + var el = null, tm = null; + this.element + .on("touchstart", ".jstree-anchor", function (e) { + el = e.currentTarget; + tm = +new Date(); + $(document).one("touchend", function (e) { + e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset); + e.currentTarget = e.target; + tm = ((+(new Date())) - tm); + if(e.target === el && tm > 600 && tm < 1000) { + e.preventDefault(); + $(el).trigger('contextmenu', e); + } + el = null; + tm = null; + }); + }); + } + */ + $(document).on("context_hide.vakata.jstree", $.proxy(function (e, data) { + this._data.contextmenu.visible = false; + $(data.reference).removeClass('jstree-context'); + }, this)); + }; + this.teardown = function () { + if(this._data.contextmenu.visible) { + $.vakata.context.hide(); + } + parent.teardown.call(this); + }; + + /** + * prepare and show the context menu for a node + * @name show_contextmenu(obj [, x, y]) + * @param {mixed} obj the node + * @param {Number} x the x-coordinate relative to the document to show the menu at + * @param {Number} y the y-coordinate relative to the document to show the menu at + * @param {Object} e the event if available that triggered the contextmenu + * @plugin contextmenu + * @trigger show_contextmenu.jstree + */ + this.show_contextmenu = function (obj, x, y, e) { + obj = this.get_node(obj); + if(!obj || obj.id === $.jstree.root) { return false; } + var s = this.settings.contextmenu, + d = this.get_node(obj, true), + a = d.children(".jstree-anchor"), + o = false, + i = false; + if(s.show_at_node || x === undefined || y === undefined) { + o = a.offset(); + x = o.left; + y = o.top + this._data.core.li_height; + } + if(this.settings.contextmenu.select_node && !this.is_selected(obj)) { + this.activate_node(obj, e); + } + + i = s.items; + if($.isFunction(i)) { + i = i.call(this, obj, $.proxy(function (i) { + this._show_contextmenu(obj, x, y, i); + }, this)); + } + if($.isPlainObject(i)) { + this._show_contextmenu(obj, x, y, i); + } + }; + /** + * show the prepared context menu for a node + * @name _show_contextmenu(obj, x, y, i) + * @param {mixed} obj the node + * @param {Number} x the x-coordinate relative to the document to show the menu at + * @param {Number} y the y-coordinate relative to the document to show the menu at + * @param {Number} i the object of items to show + * @plugin contextmenu + * @trigger show_contextmenu.jstree + * @private + */ + this._show_contextmenu = function (obj, x, y, i) { + var d = this.get_node(obj, true), + a = d.children(".jstree-anchor"); + $(document).one("context_show.vakata.jstree", $.proxy(function (e, data) { + var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu'; + $(data.element).addClass(cls); + a.addClass('jstree-context'); + }, this)); + this._data.contextmenu.visible = true; + $.vakata.context.show(a, { 'x' : x, 'y' : y }, i); + /** + * triggered when the contextmenu is shown for a node + * @event + * @name show_contextmenu.jstree + * @param {Object} node the node + * @param {Number} x the x-coordinate of the menu relative to the document + * @param {Number} y the y-coordinate of the menu relative to the document + * @plugin contextmenu + */ + this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y }); + }; + }; + + // contextmenu helper + (function ($) { + var right_to_left = false, + vakata_context = { + element : false, + reference : false, + position_x : 0, + position_y : 0, + items : [], + html : "", + is_visible : false + }; + + $.vakata.context = { + settings : { + hide_onmouseleave : 0, + icons : true + }, + _trigger : function (event_name) { + $(document).triggerHandler("context_" + event_name + ".vakata", { + "reference" : vakata_context.reference, + "element" : vakata_context.element, + "position" : { + "x" : vakata_context.position_x, + "y" : vakata_context.position_y + } + }); + }, + _execute : function (i) { + i = vakata_context.items[i]; + return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, { + "item" : i, + "reference" : vakata_context.reference, + "element" : vakata_context.element, + "position" : { + "x" : vakata_context.position_x, + "y" : vakata_context.position_y + } + }) : false; + }, + _parse : function (o, is_callback) { + if(!o) { return false; } + if(!is_callback) { + vakata_context.html = ""; + vakata_context.items = []; + } + var str = "", + sep = false, + tmp; + + if(is_callback) { str += "<"+"ul>"; } + $.each(o, function (i, val) { + if(!val) { return true; } + vakata_context.items.push(val); + if(!sep && val.separator_before) { + str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; + } + sep = false; + str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">"; + str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">"; + if($.vakata.context.settings.icons) { + str += "<"+"i "; + if(val.icon) { + if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; } + else { str += " class='" + val.icon + "' "; } + } + str += "><"+"/i><"+"span class='vakata-contextmenu-sep'> <"+"/span>"; + } + str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' '+ (val.shortcut_label || '') +'':'') + "<"+"/a>"; + if(val.submenu) { + tmp = $.vakata.context._parse(val.submenu, true); + if(tmp) { str += tmp; } + } + str += "<"+"/li>"; + if(val.separator_after) { + str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + "> <"+"/a><"+"/li>"; + sep = true; + } + }); + str = str.replace(/
    • <\/li\>$/,""); + if(is_callback) { str += "
    "; } + /** + * triggered on the document when the contextmenu is parsed (HTML is built) + * @event + * @plugin contextmenu + * @name context_parse.vakata + * @param {jQuery} reference the element that was right clicked + * @param {jQuery} element the DOM element of the menu itself + * @param {Object} position the x & y coordinates of the menu + */ + if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); } + return str.length > 10 ? str : false; + }, + _show_submenu : function (o) { + o = $(o); + if(!o.length || !o.children("ul").length) { return; } + var e = o.children("ul"), + xl = o.offset().left, + x = xl + o.outerWidth(), + y = o.offset().top, + w = e.width(), + h = e.height(), + dw = $(window).width() + $(window).scrollLeft(), + dh = $(window).height() + $(window).scrollTop(); + // може да се спести е една проверка - дали няма някой от класовете вече нагоре + if(right_to_left) { + o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left"); + } + else { + o[x + w > dw && xl > dw - x ? "addClass" : "removeClass"]("vakata-context-right"); + } + if(y + h + 10 > dh) { + e.css("bottom","-1px"); + } + + //if does not fit - stick it to the side + if (o.hasClass('vakata-context-right')) { + if (xl < w) { + e.css("margin-right", xl - w); + } + } else { + if (dw - x < w) { + e.css("margin-left", dw - x - w); + } + } + + e.show(); + }, + show : function (reference, position, data) { + var o, e, x, y, w, h, dw, dh, cond = true; + if(vakata_context.element && vakata_context.element.length) { + vakata_context.element.width(''); + } + switch(cond) { + case (!position && !reference): + return false; + case (!!position && !!reference): + vakata_context.reference = reference; + vakata_context.position_x = position.x; + vakata_context.position_y = position.y; + break; + case (!position && !!reference): + vakata_context.reference = reference; + o = reference.offset(); + vakata_context.position_x = o.left + reference.outerHeight(); + vakata_context.position_y = o.top; + break; + case (!!position && !reference): + vakata_context.position_x = position.x; + vakata_context.position_y = position.y; + break; + } + if(!!reference && !data && $(reference).data('vakata_contextmenu')) { + data = $(reference).data('vakata_contextmenu'); + } + if($.vakata.context._parse(data)) { + vakata_context.element.html(vakata_context.html); + } + if(vakata_context.items.length) { + vakata_context.element.appendTo(document.body); + e = vakata_context.element; + x = vakata_context.position_x; + y = vakata_context.position_y; + w = e.width(); + h = e.height(); + dw = $(window).width() + $(window).scrollLeft(); + dh = $(window).height() + $(window).scrollTop(); + if(right_to_left) { + x -= (e.outerWidth() - $(reference).outerWidth()); + if(x < $(window).scrollLeft() + 20) { + x = $(window).scrollLeft() + 20; + } + } + if(x + w + 20 > dw) { + x = dw - (w + 20); + } + if(y + h + 20 > dh) { + y = dh - (h + 20); + } + + vakata_context.element + .css({ "left" : x, "top" : y }) + .show() + .find('a').first().focus().parent().addClass("vakata-context-hover"); + vakata_context.is_visible = true; + /** + * triggered on the document when the contextmenu is shown + * @event + * @plugin contextmenu + * @name context_show.vakata + * @param {jQuery} reference the element that was right clicked + * @param {jQuery} element the DOM element of the menu itself + * @param {Object} position the x & y coordinates of the menu + */ + $.vakata.context._trigger("show"); + } + }, + hide : function () { + if(vakata_context.is_visible) { + vakata_context.element.hide().find("ul").hide().end().find(':focus').blur().end().detach(); + vakata_context.is_visible = false; + /** + * triggered on the document when the contextmenu is hidden + * @event + * @plugin contextmenu + * @name context_hide.vakata + * @param {jQuery} reference the element that was right clicked + * @param {jQuery} element the DOM element of the menu itself + * @param {Object} position the x & y coordinates of the menu + */ + $.vakata.context._trigger("hide"); + } + } + }; + $(function () { + right_to_left = $(document.body).css("direction") === "rtl"; + var to = false; + + vakata_context.element = $("
      "); + vakata_context.element + .on("mouseenter", "li", function (e) { + e.stopImmediatePropagation(); + + if($.contains(this, e.relatedTarget)) { + // премахнато заради delegate mouseleave по-долу + // $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); + return; + } + + if(to) { clearTimeout(to); } + vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(); + + $(this) + .siblings().find("ul").hide().end().end() + .parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover"); + $.vakata.context._show_submenu(this); + }) + // тестово - дали не натоварва? + .on("mouseleave", "li", function (e) { + if($.contains(this, e.relatedTarget)) { return; } + $(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover"); + }) + .on("mouseleave", function (e) { + $(this).find(".vakata-context-hover").removeClass("vakata-context-hover"); + if($.vakata.context.settings.hide_onmouseleave) { + to = setTimeout( + (function (t) { + return function () { $.vakata.context.hide(); }; + }(this)), $.vakata.context.settings.hide_onmouseleave); + } + }) + .on("click", "a", function (e) { + e.preventDefault(); + //}) + //.on("mouseup", "a", function (e) { + if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) { + $.vakata.context.hide(); + } + }) + .on('keydown', 'a', function (e) { + var o = null; + switch(e.which) { + case 13: + case 32: + e.type = "click"; + e.preventDefault(); + $(e.currentTarget).trigger(e); + break; + case 37: + if(vakata_context.is_visible) { + vakata_context.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 38: + if(vakata_context.is_visible) { + o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(); + if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); } + o.addClass("vakata-context-hover").children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 39: + if(vakata_context.is_visible) { + vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 40: + if(vakata_context.is_visible) { + o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(); + if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); } + o.addClass("vakata-context-hover").children('a').focus(); + e.stopImmediatePropagation(); + e.preventDefault(); + } + break; + case 27: + $.vakata.context.hide(); + e.preventDefault(); + break; + default: + //console.log(e.which); + break; + } + }) + .on('keydown', function (e) { + e.preventDefault(); + var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent(); + if(a.parent().not('.vakata-context-disabled')) { + a.click(); + } + }); + + $(document) + .on("mousedown.vakata.jstree", function (e) { + if(vakata_context.is_visible && vakata_context.element[0] !== e.target && !$.contains(vakata_context.element[0], e.target)) { + $.vakata.context.hide(); + } + }) + .on("context_show.vakata.jstree", function (e, data) { + vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"); + if(right_to_left) { + vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl"); + } + // also apply a RTL class? + vakata_context.element.find("ul").hide().end(); + }); + }); + }($)); + // $.jstree.defaults.plugins.push("contextmenu"); + + +/** + * ### Drag'n'drop plugin + * + * Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations. + */ + + /** + * stores all defaults for the drag'n'drop plugin + * @name $.jstree.defaults.dnd + * @plugin dnd + */ + $.jstree.defaults.dnd = { + /** + * a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`. + * @name $.jstree.defaults.dnd.copy + * @plugin dnd + */ + copy : true, + /** + * a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`. + * @name $.jstree.defaults.dnd.open_timeout + * @plugin dnd + */ + open_timeout : 500, + /** + * a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the nodes about to be dragged as an argument (array) and the event that started the drag - return `false` to prevent dragging + * @name $.jstree.defaults.dnd.is_draggable + * @plugin dnd + */ + is_draggable : true, + /** + * a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true` + * @name $.jstree.defaults.dnd.check_while_dragging + * @plugin dnd + */ + check_while_dragging : true, + /** + * a boolean indicating if nodes from this tree should only be copied with dnd (as opposed to moved), default is `false` + * @name $.jstree.defaults.dnd.always_copy + * @plugin dnd + */ + always_copy : false, + /** + * when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0` + * @name $.jstree.defaults.dnd.inside_pos + * @plugin dnd + */ + inside_pos : 0, + /** + * when starting the drag on a node that is selected this setting controls if all selected nodes are dragged or only the single node, default is `true`, which means all selected nodes are dragged when the drag is started on a selected node + * @name $.jstree.defaults.dnd.drag_selection + * @plugin dnd + */ + drag_selection : true, + /** + * controls whether dnd works on touch devices. If left as boolean true dnd will work the same as in desktop browsers, which in some cases may impair scrolling. If set to boolean false dnd will not work on touch devices. There is a special third option - string "selected" which means only selected nodes can be dragged on touch devices. + * @name $.jstree.defaults.dnd.touch + * @plugin dnd + */ + touch : true, + /** + * controls whether items can be dropped anywhere on the node, not just on the anchor, by default only the node anchor is a valid drop target. Works best with the wholerow plugin. If enabled on mobile depending on the interface it might be hard for the user to cancel the drop, since the whole tree container will be a valid drop target. + * @name $.jstree.defaults.dnd.large_drop_target + * @plugin dnd + */ + large_drop_target : false, + /** + * controls whether a drag can be initiated from any part of the node and not just the text/icon part, works best with the wholerow plugin. Keep in mind it can cause problems with tree scrolling on mobile depending on the interface - in that case set the touch option to "selected". + * @name $.jstree.defaults.dnd.large_drag_target + * @plugin dnd + */ + large_drag_target : false, + /** + * controls whether use HTML5 dnd api instead of classical. That will allow better integration of dnd events with other HTML5 controls. + * @reference http://caniuse.com/#feat=dragndrop + * @name $.jstree.defaults.dnd.use_html5 + * @plugin dnd + */ + use_html5: false + }; + var drg, elm; + // TODO: now check works by checking for each node individually, how about max_children, unique, etc? + $.jstree.plugins.dnd = function (options, parent) { + this.init = function (el, options) { + parent.init.call(this, el, options); + this.settings.dnd.use_html5 = this.settings.dnd.use_html5 && ('draggable' in document.createElement('span')); + }; + this.bind = function () { + parent.bind.call(this); + + this.element + .on(this.settings.dnd.use_html5 ? 'dragstart.jstree' : 'mousedown.jstree touchstart.jstree', this.settings.dnd.large_drag_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { + if(this.settings.dnd.large_drag_target && $(e.target).closest('.jstree-node')[0] !== e.currentTarget) { + return true; + } + if(e.type === "touchstart" && (!this.settings.dnd.touch || (this.settings.dnd.touch === 'selected' && !$(e.currentTarget).closest('.jstree-node').children('.jstree-anchor').hasClass('jstree-clicked')))) { + return true; + } + var obj = this.get_node(e.target), + mlt = this.is_selected(obj) && this.settings.dnd.drag_selection ? this.get_top_selected().length : 1, + txt = (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget)); + if(this.settings.core.force_text) { + txt = $.vakata.html.escape(txt); + } + if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") && + (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e))) + ) { + drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] }; + elm = e.currentTarget; + if (this.settings.dnd.use_html5) { + $.vakata.dnd._trigger('start', e, { 'helper': $(), 'element': elm, 'data': drg }); + } else { + this.element.trigger('mousedown.jstree'); + return $.vakata.dnd.start(e, drg, '
      ' + txt + '
      '); + } + } + }, this)); + if (this.settings.dnd.use_html5) { + this.element + .on('dragover.jstree', function (e) { + e.preventDefault(); + $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); + return false; + }) + //.on('dragenter.jstree', this.settings.dnd.large_drop_target ? '.jstree-node' : '.jstree-anchor', $.proxy(function (e) { + // e.preventDefault(); + // $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); + // return false; + // }, this)) + .on('drop.jstree', $.proxy(function (e) { + e.preventDefault(); + $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); + return false; + }, this)); + } + }; + this.redraw_node = function(obj, deep, callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if (obj && this.settings.dnd.use_html5) { + if (this.settings.dnd.large_drag_target) { + obj.setAttribute('draggable', true); + } else { + var i, j, tmp = null; + for(i = 0, j = obj.childNodes.length; i < j; i++) { + if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { + tmp = obj.childNodes[i]; + break; + } + } + if(tmp) { + tmp.setAttribute('draggable', true); + } + } + } + return obj; + }; + }; + + $(function() { + // bind only once for all instances + var lastmv = false, + laster = false, + lastev = false, + opento = false, + marker = $('
       
      ').hide(); //.appendTo('body'); + + $(document) + .on('dragover.vakata.jstree', function (e) { + if (elm) { + $.vakata.dnd._trigger('move', e, { 'helper': $(), 'element': elm, 'data': drg }); + } + }) + .on('drop.vakata.jstree', function (e) { + if (elm) { + $.vakata.dnd._trigger('stop', e, { 'helper': $(), 'element': elm, 'data': drg }); + elm = null; + drg = null; + } + }) + .on('dnd_start.vakata.jstree', function (e, data) { + lastmv = false; + lastev = false; + if(!data || !data.data || !data.data.jstree) { return; } + marker.appendTo(document.body); //.show(); + }) + .on('dnd_move.vakata.jstree', function (e, data) { + var isDifferentNode = data.event.target !== lastev.target; + if(opento) { + if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { + clearTimeout(opento); + } + } + if(!data || !data.data || !data.data.jstree) { return; } + + // if we are hovering the marker image do nothing (can happen on "inside" drags) + if(data.event.target.id && data.event.target.id === 'jstree-marker') { + return; + } + lastev = data.event; + + var ins = $.jstree.reference(data.event.target), + ref = false, + off = false, + rel = false, + tmp, l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm, is_copy, pn; + // if we are over an instance + if(ins && ins._data && ins._data.dnd) { + marker.attr('class', 'jstree-' + ins.get_theme() + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )); + is_copy = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))); + data.helper + .children().attr('class', 'jstree-' + ins.get_theme() + ' jstree-' + ins.get_theme() + '-' + ins.get_theme_variant() + ' ' + ( ins.settings.core.themes.responsive ? ' jstree-dnd-responsive' : '' )) + .find('.jstree-copy').first()[ is_copy ? 'show' : 'hide' ](); + + // if are hovering the container itself add a new root node + //console.log(data.event); + if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) { + ok = true; + for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { + ok = ok && ins.check( (data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey)) ) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), $.jstree.root, 'last', { 'dnd' : true, 'ref' : ins.get_node($.jstree.root), 'pos' : 'i', 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }); + if(!ok) { break; } + } + if(ok) { + lastmv = { 'ins' : ins, 'par' : $.jstree.root, 'pos' : 'last' }; + marker.hide(); + data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); + if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { + data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; + } + return; + } + } + else { + // if we are hovering a tree node + ref = ins.settings.dnd.large_drop_target ? $(data.event.target).closest('.jstree-node').children('.jstree-anchor') : $(data.event.target).closest('.jstree-anchor'); + if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) { + off = ref.offset(); + rel = (data.event.pageY !== undefined ? data.event.pageY : data.event.originalEvent.pageY) - off.top; + h = ref.outerHeight(); + if(rel < h / 3) { + o = ['b', 'i', 'a']; + } + else if(rel > h - h / 3) { + o = ['a', 'i', 'b']; + } + else { + o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a']; + } + $.each(o, function (j, v) { + switch(v) { + case 'b': + l = off.left - 6; + t = off.top; + p = ins.get_parent(ref); + i = ref.parent().index(); + break; + case 'i': + ip = ins.settings.dnd.inside_pos; + tm = ins.get_node(ref.parent()); + l = off.left - 2; + t = off.top + h / 2 + 1; + p = tm.id; + i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length)); + break; + case 'a': + l = off.left - 6; + t = off.top + h; + p = ins.get_parent(ref); + i = ref.parent().index() + 1; + break; + } + ok = true; + for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) { + op = data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? "copy_node" : "move_node"; + ps = i; + if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) { + pr = ins.get_node(p); + if(ps > $.inArray(data.data.nodes[t1], pr.children)) { + ps -= 1; + } + } + ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps, { 'dnd' : true, 'ref' : ins.get_node(ref.parent()), 'pos' : v, 'origin' : data.data.origin, 'is_multi' : (data.data.origin && data.data.origin !== ins), 'is_foreign' : (!data.data.origin) }) ); + if(!ok) { + if(ins && ins.last_error) { laster = ins.last_error(); } + break; + } + } + if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) { + if (!data.event || data.event.type !== 'dragover' || isDifferentNode) { + if (opento) { clearTimeout(opento); } + opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout); + } + } + if(ok) { + pn = ins.get_node(p, true); + if (!pn.hasClass('.jstree-dnd-parent')) { + $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); + pn.addClass('jstree-dnd-parent'); + } + lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i }; + marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show(); + data.helper.find('.jstree-icon').first().removeClass('jstree-er').addClass('jstree-ok'); + if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { + data.event.originalEvent.dataTransfer.dropEffect = is_copy ? 'copy' : 'move'; + } + laster = {}; + o = true; + return false; + } + }); + if(o === true) { return; } + } + } + } + $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); + lastmv = false; + data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er'); + if (data.event.originalEvent && data.event.originalEvent.dataTransfer) { + //data.event.originalEvent.dataTransfer.dropEffect = 'none'; + } + marker.hide(); + }) + .on('dnd_scroll.vakata.jstree', function (e, data) { + if(!data || !data.data || !data.data.jstree) { return; } + marker.hide(); + lastmv = false; + lastev = false; + data.helper.find('.jstree-icon').first().removeClass('jstree-ok').addClass('jstree-er'); + }) + .on('dnd_stop.vakata.jstree', function (e, data) { + $('.jstree-dnd-parent').removeClass('jstree-dnd-parent'); + if(opento) { clearTimeout(opento); } + if(!data || !data.data || !data.data.jstree) { return; } + marker.hide().detach(); + var i, j, nodes = []; + if(lastmv) { + for(i = 0, j = data.data.nodes.length; i < j; i++) { + nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i]; + } + lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos, false, false, false, data.data.origin); + } + else { + i = $(data.event.target).closest('.jstree'); + if(i.length && laster && laster.error && laster.error === 'check') { + i = i.jstree(true); + if(i) { + i.settings.core.error.call(this, laster); + } + } + } + lastev = false; + lastmv = false; + }) + .on('keyup.jstree keydown.jstree', function (e, data) { + data = $.vakata.dnd._get(); + if(data && data.data && data.data.jstree) { + if (e.type === "keyup" && e.which === 27) { + if (opento) { clearTimeout(opento); } + lastmv = false; + laster = false; + lastev = false; + opento = false; + marker.hide().detach(); + $.vakata.dnd._clean(); + } else { + data.helper.find('.jstree-copy').first()[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey))) ? 'show' : 'hide' ](); + if(lastev) { + lastev.metaKey = e.metaKey; + lastev.ctrlKey = e.ctrlKey; + $.vakata.dnd._trigger('move', lastev); + } + } + } + }); + }); + + // helpers + (function ($) { + $.vakata.html = { + div : $('
      '), + escape : function (str) { + return $.vakata.html.div.text(str).html(); + }, + strip : function (str) { + return $.vakata.html.div.empty().append($.parseHTML(str)).text(); + } + }; + // private variable + var vakata_dnd = { + element : false, + target : false, + is_down : false, + is_drag : false, + helper : false, + helper_w: 0, + data : false, + init_x : 0, + init_y : 0, + scroll_l: 0, + scroll_t: 0, + scroll_e: false, + scroll_i: false, + is_touch: false + }; + $.vakata.dnd = { + settings : { + scroll_speed : 10, + scroll_proximity : 20, + helper_left : 5, + helper_top : 10, + threshold : 5, + threshold_touch : 10 + }, + _trigger : function (event_name, e, data) { + if (data === undefined) { + data = $.vakata.dnd._get(); + } + data.event = e; + $(document).triggerHandler("dnd_" + event_name + ".vakata", data); + }, + _get : function () { + return { + "data" : vakata_dnd.data, + "element" : vakata_dnd.element, + "helper" : vakata_dnd.helper + }; + }, + _clean : function () { + if(vakata_dnd.helper) { vakata_dnd.helper.remove(); } + if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } + vakata_dnd = { + element : false, + target : false, + is_down : false, + is_drag : false, + helper : false, + helper_w: 0, + data : false, + init_x : 0, + init_y : 0, + scroll_l: 0, + scroll_t: 0, + scroll_e: false, + scroll_i: false, + is_touch: false + }; + $(document).off("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); + $(document).off("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); + }, + _scroll : function (init_only) { + if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) { + if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; } + return false; + } + if(!vakata_dnd.scroll_i) { + vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100); + return false; + } + if(init_only === true) { return false; } + + var i = vakata_dnd.scroll_e.scrollTop(), + j = vakata_dnd.scroll_e.scrollLeft(); + vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed); + vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed); + if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) { + /** + * triggered on the document when a drag causes an element to scroll + * @event + * @plugin dnd + * @name dnd_scroll.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {jQuery} event the element that is scrolling + */ + $.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e); + } + }, + start : function (e, data, html) { + if(e.type === "touchstart" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { + e.pageX = e.originalEvent.changedTouches[0].pageX; + e.pageY = e.originalEvent.changedTouches[0].pageY; + e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); + } + if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); } + try { + e.currentTarget.unselectable = "on"; + e.currentTarget.onselectstart = function() { return false; }; + if(e.currentTarget.style) { + e.currentTarget.style.touchAction = "none"; + e.currentTarget.style.msTouchAction = "none"; + e.currentTarget.style.MozUserSelect = "none"; + } + } catch(ignore) { } + vakata_dnd.init_x = e.pageX; + vakata_dnd.init_y = e.pageY; + vakata_dnd.data = data; + vakata_dnd.is_down = true; + vakata_dnd.element = e.currentTarget; + vakata_dnd.target = e.target; + vakata_dnd.is_touch = e.type === "touchstart"; + if(html !== false) { + vakata_dnd.helper = $("
      ").html(html).css({ + "display" : "block", + "margin" : "0", + "padding" : "0", + "position" : "absolute", + "top" : "-2000px", + "lineHeight" : "16px", + "zIndex" : "10000" + }); + } + $(document).on("mousemove.vakata.jstree touchmove.vakata.jstree", $.vakata.dnd.drag); + $(document).on("mouseup.vakata.jstree touchend.vakata.jstree", $.vakata.dnd.stop); + return false; + }, + drag : function (e) { + if(e.type === "touchmove" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { + e.pageX = e.originalEvent.changedTouches[0].pageX; + e.pageY = e.originalEvent.changedTouches[0].pageY; + e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); + } + if(!vakata_dnd.is_down) { return; } + if(!vakata_dnd.is_drag) { + if( + Math.abs(e.pageX - vakata_dnd.init_x) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) || + Math.abs(e.pageY - vakata_dnd.init_y) > (vakata_dnd.is_touch ? $.vakata.dnd.settings.threshold_touch : $.vakata.dnd.settings.threshold) + ) { + if(vakata_dnd.helper) { + vakata_dnd.helper.appendTo(document.body); + vakata_dnd.helper_w = vakata_dnd.helper.outerWidth(); + } + vakata_dnd.is_drag = true; + $(vakata_dnd.target).one('click.vakata', false); + /** + * triggered on the document when a drag starts + * @event + * @plugin dnd + * @name dnd_start.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {Object} event the event that caused the start (probably mousemove) + */ + $.vakata.dnd._trigger("start", e); + } + else { return; } + } + + var d = false, w = false, + dh = false, wh = false, + dw = false, ww = false, + dt = false, dl = false, + ht = false, hl = false; + + vakata_dnd.scroll_t = 0; + vakata_dnd.scroll_l = 0; + vakata_dnd.scroll_e = false; + $($(e.target).parentsUntil("body").addBack().get().reverse()) + .filter(function () { + return (/^auto|scroll$/).test($(this).css("overflow")) && + (this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth); + }) + .each(function () { + var t = $(this), o = t.offset(); + if(this.scrollHeight > this.offsetHeight) { + if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } + if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } + } + if(this.scrollWidth > this.offsetWidth) { + if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } + if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } + } + if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { + vakata_dnd.scroll_e = $(this); + return false; + } + }); + + if(!vakata_dnd.scroll_e) { + d = $(document); w = $(window); + dh = d.height(); wh = w.height(); + dw = d.width(); ww = w.width(); + dt = d.scrollTop(); dl = d.scrollLeft(); + if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; } + if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; } + if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; } + if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; } + if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) { + vakata_dnd.scroll_e = d; + } + } + if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); } + + if(vakata_dnd.helper) { + ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10); + hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10); + if(dh && ht + 25 > dh) { ht = dh - 50; } + if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); } + vakata_dnd.helper.css({ + left : hl + "px", + top : ht + "px" + }); + } + /** + * triggered on the document when a drag is in progress + * @event + * @plugin dnd + * @name dnd_move.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {Object} event the event that caused this to trigger (most likely mousemove) + */ + $.vakata.dnd._trigger("move", e); + return false; + }, + stop : function (e) { + if(e.type === "touchend" && e.originalEvent && e.originalEvent.changedTouches && e.originalEvent.changedTouches[0]) { + e.pageX = e.originalEvent.changedTouches[0].pageX; + e.pageY = e.originalEvent.changedTouches[0].pageY; + e.target = document.elementFromPoint(e.originalEvent.changedTouches[0].pageX - window.pageXOffset, e.originalEvent.changedTouches[0].pageY - window.pageYOffset); + } + if(vakata_dnd.is_drag) { + /** + * triggered on the document when a drag stops (the dragged element is dropped) + * @event + * @plugin dnd + * @name dnd_stop.vakata + * @param {Mixed} data any data supplied with the call to $.vakata.dnd.start + * @param {DOM} element the DOM element being dragged + * @param {jQuery} helper the helper shown next to the mouse + * @param {Object} event the event that caused the stop + */ + if (e.target !== vakata_dnd.target) { + $(vakata_dnd.target).off('click.vakata'); + } + $.vakata.dnd._trigger("stop", e); + } + else { + if(e.type === "touchend" && e.target === vakata_dnd.target) { + var to = setTimeout(function () { $(e.target).click(); }, 100); + $(e.target).one('click', function() { if(to) { clearTimeout(to); } }); + } + } + $.vakata.dnd._clean(); + return false; + } + }; + }($)); + + // include the dnd plugin by default + // $.jstree.defaults.plugins.push("dnd"); + + +/** + * ### Massload plugin + * + * Adds massload functionality to jsTree, so that multiple nodes can be loaded in a single request (only useful with lazy loading). + */ + + /** + * massload configuration + * + * It is possible to set this to a standard jQuery-like AJAX config. + * In addition to the standard jQuery ajax options here you can supply functions for `data` and `url`, the functions will be run in the current instance's scope and a param will be passed indicating which node IDs need to be loaded, the return value of those functions will be used. + * + * You can also set this to a function, that function will receive the node IDs being loaded as argument and a second param which is a function (callback) which should be called with the result. + * + * Both the AJAX and the function approach rely on the same return value - an object where the keys are the node IDs, and the value is the children of that node as an array. + * + * { + * "id1" : [{ "text" : "Child of ID1", "id" : "c1" }, { "text" : "Another child of ID1", "id" : "c2" }], + * "id2" : [{ "text" : "Child of ID2", "id" : "c3" }] + * } + * + * @name $.jstree.defaults.massload + * @plugin massload + */ + $.jstree.defaults.massload = null; + $.jstree.plugins.massload = function (options, parent) { + this.init = function (el, options) { + this._data.massload = {}; + parent.init.call(this, el, options); + }; + this._load_nodes = function (nodes, callback, is_callback, force_reload) { + var s = this.settings.massload, + nodesString = JSON.stringify(nodes), + toLoad = [], + m = this._model.data, + i, j, dom; + if (!is_callback) { + for(i = 0, j = nodes.length; i < j; i++) { + if(!m[nodes[i]] || ( (!m[nodes[i]].state.loaded && !m[nodes[i]].state.failed) || force_reload) ) { + toLoad.push(nodes[i]); + dom = this.get_node(nodes[i], true); + if (dom && dom.length) { + dom.addClass("jstree-loading").attr('aria-busy',true); + } + } + } + this._data.massload = {}; + if (toLoad.length) { + if($.isFunction(s)) { + return s.call(this, toLoad, $.proxy(function (data) { + var i, j; + if(data) { + for(i in data) { + if(data.hasOwnProperty(i)) { + this._data.massload[i] = data[i]; + } + } + } + for(i = 0, j = nodes.length; i < j; i++) { + dom = this.get_node(nodes[i], true); + if (dom && dom.length) { + dom.removeClass("jstree-loading").attr('aria-busy',false); + } + } + parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }, this)); + } + if(typeof s === 'object' && s && s.url) { + s = $.extend(true, {}, s); + if($.isFunction(s.url)) { + s.url = s.url.call(this, toLoad); + } + if($.isFunction(s.data)) { + s.data = s.data.call(this, toLoad); + } + return $.ajax(s) + .done($.proxy(function (data,t,x) { + var i, j; + if(data) { + for(i in data) { + if(data.hasOwnProperty(i)) { + this._data.massload[i] = data[i]; + } + } + } + for(i = 0, j = nodes.length; i < j; i++) { + dom = this.get_node(nodes[i], true); + if (dom && dom.length) { + dom.removeClass("jstree-loading").attr('aria-busy',false); + } + } + parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }, this)) + .fail($.proxy(function (f) { + parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }, this)); + } + } + } + return parent._load_nodes.call(this, nodes, callback, is_callback, force_reload); + }; + this._load_node = function (obj, callback) { + var data = this._data.massload[obj.id], + rslt = null, dom; + if(data) { + rslt = this[typeof data === 'string' ? '_append_html_data' : '_append_json_data']( + obj, + typeof data === 'string' ? $($.parseHTML(data)).filter(function () { return this.nodeType !== 3; }) : data, + function (status) { callback.call(this, status); } + ); + dom = this.get_node(obj.id, true); + if (dom && dom.length) { + dom.removeClass("jstree-loading").attr('aria-busy',false); + } + delete this._data.massload[obj.id]; + return rslt; + } + return parent._load_node.call(this, obj, callback); + }; + }; + +/** + * ### Search plugin + * + * Adds search functionality to jsTree. + */ + + /** + * stores all defaults for the search plugin + * @name $.jstree.defaults.search + * @plugin search + */ + $.jstree.defaults.search = { + /** + * a jQuery-like AJAX config, which jstree uses if a server should be queried for results. + * + * A `str` (which is the search string) parameter will be added with the request, an optional `inside` parameter will be added if the search is limited to a node id. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed. + * Leave this setting as `false` to not query the server. You can also set this to a function, which will be invoked in the instance's scope and receive 3 parameters - the search string, the callback to call with the array of nodes to load, and the optional node ID to limit the search to + * @name $.jstree.defaults.search.ajax + * @plugin search + */ + ajax : false, + /** + * Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `false`. + * @name $.jstree.defaults.search.fuzzy + * @plugin search + */ + fuzzy : false, + /** + * Indicates if the search should be case sensitive. Default is `false`. + * @name $.jstree.defaults.search.case_sensitive + * @plugin search + */ + case_sensitive : false, + /** + * Indicates if the tree should be filtered (by default) to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). + * This setting can be changed at runtime when calling the search method. Default is `false`. + * @name $.jstree.defaults.search.show_only_matches + * @plugin search + */ + show_only_matches : false, + /** + * Indicates if the children of matched element are shown (when show_only_matches is true) + * This setting can be changed at runtime when calling the search method. Default is `false`. + * @name $.jstree.defaults.search.show_only_matches_children + * @plugin search + */ + show_only_matches_children : false, + /** + * Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`. + * @name $.jstree.defaults.search.close_opened_onclear + * @plugin search + */ + close_opened_onclear : true, + /** + * Indicates if only leaf nodes should be included in search results. Default is `false`. + * @name $.jstree.defaults.search.search_leaves_only + * @plugin search + */ + search_leaves_only : false, + /** + * If set to a function it wil be called in the instance's scope with two arguments - search string and node (where node will be every node in the structure, so use with caution). + * If the function returns a truthy value the node will be considered a match (it might not be displayed if search_only_leaves is set to true and the node is not a leaf). Default is `false`. + * @name $.jstree.defaults.search.search_callback + * @plugin search + */ + search_callback : false + }; + + $.jstree.plugins.search = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + + this._data.search.str = ""; + this._data.search.dom = $(); + this._data.search.res = []; + this._data.search.opn = []; + this._data.search.som = false; + this._data.search.smc = false; + this._data.search.hdn = []; + + this.element + .on("search.jstree", $.proxy(function (e, data) { + if(this._data.search.som && data.res.length) { + var m = this._model.data, i, j, p = [], k, l; + for(i = 0, j = data.res.length; i < j; i++) { + if(m[data.res[i]] && !m[data.res[i]].state.hidden) { + p.push(data.res[i]); + p = p.concat(m[data.res[i]].parents); + if(this._data.search.smc) { + for (k = 0, l = m[data.res[i]].children_d.length; k < l; k++) { + if (m[m[data.res[i]].children_d[k]] && !m[m[data.res[i]].children_d[k]].state.hidden) { + p.push(m[data.res[i]].children_d[k]); + } + } + } + } + } + p = $.vakata.array_remove_item($.vakata.array_unique(p), $.jstree.root); + this._data.search.hdn = this.hide_all(true); + this.show_node(p, true); + this.redraw(true); + } + }, this)) + .on("clear_search.jstree", $.proxy(function (e, data) { + if(this._data.search.som && data.res.length) { + this.show_node(this._data.search.hdn, true); + this.redraw(true); + } + }, this)); + }; + /** + * used to search the tree nodes for a given string + * @name search(str [, skip_async]) + * @param {String} str the search string + * @param {Boolean} skip_async if set to true server will not be queried even if configured + * @param {Boolean} show_only_matches if set to true only matching nodes will be shown (keep in mind this can be very slow on large trees or old browsers) + * @param {mixed} inside an optional node to whose children to limit the search + * @param {Boolean} append if set to true the results of this search are appended to the previous search + * @plugin search + * @trigger search.jstree + */ + this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) { + if(str === false || $.trim(str.toString()) === "") { + return this.clear_search(); + } + inside = this.get_node(inside); + inside = inside && inside.id ? inside.id : null; + str = str.toString(); + var s = this.settings.search, + a = s.ajax ? s.ajax : false, + m = this._model.data, + f = null, + r = [], + p = [], i, j; + if(this._data.search.res.length && !append) { + this.clear_search(); + } + if(show_only_matches === undefined) { + show_only_matches = s.show_only_matches; + } + if(show_only_matches_children === undefined) { + show_only_matches_children = s.show_only_matches_children; + } + if(!skip_async && a !== false) { + if($.isFunction(a)) { + return a.call(this, str, $.proxy(function (d) { + if(d && d.d) { d = d.d; } + this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { + this.search(str, true, show_only_matches, inside, append, show_only_matches_children); + }); + }, this), inside); + } + else { + a = $.extend({}, a); + if(!a.data) { a.data = {}; } + a.data.str = str; + if(inside) { + a.data.inside = inside; + } + if (this._data.search.lastRequest) { + this._data.search.lastRequest.abort(); + } + this._data.search.lastRequest = $.ajax(a) + .fail($.proxy(function () { + this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) }; + this.settings.core.error.call(this, this._data.core.last_error); + }, this)) + .done($.proxy(function (d) { + if(d && d.d) { d = d.d; } + this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () { + this.search(str, true, show_only_matches, inside, append, show_only_matches_children); + }); + }, this)); + return this._data.search.lastRequest; + } + } + if(!append) { + this._data.search.str = str; + this._data.search.dom = $(); + this._data.search.res = []; + this._data.search.opn = []; + this._data.search.som = show_only_matches; + this._data.search.smc = show_only_matches_children; + } + + f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy }); + $.each(m[inside ? inside : $.jstree.root].children_d, function (ii, i) { + var v = m[i]; + if(v.text && !v.state.hidden && (!s.search_leaves_only || (v.state.loaded && v.children.length === 0)) && ( (s.search_callback && s.search_callback.call(this, str, v)) || (!s.search_callback && f.search(v.text).isMatch) ) ) { + r.push(i); + p = p.concat(v.parents); + } + }); + if(r.length) { + p = $.vakata.array_unique(p); + for(i = 0, j = p.length; i < j; i++) { + if(p[i] !== $.jstree.root && m[p[i]] && this.open_node(p[i], null, 0) === true) { + this._data.search.opn.push(p[i]); + } + } + if(!append) { + this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))); + this._data.search.res = r; + } + else { + this._data.search.dom = this._data.search.dom.add($(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')))); + this._data.search.res = $.vakata.array_unique(this._data.search.res.concat(r)); + } + this._data.search.dom.children(".jstree-anchor").addClass('jstree-search'); + } + /** + * triggered after search is complete + * @event + * @name search.jstree + * @param {jQuery} nodes a jQuery collection of matching nodes + * @param {String} str the search string + * @param {Array} res a collection of objects represeing the matching nodes + * @plugin search + */ + this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res, show_only_matches : show_only_matches }); + }; + /** + * used to clear the last search (removes classes and shows all nodes if filtering is on) + * @name clear_search() + * @plugin search + * @trigger clear_search.jstree + */ + this.clear_search = function () { + if(this.settings.search.close_opened_onclear) { + this.close_node(this._data.search.opn, 0); + } + /** + * triggered after search is complete + * @event + * @name clear_search.jstree + * @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search) + * @param {String} str the search string (the last search string) + * @param {Array} res a collection of objects represeing the matching nodes (the result from the last search) + * @plugin search + */ + this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res }); + if(this._data.search.res.length) { + this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(this._data.search.res, function (v) { + return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); + }).join(', #'))); + this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search"); + } + this._data.search.str = ""; + this._data.search.res = []; + this._data.search.opn = []; + this._data.search.dom = $(); + }; + + this.redraw_node = function(obj, deep, callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if(obj) { + if($.inArray(obj.id, this._data.search.res) !== -1) { + var i, j, tmp = null; + for(i = 0, j = obj.childNodes.length; i < j; i++) { + if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) { + tmp = obj.childNodes[i]; + break; + } + } + if(tmp) { + tmp.className += ' jstree-search'; + } + } + } + return obj; + }; + }; + + // helpers + (function ($) { + // from http://kiro.me/projects/fuse.html + $.vakata.search = function(pattern, txt, options) { + options = options || {}; + options = $.extend({}, $.vakata.search.defaults, options); + if(options.fuzzy !== false) { + options.fuzzy = true; + } + pattern = options.caseSensitive ? pattern : pattern.toLowerCase(); + var MATCH_LOCATION = options.location, + MATCH_DISTANCE = options.distance, + MATCH_THRESHOLD = options.threshold, + patternLen = pattern.length, + matchmask, pattern_alphabet, match_bitapScore, search; + if(patternLen > 32) { + options.fuzzy = false; + } + if(options.fuzzy) { + matchmask = 1 << (patternLen - 1); + pattern_alphabet = (function () { + var mask = {}, + i = 0; + for (i = 0; i < patternLen; i++) { + mask[pattern.charAt(i)] = 0; + } + for (i = 0; i < patternLen; i++) { + mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1); + } + return mask; + }()); + match_bitapScore = function (e, x) { + var accuracy = e / patternLen, + proximity = Math.abs(MATCH_LOCATION - x); + if(!MATCH_DISTANCE) { + return proximity ? 1.0 : accuracy; + } + return accuracy + (proximity / MATCH_DISTANCE); + }; + } + search = function (text) { + text = options.caseSensitive ? text : text.toLowerCase(); + if(pattern === text || text.indexOf(pattern) !== -1) { + return { + isMatch: true, + score: 0 + }; + } + if(!options.fuzzy) { + return { + isMatch: false, + score: 1 + }; + } + var i, j, + textLen = text.length, + scoreThreshold = MATCH_THRESHOLD, + bestLoc = text.indexOf(pattern, MATCH_LOCATION), + binMin, binMid, + binMax = patternLen + textLen, + lastRd, start, finish, rd, charMatch, + score = 1, + locations = []; + if (bestLoc !== -1) { + scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); + bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen); + if (bestLoc !== -1) { + scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold); + } + } + bestLoc = -1; + for (i = 0; i < patternLen; i++) { + binMin = 0; + binMid = binMax; + while (binMin < binMid) { + if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) { + binMin = binMid; + } else { + binMax = binMid; + } + binMid = Math.floor((binMax - binMin) / 2 + binMin); + } + binMax = binMid; + start = Math.max(1, MATCH_LOCATION - binMid + 1); + finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen; + rd = new Array(finish + 2); + rd[finish + 1] = (1 << i) - 1; + for (j = finish; j >= start; j--) { + charMatch = pattern_alphabet[text.charAt(j - 1)]; + if (i === 0) { + rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; + } else { + rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1]; + } + if (rd[j] & matchmask) { + score = match_bitapScore(i, j - 1); + if (score <= scoreThreshold) { + scoreThreshold = score; + bestLoc = j - 1; + locations.push(bestLoc); + if (bestLoc > MATCH_LOCATION) { + start = Math.max(1, 2 * MATCH_LOCATION - bestLoc); + } else { + break; + } + } + } + } + if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) { + break; + } + lastRd = rd; + } + return { + isMatch: bestLoc >= 0, + score: score + }; + }; + return txt === true ? { 'search' : search } : search(txt); + }; + $.vakata.search.defaults = { + location : 0, + distance : 100, + threshold : 0.6, + fuzzy : false, + caseSensitive : false + }; + }($)); + + // include the search plugin by default + // $.jstree.defaults.plugins.push("search"); + + +/** + * ### Sort plugin + * + * Automatically sorts all siblings in the tree according to a sorting function. + */ + + /** + * the settings function used to sort the nodes. + * It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`. + * @name $.jstree.defaults.sort + * @plugin sort + */ + $.jstree.defaults.sort = function (a, b) { + //return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b); + return this.get_text(a) > this.get_text(b) ? 1 : -1; + }; + $.jstree.plugins.sort = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + this.element + .on("model.jstree", $.proxy(function (e, data) { + this.sort(data.parent, true); + }, this)) + .on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) { + this.sort(data.parent || data.node.parent, false); + this.redraw_node(data.parent || data.node.parent, true); + }, this)) + .on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) { + this.sort(data.parent, false); + this.redraw_node(data.parent, true); + }, this)); + }; + /** + * used to sort a node's children + * @private + * @name sort(obj [, deep]) + * @param {mixed} obj the node + * @param {Boolean} deep if set to `true` nodes are sorted recursively. + * @plugin sort + * @trigger search.jstree + */ + this.sort = function (obj, deep) { + var i, j; + obj = this.get_node(obj); + if(obj && obj.children && obj.children.length) { + obj.children.sort($.proxy(this.settings.sort, this)); + if(deep) { + for(i = 0, j = obj.children_d.length; i < j; i++) { + this.sort(obj.children_d[i], false); + } + } + } + }; + }; + + // include the sort plugin by default + // $.jstree.defaults.plugins.push("sort"); + +/** + * ### State plugin + * + * Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc) + */ + + var to = false; + /** + * stores all defaults for the state plugin + * @name $.jstree.defaults.state + * @plugin state + */ + $.jstree.defaults.state = { + /** + * A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`. + * @name $.jstree.defaults.state.key + * @plugin state + */ + key : 'jstree', + /** + * A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`. + * @name $.jstree.defaults.state.events + * @plugin state + */ + events : 'changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree', + /** + * Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire. + * @name $.jstree.defaults.state.ttl + * @plugin state + */ + ttl : false, + /** + * A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state. + * @name $.jstree.defaults.state.filter + * @plugin state + */ + filter : false, + /** + * Should loaded nodes be restored (setting this to true means that it is possible that the whole tree will be loaded for some users - use with caution). Defaults to `false` + * @name $.jstree.defaults.state.preserve_loaded + * @plugin state + */ + preserve_loaded : false + }; + $.jstree.plugins.state = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + var bind = $.proxy(function () { + this.element.on(this.settings.state.events, $.proxy(function () { + if(to) { clearTimeout(to); } + to = setTimeout($.proxy(function () { this.save_state(); }, this), 100); + }, this)); + /** + * triggered when the state plugin is finished restoring the state (and immediately after ready if there is no state to restore). + * @event + * @name state_ready.jstree + * @plugin state + */ + this.trigger('state_ready'); + }, this); + this.element + .on("ready.jstree", $.proxy(function (e, data) { + this.element.one("restore_state.jstree", bind); + if(!this.restore_state()) { bind(); } + }, this)); + }; + /** + * save the state + * @name save_state() + * @plugin state + */ + this.save_state = function () { + var tm = this.get_state(); + if (!this.settings.state.preserve_loaded) { + delete tm.core.loaded; + } + var st = { 'state' : tm, 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) }; + $.vakata.storage.set(this.settings.state.key, JSON.stringify(st)); + }; + /** + * restore the state from the user's computer + * @name restore_state() + * @plugin state + */ + this.restore_state = function () { + var k = $.vakata.storage.get(this.settings.state.key); + if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } } + if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; } + if(!!k && k.state) { k = k.state; } + if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); } + if(!!k) { + if (!this.settings.state.preserve_loaded) { + delete k.core.loaded; + } + this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); }); + this.set_state(k); + return true; + } + return false; + }; + /** + * clear the state on the user's computer + * @name clear_state() + * @plugin state + */ + this.clear_state = function () { + return $.vakata.storage.del(this.settings.state.key); + }; + }; + + (function ($, undefined) { + $.vakata.storage = { + // simply specifying the functions in FF throws an error + set : function (key, val) { return window.localStorage.setItem(key, val); }, + get : function (key) { return window.localStorage.getItem(key); }, + del : function (key) { return window.localStorage.removeItem(key); } + }; + }($)); + + // include the state plugin by default + // $.jstree.defaults.plugins.push("state"); + +/** + * ### Types plugin + * + * Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group. + */ + + /** + * An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional). + * + * * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited. + * * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited. + * * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits. + * * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme. + * * `li_attr` an object of values which will be used to add HTML attributes on the resulting LI DOM node (merged with the node's own data) + * * `a_attr` an object of values which will be used to add HTML attributes on the resulting A DOM node (merged with the node's own data) + * + * There are two predefined types: + * + * * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes. + * * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified. + * + * @name $.jstree.defaults.types + * @plugin types + */ + $.jstree.defaults.types = { + 'default' : {} + }; + $.jstree.defaults.types[$.jstree.root] = {}; + + $.jstree.plugins.types = function (options, parent) { + this.init = function (el, options) { + var i, j; + if(options && options.types && options.types['default']) { + for(i in options.types) { + if(i !== "default" && i !== $.jstree.root && options.types.hasOwnProperty(i)) { + for(j in options.types['default']) { + if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) { + options.types[i][j] = options.types['default'][j]; + } + } + } + } + } + parent.init.call(this, el, options); + this._model.data[$.jstree.root].type = $.jstree.root; + }; + this.refresh = function (skip_loading, forget_state) { + parent.refresh.call(this, skip_loading, forget_state); + this._model.data[$.jstree.root].type = $.jstree.root; + }; + this.bind = function () { + this.element + .on('model.jstree', $.proxy(function (e, data) { + var m = this._model.data, + dpc = data.nodes, + t = this.settings.types, + i, j, c = 'default', k; + for(i = 0, j = dpc.length; i < j; i++) { + c = 'default'; + if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) { + c = m[dpc[i]].original.type; + } + if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) { + c = m[dpc[i]].data.jstree.type; + } + m[dpc[i]].type = c; + if(m[dpc[i]].icon === true && t[c].icon !== undefined) { + m[dpc[i]].icon = t[c].icon; + } + if(t[c].li_attr !== undefined && typeof t[c].li_attr === 'object') { + for (k in t[c].li_attr) { + if (t[c].li_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[dpc[i]].li_attr[k] === undefined) { + m[dpc[i]].li_attr[k] = t[c].li_attr[k]; + } + else if (k === 'class') { + m[dpc[i]].li_attr['class'] = t[c].li_attr['class'] + ' ' + m[dpc[i]].li_attr['class']; + } + } + } + } + if(t[c].a_attr !== undefined && typeof t[c].a_attr === 'object') { + for (k in t[c].a_attr) { + if (t[c].a_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[dpc[i]].a_attr[k] === undefined) { + m[dpc[i]].a_attr[k] = t[c].a_attr[k]; + } + else if (k === 'href' && m[dpc[i]].a_attr[k] === '#') { + m[dpc[i]].a_attr['href'] = t[c].a_attr['href']; + } + else if (k === 'class') { + m[dpc[i]].a_attr['class'] = t[c].a_attr['class'] + ' ' + m[dpc[i]].a_attr['class']; + } + } + } + } + } + m[$.jstree.root].type = $.jstree.root; + }, this)); + parent.bind.call(this); + }; + this.get_json = function (obj, options, flat) { + var i, j, + m = this._model.data, + opt = options ? $.extend(true, {}, options, {no_id:false}) : {}, + tmp = parent.get_json.call(this, obj, opt, flat); + if(tmp === false) { return false; } + if($.isArray(tmp)) { + for(i = 0, j = tmp.length; i < j; i++) { + tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default"; + if(options && options.no_id) { + delete tmp[i].id; + if(tmp[i].li_attr && tmp[i].li_attr.id) { + delete tmp[i].li_attr.id; + } + if(tmp[i].a_attr && tmp[i].a_attr.id) { + delete tmp[i].a_attr.id; + } + } + } + } + else { + tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default"; + if(options && options.no_id) { + tmp = this._delete_ids(tmp); + } + } + return tmp; + }; + this._delete_ids = function (tmp) { + if($.isArray(tmp)) { + for(var i = 0, j = tmp.length; i < j; i++) { + tmp[i] = this._delete_ids(tmp[i]); + } + return tmp; + } + delete tmp.id; + if(tmp.li_attr && tmp.li_attr.id) { + delete tmp.li_attr.id; + } + if(tmp.a_attr && tmp.a_attr.id) { + delete tmp.a_attr.id; + } + if(tmp.children && $.isArray(tmp.children)) { + tmp.children = this._delete_ids(tmp.children); + } + return tmp; + }; + this.check = function (chk, obj, par, pos, more) { + if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } + obj = obj && obj.id ? obj : this.get_node(obj); + par = par && par.id ? par : this.get_node(par); + var m = obj && obj.id ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j; + m = m && m._model && m._model.data ? m._model.data : null; + switch(chk) { + case "create_node": + case "move_node": + case "copy_node": + if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) { + tmp = this.get_rules(par); + if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), tmp.valid_children) === -1) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + if(m && obj.children_d && obj.parents) { + d = 0; + for(i = 0, j = obj.children_d.length; i < j; i++) { + d = Math.max(d, m[obj.children_d[i]].parents.length); + } + d = d - obj.parents.length + 1; + } + if(d <= 0 || d === undefined) { d = 1; } + do { + if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + return false; + } + par = this.get_node(par.parent); + tmp = this.get_rules(par); + d++; + } while(par); + } + break; + } + return true; + }; + /** + * used to retrieve the type settings object for a node + * @name get_rules(obj) + * @param {mixed} obj the node to find the rules for + * @return {Object} + * @plugin types + */ + this.get_rules = function (obj) { + obj = this.get_node(obj); + if(!obj) { return false; } + var tmp = this.get_type(obj, true); + if(tmp.max_depth === undefined) { tmp.max_depth = -1; } + if(tmp.max_children === undefined) { tmp.max_children = -1; } + if(tmp.valid_children === undefined) { tmp.valid_children = -1; } + return tmp; + }; + /** + * used to retrieve the type string or settings object for a node + * @name get_type(obj [, rules]) + * @param {mixed} obj the node to find the rules for + * @param {Boolean} rules if set to `true` instead of a string the settings object will be returned + * @return {String|Object} + * @plugin types + */ + this.get_type = function (obj, rules) { + obj = this.get_node(obj); + return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type); + }; + /** + * used to change a node's type + * @name set_type(obj, type) + * @param {mixed} obj the node to change + * @param {String} type the new type + * @plugin types + */ + this.set_type = function (obj, type) { + var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a; + if($.isArray(obj)) { + obj = obj.slice(); + for(t1 = 0, t2 = obj.length; t1 < t2; t1++) { + this.set_type(obj[t1], type); + } + return true; + } + t = this.settings.types; + obj = this.get_node(obj); + if(!t[type] || !obj) { return false; } + d = this.get_node(obj, true); + if (d && d.length) { + a = d.children('.jstree-anchor'); + } + old_type = obj.type; + old_icon = this.get_icon(obj); + obj.type = type; + if(old_icon === true || !t[old_type] || (t[old_type].icon !== undefined && old_icon === t[old_type].icon)) { + this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true); + } + + // remove old type props + if(t[old_type] && t[old_type].li_attr !== undefined && typeof t[old_type].li_attr === 'object') { + for (k in t[old_type].li_attr) { + if (t[old_type].li_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (k === 'class') { + m[obj.id].li_attr['class'] = (m[obj.id].li_attr['class'] || '').replace(t[old_type].li_attr[k], ''); + if (d) { d.removeClass(t[old_type].li_attr[k]); } + } + else if (m[obj.id].li_attr[k] === t[old_type].li_attr[k]) { + m[obj.id].li_attr[k] = null; + if (d) { d.removeAttr(k); } + } + } + } + } + if(t[old_type] && t[old_type].a_attr !== undefined && typeof t[old_type].a_attr === 'object') { + for (k in t[old_type].a_attr) { + if (t[old_type].a_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (k === 'class') { + m[obj.id].a_attr['class'] = (m[obj.id].a_attr['class'] || '').replace(t[old_type].a_attr[k], ''); + if (a) { a.removeClass(t[old_type].a_attr[k]); } + } + else if (m[obj.id].a_attr[k] === t[old_type].a_attr[k]) { + if (k === 'href') { + m[obj.id].a_attr[k] = '#'; + if (a) { a.attr('href', '#'); } + } + else { + delete m[obj.id].a_attr[k]; + if (a) { a.removeAttr(k); } + } + } + } + } + } + + // add new props + if(t[type].li_attr !== undefined && typeof t[type].li_attr === 'object') { + for (k in t[type].li_attr) { + if (t[type].li_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[obj.id].li_attr[k] === undefined) { + m[obj.id].li_attr[k] = t[type].li_attr[k]; + if (d) { + if (k === 'class') { + d.addClass(t[type].li_attr[k]); + } + else { + d.attr(k, t[type].li_attr[k]); + } + } + } + else if (k === 'class') { + m[obj.id].li_attr['class'] = t[type].li_attr[k] + ' ' + m[obj.id].li_attr['class']; + if (d) { d.addClass(t[type].li_attr[k]); } + } + } + } + } + if(t[type].a_attr !== undefined && typeof t[type].a_attr === 'object') { + for (k in t[type].a_attr) { + if (t[type].a_attr.hasOwnProperty(k)) { + if (k === 'id') { + continue; + } + else if (m[obj.id].a_attr[k] === undefined) { + m[obj.id].a_attr[k] = t[type].a_attr[k]; + if (a) { + if (k === 'class') { + a.addClass(t[type].a_attr[k]); + } + else { + a.attr(k, t[type].a_attr[k]); + } + } + } + else if (k === 'href' && m[obj.id].a_attr[k] === '#') { + m[obj.id].a_attr['href'] = t[type].a_attr['href']; + if (a) { a.attr('href', t[type].a_attr['href']); } + } + else if (k === 'class') { + m[obj.id].a_attr['class'] = t[type].a_attr['class'] + ' ' + m[obj.id].a_attr['class']; + if (a) { a.addClass(t[type].a_attr[k]); } + } + } + } + } + + return true; + }; + }; + // include the types plugin by default + // $.jstree.defaults.plugins.push("types"); + + +/** + * ### Unique plugin + * + * Enforces that no nodes with the same name can coexist as siblings. + */ + + /** + * stores all defaults for the unique plugin + * @name $.jstree.defaults.unique + * @plugin unique + */ + $.jstree.defaults.unique = { + /** + * Indicates if the comparison should be case sensitive. Default is `false`. + * @name $.jstree.defaults.unique.case_sensitive + * @plugin unique + */ + case_sensitive : false, + /** + * Indicates if white space should be trimmed before the comparison. Default is `false`. + * @name $.jstree.defaults.unique.trim_whitespace + * @plugin unique + */ + trim_whitespace : false, + /** + * A callback executed in the instance's scope when a new node is created and the name is already taken, the two arguments are the conflicting name and the counter. The default will produce results like `New node (2)`. + * @name $.jstree.defaults.unique.duplicate + * @plugin unique + */ + duplicate : function (name, counter) { + return name + ' (' + counter + ')'; + } + }; + + $.jstree.plugins.unique = function (options, parent) { + this.check = function (chk, obj, par, pos, more) { + if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; } + obj = obj && obj.id ? obj : this.get_node(obj); + par = par && par.id ? par : this.get_node(par); + if(!par || !par.children) { return true; } + var n = chk === "rename_node" ? pos : obj.text, + c = [], + s = this.settings.unique.case_sensitive, + w = this.settings.unique.trim_whitespace, + m = this._model.data, i, j, t; + for(i = 0, j = par.children.length; i < j; i++) { + t = m[par.children[i]].text; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + c.push(t); + } + if(!s) { n = n.toLowerCase(); } + if (w) { n = n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } + switch(chk) { + case "delete_node": + return true; + case "rename_node": + t = obj.text || ''; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + i = ($.inArray(n, c) === -1 || (obj.text && t === n)); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + case "create_node": + i = ($.inArray(n, c) === -1); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + case "copy_node": + i = ($.inArray(n, c) === -1); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + case "move_node": + i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1); + if(!i) { + this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) }; + } + return i; + } + return true; + }; + this.create_node = function (par, node, pos, callback, is_loaded) { + if(!node || node.text === undefined) { + if(par === null) { + par = $.jstree.root; + } + par = this.get_node(par); + if(!par) { + return parent.create_node.call(this, par, node, pos, callback, is_loaded); + } + pos = pos === undefined ? "last" : pos; + if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) { + return parent.create_node.call(this, par, node, pos, callback, is_loaded); + } + if(!node) { node = {}; } + var tmp, n, dpc, i, j, m = this._model.data, s = this.settings.unique.case_sensitive, w = this.settings.unique.trim_whitespace, cb = this.settings.unique.duplicate, t; + n = tmp = this.get_string('New node'); + dpc = []; + for(i = 0, j = par.children.length; i < j; i++) { + t = m[par.children[i]].text; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + dpc.push(t); + } + i = 1; + t = n; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + while($.inArray(t, dpc) !== -1) { + n = cb.call(this, tmp, (++i)).toString(); + t = n; + if (!s) { + t = t.toLowerCase(); + } + if (w) { + t = t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + } + } + node.text = n; + } + return parent.create_node.call(this, par, node, pos, callback, is_loaded); + }; + }; + + // include the unique plugin by default + // $.jstree.defaults.plugins.push("unique"); + + +/** + * ### Wholerow plugin + * + * Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers. + */ + + var div = document.createElement('DIV'); + div.setAttribute('unselectable','on'); + div.setAttribute('role','presentation'); + div.className = 'jstree-wholerow'; + div.innerHTML = ' '; + $.jstree.plugins.wholerow = function (options, parent) { + this.bind = function () { + parent.bind.call(this); + + this.element + .on('ready.jstree set_state.jstree', $.proxy(function () { + this.hide_dots(); + }, this)) + .on("init.jstree loading.jstree ready.jstree", $.proxy(function () { + //div.style.height = this._data.core.li_height + 'px'; + this.get_container_ul().addClass('jstree-wholerow-ul'); + }, this)) + .on("deselect_all.jstree", $.proxy(function (e, data) { + this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); + }, this)) + .on("changed.jstree", $.proxy(function (e, data) { + this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked'); + var tmp = false, i, j; + for(i = 0, j = data.selected.length; i < j; i++) { + tmp = this.get_node(data.selected[i], true); + if(tmp && tmp.length) { + tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); + } + } + }, this)) + .on("open_node.jstree", $.proxy(function (e, data) { + this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked'); + }, this)) + .on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) { + if(e.type === "hover_node" && this.is_disabled(data.node)) { return; } + this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered'); + }, this)) + .on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) { + if (this._data.contextmenu) { + e.preventDefault(); + var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp); + } + }, this)) + /*! + .on("mousedown.jstree touchstart.jstree", ".jstree-wholerow", function (e) { + if(e.target === e.currentTarget) { + var a = $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor"); + e.target = a[0]; + a.trigger(e); + } + }) + */ + .on("click.jstree", ".jstree-wholerow", function (e) { + e.stopImmediatePropagation(); + var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); + }) + .on("dblclick.jstree", ".jstree-wholerow", function (e) { + e.stopImmediatePropagation(); + var tmp = $.Event('dblclick', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); + }) + .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) { + e.stopImmediatePropagation(); + var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey }); + $(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(tmp).focus(); + }, this)) + .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) { + e.stopImmediatePropagation(); + if(!this.is_disabled(e.currentTarget)) { + this.hover_node(e.currentTarget); + } + return false; + }, this)) + .on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) { + this.dehover_node(e.currentTarget); + }, this)); + }; + this.teardown = function () { + if(this.settings.wholerow) { + this.element.find(".jstree-wholerow").remove(); + } + parent.teardown.call(this); + }; + this.redraw_node = function(obj, deep, callback, force_render) { + obj = parent.redraw_node.apply(this, arguments); + if(obj) { + var tmp = div.cloneNode(true); + //tmp.style.height = this._data.core.li_height + 'px'; + if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; } + if(this._data.core.focused && this._data.core.focused === obj.id) { tmp.className += ' jstree-wholerow-hovered'; } + obj.insertBefore(tmp, obj.childNodes[0]); + } + return obj; + }; + }; + // include the wholerow plugin by default + // $.jstree.defaults.plugins.push("wholerow"); + if(window.customElements && Object && Object.create) { + var proto = Object.create(HTMLElement.prototype); + proto.createdCallback = function () { + var c = { core : {}, plugins : [] }, i; + for(i in $.jstree.plugins) { + if($.jstree.plugins.hasOwnProperty(i) && this.attributes[i]) { + c.plugins.push(i); + if(this.getAttribute(i) && JSON.parse(this.getAttribute(i))) { + c[i] = JSON.parse(this.getAttribute(i)); + } + } + } + for(i in $.jstree.defaults.core) { + if($.jstree.defaults.core.hasOwnProperty(i) && this.attributes[i]) { + c.core[i] = JSON.parse(this.getAttribute(i)) || this.getAttribute(i); + } + } + $(this).jstree(c); + }; + // proto.attributeChangedCallback = function (name, previous, value) { }; + try { + window.customElements.define("vakata-jstree", function() {}, { prototype: proto }); + } catch (ignore) { } + } + +})); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/jstree.min.js b/wp-content/plugins/compressx/includes/display/js/jstree/dist/jstree.min.js new file mode 100644 index 0000000..9221c33 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/jstree/dist/jstree.min.js @@ -0,0 +1,6 @@ +/*! jsTree - v3.3.7 - 2018-11-06 - (MIT) */ +!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document;a.jstree={version:"3.3.7",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},a.jstree.create=function(b,d){var e=new a.jstree.core(++c),f=d;return d=a.extend(!0,{},a.jstree.defaults,d),f&&f.plugins&&(d.plugins=f.plugins),a.each(d.plugins,function(a,b){"core"!==a&&(e=e.plugin(b,d[b]))}),a(b).data("jstree",e),e.init(b,d),e},a.jstree.destroy=function(){a(".jstree:jstree").jstree("destroy"),a(i).off(".jstree")},a.jstree.core=function(a){this._id=a,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},a.jstree.reference=function(b){var c=null,d=null;if(!b||!b.id||b.tagName&&b.nodeType||(b=b.id),!d||!d.length)try{d=a(b)}catch(e){}if(!d||!d.length)try{d=a("#"+b.replace(a.jstree.idregex,"\\$&"))}catch(e){}return d&&d.length&&(d=d.closest(".jstree")).length&&(d=d.data("jstree"))?c=d:a(".jstree").each(function(){var d=a(this).data("jstree");return d&&d._model.data[b]?(c=d,!1):void 0}),c},a.fn.jstree=function(c){var d="string"==typeof c,e=Array.prototype.slice.call(arguments,1),f=null;return c!==!0||this.length?(this.each(function(){var g=a.jstree.reference(this),h=d&&g?g[c]:null;return f=d&&h?h.apply(g,e):null,g||d||c!==b&&!a.isPlainObject(c)||a.jstree.create(this,c),(g&&!d||c===!0)&&(f=g||!1),null!==f&&f!==b?!1:void 0}),null!==f&&f!==b?f:this):!1},a.expr.pseudos.jstree=a.expr.createPseudo(function(c){return function(c){return a(c).hasClass("jstree")&&a(c).data("jstree")!==b}}),a.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:a.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(b){b.type="click",a(b.currentTarget).trigger(b)},enter:function(b){b.type="click",a(b.currentTarget).trigger(b)},left:function(b){if(b.preventDefault(),this.is_open(b.currentTarget))this.close_node(b.currentTarget);else{var c=this.get_parent(b.currentTarget);c&&c.id!==a.jstree.root&&this.get_node(c,!0).children(".jstree-anchor").focus()}},up:function(a){a.preventDefault();var b=this.get_prev_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},right:function(b){if(b.preventDefault(),this.is_closed(b.currentTarget))this.open_node(b.currentTarget,function(a){this.get_node(a,!0).children(".jstree-anchor").focus()});else if(this.is_open(b.currentTarget)){var c=this.get_node(b.currentTarget,!0).children(".jstree-children")[0];c&&a(this._firstChild(c)).children(".jstree-anchor").focus()}},down:function(a){a.preventDefault();var b=this.get_next_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},"*":function(a){this.open_all()},home:function(b){b.preventDefault();var c=this._firstChild(this.get_container_ul()[0]);c&&a(c).children(".jstree-anchor").filter(":visible").focus()},end:function(a){a.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(a){a.preventDefault(),this.edit(a.currentTarget)}}},a.jstree.core.prototype={plugin:function(b,c){var d=a.jstree.plugins[b];return d?(this._data[b]={},d.prototype=this,new d(c,this)):this},init:function(b,c){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=a(b).addClass("jstree jstree-"+this._id),this.settings=c,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(a.jstree.root)},destroy:function(a){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(b){}a||this.element.empty(),this.teardown()},_create_prototype_node:function(){var a=i.createElement("LI"),b,c;return a.setAttribute("role","treeitem"),b=i.createElement("I"),b.className="jstree-icon jstree-ocl",b.setAttribute("role","presentation"),a.appendChild(b),b=i.createElement("A"),b.className="jstree-anchor",b.setAttribute("href","#"),b.setAttribute("tabindex","-1"),c=i.createElement("I"),c.className="jstree-icon jstree-themeicon",c.setAttribute("role","presentation"),b.appendChild(c),a.appendChild(b),b=c=null,a},_kbevent_to_func:function(a){var b={8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},c=[];a.ctrlKey&&c.push("ctrl"),a.altKey&&c.push("alt"),a.shiftKey&&c.push("shift"),c.push(b[a.which]||a.which),c=c.sort().join("-").toLowerCase();var d=this.settings.core.keyboard,e,f;for(e in d)if(d.hasOwnProperty(e)&&(f=e,"-"!==f&&"+"!==f&&(f=f.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS"),f=f.split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),f===c))return d[e];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var b="",c=null,d=0;this.element.on("dblclick.jstree",function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;if(i.selection&&i.selection.empty)i.selection.empty();else if(window.getSelection){var b=window.getSelection();try{b.removeAllRanges(),b.collapse()}catch(c){}}}).on("mousedown.jstree",a.proxy(function(a){a.target===this.element[0]&&(a.preventDefault(),d=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(a){a.preventDefault()}).on("click.jstree",".jstree-ocl",a.proxy(function(a){this.toggle_node(a.target)},this)).on("dblclick.jstree",".jstree-anchor",a.proxy(function(a){return a.target.tagName&&"input"===a.target.tagName.toLowerCase()?!0:void(this.settings.core.dblclick_toggle&&this.toggle_node(a.target))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(b){b.preventDefault(),b.currentTarget!==i.activeElement&&a(b.currentTarget).focus(),this.activate_node(b.currentTarget,b)},this)).on("keydown.jstree",".jstree-anchor",a.proxy(function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===a.which?a.which=39:39===a.which&&(a.which=37));var b=this._kbevent_to_func(a);if(b){var c=b.call(this,a);if(c===!1||c===!0)return c}},this)).on("load_node.jstree",a.proxy(function(b,c){c.status&&(c.node.id!==a.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(a.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var b=[],c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)b=b.concat(this._model.data[this._data.core.selected[c]].parents);for(b=a.vakata.array_unique(b),c=0,d=b.length;d>c;c++)this.open_node(b[c],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",a.proxy(function(d){if(d.target.tagName&&"input"===d.target.tagName.toLowerCase())return!0;c&&clearTimeout(c),c=setTimeout(function(){b=""},500);var e=String.fromCharCode(d.which).toLowerCase(),f=this.element.find(".jstree-anchor").filter(":visible"),g=f.index(i.activeElement)||0,h=!1;if(b+=e,b.length>1){if(f.slice(g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return}if(new RegExp("^"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(b)){if(f.slice(g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return}},this)).on("init.jstree",a.proxy(function(){var a=this.settings.core.themes;this._data.core.themes.dots=a.dots,this._data.core.themes.stripes=a.stripes,this._data.core.themes.icons=a.icons,this._data.core.themes.ellipsis=a.ellipsis,this.set_theme(a.name||"default",a.url),this.set_theme_variant(a.variant)},this)).on("loading.jstree",a.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",a.proxy(function(b){this._data.core.focused=null,a(b.currentTarget).filter(".jstree-hovered").mouseleave(),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",a.proxy(function(b){var c=this.get_node(b.currentTarget);c&&c.id&&(this._data.core.focused=c.id),this.element.find(".jstree-hovered").not(b.currentTarget).mouseleave(),a(b.currentTarget).mouseenter(),this.element.attr("tabindex","-1")},this)).on("focus.jstree",a.proxy(function(){if(+new Date-d>500&&!this._data.core.focused&&this.settings.core.restore_focus){d=0;var a=this.get_node(this.element.attr("aria-activedescendant"),!0);a&&a.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",a.proxy(function(a){this.hover_node(a.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),a(i).off(".jstree-"+this._id)},trigger:function(a,b){b||(b={}),b.instance=this,this.element.triggerHandler(a.replace(".jstree","")+".jstree",b)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(b){var c=this.settings.core.strings;return a.isFunction(c)?c.call(this,b):c&&c[b]?c[b]:b},_firstChild:function(a){a=a?a.firstChild:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_nextSibling:function(a){a=a?a.nextSibling:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_previousSibling:function(a){a=a?a.previousSibling:null;while(null!==a&&1!==a.nodeType)a=a.previousSibling;return a},get_node:function(b,c){b&&b.id&&(b=b.id),b instanceof jQuery&&b.length&&b[0].id&&(b=b[0].id);var d;try{if(this._model.data[b])b=this._model.data[b];else if("string"==typeof b&&this._model.data[b.replace(/^#/,"")])b=this._model.data[b.replace(/^#/,"")];else if("string"==typeof b&&(d=a("#"+b.replace(a.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else if((d=this.element.find(b)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else{if(!(d=this.element.find(b)).length||!d.hasClass("jstree"))return!1;b=this._model.data[a.jstree.root]}return c&&(b=b.id===a.jstree.root?this.element:a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)),b}catch(e){return!1}},get_path:function(b,c,d){if(b=b.parents?b:this.get_node(b),!b||b.id===a.jstree.root||!b.parents)return!1;var e,f,g=[];for(g.push(d?b.id:b.text),e=0,f=b.parents.length;f>e;e++)g.push(d?b.parents[e]:this.get_text(b.parents[e]));return g=g.reverse().slice(1),c?g.join(c):g},get_next_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this._firstChild(this.get_container_ul()[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}if(b.hasClass("jstree-open")){d=this._firstChild(b.children(".jstree-children")[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);if(null!==d)return a(d)}d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return null!==d?a(d):b.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this.get_container_ul()[0].lastChild;while(d&&0===d.offsetHeight)d=this._previousSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);if(null!==d){b=a(d);while(b.hasClass("jstree-open"))b=b.children(".jstree-children").first().children(".jstree-node:visible:last");return b}return d=b[0].parentNode.parentNode,d&&d.className&&-1!==d.className.indexOf("jstree-node")?a(d):!1},get_parent:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.parent:!1},get_children_dom:function(a){return a=this.get_node(a,!0),a[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):a&&a.length?a.children(".jstree-children").children(".jstree-node"):!1},is_parent:function(a){return a=this.get_node(a),a&&(a.state.loaded===!1||a.children.length>0)},is_loaded:function(a){return a=this.get_node(a),a&&a.state.loaded},is_loading:function(a){return a=this.get_node(a),a&&a.state&&a.state.loading},is_open:function(a){return a=this.get_node(a),a&&a.state.opened},is_closed:function(a){return a=this.get_node(a),a&&this.is_parent(a)&&!a.state.opened},is_leaf:function(a){return!this.is_parent(a)},load_node:function(b,c){var d,e,f,g,h;if(a.isArray(b))return this._load_nodes(b.slice(),c),!0;if(b=this.get_node(b),!b)return c&&c.call(this,b,!1),!1;if(b.state.loaded){for(b.state.loaded=!1,f=0,g=b.parents.length;g>f;f++)this._model.data[b.parents[f]].children_d=a.vakata.array_filter(this._model.data[b.parents[f]].children_d,function(c){return-1===a.inArray(c,b.children_d)});for(d=0,e=b.children_d.length;e>d;d++)this._model.data[b.children_d[d]].state.selected&&(h=!0),delete this._model.data[b.children_d[d]];h&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(c){return-1===a.inArray(c,b.children_d)})),b.children=[],b.children_d=[],h&&this.trigger("changed",{action:"load_node",node:b,selected:this._data.core.selected})}return b.state.failed=!1,b.state.loading=!0,this.get_node(b,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(b,a.proxy(function(a){b=this._model.data[b.id],b.state.loading=!1,b.state.loaded=a,b.state.failed=!b.state.loaded;var d=this.get_node(b,!0),e=0,f=0,g=this._model.data,h=!1;for(e=0,f=b.children.length;f>e;e++)if(g[b.children[e]]&&!g[b.children[e]].state.hidden){h=!0;break}b.state.loaded&&d&&d.length&&(d.removeClass("jstree-closed jstree-open jstree-leaf"),h?"#"!==b.id&&d.addClass(b.state.opened?"jstree-open":"jstree-closed"):d.addClass("jstree-leaf")),d.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:b,status:a}),c&&c.call(this,b,a)},this)),!0},_load_nodes:function(a,b,c,d){var e=!0,f=function(){this._load_nodes(a,b,!0)},g=this._model.data,h,i,j=[];for(h=0,i=a.length;i>h;h++)g[a[h]]&&(!g[a[h]].state.loaded&&!g[a[h]].state.failed||!c&&d)&&(this.is_loading(a[h])||this.load_node(a[h],f),e=!1);if(e){for(h=0,i=a.length;i>h;h++)g[a[h]]&&g[a[h]].state.loaded&&j.push(a[h]);b&&!b.done&&(b.call(this,j),b.done=!0)}},load_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=[],e=this._model.data,f=e[b.id].children_d,g,h;for(b.state&&!b.state.loaded&&d.push(b.id),g=0,h=f.length;h>g;g++)e[f[g]]&&e[f[g]].state&&!e[f[g]].state.loaded&&d.push(f[g]);d.length?this._load_nodes(d,function(){this.load_all(b,c)}):(c&&c.call(this,b),this.trigger("load_all",{node:b}))},_load_node:function(b,c){var d=this.settings.core.data,e,f=function g(){return 3!==this.nodeType&&8!==this.nodeType};return d?a.isFunction(d)?d.call(this,b,a.proxy(function(d){d===!1?c.call(this,!1):this["string"==typeof d?"_append_html_data":"_append_json_data"](b,"string"==typeof d?a(a.parseHTML(d)).filter(f):d,function(a){c.call(this,a)})},this)):"object"==typeof d?d.url?(d=a.extend(!0,{},d),a.isFunction(d.url)&&(d.url=d.url.call(this,b)),a.isFunction(d.data)&&(d.data=d.data.call(this,b)),a.ajax(d).done(a.proxy(function(d,e,g){var h=g.getResponseHeader("Content-Type");return h&&-1!==h.indexOf("json")||"object"==typeof d?this._append_json_data(b,d,function(a){c.call(this,a)}):h&&-1!==h.indexOf("html")||"string"==typeof d?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:g})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))},this)).fail(a.proxy(function(a){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:a})},c.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=a.isArray(d)?a.extend(!0,[],d):a.isPlainObject(d)?a.extend(!0,{},d):d,b.id===a.jstree.root?this._append_json_data(b,e,function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))):"string"==typeof d?b.id===a.jstree.root?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1)):c.call(this,!1):b.id===a.jstree.root?this._append_html_data(b,this._data.core.original_container_html.clone(!0),function(a){c.call(this,a)}):c.call(this,!1)},_node_changed:function(b){b=this.get_node(b),b&&-1===a.inArray(b.id,this._model.changed)&&this._model.changed.push(b.id)},_append_html_data:function(b,c,d){b=this.get_node(b),b.children=[],b.children_d=[];var e=c.is("ul")?c.children():c,f=b.id,g=[],h=[],i=this._model.data,j=i[f],k=this._data.core.selected.length,l,m,n;for(e.each(a.proxy(function(b,c){l=this._parse_model_from_html(a(c),f,j.parents.concat()),l&&(g.push(l),h.push(l),i[l].children_d.length&&(h=h.concat(i[l].children_d)))},this)),j.children=g,j.children_d=h,m=0,n=j.parents.length;n>m;m++)i[j.parents[m]].children_d=i[j.parents[m]].children_d.concat(h);this.trigger("model",{nodes:h,parent:f}),f!==a.jstree.root?(this._node_changed(f),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==k&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)},_append_json_data:function(b,c,d,e){if(null!==this.element){b=this.get_node(b),b.children=[],b.children_d=[],c.d&&(c=c.d,"string"==typeof c&&(c=JSON.parse(c))),a.isArray(c)||(c=[c]);var f=null,g={df:this._model.default_state,dat:c,par:b.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},h=function(a,b){a.data&&(a=a.data);var c=a.dat,d=a.par,e=[],f=[],g=[],h=a.df,i=a.t_id,j=a.t_cnt,k=a.m,l=k[d],m=a.sel,n,o,p,q,r=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f,i,j,l,m={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(m.state[f]=h[f]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(m.icon=a.data.jstree.icon),(m.icon===b||null===m.icon||""===m.icon)&&(m.icon=!0),a&&a.data&&(m.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(m.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(m.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(m.li_attr[f]=a.li_attr[f]);if(m.li_attr.id||(m.li_attr.id=e),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(m.a_attr[f]=a.a_attr[f]);for(a&&a.children&&a.children===!0&&(m.state.loaded=!1,m.children=[],m.children_d=[]),k[m.id]=m,f=0,i=m.children.length;i>f;f++)j=r(k[m.children[f]],m.id,d),l=k[j],m.children_d.push(j),l.children_d.length&&(m.children_d=m.children_d.concat(l.children_d));return delete a.data,delete a.children,k[m.id].original=a,m.state.selected&&g.push(m.id),m.id},s=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,l,m,n,o;do e="j"+i+"_"+ ++j;while(k[e]);o={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in h)h.hasOwnProperty(f)&&(o.state[f]=h[f]);if(a&&a.id&&(o.id=a.id.toString()),a&&a.text&&(o.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(o.icon=a.data.jstree.icon),(o.icon===b||null===o.icon||""===o.icon)&&(o.icon=!0),a&&a.data&&(o.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(o.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(o.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(o.li_attr[f]=a.li_attr[f]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=e),o.li_attr.id||(o.li_attr.id=o.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(o.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,l=a.children.length;l>f;f++)m=s(a.children[f],o.id,d),n=k[m],o.children.push(m),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return a&&a.children&&a.children===!0&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete a.data,delete a.children,o.original=a,k[o.id]=o,o.state.selected&&g.push(o.id),o.id};if(c.length&&c[0].id!==b&&c[0].parent!==b){for(o=0,p=c.length;p>o;o++)c[o].children||(c[o].children=[]),c[o].state||(c[o].state={}),k[c[o].id.toString()]=c[o];for(o=0,p=c.length;p>o;o++)k[c[o].parent.toString()]?(k[c[o].parent.toString()].children.push(c[o].id.toString()),l.children_d.push(c[o].id.toString())):(this._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:c[o].id.toString(),parent:c[o].parent.toString()})},this.settings.core.error.call(this,this._data.core.last_error));for(o=0,p=l.children.length;p>o;o++)n=r(k[l.children[o]],d,l.parents.concat()),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d));for(o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}else{for(o=0,p=c.length;p>o;o++)n=s(c[o],d,l.parents.concat()),n&&(e.push(n),f.push(n),k[n].children_d.length&&(f=f.concat(k[n].children_d)));for(l.children=e,l.children_d=f,o=0,p=l.parents.length;p>o;o++)k[l.parents[o]].children_d=k[l.parents[o]].children_d.concat(f);q={cnt:j,mod:k,sel:m,par:d,dpc:f,add:g}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?q:void postMessage(q)},i=function(b,c){if(null!==this.element){this._cnt=b.cnt;var e,f=this._model.data;for(e in f)f.hasOwnProperty(e)&&f[e].state&&f[e].state.loading&&b.mod[e]&&(b.mod[e].state.loading=!0);if(this._model.data=b.mod,c){var g,h=b.add,i=b.sel,j=this._data.core.selected.slice();if(f=this._model.data,i.length!==j.length||a.vakata.array_unique(i.concat(j)).length!==i.length){for(e=0,g=i.length;g>e;e++)-1===a.inArray(i[e],h)&&-1===a.inArray(i[e],j)&&(f[i[e]].state.selected=!1);for(e=0,g=j.length;g>e;e++)-1===a.inArray(j[e],i)&&(f[j[e]].state.selected=!0)}}b.add.length&&(this._data.core.selected=this._data.core.selected.concat(b.add)),this.trigger("model",{nodes:b.dpc,parent:b.par}),b.par!==a.jstree.root?(this._node_changed(b.par),this.redraw()):this.redraw(!0),b.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+h.toString()],{type:"text/javascript"}))),!this._data.core.working||e?(this._data.core.working=!0,f=new window.Worker(this._wrk),f.onmessage=a.proxy(function(a){i.call(this,a.data,!0);try{f.terminate(),f=null}catch(b){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),g.par?f.postMessage(g):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([b,c,d,!0])}catch(j){i.call(this,h(g),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else i.call(this,h(g),!1)}},_parse_model_from_html:function(c,d,e){e=e?[].concat(e):[],d&&e.unshift(d);var f,g,h=this._model.data,i={id:!1,text:!1,icon:!0,parent:d,parents:e,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},j,k,l;for(j in this._model.default_state)this._model.default_state.hasOwnProperty(j)&&(i.state[j]=this._model.default_state[j]);if(k=a.vakata.attributes(c,!0),a.each(k,function(b,c){return c=a.trim(c),c.length?(i.li_attr[b]=c,void("id"===b&&(i.id=c.toString()))):!0}),k=c.children("a").first(),k.length&&(k=a.vakata.attributes(k,!0),a.each(k,function(b,c){c=a.trim(c),c.length&&(i.a_attr[b]=c)})),k=c.children("a").first().length?c.children("a").first().clone():c.clone(),k.children("ins, i, ul").remove(),k=k.html(),k=a("
      ").html(k),i.text=this.settings.core.force_text?k.text():k.html(),k=c.data(),i.data=k?a.extend(!0,{},k):null,i.state.opened=c.hasClass("jstree-open"),i.state.selected=c.children("a").hasClass("jstree-clicked"),i.state.disabled=c.children("a").hasClass("jstree-disabled"),i.data&&i.data.jstree)for(j in i.data.jstree)i.data.jstree.hasOwnProperty(j)&&(i.state[j]=i.data.jstree[j]);k=c.children("a").children(".jstree-themeicon"),k.length&&(i.icon=k.hasClass("jstree-themeicon-hidden")?!1:k.attr("rel")),i.state.icon!==b&&(i.icon=i.state.icon),(i.icon===b||null===i.icon||""===i.icon)&&(i.icon=!0),k=c.children("ul").children("li");do l="j"+this._id+"_"+ ++this._cnt;while(h[l]);return i.id=i.li_attr.id?i.li_attr.id.toString():l,k.length?(k.each(a.proxy(function(b,c){f=this._parse_model_from_html(a(c),i.id,e),g=this._model.data[f],i.children.push(f),g.children_d.length&&(i.children_d=i.children_d.concat(g.children_d))},this)),i.children_d=i.children_d.concat(i.children)):c.hasClass("jstree-closed")&&(i.state.loaded=!1),i.li_attr["class"]&&(i.li_attr["class"]=i.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),i.a_attr["class"]&&(i.a_attr["class"]=i.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),h[i.id]=i,i.state.selected&&this._data.core.selected.push(i.id),i.id},_parse_model_from_flat_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f=this._model.data,g=this._model.default_state,h,i,j,k,l={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(h in g)g.hasOwnProperty(h)&&(l.state[h]=g[h]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(h in a.data.jstree)a.data.jstree.hasOwnProperty(h)&&(l.state[h]=a.data.jstree[h]);if(a&&"object"==typeof a.state)for(h in a.state)a.state.hasOwnProperty(h)&&(l.state[h]=a.state[h]);if(a&&"object"==typeof a.li_attr)for(h in a.li_attr)a.li_attr.hasOwnProperty(h)&&(l.li_attr[h]=a.li_attr[h]);if(l.li_attr.id||(l.li_attr.id=e),a&&"object"==typeof a.a_attr)for(h in a.a_attr)a.a_attr.hasOwnProperty(h)&&(l.a_attr[h]=a.a_attr[h]);for(a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),f[l.id]=l,h=0,i=l.children.length;i>h;h++)j=this._parse_model_from_flat_json(f[l.children[h]],l.id,d),k=f[j],l.children_d.push(j),k.children_d.length&&(l.children_d=l.children_d.concat(k.children_d));return delete a.data,delete a.children,f[l.id].original=a,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,g,h,i,j=this._model.data,k=this._model.default_state,l;do e="j"+this._id+"_"+ ++this._cnt;while(j[e]);l={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in k)k.hasOwnProperty(f)&&(l.state[f]=k[f]);if(a&&a.id&&(l.id=a.id.toString()),a&&a.text&&(l.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(l.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()), +l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children_d.concat(l.children)}return a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete a.data,delete a.children,l.original=a,j[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var b=this._model.force_full_redraw?this._model.data[a.jstree.root].children.concat([]):this._model.changed.concat([]),c=i.createElement("UL"),d,e,f,g=this._data.core.focused;for(e=0,f=b.length;f>e;e++)d=this.redraw_node(b[e],!0,this._model.force_full_redraw),d&&this._model.force_full_redraw&&c.appendChild(d);this._model.force_full_redraw&&(c.className=this.get_container_ul()[0].className,c.setAttribute("role","group"),this.element.empty().append(c)),null!==g&&this.settings.core.restore_focus&&(d=this.get_node(g,!0),d&&d.length&&d.children(".jstree-anchor")[0]!==i.activeElement?d.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:b})},redraw:function(a){a&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(b){var c=this.get_node(b),d=!1,e=!1,f=!1,g=i;if(!c)return!1;if(c.id===a.jstree.root)return this.redraw(!0);if(b=this.get_node(b,!0),!b||!b.length)return!1;if(b.children(".jstree-children").remove(),b=b[0],c.children.length&&c.state.loaded){for(f=g.createElement("UL"),f.setAttribute("role","group"),f.className="jstree-children",d=0,e=c.children.length;e>d;d++)f.appendChild(this.redraw_node(c.children[d],!0,!0));b.appendChild(f)}},redraw_node:function(b,c,d,e){var f=this.get_node(b),g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n="",o=i,p=this._model.data,q=!1,r=!1,s=null,t=0,u=0,v=!1,w=!1;if(!f)return!1;if(f.id===a.jstree.root)return this.redraw(!0);if(c=c||0===f.children.length,b=i.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(f.id[0])?"\\3"+f.id[0]+" "+f.id.substr(1).replace(a.jstree.idregex,"\\$&"):f.id.replace(a.jstree.idregex,"\\$&"))):i.getElementById(f.id))b=a(b),d||(g=b.parent().parent()[0],g===this.element[0]&&(g=null),h=b.index()),c||!f.children.length||b.children(".jstree-children").length||(c=!0),c||(j=b.children(".jstree-children")[0]),q=b.children(".jstree-anchor")[0]===i.activeElement,b.remove();else if(c=!0,!d){if(g=f.parent!==a.jstree.root?a("#"+f.parent.replace(a.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===g||g&&p[f.parent].state.opened))return!1;h=a.inArray(f.id,null===g?p[a.jstree.root].children:p[f.parent].children)}b=this._data.core.node.cloneNode(!0),n="jstree-node ";for(k in f.li_attr)if(f.li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"!==k?b.setAttribute(k,f.li_attr[k]):n+=f.li_attr[k]}for(f.a_attr.id||(f.a_attr.id=f.id+"_anchor"),b.setAttribute("aria-selected",!!f.state.selected),b.setAttribute("aria-level",f.parents.length),b.setAttribute("aria-labelledby",f.a_attr.id),f.state.disabled&&b.setAttribute("aria-disabled",!0),k=0,l=f.children.length;l>k;k++)if(!p[f.children[k]].state.hidden){v=!0;break}if(null!==f.parent&&p[f.parent]&&!f.state.hidden&&(k=a.inArray(f.id,p[f.parent].children),w=f.id,-1!==k))for(k++,l=p[f.parent].children.length;l>k;k++)if(p[p[f.parent].children[k]].state.hidden||(w=p[f.parent].children[k]),w!==f.id)break;f.state.hidden&&(n+=" jstree-hidden"),f.state.loading&&(n+=" jstree-loading"),f.state.loaded&&!v?n+=" jstree-leaf":(n+=f.state.opened&&f.state.loaded?" jstree-open":" jstree-closed",b.setAttribute("aria-expanded",f.state.opened&&f.state.loaded)),w===f.id&&(n+=" jstree-last"),b.id=f.id,b.className=n,n=(f.state.selected?" jstree-clicked":"")+(f.state.disabled?" jstree-disabled":"");for(l in f.a_attr)if(f.a_attr.hasOwnProperty(l)){if("href"===l&&"#"===f.a_attr[l])continue;"class"!==l?b.childNodes[1].setAttribute(l,f.a_attr[l]):n+=" "+f.a_attr[l]}if(n.length&&(b.childNodes[1].className="jstree-anchor "+n),(f.icon&&f.icon!==!0||f.icon===!1)&&(f.icon===!1?b.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===f.icon.indexOf("/")&&-1===f.icon.indexOf(".")?b.childNodes[1].childNodes[0].className+=" "+f.icon+" jstree-themeicon-custom":(b.childNodes[1].childNodes[0].style.backgroundImage='url("'+f.icon+'")',b.childNodes[1].childNodes[0].style.backgroundPosition="center center",b.childNodes[1].childNodes[0].style.backgroundSize="auto",b.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?b.childNodes[1].appendChild(o.createTextNode(f.text)):b.childNodes[1].innerHTML+=f.text,c&&f.children.length&&(f.state.opened||e)&&f.state.loaded){for(m=o.createElement("UL"),m.setAttribute("role","group"),m.className="jstree-children",k=0,l=f.children.length;l>k;k++)m.appendChild(this.redraw_node(f.children[k],c,!0));b.appendChild(m)}if(j&&b.appendChild(j),!d){for(g||(g=this.element[0]),k=0,l=g.childNodes.length;l>k;k++)if(g.childNodes[k]&&g.childNodes[k].className&&-1!==g.childNodes[k].className.indexOf("jstree-children")){s=g.childNodes[k];break}s||(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",g.appendChild(s)),g=s,hf;f++)this.open_node(c[f],d,e);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(e=e===b?this.settings.core.animation:e,this.is_closed(c)?this.is_loaded(c)?(h=this.get_node(c,!0),i=this,h.length&&(e&&h.children(".jstree-children").length&&h.children(".jstree-children").stop(!0,!0),c.children.length&&!this._firstChild(h.children(".jstree-children")[0])&&this.draw_children(c),e?(this.trigger("before_open",{node:c}),h.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-children").stop(!0,!0).slideDown(e,function(){this.style.display="",i.element&&i.trigger("after_open",{node:c})})):(this.trigger("before_open",{node:c}),h[0].className=h[0].className.replace("jstree-closed","jstree-open"),h[0].setAttribute("aria-expanded",!0))),c.state.opened=!0,d&&d.call(this,c,!0),h.length||this.trigger("before_open",{node:c}),this.trigger("open_node",{node:c}),e&&h.length||this.trigger("after_open",{node:c}),!0):this.is_loading(c)?setTimeout(a.proxy(function(){this.open_node(c,d,e)},this),500):void this.load_node(c,function(a,b){return b?this.open_node(a,d,e):d?d.call(this,a,!1):!1}):(d&&d.call(this,c,!1),!1)):!1},_open_to:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c,d,e=b.parents;for(c=0,d=e.length;d>c;c+=1)c!==a.jstree.root&&this.open_node(e[c],!1,0);return a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)},close_node:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.close_node(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?this.is_closed(c)?!1:(d=d===b?this.settings.core.animation:d,g=this,h=this.get_node(c,!0),c.state.opened=!1,this.trigger("close_node",{node:c}),void(h.length?d?h.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-children").stop(!0,!0).slideUp(d,function(){this.style.display="",h.children(".jstree-children").remove(),g.element&&g.trigger("after_close",{node:c})}):(h[0].className=h[0].className.replace("jstree-open","jstree-closed"),h.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:c})):this.trigger("after_close",{node:c}))):!1},toggle_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.toggle_node(b[c]);return!0}return this.is_closed(b)?this.open_node(b):this.is_open(b)?this.close_node(b):void 0},open_all:function(b,c,d){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var e=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),f,g,h;if(!e.length){for(f=0,g=b.children_d.length;g>f;f++)this.is_closed(this._model.data[b.children_d[f]])&&(this._model.data[b.children_d[f]].state.opened=!0);return this.trigger("open_all",{node:b})}d=d||e,h=this,e=this.is_closed(b)?e.find(".jstree-closed").addBack():e.find(".jstree-closed"),e.each(function(){h.open_node(this,function(a,b){b&&this.is_parent(a)&&this.open_all(a,c,d)},c||0)}),0===d.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(d)})},close_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),e=this,f,g;for(d.length&&(d=this.is_open(b)?d.find(".jstree-open").addBack():d.find(".jstree-open"),a(d.get().reverse()).each(function(){e.close_node(this,c||0)})),f=0,g=b.children_d.length;g>f;f++)this._model.data[b.children_d[f]].state.opened=!1;this.trigger("close_all",{node:b})},is_disabled:function(a){return a=this.get_node(a),a&&a.state&&a.state.disabled},enable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!1,this.get_node(b,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:b})):!1},disable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!0,this.get_node(b,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:b})):!1},is_hidden:function(a){return a=this.get_node(a),a.state.hidden===!0},hide_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.hide_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden||(b.state.hidden=!0,this._node_changed(b.parent),c||this.redraw(),this.trigger("hide_node",{node:b}))):!1},show_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.show_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden&&(b.state.hidden=!1,this._node_changed(b.parent),c||this.redraw(),this.trigger("show_node",{node:b}))):!1},hide_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&!d[c].state.hidden&&(d[c].state.hidden=!0,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("hide_all",{nodes:e}),e},show_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&d[c].state.hidden&&(d[c].state.hidden=!1,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("show_all",{nodes:e}),e},activate_node:function(a,c){if(this.is_disabled(a))return!1;if(c&&"object"==typeof c||(c={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==b?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&(!c.shiftKey||this._data.core.last_clicked&&this.get_parent(a)&&this.get_parent(a)===this._data.core.last_clicked.parent))if(c.shiftKey){var d=this.get_node(a).id,e=this._data.core.last_clicked.id,f=this.get_node(this._data.core.last_clicked.parent).children,g=!1,h,i;for(h=0,i=f.length;i>h;h+=1)f[h]===d&&(g=!g),f[h]===e&&(g=!g),this.is_disabled(f[h])||!g&&f[h]!==d&&f[h]!==e?this.deselect_node(f[h],!0,c):this.is_hidden(f[h])||this.select_node(f[h],!0,!1,c);this.trigger("changed",{action:"select_node",node:this.get_node(a),selected:this._data.core.selected,event:c})}else this.is_selected(a)?this.deselect_node(a,!1,c):this.select_node(a,!1,!1,c);else!this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&this.is_selected(a)?this.deselect_node(a,!1,c):(this.deselect_all(!0),this.select_node(a,!1,!1,c),this._data.core.last_clicked=this.get_node(a));this.trigger("activate_node",{node:this.get_node(a),event:c})},hover_node:function(a){if(a=this.get_node(a,!0),!a||!a.length||a.children(".jstree-hovered").length)return!1;var b=this.element.find(".jstree-hovered"),c=this.element;b&&b.length&&this.dehover_node(b),a.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(a)}),setTimeout(function(){c.attr("aria-activedescendant",a[0].id)},0)},dehover_node:function(a){return a=this.get_node(a,!0),a&&a.length&&a.children(".jstree-hovered").length?(a.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(a)})):!1},select_node:function(b,c,d,e){var f,g,h,i;if(a.isArray(b)){for(b=b.slice(),g=0,h=b.length;h>g;g++)this.select_node(b[g],c,d,e);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.selected||(b.state.selected=!0,this._data.core.selected.push(b.id),d||(f=this._open_to(b)),f&&f.length&&f.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked"),this.trigger("select_node",{node:b,selected:this._data.core.selected,event:e}),c||this.trigger("changed",{action:"select_node",node:b,selected:this._data.core.selected,event:e})))):!1},deselect_node:function(b,c,d){var e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.deselect_node(b[e],c,d);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(g=this.get_node(b,!0),void(b.state.selected&&(b.state.selected=!1,this._data.core.selected=a.vakata.array_remove_item(this._data.core.selected,b.id),g.length&&g.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked"),this.trigger("deselect_node",{node:b,selected:this._data.core.selected,event:d}),c||this.trigger("changed",{action:"deselect_node",node:b,selected:this._data.core.selected,event:d})))):!1},select_all:function(b){var c=this._data.core.selected.concat([]),d,e;for(this._data.core.selected=this._model.data[a.jstree.root].children_d.concat(),d=0,e=this._data.core.selected.length;e>d;d++)this._model.data[this._data.core.selected[d]]&&(this._model.data[this._data.core.selected[d]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),b||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:c})},deselect_all:function(a){var b=this._data.core.selected.concat([]),c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)this._model.data[this._data.core.selected[c]]&&(this._model.data[this._data.core.selected[c]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:b}),a||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:b})},is_selected:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.selected:!1},get_selected:function(b){return b?a.map(this._data.core.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.core.selected.slice()},get_top_selected:function(b){var c=this.get_selected(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},get_bottom_selected:function(b){var c=this.get_selected(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},get_state:function(){var b={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},c;for(c in this._model.data)this._model.data.hasOwnProperty(c)&&c!==a.jstree.root&&(this._model.data[c].state.loaded&&this.settings.core.loaded_state&&b.core.loaded.push(c),this._model.data[c].state.opened&&b.core.open.push(c),this._model.data[c].state.selected&&b.core.selected.push(c));return b},set_state:function(c,d){if(c){if(c.core&&c.core.selected&&c.core.initial_selection===b&&(c.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),c.core){var e,f,g,h,i;if(c.core.loaded)return this.settings.core.loaded_state&&a.isArray(c.core.loaded)&&c.core.loaded.length?this._load_nodes(c.core.loaded,function(a){delete c.core.loaded,this.set_state(c,d)}):(delete c.core.loaded,this.set_state(c,d)),!1;if(c.core.open)return a.isArray(c.core.open)&&c.core.open.length?this._load_nodes(c.core.open,function(a){this.open_node(a,!1,0),delete c.core.open,this.set_state(c,d)}):(delete c.core.open,this.set_state(c,d)),!1;if(c.core.scroll)return c.core.scroll&&c.core.scroll.left!==b&&this.element.scrollLeft(c.core.scroll.left),c.core.scroll&&c.core.scroll.top!==b&&this.element.scrollTop(c.core.scroll.top),delete c.core.scroll,this.set_state(c,d),!1;if(c.core.selected)return h=this,(c.core.initial_selection===b||c.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),a.each(c.core.selected,function(a,b){h.select_node(b,!1,!0)})),delete c.core.initial_selection,delete c.core.selected,this.set_state(c,d),!1;for(i in c)c.hasOwnProperty(i)&&"core"!==i&&-1===a.inArray(i,this.settings.plugins)&&delete c[i];if(a.isEmptyObject(c.core))return delete c.core,this.set_state(c,d),!1}return a.isEmptyObject(c)?(c=null,d&&d.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(b,c){this._data.core.state=c===!0?{}:this.get_state(),c&&a.isFunction(c)&&(this._data.core.state=c.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var d=this.get_container_ul()[0].className;b||(this.element.html(""),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(a.jstree.root,function(b,c){c&&(this.get_container_ul()[0].className=d,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(a.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c=[],d=[],e=this._data.core.selected.concat([]);d.push(b.id),b.state.opened===!0&&c.push(b.id),this.get_node(b,!0).find(".jstree-open").each(function(){d.push(this.id),c.push(this.id)}),this._load_nodes(d,a.proxy(function(a){this.open_node(c,!1,0),this.select_node(e),this.trigger("refresh_node",{node:b,nodes:a})},this),!1,!0)},set_id:function(b,c){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var d,e,f=this._model.data,g=b.id;for(c=c.toString(),f[b.parent].children[a.inArray(b.id,f[b.parent].children)]=c,d=0,e=b.parents.length;e>d;d++)f[b.parents[d]].children_d[a.inArray(b.id,f[b.parents[d]].children_d)]=c;for(d=0,e=b.children.length;e>d;d++)f[b.children[d]].parent=c;for(d=0,e=b.children_d.length;e>d;d++)f[b.children_d[d]].parents[a.inArray(b.id,f[b.children_d[d]].parents)]=c;return d=a.inArray(b.id,this._data.core.selected),-1!==d&&(this._data.core.selected[d]=c),d=this.get_node(b.id,!0),d&&(d.attr("id",c),this.element.attr("aria-activedescendant")===b.id&&this.element.attr("aria-activedescendant",c)),delete f[b.id],b.id=c,b.li_attr.id=c,f[c]=b,this.trigger("set_id",{node:b,"new":b.id,old:g}),!0},get_text:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.text:!1},set_text:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.set_text(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.text=c,this.get_node(b,!0).length&&this.redraw_node(b.id),this.trigger("set_text",{obj:b,text:c}),!0):!1},get_json:function(b,c,d){if(b=this.get_node(b||a.jstree.root),!b)return!1;c&&c.flat&&!d&&(d=[]);var e={id:b.id,text:b.text,icon:this.get_icon(b),li_attr:a.extend(!0,{},b.li_attr),a_attr:a.extend(!0,{},b.a_attr),state:{},data:c&&c.no_data?!1:a.extend(!0,a.isArray(b.data)?[]:{},b.data)},f,g;if(c&&c.flat?e.parent=b.parent:e.children=[],c&&c.no_state)delete e.state;else for(f in b.state)b.state.hasOwnProperty(f)&&(e.state[f]=b.state[f]);if(c&&c.no_li_attr&&delete e.li_attr,c&&c.no_a_attr&&delete e.a_attr,c&&c.no_id&&(delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id),c&&c.flat&&b.id!==a.jstree.root&&d.push(e),!c||!c.no_children)for(f=0,g=b.children.length;g>f;f++)c&&c.flat?this.get_json(b.children[f],c,d):e.children.push(this.get_json(b.children[f],c));return c&&c.flat?d:b.id===a.jstree.root?e.children:e},create_node:function(c,d,e,f,g){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return!1;if(e=e===b?"last":e,!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(c))return this.load_node(c,function(){this.create_node(c,d,e,f,!0)});d||(d={text:this.get_string("New node")}),d="string"==typeof d?{text:d}:a.extend(!0,{},d),d.text===b&&(d.text=this.get_string("New node"));var h,i,j,k;switch(c.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":h=this.get_node(c.parent),e=a.inArray(c.id,h.children),c=h;break;case"after":h=this.get_node(c.parent),e=a.inArray(c.id,h.children)+1,c=h;break;case"inside":case"first":e=0;break;case"last":e=c.children.length;break;default:e||(e=0)}if(e>c.children.length&&(e=c.children.length),d.id||(d.id=!0),!this.check("create_node",d,c,e))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(d.id===!0&&delete d.id,d=this._parse_model_from_json(d,c.id,c.parents.concat()),!d)return!1;for(h=this.get_node(d),i=[],i.push(d),i=i.concat(h.children_d),this.trigger("model",{nodes:i,parent:c.id}),c.children_d=c.children_d.concat(i),j=0,k=c.parents.length;k>j;j++)this._model.data[c.parents[j]].children_d=this._model.data[c.parents[j]].children_d.concat(i);for(d=h,h=[],j=0,k=c.children.length;k>j;j++)h[j>=e?j+1:j]=c.children[j];return h[e]=d.id,c.children=h,this.redraw_node(c,!0),this.trigger("create_node",{node:this.get_node(d),parent:c.id,position:e}),f&&f.call(this,this.get_node(d)),d.id},rename_node:function(b,c){var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.rename_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=b.text,this.check("rename_node",b,this.get_parent(b),c)?(this.set_text(b,c),this.trigger("rename_node",{node:b,text:c,old:f}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.delete_node(b[c]);return!0}if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;if(e=this.get_node(b.parent),f=a.inArray(b.id,e.children),l=!1,!this.check("delete_node",b,e,f))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==f&&(e.children=a.vakata.array_remove(e.children,f)),g=b.children_d.concat([]),g.push(b.id),h=0,i=b.parents.length;i>h;h++)this._model.data[b.parents[h]].children_d=a.vakata.array_filter(this._model.data[b.parents[h]].children_d,function(b){return-1===a.inArray(b,g)});for(j=0,k=g.length;k>j;j++)if(this._model.data[g[j]].state.selected){l=!0;break}for(l&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(b){return-1===a.inArray(b,g)})),this.trigger("delete_node",{node:b,parent:e.id}),l&&this.trigger("changed",{action:"delete_node",node:b,selected:this._data.core.selected,parent:e.id}),j=0,k=g.length;k>j;j++)delete this._model.data[g[j]];return-1!==a.inArray(this._data.core.focused,g)&&(this._data.core.focused=null,m=this.element[0].scrollTop,n=this.element[0].scrollLeft,e.id===a.jstree.root?this._model.data[a.jstree.root].children[0]&&this.get_node(this._model.data[a.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(e,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=m,this.element[0].scrollLeft=n),this.redraw_node(e,!0),!0},check:function(b,c,d,e,f){c=c&&c.id?c:this.get_node(c),d=d&&d.id?d:this.get_node(d);var g=b.match(/^move_node|copy_node|create_node$/i)?d:c,h=this.settings.core.check_callback;return"move_node"!==b&&"copy_node"!==b||f&&f.is_multi||c.id!==d.id&&("move_node"!==b||a.inArray(c.id,d.children)!==e)&&-1===a.inArray(d.id,c.children_d)?(g&&g.data&&(g=g.data),g&&g.functions&&(g.functions[b]===!1||g.functions[b]===!0)?(g.functions[b]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})}),g.functions[b]):h===!1||a.isFunction(h)&&h.call(this,b,c,d,e,f)===!1||h&&h[b]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1):!0):(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1)},last_error:function(){return this._data.core.last_error},move_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t,u,v,w;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.move_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(r=this.move_node(c[j],d,e,f,g,!1,i))&&(d=r,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;if(l=(c.parent||a.jstree.root).toString(),n=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,o=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),p=!o||!o._id||this._id!==o._id,m=o&&o._id&&l&&o._model.data[l]&&o._model.data[l].children?a.inArray(c.id,o._model.data[l].children):-1,o&&o._id&&(c=o._model.data[c.id]),p)return(r=this.copy_node(c,d,e,f,g,!1,i))?(o&&o.delete_node(c),r):!1;switch(d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,n.children);break;case"after":e=a.inArray(d.id,n.children)+1;break;case"inside":case"first":e=0;break;case"last":e=n.children.length;break;default:e||(e=0)}if(e>n.children.length&&(e=n.children.length),!this.check("move_node",c,n,e,{core:!0,origin:i,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(c.parent===n.id){for(q=n.children.concat(),r=a.inArray(c.id,q),-1!==r&&(q=a.vakata.array_remove(q,r),e>r&&e--),r=[],s=0,t=q.length;t>s;s++)r[s>=e?s+1:s]=q[s];r[e]=c.id,n.children=r,this._node_changed(n.id),this.redraw(n.id===a.jstree.root)}else{for(r=c.children_d.concat(),r.push(c.id),s=0,t=c.parents.length;t>s;s++){for(q=[],w=o._model.data[c.parents[s]].children_d,u=0,v=w.length;v>u;u++)-1===a.inArray(w[u],r)&&q.push(w[u]);o._model.data[c.parents[s]].children_d=q}for(o._model.data[l].children=a.vakata.array_remove_item(o._model.data[l].children,c.id),s=0,t=n.parents.length;t>s;s++)this._model.data[n.parents[s]].children_d=this._model.data[n.parents[s]].children_d.concat(r);for(q=[],s=0,t=n.children.length;t>s;s++)q[s>=e?s+1:s]=n.children[s];for(q[e]=c.id,n.children=q,n.children_d.push(c.id),n.children_d=n.children_d.concat(c.children_d),c.parent=n.id,r=n.parents.concat(),r.unshift(n.id),w=c.parents.length,c.parents=r,r=r.concat(),s=0,t=c.children_d.length;t>s;s++)this._model.data[c.children_d[s]].parents=this._model.data[c.children_d[s]].parents.slice(0,-1*w),Array.prototype.push.apply(this._model.data[c.children_d[s]].parents,r);(l===a.jstree.root||n.id===a.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(l),this._node_changed(n.id)),h||this.redraw()}return f&&f.call(this,c,n,e),this.trigger("move_node",{node:c,parent:n.id,position:e,old_parent:l,old_position:m,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id,old_instance:o,new_instance:this}),c.id},copy_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.copy_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(m=this.copy_node(c[j],d,e,f,g,!0,i))&&(d=m,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;switch(q=(c.parent||a.jstree.root).toString(),r=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,s=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),t=!s||!s._id||this._id!==s._id,s&&s._id&&(c=s._model.data[c.id]),d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,r.children);break;case"after":e=a.inArray(d.id,r.children)+1;break;case"inside":case"first":e=0;break;case"last":e=r.children.length;break;default:e||(e=0)}if(e>r.children.length&&(e=r.children.length),!this.check("copy_node",c,r,e,{core:!0,origin:i,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(p=s?s.get_json(c,{no_id:!0,no_data:!0,no_state:!0}):c,!p)return!1;if(p.id===!0&&delete p.id,p=this._parse_model_from_json(p,r.id,r.parents.concat()),!p)return!1;for(m=this.get_node(p),c&&c.state&&c.state.loaded===!1&&(m.state.loaded=!1),l=[],l.push(p),l=l.concat(m.children_d),this.trigger("model",{nodes:l,parent:r.id}),n=0,o=r.parents.length;o>n;n++)this._model.data[r.parents[n]].children_d=this._model.data[r.parents[n]].children_d.concat(l);for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(r.id),h||this.redraw(r.id===a.jstree.root),f&&f.call(this,m,r,e),this.trigger("copy_node",{node:m,original:c,parent:r.id,position:e,old_parent:q,old_position:s&&s._id&&q&&s._model.data[q]&&s._model.data[q].children?a.inArray(c.id,s._model.data[q].children):-1,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g); +return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="copy_node",void this.trigger("copy",{node:b})):!1},get_buffer:function(){return{mode:e,node:d,inst:f}},can_paste:function(){return e!==!1&&d!==!1},paste:function(a,b){return a=this.get_node(a),a&&e&&e.match(/^(copy_node|move_node)$/)&&d?(this[e](d,a,b,!1,!1,!1,f)&&this.trigger("paste",{parent:a.id,node:d,mode:e}),d=!1,e=!1,void(f=!1)):!1},clear_buffer:function(){d=!1,e=!1,f=!1,this.trigger("clear_buffer")},edit:function(b,c,d){var e,f,g,h,j,k,l,m,n,o=!1;return(b=this.get_node(b))?this.check("edit",b,this.get_parent(b))?(n=b,c="string"==typeof c?c:b.text,this.set_text(b,""),b=this._open_to(b),n.text=c,e=this._data.core.rtl,f=this.element.width(),this._data.core.focused=n.id,g=b.children(".jstree-anchor").focus(),h=a(""),j=c,k=a("
      ",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo(i.body),l=a("",{value:j,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:a.proxy(function(c){c.stopImmediatePropagation(),c.preventDefault();var e=h.children(".jstree-rename-input"),f=e.val(),i=this.settings.core.force_text,m;""===f&&(f=j),k.remove(),h.replaceWith(g),h.remove(),j=i?j:a("
      ").append(a.parseHTML(j)).html(),b=this.get_node(b),this.set_text(b,j),m=!!this.rename_node(b,i?a("
      ").text(f).text():a("
      ").append(a.parseHTML(f)).html()),m||this.set_text(b,j),this._data.core.focused=n.id,setTimeout(a.proxy(function(){var a=this.get_node(n.id,!0);a.length&&(this._data.core.focused=n.id,a.children(".jstree-anchor").focus())},this),0),d&&d.call(this,n,m,o),l=null},this),keydown:function(a){var b=a.which;27===b&&(o=!0,this.value=j),(27===b||13===b||37===b||38===b||39===b||40===b||32===b)&&a.stopImmediatePropagation(),(27===b||13===b)&&(a.preventDefault(),this.blur())},click:function(a){a.stopImmediatePropagation()},mousedown:function(a){a.stopImmediatePropagation()},keyup:function(a){l.width(Math.min(k.text("pW"+this.value).width(),f))},keypress:function(a){return 13===a.which?!1:void 0}}),m={fontFamily:g.css("fontFamily")||"",fontSize:g.css("fontSize")||"",fontWeight:g.css("fontWeight")||"",fontStyle:g.css("fontStyle")||"",fontStretch:g.css("fontStretch")||"",fontVariant:g.css("fontVariant")||"",letterSpacing:g.css("letterSpacing")||"",wordSpacing:g.css("wordSpacing")||""},h.attr("class",g.attr("class")).append(g.contents().clone()).append(l),g.replaceWith(h),k.css(m),l.css(m).width(Math.min(k.text("pW"+l[0].value).width(),f))[0].select(),void a(i).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(b){l&&b.target!==l&&a(l).blur()})):(this.settings.core.error.call(this,this._data.core.last_error),!1):!1},set_theme:function(b,c){if(!b)return!1;if(c===!0){var d=this.settings.core.themes.dir;d||(d=a.jstree.path+"/themes"),c=d+"/"+b+"/style.css"}c&&-1===a.inArray(c,g)&&(a("head").append(''),g.push(c)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=b,this.element.addClass("jstree-"+b),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+b+"-responsive"),this.trigger("set_theme",{theme:b})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(a){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=a,a&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.set_icon(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(h=c.icon,c.icon=d===!0||null===d||d===b||""===d?!0:d,g=this.get_node(c,!0).children(".jstree-anchor").children(".jstree-themeicon"),d===!1?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),this.hide_icon(c)):d===!0||null===d||d===b||""===d?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),h===!1&&this.show_icon(c)):-1===d.indexOf("/")&&-1===d.indexOf(".")?(g.removeClass(h).css("background",""),g.addClass(d+" jstree-themeicon-custom").attr("rel",d),h===!1&&this.show_icon(c)):(g.removeClass(h).css("background",""),g.addClass("jstree-themeicon-custom").css("background","url('"+d+"') center center no-repeat").attr("rel",d),h===!1&&this.show_icon(c)),!0):!1},get_icon:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.icon:!1},hide_icon:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.hide_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(b.icon=!1,this.get_node(b,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.show_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(e=this.get_node(b,!0),b.icon=e.length?e.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0,b.icon||(b.icon=!0),e.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},a.vakata={},a.vakata.attributes=function(b,c){b=a(b)[0];var d=c?{}:[];return b&&b.attributes&&a.each(b.attributes,function(b,e){-1===a.inArray(e.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==e.value&&""!==a.trim(e.value)&&(c?d[e.name]=e.value:d.push(e.name))}),d},a.vakata.array_unique=function(a){var c=[],d,e,f,g={};for(d=0,f=a.length;f>d;d++)g[a[d]]===b&&(c.push(a[d]),g[a[d]]=!0);return c},a.vakata.array_remove=function(a,b){return a.splice(b,1),a},a.vakata.array_remove_item=function(b,c){var d=a.inArray(c,b);return-1!==d?a.vakata.array_remove(b,d):b},a.vakata.array_filter=function(a,b,c,d,e){if(a.filter)return a.filter(b,c);d=[];for(e in a)~~e+""==e+""&&e>=0&&b.call(c,a[e],+e,a)&&d.push(a[e]);return d},a.jstree.plugins.changed=function(a,b){var c=[];this.trigger=function(a,d){var e,f;if(d||(d={}),"changed"===a.replace(".jstree","")){d.changed={selected:[],deselected:[]};var g={};for(e=0,f=c.length;f>e;e++)g[c[e]]=1;for(e=0,f=d.selected.length;f>e;e++)g[d.selected[e]]?g[d.selected[e]]=2:d.changed.selected.push(d.selected[e]);for(e=0,f=c.length;f>e;e++)1===g[c[e]]&&d.changed.deselected.push(c[e]);c=d.selected.slice()}b.trigger.call(this,a,d)},this.refresh=function(a,d){return c=[],b.refresh.apply(this,arguments)}};var j=i.createElement("I");j.className="jstree-icon jstree-checkbox",j.setAttribute("role","presentation"),a.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},a.jstree.plugins.checkbox=function(c,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",a.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",a.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",a.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",a.proxy(function(a,b){var c=this._model.data,d=c[b.parent],e=b.nodes,f,g;for(f=0,g=e.length;g>f;f++)c[e[f]].state.checked=c[e[f]].state.checked||c[e[f]].original&&c[e[f]].original.state&&c[e[f]].original.state.checked,c[e[f]].state.checked&&this._data.checkbox.selected.push(e[f])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",a.proxy(function(b,c){var d=this._model.data,e=d[c.parent],f=c.nodes,g=[],h,i,j,k,l,m,n=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection;if(-1!==n.indexOf("down"))if(e.state[o?"selected":"checked"]){for(i=0,j=f.length;j>i;i++)d[f[i]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(f)}else for(i=0,j=f.length;j>i;i++)if(d[f[i]].state[o?"selected":"checked"]){for(k=0,l=d[f[i]].children_d.length;l>k;k++)d[d[f[i]].children_d[k]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(d[f[i]].children_d)}if(-1!==n.indexOf("up")){for(i=0,j=e.children_d.length;j>i;i++)d[e.children_d[i]].children.length||g.push(d[e.children_d[i]].parent);for(g=a.vakata.array_unique(g),k=0,l=g.length;l>k;k++){e=d[g[k]];while(e&&e.id!==a.jstree.root){for(h=0,i=0,j=e.children.length;j>i;i++)h+=d[e.children[i]].state[o?"selected":"checked"];if(h!==j)break;e.state[o?"selected":"checked"]=!0,this._data[o?"core":"checkbox"].selected.push(e.id),m=this.get_node(e,!0),m&&m.length&&m.attr("aria-selected",!0).children(".jstree-anchor").addClass(o?"jstree-clicked":"jstree-checked"),e=this.get_node(e.parent)}}}this._data[o?"core":"checkbox"].selected=a.vakata.array_unique(this._data[o?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",a.proxy(function(b,c){var d=this,e=c.node,f=this._model.data,g=this.get_node(e.parent),h,i,j,k,l=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection,n={},o=this._data[m?"core":"checkbox"].selected;for(h=0,i=o.length;i>h;h++)n[o[h]]=!0;if(-1!==l.indexOf("down")){var p=this._cascade_new_checked_state(e.id,!0),q=e.children_d.concat(e.id);for(h=0,i=q.length;i>h;h++)p.indexOf(q[h])>-1?n[q[h]]=!0:delete n[q[h]]}if(-1!==l.indexOf("up"))while(g&&g.id!==a.jstree.root){for(j=0,h=0,i=g.children.length;i>h;h++)j+=f[g.children[h]].state[m?"selected":"checked"];if(j!==i)break;g.state[m?"selected":"checked"]=!0,n[g.id]=!0,k=this.get_node(g,!0),k&&k.length&&k.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),g=this.get_node(g.parent)}o=[];for(h in n)n.hasOwnProperty(h)&&o.push(h);this._data[m?"core":"checkbox"].selected=o},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",a.proxy(function(b,c){var d=this.get_node(a.jstree.root),e=this._model.data,f,g,h;for(f=0,g=d.children_d.length;g>f;f++)h=e[d.children_d[f]],h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",a.proxy(function(a,b){var c=this,d=b.node,e=this.get_node(d,!0),f,g,h,i=this.settings.checkbox.cascade,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l={},m=[],n=d.children_d.concat(d.id);if(-1!==i.indexOf("down")){var o=this._cascade_new_checked_state(d.id,!1);k=k.filter(function(a){return-1===n.indexOf(a)||o.indexOf(a)>-1})}if(-1!==i.indexOf("up")&&-1===k.indexOf(d.id)){for(f=0,g=d.parents.length;g>f;f++)h=this._model.data[d.parents[f]],h.state[j?"selected":"checked"]=!1,h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1),h=this.get_node(d.parents[f],!0),h&&h.length&&h.attr("aria-selected",!1).children(".jstree-anchor").removeClass(j?"jstree-clicked":"jstree-checked");k=k.filter(function(a){return-1===d.parents.indexOf(a)})}this._data[j?"core":"checkbox"].selected=k},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",a.proxy(function(b,c){var d=this.get_node(c.parent),e=this._model.data,f,g,h,i,j=this.settings.checkbox.tie_selection;while(d&&d.id!==a.jstree.root&&!d.state[j?"selected":"checked"]){for(h=0,f=0,g=d.children.length;g>f;f++)h+=e[d.children[f]].state[j?"selected":"checked"];if(!(g>0&&h===g))break;d.state[j?"selected":"checked"]=!0,this._data[j?"core":"checkbox"].selected.push(d.id),i=this.get_node(d,!0),i&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(j?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}},this)).on("move_node.jstree",a.proxy(function(b,c){var d=c.is_multi,e=c.old_parent,f=this.get_node(c.parent),g=this._model.data,h,i,j,k,l,m=this.settings.checkbox.tie_selection;if(!d){h=this.get_node(e);while(h&&h.id!==a.jstree.root&&!h.state[m?"selected":"checked"]){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(!(k>0&&i===k))break;h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),h=this.get_node(h.parent)}}h=f;while(h&&h.id!==a.jstree.root){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(i===k)h.state[m?"selected":"checked"]||(h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"));else{if(!h.state[m?"selected":"checked"])break;h.state[m?"selected":"checked"]=!1,this._data[m?"core":"checkbox"].selected=a.vakata.array_remove_item(this._data[m?"core":"checkbox"].selected,h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(m?"jstree-clicked":"jstree-checked")}h=this.get_node(h.parent)}},this))},this.get_undetermined=function(c){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var d,e,f,g,h={},i=this._model.data,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l=[],m=this,n=[];for(d=0,e=k.length;e>d;d++)if(i[k[d]]&&i[k[d]].parents)for(f=0,g=i[k[d]].parents.length;g>f;f++){if(h[i[k[d]].parents[f]]!==b)break;i[k[d]].parents[f]!==a.jstree.root&&(h[i[k[d]].parents[f]]=!0,l.push(i[k[d]].parents[f]))}for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var c=m.get_node(this),j;if(c)if(c.state.loaded){for(d=0,e=c.children_d.length;e>d;d++)if(j=i[c.children_d[d]],!j.state.loaded&&j.original&&j.original.state&&j.original.state.undetermined&&j.original.state.undetermined===!0)for(h[j.id]===b&&j.id!==a.jstree.root&&(h[j.id]=!0,l.push(j.id)),f=0,g=j.parents.length;g>f;f++)h[j.parents[f]]===b&&j.parents[f]!==a.jstree.root&&(h[j.parents[f]]=!0,l.push(j.parents[f]))}else if(c.original&&c.original.state&&c.original.state.undetermined&&c.original.state.undetermined===!0)for(h[c.id]===b&&c.id!==a.jstree.root&&(h[c.id]=!0,l.push(c.id)),f=0,g=c.parents.length;g>f;f++)h[c.parents[f]]===b&&c.parents[f]!==a.jstree.root&&(h[c.parents[f]]=!0,l.push(c.parents[f]))}),d=0,e=l.length;e>d;d++)i[l[d]].state[j?"selected":"checked"]||n.push(c?i[l[d]]:l[d]);return n},this._undetermined=function(){if(null!==this.element){var a=this.get_undetermined(!1),b,c,d;for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),b=0,c=a.length;c>b;b++)d=this.get_node(a[b],!0),d&&d.length&&d.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments)){var g,h,i=null,k=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(!this.settings.checkbox.tie_selection&&this._model.data[b.id].state.checked&&(i.className+=" jstree-checked"),k=j.cloneNode(!1),this._model.data[b.id].state.checkbox_disabled&&(k.className+=" jstree-checkbox-disabled"),i.insertBefore(k,i.childNodes[0]))}return e||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)),b},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(b){b=this.get_node(b);var c=this.settings.checkbox.cascade,d,e,f=this.settings.checkbox.tie_selection,g=this._data[f?"core":"checkbox"].selected,h=this._model.data;if(!b||b.state[f?"selected":"checked"]===!0||-1===c.indexOf("undetermined")||-1===c.indexOf("down")&&-1===c.indexOf("up"))return!1;if(!b.state.loaded&&b.original.state.undetermined===!0)return!0;for(d=0,e=b.children_d.length;e>d;d++)if(-1!==a.inArray(b.children_d[d],g)||!h[b.children_d[d]].state.loaded&&h[b.children_d[d]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled||(b.state.checkbox_disabled=!0,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:b})))):!1},this.enable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled&&(b.state.checkbox_disabled=!1,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:b})))):!1},this.activate_node=function(b,c){return a(c.target).hasClass("jstree-checkbox-disabled")?!1:(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||a(c.target).hasClass("jstree-checkbox"))&&(c.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!a(c.target).hasClass("jstree-checkbox")?d.activate_node.call(this,b,c):this.is_disabled(b)?!1:(this.is_checked(b)?this.uncheck_node(b,c):this.check_node(b,c),void this.trigger("activate_node",{node:this.get_node(b)})))},this._cascade_new_checked_state=function(a,b){var c=this,d=this.settings.checkbox.tie_selection,e=this._model.data[a],f=[],g=[],h,i,j;if(!this.settings.checkbox.cascade_to_disabled&&e.state.disabled||!this.settings.checkbox.cascade_to_hidden&&e.state.hidden)j=this.get_checked_descendants(a),e.state[d?"selected":"checked"]&&j.push(e.id),f=f.concat(j);else{if(e.children)for(h=0,i=e.children.length;i>h;h++){var k=e.children[h];j=c._cascade_new_checked_state(k,b),f=f.concat(j),j.indexOf(k)>-1&&g.push(k)}var l=c.get_node(e,!0),m=g.length>0&&g.lengthe;e++)this.check_node(b[e],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(d=this.get_node(b,!0),void(b.state.checked||(b.state.checked=!0,this._data.checkbox.selected.push(b.id),d&&d.length&&d.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.uncheck_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.deselect_node(b,!1,c);var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.uncheck_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.checked&&(b.state.checked=!1,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,b.id),f.length&&f.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var b=this._data.checkbox.selected.concat([]),c,d;for(this._data.checkbox.selected=this._model.data[a.jstree.root].children_d.concat(),c=0,d=this._data.checkbox.selected.length;d>c;c++)this._model.data[this._data.checkbox.selected[c]]&&(this._model.data[this._data.checkbox.selected[c]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var a=this._data.checkbox.selected.concat([]),b,c;for(b=0,c=this._data.checkbox.selected.length;c>b;b++)this._model.data[this._data.checkbox.selected[b]]&&(this._model.data[this._data.checkbox.selected[b]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:a})},this.is_checked=function(b){return this.settings.checkbox.tie_selection?this.is_selected(b):(b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.checked:!1)},this.get_checked=function(b){return this.settings.checkbox.tie_selection?this.get_selected(b):b?a.map(this._data.checkbox.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.checkbox.selected},this.get_top_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_top_selected(b);var c=this.get_checked(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},this.get_bottom_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(b);var c=this.get_checked(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},this.load_node=function(b,c){var e,f,g,h,i,j;if(!a.isArray(b)&&!this.settings.checkbox.tie_selection&&(j=this.get_node(b),j&&j.state.loaded))for(e=0,f=j.children_d.length;f>e;e++)this._model.data[j.children_d[e]].state.checked&&(i=!0,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,j.children_d[e]));return d.load_node.apply(this,arguments)},this.get_state=function(){var a=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?a:(a.checkbox=this._data.checkbox.selected.slice(),a)},this.set_state=function(b,c){var e=d.set_state.apply(this,arguments);if(e&&b.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var f=this;a.each(b.checkbox,function(a,b){f.check_node(b)})}return delete b.checkbox,this.set_state(b,c),!1}return e},this.refresh=function(a,b){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},a.jstree.defaults.conditionalselect=function(){return!0},a.jstree.plugins.conditionalselect=function(a,b){this.activate_node=function(a,c){return this.settings.conditionalselect.call(this,this.get_node(a),c)?b.activate_node.call(this,a,c):void 0}},a.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(b,c){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.create_node(d,{},"last",function(a){try{c.edit(a)}catch(b){setTimeout(function(){c.edit(a)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.edit(d)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.delete_node(c.get_selected()):c.delete_node(d)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.cut(c.get_top_selected()):c.cut(d)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.copy(c.get_top_selected()):c.copy(d)}},paste:{separator_before:!1,icon:!1,_disabled:function(b){return!a.jstree.reference(b.reference).can_paste()},separator_after:!1,label:"Paste",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.paste(d)}}}}}}},a.jstree.plugins.contextmenu=function(c,d){this.bind=function(){d.bind.call(this);var b=0,c=null,e,f;this.element.on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",a.proxy(function(a,d){"input"!==a.target.tagName.toLowerCase()&&(a.preventDefault(),b=a.ctrlKey?+new Date:0,(d||c)&&(b=+new Date+1e4),c&&clearTimeout(c),this.is_loading(a.currentTarget)||this.show_contextmenu(a.currentTarget,a.pageX,a.pageY,a))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(c){this._data.contextmenu.visible&&(!b||+new Date-b>250)&&a.vakata.context.hide(),b=0},this)).on("touchstart.jstree",".jstree-anchor",function(b){b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(e=b.originalEvent.changedTouches[0].clientX,f=b.originalEvent.changedTouches[0].clientY,c=setTimeout(function(){a(b.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(b){c&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(Math.abs(e-b.originalEvent.changedTouches[0].clientX)>10||Math.abs(f-b.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(c),a.vakata.context.hide())}).on("touchend.vakata.jstree",function(a){c&&clearTimeout(c)}),a(i).on("context_hide.vakata.jstree",a.proxy(function(b,c){this._data.contextmenu.visible=!1,a(c.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&a.vakata.context.hide(),d.teardown.call(this)},this.show_contextmenu=function(c,d,e,f){if(c=this.get_node(c),!c||c.id===a.jstree.root)return!1;var g=this.settings.contextmenu,h=this.get_node(c,!0),i=h.children(".jstree-anchor"),j=!1,k=!1;(g.show_at_node||d===b||e===b)&&(j=i.offset(),d=j.left,e=j.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(c)&&this.activate_node(c,f),k=g.items,a.isFunction(k)&&(k=k.call(this,c,a.proxy(function(a){this._show_contextmenu(c,d,e,a)},this))),a.isPlainObject(k)&&this._show_contextmenu(c,d,e,k)},this._show_contextmenu=function(b,c,d,e){var f=this.get_node(b,!0),g=f.children(".jstree-anchor");a(i).one("context_show.vakata.jstree",a.proxy(function(b,c){var d="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";a(c.element).addClass(d),g.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,a.vakata.context.show(g,{x:c,y:d},e),this.trigger("show_contextmenu",{node:b,x:c,y:d})}},function(a){var b=!1,c={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};a.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(b){a(i).triggerHandler("context_"+b+".vakata",{reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}})},_execute:function(b){return b=c.items[b],b&&(!b._disabled||a.isFunction(b._disabled)&&!b._disabled({item:b,reference:c.reference,element:c.element}))&&b.action?b.action.call(null,{item:b,reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+=""),d||(c.html=e,a.vakata.context._trigger("parse")),e.length>10?e:!1},_show_submenu:function(c){if(c=a(c),c.length&&c.children("ul").length){var d=c.children("ul"),e=c.offset().left,f=e+c.outerWidth(),g=c.offset().top,h=d.width(),i=d.height(),j=a(window).width()+a(window).scrollLeft(),k=a(window).height()+a(window).scrollTop();b?c[f-(h+10+c.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):c[f+h>j&&e>j-f?"addClass":"removeClass"]("vakata-context-right"),g+i+10>k&&d.css("bottom","-1px"),c.hasClass("vakata-context-right")?h>e&&d.css("margin-right",e-h):h>j-f&&d.css("margin-left",j-f-h),d.show()}},show:function(d,e,f){var g,h,j,k,l,m,n,o,p=!0;switch(c.element&&c.element.length&&c.element.width(""),p){case!e&&!d:return!1;case!!e&&!!d:c.reference=d,c.position_x=e.x,c.position_y=e.y;break;case!e&&!!d:c.reference=d,g=d.offset(),c.position_x=g.left+d.outerHeight(),c.position_y=g.top;break;case!!e&&!d:c.position_x=e.x,c.position_y=e.y}d&&!f&&a(d).data("vakata_contextmenu")&&(f=a(d).data("vakata_contextmenu")),a.vakata.context._parse(f)&&c.element.html(c.html),c.items.length&&(c.element.appendTo(i.body),h=c.element,j=c.position_x,k=c.position_y,l=h.width(),m=h.height(),n=a(window).width()+a(window).scrollLeft(),o=a(window).height()+a(window).scrollTop(),b&&(j-=h.outerWidth()-a(d).outerWidth(),jn&&(j=n-(l+20)),k+m+20>o&&(k=o-(m+20)),c.element.css({left:j,top:k}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),c.is_visible=!0,a.vakata.context._trigger("show"))},hide:function(){c.is_visible&&(c.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),c.is_visible=!1,a.vakata.context._trigger("hide"))}},a(function(){b="rtl"===a(i.body).css("direction");var d=!1;c.element=a("
        "),c.element.on("mouseenter","li",function(b){b.stopImmediatePropagation(),a.contains(this,b.relatedTarget)||(d&&clearTimeout(d),c.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(b){a.contains(this,b.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(b){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),a.vakata.context.settings.hide_onmouseleave&&(d=setTimeout(function(b){return function(){a.vakata.context.hide()}}(this),a.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(b){b.preventDefault(),a(this).blur().parent().hasClass("vakata-context-disabled")||a.vakata.context._execute(a(this).attr("rel"))===!1||a.vakata.context.hide()}).on("keydown","a",function(b){var d=null;switch(b.which){case 13:case 32:b.type="click",b.preventDefault(),a(b.currentTarget).trigger(b);break;case 37:c.is_visible&&(c.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 38:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 39:c.is_visible&&(c.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 40:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 27:a.vakata.context.hide(),b.preventDefault()}}).on("keydown",function(a){a.preventDefault();var b=c.element.find(".vakata-contextmenu-shortcut-"+a.which).parent();b.parent().not(".vakata-context-disabled")&&b.click()}),a(i).on("mousedown.vakata.jstree",function(b){c.is_visible&&c.element[0]!==b.target&&!a.contains(c.element[0],b.target)&&a.vakata.context.hide()}).on("context_show.vakata.jstree",function(a,d){c.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),b&&c.element.addClass("vakata-context-rtl").css("direction","rtl"),c.element.find("ul").hide().end()})})}(a),a.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var k,l;a.jstree.plugins.dnd=function(b,c){this.init=function(a,b){c.init.call(this,a,b),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in i.createElement("span")},this.bind=function(){c.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",a.proxy(function(b){if(this.settings.dnd.large_drag_target&&a(b.target).closest(".jstree-node")[0]!==b.currentTarget)return!0;if("touchstart"===b.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var c=this.get_node(b.target),d=this.is_selected(c)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,e=d>1?d+" "+this.get_string("nodes"):this.get_text(b.currentTarget);if(this.settings.core.force_text&&(e=a.vakata.html.escape(e)),c&&c.id&&c.id!==a.jstree.root&&(1===b.which||"touchstart"===b.type||"dragstart"===b.type)&&(this.settings.dnd.is_draggable===!0||a.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,d>1?this.get_top_selected(!0):[c],b))){if(k={jstree:!0,origin:this,obj:this.get_node(c,!0),nodes:d>1?this.get_top_selected():[c.id]},l=b.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),a.vakata.dnd.start(b,k,'
        '+e+'
        ');a.vakata.dnd._trigger("start",b,{helper:a(),element:l,data:k})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(b){return b.preventDefault(),a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k}),!1}).on("drop.jstree",a.proxy(function(b){return b.preventDefault(),a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),!1},this))},this.redraw_node=function(a,b,d,e){if(a=c.redraw_node.apply(this,arguments),a&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)a.setAttribute("draggable",!0);else{var f,g,h=null;for(f=0,g=a.childNodes.length;g>f;f++)if(a.childNodes[f]&&a.childNodes[f].className&&-1!==a.childNodes[f].className.indexOf("jstree-anchor")){h=a.childNodes[f];break}h&&h.setAttribute("draggable",!0)}return a}},a(function(){var c=!1,d=!1,e=!1,f=!1,g=a('
         
        ').hide();a(i).on("dragover.vakata.jstree",function(b){l&&a.vakata.dnd._trigger("move",b,{helper:a(),element:l,data:k})}).on("drop.vakata.jstree",function(b){l&&(a.vakata.dnd._trigger("stop",b,{helper:a(),element:l,data:k}),l=null,k=null)}).on("dnd_start.vakata.jstree",function(a,b){c=!1,e=!1,b&&b.data&&b.data.jstree&&g.appendTo(i.body)}).on("dnd_move.vakata.jstree",function(h,i){var j=i.event.target!==e.target;if(f&&(!i.event||"dragover"!==i.event.type||j)&&clearTimeout(f),i&&i.data&&i.data.jstree&&(!i.event.target.id||"jstree-marker"!==i.event.target.id)){e=i.event;var k=a.jstree.reference(i.event.target),l=!1,m=!1,n=!1,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;if(k&&k._data&&k._data.dnd)if(g.attr("class","jstree-"+k.get_theme()+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")),D=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey)),i.helper.children().attr("class","jstree-"+k.get_theme()+" jstree-"+k.get_theme()+"-"+k.get_theme_variant()+" "+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[D?"show":"hide"](),i.event.target!==k.element[0]&&i.event.target!==k.get_container_ul()[0]||0!==k.get_container_ul().children().length){if(l=k.settings.dnd.large_drop_target?a(i.event.target).closest(".jstree-node").children(".jstree-anchor"):a(i.event.target).closest(".jstree-anchor"),l&&l.length&&l.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(m=l.offset(),n=(i.event.pageY!==b?i.event.pageY:i.event.originalEvent.pageY)-m.top,r=l.outerHeight(),u=r/3>n?["b","i","a"]:n>r-r/3?["a","i","b"]:n>r/2?["i","a","b"]:["i","b","a"],a.each(u,function(b,e){switch(e){case"b":p=m.left-6,q=m.top,s=k.get_parent(l),t=l.parent().index();break;case"i":B=k.settings.dnd.inside_pos,C=k.get_node(l.parent()),p=m.left-2,q=m.top+r/2+1,s=C.id,t="first"===B?0:"last"===B?C.children.length:Math.min(B,C.children.length);break;case"a":p=m.left-6,q=m.top+r,s=k.get_parent(l),t=l.parent().index()+1}for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(y=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",z=t,"move_node"===y&&"a"===e&&i.data.origin&&i.data.origin===k&&s===k.get_parent(i.data.nodes[w])&&(A=k.get_node(s),z>a.inArray(i.data.nodes[w],A.children)&&(z-=1)),v=v&&(k&&k.settings&&k.settings.dnd&&k.settings.dnd.check_while_dragging===!1||k.check(y,i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],s,z,{dnd:!0,ref:k.get_node(l.parent()),pos:e,origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin})),!v){k&&k.last_error&&(d=k.last_error());break}return"i"===e&&l.parent().is(".jstree-closed")&&k.settings.dnd.open_timeout&&(!i.event||"dragover"!==i.event.type||j)&&(f&&clearTimeout(f),f=setTimeout(function(a,b){return function(){a.open_node(b)}}(k,l),k.settings.dnd.open_timeout)),v?(E=k.get_node(s,!0),E.hasClass(".jstree-dnd-parent")||(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),E.addClass("jstree-dnd-parent")),c={ins:k,par:s,pos:"i"!==e||"last"!==B||0!==t||k.is_loaded(C)?t:"last"},g.css({left:p+"px",top:q+"px"}).show(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"),d={},u=!0,!1):void 0}),u===!0))return}else{for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(v=v&&k.check(i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],a.jstree.root,"last",{dnd:!0,ref:k.get_node(a.jstree.root),pos:"i",origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin}),!v)break;if(v)return c={ins:k,par:a.jstree.root,pos:"last"},g.hide(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"))}a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),c=!1,i.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),i.event.originalEvent&&i.event.originalEvent.dataTransfer,g.hide()}}).on("dnd_scroll.vakata.jstree",function(a,b){b&&b.data&&b.data.jstree&&(g.hide(),c=!1,e=!1,b.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(b,h){if(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),f&&clearTimeout(f),h&&h.data&&h.data.jstree){g.hide().detach();var i,j,k=[];if(c){for(i=0,j=h.data.nodes.length;j>i;i++)k[i]=h.data.origin?h.data.origin.get_node(h.data.nodes[i]):h.data.nodes[i];c.ins[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(h.event.metaKey||h.event.ctrlKey))?"copy_node":"move_node"](k,c.par,c.pos,!1,!1,!1,h.data.origin)}else i=a(h.event.target).closest(".jstree"),i.length&&d&&d.error&&"check"===d.error&&(i=i.jstree(!0),i&&i.settings.core.error.call(this,d));e=!1,c=!1}}).on("keyup.jstree keydown.jstree",function(b,h){h=a.vakata.dnd._get(),h&&h.data&&h.data.jstree&&("keyup"===b.type&&27===b.which?(f&&clearTimeout(f),c=!1,d=!1,e=!1,f=!1,g.hide().detach(),a.vakata.dnd._clean()):(h.helper.find(".jstree-copy").first()[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(b.metaKey||b.ctrlKey))?"show":"hide"](),e&&(e.metaKey=b.metaKey,e.ctrlKey=b.ctrlKey,a.vakata.dnd._trigger("move",e))))})}),function(a){a.vakata.html={div:a("
        "),escape:function(b){return a.vakata.html.div.text(b).html()},strip:function(b){return a.vakata.html.div.empty().append(a.parseHTML(b)).text()}};var c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};a.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(c,d,e){e===b&&(e=a.vakata.dnd._get()),e.event=d,a(i).triggerHandler("dnd_"+c+".vakata",e)},_get:function(){return{data:c.data,element:c.element,helper:c.helper}},_clean:function(){c.helper&&c.helper.remove(),c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},a(i).off("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).off("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop)},_scroll:function(b){if(!c.scroll_e||!c.scroll_l&&!c.scroll_t)return c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),!1;if(!c.scroll_i)return c.scroll_i=setInterval(a.vakata.dnd._scroll,100),!1;if(b===!0)return!1;var d=c.scroll_e.scrollTop(),e=c.scroll_e.scrollLeft();c.scroll_e.scrollTop(d+c.scroll_t*a.vakata.dnd.settings.scroll_speed),c.scroll_e.scrollLeft(e+c.scroll_l*a.vakata.dnd.settings.scroll_speed),(d!==c.scroll_e.scrollTop()||e!==c.scroll_e.scrollLeft())&&a.vakata.dnd._trigger("scroll",c.scroll_e)},start:function(b,d,e){"touchstart"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag&&a.vakata.dnd.stop({});try{b.currentTarget.unselectable="on",b.currentTarget.onselectstart=function(){return!1},b.currentTarget.style&&(b.currentTarget.style.touchAction="none",b.currentTarget.style.msTouchAction="none",b.currentTarget.style.MozUserSelect="none")}catch(f){}return c.init_x=b.pageX,c.init_y=b.pageY,c.data=d,c.is_down=!0,c.element=b.currentTarget,c.target=b.target,c.is_touch="touchstart"===b.type,e!==!1&&(c.helper=a("
        ").html(e).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),a(i).on("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).on("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop),!1},drag:function(b){if("touchmove"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_down){if(!c.is_drag){if(!(Math.abs(b.pageX-c.init_x)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)||Math.abs(b.pageY-c.init_y)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)))return;c.helper&&(c.helper.appendTo(i.body),c.helper_w=c.helper.outerWidth()),c.is_drag=!0,a(c.target).one("click.vakata",!1),a.vakata.dnd._trigger("start",b)}var d=!1,e=!1,f=!1,g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n=!1;return c.scroll_t=0,c.scroll_l=0,c.scroll_e=!1,a(a(b.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(a(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var d=a(this),e=d.offset();return this.scrollHeight>this.offsetHeight&&(e.top+d.height()-b.pageYthis.offsetWidth&&(e.left+d.width()-b.pageXg&&b.pageY-kg&&g-(b.pageY-k)j&&b.pageX-lj&&j-(b.pageX-l)f&&(m=f-50),h&&n+c.helper_w>h&&(n=h-(c.helper_w+2)),c.helper.css({left:n+"px",top:m+"px"})),a.vakata.dnd._trigger("move",b),!1}},stop:function(b){if("touchend"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag)b.target!==c.target&&a(c.target).off("click.vakata"),a.vakata.dnd._trigger("stop",b);else if("touchend"===b.type&&b.target===c.target){var d=setTimeout(function(){a(b.target).click()},100);a(b.target).one("click",function(){d&&clearTimeout(d)})}return a.vakata.dnd._clean(),!1}}}(a),a.jstree.defaults.massload=null,a.jstree.plugins.massload=function(b,c){this.init=function(a,b){this._data.massload={},c.init.call(this,a,b)},this._load_nodes=function(b,d,e,f){var g=this.settings.massload,h=JSON.stringify(b),i=[],j=this._model.data,k,l,m;if(!e){for(k=0,l=b.length;l>k;k++)(!j[b[k]]||!j[b[k]].state.loaded&&!j[b[k]].state.failed||f)&&(i.push(b[k]),m=this.get_node(b[k],!0),m&&m.length&&m.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},i.length){if(a.isFunction(g))return g.call(this,i,a.proxy(function(a){var g,h;if(a)for(g in a)a.hasOwnProperty(g)&&(this._data.massload[g]=a[g]);for(g=0,h=b.length;h>g;g++)m=this.get_node(b[g],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this));if("object"==typeof g&&g&&g.url)return g=a.extend(!0,{},g),a.isFunction(g.url)&&(g.url=g.url.call(this,i)),a.isFunction(g.data)&&(g.data=g.data.call(this,i)),a.ajax(g).done(a.proxy(function(a,g,h){var i,j;if(a)for(i in a)a.hasOwnProperty(i)&&(this._data.massload[i]=a[i]);for(i=0,j=b.length;j>i;i++)m=this.get_node(b[i],!0),m&&m.length&&m.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this)).fail(a.proxy(function(a){c._load_nodes.call(this,b,d,e,f)},this))}}return c._load_nodes.call(this,b,d,e,f)},this._load_node=function(b,d){var e=this._data.massload[b.id],f=null,g;return e?(f=this["string"==typeof e?"_append_html_data":"_append_json_data"](b,"string"==typeof e?a(a.parseHTML(e)).filter(function(){return 3!==this.nodeType}):e,function(a){d.call(this,a)}),g=this.get_node(b.id,!0),g&&g.length&&g.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[b.id],f):c._load_node.call(this,b,d)}},a.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},a.jstree.plugins.search=function(c,d){this.bind=function(){d.bind.call(this),this._data.search.str="",this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",a.proxy(function(b,c){if(this._data.search.som&&c.res.length){var d=this._model.data,e,f,g=[],h,i;for(e=0,f=c.res.length;f>e;e++)if(d[c.res[e]]&&!d[c.res[e]].state.hidden&&(g.push(c.res[e]),g=g.concat(d[c.res[e]].parents),this._data.search.smc))for(h=0,i=d[c.res[e]].children_d.length;i>h;h++)d[d[c.res[e]].children_d[h]]&&!d[d[c.res[e]].children_d[h]].state.hidden&&g.push(d[c.res[e]].children_d[h]);g=a.vakata.array_remove_item(a.vakata.array_unique(g),a.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(g,!0),this.redraw(!0)}},this)).on("clear_search.jstree",a.proxy(function(a,b){this._data.search.som&&b.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(c,d,e,f,g,h){if(c===!1||""===a.trim(c.toString()))return this.clear_search();f=this.get_node(f),f=f&&f.id?f.id:null,c=c.toString();var i=this.settings.search,j=i.ajax?i.ajax:!1,k=this._model.data,l=null,m=[],n=[],o,p;if(this._data.search.res.length&&!g&&this.clear_search(),e===b&&(e=i.show_only_matches),h===b&&(h=i.show_only_matches_children),!d&&j!==!1)return a.isFunction(j)?j.call(this,c,a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this),f):(j=a.extend({},j),j.data||(j.data={}),j.data.str=c,f&&(j.data.inside=f),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=a.ajax(j).fail(a.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(j)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this)),this._data.search.lastRequest);if(g||(this._data.search.str=c,this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=e,this._data.search.smc=h),l=new a.vakata.search(c,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),a.each(k[f?f:a.jstree.root].children_d,function(a,b){var d=k[b];d.text&&!d.state.hidden&&(!i.search_leaves_only||d.state.loaded&&0===d.children.length)&&(i.search_callback&&i.search_callback.call(this,c,d)||!i.search_callback&&l.search(d.text).isMatch)&&(m.push(b),n=n.concat(d.parents))}),m.length){for(n=a.vakata.array_unique(n),o=0,p=n.length;p>o;o++)n[o]!==a.jstree.root&&k[n[o]]&&this.open_node(n[o],null,0)===!0&&this._data.search.opn.push(n[o]);g?(this._data.search.dom=this._data.search.dom.add(a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=a.vakata.array_unique(this._data.search.res.concat(m))):(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=m),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:c,res:this._data.search.res,show_only_matches:e})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(this._data.search.res,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=a()},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments),b&&-1!==a.inArray(b.id,this._data.search.res)){var g,h,i=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(i.className+=" jstree-search")}return b}},function(a){a.vakata.search=function(b,c,d){d=d||{},d=a.extend({},a.vakata.search.defaults,d),d.fuzzy!==!1&&(d.fuzzy=!0),b=d.caseSensitive?b:b.toLowerCase();var e=d.location,f=d.distance,g=d.threshold,h=b.length,i,j,k,l;return h>32&&(d.fuzzy=!1),d.fuzzy&&(i=1<c;c++)a[b.charAt(c)]=0;for(c=0;h>c;c++)a[b.charAt(c)]|=1<c;c++){o=0,p=q;while(p>o)k(c,e+p)<=m?o=p:q=p,p=Math.floor((q-o)/2+o);for(q=p,s=Math.max(1,e-p+1),t=Math.min(e+p,l)+h,u=new Array(t+2),u[t+1]=(1<=s;f--)if(v=j[a.charAt(f-1)],0===c?u[f]=(u[f+1]<<1|1)&v:u[f]=(u[f+1]<<1|1)&v|((r[f+1]|r[f])<<1|1)|r[f+1],u[f]&i&&(w=k(c,f-1),m>=w)){if(m=w,n=f-1,x.push(n),!(n>e))break;s=Math.max(1,2*e-n)}if(k(c+1,e)>m)break;r=u}return{isMatch:n>=0,score:w}},c===!0?{search:l}:l(c)},a.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(a),a.jstree.defaults.sort=function(a,b){return this.get_text(a)>this.get_text(b)?1:-1},a.jstree.plugins.sort=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("model.jstree",a.proxy(function(a,b){this.sort(b.parent,!0)},this)).on("rename_node.jstree create_node.jstree",a.proxy(function(a,b){this.sort(b.parent||b.node.parent,!1),this.redraw_node(b.parent||b.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",a.proxy(function(a,b){this.sort(b.parent,!1),this.redraw_node(b.parent,!0)},this))},this.sort=function(b,c){var d,e;if(b=this.get_node(b),b&&b.children&&b.children.length&&(b.children.sort(a.proxy(this.settings.sort,this)),c))for(d=0,e=b.children_d.length;e>d;d++)this.sort(b.children_d[d],!1)}};var m=!1;a.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},a.jstree.plugins.state=function(b,c){this.bind=function(){c.bind.call(this);var b=a.proxy(function(){this.element.on(this.settings.state.events,a.proxy(function(){m&&clearTimeout(m),m=setTimeout(a.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",a.proxy(function(a,c){this.element.one("restore_state.jstree",b),this.restore_state()||b()},this))},this.save_state=function(){var b=this.get_state();this.settings.state.preserve_loaded||delete b.core.loaded;var c={state:b,ttl:this.settings.state.ttl,sec:+new Date};a.vakata.storage.set(this.settings.state.key,JSON.stringify(c))},this.restore_state=function(){var b=a.vakata.storage.get(this.settings.state.key);if(b)try{b=JSON.parse(b)}catch(c){return!1}return b&&b.ttl&&b.sec&&+new Date-b.sec>b.ttl?!1:(b&&b.state&&(b=b.state),b&&a.isFunction(this.settings.state.filter)&&(b=this.settings.state.filter.call(this,b)),b?(this.settings.state.preserve_loaded||delete b.core.loaded,this.element.one("set_state.jstree",function(c,d){d.instance.trigger("restore_state",{state:a.extend(!0,{},b)})}),this.set_state(b),!0):!1)},this.clear_state=function(){return a.vakata.storage.del(this.settings.state.key)}},function(a,b){a.vakata.storage={set:function(a,b){return window.localStorage.setItem(a,b)},get:function(a){return window.localStorage.getItem(a)},del:function(a){return window.localStorage.removeItem(a)}}}(a),a.jstree.defaults.types={"default":{}},a.jstree.defaults.types[a.jstree.root]={},a.jstree.plugins.types=function(c,d){this.init=function(c,e){var f,g;if(e&&e.types&&e.types["default"])for(f in e.types)if("default"!==f&&f!==a.jstree.root&&e.types.hasOwnProperty(f))for(g in e.types["default"])e.types["default"].hasOwnProperty(g)&&e.types[f][g]===b&&(e.types[f][g]=e.types["default"][g]);d.init.call(this,c,e),this._model.data[a.jstree.root].type=a.jstree.root},this.refresh=function(b,c){d.refresh.call(this,b,c),this._model.data[a.jstree.root].type=a.jstree.root},this.bind=function(){this.element.on("model.jstree",a.proxy(function(c,d){var e=this._model.data,f=d.nodes,g=this.settings.types,h,i,j="default",k;for(h=0,i=f.length;i>h;h++){if(j="default",e[f[h]].original&&e[f[h]].original.type&&g[e[f[h]].original.type]&&(j=e[f[h]].original.type),e[f[h]].data&&e[f[h]].data.jstree&&e[f[h]].data.jstree.type&&g[e[f[h]].data.jstree.type]&&(j=e[f[h]].data.jstree.type),e[f[h]].type=j,e[f[h]].icon===!0&&g[j].icon!==b&&(e[f[h]].icon=g[j].icon),g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]===b?e[f[h]].a_attr[k]=g[j].a_attr[k]:"href"===k&&"#"===e[f[h]].a_attr[k]?e[f[h]].a_attr.href=g[j].a_attr.href:"class"===k&&(e[f[h]].a_attr["class"]=g[j].a_attr["class"]+" "+e[f[h]].a_attr["class"])}}e[a.jstree.root].type=a.jstree.root},this)),d.bind.call(this)},this.get_json=function(b,c,e){var f,g,h=this._model.data,i=c?a.extend(!0,{},c,{no_id:!1}):{},j=d.get_json.call(this,b,i,e);if(j===!1)return!1;if(a.isArray(j))for(f=0,g=j.length;g>f;f++)j[f].type=j[f].id&&h[j[f].id]&&h[j[f].id].type?h[j[f].id].type:"default",c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id, +b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.children)&&(b.children=this._delete_ids(b.children)),b},this.check=function(c,e,f,g,h){if(d.check.call(this,c,e,f,g,h)===!1)return!1;e=e&&e.id?e:this.get_node(e),f=f&&f.id?f:this.get_node(f);var i=e&&e.id?h&&h.origin?h.origin:a.jstree.reference(e.id):null,j,k,l,m;switch(i=i&&i._model&&i._model.data?i._model.data:null,c){case"create_node":case"move_node":case"copy_node":if("move_node"!==c||-1===a.inArray(e.id,f.children)){if(j=this.get_rules(f),j.max_children!==b&&-1!==j.max_children&&j.max_children===f.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(j.valid_children!==b&&-1!==j.valid_children&&-1===a.inArray(e.type||"default",j.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(i&&e.children_d&&e.parents){for(k=0,l=0,m=e.children_d.length;m>l;l++)k=Math.max(k,i[e.children_d[l]].parents.length);k=k-e.parents.length+1}(0>=k||k===b)&&(k=1);do{if(j.max_depth!==b&&-1!==j.max_depth&&j.max_depthg;g++)this.set_type(c[g],d);return!0}if(f=this.settings.types,c=this.get_node(c),!f[d]||!c)return!1;if(l=this.get_node(c,!0),l&&l.length&&(m=l.children(".jstree-anchor")),i=c.type,j=this.get_icon(c),c.type=d,(j===!0||!f[i]||f[i].icon!==b&&j===f[i].icon)&&this.set_icon(c,f[d].icon!==b?f[d].icon:!0),f[i]&&f[i].li_attr!==b&&"object"==typeof f[i].li_attr)for(k in f[i].li_attr)if(f[i].li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].li_attr["class"]=(e[c.id].li_attr["class"]||"").replace(f[i].li_attr[k],""),l&&l.removeClass(f[i].li_attr[k])):e[c.id].li_attr[k]===f[i].li_attr[k]&&(e[c.id].li_attr[k]=null,l&&l.removeAttr(k))}if(f[i]&&f[i].a_attr!==b&&"object"==typeof f[i].a_attr)for(k in f[i].a_attr)if(f[i].a_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].a_attr["class"]=(e[c.id].a_attr["class"]||"").replace(f[i].a_attr[k],""),m&&m.removeClass(f[i].a_attr[k])):e[c.id].a_attr[k]===f[i].a_attr[k]&&("href"===k?(e[c.id].a_attr[k]="#",m&&m.attr("href","#")):(delete e[c.id].a_attr[k],m&&m.removeAttr(k)))}if(f[d].li_attr!==b&&"object"==typeof f[d].li_attr)for(k in f[d].li_attr)if(f[d].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].li_attr[k]===b?(e[c.id].li_attr[k]=f[d].li_attr[k],l&&("class"===k?l.addClass(f[d].li_attr[k]):l.attr(k,f[d].li_attr[k]))):"class"===k&&(e[c.id].li_attr["class"]=f[d].li_attr[k]+" "+e[c.id].li_attr["class"],l&&l.addClass(f[d].li_attr[k]))}if(f[d].a_attr!==b&&"object"==typeof f[d].a_attr)for(k in f[d].a_attr)if(f[d].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].a_attr[k]===b?(e[c.id].a_attr[k]=f[d].a_attr[k],m&&("class"===k?m.addClass(f[d].a_attr[k]):m.attr(k,f[d].a_attr[k]))):"href"===k&&"#"===e[c.id].a_attr[k]?(e[c.id].a_attr.href=f[d].a_attr.href,m&&m.attr("href",f[d].a_attr.href)):"class"===k&&(e[c.id].a_attr["class"]=f[d].a_attr["class"]+" "+e[c.id].a_attr["class"],m&&m.addClass(f[d].a_attr[k]))}return!0}},a.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(a,b){return a+" ("+b+")"}},a.jstree.plugins.unique=function(c,d){this.check=function(b,c,e,f,g){if(d.check.call(this,b,c,e,f,g)===!1)return!1;if(c=c&&c.id?c:this.get_node(c),e=e&&e.id?e:this.get_node(e),!e||!e.children)return!0;var h="rename_node"===b?f:c.text,i=[],j=this.settings.unique.case_sensitive,k=this.settings.unique.trim_whitespace,l=this._model.data,m,n,o;for(m=0,n=e.children.length;n>m;m++)o=l[e.children[m]].text,j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),i.push(o);switch(j||(h=h.toLowerCase()),k&&(h=h.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),b){case"delete_node":return!0;case"rename_node":return o=c.text||"",j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),m=-1===a.inArray(h,i)||c.text&&o===h,m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"create_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"copy_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"move_node":return m=c.parent===e.id&&(!g||!g.is_multi)||-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m}return!0},this.create_node=function(c,e,f,g,h){if(!e||e.text===b){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return d.create_node.call(this,c,e,f,g,h);if(f=f===b?"last":f,!f.toString().match(/^(before|after)$/)&&!h&&!this.is_loaded(c))return d.create_node.call(this,c,e,f,g,h);e||(e={});var i,j,k,l,m,n=this._model.data,o=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,q=this.settings.unique.duplicate,r;for(j=i=this.get_string("New node"),k=[],l=0,m=c.children.length;m>l;l++)r=n[c.children[l]].text,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),k.push(r);l=1,r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));while(-1!==a.inArray(r,k))j=q.call(this,i,++l).toString(),r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));e.text=j}return d.create_node.call(this,c,e,f,g,h)}};var n=i.createElement("DIV");if(n.setAttribute("unselectable","on"),n.setAttribute("role","presentation"),n.className="jstree-wholerow",n.innerHTML=" ",a.jstree.plugins.wholerow=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("ready.jstree set_state.jstree",a.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var c=!1,d,e;for(d=0,e=b.selected.length;e>d;d++)c=this.get_node(b.selected[d],!0),c&&c.length&&c.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",a.proxy(function(a,b){this.get_node(b.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",a.proxy(function(a,b){"hover_node"===a.type&&this.is_disabled(b.node)||this.get_node(b.node,!0).children(".jstree-wholerow")["hover_node"===a.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",a.proxy(function(b){if(this._data.contextmenu){b.preventDefault();var c=a.Event("contextmenu",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey,pageX:b.pageX,pageY:b.pageY});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c)}},this)).on("click.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("dblclick.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("dblclick",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",a.proxy(function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",a.proxy(function(a){return a.stopImmediatePropagation(),this.is_disabled(a.currentTarget)||this.hover_node(a.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),c.teardown.call(this)},this.redraw_node=function(b,d,e,f){if(b=c.redraw_node.apply(this,arguments)){var g=n.cloneNode(!0);-1!==a.inArray(b.id,this._data.core.selected)&&(g.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===b.id&&(g.className+=" jstree-wholerow-hovered"),b.insertBefore(g,b.childNodes[0])}return b}},window.customElements&&Object&&Object.create){var o=Object.create(HTMLElement.prototype);o.createdCallback=function(){var b={core:{},plugins:[]},c;for(c in a.jstree.plugins)a.jstree.plugins.hasOwnProperty(c)&&this.attributes[c]&&(b.plugins.push(c),this.getAttribute(c)&&JSON.parse(this.getAttribute(c))&&(b[c]=JSON.parse(this.getAttribute(c))));for(c in a.jstree.defaults.core)a.jstree.defaults.core.hasOwnProperty(c)&&this.attributes[c]&&(b.core[c]=JSON.parse(this.getAttribute(c))||this.getAttribute(c));a(this).jstree(b)};try{window.customElements.define("vakata-jstree",function(){},{prototype:o})}catch(p){}}}}); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/32px.png b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/32px.png new file mode 100644 index 0000000..6039572 Binary files /dev/null and b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/32px.png differ diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/40px.png b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/40px.png new file mode 100644 index 0000000..aae89ad Binary files /dev/null and b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/40px.png differ diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/style.css b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/style.css new file mode 100644 index 0000000..d8dc188 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/style.css @@ -0,0 +1,1146 @@ +/* jsTree default dark theme */ +.jstree-node, +.jstree-children, +.jstree-container-ul { + display: block; + margin: 0; + padding: 0; + list-style-type: none; + list-style-image: none; +} +.jstree-node { + white-space: nowrap; +} +.jstree-anchor { + display: inline-block; + color: black; + white-space: nowrap; + padding: 0 4px 0 1px; + margin: 0; + vertical-align: top; +} +.jstree-anchor:focus { + outline: 0; +} +.jstree-anchor, +.jstree-anchor:link, +.jstree-anchor:visited, +.jstree-anchor:hover, +.jstree-anchor:active { + text-decoration: none; + color: inherit; +} +.jstree-icon { + display: inline-block; + text-decoration: none; + margin: 0; + padding: 0; + vertical-align: top; + text-align: center; +} +.jstree-icon:empty { + display: inline-block; + text-decoration: none; + margin: 0; + padding: 0; + vertical-align: top; + text-align: center; +} +.jstree-ocl { + cursor: pointer; +} +.jstree-leaf > .jstree-ocl { + cursor: default; +} +.jstree .jstree-open > .jstree-children { + display: block; +} +.jstree .jstree-closed > .jstree-children, +.jstree .jstree-leaf > .jstree-children { + display: none; +} +.jstree-anchor > .jstree-themeicon { + margin-right: 2px; +} +.jstree-no-icons .jstree-themeicon, +.jstree-anchor > .jstree-themeicon-hidden { + display: none; +} +.jstree-hidden, +.jstree-node.jstree-hidden { + display: none; +} +.jstree-rtl .jstree-anchor { + padding: 0 1px 0 4px; +} +.jstree-rtl .jstree-anchor > .jstree-themeicon { + margin-left: 2px; + margin-right: 0; +} +.jstree-rtl .jstree-node { + margin-left: 0; +} +.jstree-rtl .jstree-container-ul > .jstree-node { + margin-right: 0; +} +.jstree-wholerow-ul { + position: relative; + display: inline-block; + min-width: 100%; +} +.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { + cursor: pointer; +} +.jstree-wholerow-ul .jstree-anchor, +.jstree-wholerow-ul .jstree-icon { + position: relative; +} +.jstree-wholerow-ul .jstree-wholerow { + width: 100%; + cursor: pointer; + position: absolute; + left: 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.jstree-contextmenu .jstree-anchor { + -webkit-user-select: none; + /* disable selection/Copy of UIWebView */ + -webkit-touch-callout: none; + /* disable the IOS popup when long-press on a link */ +} +.vakata-context { + display: none; +} +.vakata-context, +.vakata-context ul { + margin: 0; + padding: 2px; + position: absolute; + background: #f5f5f5; + border: 1px solid #979797; + box-shadow: 2px 2px 2px #999999; +} +.vakata-context ul { + list-style: none; + left: 100%; + margin-top: -2.7em; + margin-left: -4px; +} +.vakata-context .vakata-context-right ul { + left: auto; + right: 100%; + margin-left: auto; + margin-right: -4px; +} +.vakata-context li { + list-style: none; +} +.vakata-context li > a { + display: block; + padding: 0 2em 0 2em; + text-decoration: none; + width: auto; + color: black; + white-space: nowrap; + line-height: 2.4em; + text-shadow: 1px 1px 0 white; + border-radius: 1px; +} +.vakata-context li > a:hover { + position: relative; + background-color: #e8eff7; + box-shadow: 0 0 2px #0a6aa1; +} +.vakata-context li > a.vakata-context-parent { + background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); + background-position: right center; + background-repeat: no-repeat; +} +.vakata-context li > a:focus { + outline: 0; +} +.vakata-context .vakata-context-hover > a { + position: relative; + background-color: #e8eff7; + box-shadow: 0 0 2px #0a6aa1; +} +.vakata-context .vakata-context-separator > a, +.vakata-context .vakata-context-separator > a:hover { + background: white; + border: 0; + border-top: 1px solid #e2e3e3; + height: 1px; + min-height: 1px; + max-height: 1px; + padding: 0; + margin: 0 0 0 2.4em; + border-left: 1px solid #e0e0e0; + text-shadow: 0 0 0 transparent; + box-shadow: 0 0 0 transparent; + border-radius: 0; +} +.vakata-context .vakata-contextmenu-disabled a, +.vakata-context .vakata-contextmenu-disabled a:hover { + color: silver; + background-color: transparent; + border: 0; + box-shadow: 0 0 0; +} +.vakata-context .vakata-contextmenu-disabled > a > i { + filter: grayscale(100%); +} +.vakata-context li > a > i { + text-decoration: none; + display: inline-block; + width: 2.4em; + height: 2.4em; + background: transparent; + margin: 0 0 0 -2em; + vertical-align: top; + text-align: center; + line-height: 2.4em; +} +.vakata-context li > a > i:empty { + width: 2.4em; + line-height: 2.4em; +} +.vakata-context li > a .vakata-contextmenu-sep { + display: inline-block; + width: 1px; + height: 2.4em; + background: white; + margin: 0 0.5em 0 0; + border-left: 1px solid #e2e3e3; +} +.vakata-context .vakata-contextmenu-shortcut { + font-size: 0.8em; + color: silver; + opacity: 0.5; + display: none; +} +.vakata-context-rtl ul { + left: auto; + right: 100%; + margin-left: auto; + margin-right: -4px; +} +.vakata-context-rtl li > a.vakata-context-parent { + background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); + background-position: left center; + background-repeat: no-repeat; +} +.vakata-context-rtl .vakata-context-separator > a { + margin: 0 2.4em 0 0; + border-left: 0; + border-right: 1px solid #e2e3e3; +} +.vakata-context-rtl .vakata-context-left ul { + right: auto; + left: 100%; + margin-left: -4px; + margin-right: auto; +} +.vakata-context-rtl li > a > i { + margin: 0 -2em 0 0; +} +.vakata-context-rtl li > a .vakata-contextmenu-sep { + margin: 0 0 0 0.5em; + border-left-color: white; + background: #e2e3e3; +} +#jstree-marker { + position: absolute; + top: 0; + left: 0; + margin: -5px 0 0 0; + padding: 0; + border-right: 0; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid; + width: 0; + height: 0; + font-size: 0; + line-height: 0; +} +#jstree-dnd { + line-height: 16px; + margin: 0; + padding: 4px; +} +#jstree-dnd .jstree-icon, +#jstree-dnd .jstree-copy { + display: inline-block; + text-decoration: none; + margin: 0 2px 0 0; + padding: 0; + width: 16px; + height: 16px; +} +#jstree-dnd .jstree-ok { + background: green; +} +#jstree-dnd .jstree-er { + background: red; +} +#jstree-dnd .jstree-copy { + margin: 0 2px 0 2px; +} +.jstree-default-dark .jstree-node, +.jstree-default-dark .jstree-icon { + background-repeat: no-repeat; + background-color: transparent; +} +.jstree-default-dark .jstree-anchor, +.jstree-default-dark .jstree-animated, +.jstree-default-dark .jstree-wholerow { + transition: background-color 0.15s, box-shadow 0.15s; +} +.jstree-default-dark .jstree-hovered { + background: #555; + border-radius: 2px; + box-shadow: inset 0 0 1px #555; +} +.jstree-default-dark .jstree-context { + background: #555; + border-radius: 2px; + box-shadow: inset 0 0 1px #555; +} +.jstree-default-dark .jstree-clicked { + background: #5fa2db; + border-radius: 2px; + box-shadow: inset 0 0 1px #666666; +} +.jstree-default-dark .jstree-no-icons .jstree-anchor > .jstree-themeicon { + display: none; +} +.jstree-default-dark .jstree-disabled { + background: transparent; + color: #666666; +} +.jstree-default-dark .jstree-disabled.jstree-hovered { + background: transparent; + box-shadow: none; +} +.jstree-default-dark .jstree-disabled.jstree-clicked { + background: #333333; +} +.jstree-default-dark .jstree-disabled > .jstree-icon { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default-dark .jstree-search { + font-style: italic; + color: #ffffff; + font-weight: bold; +} +.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox { + display: none !important; +} +.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked { + background: transparent; + box-shadow: none; +} +.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { + background: #555; +} +.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { + background: transparent; +} +.jstree-default-dark.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { + background: #555; +} +.jstree-default-dark > .jstree-striped { + min-width: 100%; + display: inline-block; + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; +} +.jstree-default-dark > .jstree-wholerow-ul .jstree-hovered, +.jstree-default-dark > .jstree-wholerow-ul .jstree-clicked { + background: transparent; + box-shadow: none; + border-radius: 0; +} +.jstree-default-dark .jstree-wholerow { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.jstree-default-dark .jstree-wholerow-hovered { + background: #555; +} +.jstree-default-dark .jstree-wholerow-clicked { + background: #5fa2db; + background: -webkit-linear-gradient(top, #5fa2db 0%, #5fa2db 100%); + background: linear-gradient(to bottom, #5fa2db 0%, #5fa2db 100%); +} +.jstree-default-dark .jstree-node { + min-height: 24px; + line-height: 24px; + margin-left: 24px; + min-width: 24px; +} +.jstree-default-dark .jstree-anchor { + line-height: 24px; + height: 24px; +} +.jstree-default-dark .jstree-icon { + width: 24px; + height: 24px; + line-height: 24px; +} +.jstree-default-dark .jstree-icon:empty { + width: 24px; + height: 24px; + line-height: 24px; +} +.jstree-default-dark.jstree-rtl .jstree-node { + margin-right: 24px; +} +.jstree-default-dark .jstree-wholerow { + height: 24px; +} +.jstree-default-dark .jstree-node, +.jstree-default-dark .jstree-icon { + background-image: url("32px.png"); +} +.jstree-default-dark .jstree-node { + background-position: -292px -4px; + background-repeat: repeat-y; +} +.jstree-default-dark .jstree-last { + background: transparent; +} +.jstree-default-dark .jstree-open > .jstree-ocl { + background-position: -132px -4px; +} +.jstree-default-dark .jstree-closed > .jstree-ocl { + background-position: -100px -4px; +} +.jstree-default-dark .jstree-leaf > .jstree-ocl { + background-position: -68px -4px; +} +.jstree-default-dark .jstree-themeicon { + background-position: -260px -4px; +} +.jstree-default-dark > .jstree-no-dots .jstree-node, +.jstree-default-dark > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-dark > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -36px -4px; +} +.jstree-default-dark > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -4px -4px; +} +.jstree-default-dark .jstree-disabled { + background: transparent; +} +.jstree-default-dark .jstree-disabled.jstree-hovered { + background: transparent; +} +.jstree-default-dark .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default-dark .jstree-checkbox { + background-position: -164px -4px; +} +.jstree-default-dark .jstree-checkbox:hover { + background-position: -164px -36px; +} +.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, +.jstree-default-dark .jstree-checked > .jstree-checkbox { + background-position: -228px -4px; +} +.jstree-default-dark.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, +.jstree-default-dark .jstree-checked > .jstree-checkbox:hover { + background-position: -228px -36px; +} +.jstree-default-dark .jstree-anchor > .jstree-undetermined { + background-position: -196px -4px; +} +.jstree-default-dark .jstree-anchor > .jstree-undetermined:hover { + background-position: -196px -36px; +} +.jstree-default-dark .jstree-checkbox-disabled { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default-dark > .jstree-striped { + background-size: auto 48px; +} +.jstree-default-dark.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); + background-position: 100% 1px; + background-repeat: repeat-y; +} +.jstree-default-dark.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark.jstree-rtl .jstree-open > .jstree-ocl { + background-position: -132px -36px; +} +.jstree-default-dark.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -100px -36px; +} +.jstree-default-dark.jstree-rtl .jstree-leaf > .jstree-ocl { + background-position: -68px -36px; +} +.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-node, +.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -36px -36px; +} +.jstree-default-dark.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -4px -36px; +} +.jstree-default-dark .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; +} +.jstree-default-dark > .jstree-container-ul .jstree-loading > .jstree-ocl { + background: url("throbber.gif") center center no-repeat; +} +.jstree-default-dark .jstree-file { + background: url("32px.png") -100px -68px no-repeat; +} +.jstree-default-dark .jstree-folder { + background: url("32px.png") -260px -4px no-repeat; +} +.jstree-default-dark > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; +} +#jstree-dnd.jstree-default-dark { + line-height: 24px; + padding: 0 4px; +} +#jstree-dnd.jstree-default-dark .jstree-ok, +#jstree-dnd.jstree-default-dark .jstree-er { + background-image: url("32px.png"); + background-repeat: no-repeat; + background-color: transparent; +} +#jstree-dnd.jstree-default-dark i { + background: transparent; + width: 24px; + height: 24px; + line-height: 24px; +} +#jstree-dnd.jstree-default-dark .jstree-ok { + background-position: -4px -68px; +} +#jstree-dnd.jstree-default-dark .jstree-er { + background-position: -36px -68px; +} +.jstree-default-dark .jstree-ellipsis { + overflow: hidden; +} +.jstree-default-dark .jstree-ellipsis .jstree-anchor { + width: calc(100% - 29px); + text-overflow: ellipsis; + overflow: hidden; +} +.jstree-default-dark.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); +} +.jstree-default-dark.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark-small .jstree-node { + min-height: 18px; + line-height: 18px; + margin-left: 18px; + min-width: 18px; +} +.jstree-default-dark-small .jstree-anchor { + line-height: 18px; + height: 18px; +} +.jstree-default-dark-small .jstree-icon { + width: 18px; + height: 18px; + line-height: 18px; +} +.jstree-default-dark-small .jstree-icon:empty { + width: 18px; + height: 18px; + line-height: 18px; +} +.jstree-default-dark-small.jstree-rtl .jstree-node { + margin-right: 18px; +} +.jstree-default-dark-small .jstree-wholerow { + height: 18px; +} +.jstree-default-dark-small .jstree-node, +.jstree-default-dark-small .jstree-icon { + background-image: url("32px.png"); +} +.jstree-default-dark-small .jstree-node { + background-position: -295px -7px; + background-repeat: repeat-y; +} +.jstree-default-dark-small .jstree-last { + background: transparent; +} +.jstree-default-dark-small .jstree-open > .jstree-ocl { + background-position: -135px -7px; +} +.jstree-default-dark-small .jstree-closed > .jstree-ocl { + background-position: -103px -7px; +} +.jstree-default-dark-small .jstree-leaf > .jstree-ocl { + background-position: -71px -7px; +} +.jstree-default-dark-small .jstree-themeicon { + background-position: -263px -7px; +} +.jstree-default-dark-small > .jstree-no-dots .jstree-node, +.jstree-default-dark-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-dark-small > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -39px -7px; +} +.jstree-default-dark-small > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -7px -7px; +} +.jstree-default-dark-small .jstree-disabled { + background: transparent; +} +.jstree-default-dark-small .jstree-disabled.jstree-hovered { + background: transparent; +} +.jstree-default-dark-small .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default-dark-small .jstree-checkbox { + background-position: -167px -7px; +} +.jstree-default-dark-small .jstree-checkbox:hover { + background-position: -167px -39px; +} +.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, +.jstree-default-dark-small .jstree-checked > .jstree-checkbox { + background-position: -231px -7px; +} +.jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, +.jstree-default-dark-small .jstree-checked > .jstree-checkbox:hover { + background-position: -231px -39px; +} +.jstree-default-dark-small .jstree-anchor > .jstree-undetermined { + background-position: -199px -7px; +} +.jstree-default-dark-small .jstree-anchor > .jstree-undetermined:hover { + background-position: -199px -39px; +} +.jstree-default-dark-small .jstree-checkbox-disabled { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default-dark-small > .jstree-striped { + background-size: auto 36px; +} +.jstree-default-dark-small.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); + background-position: 100% 1px; + background-repeat: repeat-y; +} +.jstree-default-dark-small.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark-small.jstree-rtl .jstree-open > .jstree-ocl { + background-position: -135px -39px; +} +.jstree-default-dark-small.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -103px -39px; +} +.jstree-default-dark-small.jstree-rtl .jstree-leaf > .jstree-ocl { + background-position: -71px -39px; +} +.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-node, +.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -39px -39px; +} +.jstree-default-dark-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -7px -39px; +} +.jstree-default-dark-small .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; +} +.jstree-default-dark-small > .jstree-container-ul .jstree-loading > .jstree-ocl { + background: url("throbber.gif") center center no-repeat; +} +.jstree-default-dark-small .jstree-file { + background: url("32px.png") -103px -71px no-repeat; +} +.jstree-default-dark-small .jstree-folder { + background: url("32px.png") -263px -7px no-repeat; +} +.jstree-default-dark-small > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; +} +#jstree-dnd.jstree-default-dark-small { + line-height: 18px; + padding: 0 4px; +} +#jstree-dnd.jstree-default-dark-small .jstree-ok, +#jstree-dnd.jstree-default-dark-small .jstree-er { + background-image: url("32px.png"); + background-repeat: no-repeat; + background-color: transparent; +} +#jstree-dnd.jstree-default-dark-small i { + background: transparent; + width: 18px; + height: 18px; + line-height: 18px; +} +#jstree-dnd.jstree-default-dark-small .jstree-ok { + background-position: -7px -71px; +} +#jstree-dnd.jstree-default-dark-small .jstree-er { + background-position: -39px -71px; +} +.jstree-default-dark-small .jstree-ellipsis { + overflow: hidden; +} +.jstree-default-dark-small .jstree-ellipsis .jstree-anchor { + width: calc(100% - 23px); + text-overflow: ellipsis; + overflow: hidden; +} +.jstree-default-dark-small.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); +} +.jstree-default-dark-small.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark-large .jstree-node { + min-height: 32px; + line-height: 32px; + margin-left: 32px; + min-width: 32px; +} +.jstree-default-dark-large .jstree-anchor { + line-height: 32px; + height: 32px; +} +.jstree-default-dark-large .jstree-icon { + width: 32px; + height: 32px; + line-height: 32px; +} +.jstree-default-dark-large .jstree-icon:empty { + width: 32px; + height: 32px; + line-height: 32px; +} +.jstree-default-dark-large.jstree-rtl .jstree-node { + margin-right: 32px; +} +.jstree-default-dark-large .jstree-wholerow { + height: 32px; +} +.jstree-default-dark-large .jstree-node, +.jstree-default-dark-large .jstree-icon { + background-image: url("32px.png"); +} +.jstree-default-dark-large .jstree-node { + background-position: -288px 0px; + background-repeat: repeat-y; +} +.jstree-default-dark-large .jstree-last { + background: transparent; +} +.jstree-default-dark-large .jstree-open > .jstree-ocl { + background-position: -128px 0px; +} +.jstree-default-dark-large .jstree-closed > .jstree-ocl { + background-position: -96px 0px; +} +.jstree-default-dark-large .jstree-leaf > .jstree-ocl { + background-position: -64px 0px; +} +.jstree-default-dark-large .jstree-themeicon { + background-position: -256px 0px; +} +.jstree-default-dark-large > .jstree-no-dots .jstree-node, +.jstree-default-dark-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-dark-large > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -32px 0px; +} +.jstree-default-dark-large > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: 0px 0px; +} +.jstree-default-dark-large .jstree-disabled { + background: transparent; +} +.jstree-default-dark-large .jstree-disabled.jstree-hovered { + background: transparent; +} +.jstree-default-dark-large .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default-dark-large .jstree-checkbox { + background-position: -160px 0px; +} +.jstree-default-dark-large .jstree-checkbox:hover { + background-position: -160px -32px; +} +.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, +.jstree-default-dark-large .jstree-checked > .jstree-checkbox { + background-position: -224px 0px; +} +.jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, +.jstree-default-dark-large .jstree-checked > .jstree-checkbox:hover { + background-position: -224px -32px; +} +.jstree-default-dark-large .jstree-anchor > .jstree-undetermined { + background-position: -192px 0px; +} +.jstree-default-dark-large .jstree-anchor > .jstree-undetermined:hover { + background-position: -192px -32px; +} +.jstree-default-dark-large .jstree-checkbox-disabled { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default-dark-large > .jstree-striped { + background-size: auto 64px; +} +.jstree-default-dark-large.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); + background-position: 100% 1px; + background-repeat: repeat-y; +} +.jstree-default-dark-large.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark-large.jstree-rtl .jstree-open > .jstree-ocl { + background-position: -128px -32px; +} +.jstree-default-dark-large.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -96px -32px; +} +.jstree-default-dark-large.jstree-rtl .jstree-leaf > .jstree-ocl { + background-position: -64px -32px; +} +.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-node, +.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -32px -32px; +} +.jstree-default-dark-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: 0px -32px; +} +.jstree-default-dark-large .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; +} +.jstree-default-dark-large > .jstree-container-ul .jstree-loading > .jstree-ocl { + background: url("throbber.gif") center center no-repeat; +} +.jstree-default-dark-large .jstree-file { + background: url("32px.png") -96px -64px no-repeat; +} +.jstree-default-dark-large .jstree-folder { + background: url("32px.png") -256px 0px no-repeat; +} +.jstree-default-dark-large > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; +} +#jstree-dnd.jstree-default-dark-large { + line-height: 32px; + padding: 0 4px; +} +#jstree-dnd.jstree-default-dark-large .jstree-ok, +#jstree-dnd.jstree-default-dark-large .jstree-er { + background-image: url("32px.png"); + background-repeat: no-repeat; + background-color: transparent; +} +#jstree-dnd.jstree-default-dark-large i { + background: transparent; + width: 32px; + height: 32px; + line-height: 32px; +} +#jstree-dnd.jstree-default-dark-large .jstree-ok { + background-position: 0px -64px; +} +#jstree-dnd.jstree-default-dark-large .jstree-er { + background-position: -32px -64px; +} +.jstree-default-dark-large .jstree-ellipsis { + overflow: hidden; +} +.jstree-default-dark-large .jstree-ellipsis .jstree-anchor { + width: calc(100% - 37px); + text-overflow: ellipsis; + overflow: hidden; +} +.jstree-default-dark-large.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); +} +.jstree-default-dark-large.jstree-rtl .jstree-last { + background: transparent; +} +@media (max-width: 768px) { + #jstree-dnd.jstree-dnd-responsive { + line-height: 40px; + font-weight: bold; + font-size: 1.1em; + text-shadow: 1px 1px white; + } + #jstree-dnd.jstree-dnd-responsive > i { + background: transparent; + width: 40px; + height: 40px; + } + #jstree-dnd.jstree-dnd-responsive > .jstree-ok { + background-image: url("40px.png"); + background-position: 0 -200px; + background-size: 120px 240px; + } + #jstree-dnd.jstree-dnd-responsive > .jstree-er { + background-image: url("40px.png"); + background-position: -40px -200px; + background-size: 120px 240px; + } + #jstree-marker.jstree-dnd-responsive { + border-left-width: 10px; + border-top-width: 10px; + border-bottom-width: 10px; + margin-top: -10px; + } +} +@media (max-width: 768px) { + .jstree-default-dark-responsive { + /* + .jstree-open > .jstree-ocl, + .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } + */ + } + .jstree-default-dark-responsive .jstree-icon { + background-image: url("40px.png"); + } + .jstree-default-dark-responsive .jstree-node, + .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { + background: transparent; + } + .jstree-default-dark-responsive .jstree-node { + min-height: 40px; + line-height: 40px; + margin-left: 40px; + min-width: 40px; + white-space: nowrap; + } + .jstree-default-dark-responsive .jstree-anchor { + line-height: 40px; + height: 40px; + } + .jstree-default-dark-responsive .jstree-icon, + .jstree-default-dark-responsive .jstree-icon:empty { + width: 40px; + height: 40px; + line-height: 40px; + } + .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { + margin-left: 0; + } + .jstree-default-dark-responsive.jstree-rtl .jstree-node { + margin-left: 0; + margin-right: 40px; + background: transparent; + } + .jstree-default-dark-responsive.jstree-rtl .jstree-container-ul > .jstree-node { + margin-right: 0; + } + .jstree-default-dark-responsive .jstree-ocl, + .jstree-default-dark-responsive .jstree-themeicon, + .jstree-default-dark-responsive .jstree-checkbox { + background-size: 120px 240px; + } + .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl, + .jstree-default-dark-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { + background: transparent; + } + .jstree-default-dark-responsive .jstree-open > .jstree-ocl { + background-position: 0 0 !important; + } + .jstree-default-dark-responsive .jstree-closed > .jstree-ocl { + background-position: 0 -40px !important; + } + .jstree-default-dark-responsive.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -40px 0 !important; + } + .jstree-default-dark-responsive .jstree-themeicon { + background-position: -40px -40px; + } + .jstree-default-dark-responsive .jstree-checkbox, + .jstree-default-dark-responsive .jstree-checkbox:hover { + background-position: -40px -80px; + } + .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, + .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, + .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox, + .jstree-default-dark-responsive .jstree-checked > .jstree-checkbox:hover { + background-position: 0 -80px; + } + .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined, + .jstree-default-dark-responsive .jstree-anchor > .jstree-undetermined:hover { + background-position: 0 -120px; + } + .jstree-default-dark-responsive .jstree-anchor { + font-weight: bold; + font-size: 1.1em; + text-shadow: 1px 1px white; + } + .jstree-default-dark-responsive > .jstree-striped { + background: transparent; + } + .jstree-default-dark-responsive .jstree-wholerow { + border-top: 1px solid #666; + border-bottom: 1px solid #000; + background: #333333; + height: 40px; + } + .jstree-default-dark-responsive .jstree-wholerow-hovered { + background: #555; + } + .jstree-default-dark-responsive .jstree-wholerow-clicked { + background: #5fa2db; + } + .jstree-default-dark-responsive .jstree-children .jstree-last > .jstree-wholerow { + box-shadow: inset 0 -6px 3px -5px #111111; + } + .jstree-default-dark-responsive .jstree-children .jstree-open > .jstree-wholerow { + box-shadow: inset 0 6px 3px -5px #111111; + border-top: 0; + } + .jstree-default-dark-responsive .jstree-children .jstree-open + .jstree-open { + box-shadow: none; + } + .jstree-default-dark-responsive .jstree-node, + .jstree-default-dark-responsive .jstree-icon, + .jstree-default-dark-responsive .jstree-node > .jstree-ocl, + .jstree-default-dark-responsive .jstree-themeicon, + .jstree-default-dark-responsive .jstree-checkbox { + background-image: url("40px.png"); + background-size: 120px 240px; + } + .jstree-default-dark-responsive .jstree-node { + background-position: -80px 0; + background-repeat: repeat-y; + } + .jstree-default-dark-responsive .jstree-last { + background: transparent; + } + .jstree-default-dark-responsive .jstree-leaf > .jstree-ocl { + background-position: -40px -120px; + } + .jstree-default-dark-responsive .jstree-last > .jstree-ocl { + background-position: -40px -160px; + } + .jstree-default-dark-responsive .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; + } + .jstree-default-dark-responsive .jstree-file { + background: url("40px.png") 0 -160px no-repeat; + background-size: 120px 240px; + } + .jstree-default-dark-responsive .jstree-folder { + background: url("40px.png") -40px -40px no-repeat; + background-size: 120px 240px; + } + .jstree-default-dark-responsive > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; + } +} +.jstree-default-dark { + background: #333; +} +.jstree-default-dark .jstree-anchor { + color: #999; + text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); +} +.jstree-default-dark .jstree-clicked, +.jstree-default-dark .jstree-checked { + color: white; +} +.jstree-default-dark .jstree-hovered { + color: white; +} +#jstree-marker.jstree-default-dark { + border-left-color: #999; + background: transparent; +} +.jstree-default-dark .jstree-anchor > .jstree-icon { + opacity: 0.75; +} +.jstree-default-dark .jstree-clicked > .jstree-icon, +.jstree-default-dark .jstree-hovered > .jstree-icon, +.jstree-default-dark .jstree-checked > .jstree-icon { + opacity: 1; +} +.jstree-default-dark.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); +} +.jstree-default-dark.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark-small.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); +} +.jstree-default-dark-small.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-dark-large.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); +} +.jstree-default-dark-large.jstree-rtl .jstree-last { + background: transparent; +} diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/style.min.css b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/style.min.css new file mode 100644 index 0000000..5d75b2a --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/style.min.css @@ -0,0 +1 @@ +.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default-dark .jstree-anchor,.jstree-default-dark .jstree-animated,.jstree-default-dark .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default-dark .jstree-hovered{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-context{background:#555;border-radius:2px;box-shadow:inset 0 0 1px #555}.jstree-default-dark .jstree-clicked{background:#5fa2db;border-radius:2px;box-shadow:inset 0 0 1px #666666}.jstree-default-dark .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default-dark .jstree-disabled{background:transparent;color:#666666}.jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default-dark .jstree-disabled.jstree-clicked{background:#333333}.jstree-default-dark .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default-dark .jstree-search{font-style:italic;color:#ffffff;font-weight:bold}.jstree-default-dark .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default-dark.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#555}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default-dark.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#555}.jstree-default-dark>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default-dark>.jstree-wholerow-ul .jstree-hovered,.jstree-default-dark>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default-dark .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default-dark .jstree-wholerow-hovered{background:#555}.jstree-default-dark .jstree-wholerow-clicked{background:#5fa2db;background:-webkit-linear-gradient(top, #5fa2db 0, #5fa2db 100%);background:linear-gradient(to bottom, #5fa2db 0, #5fa2db 100%)}.jstree-default-dark .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default-dark .jstree-anchor{line-height:24px;height:24px}.jstree-default-dark .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default-dark .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default-dark.jstree-rtl .jstree-node{margin-right:24px}.jstree-default-dark .jstree-wholerow{height:24px}.jstree-default-dark .jstree-node,.jstree-default-dark .jstree-icon{background-image:url("32px.png")} .jstree-default-dark .jstree-node{background-position:-292px -4px;background-repeat:repeat-y} .jstree-default-dark .jstree-last{background:transparent} .jstree-default-dark .jstree-open>.jstree-ocl{background-position:-132px -4px} .jstree-default-dark .jstree-closed>.jstree-ocl{background-position:-100px -4px} .jstree-default-dark .jstree-leaf>.jstree-ocl{background-position:-68px -4px} .jstree-default-dark .jstree-themeicon{background-position:-260px -4px} .jstree-default-dark>.jstree-no-dots .jstree-node,.jstree-default-dark>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px} .jstree-default-dark>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px} .jstree-default-dark .jstree-disabled{background:transparent} .jstree-default-dark .jstree-disabled.jstree-hovered{background:transparent} .jstree-default-dark .jstree-disabled.jstree-clicked{background:#efefef} .jstree-default-dark .jstree-checkbox{background-position:-164px -4px} .jstree-default-dark .jstree-checkbox:hover{background-position:-164px -36px} .jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark .jstree-checked>.jstree-checkbox{background-position:-228px -4px} .jstree-default-dark.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px} .jstree-default-dark .jstree-anchor>.jstree-undetermined{background-position:-196px -4px} .jstree-default-dark .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px} .jstree-default-dark .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)} .jstree-default-dark>.jstree-striped{background-size:auto 48px} .jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y} .jstree-default-dark.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px} .jstree-default-dark.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px} .jstree-default-dark.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px} .jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px} .jstree-default-dark.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px} .jstree-default-dark .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-dark>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat} .jstree-default-dark .jstree-file{background:url("32px.png") -100px -68px no-repeat} .jstree-default-dark .jstree-folder{background:url("32px.png") -260px -4px no-repeat} .jstree-default-dark>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0} #jstree-dnd.jstree-default-dark{line-height:24px;padding:0 4px} #jstree-dnd.jstree-default-dark .jstree-ok,#jstree-dnd.jstree-default-dark .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent} #jstree-dnd.jstree-default-dark i{background:transparent;width:24px;height:24px;line-height:24px} #jstree-dnd.jstree-default-dark .jstree-ok{background-position:-4px -68px} #jstree-dnd.jstree-default-dark .jstree-er{background-position:-36px -68px} .jstree-default-dark .jstree-ellipsis{overflow:hidden} .jstree-default-dark .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden} .jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")} .jstree-default-dark.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px} .jstree-default-dark-small .jstree-anchor{line-height:18px;height:18px} .jstree-default-dark-small .jstree-icon{width:18px;height:18px;line-height:18px} .jstree-default-dark-small .jstree-icon:empty{width:18px;height:18px;line-height:18px} .jstree-default-dark-small.jstree-rtl .jstree-node{margin-right:18px} .jstree-default-dark-small .jstree-wholerow{height:18px} .jstree-default-dark-small .jstree-node,.jstree-default-dark-small .jstree-icon{background-image:url("32px.png")} .jstree-default-dark-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y} .jstree-default-dark-small .jstree-last{background:transparent} .jstree-default-dark-small .jstree-open>.jstree-ocl{background-position:-135px -7px} .jstree-default-dark-small .jstree-closed>.jstree-ocl{background-position:-103px -7px} .jstree-default-dark-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px} .jstree-default-dark-small .jstree-themeicon{background-position:-263px -7px} .jstree-default-dark-small>.jstree-no-dots .jstree-node,.jstree-default-dark-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px} .jstree-default-dark-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px} .jstree-default-dark-small .jstree-disabled{background:transparent} .jstree-default-dark-small .jstree-disabled.jstree-hovered{background:transparent} .jstree-default-dark-small .jstree-disabled.jstree-clicked{background:#efefef} .jstree-default-dark-small .jstree-checkbox{background-position:-167px -7px} .jstree-default-dark-small .jstree-checkbox:hover{background-position:-167px -39px} .jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px} .jstree-default-dark-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px} .jstree-default-dark-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px} .jstree-default-dark-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px} .jstree-default-dark-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)} .jstree-default-dark-small>.jstree-striped{background-size:auto 36px} .jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y} .jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px} .jstree-default-dark-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px} .jstree-default-dark-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px} .jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px} .jstree-default-dark-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px} .jstree-default-dark-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-dark-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat} .jstree-default-dark-small .jstree-file{background:url("32px.png") -103px -71px no-repeat} .jstree-default-dark-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat} .jstree-default-dark-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0} #jstree-dnd.jstree-default-dark-small{line-height:18px;padding:0 4px} #jstree-dnd.jstree-default-dark-small .jstree-ok,#jstree-dnd.jstree-default-dark-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent} #jstree-dnd.jstree-default-dark-small i{background:transparent;width:18px;height:18px;line-height:18px} #jstree-dnd.jstree-default-dark-small .jstree-ok{background-position:-7px -71px} #jstree-dnd.jstree-default-dark-small .jstree-er{background-position:-39px -71px} .jstree-default-dark-small .jstree-ellipsis{overflow:hidden} .jstree-default-dark-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden} .jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")} .jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px} .jstree-default-dark-large .jstree-anchor{line-height:32px;height:32px} .jstree-default-dark-large .jstree-icon{width:32px;height:32px;line-height:32px} .jstree-default-dark-large .jstree-icon:empty{width:32px;height:32px;line-height:32px} .jstree-default-dark-large.jstree-rtl .jstree-node{margin-right:32px} .jstree-default-dark-large .jstree-wholerow{height:32px} .jstree-default-dark-large .jstree-node,.jstree-default-dark-large .jstree-icon{background-image:url("32px.png")} .jstree-default-dark-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y} .jstree-default-dark-large .jstree-last{background:transparent} .jstree-default-dark-large .jstree-open>.jstree-ocl{background-position:-128px 0} .jstree-default-dark-large .jstree-closed>.jstree-ocl{background-position:-96px 0} .jstree-default-dark-large .jstree-leaf>.jstree-ocl{background-position:-64px 0} .jstree-default-dark-large .jstree-themeicon{background-position:-256px 0} .jstree-default-dark-large>.jstree-no-dots .jstree-node,.jstree-default-dark-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0} .jstree-default-dark-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0} .jstree-default-dark-large .jstree-disabled{background:transparent} .jstree-default-dark-large .jstree-disabled.jstree-hovered{background:transparent} .jstree-default-dark-large .jstree-disabled.jstree-clicked{background:#efefef} .jstree-default-dark-large .jstree-checkbox{background-position:-160px 0} .jstree-default-dark-large .jstree-checkbox:hover{background-position:-160px -32px} .jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-large .jstree-checked>.jstree-checkbox{background-position:-224px 0} .jstree-default-dark-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px} .jstree-default-dark-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0} .jstree-default-dark-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px} .jstree-default-dark-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)} .jstree-default-dark-large>.jstree-striped{background-size:auto 64px} .jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y} .jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px} .jstree-default-dark-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px} .jstree-default-dark-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px} .jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px} .jstree-default-dark-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px} .jstree-default-dark-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-dark-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat} .jstree-default-dark-large .jstree-file{background:url("32px.png") -96px -64px no-repeat} .jstree-default-dark-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat} .jstree-default-dark-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0} #jstree-dnd.jstree-default-dark-large{line-height:32px;padding:0 4px} #jstree-dnd.jstree-default-dark-large .jstree-ok,#jstree-dnd.jstree-default-dark-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent} #jstree-dnd.jstree-default-dark-large i{background:transparent;width:32px;height:32px;line-height:32px} #jstree-dnd.jstree-default-dark-large .jstree-ok{background-position:0 -64px} #jstree-dnd.jstree-default-dark-large .jstree-er{background-position:-32px -64px} .jstree-default-dark-large .jstree-ellipsis{overflow:hidden} .jstree-default-dark-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden} .jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")} .jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white} #jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px} #jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px} #jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px} #jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-dark-responsive .jstree-icon{background-image:url("40px.png")} .jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap} .jstree-default-dark-responsive .jstree-anchor{line-height:40px;height:40px} .jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px} .jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0} .jstree-default-dark-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent} .jstree-default-dark-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0} .jstree-default-dark-responsive .jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-size:120px 240px} .jstree-default-dark-responsive .jstree-leaf>.jstree-ocl,.jstree-default-dark-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-dark-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important} .jstree-default-dark-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important} .jstree-default-dark-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important} .jstree-default-dark-responsive .jstree-themeicon{background-position:-40px -40px} .jstree-default-dark-responsive .jstree-checkbox,.jstree-default-dark-responsive .jstree-checkbox:hover{background-position:-40px -80px} .jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-dark-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox,.jstree-default-dark-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px} .jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-dark-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px} .jstree-default-dark-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white} .jstree-default-dark-responsive>.jstree-striped{background:transparent} .jstree-default-dark-responsive .jstree-wholerow{border-top:1px solid #666;border-bottom:1px solid #000;background:#333333;height:40px} .jstree-default-dark-responsive .jstree-wholerow-hovered{background:#555} .jstree-default-dark-responsive .jstree-wholerow-clicked{background:#5fa2db} .jstree-default-dark-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #111111} .jstree-default-dark-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #111111;border-top:0} .jstree-default-dark-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none} .jstree-default-dark-responsive .jstree-node,.jstree-default-dark-responsive .jstree-icon,.jstree-default-dark-responsive .jstree-node>.jstree-ocl,.jstree-default-dark-responsive .jstree-themeicon,.jstree-default-dark-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px} .jstree-default-dark-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y} .jstree-default-dark-responsive .jstree-last{background:transparent} .jstree-default-dark-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px} .jstree-default-dark-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px} .jstree-default-dark-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-dark-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px} .jstree-default-dark-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px} .jstree-default-dark-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}} .jstree-default-dark{background:#333} .jstree-default-dark .jstree-anchor{color:#999;text-shadow:1px 1px 0 rgba(0,0,0,0.5)} .jstree-default-dark .jstree-clicked,.jstree-default-dark .jstree-checked{color:white} .jstree-default-dark .jstree-hovered{color:white} #jstree-marker.jstree-default-dark{border-left-color:#999;background:transparent} .jstree-default-dark .jstree-anchor>.jstree-icon{opacity:.75} .jstree-default-dark .jstree-clicked>.jstree-icon,.jstree-default-dark .jstree-hovered>.jstree-icon,.jstree-default-dark .jstree-checked>.jstree-icon{opacity:1} .jstree-default-dark.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")} .jstree-default-dark.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")} .jstree-default-dark-small.jstree-rtl .jstree-last{background:transparent} .jstree-default-dark-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAACZmZl+9SADAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")} .jstree-default-dark-large.jstree-rtl .jstree-last{background:transparent} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/throbber.gif b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/throbber.gif new file mode 100644 index 0000000..c6a1c85 Binary files /dev/null and b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default-dark/throbber.gif differ diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/32px.png b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/32px.png new file mode 100644 index 0000000..a6a39fc Binary files /dev/null and b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/32px.png differ diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/40px.png b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/40px.png new file mode 100644 index 0000000..d025522 Binary files /dev/null and b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/40px.png differ diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/style.css b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/style.css new file mode 100644 index 0000000..0703168 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/style.css @@ -0,0 +1,1102 @@ +/* jsTree default theme */ +.jstree-node, +.jstree-children, +.jstree-container-ul { + display: block; + margin: 0; + padding: 0; + list-style-type: none; + list-style-image: none; +} +.jstree-node { + white-space: nowrap; +} +.jstree-anchor { + display: inline-block; + color: black; + white-space: nowrap; + padding: 0 4px 0 1px; + margin: 0; + vertical-align: top; +} +.jstree-anchor:focus { + outline: 0; +} +.jstree-anchor, +.jstree-anchor:link, +.jstree-anchor:visited, +.jstree-anchor:hover, +.jstree-anchor:active { + text-decoration: none; + color: inherit; +} +.jstree-icon { + display: inline-block; + text-decoration: none; + margin: 0; + padding: 0; + vertical-align: top; + text-align: center; +} +.jstree-icon:empty { + display: inline-block; + text-decoration: none; + margin: 0; + padding: 0; + vertical-align: top; + text-align: center; +} +.jstree-ocl { + cursor: pointer; +} +.jstree-leaf > .jstree-ocl { + cursor: default; +} +.jstree .jstree-open > .jstree-children { + display: block; +} +.jstree .jstree-closed > .jstree-children, +.jstree .jstree-leaf > .jstree-children { + display: none; +} +.jstree-anchor > .jstree-themeicon { + margin-right: 2px; +} +.jstree-no-icons .jstree-themeicon, +.jstree-anchor > .jstree-themeicon-hidden { + display: none; +} +.jstree-hidden, +.jstree-node.jstree-hidden { + display: none; +} +.jstree-rtl .jstree-anchor { + padding: 0 1px 0 4px; +} +.jstree-rtl .jstree-anchor > .jstree-themeicon { + margin-left: 2px; + margin-right: 0; +} +.jstree-rtl .jstree-node { + margin-left: 0; +} +.jstree-rtl .jstree-container-ul > .jstree-node { + margin-right: 0; +} +.jstree-wholerow-ul { + position: relative; + display: inline-block; + min-width: 100%; +} +.jstree-wholerow-ul .jstree-leaf > .jstree-ocl { + cursor: pointer; +} +.jstree-wholerow-ul .jstree-anchor, +.jstree-wholerow-ul .jstree-icon { + position: relative; +} +.jstree-wholerow-ul .jstree-wholerow { + width: 100%; + cursor: pointer; + position: absolute; + left: 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.jstree-contextmenu .jstree-anchor { + -webkit-user-select: none; + /* disable selection/Copy of UIWebView */ + -webkit-touch-callout: none; + /* disable the IOS popup when long-press on a link */ +} +.vakata-context { + display: none; +} +.vakata-context, +.vakata-context ul { + margin: 0; + padding: 2px; + position: absolute; + background: #f5f5f5; + border: 1px solid #979797; + box-shadow: 2px 2px 2px #999999; +} +.vakata-context ul { + list-style: none; + left: 100%; + margin-top: -2.7em; + margin-left: -4px; +} +.vakata-context .vakata-context-right ul { + left: auto; + right: 100%; + margin-left: auto; + margin-right: -4px; +} +.vakata-context li { + list-style: none; +} +.vakata-context li > a { + display: block; + padding: 0 2em 0 2em; + text-decoration: none; + width: auto; + color: black; + white-space: nowrap; + line-height: 2.4em; + text-shadow: 1px 1px 0 white; + border-radius: 1px; +} +.vakata-context li > a:hover { + position: relative; + background-color: #e8eff7; + box-shadow: 0 0 2px #0a6aa1; +} +.vakata-context li > a.vakata-context-parent { + background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); + background-position: right center; + background-repeat: no-repeat; +} +.vakata-context li > a:focus { + outline: 0; +} +.vakata-context .vakata-context-hover > a { + position: relative; + background-color: #e8eff7; + box-shadow: 0 0 2px #0a6aa1; +} +.vakata-context .vakata-context-separator > a, +.vakata-context .vakata-context-separator > a:hover { + background: white; + border: 0; + border-top: 1px solid #e2e3e3; + height: 1px; + min-height: 1px; + max-height: 1px; + padding: 0; + margin: 0 0 0 2.4em; + border-left: 1px solid #e0e0e0; + text-shadow: 0 0 0 transparent; + box-shadow: 0 0 0 transparent; + border-radius: 0; +} +.vakata-context .vakata-contextmenu-disabled a, +.vakata-context .vakata-contextmenu-disabled a:hover { + color: silver; + background-color: transparent; + border: 0; + box-shadow: 0 0 0; +} +.vakata-context .vakata-contextmenu-disabled > a > i { + filter: grayscale(100%); +} +.vakata-context li > a > i { + text-decoration: none; + display: inline-block; + width: 2.4em; + height: 2.4em; + background: transparent; + margin: 0 0 0 -2em; + vertical-align: top; + text-align: center; + line-height: 2.4em; +} +.vakata-context li > a > i:empty { + width: 2.4em; + line-height: 2.4em; +} +.vakata-context li > a .vakata-contextmenu-sep { + display: inline-block; + width: 1px; + height: 2.4em; + background: white; + margin: 0 0.5em 0 0; + border-left: 1px solid #e2e3e3; +} +.vakata-context .vakata-contextmenu-shortcut { + font-size: 0.8em; + color: silver; + opacity: 0.5; + display: none; +} +.vakata-context-rtl ul { + left: auto; + right: 100%; + margin-left: auto; + margin-right: -4px; +} +.vakata-context-rtl li > a.vakata-context-parent { + background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); + background-position: left center; + background-repeat: no-repeat; +} +.vakata-context-rtl .vakata-context-separator > a { + margin: 0 2.4em 0 0; + border-left: 0; + border-right: 1px solid #e2e3e3; +} +.vakata-context-rtl .vakata-context-left ul { + right: auto; + left: 100%; + margin-left: -4px; + margin-right: auto; +} +.vakata-context-rtl li > a > i { + margin: 0 -2em 0 0; +} +.vakata-context-rtl li > a .vakata-contextmenu-sep { + margin: 0 0 0 0.5em; + border-left-color: white; + background: #e2e3e3; +} +#jstree-marker { + position: absolute; + top: 0; + left: 0; + margin: -5px 0 0 0; + padding: 0; + border-right: 0; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 5px solid; + width: 0; + height: 0; + font-size: 0; + line-height: 0; +} +#jstree-dnd { + line-height: 16px; + margin: 0; + padding: 4px; +} +#jstree-dnd .jstree-icon, +#jstree-dnd .jstree-copy { + display: inline-block; + text-decoration: none; + margin: 0 2px 0 0; + padding: 0; + width: 16px; + height: 16px; +} +#jstree-dnd .jstree-ok { + background: green; +} +#jstree-dnd .jstree-er { + background: red; +} +#jstree-dnd .jstree-copy { + margin: 0 2px 0 2px; +} +.jstree-default .jstree-node, +.jstree-default .jstree-icon { + background-repeat: no-repeat; + background-color: transparent; +} +.jstree-default .jstree-anchor, +.jstree-default .jstree-animated, +.jstree-default .jstree-wholerow { + transition: background-color 0.15s, box-shadow 0.15s; +} +.jstree-default .jstree-hovered { + background: #e7f4f9; + border-radius: 2px; + box-shadow: inset 0 0 1px #cccccc; +} +.jstree-default .jstree-context { + background: #e7f4f9; + border-radius: 2px; + box-shadow: inset 0 0 1px #cccccc; +} +.jstree-default .jstree-clicked { + background: #beebff; + border-radius: 2px; + box-shadow: inset 0 0 1px #999999; +} +.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon { + display: none; +} +.jstree-default .jstree-disabled { + background: transparent; + color: #666666; +} +.jstree-default .jstree-disabled.jstree-hovered { + background: transparent; + box-shadow: none; +} +.jstree-default .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default .jstree-disabled > .jstree-icon { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default .jstree-search { + font-style: italic; + color: #8b0000; + font-weight: bold; +} +.jstree-default .jstree-no-checkboxes .jstree-checkbox { + display: none !important; +} +.jstree-default.jstree-checkbox-no-clicked .jstree-clicked { + background: transparent; + box-shadow: none; +} +.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered { + background: #e7f4f9; +} +.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked { + background: transparent; +} +.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered { + background: #e7f4f9; +} +.jstree-default > .jstree-striped { + min-width: 100%; + display: inline-block; + background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; +} +.jstree-default > .jstree-wholerow-ul .jstree-hovered, +.jstree-default > .jstree-wholerow-ul .jstree-clicked { + background: transparent; + box-shadow: none; + border-radius: 0; +} +.jstree-default .jstree-wholerow { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} +.jstree-default .jstree-wholerow-hovered { + background: #e7f4f9; +} +.jstree-default .jstree-wholerow-clicked { + background: #beebff; + background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%); + background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%); +} +.jstree-default .jstree-node { + min-height: 24px; + line-height: 24px; + margin-left: 24px; + min-width: 24px; +} +.jstree-default .jstree-anchor { + line-height: 24px; + height: 24px; +} +.jstree-default .jstree-icon { + width: 24px; + height: 24px; + line-height: 24px; +} +.jstree-default .jstree-icon:empty { + width: 24px; + height: 24px; + line-height: 24px; +} +.jstree-default.jstree-rtl .jstree-node { + margin-right: 24px; +} +.jstree-default .jstree-wholerow { + height: 24px; +} +.jstree-default .jstree-node, +.jstree-default .jstree-icon { + background-image: url("32px.png"); +} +.jstree-default .jstree-node { + background-position: -292px -4px; + background-repeat: repeat-y; +} +.jstree-default .jstree-last { + background: transparent; +} +.jstree-default .jstree-open > .jstree-ocl { + background-position: -132px -4px; +} +.jstree-default .jstree-closed > .jstree-ocl { + background-position: -100px -4px; +} +.jstree-default .jstree-leaf > .jstree-ocl { + background-position: -68px -4px; +} +.jstree-default .jstree-themeicon { + background-position: -260px -4px; +} +.jstree-default > .jstree-no-dots .jstree-node, +.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -36px -4px; +} +.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -4px -4px; +} +.jstree-default .jstree-disabled { + background: transparent; +} +.jstree-default .jstree-disabled.jstree-hovered { + background: transparent; +} +.jstree-default .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default .jstree-checkbox { + background-position: -164px -4px; +} +.jstree-default .jstree-checkbox:hover { + background-position: -164px -36px; +} +.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, +.jstree-default .jstree-checked > .jstree-checkbox { + background-position: -228px -4px; +} +.jstree-default.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, +.jstree-default .jstree-checked > .jstree-checkbox:hover { + background-position: -228px -36px; +} +.jstree-default .jstree-anchor > .jstree-undetermined { + background-position: -196px -4px; +} +.jstree-default .jstree-anchor > .jstree-undetermined:hover { + background-position: -196px -36px; +} +.jstree-default .jstree-checkbox-disabled { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default > .jstree-striped { + background-size: auto 48px; +} +.jstree-default.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); + background-position: 100% 1px; + background-repeat: repeat-y; +} +.jstree-default.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default.jstree-rtl .jstree-open > .jstree-ocl { + background-position: -132px -36px; +} +.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -100px -36px; +} +.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl { + background-position: -68px -36px; +} +.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node, +.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -36px -36px; +} +.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -4px -36px; +} +.jstree-default .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; +} +.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl { + background: url("throbber.gif") center center no-repeat; +} +.jstree-default .jstree-file { + background: url("32px.png") -100px -68px no-repeat; +} +.jstree-default .jstree-folder { + background: url("32px.png") -260px -4px no-repeat; +} +.jstree-default > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; +} +#jstree-dnd.jstree-default { + line-height: 24px; + padding: 0 4px; +} +#jstree-dnd.jstree-default .jstree-ok, +#jstree-dnd.jstree-default .jstree-er { + background-image: url("32px.png"); + background-repeat: no-repeat; + background-color: transparent; +} +#jstree-dnd.jstree-default i { + background: transparent; + width: 24px; + height: 24px; + line-height: 24px; +} +#jstree-dnd.jstree-default .jstree-ok { + background-position: -4px -68px; +} +#jstree-dnd.jstree-default .jstree-er { + background-position: -36px -68px; +} +.jstree-default .jstree-ellipsis { + overflow: hidden; +} +.jstree-default .jstree-ellipsis .jstree-anchor { + width: calc(100% - 29px); + text-overflow: ellipsis; + overflow: hidden; +} +.jstree-default.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); +} +.jstree-default.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-small .jstree-node { + min-height: 18px; + line-height: 18px; + margin-left: 18px; + min-width: 18px; +} +.jstree-default-small .jstree-anchor { + line-height: 18px; + height: 18px; +} +.jstree-default-small .jstree-icon { + width: 18px; + height: 18px; + line-height: 18px; +} +.jstree-default-small .jstree-icon:empty { + width: 18px; + height: 18px; + line-height: 18px; +} +.jstree-default-small.jstree-rtl .jstree-node { + margin-right: 18px; +} +.jstree-default-small .jstree-wholerow { + height: 18px; +} +.jstree-default-small .jstree-node, +.jstree-default-small .jstree-icon { + background-image: url("32px.png"); +} +.jstree-default-small .jstree-node { + background-position: -295px -7px; + background-repeat: repeat-y; +} +.jstree-default-small .jstree-last { + background: transparent; +} +.jstree-default-small .jstree-open > .jstree-ocl { + background-position: -135px -7px; +} +.jstree-default-small .jstree-closed > .jstree-ocl { + background-position: -103px -7px; +} +.jstree-default-small .jstree-leaf > .jstree-ocl { + background-position: -71px -7px; +} +.jstree-default-small .jstree-themeicon { + background-position: -263px -7px; +} +.jstree-default-small > .jstree-no-dots .jstree-node, +.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -39px -7px; +} +.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -7px -7px; +} +.jstree-default-small .jstree-disabled { + background: transparent; +} +.jstree-default-small .jstree-disabled.jstree-hovered { + background: transparent; +} +.jstree-default-small .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default-small .jstree-checkbox { + background-position: -167px -7px; +} +.jstree-default-small .jstree-checkbox:hover { + background-position: -167px -39px; +} +.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, +.jstree-default-small .jstree-checked > .jstree-checkbox { + background-position: -231px -7px; +} +.jstree-default-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, +.jstree-default-small .jstree-checked > .jstree-checkbox:hover { + background-position: -231px -39px; +} +.jstree-default-small .jstree-anchor > .jstree-undetermined { + background-position: -199px -7px; +} +.jstree-default-small .jstree-anchor > .jstree-undetermined:hover { + background-position: -199px -39px; +} +.jstree-default-small .jstree-checkbox-disabled { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default-small > .jstree-striped { + background-size: auto 36px; +} +.jstree-default-small.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); + background-position: 100% 1px; + background-repeat: repeat-y; +} +.jstree-default-small.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl { + background-position: -135px -39px; +} +.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -103px -39px; +} +.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl { + background-position: -71px -39px; +} +.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node, +.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -39px -39px; +} +.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: -7px -39px; +} +.jstree-default-small .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; +} +.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl { + background: url("throbber.gif") center center no-repeat; +} +.jstree-default-small .jstree-file { + background: url("32px.png") -103px -71px no-repeat; +} +.jstree-default-small .jstree-folder { + background: url("32px.png") -263px -7px no-repeat; +} +.jstree-default-small > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; +} +#jstree-dnd.jstree-default-small { + line-height: 18px; + padding: 0 4px; +} +#jstree-dnd.jstree-default-small .jstree-ok, +#jstree-dnd.jstree-default-small .jstree-er { + background-image: url("32px.png"); + background-repeat: no-repeat; + background-color: transparent; +} +#jstree-dnd.jstree-default-small i { + background: transparent; + width: 18px; + height: 18px; + line-height: 18px; +} +#jstree-dnd.jstree-default-small .jstree-ok { + background-position: -7px -71px; +} +#jstree-dnd.jstree-default-small .jstree-er { + background-position: -39px -71px; +} +.jstree-default-small .jstree-ellipsis { + overflow: hidden; +} +.jstree-default-small .jstree-ellipsis .jstree-anchor { + width: calc(100% - 23px); + text-overflow: ellipsis; + overflow: hidden; +} +.jstree-default-small.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); +} +.jstree-default-small.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-large .jstree-node { + min-height: 32px; + line-height: 32px; + margin-left: 32px; + min-width: 32px; +} +.jstree-default-large .jstree-anchor { + line-height: 32px; + height: 32px; +} +.jstree-default-large .jstree-icon { + width: 32px; + height: 32px; + line-height: 32px; +} +.jstree-default-large .jstree-icon:empty { + width: 32px; + height: 32px; + line-height: 32px; +} +.jstree-default-large.jstree-rtl .jstree-node { + margin-right: 32px; +} +.jstree-default-large .jstree-wholerow { + height: 32px; +} +.jstree-default-large .jstree-node, +.jstree-default-large .jstree-icon { + background-image: url("32px.png"); +} +.jstree-default-large .jstree-node { + background-position: -288px 0px; + background-repeat: repeat-y; +} +.jstree-default-large .jstree-last { + background: transparent; +} +.jstree-default-large .jstree-open > .jstree-ocl { + background-position: -128px 0px; +} +.jstree-default-large .jstree-closed > .jstree-ocl { + background-position: -96px 0px; +} +.jstree-default-large .jstree-leaf > .jstree-ocl { + background-position: -64px 0px; +} +.jstree-default-large .jstree-themeicon { + background-position: -256px 0px; +} +.jstree-default-large > .jstree-no-dots .jstree-node, +.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -32px 0px; +} +.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: 0px 0px; +} +.jstree-default-large .jstree-disabled { + background: transparent; +} +.jstree-default-large .jstree-disabled.jstree-hovered { + background: transparent; +} +.jstree-default-large .jstree-disabled.jstree-clicked { + background: #efefef; +} +.jstree-default-large .jstree-checkbox { + background-position: -160px 0px; +} +.jstree-default-large .jstree-checkbox:hover { + background-position: -160px -32px; +} +.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, +.jstree-default-large .jstree-checked > .jstree-checkbox { + background-position: -224px 0px; +} +.jstree-default-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, +.jstree-default-large .jstree-checked > .jstree-checkbox:hover { + background-position: -224px -32px; +} +.jstree-default-large .jstree-anchor > .jstree-undetermined { + background-position: -192px 0px; +} +.jstree-default-large .jstree-anchor > .jstree-undetermined:hover { + background-position: -192px -32px; +} +.jstree-default-large .jstree-checkbox-disabled { + opacity: 0.8; + filter: url("data:image/svg+xml;utf8,#jstree-grayscale"); + /* Firefox 10+ */ + filter: gray; + /* IE6-9 */ + -webkit-filter: grayscale(100%); + /* Chrome 19+ & Safari 6+ */ +} +.jstree-default-large > .jstree-striped { + background-size: auto 64px; +} +.jstree-default-large.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); + background-position: 100% 1px; + background-repeat: repeat-y; +} +.jstree-default-large.jstree-rtl .jstree-last { + background: transparent; +} +.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl { + background-position: -128px -32px; +} +.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -96px -32px; +} +.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl { + background-position: -64px -32px; +} +.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node, +.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl { + background: transparent; +} +.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl { + background-position: -32px -32px; +} +.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl { + background-position: 0px -32px; +} +.jstree-default-large .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; +} +.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl { + background: url("throbber.gif") center center no-repeat; +} +.jstree-default-large .jstree-file { + background: url("32px.png") -96px -64px no-repeat; +} +.jstree-default-large .jstree-folder { + background: url("32px.png") -256px 0px no-repeat; +} +.jstree-default-large > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; +} +#jstree-dnd.jstree-default-large { + line-height: 32px; + padding: 0 4px; +} +#jstree-dnd.jstree-default-large .jstree-ok, +#jstree-dnd.jstree-default-large .jstree-er { + background-image: url("32px.png"); + background-repeat: no-repeat; + background-color: transparent; +} +#jstree-dnd.jstree-default-large i { + background: transparent; + width: 32px; + height: 32px; + line-height: 32px; +} +#jstree-dnd.jstree-default-large .jstree-ok { + background-position: 0px -64px; +} +#jstree-dnd.jstree-default-large .jstree-er { + background-position: -32px -64px; +} +.jstree-default-large .jstree-ellipsis { + overflow: hidden; +} +.jstree-default-large .jstree-ellipsis .jstree-anchor { + width: calc(100% - 37px); + text-overflow: ellipsis; + overflow: hidden; +} +.jstree-default-large.jstree-rtl .jstree-node { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); +} +.jstree-default-large.jstree-rtl .jstree-last { + background: transparent; +} +@media (max-width: 768px) { + #jstree-dnd.jstree-dnd-responsive { + line-height: 40px; + font-weight: bold; + font-size: 1.1em; + text-shadow: 1px 1px white; + } + #jstree-dnd.jstree-dnd-responsive > i { + background: transparent; + width: 40px; + height: 40px; + } + #jstree-dnd.jstree-dnd-responsive > .jstree-ok { + background-image: url("40px.png"); + background-position: 0 -200px; + background-size: 120px 240px; + } + #jstree-dnd.jstree-dnd-responsive > .jstree-er { + background-image: url("40px.png"); + background-position: -40px -200px; + background-size: 120px 240px; + } + #jstree-marker.jstree-dnd-responsive { + border-left-width: 10px; + border-top-width: 10px; + border-bottom-width: 10px; + margin-top: -10px; + } +} +@media (max-width: 768px) { + .jstree-default-responsive { + /* + .jstree-open > .jstree-ocl, + .jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; } + */ + } + .jstree-default-responsive .jstree-icon { + background-image: url("40px.png"); + } + .jstree-default-responsive .jstree-node, + .jstree-default-responsive .jstree-leaf > .jstree-ocl { + background: transparent; + } + .jstree-default-responsive .jstree-node { + min-height: 40px; + line-height: 40px; + margin-left: 40px; + min-width: 40px; + white-space: nowrap; + } + .jstree-default-responsive .jstree-anchor { + line-height: 40px; + height: 40px; + } + .jstree-default-responsive .jstree-icon, + .jstree-default-responsive .jstree-icon:empty { + width: 40px; + height: 40px; + line-height: 40px; + } + .jstree-default-responsive > .jstree-container-ul > .jstree-node { + margin-left: 0; + } + .jstree-default-responsive.jstree-rtl .jstree-node { + margin-left: 0; + margin-right: 40px; + background: transparent; + } + .jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node { + margin-right: 0; + } + .jstree-default-responsive .jstree-ocl, + .jstree-default-responsive .jstree-themeicon, + .jstree-default-responsive .jstree-checkbox { + background-size: 120px 240px; + } + .jstree-default-responsive .jstree-leaf > .jstree-ocl, + .jstree-default-responsive.jstree-rtl .jstree-leaf > .jstree-ocl { + background: transparent; + } + .jstree-default-responsive .jstree-open > .jstree-ocl { + background-position: 0 0 !important; + } + .jstree-default-responsive .jstree-closed > .jstree-ocl { + background-position: 0 -40px !important; + } + .jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl { + background-position: -40px 0 !important; + } + .jstree-default-responsive .jstree-themeicon { + background-position: -40px -40px; + } + .jstree-default-responsive .jstree-checkbox, + .jstree-default-responsive .jstree-checkbox:hover { + background-position: -40px -80px; + } + .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox, + .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover, + .jstree-default-responsive .jstree-checked > .jstree-checkbox, + .jstree-default-responsive .jstree-checked > .jstree-checkbox:hover { + background-position: 0 -80px; + } + .jstree-default-responsive .jstree-anchor > .jstree-undetermined, + .jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover { + background-position: 0 -120px; + } + .jstree-default-responsive .jstree-anchor { + font-weight: bold; + font-size: 1.1em; + text-shadow: 1px 1px white; + } + .jstree-default-responsive > .jstree-striped { + background: transparent; + } + .jstree-default-responsive .jstree-wholerow { + border-top: 1px solid rgba(255, 255, 255, 0.7); + border-bottom: 1px solid rgba(64, 64, 64, 0.2); + background: #ebebeb; + height: 40px; + } + .jstree-default-responsive .jstree-wholerow-hovered { + background: #e7f4f9; + } + .jstree-default-responsive .jstree-wholerow-clicked { + background: #beebff; + } + .jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow { + box-shadow: inset 0 -6px 3px -5px #666666; + } + .jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow { + box-shadow: inset 0 6px 3px -5px #666666; + border-top: 0; + } + .jstree-default-responsive .jstree-children .jstree-open + .jstree-open { + box-shadow: none; + } + .jstree-default-responsive .jstree-node, + .jstree-default-responsive .jstree-icon, + .jstree-default-responsive .jstree-node > .jstree-ocl, + .jstree-default-responsive .jstree-themeicon, + .jstree-default-responsive .jstree-checkbox { + background-image: url("40px.png"); + background-size: 120px 240px; + } + .jstree-default-responsive .jstree-node { + background-position: -80px 0; + background-repeat: repeat-y; + } + .jstree-default-responsive .jstree-last { + background: transparent; + } + .jstree-default-responsive .jstree-leaf > .jstree-ocl { + background-position: -40px -120px; + } + .jstree-default-responsive .jstree-last > .jstree-ocl { + background-position: -40px -160px; + } + .jstree-default-responsive .jstree-themeicon-custom { + background-color: transparent; + background-image: none; + background-position: 0 0; + } + .jstree-default-responsive .jstree-file { + background: url("40px.png") 0 -160px no-repeat; + background-size: 120px 240px; + } + .jstree-default-responsive .jstree-folder { + background: url("40px.png") -40px -40px no-repeat; + background-size: 120px 240px; + } + .jstree-default-responsive > .jstree-container-ul > .jstree-node { + margin-left: 0; + margin-right: 0; + } +} diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/style.min.css b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/style.min.css new file mode 100644 index 0000000..843f2e7 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/style.min.css @@ -0,0 +1 @@ +.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf>.jstree-ocl{cursor:default}.jstree .jstree-open>.jstree-children{display:block}.jstree .jstree-closed>.jstree-children,.jstree .jstree-leaf>.jstree-children{display:none}.jstree-anchor>.jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor>.jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor>.jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf>.jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li>a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li>a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li>a:focus{outline:0}.vakata-context .vakata-context-hover>a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator>a,.vakata-context .vakata-context-separator>a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context .vakata-contextmenu-disabled>a>i{filter:grayscale(100%)}.vakata-context li>a>i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li>a>i:empty{width:2.4em;line-height:2.4em}.vakata-context li>a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 .5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:.8em;color:silver;opacity:.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li>a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator>a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li>a>i{margin:0 -2em 0 0}.vakata-context-rtl li>a .vakata-contextmenu-sep{margin:0 0 0 .5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-default .jstree-anchor,.jstree-default .jstree-animated,.jstree-default .jstree-wholerow{transition:background-color .15s,box-shadow .15s}.jstree-default .jstree-hovered{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-default .jstree-context{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-default .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999999}.jstree-default .jstree-no-icons .jstree-anchor>.jstree-themeicon{display:none}.jstree-default .jstree-disabled{background:transparent;color:#666666}.jstree-default .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-default .jstree-disabled.jstree-clicked{background:#efefef}.jstree-default .jstree-disabled>.jstree-icon{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)}.jstree-default .jstree-search{font-style:italic;color:#8b0000;font-weight:bold}.jstree-default .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#e7f4f9}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-default.jstree-checkbox-no-clicked>.jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#e7f4f9}.jstree-default>.jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-default>.jstree-wholerow-ul .jstree-hovered,.jstree-default>.jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-default .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-default .jstree-wholerow-hovered{background:#e7f4f9}.jstree-default .jstree-wholerow-clicked{background:#beebff;background:-webkit-linear-gradient(top, #beebff 0, #a8e4ff 100%);background:linear-gradient(to bottom, #beebff 0, #a8e4ff 100%)}.jstree-default .jstree-node{min-height:24px;line-height:24px;margin-left:24px;min-width:24px}.jstree-default .jstree-anchor{line-height:24px;height:24px}.jstree-default .jstree-icon{width:24px;height:24px;line-height:24px}.jstree-default .jstree-icon:empty{width:24px;height:24px;line-height:24px}.jstree-default.jstree-rtl .jstree-node{margin-right:24px}.jstree-default .jstree-wholerow{height:24px}.jstree-default .jstree-node,.jstree-default .jstree-icon{background-image:url("32px.png")} .jstree-default .jstree-node{background-position:-292px -4px;background-repeat:repeat-y} .jstree-default .jstree-last{background:transparent} .jstree-default .jstree-open>.jstree-ocl{background-position:-132px -4px} .jstree-default .jstree-closed>.jstree-ocl{background-position:-100px -4px} .jstree-default .jstree-leaf>.jstree-ocl{background-position:-68px -4px} .jstree-default .jstree-themeicon{background-position:-260px -4px} .jstree-default>.jstree-no-dots .jstree-node,.jstree-default>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -4px} .jstree-default>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -4px} .jstree-default .jstree-disabled{background:transparent} .jstree-default .jstree-disabled.jstree-hovered{background:transparent} .jstree-default .jstree-disabled.jstree-clicked{background:#efefef} .jstree-default .jstree-checkbox{background-position:-164px -4px} .jstree-default .jstree-checkbox:hover{background-position:-164px -36px} .jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default .jstree-checked>.jstree-checkbox{background-position:-228px -4px} .jstree-default.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default .jstree-checked>.jstree-checkbox:hover{background-position:-228px -36px} .jstree-default .jstree-anchor>.jstree-undetermined{background-position:-196px -4px} .jstree-default .jstree-anchor>.jstree-undetermined:hover{background-position:-196px -36px} .jstree-default .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)} .jstree-default>.jstree-striped{background-size:auto 48px} .jstree-default.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y} .jstree-default.jstree-rtl .jstree-last{background:transparent} .jstree-default.jstree-rtl .jstree-open>.jstree-ocl{background-position:-132px -36px} .jstree-default.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-100px -36px} .jstree-default.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-68px -36px} .jstree-default.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-36px -36px} .jstree-default.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-4px -36px} .jstree-default .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat} .jstree-default .jstree-file{background:url("32px.png") -100px -68px no-repeat} .jstree-default .jstree-folder{background:url("32px.png") -260px -4px no-repeat} .jstree-default>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0} #jstree-dnd.jstree-default{line-height:24px;padding:0 4px} #jstree-dnd.jstree-default .jstree-ok,#jstree-dnd.jstree-default .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent} #jstree-dnd.jstree-default i{background:transparent;width:24px;height:24px;line-height:24px} #jstree-dnd.jstree-default .jstree-ok{background-position:-4px -68px} #jstree-dnd.jstree-default .jstree-er{background-position:-36px -68px} .jstree-default .jstree-ellipsis{overflow:hidden} .jstree-default .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden} .jstree-default.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")} .jstree-default.jstree-rtl .jstree-last{background:transparent} .jstree-default-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px} .jstree-default-small .jstree-anchor{line-height:18px;height:18px} .jstree-default-small .jstree-icon{width:18px;height:18px;line-height:18px} .jstree-default-small .jstree-icon:empty{width:18px;height:18px;line-height:18px} .jstree-default-small.jstree-rtl .jstree-node{margin-right:18px} .jstree-default-small .jstree-wholerow{height:18px} .jstree-default-small .jstree-node,.jstree-default-small .jstree-icon{background-image:url("32px.png")} .jstree-default-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y} .jstree-default-small .jstree-last{background:transparent} .jstree-default-small .jstree-open>.jstree-ocl{background-position:-135px -7px} .jstree-default-small .jstree-closed>.jstree-ocl{background-position:-103px -7px} .jstree-default-small .jstree-leaf>.jstree-ocl{background-position:-71px -7px} .jstree-default-small .jstree-themeicon{background-position:-263px -7px} .jstree-default-small>.jstree-no-dots .jstree-node,.jstree-default-small>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-small>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -7px} .jstree-default-small>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -7px} .jstree-default-small .jstree-disabled{background:transparent} .jstree-default-small .jstree-disabled.jstree-hovered{background:transparent} .jstree-default-small .jstree-disabled.jstree-clicked{background:#efefef} .jstree-default-small .jstree-checkbox{background-position:-167px -7px} .jstree-default-small .jstree-checkbox:hover{background-position:-167px -39px} .jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-small .jstree-checked>.jstree-checkbox{background-position:-231px -7px} .jstree-default-small.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-small .jstree-checked>.jstree-checkbox:hover{background-position:-231px -39px} .jstree-default-small .jstree-anchor>.jstree-undetermined{background-position:-199px -7px} .jstree-default-small .jstree-anchor>.jstree-undetermined:hover{background-position:-199px -39px} .jstree-default-small .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)} .jstree-default-small>.jstree-striped{background-size:auto 36px} .jstree-default-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y} .jstree-default-small.jstree-rtl .jstree-last{background:transparent} .jstree-default-small.jstree-rtl .jstree-open>.jstree-ocl{background-position:-135px -39px} .jstree-default-small.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-103px -39px} .jstree-default-small.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-71px -39px} .jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-39px -39px} .jstree-default-small.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:-7px -39px} .jstree-default-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-small>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat} .jstree-default-small .jstree-file{background:url("32px.png") -103px -71px no-repeat} .jstree-default-small .jstree-folder{background:url("32px.png") -263px -7px no-repeat} .jstree-default-small>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0} #jstree-dnd.jstree-default-small{line-height:18px;padding:0 4px} #jstree-dnd.jstree-default-small .jstree-ok,#jstree-dnd.jstree-default-small .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent} #jstree-dnd.jstree-default-small i{background:transparent;width:18px;height:18px;line-height:18px} #jstree-dnd.jstree-default-small .jstree-ok{background-position:-7px -71px} #jstree-dnd.jstree-default-small .jstree-er{background-position:-39px -71px} .jstree-default-small .jstree-ellipsis{overflow:hidden} .jstree-default-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden} .jstree-default-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")} .jstree-default-small.jstree-rtl .jstree-last{background:transparent} .jstree-default-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px} .jstree-default-large .jstree-anchor{line-height:32px;height:32px} .jstree-default-large .jstree-icon{width:32px;height:32px;line-height:32px} .jstree-default-large .jstree-icon:empty{width:32px;height:32px;line-height:32px} .jstree-default-large.jstree-rtl .jstree-node{margin-right:32px} .jstree-default-large .jstree-wholerow{height:32px} .jstree-default-large .jstree-node,.jstree-default-large .jstree-icon{background-image:url("32px.png")} .jstree-default-large .jstree-node{background-position:-288px 0;background-repeat:repeat-y} .jstree-default-large .jstree-last{background:transparent} .jstree-default-large .jstree-open>.jstree-ocl{background-position:-128px 0} .jstree-default-large .jstree-closed>.jstree-ocl{background-position:-96px 0} .jstree-default-large .jstree-leaf>.jstree-ocl{background-position:-64px 0} .jstree-default-large .jstree-themeicon{background-position:-256px 0} .jstree-default-large>.jstree-no-dots .jstree-node,.jstree-default-large>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-large>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px 0} .jstree-default-large>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 0} .jstree-default-large .jstree-disabled{background:transparent} .jstree-default-large .jstree-disabled.jstree-hovered{background:transparent} .jstree-default-large .jstree-disabled.jstree-clicked{background:#efefef} .jstree-default-large .jstree-checkbox{background-position:-160px 0} .jstree-default-large .jstree-checkbox:hover{background-position:-160px -32px} .jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-large .jstree-checked>.jstree-checkbox{background-position:-224px 0} .jstree-default-large.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-large .jstree-checked>.jstree-checkbox:hover{background-position:-224px -32px} .jstree-default-large .jstree-anchor>.jstree-undetermined{background-position:-192px 0} .jstree-default-large .jstree-anchor>.jstree-undetermined:hover{background-position:-192px -32px} .jstree-default-large .jstree-checkbox-disabled{opacity:.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");filter:gray;-webkit-filter:grayscale(100%)} .jstree-default-large>.jstree-striped{background-size:auto 64px} .jstree-default-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y} .jstree-default-large.jstree-rtl .jstree-last{background:transparent} .jstree-default-large.jstree-rtl .jstree-open>.jstree-ocl{background-position:-128px -32px} .jstree-default-large.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-96px -32px} .jstree-default-large.jstree-rtl .jstree-leaf>.jstree-ocl{background-position:-64px -32px} .jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-node,.jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-open>.jstree-ocl{background-position:-32px -32px} .jstree-default-large.jstree-rtl>.jstree-no-dots .jstree-closed>.jstree-ocl{background-position:0 -32px} .jstree-default-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-large>.jstree-container-ul .jstree-loading>.jstree-ocl{background:url("throbber.gif") center center no-repeat} .jstree-default-large .jstree-file{background:url("32px.png") -96px -64px no-repeat} .jstree-default-large .jstree-folder{background:url("32px.png") -256px 0 no-repeat} .jstree-default-large>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0} #jstree-dnd.jstree-default-large{line-height:32px;padding:0 4px} #jstree-dnd.jstree-default-large .jstree-ok,#jstree-dnd.jstree-default-large .jstree-er{background-image:url("32px.png");background-repeat:no-repeat;background-color:transparent} #jstree-dnd.jstree-default-large i{background:transparent;width:32px;height:32px;line-height:32px} #jstree-dnd.jstree-default-large .jstree-ok{background-position:0 -64px} #jstree-dnd.jstree-default-large .jstree-er{background-position:-32px -64px} .jstree-default-large .jstree-ellipsis{overflow:hidden} .jstree-default-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden} .jstree-default-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")} .jstree-default-large.jstree-rtl .jstree-last{background:transparent}@media (max-width:768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white} #jstree-dnd.jstree-dnd-responsive>i{background:transparent;width:40px;height:40px} #jstree-dnd.jstree-dnd-responsive>.jstree-ok{background-image:url("40px.png");background-position:0 -200px;background-size:120px 240px} #jstree-dnd.jstree-dnd-responsive>.jstree-er{background-image:url("40px.png");background-position:-40px -200px;background-size:120px 240px} #jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width:768px){.jstree-default-responsive .jstree-icon{background-image:url("40px.png")} .jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap} .jstree-default-responsive .jstree-anchor{line-height:40px;height:40px} .jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px} .jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0} .jstree-default-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent} .jstree-default-responsive.jstree-rtl .jstree-container-ul>.jstree-node{margin-right:0} .jstree-default-responsive .jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-size:120px 240px} .jstree-default-responsive .jstree-leaf>.jstree-ocl,.jstree-default-responsive.jstree-rtl .jstree-leaf>.jstree-ocl{background:transparent} .jstree-default-responsive .jstree-open>.jstree-ocl{background-position:0 0 !important} .jstree-default-responsive .jstree-closed>.jstree-ocl{background-position:0 -40px !important} .jstree-default-responsive.jstree-rtl .jstree-closed>.jstree-ocl{background-position:-40px 0 !important} .jstree-default-responsive .jstree-themeicon{background-position:-40px -40px} .jstree-default-responsive .jstree-checkbox,.jstree-default-responsive .jstree-checkbox:hover{background-position:-40px -80px} .jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox,.jstree-default-responsive.jstree-checkbox-selection .jstree-clicked>.jstree-checkbox:hover,.jstree-default-responsive .jstree-checked>.jstree-checkbox,.jstree-default-responsive .jstree-checked>.jstree-checkbox:hover{background-position:0 -80px} .jstree-default-responsive .jstree-anchor>.jstree-undetermined,.jstree-default-responsive .jstree-anchor>.jstree-undetermined:hover{background-position:0 -120px} .jstree-default-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white} .jstree-default-responsive>.jstree-striped{background:transparent} .jstree-default-responsive .jstree-wholerow{border-top:1px solid rgba(255,255,255,0.7);border-bottom:1px solid rgba(64,64,64,0.2);background:#ebebeb;height:40px} .jstree-default-responsive .jstree-wholerow-hovered{background:#e7f4f9} .jstree-default-responsive .jstree-wholerow-clicked{background:#beebff} .jstree-default-responsive .jstree-children .jstree-last>.jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #666666} .jstree-default-responsive .jstree-children .jstree-open>.jstree-wholerow{box-shadow:inset 0 6px 3px -5px #666666;border-top:0} .jstree-default-responsive .jstree-children .jstree-open+.jstree-open{box-shadow:none} .jstree-default-responsive .jstree-node,.jstree-default-responsive .jstree-icon,.jstree-default-responsive .jstree-node>.jstree-ocl,.jstree-default-responsive .jstree-themeicon,.jstree-default-responsive .jstree-checkbox{background-image:url("40px.png");background-size:120px 240px} .jstree-default-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y} .jstree-default-responsive .jstree-last{background:transparent} .jstree-default-responsive .jstree-leaf>.jstree-ocl{background-position:-40px -120px} .jstree-default-responsive .jstree-last>.jstree-ocl{background-position:-40px -160px} .jstree-default-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0} .jstree-default-responsive .jstree-file{background:url("40px.png") 0 -160px no-repeat;background-size:120px 240px} .jstree-default-responsive .jstree-folder{background:url("40px.png") -40px -40px no-repeat;background-size:120px 240px} .jstree-default-responsive>.jstree-container-ul>.jstree-node{margin-left:0;margin-right:0}} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/throbber.gif b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/throbber.gif new file mode 100644 index 0000000..64c8eeb Binary files /dev/null and b/wp-content/plugins/compressx/includes/display/js/jstree/dist/themes/default/throbber.gif differ diff --git a/wp-content/plugins/compressx/includes/display/js/optimize.js b/wp-content/plugins/compressx/includes/display/js/optimize.js new file mode 100644 index 0000000..4d3f75a --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/optimize.js @@ -0,0 +1,273 @@ + +window.compressx = window.compressx || {}; + +(function($, w, undefined) +{ + w.compressx.media={ + progress_queue:[], + lock:false, + init:function() + { + $( document ).on( 'click', '.cx-media-item a.cx-media', this.handle_action_button); + $( document ).on( 'click', '.misc-pub-cx a.cx-media', this.handle_action_button_edit); + $( document ).on( 'click', '.cx-media-attachment a.cx-media', this.handle_action_button_attachment); + w.compressx.media.get_progress(); + }, + handle_action_button:function () + { + if(w.compressx.media.islockbtn()) + { + return ; + } + + var $row = $(this).closest('.cx-media-item'); + var $select = $row.find('.cx-media-selected'); + var action = $select.val(); + + if(action==="") + { + return; + } + + var id=$( this ).data( 'id' ); + $( this ).html("Progressing..."); + $( this ).removeClass('cx-media'); + w.compressx.media.lockbtn(true); + + var ajax_action=w.compressx.media.get_ajax_action(action); + + var ajax_data = { + 'action': ajax_action, + 'id':id + }; + compressx_post_request(ajax_data, function(data) + { + w.compressx.media.get_progress(); + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + w.compressx.media.get_progress(); + }); + }, + handle_action_button_edit:function() + { + if(w.compressx.media.islockbtn()) + { + return ; + } + + var $row = $(this).closest('.misc-pub-cx'); + var $select = $row.find('.cx-media-selected'); + var action = $select.val(); + + if(action==="") + { + return; + } + + var id=$( this ).data( 'id' ); + $( this ).html("Converting..."); + $( this ).removeClass('cx-media'); + w.compressx.media.lockbtn(true); + + var ajax_action=w.compressx.media.get_ajax_action(action); + var ajax_data = { + 'action': ajax_action, + 'id':id + }; + compressx_post_request(ajax_data, function(data) + { + w.compressx.media.get_progress('edit'); + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + w.compressx.media.get_progress('edit'); + }); + }, + handle_action_button_attachment:function() + { + if(w.compressx.media.islockbtn()) + { + return ; + } + + var $row = $(this).closest('.cx-media-attachment'); + var $select = $row.find('.cx-media-selected'); + var action = $select.val(); + + if(action==="") + { + return; + } + + var id=$( this ).data( 'id' ); + $( this ).html("Converting..."); + $( this ).removeClass('cx-media'); + w.compressx.media.lockbtn(true); + + var ajax_action=w.compressx.media.get_ajax_action(action); + var ajax_data = { + 'action': ajax_action, + 'id':id + }; + + compressx_post_request(ajax_data, function(data) + { + w.compressx.media.get_progress('attachment'); + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + w.compressx.media.get_progress('attachment'); + }); + }, + get_ajax_action: function(action) { + switch (action) { + case 'convert': return 'compressx_opt_single_image'; + case 'delete': return 'compressx_delete_single_image'; + default: return ''; + } + }, + get_progress:function(page='media') + { + var ids=[]; + if(page=='media') + { + var media=$('.cx-media-item'); + if ( media.length>0 ) + { + media.each( function() + { + ids.push( $( this ).data( 'id' ) ); + } ); + } + } + else if(page=='attachment') + { + var id=$('.cx-media-attachment').data( 'id' ); + ids.push(id ); + } + else + { + var id=$('.misc-pub-cx').data( 'id' ); + ids.push(id ); + } + + if(ids.length<1) + { + return; + } + var ids_json=JSON.stringify(ids); + var ajax_data = { + 'action': 'compressx_get_opt_single_image_progress', + ids:ids_json, + page:page + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + if(typeof data !== 'undefined' && data !== '') + { + var jsonarray = jQuery.parseJSON(data); + w.compressx.media.update(jsonarray,page); + if (jsonarray.result === 'success') + { + if(jsonarray.continue) + { + setTimeout(function () + { + w.compressx.media.get_progress(page); + }, 1000); + } + else if(jsonarray.finished) + { + w.compressx.media.lockbtn(false); + } + else + { + //w.compressx.media.optimize_timeout_image(page); + w.compressx.media.lockbtn(false); + } + + } + else + { + if(jsonarray.timeout) + { + //w.compressx.media.optimize_timeout_image(page); + w.compressx.media.lockbtn(false); + } + else + { + w.compressx.media.lockbtn(false); + } + } + } + } + catch(err) + { + alert(err); + w.compressx.media.lockbtn(false); + } + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + setTimeout(function () + { + w.compressx.media.get_progress(page); + }, 1000); + }); + }, + update:function (jsonarray,page='media') + { + if(page=='edit') + { + var id=$('.misc-pub-cx').data( 'id' ); + if(jsonarray.hasOwnProperty(id)) + { + $( '.misc-pub-cx' ).html(jsonarray[id]['html']); + } + } + else if(page=='attachment') + { + var media=$('.cx-media-attachment'); + if ( media.length>0 ) + { + media.each( function() + { + var id=$( this ).data( 'id' ); + if(jsonarray.hasOwnProperty(id)) + { + $( this ).html(jsonarray[id]['html']); + } + } ); + } + } + else + { + var media=$('.cx-media-item'); + if ( media.length>0 ) + { + media.each( function() + { + var id=$( this ).data( 'id' ); + if(jsonarray.hasOwnProperty(id)) + { + $( this ).html(jsonarray[id]['html']); + } + } ); + } + } + }, + lockbtn:function (status) + { + w.compressx.media.lock=status; + }, + islockbtn:function () + { + return w.compressx.media.lock; + } + }; + w.compressx.media.init(); +})(jQuery, window); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display/js/twentytwenty/jquery.event.move.js b/wp-content/plugins/compressx/includes/display/js/twentytwenty/jquery.event.move.js new file mode 100644 index 0000000..a792b71 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/twentytwenty/jquery.event.move.js @@ -0,0 +1,599 @@ +// DOM.event.move +// +// 2.0.0 +// +// Stephen Band +// +// Triggers 'movestart', 'move' and 'moveend' events after +// mousemoves following a mousedown cross a distance threshold, +// similar to the native 'dragstart', 'drag' and 'dragend' events. +// Move events are throttled to animation frames. Move event objects +// have the properties: +// +// pageX: +// pageY: Page coordinates of pointer. +// startX: +// startY: Page coordinates of pointer at movestart. +// distX: +// distY: Distance the pointer has moved since movestart. +// deltaX: +// deltaY: Distance the finger has moved since last event. +// velocityX: +// velocityY: Average velocity over last few events. + + +(function(fn) { + if (typeof define === 'function' && define.amd) { + define([], fn); + } else if ((typeof module !== "undefined" && module !== null) && module.exports) { + module.exports = fn; + } else { + fn(); + } +})(function(){ + var assign = Object.assign || window.jQuery && jQuery.extend; + + // Number of pixels a pressed pointer travels before movestart + // event is fired. + var threshold = 8; + + // Shim for requestAnimationFrame, falling back to timer. See: + // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + var requestFrame = (function(){ + return ( + window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function(fn, element){ + return window.setTimeout(function(){ + fn(); + }, 25); + } + ); + })(); + + // Shim for customEvent + // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill + (function () { + if ( typeof window.CustomEvent === "function" ) return false; + function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); + return evt; + } + + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; + })(); + + var ignoreTags = { + textarea: true, + input: true, + select: true, + button: true + }; + + var mouseevents = { + move: 'mousemove', + cancel: 'mouseup dragstart', + end: 'mouseup' + }; + + var touchevents = { + move: 'touchmove', + cancel: 'touchend', + end: 'touchend' + }; + + var rspaces = /\s+/; + + + // DOM Events + + var eventOptions = { bubbles: true, cancelable: true }; + + var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; + + function createEvent(type) { + return new CustomEvent(type, eventOptions); + } + + function getEvents(node) { + return node[eventsSymbol] || (node[eventsSymbol] = {}); + } + + function on(node, types, fn, data, selector) { + types = types.split(rspaces); + + var events = getEvents(node); + var i = types.length; + var handlers, type; + + function handler(e) { fn(e, data); } + + while (i--) { + type = types[i]; + handlers = events[type] || (events[type] = []); + handlers.push([fn, handler]); + node.addEventListener(type, handler); + } + } + + function off(node, types, fn, selector) { + types = types.split(rspaces); + + var events = getEvents(node); + var i = types.length; + var type, handlers, k; + + if (!events) { return; } + + while (i--) { + type = types[i]; + handlers = events[type]; + if (!handlers) { continue; } + k = handlers.length; + while (k--) { + if (handlers[k][0] === fn) { + node.removeEventListener(type, handlers[k][1]); + handlers.splice(k, 1); + } + } + } + } + + function trigger(node, type, properties) { + // Don't cache events. It prevents you from triggering an event of a + // given type from inside the handler of another event of that type. + var event = createEvent(type); + if (properties) { assign(event, properties); } + node.dispatchEvent(event); + } + + + // Constructors + + function Timer(fn){ + var callback = fn, + active = false, + running = false; + + function trigger(time) { + if (active){ + callback(); + requestFrame(trigger); + running = true; + active = false; + } + else { + running = false; + } + } + + this.kick = function(fn) { + active = true; + if (!running) { trigger(); } + }; + + this.end = function(fn) { + var cb = callback; + + if (!fn) { return; } + + // If the timer is not running, simply call the end callback. + if (!running) { + fn(); + } + // If the timer is running, and has been kicked lately, then + // queue up the current callback and the end callback, otherwise + // just the end callback. + else { + callback = active ? + function(){ cb(); fn(); } : + fn ; + + active = true; + } + }; + } + + + // Functions + + function noop() {} + + function preventDefault(e) { + e.preventDefault(); + } + + function isIgnoreTag(e) { + return !!ignoreTags[e.target.tagName.toLowerCase()]; + } + + function isPrimaryButton(e) { + // Ignore mousedowns on any button other than the left (or primary) + // mouse button, or when a modifier key is pressed. + return (e.which === 1 && !e.ctrlKey && !e.altKey); + } + + function identifiedTouch(touchList, id) { + var i, l; + + if (touchList.identifiedTouch) { + return touchList.identifiedTouch(id); + } + + // touchList.identifiedTouch() does not exist in + // webkit yet… we must do the search ourselves... + + i = -1; + l = touchList.length; + + while (++i < l) { + if (touchList[i].identifier === id) { + return touchList[i]; + } + } + } + + function changedTouch(e, data) { + var touch = identifiedTouch(e.changedTouches, data.identifier); + + // This isn't the touch you're looking for. + if (!touch) { return; } + + // Chrome Android (at least) includes touches that have not + // changed in e.changedTouches. That's a bit annoying. Check + // that this touch has changed. + if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } + + return touch; + } + + + // Handlers that decide when the first movestart is triggered + + function mousedown(e){ + // Ignore non-primary buttons + if (!isPrimaryButton(e)) { return; } + + // Ignore form and interactive elements + if (isIgnoreTag(e)) { return; } + + on(document, mouseevents.move, mousemove, e); + on(document, mouseevents.cancel, mouseend, e); + } + + function mousemove(e, data){ + checkThreshold(e, data, e, removeMouse); + } + + function mouseend(e, data) { + removeMouse(); + } + + function removeMouse() { + off(document, mouseevents.move, mousemove); + off(document, mouseevents.cancel, mouseend); + } + + function touchstart(e) { + // Don't get in the way of interaction with form elements + if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } + + var touch = e.changedTouches[0]; + + // iOS live updates the touch objects whereas Android gives us copies. + // That means we can't trust the touchstart object to stay the same, + // so we must copy the data. This object acts as a template for + // movestart, move and moveend event objects. + var data = { + target: touch.target, + pageX: touch.pageX, + pageY: touch.pageY, + identifier: touch.identifier, + + // The only way to make handlers individually unbindable is by + // making them unique. + touchmove: function(e, data) { touchmove(e, data); }, + touchend: function(e, data) { touchend(e, data); } + }; + + on(document, touchevents.move, data.touchmove, data); + on(document, touchevents.cancel, data.touchend, data); + } + + function touchmove(e, data) { + var touch = changedTouch(e, data); + if (!touch) { return; } + checkThreshold(e, data, touch, removeTouch); + } + + function touchend(e, data) { + var touch = identifiedTouch(e.changedTouches, data.identifier); + if (!touch) { return; } + removeTouch(data); + } + + function removeTouch(data) { + off(document, touchevents.move, data.touchmove); + off(document, touchevents.cancel, data.touchend); + } + + function checkThreshold(e, data, touch, fn) { + var distX = touch.pageX - data.pageX; + var distY = touch.pageY - data.pageY; + + // Do nothing if the threshold has not been crossed. + if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } + + triggerStart(e, data, touch, distX, distY, fn); + } + + function triggerStart(e, data, touch, distX, distY, fn) { + var touches = e.targetTouches; + var time = e.timeStamp - data.timeStamp; + + // Create a movestart object with some special properties that + // are passed only to the movestart handlers. + var template = { + altKey: e.altKey, + ctrlKey: e.ctrlKey, + shiftKey: e.shiftKey, + startX: data.pageX, + startY: data.pageY, + distX: distX, + distY: distY, + deltaX: distX, + deltaY: distY, + pageX: touch.pageX, + pageY: touch.pageY, + velocityX: distX / time, + velocityY: distY / time, + identifier: data.identifier, + targetTouches: touches, + finger: touches ? touches.length : 1, + enableMove: function() { + this.moveEnabled = true; + this.enableMove = noop; + e.preventDefault(); + } + }; + + // Trigger the movestart event. + trigger(data.target, 'movestart', template); + + // Unbind handlers that tracked the touch or mouse up till now. + fn(data); + } + + + // Handlers that control what happens following a movestart + + function activeMousemove(e, data) { + var timer = data.timer; + + data.touch = e; + data.timeStamp = e.timeStamp; + timer.kick(); + } + + function activeMouseend(e, data) { + var target = data.target; + var event = data.event; + var timer = data.timer; + + removeActiveMouse(); + + endEvent(target, event, timer, function() { + // Unbind the click suppressor, waiting until after mouseup + // has been handled. + setTimeout(function(){ + off(target, 'click', preventDefault); + }, 0); + }); + } + + function removeActiveMouse() { + off(document, mouseevents.move, activeMousemove); + off(document, mouseevents.end, activeMouseend); + } + + function activeTouchmove(e, data) { + var event = data.event; + var timer = data.timer; + var touch = changedTouch(e, event); + + if (!touch) { return; } + + // Stop the interface from gesturing + e.preventDefault(); + + event.targetTouches = e.targetTouches; + data.touch = touch; + data.timeStamp = e.timeStamp; + + timer.kick(); + } + + function activeTouchend(e, data) { + var target = data.target; + var event = data.event; + var timer = data.timer; + var touch = identifiedTouch(e.changedTouches, event.identifier); + + // This isn't the touch you're looking for. + if (!touch) { return; } + + removeActiveTouch(data); + endEvent(target, event, timer); + } + + function removeActiveTouch(data) { + off(document, touchevents.move, data.activeTouchmove); + off(document, touchevents.end, data.activeTouchend); + } + + + // Logic for triggering move and moveend events + + function updateEvent(event, touch, timeStamp) { + var time = timeStamp - event.timeStamp; + + event.distX = touch.pageX - event.startX; + event.distY = touch.pageY - event.startY; + event.deltaX = touch.pageX - event.pageX; + event.deltaY = touch.pageY - event.pageY; + + // Average the velocity of the last few events using a decay + // curve to even out spurious jumps in values. + event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; + event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; + event.pageX = touch.pageX; + event.pageY = touch.pageY; + } + + function endEvent(target, event, timer, fn) { + timer.end(function(){ + trigger(target, 'moveend', event); + return fn && fn(); + }); + } + + + // Set up the DOM + + function movestart(e) { + if (e.defaultPrevented) { return; } + if (!e.moveEnabled) { return; } + + var event = { + startX: e.startX, + startY: e.startY, + pageX: e.pageX, + pageY: e.pageY, + distX: e.distX, + distY: e.distY, + deltaX: e.deltaX, + deltaY: e.deltaY, + velocityX: e.velocityX, + velocityY: e.velocityY, + identifier: e.identifier, + targetTouches: e.targetTouches, + finger: e.finger + }; + + var data = { + target: e.target, + event: event, + timer: new Timer(update), + touch: undefined, + timeStamp: e.timeStamp + }; + + function update(time) { + updateEvent(event, data.touch, data.timeStamp); + trigger(data.target, 'move', event); + } + + if (e.identifier === undefined) { + // We're dealing with a mouse event. + // Stop clicks from propagating during a move + on(e.target, 'click', preventDefault); + on(document, mouseevents.move, activeMousemove, data); + on(document, mouseevents.end, activeMouseend, data); + } + else { + // In order to unbind correct handlers they have to be unique + data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; + data.activeTouchend = function(e, data) { activeTouchend(e, data); }; + + // We're dealing with a touch. + on(document, touchevents.move, data.activeTouchmove, data); + on(document, touchevents.end, data.activeTouchend, data); + } + } + + on(document, 'mousedown', mousedown); + on(document, 'touchstart', touchstart); + on(document, 'movestart', movestart); + + + // jQuery special events + // + // jQuery event objects are copies of DOM event objects. They need + // a little help copying the move properties across. + + if (!window.jQuery) { return; } + + var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); + + function enableMove1(e) { e.enableMove(); } + function enableMove2(e) { e.enableMove(); } + function enableMove3(e) { e.enableMove(); } + + function add(handleObj) { + var handler = handleObj.handler; + + handleObj.handler = function(e) { + // Copy move properties across from originalEvent + var i = properties.length; + var property; + + while(i--) { + property = properties[i]; + e[property] = e.originalEvent[property]; + } + + handler.apply(this, arguments); + }; + } + + jQuery.event.special.movestart = { + setup: function() { + // Movestart must be enabled to allow other move events + on(this, 'movestart', enableMove1); + + // Do listen to DOM events + return false; + }, + + teardown: function() { + off(this, 'movestart', enableMove1); + return false; + }, + + add: add + }; + + jQuery.event.special.move = { + setup: function() { + on(this, 'movestart', enableMove2); + return false; + }, + + teardown: function() { + off(this, 'movestart', enableMove2); + return false; + }, + + add: add + }; + + jQuery.event.special.moveend = { + setup: function() { + on(this, 'movestart', enableMove3); + return false; + }, + + teardown: function() { + off(this, 'movestart', enableMove3); + return false; + }, + + add: add + }; +}); diff --git a/wp-content/plugins/compressx/includes/display/js/twentytwenty/jquery.twentytwenty.js b/wp-content/plugins/compressx/includes/display/js/twentytwenty/jquery.twentytwenty.js new file mode 100644 index 0000000..b09737f --- /dev/null +++ b/wp-content/plugins/compressx/includes/display/js/twentytwenty/jquery.twentytwenty.js @@ -0,0 +1,151 @@ +(function($){ + + $.fn.twentytwenty = function(options) { + var options = $.extend({ + default_offset_pct: 0.5, + orientation: 'horizontal', + before_label: 'Before', + after_label: 'After', + no_overlay: false, + move_slider_on_hover: false, + move_with_handle_only: true, + click_to_move: false + }, options); + + return this.each(function() { + + var sliderPct = options.default_offset_pct; + var container = $(this); + var sliderOrientation = options.orientation; + var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; + var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; + + + container.wrap("
        "); + if(!options.no_overlay) { + container.append("
        "); + var overlay = container.find(".twentytwenty-overlay"); + overlay.append("
        "); + overlay.append("
        "); + } + var beforeImg = container.find("img:first"); + var afterImg = container.find("img:last"); + container.append("
        "); + var slider = container.find(".twentytwenty-handle"); + slider.append(""); + slider.append(""); + container.addClass("twentytwenty-container"); + beforeImg.addClass("twentytwenty-before"); + afterImg.addClass("twentytwenty-after"); + + var calcOffset = function(dimensionPct) { + var w = beforeImg.width(); + var h = beforeImg.height(); + return { + w: w+"px", + h: h+"px", + cw: (dimensionPct*w)+"px", + ch: (dimensionPct*h)+"px" + }; + }; + + var adjustContainer = function(offset) { + if (sliderOrientation === 'vertical') { + beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); + afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); + } + else { + beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); + afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); + } + container.css("height", offset.h); + }; + + var adjustSlider = function(pct) { + var offset = calcOffset(pct); + slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); + adjustContainer(offset); + }; + + // Return the number specified or the min/max number if it outside the range given. + var minMaxNumber = function(num, min, max) { + return Math.max(min, Math.min(max, num)); + }; + + // Calculate the slider percentage based on the position. + var getSliderPercentage = function(positionX, positionY) { + var sliderPercentage = (sliderOrientation === 'vertical') ? + (positionY-offsetY)/imgHeight : + (positionX-offsetX)/imgWidth; + + return minMaxNumber(sliderPercentage, 0, 1); + }; + + + $(window).on("resize.twentytwenty", function(e) { + adjustSlider(sliderPct); + }); + + var offsetX = 0; + var offsetY = 0; + var imgWidth = 0; + var imgHeight = 0; + var onMoveStart = function(e) { + if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { + e.preventDefault(); + } + else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { + e.preventDefault(); + } + container.addClass("active"); + offsetX = container.offset().left; + offsetY = container.offset().top; + imgWidth = beforeImg.width(); + imgHeight = beforeImg.height(); + }; + var onMove = function(e) { + if (container.hasClass("active")) { + sliderPct = getSliderPercentage(e.pageX, e.pageY); + adjustSlider(sliderPct); + } + }; + var onMoveEnd = function() { + container.removeClass("active"); + }; + + var moveTarget = options.move_with_handle_only ? slider : container; + moveTarget.on("movestart",onMoveStart); + moveTarget.on("move",onMove); + moveTarget.on("moveend",onMoveEnd); + + if (options.move_slider_on_hover) { + container.on("mouseenter", onMoveStart); + container.on("mousemove", onMove); + container.on("mouseleave", onMoveEnd); + } + + slider.on("touchmove", function(e) { + e.preventDefault(); + }); + + container.find("img").on("mousedown", function(event) { + event.preventDefault(); + }); + + if (options.click_to_move) { + container.on('click', function(e) { + offsetX = container.offset().left; + offsetY = container.offset().top; + imgWidth = beforeImg.width(); + imgHeight = beforeImg.height(); + + sliderPct = getSliderPercentage(e.pageX, e.pageY); + adjustSlider(sliderPct); + }); + } + + $(window).trigger("resize.twentytwenty"); + }); + }; + +})(jQuery); diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-addons-display.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-addons-display.php new file mode 100644 index 0000000..50d93c9 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-addons-display.php @@ -0,0 +1,163 @@ + +
        +
        + output_header(); + $this->output_addons(); + $this->output_footer(); + ?> +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        + +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + + + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        + ajax_check_security(); + + $force=isset($_POST['force'])?sanitize_key($_POST['force']):'0'; + if($force=='1') + { + $force=true; + } + else + { + $force=false; + } + + $start_row=isset($_POST['offset'])?sanitize_key($_POST['offset']):0; + + $ret=CompressX_Image_Scanner::scan_unoptimized_images_v2($force,$start_row); + + echo wp_json_encode($ret); + + die(); + } + + public function init_bulk_optimization_task() + { + global $compressx; + $compressx->ajax_check_security(); + + $force=isset($_POST['force'])?sanitize_key($_POST['force']):'0'; + if($force=='1') + { + $force=true; + } + else + { + $force=false; + } + + $task=new CompressX_ImgOptim_Task(); + $ret=$task->init_task($force); + echo wp_json_encode($ret); + die(); + } + + public function run_optimize() + { + global $compressx; + $compressx->ajax_check_security(); + + set_time_limit(120); + $task=new CompressX_ImgOptim_Task(); + + $ret=$task->get_task_status(); + + if($ret['result']=='success'&&$ret['status']=='completed') + { + $this->flush($ret); + $task->do_optimize_image(); + //echo wp_json_encode($ret); + } + else + { + echo wp_json_encode($ret); + } + + die(); + } + + private function flush($ret) + { + $json=wp_json_encode($ret); + if(!headers_sent()) + { + header('Content-Length: '.strlen($json)); + header('Connection: close'); + header('Content-Encoding: none'); + } + + + if (session_id()) + session_write_close(); + echo wp_json_encode($ret); + + if(function_exists('fastcgi_finish_request')) + { + fastcgi_finish_request(); + } + else + { + ob_flush(); + flush(); + } + } + + public function get_opt_progress() + { + global $compressx; + $compressx->ajax_check_security(); + + $task=new CompressX_ImgOptim_Task(); + + $result=$task->get_task_progress_ex(); + + // $file_name=$task->get_log_file(); + // if(empty($file_name)) + // { + // $log=CompressX_Log_Ex::get_instance(); + // $log->OpenLogFile(); + // } + // else + // { + // $log=CompressX_Log_Ex::get_instance(); + // $log->OpenLogFile($file_name); + // } + + echo wp_json_encode($result); + + die(); + } + + public function get_task_log() + { + global $compressx; + $compressx->ajax_check_security(); + + $task=new CompressX_ImgOptim_Task(); + + $offset=isset($_POST['offset'])?sanitize_key($_POST['offset']):0; + $offset=intval($offset); + + $file_name=$task->get_log_file(); + if(empty($file_name)) + { + $log=CompressX_Log_Ex::get_instance(); + $log->OpenLogFile(); + } + else + { + $log=CompressX_Log_Ex::get_instance(); + $log->OpenLogFile($file_name); + } + + $ret=$log->get_log_content($offset); + + echo wp_json_encode($ret); + die(); + } + + public function download_task_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try { + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is verified in ajax_check_security above + $task=new CompressX_ImgOptim_Task(); + $file_name=$task->get_log_file(); + if(!empty($file_name)) + { + $log=CompressX_Log_Ex::get_instance(); + $log->OpenLogFile($file_name); + $path=$log->log_file; + } + else + { + die(); + } + + if (!file_exists($path)) + { + die(); + } + + if (session_id()) { + session_write_close(); + } + + $size = filesize($path); + if (!headers_sent()) { + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="' . $file_name . '"'); + header('Content-Transfer-Encoding: binary'); + header('Connection: Keep-Alive'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + header('Content-Length: ' . $size); + } + + ob_end_clean(); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile -- Sending file to browser for download + readfile($path); + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + } + exit; + } + + public function display() + { + ?> +
        +
        + output_header(); + $this->output_review(); + $this->output_warning(); + $this->output_bulk(); + $this->output_progress(); + $this->output_comparison(); + $this->output_logs(); + $this->output_footer(); + ?> +
        +
        + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        + +
        +

        + +

        +
        +
        +
        + +
        +
        +

        + +
        + +

        + (). +

        + +
        + +
        + +
        + +
        + +
        +
        + +

        + (). +

        +
        + +
        + +

        + + (). +

        +
        +
        +
        + + + + +
        +

        +

        + +

        + +
        +
        +
        +
        + +
        +
        + + +
        +
        + +
        +
        +

        +

        + +

        +
        + +
        +

        +

        + +

        +

        +

        +
        + +
        +

        +

        + +

        +

        +

        +
        +
        +
        + get_recent_logs(); + $url=admin_url('admin.php?page=info-compressx'); + ?> +
        +
        +

        + +
        + +
        + + + + + + + + + + + + + + + + + + + +
        + + + +
        +
        +
        + + + + get_log_list(); + + $formatted_logs = array(); + $count = 0; + foreach ($log_list as $log) { + if ($count >= 10) break; + + $size_formatted = 'N/A'; + if (isset($log['size']) && is_numeric($log['size'])) { + if ($log['size'] >= 1024) { + $size_formatted = round($log['size'] / 1024, 2) . ' KB'; + } else { + $size_formatted = $log['size'] . ' B'; + } + } + + $formatted_logs[] = array( + 'date' => isset($log['date']) ? $log['date'] : gmdate('M-d-y H:i'), + 'filename' => isset($log['name']) ? $log['name'] : (isset($log['file_name']) ? $log['file_name'] : 'unknown.txt'), + 'size' => $size_formatted, + 'detail_url' => '#', + 'download_url' => '#', + 'delete_url' => '#' + ); + $count++; + } + + return $formatted_logs; + } + + /* old + private function get_log_list() + { + $log_list = array(); + $log = new CompressX_Log(); + $dir = $log->GetSaveLogFolder(); + $files = array(); + $handler = opendir($dir); + $regex = '#^compressx.*_log.txt#'; + + if ($handler !== false) { + while (($filename = readdir($handler)) !== false) { + if ($filename != "." && $filename != "..") { + if (is_dir($dir . $filename)) { + continue; + } else { + if (preg_match($regex, $filename)) { + $files[$filename] = $dir . $filename; + } + } + } + } + if ($handler) { + @closedir($handler); + } + } + + foreach ($files as $file) { + $handle = @fopen($file, "r"); + if ($handle) { + $log_file = array(); + $log_file['file_name'] = basename($file); + if (preg_match('/compressx-(.*?)_/', basename($file), $matches)) { + $id = $matches[0]; + $id = substr($id, 0, strlen($id) - 1); + $log_file['id'] = $id; + } + $log_file['path'] = $file; + $log_file['size'] = filesize($file); + $log_file['name'] = basename($file); + $log_file['time'] = filemtime($file); + + $offset = get_option('gmt_offset'); + $localtime = $log_file['time'] + $offset * 60 * 60; + $log_file['date'] = gmdate('M-d-y H:i', $localtime); + + $line = fgets($handle); + if ($line !== false) { + $pos = strpos($line, 'Log created: '); + if ($pos !== false) { + $log_file['time'] = substr($line, $pos + strlen('Log created: ')); + } + } + + fclose($handle); + $log_list[basename($file)] = $log_file; + } + } + + uasort($log_list, function ($a, $b) { + if ($a['time'] > $b['time']) { + return -1; + } else if ($a['time'] === $b['time']) { + return 0; + } else { + return 1; + } + }); + + return $log_list; + } + */ + + private function get_log_list() + { + + $log_list = array(); + + $log = new CompressX_Log(); + $dir = trailingslashit( $log->GetSaveLogFolder() ); + + // Init WP_Filesystem. + global $wp_filesystem; + if ( empty( $wp_filesystem ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + WP_Filesystem(); + } + + if ( empty( $wp_filesystem ) ) { + return $log_list; + } + + if ( ! $wp_filesystem->is_dir( $dir ) ) { + return $log_list; + } + + $regex = '#^compressx.*_log\.txt$#'; + + // List directory files. + $dir_list = $wp_filesystem->dirlist( $dir, false, false ); + + if ( empty( $dir_list ) || ! is_array( $dir_list ) ) { + return $log_list; + } + + foreach ( $dir_list as $filename => $info ) { + + if ( empty( $filename ) ) { + continue; + } + + // Skip folders. + if ( isset( $info['type'] ) && 'd' === $info['type'] ) { + continue; + } + + // Match log files. + if ( ! preg_match( $regex, $filename ) ) { + continue; + } + + $file = $dir . $filename; + + $log_file = array(); + $log_file['file_name'] = $filename; + $log_file['path'] = $file; + $log_file['name'] = $filename; + + // Size. + $size = $wp_filesystem->size( $file ); + $log_file['size'] = ( false === $size ) ? 0 : (int) $size; + + // Time. + $mtime = $wp_filesystem->mtime( $file ); + $mtime = ( false === $mtime ) ? 0 : (int) $mtime; + $log_file['time'] = $mtime; + + // ID extraction (keep your original logic). + if ( preg_match( '/compressx-(.*?)_/', $filename, $matches ) ) { + $id = $matches[0]; + $id = substr( $id, 0, strlen( $id ) - 1 ); + $log_file['id'] = $id; + } + + // Local time format. + $offset = (float) get_option( 'gmt_offset' ); + $localtime = $mtime + (int) ( $offset * 3600 ); + $log_file['date'] = gmdate( 'M-d-y H:i', $localtime ); + + // Read first line from log file (simulate fgets). + $content = $wp_filesystem->get_contents( $file ); + + if ( ! empty( $content ) ) { + $lines = preg_split( "/\r\n|\n|\r/", $content ); + $line = isset( $lines[0] ) ? $lines[0] : ''; + + if ( ! empty( $line ) ) { + $pos = strpos( $line, 'Log created: ' ); + if ( false !== $pos ) { + $log_file['time'] = substr( $line, $pos + strlen( 'Log created: ' ) ); + } + } + } + + $log_list[ $filename ] = $log_file; + } + + uasort( + $log_list, + function ( $a, $b ) { + if ( $a['time'] > $b['time'] ) { + return -1; + } elseif ( $a['time'] === $b['time'] ) { + return 0; + } else { + return 1; + } + } + ); + + return $log_list; + } + + public function get_latest_image_data() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-image-optimization'); + + $current_image_id=CompressX_Options::get_option('compressx_latest_bulk_image',null);// + + + $meta=CompressX_Image_Meta_V2::get_image_meta($current_image_id); + if(empty($current_image_id)) + { + $default_image_data=true; + } + else if(empty($meta)) + { + $default_image_data=true; + } + else if(wp_get_attachment_url( $current_image_id )===false) + { + $default_image_data=true; + } + else + { + if($this->webp_converted_exist($current_image_id)||$this->avif_converted_exist($current_image_id)) + { + $default_image_data=false; + } + else + { + $default_image_data=true; + } + } + + $ret['compressx_latest_bulk_image']=$current_image_id; + $ret['default_image_data']=$default_image_data; + + if($default_image_data) + { + $og_test_file='/includes/assets/compressx_test.png'; + $og_test_webp_file='/includes/assets/compressx_test.png.webp'; + $test_file='compressx_test_comparison.png'; + $test_webp_file='compressx_test_comparison.webp'; + + $upload_dir = wp_upload_dir(); + $path = $upload_dir['basedir'] . '/' .$test_file; + if (!file_exists($path)) + { + $og_path = COMPRESSX_DIR . $og_test_file; + copy($og_path, $path); + } + + $path2 = $upload_dir['basedir'] . '/' . $test_webp_file; + + if (!file_exists($path2)) + { + $og_path = COMPRESSX_DIR . $og_test_webp_file; + copy($og_path, $path2); + } + + $url=$upload_dir['baseurl'].'/'. $test_file; + $url2=$upload_dir['baseurl'].'/'. $test_webp_file; + + $original_size=filesize($path); + $webp_size=filesize($path2); + $savings = round((($original_size - $webp_size) / $original_size) * 100); + $current_image['original_path']=$path; + $current_image['original_url']=$url; + $current_image['webp_path']=$path2; + $current_image['webp_url']=$url2; + $current_image['avif_path']=''; + $current_image['avif_url']=''; + $current_image['original_size']=size_format($original_size,2); + $current_image['webp_size']=size_format($webp_size,2); + $current_image['webp_savings'] ="~{$savings}% smaller"; + $current_image['avif_size']=""; + $current_image['avif_savings']=""; + + $current_image['webp_disabled'] = false; + $current_image['avif_disabled'] = true; + } + else + { + $og_url=wp_get_attachment_url($current_image_id); + $current_image['original_url']=$og_url.'?original'; + $current_image['original_path'] = get_attached_file($current_image_id); + $meta=CompressX_Image_Meta_V2::get_image_meta($current_image_id); + + $current_image['original_size']=size_format($meta['og_file_size']); + + if($meta['webp_converted']) + { + $current_image['webp_disabled'] = false; + $current_image['webp_size'] = size_format($meta['webp_converted_size'],2); + $savings = round((( $meta['og_file_size'] - $meta['webp_converted_size']) / $meta['og_file_size']) * 100); + + $output_path=CompressX_Image_Method::get_output_path($current_image['original_path']); + if(isset($meta['mime_type'])&&$meta['mime_type']=="image/webp") + { + $current_image['webp_path']=$output_path; + $current_image['webp_url']=$this->get_nextgen_url($og_url).'?original'; + } + else + { + $current_image['webp_path']=$output_path.'.webp'; + $current_image['webp_url']=$this->get_nextgen_url($og_url).'.webp?original'; + } + + $current_image['webp_savings'] ="~{$savings}% smaller"; + } + else + { + $current_image['webp_disabled'] = true; + $current_image['webp_path']=''; + $current_image['webp_url']=''; + $current_image['webp_size'] =0; + $current_image['webp_savings'] =0; + } + + if($meta['avif_converted']) + { + $current_image['avif_disabled'] = false; + $output_path=CompressX_Image_Method::get_output_path($current_image['original_path']); + if(isset($meta['mime_type'])&&$meta['mime_type']=="image/avif") + { + $current_image['avif_path']=$output_path; + $current_image['avif_url']=$this->get_nextgen_url($og_url).'?original'; + } + else + { + $current_image['avif_path']=$output_path.'.avif'; + $current_image['avif_url']=$this->get_nextgen_url($og_url).'.avif?original'; + } + + $current_image['avif_size'] = size_format($meta['avif_converted_size'],2); + $savings = round((( $meta['og_file_size'] - $meta['avif_converted_size']) / $meta['og_file_size']) * 100); + $current_image['avif_savings'] ="~{$savings}% smaller"; + } + else + { + $current_image['avif_disabled'] = true; + $current_image['avif_path']=''; + $current_image['avif_url']=''; + $current_image['avif_size'] = 0; + $current_image['avif_savings']=0; + } + } + + $ret['result']='success'; + $ret['current_image']=$current_image; + echo wp_json_encode($ret); + die(); + } + + public function webp_converted_exist($image_id) + { + $original_path = get_attached_file($image_id); + $meta=CompressX_Image_Meta_V2::get_image_meta($image_id); + if($meta['webp_converted']) + { + $output_path=CompressX_Image_Method::get_output_path($original_path); + if(isset($meta['mime_type'])&&$meta['mime_type']=="image/webp") + { + $webp_path=$output_path; + } + else + { + $webp_path=$output_path.'.webp'; + } + + if(file_exists($webp_path)) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public function avif_converted_exist($image_id) + { + $original_path = get_attached_file($image_id); + $meta=CompressX_Image_Meta_V2::get_image_meta($image_id); + + if($meta['avif_converted']) + { + $output_path=CompressX_Image_Method::get_output_path($original_path); + if(isset($meta['mime_type'])&&$meta['mime_type']=="image/avif") + { + $avif_path=$output_path; + } + else + { + $avif_path=$output_path.'.avif'; + } + + if(file_exists($avif_path)) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public function get_nextgen_url( $orig_url ) + { + $upload_dir = wp_get_upload_dir(); + + return str_replace( + $upload_dir['baseurl'], + content_url( 'compressx-nextgen/uploads' ), + $orig_url + ); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-cdn-display.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-cdn-display.php new file mode 100644 index 0000000..db79021 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-cdn-display.php @@ -0,0 +1,438 @@ + +
        +
        + output_header(); + $this->output_cdn(); + $this->output_save_section(); + $this->output_footer(); + ?> +
        +
        + + +
        +
        +

        +

        + + +
        + +
        + render_cloudflare_settings($zone_id, $email, $api_key); + $this->render_cloudflare_features($auto_purge_cache_checked, $auto_purge_cache_after_manual_checked); + ?> +
        + + render_bunnycdn_placeholder(); ?> +
        + +
        +

        +

        + +
        +
        + + +
        +
        + + +
        +
        + + +
        +
        +
        + +
        +

        + +
        + + + + +
        + + + +
        +
        +
        + + + +
        +
        +

        + +

        +

        + +

        +
        +
        + +
        +
        +
        + + + +
        +
        +
        + 'compressx-v2-h-4 compressx-v2-w-4', + 'medium' => 'compressx-v2-h-5 compressx-v2-w-5', + 'large' => 'compressx-v2-h-6 compressx-v2-w-6' + ); + + $button_class = isset($size_classes[$button_size]) ? $size_classes[$button_size] : $size_classes['medium']; + ?> +
        + + + +
        + ajax_check_security('compressx-can-use-cdn'); + + if(isset($_POST['setting'])&&!empty($_POST['setting'])) + { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) + { + $ret['result']='failed'; + $ret['error']='json decode failed'; + echo wp_json_encode($ret); + die(); + } + + if($this->need_test($setting)) + { + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + $cdn=new CompressX_CloudFlare_CDN($setting); + + $ret=$cdn->purge_cache(); + + if($ret['result']!='success') + { + echo wp_json_encode($ret); + die(); + } + } + + $options=CompressX_Options::get_option('compressx_general_settings',array()); + + if(isset($setting['zone_id'])) { + $options['cf_cdn']['zone_id']=$setting['zone_id']; + } + if(isset($setting['email'])) { + $options['cf_cdn']['email']=$setting['email']; + } + if(isset($setting['api_key'])) { + $options['cf_cdn']['api_key']=$setting['api_key']; + } + if(isset($setting['auto_purge_cache'])) + { + $options['cf_cdn']['auto_purge_cache']=$setting['auto_purge_cache']; + } + else + { + $options['cf_cdn']['auto_purge_cache']=false; + } + + if(isset($setting['auto_purge_cache_after_manual'])) + { + $options['cf_cdn']['auto_purge_cache_after_manual']=$setting['auto_purge_cache_after_manual']; + } + else + { + $options['cf_cdn']['auto_purge_cache_after_manual']=false; + } + + CompressX_Options::update_option('compressx_general_settings',$options); + + $ret['result']='success'; + echo wp_json_encode($ret); + die(); + } + else + { + die(); + } + } + + public function need_test($setting) + { + if(isset($setting['auto_purge_cache'])&&$setting['auto_purge_cache']) + { + return true; + } + + if(isset($setting['auto_purge_cache_after_manual'])&&$setting['auto_purge_cache_after_manual']) + { + return true; + } + + return false; + } + + public function purge_cache() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-cdn'); + + if(isset($_POST['setting'])&&!empty($_POST['setting'])) + { + $json_setting = sanitize_text_field($_POST['setting']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) + { + $ret['result']='failed'; + $ret['error']='json decode failed'; + echo wp_json_encode($ret); + die(); + } + + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + + $cdn=new CompressX_CloudFlare_CDN($setting); + + $ret=$cdn->purge_cache(); + + echo wp_json_encode($ret); + die(); + } + else + { + include_once COMPRESSX_DIR . '/includes/class-compressx-cloudflare-cdn.php'; + + $options=CompressX_Options::get_option('compressx_general_settings',array()); + + $setting=$options['cf_cdn']; + + $cdn=new CompressX_CloudFlare_CDN($setting); + + $ret=$cdn->purge_cache(); + + echo wp_json_encode($ret); + die(); + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-custom-bulk-action-v2.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-custom-bulk-action-v2.php new file mode 100644 index 0000000..3c593f3 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-custom-bulk-action-v2.php @@ -0,0 +1,676 @@ +support_extension=array(); + $this->support_extension[]='jpg'; + $this->support_extension[]='jpeg'; + $this->support_extension[]='png'; + $this->support_extension[]='webp'; + + add_action('wp_ajax_compressx_get_custom_tree_dir_ex', array($this, 'get_custom_tree_dir_ex')); + add_action('wp_ajax_compressx_add_include_folders', array($this, 'add_include_folders')); + add_action('wp_ajax_compressx_remove_include_folders', array($this, 'remove_include_folders')); + // + add_action('wp_ajax_compressx_start_scan_custom_images', array($this, 'start_scan_custom_images')); + add_action('wp_ajax_compressx_init_custom_bulk_optimization_task', array($this, 'init_custom_bulk_optimization_task')); + add_action('wp_ajax_compressx_run_custom_optimize', array($this, 'run_custom_optimize')); + add_action('wp_ajax_compressx_get_custom_opt_progress', array($this, 'get_custom_opt_progress')); + add_action('wp_ajax_compressx_get_dir_info', array($this, 'get_dir_info')); + // + add_action('cx_output_custom_bulk',array($this, 'output_custom_bulk')); + } + + public function output_custom_bulk() + { + CompressX_Custom_Image_Meta::check_custom_table(); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + $stats=$this->get_custom_stats($includes); + $found=$stats['files']; + $saved=$stats['saved']; + $processed=$stats['processed_files']; + ?> +
        +
        +
        +
        +
        +
        +
        + +
        +
        + output_custom_folders(); + ?> +
        +
        + + | + % | + + +
        +
        + + + +
        +
        + +
        +
        +
        +
        +
        +
        + get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif); + } + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + return $stats; + } + + public function get_folder_stats($path,&$stats,$convert_to_webp,$convert_to_avif) + { + try { + $count=0; + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + + foreach ($rii as $file) + { + if ($file->isDir()) + { + continue; + } + + if($this->is_support_extension($file->getExtension())) + { + $filename=$path.'/'.$file->getFilename(); + $filename=$this->transfer_path($filename); + + $type=pathinfo($filename, PATHINFO_EXTENSION); + + if($convert_to_webp&&$type!="webp") + { + if(CompressX_Custom_Image_Meta::is_convert_webp($filename)) + { + $stats['processed_files']++; + $stats['processed']+=CompressX_Custom_Image_Meta::get_convert_webp_size($filename); + } + + $count++; + $stats['files']++; + $stats['total']+=$file->getSize(); + } + else if($convert_to_avif&&$type!="avif") + { + if(CompressX_Custom_Image_Meta::is_convert_avif($filename)) + { + $stats['processed_files']++; + $stats['processed']+=CompressX_Custom_Image_Meta::get_convert_avif_size($filename); + } + + $count++; + $stats['files']++; + $stats['total']+=$file->getSize(); + } + } + } + return $count; + } + catch (Exception $exception) + { + return 0; + } + + } + + public function is_support_extension($extension) + { + if(in_array($extension,$this->support_extension)) + { + return true; + } + else + { + return false; + } + } + + public function output_custom_folders() + { + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + + $convert_to_avif=CompressX_Options::get_option('compressx_output_format_avif',1); + + if($convert_to_avif&&CompressX_Image_Opt_Method::is_support_avif()) + { + $convert_to_avif=true; + } + else + { + $convert_to_avif=false; + } + + ?> +
        +
        + + + +
        +
        +
        +
        + + + + +
        +
          + +
        • + + get_children_count($include,$convert_to_avif).')')?> + +
        • + +
        +
        +
        +
        + ajax_check_security('compressx-can-bulk-custom-convert'); + + try{ + $node_array = array(); + + if ($_POST['tree_node']['node']['id'] == '#') + { + $path = ABSPATH; + + if (!empty($_POST['tree_node']['path'])) + { + $path = sanitize_text_field($_POST['tree_node']['path']); + } + } else { + $path = sanitize_text_field($_POST['tree_node']['node']['id']); + } + + $path = trailingslashit(str_replace('\\', '/', realpath($path))); + + if ($dh = opendir($path)) + { + while (substr($path, -1) == '/') + { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) + { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) + { + if (is_dir($path . '/' . $value)) + { + if(!$this->is_media_folder($path . '/' . $value)) + { + $node['children'] = $this->has_children($path . '/' . $value); + $node['id'] = $path . '/' . $value; + $node['icon'] = 'dashicons dashicons-category cx-icon-color-techblue'; + $node['text'] =''.$value.''; + $node['text'] .=''; + $node_array[] = $node; + } + } + else{ + continue; + } + } + } + } + + $ret['nodes'] = $node_array; + echo wp_json_encode($ret); + } + catch (Exception $error) { + $message = 'An exception has occurred. class: '.get_class($error).';msg: '.$error->getMessage().';code: '.$error->getCode().';line: '.$error->getLine().';in_file: '.$error->getFile().';'; + //error_log($message); + echo wp_json_encode(array('result'=>'failed','error'=>$message)); + } + die(); + } + + public function has_children($path) + { + if ($dh = opendir($path)) + { + while (substr($path, -1) == '/') + { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) + { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) + { + if (is_dir($path . '/' . $value)) + { + return true; + } + } + } + } + + return false; + } + + public function is_media_folder($path) + { + $upload_dir = wp_upload_dir(); + $base_dir = $upload_dir['basedir']; + $base_dir = trailingslashit(str_replace('\\', '/', realpath($base_dir))); + $path=str_replace( $base_dir, '', $path ); + $path_arr = explode( '/', $path ); + + if ( count( $path_arr ) >= 1) + { + if(is_numeric( $path_arr[0] ) && $path_arr[0] > 1950 && $path_arr[0] < 2050) + { + return true; + } + } + + $path=$this->transfer_path($path); + $upload_root=$this->transfer_path($upload_dir['basedir']); + $compressx1=$this->transfer_path(WP_CONTENT_DIR.'/compressx'); + $compressx2=$this->transfer_path(WP_CONTENT_DIR.'/compressx-nextgen'); + + if($path==$compressx1) + { + return true; + } + else if($path==$compressx2) + { + return true; + } + else if($path==$upload_root) + { + return true; + } + + return false; + } + + public function get_children_count($path,$convert_to_avif) + { + try { + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + $files = 0; + + /** @var SplFileInfo $file */ + foreach ($rii as $file) + { + if ($file->isDir()) + { + continue; + } + + if($this->is_support_extension($file->getExtension())) + { + $filename=$path.'/'.$file->getFilename(); + $type=pathinfo($filename, PATHINFO_EXTENSION); + + if($type=='webp'&&$convert_to_avif) + { + $files++; + } + else + { + $files++; + } + + } + + } + + return $files; + } + catch (Exception $e) + { + return 0; + } + } + + public function add_include_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + + $new_include = sanitize_text_field($_POST['id']); + + $new_includes[$new_include]=$new_include; + + $includes=array_merge($includes,$new_includes); + + CompressX_Options::update_option('compressx_custom_includes',$includes); + + $stats=array(); + + $stats['files']=0; + $stats['saved']=0; + $stats['processed_files']=0; + $stats['total']=0; + $stats['processed']=0; + + $convert_to_webp=CompressX_Image_Opt_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Opt_Method::get_convert_to_avif(); + + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + + $html='
          '; + foreach ($includes as $include) + { + $path=str_replace($abs_path,'',$include); + $html.= '
        • '. + ''.$path.'('.$this->get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif).')'.''. + '
        • '; + } + $html.='
            '; + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + $ret['result']='success'; + $ret['html']=$html; + $ret['found']=$stats['files']; + $ret['saved']=$stats['saved']; + $ret['processed']=$stats['processed_files']; + + echo wp_json_encode($ret); + die(); + } + + public function get_dir_info() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + + $stats=array(); + + $stats['files']=0; + $stats['saved']=0; + $stats['processed_files']=0; + $stats['total']=0; + $stats['processed']=0; + + $convert_to_webp=CompressX_Image_Opt_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Opt_Method::get_convert_to_avif(); + + foreach ($includes as $include) + { + $this->get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif); + } + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + $ret['result']='success'; + $ret['found']=$stats['files']; + $ret['saved']=$stats['saved']; + $ret['processed']=$stats['processed_files']; + + echo wp_json_encode($ret); + die(); + } + + public function remove_include_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + + $id = sanitize_text_field($_POST['id']); + unset($includes[$id]); + + CompressX_Options::update_option('compressx_custom_includes',$includes); + + $stats=array(); + + $stats['files']=0; + $stats['saved']=0; + $stats['processed_files']=0; + $stats['total']=0; + $stats['processed']=0; + + $convert_to_webp=CompressX_Image_Opt_Method::get_convert_to_webp(); + $convert_to_avif=CompressX_Image_Opt_Method::get_convert_to_avif(); + + foreach ($includes as $include) + { + $this->get_folder_stats($include,$stats,$convert_to_webp,$convert_to_avif); + } + + if($stats['total']>0) + { + $stats['saved'] = ( $stats['processed'] / $stats['total'] ) * 100; + $stats['saved'] = round( $stats['saved'], 1 ); + } + + $ret['result']='success'; + $ret['found']=$stats['files']; + $ret['saved']=$stats['saved']; + $ret['processed']=$stats['processed_files']; + + echo wp_json_encode($ret); + die(); + } + + public function start_scan_custom_images() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $includes=CompressX_Options::get_option('compressx_custom_includes',array()); + if(empty($includes)) + { + $ret['result']='failed'; + $ret['error']='Please select at least one folder to process.'; + echo wp_json_encode($ret); + die(); + } + + CompressX_Options::update_option("compressx_need_optimized_custom_images",array()); + + $images=array(); + + foreach ($includes as $include) + { + $this->get_folder_images($images,$include); + } + + CompressX_Options::update_option("compressx_need_optimized_custom_images",$images); + + $ret['result']='success'; + $ret['progress']=sprintf( + 'Scanning: %1$d Found | View Log', + sizeof($images)); + $ret['finished']=true; + $ret['test']=$includes; + + echo wp_json_encode($ret); + + die(); + } + + public function get_folder_images(&$images,$path) + { + if(is_dir($path)) + { + $handler = opendir($path); + if($handler!==false) + { + while (($filename = readdir($handler)) !== false) + { + if ($filename != "." && $filename != "..") + { + if (is_dir($path . DIRECTORY_SEPARATOR . $filename)) + { + $this->get_folder_images($images, $path . DIRECTORY_SEPARATOR . $filename); + } + else + { + if($this->check_image($path . DIRECTORY_SEPARATOR . $filename)) + { + $images[] = $path . DIRECTORY_SEPARATOR . $filename; + } + } + } + } + if($handler) + @closedir($handler); + } + } + } + + public function check_image($file) + { + if ( ! file_exists( $file )) + { + return false; + } + $extension = array('jpg', 'jpeg', 'png','webp','avif'); + + $ext = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); + + if ( !in_array( $ext, $extension, true ) ) + { + return false; + } + + return true; + } + + public function init_custom_bulk_optimization_task() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $force=isset($_POST['force'])?sanitize_key($_POST['force']):'0'; + if($force=='1') + { + $force=true; + } + else + { + $force=false; + } + + $task=new CompressX_Custom_ImgOptim_Task(); + $ret=$task->init_task($force); + echo wp_json_encode($ret); + die(); + } + + public function run_custom_optimize() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + set_time_limit(180); + + $task=new CompressX_Custom_ImgOptim_Task(); + + $ret=$task->get_task_status(); + + if($ret['result']=='success'&&$ret['status']=='completed') + { + $ret=$task->do_optimize_image(); + echo wp_json_encode($ret); + } + else + { + echo wp_json_encode($ret); + } + die(); + } + + public function get_custom_opt_progress() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-bulk-custom-convert'); + + $task=new CompressX_Custom_ImgOptim_Task(); + + $result=$task->get_task_progress(); + + echo wp_json_encode($result); + + die(); + } + + private function transfer_path($path) + { + $path = str_replace('\\','/',$path); + $values = explode('/',$path); + return implode(DIRECTORY_SEPARATOR,$values); + } +} diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-image-optimization-display.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-image-optimization-display.php new file mode 100644 index 0000000..a4a332c --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-image-optimization-display.php @@ -0,0 +1,2133 @@ +bulk_optimization=new CompressX_Bulk_Optimization_Display(); + add_action('compressx_output_review_v2', array($this, 'output_review')); + add_action('wp_ajax_compressx_save_image_optimization_settings', array($this, 'set_setting')); + add_action('wp_ajax_compressx_rating_dismiss', array($this, 'compressx_rating_dismiss')); + + add_action('wp_ajax_compressx_hide_big_update_v2', array($this, 'hide_big_update')); + } + + public function display() + { + $view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : ''; + switch ($view) + { + case 'bulk': + $this->bulk_optimization->display(); + break; + default: + $this->display_image_optimization(); + break; + } + } + + public function display_image_optimization() + { + ?> +
            +
            + output_header(); + $this->output_review(); + $this->output_notice(); + $this->output_format(); + $this->output_quality(); + $this->output_settings(); + $this->output_save_section(); + $this->output_footer(); + ?> +
            +
            + get_bulk_progress(); + ?> + +
            + +
            +

            + +

            +

            + +

            +
            + +
            + +
            +
            + +
            + +
            +

            + ' . esc_html( $opt_size ) . '' + ); + ?> +

            +

            + ' . esc_html__( '5-star review', 'compressx' ) . '' + ); + ?> + +

            + + +
            + + + + +
            +
            +
            + + +
            + + +

            + 🚀 +

            + + +

            + + +

            + + +
              +
            • 🎨
            • + +
            • 🔄
            • +
            + + +

            + let us know — we\'ll fix it quickly.', 'compressx' ) + ), + esc_url( 'https://wordpress.org/support/plugin/compressx/' ) + ); + ?> + +

            + + +
            + +
            +
            + +
            +
            + +
            +

            + +

            +
            +
            +
            + test(); + if (!$result ) + { + ?> +
            +
            + +
            + is_active_cache()) + { + ?> +

            + +

            + is_apache()) + { + ?> +

            + How-to: Config Apache htaccess Rules', 'compressx')) ?> +

            + is_nginx()) + { + ?> +

            + How-to: Config Nginx htaccess Rules', 'compressx')) ?> +

            + is_litespeed()) + { + ?> +

            + +

            + +

            + +

            + +
            +
            +
            + +
            +

            +
            + +
            +

            + + + output_tooltip( + 'cx-v2-tip-auto-optimize', + esc_html__('Enable it to convert the new uploaded images.', 'compressx'), + 'large' + ); + ?> +

            +
            + +
            +
            +

            + + + output_tooltip( + 'cx-v2-tip-library', + esc_html__('Choose the PHP extension for image processing. GD is faster for large images but supports fewer formats. Imagick supports more formats and produces higher quality results.', 'compressx') + ); + ?> +

            + + + +
            + +
            + + + +
            +
            + +
            +

            + + + output_tooltip( + 'cx-v2-tip-formats', + esc_html__('Convert .jpg and .png images to WebP or/and AVIF format.', 'compressx') + ); + ?> +

            +
            + + +
            + +
            +
            +
            +

            + + + +

            +
            +
            + get_bulk_progress(); + ?> +
            +
            +

            + + + output_tooltip( + 'cx-v2-tip-quality', + esc_html__('Choose the most appropriate compression level. Higher quality means larger file sizes but better image appearance.', 'compressx'), + 'large' + ); + ?> +

            + + +
            + + output_free_quality_section(); ?> + +
            + +
            + + + +
            + +
            +
            +
            +
            + +
            +

            + + + +

            +

            + +

            +
            + +
            + + WebP 99,AVIF 99. + WebP 80, + AVIF 60. + +
            +
            +
            + +
            + + + + + +
            +
            + +
            + output_general();?> +
            + + +
            + output_smart();?> +
            +
            +
            + +
            +
            +
            +
            + +
            +
            + + + + +
            +
            +
            + +
            +
            + +
            +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            +
            +
            + +
            +
            +
            +
            + +
            +
            + + + + +
            +
            +
            + +
            +
            + +
            +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            + +
            +
            + +
            +

            +

            + +

            +
            +
            +
            +
            + + +
            +
            + + +
            +
            +
            +
            +
            +
            + + +
            +

            + WebP +

            +
            + + + +
            + + + + + +
            +
            + + + +
            + + +
            +

            + AVIF +

            +
            + + + +
            + + + + +
            +
            + + + +
            + + +
            + + + +
            + +
            +

            + +

            +

            + +

            +
            + +
            +

            + + + +

            +
            +
            + +
            +
            + +
            +
            + +
            +
            + + +
            +
            + + + + + + + +
            +
            + +
            +
            + + +
            +
            + +
            + +
            +
            + +
            +

            + +

            +
            +
            + +
            +
            +
            + + + + + +
            +
            +
            +
            +
            + +
            +
            +
            + + + + + +
            +
            +
            +
            + +
            +
            + Threshold)', 'compressx' ); ?> +
            +

            + +

            +
            + +
            +
            + +
            +
            +
            + +
            +
            + +
            +
            +
            + +
            +
            + +
            +
            +
            +
            +
            + +
            +
            +
            + + + + + +
            +
            +
            +
            + +
            +
            + +
            +
            +
            + +
            +
            + +
            +
            +
            + +
            +
            + +
            +
            +
            +
            +
            + +
            +
            +
            + + + + + +
            +
            +
            +
            + +
            +
            +
            + +
            + +
            + +
            +
            +
            + + + + +
            +

            + +
            + +
            + + +
            + + + +
            +
            + + +
            + + +
            + + + + +
            +
            + + +
            + +
            + + +
            +
            + + +
            + + +
            + + +
            + +
            + + +
            +
            + + +
            + +
            + + +
            +
            + + output_cron_watermark_placeholders(); + ?> + +
            + + +
            + +
            + + +
            +
            + + + + + +
            +
            +
            + +
            + + +
            + +
            +
            +
            + + + + <?php echo esc_attr__( 'Loading...', 'compressx' ); ?> + + + +
            +
            +
            + 'compressx-v2-h-4 compressx-v2-w-4', + 'medium' => 'compressx-v2-h-5 compressx-v2-w-5', + 'large' => 'compressx-v2-h-6 compressx-v2-w-6' + ); + + $button_class = isset($size_classes[$button_size]) ? $size_classes[$button_size] : $size_classes['medium']; + ?> +
            + + + +
            + ajax_check_security('compressx-can-use-general-settings'); + + if (isset($_POST['settings']) && !empty($_POST['settings'])) + { + $json_setting = sanitize_text_field($_POST['settings']); + $json_setting = stripslashes($json_setting); + $setting = json_decode($json_setting, true); + if (is_null($setting)) { + $ret['result'] = 'failed'; + $ret['error'] = 'json decode failed'; + echo wp_json_encode($ret); + die(); + } + + if (isset($setting['auto_optimize'])) + { + if ($setting['auto_optimize'] == '1') + { + $options = true; + } else { + $options = false; + } + + if (CompressX_Options::get_option('compressx_show_review', false) === false) + { + CompressX_Options::update_option('compressx_show_review', time() + 259200); + } + CompressX_Options::update_option('compressx_auto_optimize', $options); + } + + if (isset($setting['convert_to_webp'])) + { + if ($setting['convert_to_webp'] == '1') + { + $options = 1; + } else { + $options = 0; + } + + CompressX_Options::update_option('compressx_output_format_webp', $options); + } + + if (isset($setting['convert_to_avif'])) + { + if ($setting['convert_to_avif'] == '1') + { + $options = 1; + } else { + $options = 0; + } + + CompressX_Options::update_option('compressx_output_format_avif', $options); + } + + if (isset($setting['converter_method'])&&!empty($setting['converter_method'])) + { + $converter_method = $setting['converter_method']; + CompressX_Options::update_option('compressx_converter_method', $converter_method); + } + + if (isset($setting['quality_webp'])&&isset($setting['quality_avif'])) + { + $quality_options['quality'] = "custom"; + $quality_options['quality_webp'] = isset($setting['quality_webp']) ? $setting['quality_webp'] : 80; + $quality_options['quality_avif'] = isset($setting['quality_avif']) ? $setting['quality_avif'] : 60; + + CompressX_Options::update_option('compressx_quality', $quality_options); + } + + $options = CompressX_Options::get_option('compressx_general_settings', array()); + + if (isset($setting['remove_exif'])) + $options['remove_exif'] = $setting['remove_exif']; + if (isset($setting['exclude_png'])) + $options['exclude_png'] = $setting['exclude_png']; + if (isset($setting['exclude_png_webp'])) + $options['exclude_png_webp'] = $setting['exclude_png_webp']; + // + if (isset($setting['auto_remove_larger_format'])) + $options['auto_remove_larger_format'] = $setting['auto_remove_larger_format']; + + $interface_version_changed=false; + + /* + if (isset($setting['interface_version'])) { + $old_interface_version = isset($options['interface_version']) ? $options['interface_version'] : 'v1'; + if ($old_interface_version !== $setting['interface_version']) { + $interface_version_changed = true; + } + $options['interface_version'] = $setting['interface_version']; + }*/ + + $reset_rewrite=false; + if (isset($setting['image_load'])) { + if (!isset($options['image_load'])) { + $options['image_load'] = 'htaccess'; + } + + if ($options['image_load'] != $setting['image_load']) + $reset_rewrite = true; + + $options['image_load'] = $setting['image_load']; + } + + + if (isset($setting['resize'])) + { + if($setting['resize']=='1') + { + $options['resize']['enable']=true; + } + else + { + $options['resize']['enable']=false; + } + } + + if (isset($setting['resize_width'])) + $options['resize']['width'] = $setting['resize_width']; + if (isset($setting['resize_height'])) + $options['resize']['height'] = $setting['resize_height']; + + if (isset($setting['converter_images_pre_request'])) + $options['converter_images_pre_request'] = intval($setting['converter_images_pre_request']); + // + if ($options['image_load'] == 'htaccess') + { + if ($reset_rewrite) + { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules(); + $ret['test'] = '1'; + } + } else if ($options['image_load'] == 'compat_htaccess') { + if ($reset_rewrite) { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules_ex(); + $ret['test'] = '1'; + } + } else { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->remove_rewrite_rule(); + } + + CompressX_Options::update_option('compressx_general_settings', $options); + + if ($interface_version_changed) + { + $ret['interface_version_changed']=true; + } + else + { + $ret['interface_version_changed']=false; + } + $ret['result'] = 'success'; + echo wp_json_encode($ret); + die(); + } + else + { + die(); + } + } + + public function compressx_rating_dismiss() + { + global $compressx; + $compressx->ajax_check_security(); + + if (isset($_POST['value'])) { + $value = sanitize_text_field($_POST['value']); + if ($value == 'ask_me_later') { + $time = time() + 259200; + CompressX_Options::update_option('compressx_rating_dismiss', $time); + } + if ($value == 'close') { + $time = time() + 604800; + CompressX_Options::update_option('compressx_rating_dismiss', $time); + } else if ($value == 'already') { + CompressX_Options::update_option('compressx_rating_dismiss', 0); + } else if ($value == 'dismiss') { + CompressX_Options::update_option('compressx_rating_dismiss', 0); + } + } + + die(); + } + + public function hide_big_update() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-image-optimization'); + + CompressX_Options::update_option('compressx_hide_big_update', true); + + die(); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-media-replace-display.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-media-replace-display.php new file mode 100644 index 0000000..f4f46a4 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-media-replace-display.php @@ -0,0 +1,925 @@ +is_supported_image($post)) + { + return $actions; + } + + $post_id = $post->ID; + $url = admin_url("upload.php"); + $url = add_query_arg(array( + 'page' => 'media-replace-compressx', + 'attachment_id' => $post_id, + ), $url); + $actions['compressx_media_replace']='' . + esc_html__( 'Replace Media', 'compressx' ) . + ''; + + return $actions; + } + + public function add_meta_boxes($post) + { + if (! $post || ! is_object($post)) { + return; + } + + if (! current_user_can('upload_files')) { + return; + } + + $mime = (string) get_post_mime_type($post); + if (strpos($mime, 'image/') !== 0) { + return; + } + + add_meta_box( + 'compressx-media-replace-box', + __('Replace Media', 'compressx'), + array($this,'render_media_replace_metabox'), + 'attachment', + 'side', + 'low' + ); + } + + public function render_media_replace_metabox($post) + { + $attachment_id = (int) $post->ID; + + $url = add_query_arg( + array( + 'page' => 'media-replace-compressx', + 'attachment_id' => $attachment_id, + ), + admin_url('upload.php') + ); + + $url = wp_nonce_url($url, 'compressx_media_replace'); + + echo '

            ' + . esc_html__('Upload & Replace Media File', 'compressx') + . '

            '; + + echo '

            ' + . esc_html__('Replace this attachment and regenerate thumbnails according to your settings.', 'compressx') + . '

            '; + } + + public function attachment_editor($form_fields, $post) + { + if (! current_user_can('upload_files')) { + return $form_fields; + } + + $mime = (string) get_post_mime_type($post); + if (strpos($mime, 'image/') !== 0) + { + return $form_fields; + } + + if (function_exists('get_current_screen')) + { + $screen = get_current_screen(); + if ($screen && $screen->id === 'attachment') { + return $form_fields; + } + } + + if (wp_doing_ajax()) + { + $ref = wp_get_referer(); + if (!$ref && !empty($_SERVER['HTTP_REFERER'])) { + $ref = $_SERVER['HTTP_REFERER']; + } + + if (!$ref || strpos($ref, 'upload.php') === false) { + return $form_fields; + } + } + + $url = add_query_arg( + array( + 'page' => 'media-replace-compressx', + 'attachment_id' => (int) $post->ID, + ), + admin_url('upload.php') + ); + + $url = wp_nonce_url($url, 'compressx_media_replace'); + + $form_fields['compressx-media-replace'] = array( + 'label' => __('Replace Media', 'compressx'), + 'input' => 'html', + 'html' => '' . + esc_html__('Upload a new file', 'compressx') . + '', + 'helps' => __('Click to replace this file via CompressX.', 'compressx'), + ); + + return $form_fields; + } + + public function is_supported_image($post) + { + if (! is_object($post)) + { + return false; + } + $post_id = $post->ID; + $post_type = $post->post_type; + + if ($post_type !== 'attachment') + { + return false; + } + + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png", + "image/webp", + "image/avif"); + + $mime_type=get_post_mime_type($post_id); + if(in_array($mime_type,$supported_mime_types)) + { + return true; + } + else + { + return false; + } + } + + public function display() + { + if (array_key_exists("attachment_id", $_GET) && intval($_GET["attachment_id"]) > 0) + { + $this->attachment_id= intval($_GET["attachment_id"]); + ?> +
            +
            + output_header(); + $this->output_media_replace_v2(); + $this->output_footer(); + ?> +
            +
            + +
            +
            +

            + +

            +

            + +

            +
            +
            + +
            +
            + + output_media_replace_setting_v2()?> + + output_media_replace_manipulation()?> +
            +
            +
            + +
            + + + <?php echo esc_attr__( 'Loading...', 'compressx' ); ?> + + +
            + +
            +
            + +
            +
            +

            + +

            +
              +
            • +
              +
              + + +
              + | + +
              + + + +
              +
              +
            • +
            • •
            • +
            • • :
            • +
            +
            +
            +
            +
            + +
            + > +
            + + +
            +

            +
            + +

            +

            + +

            +
            +

            + +

            +
            + + + + +
            +
            +
            +
            +
            + +
            + +
            + +
            +

            + +

            + + +
            + +
            + + +
            + +
            +
            + +
            + + +
            + +
            + +
            +
            +

            + +

            +
            +
            +
            +
            +
            + +
            + output_current_media_v2()?> + output_upload_new_media_v2()?> + +
            +

            + +

            + +
              +
            • +
            • +
            • +
            • +
            • +
            • +
            +
            +
            + attachment_id, 'medium'); + if (is_array($medium) && !empty($medium[0])) + { + $url = $medium[0]; + } + else + { + $full = wp_get_attachment_image_src($this->attachment_id, 'full'); + $full_url = $full[0]; + $full_w = (int) $full[1]; + + if ($full_w > 0 && $full_w < 300) + { + $url = $full_url; + } + else + { + $meta = wp_get_attachment_metadata($this->attachment_id); + if (!empty($meta['sizes']) && is_array($meta['sizes'])) + { + $candidates = []; + + foreach ($meta['sizes'] as $size_name => $info) + { + if (empty($info['width']) || empty($info['file'])) continue; + + $w = (int) $info['width']; + if ($w >= 300) + { + $candidates[] = ['w' => $w,'s'=>$size_name]; + } + } + + if (!empty($candidates)) + { + usort($candidates, function($a, $b) { return $a['w'] <=> $b['w']; }); + + $src=wp_get_attachment_image_src($this->attachment_id, $candidates[0]['s']); + $url=$src[0]; + } + } + } + + if(empty($url)) + { + $url=$full_url; + } + } + + $url.='?v='.time(); + + $width=0; + $height=0; + $size=0; + $meta = wp_get_attachment_metadata($this->attachment_id); + $file = get_attached_file($this->attachment_id); + if (is_array($meta)) + { + if(!empty($meta['filesize'])) + { + $size=(int)$meta['filesize']; + } + + if (!empty($meta['width'])) + $width = (int) $meta['width']; + if (!empty($meta['height'])) + $height = (int) $meta['height']; + } + else + { + if ($file && file_exists($file)) + { + $size = (int) @filesize($file); + + $img = @getimagesize($file); + if (is_array($img) && !empty($img[0]) && !empty($img[1])) + { + $width = (int) $img[0]; + $height = (int) $img[1]; + } + } + } + + $dimensions="Dimensions: $width × $height"; + $size="File size: ".size_format($size,2); + if(CompressX_Image_Meta_V2::is_image_optimized($this->attachment_id)) + { + $status="Status: Optimized"; + } + else + { + $status="Status: Unoptimized"; + } + + if(!empty($meta['sizes'])) + $thumbnail_counts = sprintf( + /* translators: %d: number of generated thumbnails. */ + __( 'Thumbnails: %d', 'compressx' ), + count( $meta['sizes'] ) + ); + else + $thumbnail_counts = sprintf( + __( 'Thumbnails: 0', 'compressx' ) + ); + + $mime_type=get_post_mime_type($this->attachment_id); + $ft = wp_check_filetype($file); + $ext = !empty($ft['ext']) ? $ft['ext'] : ''; + $type = $ext ? strtoupper($ext) : '-'; + ?> +
            +
            +

            + +

            +
            +
            +
            + <?php echo esc_attr__( 'Replace preview', 'compressx' ); ?> +
            +
            +
            +
            +
            +
            +
            +
            +

            + + Learn more...', 'compressx' ) + ), + esc_url( 'https://compressx.io/docs/media-replace/' ) + ); + ?> +

            +
            +
            +
            +
            + +
            +
            +

            + +

            +
            + + +
            +
            + + + +
            +

            + +

            +

            + +

            +
            + + +
            + ajax_check_security(); + + if (isset($_POST['settings']) && !empty($_POST['settings'])) + { + $settings=$_POST['settings']; + $options=CompressX_Options::get_option('compressx_media_replace',array()); + + if (isset($settings['auto_re_optimize'])) + { + $auto_re_optimize=sanitize_text_field($settings['auto_re_optimize']); + if($auto_re_optimize=='1') + { + $auto_re_optimize=true; + } + else + { + $auto_re_optimize=false; + } + $options['auto_re_optimize']=$auto_re_optimize; + } + + if (isset($settings['thumbnail_generation'])) + { + $thumbnail_generation=sanitize_text_field($settings['thumbnail_generation']); + if($thumbnail_generation=='default_fill') + { + $thumbnail_generation='default_fill'; + } + else + { + $thumbnail_generation='match_original'; + } + $options['thumbnail_generation']=$thumbnail_generation; + } + + CompressX_Options::update_option('compressx_media_replace',$options); + $ret['result']='success'; + echo wp_json_encode($ret); + die(); + } + else + { + die(); + } + } + + public function replace_media() + { + global $compressx; + $compressx->ajax_check_security(); + + if (empty($_FILES['image']) || !is_array($_FILES['image'])) + { + wp_send_json( array( + 'result' => 'failed', + 'error' => __( 'No file uploaded.', 'compressx' ), + ) ); + } + + if (empty($_POST['attachment_id'])) + { + wp_send_json( array( + 'result' => 'failed', + 'error' => __( 'No attachment_id.', 'compressx' ), + ) ); + } + + $file = $_FILES['image']; + $attachment_id = sanitize_text_field($_POST['attachment_id']); + $allowed_mimes = [ + 'jpg|jpeg|jpe' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif', + 'webp' => 'image/webp', + 'avif' => 'image/avif', + ]; + + if (!function_exists('wp_handle_upload')) + { + require_once ABSPATH . 'wp-admin/includes/file.php'; + } + + add_filter('upload_dir',array($this, 'get_compressx_tmp_folder')); + + $overrides = [ + 'test_form' => false, + 'mimes' => $allowed_mimes, + ]; + + $uploaded = wp_handle_upload($file, $overrides); + + remove_filter('upload_dir', array($this, 'get_compressx_tmp_folder')); + + if (isset($uploaded['error'])) + { + wp_send_json(['result' => 'failed', 'error' => $uploaded['error']]); + } + + include_once COMPRESSX_DIR . '/includes/class-compressx-media-replace.php'; + $media_replace=new CompressX_Media_Replace(); + + $options=CompressX_Options::get_option('compressx_media_replace',array()); + + if(CompressX_Image_Meta_V2::is_image_optimized($attachment_id)) + { + $this->delete_converted_image($attachment_id); + } + + $ret=$media_replace->replace($attachment_id,$uploaded['file'],$options); + if($ret['result']=='success') + { + $auto_re_optimize=isset($options['auto_re_optimize'])?$options['auto_re_optimize']:true; + if($auto_re_optimize) + { + $this->reconvert_image($attachment_id); + } + } + + echo wp_json_encode($ret); + + die(); + } + + public function reconvert_image($image_id) + { + + $options=$this->init_option(); + + $this->delete_converted_image($image_id); + + $image=new Compressx_Image($image_id,$options); + $file_path = get_attached_file( $image_id ); + if(empty($file_path)) + { + $error='Image:'.$image_id.' failed. Error: failed to get get_attached_file'; + CompressX_Image_Meta_V2::update_image_failed($image_id,$error); + return; + } + + CompressX_Image_Meta_V2::update_image_progressing($image_id); + + //$image->resize(); + + if($image->convert()) + { + CompressX_Image_Meta_V2::update_image_meta_status($image_id, 'optimized'); + } + else + { + CompressX_Image_Meta_V2::update_image_meta_status($image_id,'failed'); + } + + CompressX_Image_Meta_V2::delete_image_progressing($image_id); + } + + public function delete_converted_image($image_id) + { + $files=array(); + $file_path = get_attached_file( $image_id ); + $meta = wp_get_attachment_metadata( $image_id, true ); + + if ( ! empty( $meta['sizes'] ) ) + { + foreach ( $meta['sizes'] as $size_key => $size_data ) + { + $filename= path_join( dirname( $file_path ), $size_data['file'] ); + $files[$size_key] =$filename; + } + + if(!in_array($file_path,$files)) + { + $files['og']=$file_path; + } + } + else + { + $files['og']=$file_path; + } + + foreach ($files as $size_key=>$file) + { + $file=CompressX_Image_Method::get_output_path($file); + $webp_file =$file.'.webp'; + $avif_file =$file.'.avif'; + if(file_exists($webp_file)) + @wp_delete_file($webp_file); + + if(file_exists($avif_file)) + @wp_delete_file($avif_file); + + if(file_exists($file)) + @wp_delete_file($file); + + } + + delete_post_meta($image_id,'compressx_image_meta_status'); + delete_post_meta($image_id,'compressx_image_meta_webp_converted'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted'); + delete_post_meta($image_id,'compressx_image_meta_compressed'); + + delete_post_meta($image_id,'compressx_image_meta_og_file_size'); + delete_post_meta($image_id,'compressx_image_meta_webp_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_compressed_size'); + delete_post_meta($image_id,'compressx_image_meta'); + delete_post_meta($image_id,'compressx_image_progressing'); + CompressX_Image_Meta_V2::delete_image_meta($image_id); + } + + public function init_option() + { + $general_options=CompressX_Options::get_general_settings(); + $quality_options=CompressX_Options::get_quality_option(); + return array_merge($general_options,$quality_options); + + } + + public function get_compressx_tmp_folder( $uploads ) { + + $path = WP_CONTENT_DIR . '/compressx'; + $url = content_url( '/compressx' ); + + // Ensure directory exists. + if ( ! is_dir( $path ) ) { + wp_mkdir_p( $path ); + } + + // Init WP_Filesystem. + global $wp_filesystem; + if ( empty( $wp_filesystem ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + WP_Filesystem(); + } + + // If WP_Filesystem is not available, fallback to original uploads. + if ( empty( $wp_filesystem ) ) { + return $uploads; + } + + // Create empty index.html (prevent directory listing). + $index_file = $path . '/index.html'; + if ( ! $wp_filesystem->exists( $index_file ) ) { + $wp_filesystem->put_contents( $index_file, '', FS_CHMOD_FILE ); + } + + // .htaccess content (no heredoc). + $root_htaccess = "# CompressX - block public access by default\n\n" + . "\n" + . " Require all denied\n" + . "\n" + . "\n" + . " Deny from all\n" + . "\n"; + + $root_ht_file = $path . '/.htaccess'; + + $current = ''; + if ( $wp_filesystem->exists( $root_ht_file ) ) { + $current = $wp_filesystem->get_contents( $root_ht_file ); + if ( false === $current ) { + $current = ''; + } + } + + // Write .htaccess only if changed. + if ( $current !== $root_htaccess ) { + $wp_filesystem->put_contents( $root_ht_file, $root_htaccess, FS_CHMOD_FILE ); + } + + // Override uploads paths. + $uploads['path'] = $path; + $uploads['url'] = $url; + $uploads['subdir'] = ''; + $uploads['basedir'] = $path; + $uploads['baseurl'] = $url; + + return $uploads; + } + +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-settings-display.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-settings-display.php new file mode 100644 index 0000000..49ef04b --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-settings-display.php @@ -0,0 +1,1163 @@ + +
            +
            + output_header(); + $this->output_settings(); + $this->output_save_section(); + $this->output_footer(); + ?> +
            +
            + +
            +
            +

            + +

            +

            + +

            +
            +
            + + +
            + + +
            + +
            + + +
            + output_thumbnail_sizes(); ?> + output_exclude_folders(); ?> + output_custom_folders(); ?> + output_cache_control_settings(); ?> + output_scan_page_settings(); ?> + output_delete_images(); ?> + +
            + +
            + $_wp_additional_image_sizes[$size_key]['width'], + 'height' => $_wp_additional_image_sizes[$size_key]['height'], + 'crop' => $_wp_additional_image_sizes[$size_key]['crop'], + ); + if (isset($options['skip_size'][$size_key]) && $options['skip_size'][$size_key]) { + $image_sizes[$size_key]['skip'] = true; + } else { + $image_sizes[$size_key]['skip'] = false; + } + } + } + + if (! isset($image_sizes['medium_large']) || empty($image_sizes['medium_large'])) { + $width = intval(get_option('medium_large_size_w')); + $height = intval(get_option('medium_large_size_h')); + + $image_sizes['medium_large'] = array( + 'width' => $width, + 'height' => $height, + ); + + if (isset($options['skip_size']['medium_large']) && $options['skip_size']['medium_large']) { + $image_sizes['medium_large']['skip'] = true; + } else { + $image_sizes['medium_large']['skip'] = false; + } + } + ?> +
            + + +
            +

            + + + output_tooltip('', esc_html__('Choose thumbnail sizes you want to process. Some themes may generate new thumbnail sizes sometimes, then you\'ll need to reprocess the thumbnails sizes using the Bulk Processing function.', 'compressx'), 'large'); ?> + +

            +

            + +

            +
            + + +
            + $size) { + if ($showed > $max_show) { + $style = "display:none"; + if (!$show_more) { + $show_more = true; + ?> + + + + +
            + + +
            +

            + +

            +
            +
            + +
            + +
            +

            + + + output_tooltip('', esc_html__('Select folders in the Uploads folder (media library) and exclude them from the processing.', 'compressx'), 'large'); ?> + +

            +

            + +

            +
            + +
            +
            +
            + + + +
            +
            +
            +
            + + + + +
            +
              + +
            • + + get_children_count($exclude) . ') images') ?> + +
            • + +
            +
            +
            +
            +
            +
            + get_custom_stats($custom_folders); + $found = $stats['files']; + $saved = $stats['saved']; + $processed = $stats['processed_files']; + ?> +
            + +
            +

            + + + output_tooltip('', esc_html__('Select custom folders in the /wp-content folder and process images inside them.', 'compressx'), 'large'); ?> + +

            +

            + +

            +
            + +
            +
            +
            + + + +
            +
            +
            +
            + + + + +
            +
              + +
            • + + get_custom_children_count($folder) . ')') ?> + +
            • + +
            +
            +
            +
            + +
            +
            + + | + % | + + +
            +
            + + + +
            +
            + +
            +
            +
            + +
            + + +
            + + +

            + +

            + + +
            +

            ⚠️ WebP AVIF

            +

            +
            + +
            +
            + + + + + + +
            +

            + DELETE +

            +
            +
            + +
            + +
            +

            + + + output_tooltip('', esc_html__('You can try to check this option if the site cannot be cached by Cloudflare.', 'compressx'), 'large'); ?> + +

            +

            + +

            +
            + +
            + +
            +
            + +
            + +
            +

            + + + output_tooltip( + '', + esc_html__('Set the number of images processed per scan batch. A higher value may speed up scanning but requires more server resources.', 'compressx'), + 'large' + ); + ?> + +

            +

            + +

            +
            + +
            + + +
            +
            + +
            +
            +
            + + + + + +
            +
            +
            + 'compressx-v2-h-4 compressx-v2-w-4', + 'medium' => 'compressx-v2-h-5 compressx-v2-w-5', + 'large' => 'compressx-v2-h-6 compressx-v2-w-6' + ); + + $button_class = isset($size_classes[$button_size]) ? $size_classes[$button_size] : $size_classes['medium']; + ?> +
            + + + +
            + get_folder_stats($include, $stats, $convert_to_webp, $convert_to_avif); + } + + if ($stats['total'] > 0) { + $stats['saved'] = ($stats['processed'] / $stats['total']) * 100; + $stats['saved'] = round($stats['saved'], 1); + } + + return $stats; + } + + private function get_folder_stats($path, &$stats, $convert_to_webp, $convert_to_avif) + { + try { + if (!class_exists('CompressX_Custom_Image_Meta')) { + return 0; + } + + $support_extension = array('jpg', 'jpeg', 'png', 'webp'); + $count = 0; + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + + foreach ($rii as $file) { + if ($file->isDir()) { + continue; + } + + $extension = strtolower($file->getExtension()); + if (in_array($extension, $support_extension)) { + $filename = $path . '/' . $file->getFilename(); + $filename = $this->transfer_path($filename); + $type = pathinfo($filename, PATHINFO_EXTENSION); + + if ($convert_to_webp && $type != "webp") { + if (CompressX_Custom_Image_Meta::is_convert_webp($filename)) { + $stats['processed_files']++; + $stats['processed'] += CompressX_Custom_Image_Meta::get_convert_webp_size($filename); + } + + $count++; + $stats['files']++; + $stats['total'] += $file->getSize(); + } else if ($convert_to_avif && $type != "avif") { + if (CompressX_Custom_Image_Meta::is_convert_avif($filename)) { + $stats['processed_files']++; + $stats['processed'] += CompressX_Custom_Image_Meta::get_convert_avif_size($filename); + } + + $count++; + $stats['files']++; + $stats['total'] += $file->getSize(); + } + } + } + return $count; + } catch (Exception $exception) { + return 0; + } + } + + private function transfer_path($path) + { + $path = str_replace('\\', '/', $path); + $values = explode('/', $path); + return implode(DIRECTORY_SEPARATOR, $values); + } + + public function get_custom_tree_dir() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + try { + $node_array = array(); + + if ($_POST['tree_node']['node']['id'] == '#') { + $path = ABSPATH; + + if (!empty($_POST['tree_node']['path'])) { + $path = sanitize_text_field($_POST['tree_node']['path']); + } + + /* + $node_array[] = array( + 'text' => basename($path), + 'children' => true, + 'id' => $path, + 'icon' => 'dashicons dashicons-category cx-icon-color-yellow', + 'state' => array( + 'opened' => true + ) + );*/ + } else { + $path = sanitize_text_field($_POST['tree_node']['node']['id']); + } + + $upload_dir = wp_upload_dir(); + $uploads_path = $upload_dir['basedir']; + $uploads_path = str_replace('\\', '/', $uploads_path); + $uploads_path = $uploads_path . '/'; + + if ($path == $uploads_path) { + $init = true; + $key = gmdate('Y', time()); + } else { + $init = false; + $key = gmdate('Y', time()); + } + + $path = trailingslashit(str_replace('\\', '/', realpath($path))); + + if ($dh = opendir($path)) { + while (substr($path, -1) == '/') { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) { + if (is_dir($path . '/' . $value)) { + $node['children'] = $this->has_children($path . '/' . $value); + $node['id'] = $path . '/' . $value; + if ($init) { + if ($value == $key) { + $node['state']['opened'] = true; + } + } + // + $node['icon'] = 'dashicons dashicons-open-folder cx-icon-color-techblue compressx-text'; + $node['children_count'] = $this->get_children_count($path . '/' . $value); + $node['text'] = $value . ',(' . $node['children_count'] . ') images'; + $node['text'] .= ''; + $node_array[] = $node; + + /* + if($this->is_media_folder($path . '/' . $value)) + { + $node['children'] = $this->has_children($path . '/' . $value); + $node['id'] = $path . '/' . $value; + if($init) + { + if($value==$key) + { + $node['state']['opened']=true; + } + } + // + $node['icon'] = 'dashicons dashicons-open-folder cx-icon-color-techblue compressx-text'; + $node['children_count']=$this->get_children_count($path . '/' . $value); + $node['text'] = $value.',('. $node['children_count'].') images'; + $node['text'] .=''; + $node_array[] = $node; + } + else + { + continue; + }*/ + } else { + //$node['text'] = $value; + //$node['children'] = true; + //$node['id'] = $path . '/' . $value; + //$node['icon'] = 'dashicons dashicons-media-default cx-icon-color-yellow'; + //$node_array[] = $node; + continue; + } + } + } + } + + $ret['nodes'] = $node_array; + echo wp_json_encode($ret); + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + echo wp_json_encode(array('result' => 'failed', 'error' => $message)); + } + die(); + } + + public function has_children($path) + { + if ($dh = opendir($path)) { + while (substr($path, -1) == '/') { + $path = rtrim($path, '/'); + } + $skip_paths = array(".", ".."); + + while (($value = readdir($dh)) !== false) { + trailingslashit(str_replace('\\', '/', $value)); + if (!in_array($value, $skip_paths)) { + if (is_dir($path . '/' . $value)) { + return true; + } + } + } + } + + return false; + } + + public function is_media_folder($path) + { + $upload_dir = wp_upload_dir(); + $base_dir = $upload_dir['basedir']; + $base_dir = trailingslashit(str_replace('\\', '/', realpath($base_dir))); + $path = str_replace($base_dir, '', $path); + $path_arr = explode('/', $path); + + if (count($path_arr) >= 1) { + if (is_numeric($path_arr[0]) && $path_arr[0] > 1950 && $path_arr[0] < 2050) { + return true; + } + } + + return false; + } + + public function get_children_count($path) + { + try { + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + $files = 0; + + /** @var SplFileInfo $file */ + foreach ($rii as $file) { + if ($file->isDir()) { + continue; + } + + $files++; + } + + return $files; + } catch (Exception $e) { + return 0; + } + } + + public function add_exclude_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + $json_excludes = sanitize_text_field($_POST['excludes']); + $json_excludes = stripslashes($json_excludes); + $new_excludes = json_decode($json_excludes, true); + + CompressX_Options::update_option('compressx_media_excludes', $new_excludes); + + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + $html = '
              '; + foreach ($new_excludes as $exclude) { + $path = str_replace($abs_path, '', $exclude); + $html .= '
            • ' . + '' . $path . ',(' . $this->get_children_count($exclude) . ') images' . '' . + '
            • '; + } + $html .= '
                '; + $ret['result'] = 'success'; + $ret['html'] = $html; + echo wp_json_encode($ret); + die(); + } + + public function add_exclude_folder() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + $exclude = sanitize_text_field($_POST['id']); + $abs_path = trailingslashit(str_replace('\\', '/', realpath(ABSPATH))); + $path = str_replace($abs_path, '', $exclude); + + $html = '
              • ' . + '' . $path . ',(' . $this->get_children_count($exclude) . ') images' . '' . + '
              • '; + $ret['result'] = 'success'; + $ret['html'] = $html; + echo wp_json_encode($ret); + die(); + } + + public function remove_exclude_folders() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-exclude'); + + $excludes = CompressX_Options::get_option('compressx_media_excludes', array()); + + $id = sanitize_text_field($_POST['id']); + unset($excludes[$id]); + + CompressX_Options::update_option('compressx_media_excludes', $excludes); + + $ret['result'] = 'success'; + + echo wp_json_encode($ret); + die(); + } + + public function save_settings() + { + global $compressx; + $compressx->ajax_check_security(); + + if (isset($_POST['settings']) && !empty($_POST['settings'])) + { + $json_settings = sanitize_text_field($_POST['settings']); + $json_settings = stripslashes($json_settings); + $settings = json_decode($json_settings, true); + if (is_null($settings)) + { + $ret['result'] = 'failed'; + $ret['error'] = 'json decode failed'; + echo wp_json_encode($ret); + die(); + } + } + else + { + die(); + } + + $options = CompressX_Options::get_option('compressx_general_settings', array()); + + if (isset($settings['size_settings'])) + { + $intermediate_image_sizes = get_intermediate_image_sizes(); + + if (isset($settings['size_settings']['og'])) { + $options['skip_size']['og'] = !$settings['size_settings']['og']; + } else { + $options['skip_size']['og'] = true; + } + + foreach ($intermediate_image_sizes as $size_key) { + if (isset($settings['size_settings'][$size_key])) { + $options['skip_size'][$size_key] = !$settings['size_settings'][$size_key]; + } else { + $options['skip_size'][$size_key] = true; + } + } + } + + // Handle list_view_setting (Media Library Display Options) + if (isset($settings['list_view_setting'])) { + $media_library_list_view = CompressX_Options::get_option('compressx_media_library_list_view', array()); + + $media_library_list_view['delete_thumbnails'] = isset($settings['list_view_setting']['delete_thumbnails']) && $settings['list_view_setting']['delete_thumbnails'] == '1'; + $media_library_list_view['delete_thumbnails_saved'] = isset($settings['list_view_setting']['delete_thumbnails_saved']) && $settings['list_view_setting']['delete_thumbnails_saved'] == '1'; + $media_library_list_view['dropdown_delete_thumbnails'] = isset($settings['list_view_setting']['dropdown_delete_thumbnails']) && $settings['list_view_setting']['dropdown_delete_thumbnails'] == '1'; + $media_library_list_view['watermark_status'] = isset($settings['list_view_setting']['watermark_status']) && $settings['list_view_setting']['watermark_status'] == '1'; + $media_library_list_view['dropdown_watermark'] = isset($settings['list_view_setting']['dropdown_watermark']) && $settings['list_view_setting']['dropdown_watermark'] == '1'; + + CompressX_Options::update_option('compressx_media_library_list_view', $media_library_list_view); + } + + // Handle cache_control_setting + $reset_rewrite = false; + if (isset($settings['cache_control_setting'])) + { + if (isset($settings['cache_control_setting']['disable_cache_control'])) + { + $old_value = isset($options['disable_cache_control']) ? $options['disable_cache_control'] : false; + $new_value = $settings['cache_control_setting']['disable_cache_control'] == '1'; + + if ($old_value != $new_value) + { + $reset_rewrite = true; + $options['disable_cache_control'] = $new_value; + } + } + } + + // Handle scan_page_setting + if (isset($settings['scan_page_setting'])) + { + if (isset($settings['scan_page_setting']['scan_images_page'])) + { + $scan_images_page = intval($settings['scan_page_setting']['scan_images_page']); + + if ($scan_images_page <= 0) + { + $scan_images_page = 500; + } + + if ($scan_images_page < 50) + { + $scan_images_page = 50; + } + + if ($scan_images_page > 5000) + { + $scan_images_page = 5000; + } + + $options['scan_images_page'] = $scan_images_page; + } + } + + CompressX_Options::update_option('compressx_general_settings', $options); + + if ($reset_rewrite) + { + $image_load = isset($options['image_load']) ? $options['image_load'] : 'htaccess'; + if ($image_load == 'htaccess') + { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules(); + } + else if ($image_load == 'compat_htaccess') + { + include_once COMPRESSX_DIR . '/includes/class-compressx-webp-rewrite.php'; + $rewrite = new CompressX_Webp_Rewrite(); + $rewrite->create_rewrite_rules_ex(); + } + } + + if (isset($_POST['excludes']) && !empty($_POST['excludes'])) + { + $json_settings = sanitize_text_field($_POST['excludes']); + $json_settings = stripslashes($json_settings); + $excludes = json_decode($json_settings, true); + if (is_null($excludes)) + { + $ret['result'] = 'failed'; + $ret['error'] = 'json decode failed'; + echo wp_json_encode($ret); + die(); + } + + $old_excludes = CompressX_Options::get_option('compressx_media_excludes', array()); + $excludes_changed = $this->is_excludes_changed($old_excludes, $excludes); + + CompressX_Options::update_option('compressx_media_excludes', $excludes); + + if ($excludes_changed) + { + CompressX_Image_Meta_V2::clear_image_meta_status(); + } + + } + + $ret['result'] = 'success'; + echo wp_json_encode($ret); + die(); + } + + private function is_excludes_changed($old_excludes, $new_excludes) + { + if (!is_array($old_excludes)) { + $old_excludes = array(); + } + + if (!is_array($new_excludes)) { + $new_excludes = array(); + } + + $old_excludes = $this->normalize_excludes_for_compare($old_excludes); + $new_excludes = $this->normalize_excludes_for_compare($new_excludes); + + return md5(wp_json_encode($old_excludes)) !== md5(wp_json_encode($new_excludes)); + } + + private function normalize_excludes_for_compare($excludes) + { + if (!is_array($excludes)) { + return array(); + } + + ksort($excludes); + + foreach ($excludes as $key => $value) { + if (is_array($value)) { + $excludes[$key] = $this->normalize_excludes_for_compare($value); + } else { + if ($value === '1' || $value === 1 || $value === true) { + $excludes[$key] = true; + } else if ($value === '0' || $value === 0 || $value === false) { + $excludes[$key] = false; + } else { + $excludes[$key] = $value; + } + } + } + + return $excludes; + } + + public function delete_files() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-delete'); + + global $wpdb; + + $where['meta_key'] = "compressx_image_meta_status"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_webp_converted"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_avif_converted"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_compressed"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_og_file_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_webp_converted_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_avif_converted_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta_compressed_size"; + $wpdb->delete($wpdb->postmeta, $where); + + $where['meta_key'] = "compressx_image_meta"; + $wpdb->delete($wpdb->postmeta, $where); + + delete_transient('compressx_set_global_stats'); + + $table_name = $wpdb->prefix . "compressx_files_opt_meta"; + $exists = $wpdb->get_var( + $wpdb->prepare("SHOW TABLES LIKE %s", $table_name) + ); + if ($exists == $table_name) + { + $wpdb->get_results("TRUNCATE TABLE $table_name", ARRAY_A); + } + + CompressX_Image_Meta_V2::delete_all_image_meta(); + $this->_delete_files(); + + $ret['result'] = "success"; + echo wp_json_encode($ret); + die(); + } + + public function _delete_files() + { + $path = WP_CONTENT_DIR . '/compressx-nextgen'; + $this->deleteDir($path); + + include_once COMPRESSX_DIR . '/includes/class-compressx-default-folder.php'; + $dir = new CompressX_default_folder(); + $dir->create_uploads_dir(); + } + + public function deleteDir( $dirPath ) + { + if ( ! is_dir( $dirPath ) ) { + return false; + } + + global $wp_filesystem; + if ( empty( $wp_filesystem ) ) { + require_once ABSPATH . 'wp-admin/includes/file.php'; + WP_Filesystem(); + } + + if ( empty( $wp_filesystem ) ) { + return false; + } + + // Recursive delete. + return $wp_filesystem->rmdir( $dirPath, true ); + } + + private function get_custom_children_count($path) + { + try + { + $convert_to_avif = CompressX_Options::get_option('compressx_output_format_avif', 1); + if ($convert_to_avif&&CompressX_Image_Opt_Method::is_support_avif()) + { + $convert_to_avif = true; + } + else + { + $convert_to_avif = false; + } + + $support_extension = array('jpg', 'jpeg', 'png', 'webp'); + $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)); + $files = 0; + + foreach ($rii as $file) { + if ($file->isDir()) { + continue; + } + + $extension = strtolower($file->getExtension()); + if (in_array($extension, $support_extension)) { + $filename = $path . '/' . $file->getFilename(); + $type = pathinfo($filename, PATHINFO_EXTENSION); + + if ($type == 'webp' && $convert_to_avif) { + $files++; + } else if ($type != 'webp') { + $files++; + } + } + } + + return $files; + } catch (Exception $e) { + return 0; + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/class-compressx-system-info-display.php b/wp-content/plugins/compressx/includes/display_v2/class-compressx-system-info-display.php new file mode 100644 index 0000000..7b202ba --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/class-compressx-system-info-display.php @@ -0,0 +1,1087 @@ + +
                +
                + output_header(); + $this->output_system_information(); + $this->output_logs(); + $this->output_footer(); + ?> +
                +
                + +
                +
                +

                + +

                +

                + +

                +
                +
                + get_debug_info(); + ?> +
                +
                +

                + +

                + +
                + +
                + +
                +

                🌐

                +
                  +
                • +
                • +
                • + =')): ?> + + +
                • +
                • + + +
                • +
                +
                + + +
                +

                🖼️

                +
                  +
                • + +
                • + +
                • + + + + + + +
                • +
                • + + + + + + +
                • + +
                • + + + + + +
                • + +
                • + + + + + + +
                • +
                • + + + + + + +
                • + +
                +
                + + +
                +

                ⚡

                +
                  +
                • +
                • +
                • + = 256): ?> + + +
                • +
                +
                + + +
                +

                ⚙️

                +
                  +
                • +
                • + 50) + { + $plugin_count= '50+'; + } + echo esc_html($plugin_count.' installed'); + ?> + +
                • +
                • + + + + + +
                • +
                +
                +
                + + + +
                + + + + +
                +
                +

                + +
                +
                + get_log_list(); + $log_list=new CompressX_Log_List_V2(); + $log_list->set_log_list($list); + $log_list->prepare_items(); + $log_list->display(); + ?> +
                +
                + + + + GetSaveLogFolder(); + $files = array(); + $handler = opendir($dir); + $regex = '#^compressx.*_log.txt#'; + if ($handler !== false) { + while (($filename = readdir($handler)) !== false) { + if ($filename != "." && $filename != "..") { + if (is_dir($dir . $filename)) { + continue; + } else { + if (preg_match($regex, $filename)) { + $files[$filename] = $dir . $filename; + } + } + } + } + if ($handler) { + @closedir($handler); + } + } + + foreach ($files as $file) { + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Simple read operation for log file metadata + $handle = @fopen($file, "r"); + if ($handle) { + $log_file['file_name'] = basename($file); + if (preg_match('/compressx-(.*?)_/', basename($file), $matches)) { + $id = $matches[0]; + $id = substr($id, 0, strlen($id) - 1); + $log_file['id'] = $id; + } + $log_file['path'] = $file; + $log_file['size'] = filesize($file); + $log_file['name'] = basename($file); + $log_file['time'] = filemtime($file); + + $offset = get_option('gmt_offset'); + $localtime = $log_file['time'] + $offset * 60 * 60; + $log_file['date'] = gmdate('M-d-y H:i', $localtime); + + $line = fgets($handle); + if ($line !== false) { + $pos = strpos($line, 'Log created: '); + if ($pos !== false) { + $log_file['time'] = substr($line, $pos + strlen('Log created: ')); + } + } + + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing file opened above for log reading + fclose($handle); + $log_list[basename($file)] = $log_file; + } + } + + $log_list = $this->sort_list($log_list); + return $log_list; + } + + public function sort_list($list) + { + uasort($list, function ($a, $b) { + if ($a['time'] > $b['time']) { + return -1; + } else if ($a['time'] === $b['time']) { + return 0; + } else { + return 1; + } + }); + + return $list; + } + + /** + * Get filtered log list by date/time range + * + * @since 2.0.0 + * @param string $start_date Start date + * @param string $start_time Start time + * @param string $end_date End date + * @param string $end_time End time + * @return array + */ + public function get_log_list_ex($start_date, $start_time, $end_date, $end_time) + { + if (empty($start_date)) { + $start = 0; + } else if (empty($start_time)) { + $start = strtotime($start_date); + } else { + $start = strtotime($start_date . ' ' . $start_time); + } + + if ($start > 0) { + $offset = get_option('gmt_offset'); + $start = $start - $offset * 60 * 60; + } + + if (empty($end_date)) { + $end = 0; + } else if (empty($end_time)) { + $end = strtotime($end_date); + } else { + $end = strtotime($end_date . ' ' . $end_time); + } + + if ($end > 0) { + $offset = get_option('gmt_offset'); + $end = $end - $offset * 60 * 60; + } + + $log_list = array(); + $log = new CompressX_Log(); + $dir = $log->GetSaveLogFolder(); + $files = array(); + $handler = opendir($dir); + $regex = '#^compressx.*_log.txt#'; + if ($handler !== false) { + while (($filename = readdir($handler)) !== false) { + if ($filename != "." && $filename != "..") { + if (is_dir($dir . $filename)) { + continue; + } else { + if (preg_match($regex, $filename)) { + $files[$filename] = $dir . $filename; + } + } + } + } + if ($handler) + @closedir($handler); + } + + foreach ($files as $file) { + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Simple read operation for log file metadata + $handle = @fopen($file, "r"); + if ($handle) { + $log_file['file_name'] = basename($file); + if (preg_match('/compressx-(.*?)_/', basename($file), $matches)) { + $id = $matches[0]; + $id = substr($id, 0, strlen($id) - 1); + $log_file['id'] = $id; + } + $log_file['path'] = $file; + $log_file['size'] = filesize($file); + $log_file['name'] = basename($file); + /* + $log_file['time'] = preg_replace('/[^0-9]/', '', basename($file)); + + $offset = get_option('gmt_offset'); + $localtime = strtotime($log_file['time']) + $offset * 60 * 60; + $log_file['date'] = gmdate('M-d-y H:i', $localtime);*/ + + $log_file['time'] = filemtime($file); + + $offset = get_option('gmt_offset'); + $localtime = $log_file['time'] + $offset * 60 * 60; + $log_file['date'] = gmdate('M-d-y H:i', $localtime); + + $line = fgets($handle); + if ($line !== false) { + $pos = strpos($line, 'Log created: '); + if ($pos !== false) { + $log_file['time'] = substr($line, $pos + strlen('Log created: ')); + } + } + + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing file opened above for log reading + fclose($handle); + + if ($start > 0 && $end > 0) { + if ($localtime >= $start && $localtime <= $end) { + $log_list[basename($file)] = $log_file; + } + } else if ($start > 0) { + if ($localtime >= $start) { + $log_list[basename($file)] = $log_file; + } + } else if ($end > 0) { + if ($localtime <= $end) { + $log_list[basename($file)] = $log_file; + } + } else { + $log_list[basename($file)] = $log_file; + } + } + } + + $log_list = $this->sort_list($log_list); + + return $log_list; + } + + private function is_log_file($file_name) + { + if (preg_match('/compressx_.*_log\.txt$/', $file_name)) { + return true; + } + return false; + } + + public function open_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try { + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in ajax_check_security above + if (!isset($_POST['filename'])) { + die(); + } + + // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- Nonce is verified in ajax_check_security above + $file_name = sanitize_text_field(wp_unslash($_POST['filename'])); + $loglist = $this->get_log_list(); + if (!empty($loglist)) { + if (isset($loglist[$file_name])) { + $log = $loglist[$file_name]; + } else { + $ret['result'] = 'failed'; + $ret['error'] = __('The log not found ', 'compressx') . $file_name; + echo wp_json_encode($ret); + die(); + } + + $path = $log['path']; + if (!file_exists($path)) { + $ret['result'] = 'failed'; + $ret['error'] = __('The log not found ', 'compressx') . $file_name; + echo wp_json_encode($ret); + die(); + } + + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Simple read operation for log display + $file = fopen($path, 'r'); + if (!$file) { + $ret['result'] = 'failed'; + $ret['error'] = __('Unable to open the log file.', 'compressx'); + echo wp_json_encode($ret); + die(); + } + + $offset = get_option('gmt_offset'); + $buffer = ''; + $create = gmdate('Y-m-d', $log['time']) ; + while (!feof($file)) { + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fread -- Reading log file for display + $buffer .= fread($file, 1024); + } + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing file opened above + fclose($file); + $ret['create'] = $create; + $ret['result'] = 'success'; + $ret['data'] = $buffer; + echo wp_json_encode($ret); + die(); + } else { + $ret['result'] = 'failed'; + $ret['error'] = 'The log not found.'; + echo wp_json_encode($ret); + die(); + } + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + echo wp_json_encode(array('result' => 'failed', 'error' => $message)); + } + die(); + } + + public function download_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try { + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is verified in ajax_check_security above + $file_name = sanitize_file_name($_GET['log']); + $log = new CompressX_Log(); + $path = $log->GetSaveLogFolder() . $file_name; + + if (!file_exists($path)) { + die(); + } + + if (session_id()) { + session_write_close(); + } + + $size = filesize($path); + if (!headers_sent()) { + header('Content-Description: File Transfer'); + header('Content-Type: application/octet-stream'); + header('Content-Disposition: attachment; filename="' . $file_name . '"'); + header('Content-Transfer-Encoding: binary'); + header('Connection: Keep-Alive'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + header('Content-Length: ' . $size); + } + + ob_end_clean(); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile -- Sending file to browser for download + readfile($path); + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + } + exit; + } + + public function delete_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try { + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in ajax_check_security above + if (!isset($_POST['filename'])) { + die(); + } + + // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- Nonce is verified in ajax_check_security above + $file_name = sanitize_text_field(wp_unslash($_POST['filename'])); + $loglist = $this->get_log_list(); + if (!empty($loglist)) { + if (isset($loglist[$file_name])) { + $log = $loglist[$file_name]; + } else { + $ret['result'] = 'failed'; + $ret['error'] = __('The log not found ', 'compressx') . $file_name; + echo wp_json_encode($ret); + die(); + } + + $path = $log['path']; + @wp_delete_file($path); + + $ret['result'] = 'success'; + echo wp_json_encode($ret); + die(); + } else { + $ret['result'] = 'failed'; + $ret['error'] = __('The log not found ', 'compressx'); + echo wp_json_encode($ret); + die(); + } + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + echo wp_json_encode(array('result' => 'failed', 'error' => $message)); + } + die(); + } + + public function delete_all_log() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + try { + $log = new CompressX_Log(); + $dir = $log->GetSaveLogFolder(); + $files = array(); + $handler = opendir($dir); + if ($handler !== false) { + while (($filename = readdir($handler)) !== false) { + if ($filename != "." && $filename != "..") { + if (is_dir($dir . $filename)) { + continue; + } else { + if ($this->is_log_file($filename)) { + @wp_delete_file($dir . $filename); + } + } + } + } + if ($handler) { + closedir($handler); + } + } + $ret['result'] = 'success'; + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + $ret['result'] = 'failed'; + $ret['error'] = $message; + } + echo wp_json_encode($ret); + die(); + } + + public function get_logs_list() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-logs'); + + if(isset($_POST['start_date'])) + { + $start_date=sanitize_key($_POST['start_date']); + } + else + { + $start_date=''; + } + + if(isset($_POST['start_time'])) + { + $start_time=sanitize_key($_POST['start_time']); + } + else + { + $start_time=''; + } + + if(isset($_POST['end_date'])) + { + $end_date=sanitize_key($_POST['end_date']); + } + else + { + $end_date=''; + } + + if(isset($_POST['end_time'])) + { + $end_time=sanitize_key($_POST['end_time']); + } + else + { + $end_time=''; + } + + if(isset($_POST['page'])) + { + $page=sanitize_key($_POST['page']); + } + else + { + $page=0; + } + + $list=$this->get_log_list_ex($start_date,$start_time,$end_date,$end_time); + $log_list=new CompressX_Log_List_V2(); + $log_list->set_log_list($list,$page); + $log_list->prepare_items(); + ob_start(); + $log_list->display(); + $json['result'] = 'success'; + $json['html'] = ob_get_clean(); + + echo wp_json_encode($json); + die(); + } + + public function get_debug_info() + { + global $wp_version; + $debug_info = array(); + + $debug_info['home'] = $this->get_domain(); + $debug_info['Server name'] = $_SERVER['SERVER_NAME']; + $debug_info['Web Server'] = sanitize_text_field($_SERVER["SERVER_SOFTWARE"]); + $debug_info['CompressX version'] = COMPRESSX_VERSION; + $debug_info['Wordpress version'] = $wp_version; + $debug_info['PHP version'] = phpversion(); + + if (!function_exists('gd_info')) { + $debug_info['GD extension'] = __("GD extension is not installed or enabled.", 'compressx'); + } else { + $debug_info['GD extension'] = __("The GD extension has been properly installed.", 'compressx'); + $info = gd_info(); + $debug_info['GD Version'] = isset($info['GD Version']) ? $info['GD Version'] : ''; + $debug_info['GD WebP Support'] = isset($info['WebP Support']) ? $info['WebP Support'] : false; + $debug_info['GD AVIF Support'] = isset($info['AVIF Support']) ? $info['AVIF Support'] : false; + } + + if (extension_loaded('imagick') && class_exists('\Imagick')) { + $debug_info['Imagick extension'] = __("The imagick extension has been properly installed.", 'compressx'); + $debug_info['Imagick Version'] = \Imagick::getVersion(); + $debug_info['Imagick WebP Support'] = \Imagick::queryformats('WEBP') ? true : false; + $debug_info['Imagick AVIF Support'] = \Imagick::queryformats('AVIF') ? true : false; + } else { + $debug_info['Imagick extension'] = __("Imagick extension is not installed or enabled.", 'compressx'); + } + + $debug_info['active_plugins'] = get_option('active_plugins'); + $debug_info['active_theme'] = wp_get_theme()->get_template(); + $debug_info['memory_current'] = size_format(memory_get_usage(), 2); + $debug_info['memory_peak'] = size_format(memory_get_peak_usage(), 2); + $debug_info['memory_limit'] = ini_get('memory_limit'); + + include_once COMPRESSX_DIR . '/includes/class-compressx-rewrite-checker.php'; + $test = new CompressX_Rewrite_Checker(); + $result = $test->test_ex(); + if ($result['result'] == 'success') { + $debug_info['Rewrite rules test'] = 'success'; + } else { + $debug_info['Rewrite rules test'] = $result['error']; + } + + $options = get_option('compressx_general_settings', array()); + $debug_info['setting'] = $options; + $quality_options = get_option('compressx_quality', array()); + $converter_method = get_option('compressx_converter_method', false); + $output_format_webp = get_option('compressx_output_format_webp', 1); + $output_format_avif = get_option('compressx_output_format_avif', 1); + $debug_info['setting']['quality'] = $quality_options; + $debug_info['setting']['output_format_webp'] = $output_format_webp; + $debug_info['setting']['output_format_avif'] = $output_format_avif; + $debug_info['setting']['converter_method'] = $converter_method; + $debug_info['setting'] = wp_json_encode($debug_info['setting']); + + return $debug_info; + } + + public function get_domain() + { + global $wpdb; + $home_url = home_url(); + $db_home_url = home_url(); + $home_url_sql = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->options WHERE option_name = %s", 'home')); + foreach ($home_url_sql as $home) { + $db_home_url = untrailingslashit($home->option_value); + } + + if ($home_url === $db_home_url) { + $domain = $home_url; + } else { + $domain = $db_home_url; + } + + return strtolower($domain); + } + + public function create_debug_package() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-system-info'); + + try { + if (!class_exists('PclZip')) + include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php'); + + $backup_path = "compressx"; + $path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_debug.zip'; + if (!is_dir(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path)) { + wp_mkdir_p(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Creating protection files + @fopen(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'index.html', 'x'); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Creating htaccess protection file + $tempfile = @fopen(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . '.htaccess', 'x'); + if ($tempfile) { + $text = "deny from all"; + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite -- Writing htaccess protection + fwrite($tempfile, $text); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing htaccess file + fclose($tempfile); + } + } + + if (file_exists($path)) { + @wp_delete_file($path); + } + + $archive = new PclZip($path); + $server_info = wp_json_encode($this->get_debug_info()); + $server_file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_server_info.json'; + if (file_exists($server_file_path)) { + @wp_delete_file($server_file_path); + } + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Creating temporary debug info file + $server_file = fopen($server_file_path, 'x'); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing temporary file + fclose($server_file); + file_put_contents($server_file_path, $server_info); + if (!$archive->add($server_file_path, PCLZIP_OPT_REMOVE_ALL_PATH)) { + exit; + } + @wp_delete_file($server_file_path); + + $log = new CompressX_Log(); + $files = $log->get_logs(); + if (!empty($files)) { + if (!$archive->add($files, PCLZIP_OPT_REMOVE_ALL_PATH)) { + exit; + } + } + + if (session_id()) + session_write_close(); + + $size = filesize($path); + if (!headers_sent()) { + header('Content-Description: File Transfer'); + header('Content-Type: application/zip'); + header('Content-Disposition: attachment; filename="' . basename($path) . '"'); + header('Cache-Control: must-revalidate'); + header('Content-Length: ' . $size); + header('Content-Transfer-Encoding: binary'); + } + + ob_end_clean(); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile -- Sending debug package to browser for download + readfile($path); + @wp_delete_file($path); + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + echo wp_json_encode(array('result' => 'failed', 'error' => $message)); + die(); + } + exit; + } + + public function send_debug_info() + { + global $compressx; + $compressx->ajax_check_security('compressx-can-use-system-info'); + + try { + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in ajax_check_security above + if (!isset($_POST['user_mail']) || empty($_POST['user_mail'])) { + $ret['result'] = 'failed'; + $ret['error'] = __('User\'s email address is required.', 'compressx'); + } else { + $pattern = '/^[a-z0-9]+([._-][a-z0-9]+)*@([0-9a-z]+\.[a-z]{2,14}(\.[a-z]{2})?)$/i'; + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in ajax_check_security above + if (!preg_match($pattern, $_POST['user_mail'])) { + $ret['result'] = 'failed'; + $ret['error'] = __('Please enter a valid email address.', 'compressx'); + } else { + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in ajax_check_security above + $user_mail = sanitize_email($_POST['user_mail']); + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified in ajax_check_security above + $comment = sanitize_text_field($_POST['comment']); + $ret = $this->_send_debug_info($user_mail, $comment); + } + } + echo wp_json_encode($ret); + die(); + } catch (Exception $error) { + $message = 'An exception has occurred. class: ' . get_class($error) . ';msg: ' . $error->getMessage() . ';code: ' . $error->getCode() . ';line: ' . $error->getLine() . ';in_file: ' . $error->getFile() . ';'; + //error_log($message); + echo wp_json_encode(array('result' => 'failed', 'error' => $message)); + die(); + } + } + + public function _send_debug_info($user_email, $comment) + { + $send_to = 'support@compressx.io'; + $subject = 'Debug Information'; + $body = '
                User\'s email: ' . $user_email . '.
                '; + $body .= '
                Comment: ' . $comment . '.
                '; + $headers = array('Content-Type: text/html; charset=UTF-8'); + + if (!class_exists('PclZip')) + include_once(ABSPATH . '/wp-admin/includes/class-pclzip.php'); + + $backup_path = "compressx"; + $path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_debug.zip'; + if (!is_dir(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path)) { + wp_mkdir_p(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Creating protection files + @fopen(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'index.html', 'x'); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Creating htaccess protection file + $tempfile = @fopen(WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . '.htaccess', 'x'); + if ($tempfile) { + $text = "deny from all"; + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fwrite -- Writing htaccess protection + fwrite($tempfile, $text); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing htaccess file + fclose($tempfile); + } + } + + if (file_exists($path)) { + @wp_delete_file($path); + } + + $archive = new PclZip($path); + $server_info = wp_json_encode($this->get_debug_info()); + $server_file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $backup_path . DIRECTORY_SEPARATOR . 'compressx_server_info.json'; + if (file_exists($server_file_path)) { + @wp_delete_file($server_file_path); + } + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Creating temporary debug info file + $server_file = fopen($server_file_path, 'x'); + // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- Closing temporary file + fclose($server_file); + file_put_contents($server_file_path, $server_info); + $archive->add($server_file_path, PCLZIP_OPT_REMOVE_ALL_PATH); + @wp_delete_file($server_file_path); + + $log = new CompressX_Log(); + $files = $log->get_logs(); + if (!empty($files)) { + $archive->add($files, PCLZIP_OPT_REMOVE_ALL_PATH); + } + + $attachments[] = $path; + + if (wp_mail($send_to, $subject, $body, $headers, $attachments) === false) { + $ret['result'] = 'failed'; + $ret['error'] = __('Unable to send email. Please check the configuration of email server.', 'compressx'); + } else { + $ret['result'] = 'success'; + } + + @wp_delete_file($path); + return $ret; + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/css/compressx-folder-tree.css b/wp-content/plugins/compressx/includes/display_v2/css/compressx-folder-tree.css new file mode 100644 index 0000000..14edf4f --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/css/compressx-folder-tree.css @@ -0,0 +1,118 @@ +:root { + --color-tech-blue: #018fd1; + --color-dark-yellow: orange; + --color-grey: #ddd; + --color-grey-black: #888; + --color-light-grey: #F8F9FA; + --color-light-blue: #175cff; + --color-light-blue-2: #104bd4; + --color-background: #fff; + --color-title: #0B163F; +} + +.compressx-general-settings-body .cx-uploads-rules, +.compressx-general-settings-body .cx-mediafolder-rules { + display: grid; + grid-template-columns: 1fr 2fr; + gap: 1rem; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-icon-color-yellow { + color: var(--color-dark-yellow); + font-size: 1rem; + padding-top: 0.1rem; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-icon-color-techblue { + color: var(--color-tech-blue); + font-size: 1rem; + padding-top: 0.1rem; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included { + position: relative; + padding: 1rem 0; + border-radius: 10px; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer li, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list li { + position: relative; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer .cx-remove-rule, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list .cx-remove-rule { + position: absolute; + right: 0; + cursor: pointer; + color: var(--color-grey-black); + font-size: 1rem; + padding-top: 0.1rem; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer, +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list { + margin-top: 1rem; + border: 1px solid var(--color-grey); + border-radius: 4px; + padding: 0 0.5rem; + height: 200px; + overflow-y: auto; + overflow-x: auto; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list ul { + padding: 0; +} + +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolder-included .cx-mediafolder-list li:nth-child(odd), +.compressx-general-settings-body .cx-mediafolder-rules .cx-mediafolders .cx-upload-treeviewer li:nth-child(odd) { + background-color: var(--color-light-grey); +} + +.compressx-container .cx-button { + background-color: var(--color-light-blue); + border-color: var(--color-light-blue); +} + +.compressx-container .cx-button:hover { + background-color: var(--color-light-blue-2); + border-color: var(--color-light-blue-2); + color: var(--color-background); +} + +.compressx-container .cx-button:focus { + background-color: var(--color-light-blue-2); + border-color: var(--color-light-blue-2); + color: var(--color-background); +} + +.compressx-container .cx-button-light { + background-color: var(--color-background); + border-color: var(--color-light-blue); + color: var(--color-light-blue); +} + +.compressx-container .cx-button-light:hover { + background-color: var(--color-light-blue); + color: var(--color-background); +} + +@media screen and (max-width: 768px) { + .compressx-general-settings-body .cx-uploads-rules, + .compressx-general-settings-body .cx-mediafolder-rules { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; + } +} + +@media screen and (max-width: 430px) { + .compressx-general-settings-body .cx-uploads-rules, + .compressx-general-settings-body .cx-mediafolder-rules { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; + } +} diff --git a/wp-content/plugins/compressx/includes/display_v2/css/compressx-style-v2.css b/wp-content/plugins/compressx/includes/display_v2/css/compressx-style-v2.css new file mode 100644 index 0000000..536676a --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/css/compressx-style-v2.css @@ -0,0 +1,2986 @@ +*, ::before, ::after { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +::backdrop { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: rgb(59 130 246 / 0.5); + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} + +/* +! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com +*/ + +/* +1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) +2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) +*/ + +*, +::before, +::after { + box-sizing: border-box; + /* 1 */ + border-width: 0; + /* 2 */ + border-style: solid; + /* 2 */ + border-color: #e5e7eb; + /* 2 */ +} + +::before, +::after { + --tw-content: ''; +} + +/* +1. Use a consistent sensible line-height in all browsers. +2. Prevent adjustments of font size after orientation changes in iOS. +3. Use a more readable tab size. +4. Use the user's configured `sans` font-family by default. +5. Use the user's configured `sans` font-feature-settings by default. +6. Use the user's configured `sans` font-variation-settings by default. +7. Disable tap highlights on iOS +*/ + +html, +:host { + line-height: 1.5; + /* 1 */ + -webkit-text-size-adjust: 100%; + /* 2 */ + -moz-tab-size: 4; + /* 3 */ + -o-tab-size: 4; + tab-size: 4; + /* 3 */ + font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + /* 4 */ + font-feature-settings: normal; + /* 5 */ + font-variation-settings: normal; + /* 6 */ + -webkit-tap-highlight-color: transparent; + /* 7 */ +} + +/* +1. Remove the margin in all browsers. +2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. +*/ + +body { + margin: 0; + /* 1 */ + line-height: inherit; + /* 2 */ +} + +/* +1. Add the correct height in Firefox. +2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) +3. Ensure horizontal rules are visible by default. +*/ + +hr { + height: 0; + /* 1 */ + color: inherit; + /* 2 */ + border-top-width: 1px; + /* 3 */ +} + +/* +Add the correct text decoration in Chrome, Edge, and Safari. +*/ + +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} + +/* +Remove the default font size and weight for headings. +*/ + +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} + +/* +Reset links to optimize for opt-in styling instead of opt-out. +*/ + +a { + color: inherit; + text-decoration: inherit; +} + +/* +Add the correct font weight in Edge and Safari. +*/ + +b, +strong { + font-weight: bolder; +} + +/* +1. Use the user's configured `mono` font-family by default. +2. Use the user's configured `mono` font-feature-settings by default. +3. Use the user's configured `mono` font-variation-settings by default. +4. Correct the odd `em` font sizing in all browsers. +*/ + +code, +kbd, +samp, +pre { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; + /* 1 */ + font-feature-settings: normal; + /* 2 */ + font-variation-settings: normal; + /* 3 */ + font-size: 1em; + /* 4 */ +} + +/* +Add the correct font size in all browsers. +*/ + +small { + font-size: 80%; +} + +/* +Prevent `sub` and `sup` elements from affecting the line height in all browsers. +*/ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +/* +1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) +2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +3. Remove gaps between table borders by default. +*/ + +table { + text-indent: 0; + /* 1 */ + border-color: inherit; + /* 2 */ + border-collapse: collapse; + /* 3 */ +} + +/* +1. Change the font styles in all browsers. +2. Remove the margin in Firefox and Safari. +3. Remove default padding in all browsers. +*/ + +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + /* 1 */ + font-feature-settings: inherit; + /* 1 */ + font-variation-settings: inherit; + /* 1 */ + font-size: 100%; + /* 1 */ + font-weight: inherit; + /* 1 */ + line-height: inherit; + /* 1 */ + letter-spacing: inherit; + /* 1 */ + color: inherit; + /* 1 */ + margin: 0; + /* 2 */ + padding: 0; + /* 3 */ +} + +/* +Remove the inheritance of text transform in Edge and Firefox. +*/ + +button, +select { + text-transform: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Remove default button styles. +*/ + +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + /* 1 */ + background-color: transparent; + /* 2 */ + background-image: none; + /* 2 */ +} + +/* +Use the modern Firefox focus style for all focusable elements. +*/ + +:-moz-focusring { + outline: auto; +} + +/* +Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) +*/ + +:-moz-ui-invalid { + box-shadow: none; +} + +/* +Add the correct vertical alignment in Chrome and Firefox. +*/ + +progress { + vertical-align: baseline; +} + +/* +Correct the cursor style of increment and decrement buttons in Safari. +*/ + +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} + +/* +1. Correct the odd appearance in Chrome and Safari. +2. Correct the outline style in Safari. +*/ + +[type='search'] { + -webkit-appearance: textfield; + /* 1 */ + outline-offset: -2px; + /* 2 */ +} + +/* +Remove the inner padding in Chrome and Safari on macOS. +*/ + +::-webkit-search-decoration { + -webkit-appearance: none; +} + +/* +1. Correct the inability to style clickable types in iOS and Safari. +2. Change font properties to `inherit` in Safari. +*/ + +::-webkit-file-upload-button { + -webkit-appearance: button; + /* 1 */ + font: inherit; + /* 2 */ +} + +/* +Add the correct display in Chrome and Safari. +*/ + +summary { + display: list-item; +} + +/* +Removes the default spacing and border for appropriate elements. +*/ + +blockquote, +dl, +dd, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +figure, +p, +pre { + margin: 0; +} + +fieldset { + margin: 0; + padding: 0; +} + +legend { + padding: 0; +} + +ol, +ul, +menu { + list-style: none; + margin: 0; + padding: 0; +} + +/* +Reset default styling for dialogs. +*/ + +dialog { + padding: 0; +} + +/* +Prevent resizing textareas horizontally by default. +*/ + +textarea { + resize: vertical; +} + +/* +1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) +2. Set the default placeholder color to the user's configured gray 400 color. +*/ + +input::-moz-placeholder, textarea::-moz-placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +input::placeholder, +textarea::placeholder { + opacity: 1; + /* 1 */ + color: #9ca3af; + /* 2 */ +} + +/* +Set the default cursor for buttons. +*/ + +button, +[role="button"] { + cursor: pointer; +} + +/* +Make sure disabled buttons don't get the pointer cursor. +*/ + +:disabled { + cursor: default; +} + +/* +1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) +2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) + This can trigger a poorly considered lint error in some tools but is included by design. +*/ + +img, +svg, +video, +canvas, +audio, +iframe, +embed, +object { + display: block; + /* 1 */ + vertical-align: middle; + /* 2 */ +} + +/* +Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) +*/ + +img, +video { + max-width: 100%; + height: auto; +} + +/* Make elements with the HTML hidden attribute stay hidden by default */ + +[hidden]:where(:not([hidden="until-found"])) { + display: none; +} + +.compressx-v2-sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.compressx-v2-fixed { + position: fixed; +} + +.compressx-v2-absolute { + position: absolute; +} + +.compressx-v2-relative { + position: relative; +} + +.compressx-v2-sticky { + position: sticky; +} + +.compressx-v2--top-4 { + top: -1rem; +} + +.compressx-v2-bottom-0 { + bottom: 0px; +} + +.compressx-v2-bottom-full { + bottom: 100%; +} + +.compressx-v2-left-0 { + left: 0px; +} + +.compressx-v2-left-0\.5 { + left: 0.125rem; +} + +.compressx-v2-left-1\/2 { + left: 50%; +} + +.compressx-v2-right-0 { + right: 0px; +} + +.compressx-v2-right-2 { + right: 0.5rem; +} + +.compressx-v2-right-3 { + right: 0.75rem; +} + +.compressx-v2-top-0 { + top: 0px; +} + +.compressx-v2-top-0\.5 { + top: 0.125rem; +} + +.compressx-v2-top-2 { + top: 0.5rem; +} + +.compressx-v2-top-3 { + top: 0.75rem; +} + +.compressx-v2-top-full { + top: 100%; +} + +.compressx-v2-z-50 { + z-index: 50; +} + +.compressx-v2-col-span-1 { + grid-column: span 1 / span 1; +} + +.compressx-v2-col-span-2 { + grid-column: span 2 / span 2; +} + +.compressx-v2-mx-0\.5 { + margin-left: 0.125rem; + margin-right: 0.125rem; +} + +.compressx-v2-mx-auto { + margin-left: auto; + margin-right: auto; +} + +.compressx-v2-my-2 { + margin-top: 0.5rem; + margin-bottom: 0.5rem; +} + +.compressx-v2-my-3 { + margin-top: 0.75rem; + margin-bottom: 0.75rem; +} + +.compressx-v2-my-6 { + margin-top: 1.5rem; + margin-bottom: 1.5rem; +} + +.compressx-v2-mx-1 { + margin-left: 0.25rem; + margin-right: 0.25rem; +} + +.compressx-v2-mb-0\.5 { + margin-bottom: 0.125rem; +} + +.compressx-v2-mb-1 { + margin-bottom: 0.25rem; +} + +.compressx-v2-mb-2 { + margin-bottom: 0.5rem; +} + +.compressx-v2-mb-3 { + margin-bottom: 0.75rem; +} + +.compressx-v2-mb-4 { + margin-bottom: 1rem; +} + +.compressx-v2-mb-5 { + margin-bottom: 1.25rem; +} + +.compressx-v2-mb-6 { + margin-bottom: 1.5rem; +} + +.compressx-v2-mb-8 { + margin-bottom: 2rem; +} + +.compressx-v2-ml-1 { + margin-left: 0.25rem; +} + +.compressx-v2-ml-2 { + margin-left: 0.5rem; +} + +.compressx-v2-ml-3 { + margin-left: 0.75rem; +} + +.compressx-v2-ml-4 { + margin-left: 1rem; +} + +.compressx-v2-ml-5 { + margin-left: 1.25rem; +} + +.compressx-v2-ml-6 { + margin-left: 1.5rem; +} + +.compressx-v2-mr-2 { + margin-right: 0.5rem; +} + +.compressx-v2-mr-4 { + margin-right: 1rem; +} + +.compressx-v2-mt-0\.5 { + margin-top: 0.125rem; +} + +.compressx-v2-mt-1 { + margin-top: 0.25rem; +} + +.compressx-v2-mt-12 { + margin-top: 3rem; +} + +.compressx-v2-mt-2 { + margin-top: 0.5rem; +} + +.compressx-v2-mt-3 { + margin-top: 0.75rem; +} + +.compressx-v2-mt-4 { + margin-top: 1rem; +} + +.compressx-v2-mt-5 { + margin-top: 1.25rem; +} + +.compressx-v2-mt-6 { + margin-top: 1.5rem; +} + +.compressx-v2-mt-8 { + margin-top: 2rem; +} + +.compressx-v2-mt-\[4px\] { + margin-top: 4px; +} + +.compressx-v2-mr-1 { + margin-right: 0.25rem; +} + +.compressx-v2-mt-\[1px\] { + margin-top: 1px; +} + +.compressx-v2-block { + display: block; +} + +.compressx-v2-inline-block { + display: inline-block; +} + +.compressx-v2-flex { + display: flex; +} + +.compressx-v2-inline-flex { + display: inline-flex; +} + +.compressx-v2-grid { + display: grid; +} + +.compressx-v2-hidden { + display: none; +} + +.compressx-v2-h-1 { + height: 0.25rem; +} + +.compressx-v2-h-1\.5 { + height: 0.375rem; +} + +.compressx-v2-h-10 { + height: 2.5rem; +} + +.compressx-v2-h-2 { + height: 0.5rem; +} + +.compressx-v2-h-3 { + height: 0.75rem; +} + +.compressx-v2-h-36 { + height: 9rem; +} + +.compressx-v2-h-4 { + height: 1rem; +} + +.compressx-v2-h-48 { + height: 12rem; +} + +.compressx-v2-h-5 { + height: 1.25rem; +} + +.compressx-v2-h-52 { + height: 13rem; +} + +.compressx-v2-h-56 { + height: 14rem; +} + +.compressx-v2-h-6 { + height: 1.5rem; +} + +.compressx-v2-h-64 { + height: 16rem; +} + +.compressx-v2-h-96 { + height: 24rem; +} + +.compressx-v2-h-\[135px\] { + height: 135px; +} + +.compressx-v2-h-\[140px\] { + height: 140px; +} + +.compressx-v2-h-\[150px\] { + height: 150px; +} + +.compressx-v2-h-\[160px\] { + height: 160px; +} + +.compressx-v2-h-\[35rem\] { + height: 35rem; +} + +.compressx-v2-h-\[400px\] { + height: 400px; +} + +.compressx-v2-h-\[calc\(100vh-200px\)\] { + height: calc(100vh - 200px); +} + +.compressx-v2-h-\[calc\(100vh-70px\)\] { + height: calc(100vh - 70px); +} + +.compressx-v2-h-fit { + height: -moz-fit-content; + height: fit-content; +} + +.compressx-v2-h-full { + height: 100%; +} + +.compressx-v2-h-px { + height: 1px; +} + +.compressx-v2-h-8 { + height: 2rem; +} + +.compressx-v2-h-9 { + height: 2.25rem; +} + +.compressx-v2-h-3\.5 { + height: 0.875rem; +} + +.compressx-v2-h-7 { + height: 1.75rem; +} + +.compressx-v2-max-h-\[600px\] { + max-height: 600px; +} + +.compressx-v2-max-h-20 { + max-height: 5rem; +} + +.compressx-v2-max-h-5 { + max-height: 1.25rem; +} + +.compressx-v2-min-h-20 { + min-height: 5rem; +} + +.compressx-v2-w-1\.5 { + width: 0.375rem; +} + +.compressx-v2-w-1\/2 { + width: 50%; +} + +.compressx-v2-w-10 { + width: 2.5rem; +} + +.compressx-v2-w-11 { + width: 2.75rem; +} + +.compressx-v2-w-16 { + width: 4rem; +} + +.compressx-v2-w-2 { + width: 0.5rem; +} + +.compressx-v2-w-20 { + width: 5rem; +} + +.compressx-v2-w-24 { + width: 6rem; +} + +.compressx-v2-w-32 { + width: 8rem; +} + +.compressx-v2-w-36 { + width: 9rem; +} + +.compressx-v2-w-4 { + width: 1rem; +} + +.compressx-v2-w-5 { + width: 1.25rem; +} + +.compressx-v2-w-56 { + width: 14rem; +} + +.compressx-v2-w-6 { + width: 1.5rem; +} + +.compressx-v2-w-60 { + width: 15rem; +} + +.compressx-v2-w-64 { + width: 16rem; +} + +.compressx-v2-w-8 { + width: 2rem; +} + +.compressx-v2-w-\[135px\] { + width: 135px; +} + +.compressx-v2-w-\[140px\] { + width: 140px; +} + +.compressx-v2-w-\[150px\] { + width: 150px; +} + +.compressx-v2-w-\[160px\] { + width: 160px; +} + +.compressx-v2-w-\[300px\] { + width: 300px; +} + +.compressx-v2-w-\[320px\] { + width: 320px; +} + +.compressx-v2-w-\[360px\] { + width: 360px; +} + +.compressx-v2-w-\[45\%\] { + width: 45%; +} + +.compressx-v2-w-\[60\%\] { + width: 60%; +} + +.compressx-v2-w-full { + width: 100%; +} + +.compressx-v2-w-3\.5 { + width: 0.875rem; +} + +.compressx-v2-min-w-20 { + min-width: 5rem; +} + +.compressx-v2-min-w-56 { + min-width: 14rem; +} + +.compressx-v2-min-w-64 { + min-width: 16rem; +} + +.compressx-v2-min-w-\[120px\] { + min-width: 120px; +} + +.compressx-v2-min-w-\[250px\] { + min-width: 250px; +} + +.compressx-v2-min-w-full { + min-width: 100%; +} + +.compressx-v2-min-w-0 { + min-width: 0px; +} + +.compressx-v2-max-w-7xl { + max-width: 80rem; +} + +.compressx-v2-max-w-96 { + max-width: 24rem; +} + +.compressx-v2-max-w-\[1200px\] { + max-width: 1200px; +} + +.compressx-v2-max-w-full { + max-width: 100%; +} + +.compressx-v2-max-w-xl { + max-width: 36rem; +} + +.compressx-v2-max-w-20 { + max-width: 5rem; +} + +.compressx-v2-flex-1 { + flex: 1 1 0%; +} + +.compressx-v2-flex-\[2\] { + flex: 2; +} + +.compressx-v2-flex-shrink-0 { + flex-shrink: 0; +} + +.compressx-v2-shrink-0 { + flex-shrink: 0; +} + +.-compressx-v2-translate-x-1\/2 { + --tw-translate-x: -50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2--translate-y-1\/2 { + --tw-translate-y: -50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-translate-x-1\/2 { + --tw-translate-x: 50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-translate-x-5 { + --tw-translate-x: 1.25rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-translate-y-1\/2 { + --tw-translate-y: 50%; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-rotate-45 { + --tw-rotate: 45deg; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-rotate-90 { + --tw-rotate: 90deg; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-transform { + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-animate-\[fadein_2s_ease-in-out\] { + animation: fadein 2s ease-in-out; +} + +.compressx-v2-cursor-pointer { + cursor: pointer; +} + +.compressx-v2-cursor-default { + cursor: default; +} + +.compressx-v2-list-disc { + list-style-type: disc; +} + +.compressx-v2-list-none { + list-style-type: none; +} + +.compressx-v2-grid-cols-1 { + grid-template-columns: repeat(1, minmax(0, 1fr)); +} + +.compressx-v2-grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); +} + +.compressx-v2-grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); +} + +.compressx-v2-grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); +} + +.compressx-v2-grid-cols-\[auto\,1fr\] { + grid-template-columns: auto 1fr; +} + +.compressx-v2-flex-col { + flex-direction: column; +} + +.compressx-v2-flex-wrap { + flex-wrap: wrap; +} + +.compressx-v2-items-start { + align-items: flex-start; +} + +.compressx-v2-items-end { + align-items: flex-end; +} + +.compressx-v2-items-center { + align-items: center; +} + +.compressx-v2-items-baseline { + align-items: baseline; +} + +.compressx-v2-items-stretch { + align-items: stretch; +} + +.compressx-v2-justify-start { + justify-content: flex-start; +} + +.compressx-v2-justify-end { + justify-content: flex-end; +} + +.compressx-v2-justify-center { + justify-content: center; +} + +.compressx-v2-justify-between { + justify-content: space-between; +} + +.compressx-v2-gap-1 { + gap: 0.25rem; +} + +.compressx-v2-gap-1\.5 { + gap: 0.375rem; +} + +.compressx-v2-gap-2 { + gap: 0.5rem; +} + +.compressx-v2-gap-3 { + gap: 0.75rem; +} + +.compressx-v2-gap-4 { + gap: 1rem; +} + +.compressx-v2-gap-5 { + gap: 1.25rem; +} + +.compressx-v2-gap-6 { + gap: 1.5rem; +} + +.compressx-v2-gap-x-1 { + -moz-column-gap: 0.25rem; + column-gap: 0.25rem; +} + +.compressx-v2-gap-x-6 { + -moz-column-gap: 1.5rem; + column-gap: 1.5rem; +} + +.compressx-v2-gap-y-1 { + row-gap: 0.25rem; +} + +.compressx-v2-gap-y-2 { + row-gap: 0.5rem; +} + +.compressx-v2-gap-x-3 { + -moz-column-gap: 0.75rem; + column-gap: 0.75rem; +} + +.compressx-v2-space-x-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.25rem * var(--tw-space-x-reverse)); + margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse))); +} + +.compressx-v2-space-x-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.5rem * var(--tw-space-x-reverse)); + margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))); +} + +.compressx-v2-space-x-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(0.75rem * var(--tw-space-x-reverse)); + margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse))); +} + +.compressx-v2-space-x-6 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(1.5rem * var(--tw-space-x-reverse)); + margin-left: calc(1.5rem * calc(1 - var(--tw-space-x-reverse))); +} + +.compressx-v2-space-y-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-2 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-4 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-5 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1.25rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.25rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-6 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-8 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(2rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-\[2px\] > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(2px * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(2px * var(--tw-space-y-reverse)); +} + +.compressx-v2-space-y-1\.5 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.375rem * var(--tw-space-y-reverse)); +} + +.compressx-v2-divide-y > :not([hidden]) ~ :not([hidden]) { + --tw-divide-y-reverse: 0; + border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); + border-bottom-width: calc(1px * var(--tw-divide-y-reverse)); +} + +.compressx-v2-divide-gray-100 > :not([hidden]) ~ :not([hidden]) { + --tw-divide-opacity: 1; + border-color: rgb(243 244 246 / var(--tw-divide-opacity, 1)); +} + +.compressx-v2-divide-gray-200 > :not([hidden]) ~ :not([hidden]) { + --tw-divide-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-divide-opacity, 1)); +} + +.compressx-v2-overflow-hidden { + overflow: hidden; +} + +.compressx-v2-overflow-visible { + overflow: visible; +} + +.compressx-v2-overflow-x-auto { + overflow-x: auto; +} + +.compressx-v2-overflow-y-auto { + overflow-y: auto; +} + +.compressx-v2-overflow-x-hidden { + overflow-x: hidden; +} + +.compressx-v2-truncate { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.compressx-v2-whitespace-nowrap { + white-space: nowrap; +} + +.compressx-v2-whitespace-pre-line { + white-space: pre-line; +} + +.compressx-v2-rounded { + border-radius: 0.25rem; +} + +.compressx-v2-rounded-full { + border-radius: 9999px; +} + +.compressx-v2-rounded-lg { + border-radius: 0.5rem; +} + +.compressx-v2-rounded-md { + border-radius: 0.375rem; +} + +.compressx-v2-rounded-sm { + border-radius: 0.125rem; +} + +.compressx-v2-border { + border-width: 1px; +} + +.compressx-v2-border-b { + border-bottom-width: 1px; +} + +.compressx-v2-border-b-2 { + border-bottom-width: 2px; +} + +.compressx-v2-border-l { + border-left-width: 1px; +} + +.compressx-v2-border-l-4 { + border-left-width: 4px; +} + +.compressx-v2-border-r { + border-right-width: 1px; +} + +.compressx-v2-border-t { + border-top-width: 1px; +} + +.compressx-v2-border-dashed { + border-style: dashed; +} + +.compressx-v2-border-black { + --tw-border-opacity: 1; + border-color: rgb(0 0 0 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-blue-100 { + --tw-border-opacity: 1; + border-color: rgb(219 234 254 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-blue-200 { + --tw-border-opacity: 1; + border-color: rgb(191 219 254 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-blue-300 { + --tw-border-opacity: 1; + border-color: rgb(147 197 253 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-blue-400 { + --tw-border-opacity: 1; + border-color: rgb(96 165 250 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-blue-500 { + --tw-border-opacity: 1; + border-color: rgb(59 130 246 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-blue-600 { + --tw-border-opacity: 1; + border-color: rgb(37 99 235 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-emerald-200 { + --tw-border-opacity: 1; + border-color: rgb(167 243 208 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-gray-100 { + --tw-border-opacity: 1; + border-color: rgb(243 244 246 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-gray-300 { + --tw-border-opacity: 1; + border-color: rgb(209 213 219 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-gray-400 { + --tw-border-opacity: 1; + border-color: rgb(156 163 175 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-green-100 { + --tw-border-opacity: 1; + border-color: rgb(220 252 231 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-green-300 { + --tw-border-opacity: 1; + border-color: rgb(134 239 172 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-green-400 { + --tw-border-opacity: 1; + border-color: rgb(74 222 128 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-red-300 { + --tw-border-opacity: 1; + border-color: rgb(252 165 165 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-red-500 { + --tw-border-opacity: 1; + border-color: rgb(239 68 68 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-slate-200 { + --tw-border-opacity: 1; + border-color: rgb(226 232 240 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-slate-300 { + --tw-border-opacity: 1; + border-color: rgb(203 213 225 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-transparent { + border-color: transparent; +} + +.compressx-v2-border-yellow-300 { + --tw-border-opacity: 1; + border-color: rgb(253 224 71 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-yellow-400 { + --tw-border-opacity: 1; + border-color: rgb(250 204 21 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-slate-900 { + --tw-border-opacity: 1; + border-color: rgb(15 23 42 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-border-red-200 { + --tw-border-opacity: 1; + border-color: rgb(254 202 202 / var(--tw-border-opacity, 1)); +} + +.compressx-v2-bg-\[\#F0F4FF\] { + --tw-bg-opacity: 1; + background-color: rgb(240 244 255 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-\[\#F2FBFA\] { + --tw-bg-opacity: 1; + background-color: rgb(242 251 250 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-\[\#F8FAFF\] { + --tw-bg-opacity: 1; + background-color: rgb(248 250 255 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-\[\#F9FDF6\] { + --tw-bg-opacity: 1; + background-color: rgb(249 253 246 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-\[\#FFFDF5\] { + --tw-bg-opacity: 1; + background-color: rgb(255 253 245 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-amber-500 { + --tw-bg-opacity: 1; + background-color: rgb(245 158 11 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-black { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-blue-100 { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-blue-50 { + --tw-bg-opacity: 1; + background-color: rgb(239 246 255 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-blue-50\/30 { + background-color: rgb(239 246 255 / 0.3); +} + +.compressx-v2-bg-blue-500 { + --tw-bg-opacity: 1; + background-color: rgb(59 130 246 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-blue-600 { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-cyan-50 { + --tw-bg-opacity: 1; + background-color: rgb(236 254 255 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-emerald-400 { + --tw-bg-opacity: 1; + background-color: rgb(52 211 153 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-emerald-50 { + --tw-bg-opacity: 1; + background-color: rgb(236 253 245 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-emerald-500 { + --tw-bg-opacity: 1; + background-color: rgb(16 185 129 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-200 { + --tw-bg-opacity: 1; + background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-300 { + --tw-bg-opacity: 1; + background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-50 { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-500 { + --tw-bg-opacity: 1; + background-color: rgb(107 114 128 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-600 { + --tw-bg-opacity: 1; + background-color: rgb(75 85 99 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-700 { + --tw-bg-opacity: 1; + background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gray-900 { + --tw-bg-opacity: 1; + background-color: rgb(17 24 39 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-100 { + --tw-bg-opacity: 1; + background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-200 { + --tw-bg-opacity: 1; + background-color: rgb(187 247 208 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-300 { + --tw-bg-opacity: 1; + background-color: rgb(134 239 172 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-400 { + --tw-bg-opacity: 1; + background-color: rgb(74 222 128 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-50 { + --tw-bg-opacity: 1; + background-color: rgb(240 253 244 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-50\/30 { + background-color: rgb(240 253 244 / 0.3); +} + +.compressx-v2-bg-green-500 { + --tw-bg-opacity: 1; + background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-green-600 { + --tw-bg-opacity: 1; + background-color: rgb(22 163 74 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-orange-100 { + --tw-bg-opacity: 1; + background-color: rgb(255 237 213 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-orange-50 { + --tw-bg-opacity: 1; + background-color: rgb(255 247 237 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-orange-500 { + --tw-bg-opacity: 1; + background-color: rgb(249 115 22 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-orange-600 { + --tw-bg-opacity: 1; + background-color: rgb(234 88 12 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-purple-50 { + --tw-bg-opacity: 1; + background-color: rgb(250 245 255 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-red-100 { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-red-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 242 242 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-red-500 { + --tw-bg-opacity: 1; + background-color: rgb(239 68 68 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-red-600 { + --tw-bg-opacity: 1; + background-color: rgb(220 38 38 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-slate-50 { + --tw-bg-opacity: 1; + background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-slate-900\/95 { + background-color: rgb(15 23 42 / 0.95); +} + +.compressx-v2-bg-teal-500 { + --tw-bg-opacity: 1; + background-color: rgb(20 184 166 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-transparent { + background-color: transparent; +} + +.compressx-v2-bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-yellow-100 { + --tw-bg-opacity: 1; + background-color: rgb(254 249 195 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-yellow-400 { + --tw-bg-opacity: 1; + background-color: rgb(250 204 21 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-yellow-50 { + --tw-bg-opacity: 1; + background-color: rgb(254 252 232 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-yellow-500 { + --tw-bg-opacity: 1; + background-color: rgb(234 179 8 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-slate-100 { + --tw-bg-opacity: 1; + background-color: rgb(241 245 249 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-slate-900 { + --tw-bg-opacity: 1; + background-color: rgb(15 23 42 / var(--tw-bg-opacity, 1)); +} + +.compressx-v2-bg-gradient-to-r { + background-image: linear-gradient(to right, var(--tw-gradient-stops)); +} + +.compressx-v2-from-blue-400 { + --tw-gradient-from: #60a5fa var(--tw-gradient-from-position); + --tw-gradient-to: rgb(96 165 250 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-blue-50 { + --tw-gradient-from: #eff6ff var(--tw-gradient-from-position); + --tw-gradient-to: rgb(239 246 255 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-blue-500 { + --tw-gradient-from: #3b82f6 var(--tw-gradient-from-position); + --tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-cyan-50 { + --tw-gradient-from: #ecfeff var(--tw-gradient-from-position); + --tw-gradient-to: rgb(236 254 255 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-green-500 { + --tw-gradient-from: #22c55e var(--tw-gradient-from-position); + --tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-indigo-100 { + --tw-gradient-from: #e0e7ff var(--tw-gradient-from-position); + --tw-gradient-to: rgb(224 231 255 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-orange-400 { + --tw-gradient-from: #fb923c var(--tw-gradient-from-position); + --tw-gradient-to: rgb(251 146 60 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-from-teal-400 { + --tw-gradient-from: #2dd4bf var(--tw-gradient-from-position); + --tw-gradient-to: rgb(45 212 191 / 0) var(--tw-gradient-to-position); + --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); +} + +.compressx-v2-to-blue-100 { + --tw-gradient-to: #dbeafe var(--tw-gradient-to-position); +} + +.compressx-v2-to-green-400 { + --tw-gradient-to: #4ade80 var(--tw-gradient-to-position); +} + +.compressx-v2-to-indigo-400 { + --tw-gradient-to: #818cf8 var(--tw-gradient-to-position); +} + +.compressx-v2-to-indigo-50 { + --tw-gradient-to: #eef2ff var(--tw-gradient-to-position); +} + +.compressx-v2-to-sky-50 { + --tw-gradient-to: #f0f9ff var(--tw-gradient-to-position); +} + +.compressx-v2-to-teal-400 { + --tw-gradient-to: #2dd4bf var(--tw-gradient-to-position); +} + +.compressx-v2-to-yellow-400 { + --tw-gradient-to: #facc15 var(--tw-gradient-to-position); +} + +.compressx-v2-object-contain { + -o-object-fit: contain; + object-fit: contain; +} + +.compressx-v2-object-cover { + -o-object-fit: cover; + object-fit: cover; +} + +.compressx-v2-p-1 { + padding: 0.25rem; +} + +.compressx-v2-p-10 { + padding: 2.5rem; +} + +.compressx-v2-p-2 { + padding: 0.5rem; +} + +.compressx-v2-p-3 { + padding: 0.75rem; +} + +.compressx-v2-p-4 { + padding: 1rem; +} + +.compressx-v2-p-5 { + padding: 1.25rem; +} + +.compressx-v2-p-6 { + padding: 1.5rem; +} + +.compressx-v2-p-8 { + padding: 2rem; +} + +.compressx-v2-p-12 { + padding: 3rem; +} + +.compressx-v2-px-1 { + padding-left: 0.25rem; + padding-right: 0.25rem; +} + +.compressx-v2-px-2 { + padding-left: 0.5rem; + padding-right: 0.5rem; +} + +.compressx-v2-px-2\.5 { + padding-left: 0.625rem; + padding-right: 0.625rem; +} + +.compressx-v2-px-3 { + padding-left: 0.75rem; + padding-right: 0.75rem; +} + +.compressx-v2-px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.compressx-v2-px-5 { + padding-left: 1.25rem; + padding-right: 1.25rem; +} + +.compressx-v2-px-6 { + padding-left: 1.5rem; + padding-right: 1.5rem; +} + +.compressx-v2-px-\[6px\] { + padding-left: 6px; + padding-right: 6px; +} + +.compressx-v2-py-0\.5 { + padding-top: 0.125rem; + padding-bottom: 0.125rem; +} + +.compressx-v2-py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.compressx-v2-py-1\.5 { + padding-top: 0.375rem; + padding-bottom: 0.375rem; +} + +.compressx-v2-py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.compressx-v2-py-2\.5 { + padding-top: 0.625rem; + padding-bottom: 0.625rem; +} + +.compressx-v2-py-3 { + padding-top: 0.75rem; + padding-bottom: 0.75rem; +} + +.compressx-v2-py-4 { + padding-top: 1rem; + padding-bottom: 1rem; +} + +.compressx-v2-py-6 { + padding-top: 1.5rem; + padding-bottom: 1.5rem; +} + +.compressx-v2-py-\[1px\] { + padding-top: 1px; + padding-bottom: 1px; +} + +.compressx-v2-pb-2 { + padding-bottom: 0.5rem; +} + +.compressx-v2-pb-3 { + padding-bottom: 0.75rem; +} + +.compressx-v2-pb-4 { + padding-bottom: 1rem; +} + +.compressx-v2-pl-2 { + padding-left: 0.5rem; +} + +.compressx-v2-pl-3 { + padding-left: 0.75rem; +} + +.compressx-v2-pl-4 { + padding-left: 1rem; +} + +.compressx-v2-pl-5 { + padding-left: 1.25rem; +} + +.compressx-v2-pl-6 { + padding-left: 1.5rem; +} + +.compressx-v2-pl-8 { + padding-left: 2rem; +} + +.compressx-v2-pr-3 { + padding-right: 0.75rem; +} + +.compressx-v2-pr-4 { + padding-right: 1rem; +} + +.compressx-v2-pt-1 { + padding-top: 0.25rem; +} + +.compressx-v2-pt-2 { + padding-top: 0.5rem; +} + +.compressx-v2-pt-3 { + padding-top: 0.75rem; +} + +.compressx-v2-pt-4 { + padding-top: 1rem; +} + +.compressx-v2-pb-0 { + padding-bottom: 0px; +} + +.compressx-v2-text-left { + text-align: left; +} + +.compressx-v2-text-center { + text-align: center; +} + +.compressx-v2-text-right { + text-align: right; +} + +.compressx-v2-font-mono { + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; +} + +.compressx-v2-text-2xl { + font-size: 1.5rem; + line-height: 2rem; +} + +.compressx-v2-text-3xl { + font-size: 1.875rem; + line-height: 2.25rem; +} + +.compressx-v2-text-4xl { + font-size: 2.25rem; + line-height: 2.5rem; +} + +.compressx-v2-text-6xl { + font-size: 3.75rem; + line-height: 1; +} + +.compressx-v2-text-\[10px\] { + font-size: 10px; +} + +.compressx-v2-text-\[11px\] { + font-size: 11px; +} + +.compressx-v2-text-\[12px\] { + font-size: 12px; +} + +.compressx-v2-text-base { + font-size: 1rem; + line-height: 1.5rem; +} + +.compressx-v2-text-lg { + font-size: 1.125rem; + line-height: 1.75rem; +} + +.compressx-v2-text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.compressx-v2-text-xl { + font-size: 1.25rem; + line-height: 1.75rem; +} + +.compressx-v2-text-xs { + font-size: 0.75rem; + line-height: 1rem; +} + +.compressx-v2-font-bold { + font-weight: 700; +} + +.compressx-v2-font-extrabold { + font-weight: 800; +} + +.compressx-v2-font-medium { + font-weight: 500; +} + +.compressx-v2-font-semibold { + font-weight: 600; +} + +.compressx-v2-leading-5 { + line-height: 1.25rem; +} + +.compressx-v2-leading-none { + line-height: 1; +} + +.compressx-v2-leading-normal { + line-height: 1.5; +} + +.compressx-v2-leading-relaxed { + line-height: 1.625; +} + +.compressx-v2-leading-snug { + line-height: 1.375; +} + +.compressx-v2-leading-tight { + line-height: 1.25; +} + +.compressx-v2-tracking-tight { + letter-spacing: -0.025em; +} + +.compressx-v2-tracking-wide { + letter-spacing: 0.025em; +} + +.compressx-v2-text-amber-600 { + --tw-text-opacity: 1; + color: rgb(217 119 6 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-black { + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-blue-500 { + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-blue-600 { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-blue-700 { + --tw-text-opacity: 1; + color: rgb(29 78 216 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-blue-800 { + --tw-text-opacity: 1; + color: rgb(30 64 175 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-cyan-600 { + --tw-text-opacity: 1; + color: rgb(8 145 178 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-emerald-300 { + --tw-text-opacity: 1; + color: rgb(110 231 183 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-emerald-500 { + --tw-text-opacity: 1; + color: rgb(16 185 129 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-emerald-600 { + --tw-text-opacity: 1; + color: rgb(5 150 105 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-emerald-700 { + --tw-text-opacity: 1; + color: rgb(4 120 87 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-300 { + --tw-text-opacity: 1; + color: rgb(209 213 219 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-800 { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-green-500 { + --tw-text-opacity: 1; + color: rgb(34 197 94 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-green-600 { + --tw-text-opacity: 1; + color: rgb(22 163 74 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-green-700 { + --tw-text-opacity: 1; + color: rgb(21 128 61 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-green-800 { + --tw-text-opacity: 1; + color: rgb(22 101 52 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-green-900 { + --tw-text-opacity: 1; + color: rgb(20 83 45 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-orange-500 { + --tw-text-opacity: 1; + color: rgb(249 115 22 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-orange-600 { + --tw-text-opacity: 1; + color: rgb(234 88 12 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-purple-600 { + --tw-text-opacity: 1; + color: rgb(147 51 234 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-red-500 { + --tw-text-opacity: 1; + color: rgb(239 68 68 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-red-600 { + --tw-text-opacity: 1; + color: rgb(220 38 38 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-red-700 { + --tw-text-opacity: 1; + color: rgb(185 28 28 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-red-800 { + --tw-text-opacity: 1; + color: rgb(153 27 27 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-sky-300 { + --tw-text-opacity: 1; + color: rgb(125 211 252 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-sky-600 { + --tw-text-opacity: 1; + color: rgb(2 132 199 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-slate-500 { + --tw-text-opacity: 1; + color: rgb(100 116 139 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-slate-600 { + --tw-text-opacity: 1; + color: rgb(71 85 105 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-teal-600 { + --tw-text-opacity: 1; + color: rgb(13 148 136 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-white { + --tw-text-opacity: 1; + color: rgb(255 255 255 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-yellow-500 { + --tw-text-opacity: 1; + color: rgb(234 179 8 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-yellow-600 { + --tw-text-opacity: 1; + color: rgb(202 138 4 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-yellow-700 { + --tw-text-opacity: 1; + color: rgb(161 98 7 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-yellow-800 { + --tw-text-opacity: 1; + color: rgb(133 77 14 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-yellow-900 { + --tw-text-opacity: 1; + color: rgb(113 63 18 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-slate-700 { + --tw-text-opacity: 1; + color: rgb(51 65 85 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-slate-900 { + --tw-text-opacity: 1; + color: rgb(15 23 42 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-slate-400 { + --tw-text-opacity: 1; + color: rgb(148 163 184 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-text-slate-800 { + --tw-text-opacity: 1; + color: rgb(30 41 59 / var(--tw-text-opacity, 1)); +} + +.compressx-v2-underline { + text-decoration-line: underline; +} + +.compressx-v2-accent-blue-500 { + accent-color: #3b82f6; +} + +.compressx-v2-shadow { + --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.compressx-v2-shadow-md { + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.compressx-v2-shadow-sm { + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.compressx-v2-shadow-xl { + --tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.compressx-v2-ring-1 { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.compressx-v2-ring-black\/10 { + --tw-ring-color: rgb(0 0 0 / 0.1); +} + +.compressx-v2-transition { + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.compressx-v2-transition-all { + transition-property: all; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.compressx-v2-transition-colors { + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.compressx-v2-transition-transform { + transition-property: transform; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.compressx-v2-duration-700 { + transition-duration: 700ms; +} + +.compressx-v2-duration-150 { + transition-duration: 150ms; +} + +.hover\:compressx-v2-translate-y-0\.5:hover { + --tw-translate-y: 0.125rem; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.hover\:compressx-v2-border:hover { + border-width: 1px; +} + +.hover\:compressx-v2-border-blue-500:hover { + --tw-border-opacity: 1; + border-color: rgb(59 130 246 / var(--tw-border-opacity, 1)); +} + +.hover\:compressx-v2-border-gray-300:hover { + --tw-border-opacity: 1; + border-color: rgb(209 213 219 / var(--tw-border-opacity, 1)); +} + +.hover\:compressx-v2-border-gray-400:hover { + --tw-border-opacity: 1; + border-color: rgb(156 163 175 / var(--tw-border-opacity, 1)); +} + +.hover\:compressx-v2-border-slate-300:hover { + --tw-border-opacity: 1; + border-color: rgb(203 213 225 / var(--tw-border-opacity, 1)); +} + +.hover\:compressx-v2-border-red-300:hover { + --tw-border-opacity: 1; + border-color: rgb(252 165 165 / var(--tw-border-opacity, 1)); +} + +.hover\:compressx-v2-bg-blue-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(219 234 254 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-blue-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(191 219 254 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-blue-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(239 246 255 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-blue-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-blue-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(29 78 216 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-300:hover { + --tw-bg-opacity: 1; + background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-400:hover { + --tw-bg-opacity: 1; + background-color: rgb(156 163 175 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-gray-800:hover { + --tw-bg-opacity: 1; + background-color: rgb(31 41 55 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-green-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-green-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(21 128 61 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-orange-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(234 88 12 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-orange-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(194 65 12 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-red-200:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 202 202 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-red-600:hover { + --tw-bg-opacity: 1; + background-color: rgb(220 38 38 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-red-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(185 28 28 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-slate-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(248 250 252 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-yellow-500:hover { + --tw-bg-opacity: 1; + background-color: rgb(234 179 8 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-white:hover { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-yellow-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 249 195 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-bg-red-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(254 242 242 / var(--tw-bg-opacity, 1)); +} + +.hover\:compressx-v2-text-black:hover { + --tw-text-opacity: 1; + color: rgb(0 0 0 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-blue-500:hover { + --tw-text-opacity: 1; + color: rgb(59 130 246 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-blue-600:hover { + --tw-text-opacity: 1; + color: rgb(37 99 235 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-blue-700:hover { + --tw-text-opacity: 1; + color: rgb(29 78 216 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-blue-800:hover { + --tw-text-opacity: 1; + color: rgb(30 64 175 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-gray-600:hover { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-green-600:hover { + --tw-text-opacity: 1; + color: rgb(22 163 74 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-green-800:hover { + --tw-text-opacity: 1; + color: rgb(22 101 52 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-red-400:hover { + --tw-text-opacity: 1; + color: rgb(248 113 113 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-red-500:hover { + --tw-text-opacity: 1; + color: rgb(239 68 68 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-red-700:hover { + --tw-text-opacity: 1; + color: rgb(185 28 28 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-slate-800:hover { + --tw-text-opacity: 1; + color: rgb(30 41 59 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-yellow-900:hover { + --tw-text-opacity: 1; + color: rgb(113 63 18 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-text-gray-800:hover { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity, 1)); +} + +.hover\:compressx-v2-underline:hover { + text-decoration-line: underline; +} + +.hover\:compressx-v2-opacity-90:hover { + opacity: 0.9; +} + +.hover\:compressx-v2-shadow:hover { + --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.hover\:compressx-v2-shadow-lg:hover { + --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.hover\:compressx-v2-shadow-md:hover { + --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.hover\:compressx-v2-shadow-sm:hover { + --tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); + --tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.focus\:compressx-v2-border-blue-500:focus { + --tw-border-opacity: 1; + border-color: rgb(59 130 246 / var(--tw-border-opacity, 1)); +} + +.focus\:compressx-v2-outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:compressx-v2-ring-1:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:compressx-v2-ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:compressx-v2-ring-gray-300:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(209 213 219 / var(--tw-ring-opacity, 1)); +} + +.focus\:compressx-v2-ring-gray-400:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(156 163 175 / var(--tw-ring-opacity, 1)); +} + +.focus\:compressx-v2-ring-sky-400:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(56 189 248 / var(--tw-ring-opacity, 1)); +} + +.focus\:compressx-v2-ring-green-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity, 1)); +} + +.focus\:compressx-v2-ring-yellow-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(234 179 8 / var(--tw-ring-opacity, 1)); +} + +.disabled\:compressx-v2-opacity-50:disabled { + opacity: 0.5; +} + +.compressx-v2-group[open] .group-open\:compressx-v2-rotate-180 { + --tw-rotate: 180deg; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.compressx-v2-group:focus-within .group-focus-within\:compressx-v2-block { + display: block; +} + +.compressx-v2-group:hover .group-hover\:compressx-v2-block { + display: block; +} + +@media (min-width: 640px) { + .sm\:compressx-v2-mt-0 { + margin-top: 0px; + } + + .sm\:compressx-v2-grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .sm\:compressx-v2-flex-row { + flex-direction: row; + } +} + +@media (min-width: 768px) { + .md\:compressx-v2-col-span-3 { + grid-column: span 3 / span 3; + } + + .md\:compressx-v2-col-span-7 { + grid-column: span 7 / span 7; + } + + .md\:compressx-v2-flex { + display: flex; + } + + .md\:compressx-v2-hidden { + display: none; + } + + .md\:compressx-v2-w-3\/4 { + width: 75%; + } + + .md\:compressx-v2-w-\[480px\] { + width: 480px; + } + + .md\:compressx-v2-w-auto { + width: auto; + } + + .md\:compressx-v2-grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .md\:compressx-v2-grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + + .md\:compressx-v2-grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); + } + + .md\:compressx-v2-grid-cols-5 { + grid-template-columns: repeat(5, minmax(0, 1fr)); + } + + .md\:compressx-v2-grid-cols-\[2fr\2c 1fr\] { + grid-template-columns: 2fr 1fr; + } + + .md\:compressx-v2-grid-cols-10 { + grid-template-columns: repeat(10, minmax(0, 1fr)); + } + + .md\:compressx-v2-flex-nowrap { + flex-wrap: nowrap; + } + + .md\:compressx-v2-justify-end { + justify-content: flex-end; + } + + .md\:compressx-v2-justify-center { + justify-content: center; + } +} + +@media (min-width: 1024px) { + .lg\:compressx-v2-col-span-2 { + grid-column: span 2 / span 2; + } + + .lg\:compressx-v2-grid-cols-2 { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .lg\:compressx-v2-grid-cols-3 { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } + + .lg\:compressx-v2-grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); + } + + .lg\:compressx-v2-flex-row { + flex-direction: row; + } +} + +@media (min-width: 1280px) { + .xl\:compressx-v2-grid-cols-4 { + grid-template-columns: repeat(4, minmax(0, 1fr)); + } + + .xl\:compressx-v2-grid-cols-6 { + grid-template-columns: repeat(6, minmax(0, 1fr)); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/css/twentytwenty/twentytwenty.css b/wp-content/plugins/compressx/includes/display_v2/css/twentytwenty/twentytwenty.css new file mode 100644 index 0000000..e42c889 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/css/twentytwenty/twentytwenty.css @@ -0,0 +1,206 @@ +.twentytwenty-horizontal .twentytwenty-handle:before, .twentytwenty-horizontal .twentytwenty-handle:after, .twentytwenty-vertical .twentytwenty-handle:before, .twentytwenty-vertical .twentytwenty-handle:after { + content: " "; + display: block; + background: white; + position: absolute; + z-index: 30; + -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-horizontal .twentytwenty-handle:before, .twentytwenty-horizontal .twentytwenty-handle:after { + width: 3px; + height: 9999px; + left: 50%; + margin-left: -1.5px; } + +.twentytwenty-vertical .twentytwenty-handle:before, .twentytwenty-vertical .twentytwenty-handle:after { + width: 9999px; + height: 3px; + top: 50%; + margin-top: -1.5px; } + +.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay { + position: absolute; + top: 0; + width: 100%; + height: 100%; } + +.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay { + -webkit-transition-duration: 0.5s; + -moz-transition-duration: 0.5s; + transition-duration: 0.5s; } + +.twentytwenty-before-label, .twentytwenty-after-label { + -webkit-transition-property: opacity; + -moz-transition-property: opacity; + transition-property: opacity; } + +.twentytwenty-before-label:before, .twentytwenty-after-label:before { + color: white; + font-size: 13px; + letter-spacing: 0.1em; } + +.twentytwenty-before-label:before, .twentytwenty-after-label:before { + position: absolute; + background: rgba(255, 255, 255, 0.2); + line-height: 38px; + padding: 0 20px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; } + +.twentytwenty-horizontal .twentytwenty-before-label:before, .twentytwenty-horizontal .twentytwenty-after-label:before { + top: 50%; + margin-top: -19px; } + +.twentytwenty-vertical .twentytwenty-before-label:before, .twentytwenty-vertical .twentytwenty-after-label:before { + left: 50%; + margin-left: -45px; + text-align: center; + width: 90px; } + +.twentytwenty-left-arrow, .twentytwenty-right-arrow, .twentytwenty-up-arrow, .twentytwenty-down-arrow { + width: 0; + height: 0; + border: 6px inset transparent; + position: absolute; } + +.twentytwenty-left-arrow, .twentytwenty-right-arrow { + top: 50%; + margin-top: -6px; } + +.twentytwenty-up-arrow, .twentytwenty-down-arrow { + left: 50%; + margin-left: -6px; } + +.twentytwenty-container { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + z-index: 0; + overflow: hidden; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; } + .twentytwenty-container img { + max-width: 100%; + position: absolute; + top: 0; + display: block; } + .twentytwenty-container.active .twentytwenty-overlay, .twentytwenty-container.active :hover.twentytwenty-overlay { + background: rgba(0, 0, 0, 0); } + .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-before-label, + .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-after-label, .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-before-label, + .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-after-label { + opacity: 0; } + .twentytwenty-container * { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; } + +.twentytwenty-before-label { + opacity: 0; } + .twentytwenty-before-label:before { + content: attr(data-content); } + +.twentytwenty-after-label { + opacity: 0; } + .twentytwenty-after-label:before { + content: attr(data-content); } + +.twentytwenty-horizontal .twentytwenty-before-label:before { + left: 10px; } + +.twentytwenty-horizontal .twentytwenty-after-label:before { + right: 10px; } + +.twentytwenty-vertical .twentytwenty-before-label:before { + top: 10px; } + +.twentytwenty-vertical .twentytwenty-after-label:before { + bottom: 10px; } + +.twentytwenty-overlay { + -webkit-transition-property: background; + -moz-transition-property: background; + transition-property: background; + background: rgba(0, 0, 0, 0); + z-index: 25; } + .twentytwenty-overlay:hover { + background: rgba(0, 0, 0, 0.5); } + .twentytwenty-overlay:hover .twentytwenty-after-label { + opacity: 1; } + .twentytwenty-overlay:hover .twentytwenty-before-label { + opacity: 1; } + +.twentytwenty-before { + z-index: 20; } + +.twentytwenty-after { + z-index: 10; } + +.twentytwenty-handle { + height: 38px; + width: 38px; + position: absolute; + left: 50%; + top: 50%; + margin-left: -22px; + margin-top: -22px; + border: 3px solid white; + -webkit-border-radius: 1000px; + -moz-border-radius: 1000px; + border-radius: 1000px; + -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + z-index: 40; + cursor: pointer; } + +.twentytwenty-horizontal .twentytwenty-handle:before { + bottom: 50%; + margin-bottom: 22px; + -webkit-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } +.twentytwenty-horizontal .twentytwenty-handle:after { + top: 50%; + margin-top: 22px; + -webkit-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-vertical .twentytwenty-handle:before { + left: 50%; + margin-left: 22px; + -webkit-box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } +.twentytwenty-vertical .twentytwenty-handle:after { + right: 50%; + margin-right: 22px; + -webkit-box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-left-arrow { + border-right: 6px solid white; + left: 50%; + margin-left: -17px; } + +.twentytwenty-right-arrow { + border-left: 6px solid white; + right: 50%; + margin-right: -17px; } + +.twentytwenty-up-arrow { + border-bottom: 6px solid white; + top: 50%; + margin-top: -17px; } + +.twentytwenty-down-arrow { + border-top: 6px solid white; + bottom: 50%; + margin-bottom: -17px; } diff --git a/wp-content/plugins/compressx/includes/display_v2/js/chart.umd.min.js b/wp-content/plugins/compressx/includes/display_v2/js/chart.umd.min.js new file mode 100644 index 0000000..008464f --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/chart.umd.min.js @@ -0,0 +1,14 @@ +/*! + * Chart.js v4.5.1 + * https://www.chartjs.org + * (c) 2025 Chart.js Contributors + * Released under the MIT License + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Chart=e()}(this,(function(){"use strict";var t=Object.freeze({__proto__:null,get Colors(){return Jo},get Decimation(){return ta},get Filler(){return ba},get Legend(){return Ma},get SubTitle(){return Pa},get Title(){return ka},get Tooltip(){return Na}});function e(){}const i=(()=>{let t=0;return()=>t++})();function s(t){return null==t}function n(t){if(Array.isArray&&Array.isArray(t))return!0;const e=Object.prototype.toString.call(t);return"[object"===e.slice(0,7)&&"Array]"===e.slice(-6)}function o(t){return null!==t&&"[object Object]"===Object.prototype.toString.call(t)}function a(t){return("number"==typeof t||t instanceof Number)&&isFinite(+t)}function r(t,e){return a(t)?t:e}function l(t,e){return void 0===t?e:t}const h=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100:+t/e,c=(t,e)=>"string"==typeof t&&t.endsWith("%")?parseFloat(t)/100*e:+t;function d(t,e,i){if(t&&"function"==typeof t.call)return t.apply(i,e)}function u(t,e,i,s){let a,r,l;if(n(t))if(r=t.length,s)for(a=r-1;a>=0;a--)e.call(i,t[a],a);else for(a=0;at,x:t=>t.x,y:t=>t.y};function v(t){const e=t.split("."),i=[];let s="";for(const t of e)s+=t,s.endsWith("\\")?s=s.slice(0,-1)+".":(i.push(s),s="");return i}function M(t,e){const i=y[e]||(y[e]=function(t){const e=v(t);return t=>{for(const i of e){if(""===i)break;t=t&&t[i]}return t}}(e));return i(t)}function w(t){return t.charAt(0).toUpperCase()+t.slice(1)}const k=t=>void 0!==t,S=t=>"function"==typeof t,P=(t,e)=>{if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0};function D(t){return"mouseup"===t.type||"click"===t.type||"contextmenu"===t.type}const C=Math.PI,O=2*C,A=O+C,T=Number.POSITIVE_INFINITY,L=C/180,E=C/2,R=C/4,I=2*C/3,z=Math.log10,F=Math.sign;function V(t,e,i){return Math.abs(t-e)t-e)).pop(),e}function N(t){return!function(t){return"symbol"==typeof t||"object"==typeof t&&null!==t&&!(Symbol.toPrimitive in t||"toString"in t||"valueOf"in t)}(t)&&!isNaN(parseFloat(t))&&isFinite(t)}function H(t,e){const i=Math.round(t);return i-e<=t&&i+e>=t}function j(t,e,i){let s,n,o;for(s=0,n=t.length;sl&&h=Math.min(e,i)-s&&t<=Math.max(e,i)+s}function et(t,e,i){i=i||(i=>t[i]1;)s=o+n>>1,i(s)?o=s:n=s;return{lo:o,hi:n}}const it=(t,e,i,s)=>et(t,i,s?s=>{const n=t[s][e];return nt[s][e]et(t,i,(s=>t[s][e]>=i));function nt(t,e,i){let s=0,n=t.length;for(;ss&&t[n-1]>i;)n--;return s>0||n{const i="_onData"+w(e),s=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value(...e){const n=s.apply(this,e);return t._chartjs.listeners.forEach((t=>{"function"==typeof t[i]&&t[i](...e)})),n}})})))}function rt(t,e){const i=t._chartjs;if(!i)return;const s=i.listeners,n=s.indexOf(e);-1!==n&&s.splice(n,1),s.length>0||(ot.forEach((e=>{delete t[e]})),delete t._chartjs)}function lt(t){const e=new Set(t);return e.size===t.length?t:Array.from(e)}const ht="undefined"==typeof window?function(t){return t()}:window.requestAnimationFrame;function ct(t,e){let i=[],s=!1;return function(...n){i=n,s||(s=!0,ht.call(window,(()=>{s=!1,t.apply(e,i)})))}}function dt(t,e){let i;return function(...s){return e?(clearTimeout(i),i=setTimeout(t,e,s)):t.apply(this,s),e}}const ut=t=>"start"===t?"left":"end"===t?"right":"center",ft=(t,e,i)=>"start"===t?e:"end"===t?i:(e+i)/2,gt=(t,e,i,s)=>t===(s?"left":"right")?i:"center"===t?(e+i)/2:e;function pt(t,e,i){const n=e.length;let o=0,a=n;if(t._sorted){const{iScale:r,vScale:l,_parsed:h}=t,c=t.dataset&&t.dataset.options?t.dataset.options.spanGaps:null,d=r.axis,{min:u,max:f,minDefined:g,maxDefined:p}=r.getUserBounds();if(g){if(o=Math.min(it(h,d,u).lo,i?n:it(e,d,r.getPixelForValue(u)).lo),c){const t=h.slice(0,o+1).reverse().findIndex((t=>!s(t[l.axis])));o-=Math.max(0,t)}o=Z(o,0,n-1)}if(p){let t=Math.max(it(h,r.axis,f,!0).hi+1,i?0:it(e,d,r.getPixelForValue(f),!0).hi+1);if(c){const e=h.slice(t-1).findIndex((t=>!s(t[l.axis])));t+=Math.max(0,e)}a=Z(t,o,n)-o}else a=n-o}return{start:o,count:a}}function mt(t){const{xScale:e,yScale:i,_scaleRanges:s}=t,n={xmin:e.min,xmax:e.max,ymin:i.min,ymax:i.max};if(!s)return t._scaleRanges=n,!0;const o=s.xmin!==e.min||s.xmax!==e.max||s.ymin!==i.min||s.ymax!==i.max;return Object.assign(s,n),o}class xt{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,e,i,s){const n=e.listeners[s],o=e.duration;n.forEach((s=>s({chart:t,initial:e.initial,numSteps:o,currentStep:Math.min(i-e.start,o)})))}_refresh(){this._request||(this._running=!0,this._request=ht.call(window,(()=>{this._update(),this._request=null,this._running&&this._refresh()})))}_update(t=Date.now()){let e=0;this._charts.forEach(((i,s)=>{if(!i.running||!i.items.length)return;const n=i.items;let o,a=n.length-1,r=!1;for(;a>=0;--a)o=n[a],o._active?(o._total>i.duration&&(i.duration=o._total),o.tick(t),r=!0):(n[a]=n[n.length-1],n.pop());r&&(s.draw(),this._notify(s,i,t,"progress")),n.length||(i.running=!1,this._notify(s,i,t,"complete"),i.initial=!1),e+=n.length})),this._lastDate=t,0===e&&(this._running=!1)}_getAnims(t){const e=this._charts;let i=e.get(t);return i||(i={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},e.set(t,i)),i}listen(t,e,i){this._getAnims(t).listeners[e].push(i)}add(t,e){e&&e.length&&this._getAnims(t).items.push(...e)}has(t){return this._getAnims(t).items.length>0}start(t){const e=this._charts.get(t);e&&(e.running=!0,e.start=Date.now(),e.duration=e.items.reduce(((t,e)=>Math.max(t,e._duration)),0),this._refresh())}running(t){if(!this._running)return!1;const e=this._charts.get(t);return!!(e&&e.running&&e.items.length)}stop(t){const e=this._charts.get(t);if(!e||!e.items.length)return;const i=e.items;let s=i.length-1;for(;s>=0;--s)i[s].cancel();e.items=[],this._notify(t,e,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var bt=new xt; +/*! + * @kurkle/color v0.3.2 + * https://github.com/kurkle/color#readme + * (c) 2023 Jukka Kurkela + * Released under the MIT License + */function _t(t){return t+.5|0}const yt=(t,e,i)=>Math.max(Math.min(t,i),e);function vt(t){return yt(_t(2.55*t),0,255)}function Mt(t){return yt(_t(255*t),0,255)}function wt(t){return yt(_t(t/2.55)/100,0,1)}function kt(t){return yt(_t(100*t),0,100)}const St={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15,a:10,b:11,c:12,d:13,e:14,f:15},Pt=[..."0123456789ABCDEF"],Dt=t=>Pt[15&t],Ct=t=>Pt[(240&t)>>4]+Pt[15&t],Ot=t=>(240&t)>>4==(15&t);function At(t){var e=(t=>Ot(t.r)&&Ot(t.g)&&Ot(t.b)&&Ot(t.a))(t)?Dt:Ct;return t?"#"+e(t.r)+e(t.g)+e(t.b)+((t,e)=>t<255?e(t):"")(t.a,e):void 0}const Tt=/^(hsla?|hwb|hsv)\(\s*([-+.e\d]+)(?:deg)?[\s,]+([-+.e\d]+)%[\s,]+([-+.e\d]+)%(?:[\s,]+([-+.e\d]+)(%)?)?\s*\)$/;function Lt(t,e,i){const s=e*Math.min(i,1-i),n=(e,n=(e+t/30)%12)=>i-s*Math.max(Math.min(n-3,9-n,1),-1);return[n(0),n(8),n(4)]}function Et(t,e,i){const s=(s,n=(s+t/60)%6)=>i-i*e*Math.max(Math.min(n,4-n,1),0);return[s(5),s(3),s(1)]}function Rt(t,e,i){const s=Lt(t,1,.5);let n;for(e+i>1&&(n=1/(e+i),e*=n,i*=n),n=0;n<3;n++)s[n]*=1-e-i,s[n]+=e;return s}function It(t){const e=t.r/255,i=t.g/255,s=t.b/255,n=Math.max(e,i,s),o=Math.min(e,i,s),a=(n+o)/2;let r,l,h;return n!==o&&(h=n-o,l=a>.5?h/(2-n-o):h/(n+o),r=function(t,e,i,s,n){return t===n?(e-i)/s+(e>16&255,o>>8&255,255&o]}return t}(),Ht.transparent=[0,0,0,0]);const e=Ht[t.toLowerCase()];return e&&{r:e[0],g:e[1],b:e[2],a:4===e.length?e[3]:255}}const $t=/^rgba?\(\s*([-+.\d]+)(%)?[\s,]+([-+.e\d]+)(%)?[\s,]+([-+.e\d]+)(%)?(?:[\s,/]+([-+.e\d]+)(%)?)?\s*\)$/;const Yt=t=>t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,Ut=t=>t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4);function Xt(t,e,i){if(t){let s=It(t);s[e]=Math.max(0,Math.min(s[e]+s[e]*i,0===e?360:1)),s=Ft(s),t.r=s[0],t.g=s[1],t.b=s[2]}}function qt(t,e){return t?Object.assign(e||{},t):t}function Kt(t){var e={r:0,g:0,b:0,a:255};return Array.isArray(t)?t.length>=3&&(e={r:t[0],g:t[1],b:t[2],a:255},t.length>3&&(e.a=Mt(t[3]))):(e=qt(t,{r:0,g:0,b:0,a:1})).a=Mt(e.a),e}function Gt(t){return"r"===t.charAt(0)?function(t){const e=$t.exec(t);let i,s,n,o=255;if(e){if(e[7]!==i){const t=+e[7];o=e[8]?vt(t):yt(255*t,0,255)}return i=+e[1],s=+e[3],n=+e[5],i=255&(e[2]?vt(i):yt(i,0,255)),s=255&(e[4]?vt(s):yt(s,0,255)),n=255&(e[6]?vt(n):yt(n,0,255)),{r:i,g:s,b:n,a:o}}}(t):Bt(t)}class Jt{constructor(t){if(t instanceof Jt)return t;const e=typeof t;let i;var s,n,o;"object"===e?i=Kt(t):"string"===e&&(o=(s=t).length,"#"===s[0]&&(4===o||5===o?n={r:255&17*St[s[1]],g:255&17*St[s[2]],b:255&17*St[s[3]],a:5===o?17*St[s[4]]:255}:7!==o&&9!==o||(n={r:St[s[1]]<<4|St[s[2]],g:St[s[3]]<<4|St[s[4]],b:St[s[5]]<<4|St[s[6]],a:9===o?St[s[7]]<<4|St[s[8]]:255})),i=n||jt(t)||Gt(t)),this._rgb=i,this._valid=!!i}get valid(){return this._valid}get rgb(){var t=qt(this._rgb);return t&&(t.a=wt(t.a)),t}set rgb(t){this._rgb=Kt(t)}rgbString(){return this._valid?(t=this._rgb)&&(t.a<255?`rgba(${t.r}, ${t.g}, ${t.b}, ${wt(t.a)})`:`rgb(${t.r}, ${t.g}, ${t.b})`):void 0;var t}hexString(){return this._valid?At(this._rgb):void 0}hslString(){return this._valid?function(t){if(!t)return;const e=It(t),i=e[0],s=kt(e[1]),n=kt(e[2]);return t.a<255?`hsla(${i}, ${s}%, ${n}%, ${wt(t.a)})`:`hsl(${i}, ${s}%, ${n}%)`}(this._rgb):void 0}mix(t,e){if(t){const i=this.rgb,s=t.rgb;let n;const o=e===n?.5:e,a=2*o-1,r=i.a-s.a,l=((a*r==-1?a:(a+r)/(1+a*r))+1)/2;n=1-l,i.r=255&l*i.r+n*s.r+.5,i.g=255&l*i.g+n*s.g+.5,i.b=255&l*i.b+n*s.b+.5,i.a=o*i.a+(1-o)*s.a,this.rgb=i}return this}interpolate(t,e){return t&&(this._rgb=function(t,e,i){const s=Ut(wt(t.r)),n=Ut(wt(t.g)),o=Ut(wt(t.b));return{r:Mt(Yt(s+i*(Ut(wt(e.r))-s))),g:Mt(Yt(n+i*(Ut(wt(e.g))-n))),b:Mt(Yt(o+i*(Ut(wt(e.b))-o))),a:t.a+i*(e.a-t.a)}}(this._rgb,t._rgb,e)),this}clone(){return new Jt(this.rgb)}alpha(t){return this._rgb.a=Mt(t),this}clearer(t){return this._rgb.a*=1-t,this}greyscale(){const t=this._rgb,e=_t(.3*t.r+.59*t.g+.11*t.b);return t.r=t.g=t.b=e,this}opaquer(t){return this._rgb.a*=1+t,this}negate(){const t=this._rgb;return t.r=255-t.r,t.g=255-t.g,t.b=255-t.b,this}lighten(t){return Xt(this._rgb,2,t),this}darken(t){return Xt(this._rgb,2,-t),this}saturate(t){return Xt(this._rgb,1,t),this}desaturate(t){return Xt(this._rgb,1,-t),this}rotate(t){return function(t,e){var i=It(t);i[0]=Vt(i[0]+e),i=Ft(i),t.r=i[0],t.g=i[1],t.b=i[2]}(this._rgb,t),this}}function Zt(t){if(t&&"object"==typeof t){const e=t.toString();return"[object CanvasPattern]"===e||"[object CanvasGradient]"===e}return!1}function Qt(t){return Zt(t)?t:new Jt(t)}function te(t){return Zt(t)?t:new Jt(t).saturate(.5).darken(.1).hexString()}const ee=["x","y","borderWidth","radius","tension"],ie=["color","borderColor","backgroundColor"];const se=new Map;function ne(t,e,i){return function(t,e){e=e||{};const i=t+JSON.stringify(e);let s=se.get(i);return s||(s=new Intl.NumberFormat(t,e),se.set(i,s)),s}(e,i).format(t)}const oe={values:t=>n(t)?t:""+t,numeric(t,e,i){if(0===t)return"0";const s=this.chart.options.locale;let n,o=t;if(i.length>1){const e=Math.max(Math.abs(i[0].value),Math.abs(i[i.length-1].value));(e<1e-4||e>1e15)&&(n="scientific"),o=function(t,e){let i=e.length>3?e[2].value-e[1].value:e[1].value-e[0].value;Math.abs(i)>=1&&t!==Math.floor(t)&&(i=t-Math.floor(t));return i}(t,i)}const a=z(Math.abs(o)),r=isNaN(a)?1:Math.max(Math.min(-1*Math.floor(a),20),0),l={notation:n,minimumFractionDigits:r,maximumFractionDigits:r};return Object.assign(l,this.options.ticks.format),ne(t,s,l)},logarithmic(t,e,i){if(0===t)return"0";const s=i[e].significand||t/Math.pow(10,Math.floor(z(t)));return[1,2,3,5,10,15].includes(s)||e>.8*i.length?oe.numeric.call(this,t,e,i):""}};var ae={formatters:oe};const re=Object.create(null),le=Object.create(null);function he(t,e){if(!e)return t;const i=e.split(".");for(let e=0,s=i.length;et.chart.platform.getDevicePixelRatio(),this.elements={},this.events=["mousemove","mouseout","click","touchstart","touchmove"],this.font={family:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",size:12,style:"normal",lineHeight:1.2,weight:null},this.hover={},this.hoverBackgroundColor=(t,e)=>te(e.backgroundColor),this.hoverBorderColor=(t,e)=>te(e.borderColor),this.hoverColor=(t,e)=>te(e.color),this.indexAxis="x",this.interaction={mode:"nearest",intersect:!0,includeInvisible:!1},this.maintainAspectRatio=!0,this.onHover=null,this.onClick=null,this.parsing=!0,this.plugins={},this.responsive=!0,this.scale=void 0,this.scales={},this.showLine=!0,this.drawActiveElementsOnTop=!0,this.describe(t),this.apply(e)}set(t,e){return ce(this,t,e)}get(t){return he(this,t)}describe(t,e){return ce(le,t,e)}override(t,e){return ce(re,t,e)}route(t,e,i,s){const n=he(this,t),a=he(this,i),r="_"+e;Object.defineProperties(n,{[r]:{value:n[e],writable:!0},[e]:{enumerable:!0,get(){const t=this[r],e=a[s];return o(t)?Object.assign({},e,t):l(t,e)},set(t){this[r]=t}}})}apply(t){t.forEach((t=>t(this)))}}var ue=new de({_scriptable:t=>!t.startsWith("on"),_indexable:t=>"events"!==t,hover:{_fallback:"interaction"},interaction:{_scriptable:!1,_indexable:!1}},[function(t){t.set("animation",{delay:void 0,duration:1e3,easing:"easeOutQuart",fn:void 0,from:void 0,loop:void 0,to:void 0,type:void 0}),t.describe("animation",{_fallback:!1,_indexable:!1,_scriptable:t=>"onProgress"!==t&&"onComplete"!==t&&"fn"!==t}),t.set("animations",{colors:{type:"color",properties:ie},numbers:{type:"number",properties:ee}}),t.describe("animations",{_fallback:"animation"}),t.set("transitions",{active:{animation:{duration:400}},resize:{animation:{duration:0}},show:{animations:{colors:{from:"transparent"},visible:{type:"boolean",duration:0}}},hide:{animations:{colors:{to:"transparent"},visible:{type:"boolean",easing:"linear",fn:t=>0|t}}}})},function(t){t.set("layout",{autoPadding:!0,padding:{top:0,right:0,bottom:0,left:0}})},function(t){t.set("scale",{display:!0,offset:!1,reverse:!1,beginAtZero:!1,bounds:"ticks",clip:!0,grace:0,grid:{display:!0,lineWidth:1,drawOnChartArea:!0,drawTicks:!0,tickLength:8,tickWidth:(t,e)=>e.lineWidth,tickColor:(t,e)=>e.color,offset:!1},border:{display:!0,dash:[],dashOffset:0,width:1},title:{display:!1,text:"",padding:{top:4,bottom:4}},ticks:{minRotation:0,maxRotation:50,mirror:!1,textStrokeWidth:0,textStrokeColor:"",padding:3,display:!0,autoSkip:!0,autoSkipPadding:3,labelOffset:0,callback:ae.formatters.values,minor:{},major:{},align:"center",crossAlign:"near",showLabelBackdrop:!1,backdropColor:"rgba(255, 255, 255, 0.75)",backdropPadding:2}}),t.route("scale.ticks","color","","color"),t.route("scale.grid","color","","borderColor"),t.route("scale.border","color","","borderColor"),t.route("scale.title","color","","color"),t.describe("scale",{_fallback:!1,_scriptable:t=>!t.startsWith("before")&&!t.startsWith("after")&&"callback"!==t&&"parser"!==t,_indexable:t=>"borderDash"!==t&&"tickBorderDash"!==t&&"dash"!==t}),t.describe("scales",{_fallback:"scale"}),t.describe("scale.ticks",{_scriptable:t=>"backdropPadding"!==t&&"callback"!==t,_indexable:t=>"backdropPadding"!==t})}]);function fe(){return"undefined"!=typeof window&&"undefined"!=typeof document}function ge(t){let e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e}function pe(t,e,i){let s;return"string"==typeof t?(s=parseInt(t,10),-1!==t.indexOf("%")&&(s=s/100*e.parentNode[i])):s=t,s}const me=t=>t.ownerDocument.defaultView.getComputedStyle(t,null);function xe(t,e){return me(t).getPropertyValue(e)}const be=["top","right","bottom","left"];function _e(t,e,i){const s={};i=i?"-"+i:"";for(let n=0;n<4;n++){const o=be[n];s[o]=parseFloat(t[e+"-"+o+i])||0}return s.width=s.left+s.right,s.height=s.top+s.bottom,s}const ye=(t,e,i)=>(t>0||e>0)&&(!i||!i.shadowRoot);function ve(t,e){if("native"in t)return t;const{canvas:i,currentDevicePixelRatio:s}=e,n=me(i),o="border-box"===n.boxSizing,a=_e(n,"padding"),r=_e(n,"border","width"),{x:l,y:h,box:c}=function(t,e){const i=t.touches,s=i&&i.length?i[0]:t,{offsetX:n,offsetY:o}=s;let a,r,l=!1;if(ye(n,o,t.target))a=n,r=o;else{const t=e.getBoundingClientRect();a=s.clientX-t.left,r=s.clientY-t.top,l=!0}return{x:a,y:r,box:l}}(t,i),d=a.left+(c&&r.left),u=a.top+(c&&r.top);let{width:f,height:g}=e;return o&&(f-=a.width+r.width,g-=a.height+r.height),{x:Math.round((l-d)/f*i.width/s),y:Math.round((h-u)/g*i.height/s)}}const Me=t=>Math.round(10*t)/10;function we(t,e,i,s){const n=me(t),o=_e(n,"margin"),a=pe(n.maxWidth,t,"clientWidth")||T,r=pe(n.maxHeight,t,"clientHeight")||T,l=function(t,e,i){let s,n;if(void 0===e||void 0===i){const o=t&&ge(t);if(o){const t=o.getBoundingClientRect(),a=me(o),r=_e(a,"border","width"),l=_e(a,"padding");e=t.width-l.width-r.width,i=t.height-l.height-r.height,s=pe(a.maxWidth,o,"clientWidth"),n=pe(a.maxHeight,o,"clientHeight")}else e=t.clientWidth,i=t.clientHeight}return{width:e,height:i,maxWidth:s||T,maxHeight:n||T}}(t,e,i);let{width:h,height:c}=l;if("content-box"===n.boxSizing){const t=_e(n,"border","width"),e=_e(n,"padding");h-=e.width+t.width,c-=e.height+t.height}h=Math.max(0,h-o.width),c=Math.max(0,s?h/s:c-o.height),h=Me(Math.min(h,a,l.maxWidth)),c=Me(Math.min(c,r,l.maxHeight)),h&&!c&&(c=Me(h/2));return(void 0!==e||void 0!==i)&&s&&l.height&&c>l.height&&(c=l.height,h=Me(Math.floor(c*s))),{width:h,height:c}}function ke(t,e,i){const s=e||1,n=Me(t.height*s),o=Me(t.width*s);t.height=Me(t.height),t.width=Me(t.width);const a=t.canvas;return a.style&&(i||!a.style.height&&!a.style.width)&&(a.style.height=`${t.height}px`,a.style.width=`${t.width}px`),(t.currentDevicePixelRatio!==s||a.height!==n||a.width!==o)&&(t.currentDevicePixelRatio=s,a.height=n,a.width=o,t.ctx.setTransform(s,0,0,s,0,0),!0)}const Se=function(){let t=!1;try{const e={get passive(){return t=!0,!1}};fe()&&(window.addEventListener("test",null,e),window.removeEventListener("test",null,e))}catch(t){}return t}();function Pe(t,e){const i=xe(t,e),s=i&&i.match(/^(\d+)(\.\d+)?px$/);return s?+s[1]:void 0}function De(t){return!t||s(t.size)||s(t.family)?null:(t.style?t.style+" ":"")+(t.weight?t.weight+" ":"")+t.size+"px "+t.family}function Ce(t,e,i,s,n){let o=e[n];return o||(o=e[n]=t.measureText(n).width,i.push(n)),o>s&&(s=o),s}function Oe(t,e,i,s){let o=(s=s||{}).data=s.data||{},a=s.garbageCollect=s.garbageCollect||[];s.font!==e&&(o=s.data={},a=s.garbageCollect=[],s.font=e),t.save(),t.font=e;let r=0;const l=i.length;let h,c,d,u,f;for(h=0;hi.length){for(h=0;h0&&t.stroke()}}function Re(t,e,i){return i=i||.5,!e||t&&t.x>e.left-i&&t.xe.top-i&&t.y0&&""!==r.strokeColor;let c,d;for(t.save(),t.font=a.string,function(t,e){e.translation&&t.translate(e.translation[0],e.translation[1]),s(e.rotation)||t.rotate(e.rotation),e.color&&(t.fillStyle=e.color),e.textAlign&&(t.textAlign=e.textAlign),e.textBaseline&&(t.textBaseline=e.textBaseline)}(t,r),c=0;ct[0])){const o=i||t;void 0===s&&(s=ti("_fallback",t));const a={[Symbol.toStringTag]:"Object",_cacheable:!0,_scopes:t,_rootScopes:o,_fallback:s,_getTarget:n,override:i=>je([i,...t],e,o,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete e._keys,delete t[0][i],!0),get:(i,s)=>qe(i,s,(()=>function(t,e,i,s){let n;for(const o of e)if(n=ti(Ue(o,t),i),void 0!==n)return Xe(t,n)?Ze(i,s,t,n):n}(s,e,t,i))),getOwnPropertyDescriptor:(t,e)=>Reflect.getOwnPropertyDescriptor(t._scopes[0],e),getPrototypeOf:()=>Reflect.getPrototypeOf(t[0]),has:(t,e)=>ei(t).includes(e),ownKeys:t=>ei(t),set(t,e,i){const s=t._storage||(t._storage=n());return t[e]=s[e]=i,delete t._keys,!0}})}function $e(t,e,i,s){const a={_cacheable:!1,_proxy:t,_context:e,_subProxy:i,_stack:new Set,_descriptors:Ye(t,s),setContext:e=>$e(t,e,i,s),override:n=>$e(t.override(n),e,i,s)};return new Proxy(a,{deleteProperty:(e,i)=>(delete e[i],delete t[i],!0),get:(t,e,i)=>qe(t,e,(()=>function(t,e,i){const{_proxy:s,_context:a,_subProxy:r,_descriptors:l}=t;let h=s[e];S(h)&&l.isScriptable(e)&&(h=function(t,e,i,s){const{_proxy:n,_context:o,_subProxy:a,_stack:r}=i;if(r.has(t))throw new Error("Recursion detected: "+Array.from(r).join("->")+"->"+t);r.add(t);let l=e(o,a||s);r.delete(t),Xe(t,l)&&(l=Ze(n._scopes,n,t,l));return l}(e,h,t,i));n(h)&&h.length&&(h=function(t,e,i,s){const{_proxy:n,_context:a,_subProxy:r,_descriptors:l}=i;if(void 0!==a.index&&s(t))return e[a.index%e.length];if(o(e[0])){const i=e,s=n._scopes.filter((t=>t!==i));e=[];for(const o of i){const i=Ze(s,n,t,o);e.push($e(i,a,r&&r[t],l))}}return e}(e,h,t,l.isIndexable));Xe(e,h)&&(h=$e(h,a,r&&r[e],l));return h}(t,e,i))),getOwnPropertyDescriptor:(e,i)=>e._descriptors.allKeys?Reflect.has(t,i)?{enumerable:!0,configurable:!0}:void 0:Reflect.getOwnPropertyDescriptor(t,i),getPrototypeOf:()=>Reflect.getPrototypeOf(t),has:(e,i)=>Reflect.has(t,i),ownKeys:()=>Reflect.ownKeys(t),set:(e,i,s)=>(t[i]=s,delete e[i],!0)})}function Ye(t,e={scriptable:!0,indexable:!0}){const{_scriptable:i=e.scriptable,_indexable:s=e.indexable,_allKeys:n=e.allKeys}=t;return{allKeys:n,scriptable:i,indexable:s,isScriptable:S(i)?i:()=>i,isIndexable:S(s)?s:()=>s}}const Ue=(t,e)=>t?t+w(e):e,Xe=(t,e)=>o(e)&&"adapters"!==t&&(null===Object.getPrototypeOf(e)||e.constructor===Object);function qe(t,e,i){if(Object.prototype.hasOwnProperty.call(t,e)||"constructor"===e)return t[e];const s=i();return t[e]=s,s}function Ke(t,e,i){return S(t)?t(e,i):t}const Ge=(t,e)=>!0===t?e:"string"==typeof t?M(e,t):void 0;function Je(t,e,i,s,n){for(const o of e){const e=Ge(i,o);if(e){t.add(e);const o=Ke(e._fallback,i,n);if(void 0!==o&&o!==i&&o!==s)return o}else if(!1===e&&void 0!==s&&i!==s)return null}return!1}function Ze(t,e,i,s){const a=e._rootScopes,r=Ke(e._fallback,i,s),l=[...t,...a],h=new Set;h.add(s);let c=Qe(h,l,i,r||i,s);return null!==c&&((void 0===r||r===i||(c=Qe(h,l,r,c,s),null!==c))&&je(Array.from(h),[""],a,r,(()=>function(t,e,i){const s=t._getTarget();e in s||(s[e]={});const a=s[e];if(n(a)&&o(i))return i;return a||{}}(e,i,s))))}function Qe(t,e,i,s,n){for(;i;)i=Je(t,e,i,s,n);return i}function ti(t,e){for(const i of e){if(!i)continue;const e=i[t];if(void 0!==e)return e}}function ei(t){let e=t._keys;return e||(e=t._keys=function(t){const e=new Set;for(const i of t)for(const t of Object.keys(i).filter((t=>!t.startsWith("_"))))e.add(t);return Array.from(e)}(t._scopes)),e}function ii(t,e,i,s){const{iScale:n}=t,{key:o="r"}=this._parsing,a=new Array(s);let r,l,h,c;for(r=0,l=s;re"x"===t?"y":"x";function ai(t,e,i,s){const n=t.skip?e:t,o=e,a=i.skip?e:i,r=q(o,n),l=q(a,o);let h=r/(r+l),c=l/(r+l);h=isNaN(h)?0:h,c=isNaN(c)?0:c;const d=s*h,u=s*c;return{previous:{x:o.x-d*(a.x-n.x),y:o.y-d*(a.y-n.y)},next:{x:o.x+u*(a.x-n.x),y:o.y+u*(a.y-n.y)}}}function ri(t,e="x"){const i=oi(e),s=t.length,n=Array(s).fill(0),o=Array(s);let a,r,l,h=ni(t,0);for(a=0;a!t.skip))),"monotone"===e.cubicInterpolationMode)ri(t,n);else{let i=s?t[t.length-1]:t[0];for(o=0,a=t.length;o0===t||1===t,di=(t,e,i)=>-Math.pow(2,10*(t-=1))*Math.sin((t-e)*O/i),ui=(t,e,i)=>Math.pow(2,-10*t)*Math.sin((t-e)*O/i)+1,fi={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>-t*(t-2),easeInOutQuad:t=>(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1),easeInCubic:t=>t*t*t,easeOutCubic:t=>(t-=1)*t*t+1,easeInOutCubic:t=>(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2),easeInQuart:t=>t*t*t*t,easeOutQuart:t=>-((t-=1)*t*t*t-1),easeInOutQuart:t=>(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2),easeInQuint:t=>t*t*t*t*t,easeOutQuint:t=>(t-=1)*t*t*t*t+1,easeInOutQuint:t=>(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2),easeInSine:t=>1-Math.cos(t*E),easeOutSine:t=>Math.sin(t*E),easeInOutSine:t=>-.5*(Math.cos(C*t)-1),easeInExpo:t=>0===t?0:Math.pow(2,10*(t-1)),easeOutExpo:t=>1===t?1:1-Math.pow(2,-10*t),easeInOutExpo:t=>ci(t)?t:t<.5?.5*Math.pow(2,10*(2*t-1)):.5*(2-Math.pow(2,-10*(2*t-1))),easeInCirc:t=>t>=1?t:-(Math.sqrt(1-t*t)-1),easeOutCirc:t=>Math.sqrt(1-(t-=1)*t),easeInOutCirc:t=>(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1),easeInElastic:t=>ci(t)?t:di(t,.075,.3),easeOutElastic:t=>ci(t)?t:ui(t,.075,.3),easeInOutElastic(t){const e=.1125;return ci(t)?t:t<.5?.5*di(2*t,e,.45):.5+.5*ui(2*t-1,e,.45)},easeInBack(t){const e=1.70158;return t*t*((e+1)*t-e)},easeOutBack(t){const e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack(t){let e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:t=>1-fi.easeOutBounce(1-t),easeOutBounce(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375},easeInOutBounce:t=>t<.5?.5*fi.easeInBounce(2*t):.5*fi.easeOutBounce(2*t-1)+.5};function gi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:t.y+i*(e.y-t.y)}}function pi(t,e,i,s){return{x:t.x+i*(e.x-t.x),y:"middle"===s?i<.5?t.y:e.y:"after"===s?i<1?t.y:e.y:i>0?e.y:t.y}}function mi(t,e,i,s){const n={x:t.cp2x,y:t.cp2y},o={x:e.cp1x,y:e.cp1y},a=gi(t,n,i),r=gi(n,o,i),l=gi(o,e,i),h=gi(a,r,i),c=gi(r,l,i);return gi(h,c,i)}const xi=/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/,bi=/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/;function _i(t,e){const i=(""+t).match(xi);if(!i||"normal"===i[1])return 1.2*e;switch(t=+i[2],i[3]){case"px":return t;case"%":t/=100}return e*t}const yi=t=>+t||0;function vi(t,e){const i={},s=o(e),n=s?Object.keys(e):e,a=o(t)?s?i=>l(t[i],t[e[i]]):e=>t[e]:()=>t;for(const t of n)i[t]=yi(a(t));return i}function Mi(t){return vi(t,{top:"y",right:"x",bottom:"y",left:"x"})}function wi(t){return vi(t,["topLeft","topRight","bottomLeft","bottomRight"])}function ki(t){const e=Mi(t);return e.width=e.left+e.right,e.height=e.top+e.bottom,e}function Si(t,e){t=t||{},e=e||ue.font;let i=l(t.size,e.size);"string"==typeof i&&(i=parseInt(i,10));let s=l(t.style,e.style);s&&!(""+s).match(bi)&&(console.warn('Invalid font style specified: "'+s+'"'),s=void 0);const n={family:l(t.family,e.family),lineHeight:_i(l(t.lineHeight,e.lineHeight),i),size:i,style:s,weight:l(t.weight,e.weight),string:""};return n.string=De(n),n}function Pi(t,e,i,s){let o,a,r,l=!0;for(o=0,a=t.length;oi&&0===t?0:t+e;return{min:a(s,-Math.abs(o)),max:a(n,o)}}function Ci(t,e){return Object.assign(Object.create(t),e)}function Oi(t,e,i){return t?function(t,e){return{x:i=>t+t+e-i,setWidth(t){e=t},textAlign:t=>"center"===t?t:"right"===t?"left":"right",xPlus:(t,e)=>t-e,leftForLtr:(t,e)=>t-e}}(e,i):{x:t=>t,setWidth(t){},textAlign:t=>t,xPlus:(t,e)=>t+e,leftForLtr:(t,e)=>t}}function Ai(t,e){let i,s;"ltr"!==e&&"rtl"!==e||(i=t.canvas.style,s=[i.getPropertyValue("direction"),i.getPropertyPriority("direction")],i.setProperty("direction",e,"important"),t.prevTextDirection=s)}function Ti(t,e){void 0!==e&&(delete t.prevTextDirection,t.canvas.style.setProperty("direction",e[0],e[1]))}function Li(t){return"angle"===t?{between:J,compare:K,normalize:G}:{between:tt,compare:(t,e)=>t-e,normalize:t=>t}}function Ei({start:t,end:e,count:i,loop:s,style:n}){return{start:t%i,end:e%i,loop:s&&(e-t+1)%i==0,style:n}}function Ri(t,e,i){if(!i)return[t];const{property:s,start:n,end:o}=i,a=e.length,{compare:r,between:l,normalize:h}=Li(s),{start:c,end:d,loop:u,style:f}=function(t,e,i){const{property:s,start:n,end:o}=i,{between:a,normalize:r}=Li(s),l=e.length;let h,c,{start:d,end:u,loop:f}=t;if(f){for(d+=l,u+=l,h=0,c=l;hb||l(n,x,p)&&0!==r(n,x),v=()=>!b||0===r(o,p)||l(o,x,p);for(let t=c,i=c;t<=d;++t)m=e[t%a],m.skip||(p=h(m[s]),p!==x&&(b=l(p,n,o),null===_&&y()&&(_=0===r(p,n)?t:i),null!==_&&v()&&(g.push(Ei({start:_,end:t,loop:u,count:a,style:f})),_=null),i=t,x=p));return null!==_&&g.push(Ei({start:_,end:d,loop:u,count:a,style:f})),g}function Ii(t,e){const i=[],s=t.segments;for(let n=0;nn&&t[o%e].skip;)o--;return o%=e,{start:n,end:o}}(i,n,o,s);if(!0===s)return Fi(t,[{start:a,end:r,loop:o}],i,e);return Fi(t,function(t,e,i,s){const n=t.length,o=[];let a,r=e,l=t[e];for(a=e+1;a<=i;++a){const i=t[a%n];i.skip||i.stop?l.skip||(s=!1,o.push({start:e%n,end:(a-1)%n,loop:s}),e=r=i.stop?a:null):(r=a,l.skip&&(e=a)),l=i}return null!==r&&o.push({start:e%n,end:r%n,loop:s}),o}(i,a,r!s(t[e.axis])));n.lo-=Math.max(0,a);const r=i.slice(n.hi).findIndex((t=>!s(t[e.axis])));n.hi+=Math.max(0,r)}return n}if(o._sharedOptions){const t=a[0],s="function"==typeof t.getRange&&t.getRange(e);if(s){const t=r(a,e,i-s),n=r(a,e,i+s);return{lo:t.lo,hi:n.hi}}}}return{lo:0,hi:a.length-1}}function $i(t,e,i,s,n){const o=t.getSortedVisibleDatasetMetas(),a=i[e];for(let t=0,i=o.length;t{t[a]&&t[a](e[i],n)&&(o.push({element:t,datasetIndex:s,index:l}),r=r||t.inRange(e.x,e.y,n))})),s&&!r?[]:o}var Ki={evaluateInteractionItems:$i,modes:{index(t,e,i,s){const n=ve(e,t),o=i.axis||"x",a=i.includeInvisible||!1,r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a),l=[];return r.length?(t.getSortedVisibleDatasetMetas().forEach((t=>{const e=r[0].index,i=t.data[e];i&&!i.skip&&l.push({element:i,datasetIndex:t.index,index:e})})),l):[]},dataset(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;let r=i.intersect?Yi(t,n,o,s,a):Xi(t,n,o,!1,s,a);if(r.length>0){const e=r[0].datasetIndex,i=t.getDatasetMeta(e).data;r=[];for(let t=0;tYi(t,ve(e,t),i.axis||"xy",s,i.includeInvisible||!1),nearest(t,e,i,s){const n=ve(e,t),o=i.axis||"xy",a=i.includeInvisible||!1;return Xi(t,n,o,i.intersect,s,a)},x:(t,e,i,s)=>qi(t,ve(e,t),"x",i.intersect,s),y:(t,e,i,s)=>qi(t,ve(e,t),"y",i.intersect,s)}};const Gi=["left","top","right","bottom"];function Ji(t,e){return t.filter((t=>t.pos===e))}function Zi(t,e){return t.filter((t=>-1===Gi.indexOf(t.pos)&&t.box.axis===e))}function Qi(t,e){return t.sort(((t,i)=>{const s=e?i:t,n=e?t:i;return s.weight===n.weight?s.index-n.index:s.weight-n.weight}))}function ts(t,e){const i=function(t){const e={};for(const i of t){const{stack:t,pos:s,stackWeight:n}=i;if(!t||!Gi.includes(s))continue;const o=e[t]||(e[t]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=n}return e}(t),{vBoxMaxWidth:s,hBoxMaxHeight:n}=e;let o,a,r;for(o=0,a=t.length;o{s[t]=Math.max(e[t],i[t])})),s}return s(t?["left","right"]:["top","bottom"])}function os(t,e,i,s){const n=[];let o,a,r,l,h,c;for(o=0,a=t.length,h=0;ot.box.fullSize)),!0),s=Qi(Ji(e,"left"),!0),n=Qi(Ji(e,"right")),o=Qi(Ji(e,"top"),!0),a=Qi(Ji(e,"bottom")),r=Zi(e,"x"),l=Zi(e,"y");return{fullSize:i,leftAndTop:s.concat(o),rightAndBottom:n.concat(l).concat(a).concat(r),chartArea:Ji(e,"chartArea"),vertical:s.concat(n).concat(l),horizontal:o.concat(a).concat(r)}}(t.boxes),l=r.vertical,h=r.horizontal;u(t.boxes,(t=>{"function"==typeof t.beforeLayout&&t.beforeLayout()}));const c=l.reduce(((t,e)=>e.box.options&&!1===e.box.options.display?t:t+1),0)||1,d=Object.freeze({outerWidth:e,outerHeight:i,padding:n,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/c,hBoxMaxHeight:a/2}),f=Object.assign({},n);is(f,ki(s));const g=Object.assign({maxPadding:f,w:o,h:a,x:n.left,y:n.top},n),p=ts(l.concat(h),d);os(r.fullSize,g,d,p),os(l,g,d,p),os(h,g,d,p)&&os(l,g,d,p),function(t){const e=t.maxPadding;function i(i){const s=Math.max(e[i]-t[i],0);return t[i]+=s,s}t.y+=i("top"),t.x+=i("left"),i("right"),i("bottom")}(g),rs(r.leftAndTop,g,d,p),g.x+=g.w,g.y+=g.h,rs(r.rightAndBottom,g,d,p),t.chartArea={left:g.left,top:g.top,right:g.left+g.w,bottom:g.top+g.h,height:g.h,width:g.w},u(r.chartArea,(e=>{const i=e.box;Object.assign(i,t.chartArea),i.update(g.w,g.h,{left:0,top:0,right:0,bottom:0})}))}};class hs{acquireContext(t,e){}releaseContext(t){return!1}addEventListener(t,e,i){}removeEventListener(t,e,i){}getDevicePixelRatio(){return 1}getMaximumSize(t,e,i,s){return e=Math.max(0,e||t.width),i=i||t.height,{width:e,height:Math.max(0,s?Math.floor(e/s):i)}}isAttached(t){return!0}updateConfig(t){}}class cs extends hs{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const ds="$chartjs",us={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},fs=t=>null===t||""===t;const gs=!!Se&&{passive:!0};function ps(t,e,i){t&&t.canvas&&t.canvas.removeEventListener(e,i,gs)}function ms(t,e){for(const i of t)if(i===e||i.contains(e))return!0}function xs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.addedNodes,s),e=e&&!ms(i.removedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}function bs(t,e,i){const s=t.canvas,n=new MutationObserver((t=>{let e=!1;for(const i of t)e=e||ms(i.removedNodes,s),e=e&&!ms(i.addedNodes,s);e&&i()}));return n.observe(document,{childList:!0,subtree:!0}),n}const _s=new Map;let ys=0;function vs(){const t=window.devicePixelRatio;t!==ys&&(ys=t,_s.forEach(((e,i)=>{i.currentDevicePixelRatio!==t&&e()})))}function Ms(t,e,i){const s=t.canvas,n=s&&ge(s);if(!n)return;const o=ct(((t,e)=>{const s=n.clientWidth;i(t,e),s{const e=t[0],i=e.contentRect.width,s=e.contentRect.height;0===i&&0===s||o(i,s)}));return a.observe(n),function(t,e){_s.size||window.addEventListener("resize",vs),_s.set(t,e)}(t,o),a}function ws(t,e,i){i&&i.disconnect(),"resize"===e&&function(t){_s.delete(t),_s.size||window.removeEventListener("resize",vs)}(t)}function ks(t,e,i){const s=t.canvas,n=ct((e=>{null!==t.ctx&&i(function(t,e){const i=us[t.type]||t.type,{x:s,y:n}=ve(t,e);return{type:i,chart:e,native:t,x:void 0!==s?s:null,y:void 0!==n?n:null}}(e,t))}),t);return function(t,e,i){t&&t.addEventListener(e,i,gs)}(s,e,n),n}class Ss extends hs{acquireContext(t,e){const i=t&&t.getContext&&t.getContext("2d");return i&&i.canvas===t?(function(t,e){const i=t.style,s=t.getAttribute("height"),n=t.getAttribute("width");if(t[ds]={initial:{height:s,width:n,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",i.boxSizing=i.boxSizing||"border-box",fs(n)){const e=Pe(t,"width");void 0!==e&&(t.width=e)}if(fs(s))if(""===t.style.height)t.height=t.width/(e||2);else{const e=Pe(t,"height");void 0!==e&&(t.height=e)}}(t,e),i):null}releaseContext(t){const e=t.canvas;if(!e[ds])return!1;const i=e[ds].initial;["height","width"].forEach((t=>{const n=i[t];s(n)?e.removeAttribute(t):e.setAttribute(t,n)}));const n=i.style||{};return Object.keys(n).forEach((t=>{e.style[t]=n[t]})),e.width=e.width,delete e[ds],!0}addEventListener(t,e,i){this.removeEventListener(t,e);const s=t.$proxies||(t.$proxies={}),n={attach:xs,detach:bs,resize:Ms}[e]||ks;s[e]=n(t,e,i)}removeEventListener(t,e){const i=t.$proxies||(t.$proxies={}),s=i[e];if(!s)return;({attach:ws,detach:ws,resize:ws}[e]||ps)(t,e,s),i[e]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,e,i,s){return we(t,e,i,s)}isAttached(t){const e=t&&ge(t);return!(!e||!e.isConnected)}}function Ps(t){return!fe()||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas?cs:Ss}var Ds=Object.freeze({__proto__:null,BasePlatform:hs,BasicPlatform:cs,DomPlatform:Ss,_detectPlatform:Ps});const Cs="transparent",Os={boolean:(t,e,i)=>i>.5?e:t,color(t,e,i){const s=Qt(t||Cs),n=s.valid&&Qt(e||Cs);return n&&n.valid?n.mix(s,i).hexString():e},number:(t,e,i)=>t+(e-t)*i};class As{constructor(t,e,i,s){const n=e[i];s=Pi([t.to,s,n,t.from]);const o=Pi([t.from,n,s]);this._active=!0,this._fn=t.fn||Os[t.type||typeof o],this._easing=fi[t.easing]||fi.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=e,this._prop=i,this._from=o,this._to=s,this._promises=void 0}active(){return this._active}update(t,e,i){if(this._active){this._notify(!1);const s=this._target[this._prop],n=i-this._start,o=this._duration-n;this._start=i,this._duration=Math.floor(Math.max(o,t.duration)),this._total+=n,this._loop=!!t.loop,this._to=Pi([t.to,e,s,t.from]),this._from=Pi([t.from,s,e])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const e=t-this._start,i=this._duration,s=this._prop,n=this._from,o=this._loop,a=this._to;let r;if(this._active=n!==a&&(o||e1?2-r:r,r=this._easing(Math.min(1,Math.max(0,r))),this._target[s]=this._fn(n,a,r))}wait(){const t=this._promises||(this._promises=[]);return new Promise(((e,i)=>{t.push({res:e,rej:i})}))}_notify(t){const e=t?"res":"rej",i=this._promises||[];for(let t=0;t{const a=t[s];if(!o(a))return;const r={};for(const t of e)r[t]=a[t];(n(a.properties)&&a.properties||[s]).forEach((t=>{t!==s&&i.has(t)||i.set(t,r)}))}))}_animateOptions(t,e){const i=e.options,s=function(t,e){if(!e)return;let i=t.options;if(!i)return void(t.options=e);i.$shared&&(t.options=i=Object.assign({},i,{$shared:!1,$animations:{}}));return i}(t,i);if(!s)return[];const n=this._createAnimations(s,i);return i.$shared&&function(t,e){const i=[],s=Object.keys(e);for(let e=0;e{t.options=i}),(()=>{})),n}_createAnimations(t,e){const i=this._properties,s=[],n=t.$animations||(t.$animations={}),o=Object.keys(e),a=Date.now();let r;for(r=o.length-1;r>=0;--r){const l=o[r];if("$"===l.charAt(0))continue;if("options"===l){s.push(...this._animateOptions(t,e));continue}const h=e[l];let c=n[l];const d=i.get(l);if(c){if(d&&c.active()){c.update(d,h,a);continue}c.cancel()}d&&d.duration?(n[l]=c=new As(d,t,l,h),s.push(c)):t[l]=h}return s}update(t,e){if(0===this._properties.size)return void Object.assign(t,e);const i=this._createAnimations(t,e);return i.length?(bt.add(this._chart,i),!0):void 0}}function Ls(t,e){const i=t&&t.options||{},s=i.reverse,n=void 0===i.min?e:0,o=void 0===i.max?e:0;return{start:s?o:n,end:s?n:o}}function Es(t,e){const i=[],s=t._getSortedDatasetMetas(e);let n,o;for(n=0,o=s.length;n0||!i&&e<0)return n.index}return null}function Vs(t,e){const{chart:i,_cachedMeta:s}=t,n=i._stacks||(i._stacks={}),{iScale:o,vScale:a,index:r}=s,l=o.axis,h=a.axis,c=function(t,e,i){return`${t.id}.${e.id}.${i.stack||i.type}`}(o,a,s),d=e.length;let u;for(let t=0;ti[t].axis===e)).shift()}function Ws(t,e){const i=t.controller.index,s=t.vScale&&t.vScale.axis;if(s){e=e||t._parsed;for(const t of e){const e=t._stacks;if(!e||void 0===e[s]||void 0===e[s][i])return;delete e[s][i],void 0!==e[s]._visualValues&&void 0!==e[s]._visualValues[i]&&delete e[s]._visualValues[i]}}}const Ns=t=>"reset"===t||"none"===t,Hs=(t,e)=>e?t:Object.assign({},t);class js{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,e){this.chart=t,this._ctx=t.ctx,this.index=e,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Is(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&Ws(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,e=this._cachedMeta,i=this.getDataset(),s=(t,e,i,s)=>"x"===t?e:"r"===t?s:i,n=e.xAxisID=l(i.xAxisID,Bs(t,"x")),o=e.yAxisID=l(i.yAxisID,Bs(t,"y")),a=e.rAxisID=l(i.rAxisID,Bs(t,"r")),r=e.indexAxis,h=e.iAxisID=s(r,n,o,a),c=e.vAxisID=s(r,o,n,a);e.xScale=this.getScaleForId(n),e.yScale=this.getScaleForId(o),e.rScale=this.getScaleForId(a),e.iScale=this.getScaleForId(h),e.vScale=this.getScaleForId(c)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const e=this._cachedMeta;return t===e.iScale?e.vScale:e.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&rt(this._data,this),t._stacked&&Ws(t)}_dataCheck(){const t=this.getDataset(),e=t.data||(t.data=[]),i=this._data;if(o(e)){const t=this._cachedMeta;this._data=function(t,e){const{iScale:i,vScale:s}=e,n="x"===i.axis?"x":"y",o="x"===s.axis?"x":"y",a=Object.keys(t),r=new Array(a.length);let l,h,c;for(l=0,h=a.length;l0&&i._parsed[t-1];if(!1===this._parsing)i._parsed=s,i._sorted=!0,d=s;else{d=n(s[t])?this.parseArrayData(i,s,t,e):o(s[t])?this.parseObjectData(i,s,t,e):this.parsePrimitiveData(i,s,t,e);const a=()=>null===c[l]||f&&c[l]t&&!e.hidden&&e._stacked&&{keys:Es(i,!0),values:null})(e,i,this.chart),h={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:c,max:d}=function(t){const{min:e,max:i,minDefined:s,maxDefined:n}=t.getUserBounds();return{min:s?e:Number.NEGATIVE_INFINITY,max:n?i:Number.POSITIVE_INFINITY}}(r);let u,f;function g(){f=s[u];const e=f[r.axis];return!a(f[t.axis])||c>e||d=0;--u)if(!g()){this.updateRangeFromParsed(h,t,f,l);break}return h}getAllParsedValues(t){const e=this._cachedMeta._parsed,i=[];let s,n,o;for(s=0,n=e.length;s=0&&tthis.getContext(i,s,e)),c);return f.$shared&&(f.$shared=r,n[o]=Object.freeze(Hs(f,r))),f}_resolveAnimations(t,e,i){const s=this.chart,n=this._cachedDataOpts,o=`animation-${e}`,a=n[o];if(a)return a;let r;if(!1!==s.options.animation){const s=this.chart.config,n=s.datasetAnimationScopeKeys(this._type,e),o=s.getOptionScopes(this.getDataset(),n);r=s.createResolver(o,this.getContext(t,i,e))}const l=new Ts(s,r&&r.animations);return r&&r._cacheable&&(n[o]=Object.freeze(l)),l}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,e){return!e||Ns(t)||this.chart._animationsDisabled}_getSharedOptions(t,e){const i=this.resolveDataElementOptions(t,e),s=this._sharedOptions,n=this.getSharedOptions(i),o=this.includeOptions(e,n)||n!==s;return this.updateSharedOptions(n,e,i),{sharedOptions:n,includeOptions:o}}updateElement(t,e,i,s){Ns(s)?Object.assign(t,i):this._resolveAnimations(e,s).update(t,i)}updateSharedOptions(t,e,i){t&&!Ns(e)&&this._resolveAnimations(void 0,e).update(t,i)}_setStyle(t,e,i,s){t.active=s;const n=this.getStyle(e,s);this._resolveAnimations(e,i,s).update(t,{options:!s&&this.getSharedOptions(n)||n})}removeHoverStyle(t,e,i){this._setStyle(t,i,"active",!1)}setHoverStyle(t,e,i){this._setStyle(t,i,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const e=this._data,i=this._cachedMeta.data;for(const[t,e,i]of this._syncList)this[t](e,i);this._syncList=[];const s=i.length,n=e.length,o=Math.min(n,s);o&&this.parse(0,o),n>s?this._insertElements(s,n-s,t):n{for(t.length+=e,a=t.length-1;a>=o;a--)t[a]=t[a-e]};for(r(n),a=t;a{s[t]=i[t]&&i[t].active()?i[t]._to:this[t]})),s}}function Ys(t,e){const i=t.options.ticks,n=function(t){const e=t.options.offset,i=t._tickSize(),s=t._length/i+(e?0:1),n=t._maxLength/i;return Math.floor(Math.min(s,n))}(t),o=Math.min(i.maxTicksLimit||n,n),a=i.major.enabled?function(t){const e=[];let i,s;for(i=0,s=t.length;io)return function(t,e,i,s){let n,o=0,a=i[0];for(s=Math.ceil(s),n=0;nn)return e}return Math.max(n,1)}(a,e,o);if(r>0){let t,i;const n=r>1?Math.round((h-l)/(r-1)):null;for(Us(e,c,d,s(n)?0:l-n,l),t=0,i=r-1;t"top"===e||"left"===e?t[e]+i:t[e]-i,qs=(t,e)=>Math.min(e||t,t);function Ks(t,e){const i=[],s=t.length/e,n=t.length;let o=0;for(;oa+r)))return h}function Js(t){return t.drawTicks?t.tickLength:0}function Zs(t,e){if(!t.display)return 0;const i=Si(t.font,e),s=ki(t.padding);return(n(t.text)?t.text.length:1)*i.lineHeight+s.height}function Qs(t,e,i){let s=ut(t);return(i&&"right"!==e||!i&&"right"===e)&&(s=(t=>"left"===t?"right":"right"===t?"left":t)(s)),s}class tn extends $s{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,e){return t}getUserBounds(){let{_userMin:t,_userMax:e,_suggestedMin:i,_suggestedMax:s}=this;return t=r(t,Number.POSITIVE_INFINITY),e=r(e,Number.NEGATIVE_INFINITY),i=r(i,Number.POSITIVE_INFINITY),s=r(s,Number.NEGATIVE_INFINITY),{min:r(t,i),max:r(e,s),minDefined:a(t),maxDefined:a(e)}}getMinMax(t){let e,{min:i,max:s,minDefined:n,maxDefined:o}=this.getUserBounds();if(n&&o)return{min:i,max:s};const a=this.getMatchingVisibleMetas();for(let r=0,l=a.length;rs?s:i,s=n&&i>s?i:s,{min:r(i,r(s,i)),max:r(s,r(i,s))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){d(this.options.beforeUpdate,[this])}update(t,e,i){const{beginAtZero:s,grace:n,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=t,this.maxHeight=e,this._margins=i=Object.assign({left:0,right:0,top:0,bottom:0},i),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+i.left+i.right:this.height+i.top+i.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=Di(this,n,s),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const r=a=n||i<=1||!this.isHorizontal())return void(this.labelRotation=s);const h=this._getLabelSizes(),c=h.widest.width,d=h.highest.height,u=Z(this.chart.width-c,0,this.maxWidth);o=t.offset?this.maxWidth/i:u/(i-1),c+6>o&&(o=u/(i-(t.offset?.5:1)),a=this.maxHeight-Js(t.grid)-e.padding-Zs(t.title,this.chart.options.font),r=Math.sqrt(c*c+d*d),l=Y(Math.min(Math.asin(Z((h.highest.height+6)/o,-1,1)),Math.asin(Z(a/r,-1,1))-Math.asin(Z(d/r,-1,1)))),l=Math.max(s,Math.min(n,l))),this.labelRotation=l}afterCalculateLabelRotation(){d(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){d(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:e,options:{ticks:i,title:s,grid:n}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const o=Zs(s,e.options.font);if(a?(t.width=this.maxWidth,t.height=Js(n)+o):(t.height=this.maxHeight,t.width=Js(n)+o),i.display&&this.ticks.length){const{first:e,last:s,widest:n,highest:o}=this._getLabelSizes(),r=2*i.padding,l=$(this.labelRotation),h=Math.cos(l),c=Math.sin(l);if(a){const e=i.mirror?0:c*n.width+h*o.height;t.height=Math.min(this.maxHeight,t.height+e+r)}else{const e=i.mirror?0:h*n.width+c*o.height;t.width=Math.min(this.maxWidth,t.width+e+r)}this._calculatePadding(e,s,c,h)}}this._handleMargins(),a?(this.width=this._length=e.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=e.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,e,i,s){const{ticks:{align:n,padding:o},position:a}=this.options,r=0!==this.labelRotation,l="top"!==a&&"x"===this.axis;if(this.isHorizontal()){const a=this.getPixelForTick(0)-this.left,h=this.right-this.getPixelForTick(this.ticks.length-1);let c=0,d=0;r?l?(c=s*t.width,d=i*e.height):(c=i*t.height,d=s*e.width):"start"===n?d=e.width:"end"===n?c=t.width:"inner"!==n&&(c=t.width/2,d=e.width/2),this.paddingLeft=Math.max((c-a+o)*this.width/(this.width-a),0),this.paddingRight=Math.max((d-h+o)*this.width/(this.width-h),0)}else{let i=e.height/2,s=t.height/2;"start"===n?(i=0,s=t.height):"end"===n&&(i=e.height,s=0),this.paddingTop=i+o,this.paddingBottom=s+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){d(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:e}=this.options;return"top"===e||"bottom"===e||"x"===t}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){let e,i;for(this.beforeTickToLabelConversion(),this.generateTickLabels(t),e=0,i=t.length;e{const i=t.gc,s=i.length/2;let n;if(s>e){for(n=0;n({width:r[t]||0,height:l[t]||0});return{first:P(0),last:P(e-1),widest:P(k),highest:P(S),widths:r,heights:l}}getLabelForValue(t){return t}getPixelForValue(t,e){return NaN}getValueForPixel(t){}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const e=this._startPixel+t*this._length;return Q(this._alignToPixels?Ae(this.chart,e,0):e)}getDecimalForPixel(t){const e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:e}=this;return t<0&&e<0?e:t>0&&e>0?t:0}getContext(t){const e=this.ticks||[];if(t>=0&&ta*s?a/i:r/s:r*s0}_computeGridLineItems(t){const e=this.axis,i=this.chart,s=this.options,{grid:n,position:a,border:r}=s,h=n.offset,c=this.isHorizontal(),d=this.ticks.length+(h?1:0),u=Js(n),f=[],g=r.setContext(this.getContext()),p=g.display?g.width:0,m=p/2,x=function(t){return Ae(i,t,p)};let b,_,y,v,M,w,k,S,P,D,C,O;if("top"===a)b=x(this.bottom),w=this.bottom-u,S=b-m,D=x(t.top)+m,O=t.bottom;else if("bottom"===a)b=x(this.top),D=t.top,O=x(t.bottom)-m,w=b+m,S=this.top+u;else if("left"===a)b=x(this.right),M=this.right-u,k=b-m,P=x(t.left)+m,C=t.right;else if("right"===a)b=x(this.left),P=t.left,C=x(t.right)-m,M=b+m,k=this.left+u;else if("x"===e){if("center"===a)b=x((t.top+t.bottom)/2+.5);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}D=t.top,O=t.bottom,w=b+m,S=w+u}else if("y"===e){if("center"===a)b=x((t.left+t.right)/2);else if(o(a)){const t=Object.keys(a)[0],e=a[t];b=x(this.chart.scales[t].getPixelForValue(e))}M=b-m,k=M-u,P=t.left,C=t.right}const A=l(s.ticks.maxTicksLimit,d),T=Math.max(1,Math.ceil(d/A));for(_=0;_0&&(o-=s/2)}d={left:o,top:n,width:s+e.width,height:i+e.height,color:t.backdropColor}}x.push({label:v,font:P,textOffset:O,options:{rotation:m,color:i,strokeColor:o,strokeWidth:h,textAlign:f,textBaseline:A,translation:[M,w],backdrop:d}})}return x}_getXAxisLabelAlignment(){const{position:t,ticks:e}=this.options;if(-$(this.labelRotation))return"top"===t?"left":"right";let i="center";return"start"===e.align?i="left":"end"===e.align?i="right":"inner"===e.align&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:e,ticks:{crossAlign:i,mirror:s,padding:n}}=this.options,o=t+n,a=this._getLabelSizes().widest.width;let r,l;return"left"===e?s?(l=this.right+n,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l+=a)):(l=this.right-o,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l=this.left)):"right"===e?s?(l=this.left+n,"near"===i?r="right":"center"===i?(r="center",l-=a/2):(r="left",l-=a)):(l=this.left+o,"near"===i?r="left":"center"===i?(r="center",l+=a/2):(r="right",l=this.right)):r="right",{textAlign:r,x:l}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,e=this.options.position;return"left"===e||"right"===e?{top:0,left:this.left,bottom:t.height,right:this.right}:"top"===e||"bottom"===e?{top:this.top,left:0,bottom:this.bottom,right:t.width}:void 0}drawBackground(){const{ctx:t,options:{backgroundColor:e},left:i,top:s,width:n,height:o}=this;e&&(t.save(),t.fillStyle=e,t.fillRect(i,s,n,o),t.restore())}getLineWidthForValue(t){const e=this.options.grid;if(!this._isVisible()||!e.display)return 0;const i=this.ticks.findIndex((e=>e.value===t));if(i>=0){return e.setContext(this.getContext(i)).lineWidth}return 0}drawGrid(t){const e=this.options.grid,i=this.ctx,s=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let n,o;const a=(t,e,s)=>{s.width&&s.color&&(i.save(),i.lineWidth=s.width,i.strokeStyle=s.color,i.setLineDash(s.borderDash||[]),i.lineDashOffset=s.borderDashOffset,i.beginPath(),i.moveTo(t.x,t.y),i.lineTo(e.x,e.y),i.stroke(),i.restore())};if(e.display)for(n=0,o=s.length;n{this.drawBackground(),this.drawGrid(t),this.drawTitle()}},{z:s,draw:()=>{this.drawBorder()}},{z:e,draw:t=>{this.drawLabels(t)}}]:[{z:e,draw:t=>{this.draw(t)}}]}getMatchingVisibleMetas(t){const e=this.chart.getSortedVisibleDatasetMetas(),i=this.axis+"AxisID",s=[];let n,o;for(n=0,o=e.length;n{const s=i.split("."),n=s.pop(),o=[t].concat(s).join("."),a=e[i].split("."),r=a.pop(),l=a.join(".");ue.route(o,n,l,r)}))}(e,t.defaultRoutes);t.descriptors&&ue.describe(e,t.descriptors)}(t,o,i),this.override&&ue.override(t.id,t.overrides)),o}get(t){return this.items[t]}unregister(t){const e=this.items,i=t.id,s=this.scope;i in e&&delete e[i],s&&i in ue[s]&&(delete ue[s][i],this.override&&delete re[i])}}class sn{constructor(){this.controllers=new en(js,"datasets",!0),this.elements=new en($s,"elements"),this.plugins=new en(Object,"plugins"),this.scales=new en(tn,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,e,i){[...e].forEach((e=>{const s=i||this._getRegistryForType(e);i||s.isForType(e)||s===this.plugins&&e.id?this._exec(t,s,e):u(e,(e=>{const s=i||this._getRegistryForType(e);this._exec(t,s,e)}))}))}_exec(t,e,i){const s=w(t);d(i["before"+s],[],i),e[t](i),d(i["after"+s],[],i)}_getRegistryForType(t){for(let e=0;et.filter((t=>!e.some((e=>t.plugin.id===e.plugin.id))));this._notify(s(e,i),t,"stop"),this._notify(s(i,e),t,"start")}}function an(t,e){return e||!1!==t?!0===t?{}:t:null}function rn(t,{plugin:e,local:i},s,n){const o=t.pluginScopeKeys(e),a=t.getOptionScopes(s,o);return i&&e.defaults&&a.push(e.defaults),t.createResolver(a,n,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ln(t,e){const i=ue.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||i.indexAxis||"x"}function hn(t){if("x"===t||"y"===t||"r"===t)return t}function cn(t,...e){if(hn(t))return t;for(const s of e){const e=s.axis||("top"===(i=s.position)||"bottom"===i?"x":"left"===i||"right"===i?"y":void 0)||t.length>1&&hn(t[0].toLowerCase());if(e)return e}var i;throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function dn(t,e,i){if(i[e+"AxisID"]===t)return{axis:e}}function un(t,e){const i=re[t.type]||{scales:{}},s=e.scales||{},n=ln(t.type,e),a=Object.create(null);return Object.keys(s).forEach((e=>{const r=s[e];if(!o(r))return console.error(`Invalid scale configuration for scale: ${e}`);if(r._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${e}`);const l=cn(e,r,function(t,e){if(e.data&&e.data.datasets){const i=e.data.datasets.filter((e=>e.xAxisID===t||e.yAxisID===t));if(i.length)return dn(t,"x",i[0])||dn(t,"y",i[0])}return{}}(e,t),ue.scales[r.type]),h=function(t,e){return t===e?"_index_":"_value_"}(l,n),c=i.scales||{};a[e]=b(Object.create(null),[{axis:l},r,c[l],c[h]])})),t.data.datasets.forEach((i=>{const n=i.type||t.type,o=i.indexAxis||ln(n,e),r=(re[n]||{}).scales||{};Object.keys(r).forEach((t=>{const e=function(t,e){let i=t;return"_index_"===t?i=e:"_value_"===t&&(i="x"===e?"y":"x"),i}(t,o),n=i[e+"AxisID"]||e;a[n]=a[n]||Object.create(null),b(a[n],[{axis:e},s[n],r[t]])}))})),Object.keys(a).forEach((t=>{const e=a[t];b(e,[ue.scales[e.type],ue.scale])})),a}function fn(t){const e=t.options||(t.options={});e.plugins=l(e.plugins,{}),e.scales=un(t,e)}function gn(t){return(t=t||{}).datasets=t.datasets||[],t.labels=t.labels||[],t}const pn=new Map,mn=new Set;function xn(t,e){let i=pn.get(t);return i||(i=e(),pn.set(t,i),mn.add(i)),i}const bn=(t,e,i)=>{const s=M(e,i);void 0!==s&&t.add(s)};class _n{constructor(t){this._config=function(t){return(t=t||{}).data=gn(t.data),fn(t),t}(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=gn(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),fn(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return xn(t,(()=>[[`datasets.${t}`,""]]))}datasetAnimationScopeKeys(t,e){return xn(`${t}.transition.${e}`,(()=>[[`datasets.${t}.transitions.${e}`,`transitions.${e}`],[`datasets.${t}`,""]]))}datasetElementScopeKeys(t,e){return xn(`${t}-${e}`,(()=>[[`datasets.${t}.elements.${e}`,`datasets.${t}`,`elements.${e}`,""]]))}pluginScopeKeys(t){const e=t.id;return xn(`${this.type}-plugin-${e}`,(()=>[[`plugins.${e}`,...t.additionalOptionScopes||[]]]))}_cachedScopes(t,e){const i=this._scopeCache;let s=i.get(t);return s&&!e||(s=new Map,i.set(t,s)),s}getOptionScopes(t,e,i){const{options:s,type:n}=this,o=this._cachedScopes(t,i),a=o.get(e);if(a)return a;const r=new Set;e.forEach((e=>{t&&(r.add(t),e.forEach((e=>bn(r,t,e)))),e.forEach((t=>bn(r,s,t))),e.forEach((t=>bn(r,re[n]||{},t))),e.forEach((t=>bn(r,ue,t))),e.forEach((t=>bn(r,le,t)))}));const l=Array.from(r);return 0===l.length&&l.push(Object.create(null)),mn.has(e)&&o.set(e,l),l}chartOptionScopes(){const{options:t,type:e}=this;return[t,re[e]||{},ue.datasets[e]||{},{type:e},ue,le]}resolveNamedOptions(t,e,i,s=[""]){const o={$shared:!0},{resolver:a,subPrefixes:r}=yn(this._resolverCache,t,s);let l=a;if(function(t,e){const{isScriptable:i,isIndexable:s}=Ye(t);for(const o of e){const e=i(o),a=s(o),r=(a||e)&&t[o];if(e&&(S(r)||vn(r))||a&&n(r))return!0}return!1}(a,e)){o.$shared=!1;l=$e(a,i=S(i)?i():i,this.createResolver(t,i,r))}for(const t of e)o[t]=l[t];return o}createResolver(t,e,i=[""],s){const{resolver:n}=yn(this._resolverCache,t,i);return o(e)?$e(n,e,void 0,s):n}}function yn(t,e,i){let s=t.get(e);s||(s=new Map,t.set(e,s));const n=i.join();let o=s.get(n);if(!o){o={resolver:je(e,i),subPrefixes:i.filter((t=>!t.toLowerCase().includes("hover")))},s.set(n,o)}return o}const vn=t=>o(t)&&Object.getOwnPropertyNames(t).some((e=>S(t[e])));const Mn=["top","bottom","left","right","chartArea"];function wn(t,e){return"top"===t||"bottom"===t||-1===Mn.indexOf(t)&&"x"===e}function kn(t,e){return function(i,s){return i[t]===s[t]?i[e]-s[e]:i[t]-s[t]}}function Sn(t){const e=t.chart,i=e.options.animation;e.notifyPlugins("afterRender"),d(i&&i.onComplete,[t],e)}function Pn(t){const e=t.chart,i=e.options.animation;d(i&&i.onProgress,[t],e)}function Dn(t){return fe()&&"string"==typeof t?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const Cn={},On=t=>{const e=Dn(t);return Object.values(Cn).filter((t=>t.canvas===e)).pop()};function An(t,e,i){const s=Object.keys(t);for(const n of s){const s=+n;if(s>=e){const o=t[n];delete t[n],(i>0||s>e)&&(t[s+i]=o)}}}class Tn{static defaults=ue;static instances=Cn;static overrides=re;static registry=nn;static version="4.5.1";static getChart=On;static register(...t){nn.add(...t),Ln()}static unregister(...t){nn.remove(...t),Ln()}constructor(t,e){const s=this.config=new _n(e),n=Dn(t),o=On(n);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=s.createResolver(s.chartOptionScopes(),this.getContext());this.platform=new(s.platform||Ps(n)),this.platform.updateConfig(s);const r=this.platform.acquireContext(n,a.aspectRatio),l=r&&r.canvas,h=l&&l.height,c=l&&l.width;this.id=i(),this.ctx=r,this.canvas=l,this.width=c,this.height=h,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new on,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=dt((t=>this.update(t)),a.resizeDelay||0),this._dataChanges=[],Cn[this.id]=this,r&&l?(bt.listen(this,"complete",Sn),bt.listen(this,"progress",Pn),this._initialize(),this.attached&&this.update()):console.error("Failed to create chart: can't acquire context from the given item")}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:e},width:i,height:n,_aspectRatio:o}=this;return s(t)?e&&o?o:n?i/n:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return nn}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ke(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return Te(this.canvas,this.ctx),this}stop(){return bt.stop(this),this}resize(t,e){bt.running(this)?this._resizeBeforeDraw={width:t,height:e}:this._resize(t,e)}_resize(t,e){const i=this.options,s=this.canvas,n=i.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(s,t,e,n),a=i.devicePixelRatio||this.platform.getDevicePixelRatio(),r=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ke(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),d(i.onResize,[this,o],this),this.attached&&this._doResize(r)&&this.render())}ensureScalesHaveIDs(){u(this.options.scales||{},((t,e)=>{t.id=e}))}buildOrUpdateScales(){const t=this.options,e=t.scales,i=this.scales,s=Object.keys(i).reduce(((t,e)=>(t[e]=!1,t)),{});let n=[];e&&(n=n.concat(Object.keys(e).map((t=>{const i=e[t],s=cn(t,i),n="r"===s,o="x"===s;return{options:i,dposition:n?"chartArea":o?"bottom":"left",dtype:n?"radialLinear":o?"category":"linear"}})))),u(n,(e=>{const n=e.options,o=n.id,a=cn(o,n),r=l(n.type,e.dtype);void 0!==n.position&&wn(n.position,a)===wn(e.dposition)||(n.position=e.dposition),s[o]=!0;let h=null;if(o in i&&i[o].type===r)h=i[o];else{h=new(nn.getScale(r))({id:o,type:r,ctx:this.ctx,chart:this}),i[h.id]=h}h.init(n,t)})),u(s,((t,e)=>{t||delete i[e]})),u(i,(t=>{ls.configure(this,t,t.options),ls.addBox(this,t)}))}_updateMetasets(){const t=this._metasets,e=this.data.datasets.length,i=t.length;if(t.sort(((t,e)=>t.index-e.index)),i>e){for(let t=e;te.length&&delete this._stacks,t.forEach(((t,i)=>{0===e.filter((e=>e===t._dataset)).length&&this._destroyDatasetMeta(i)}))}buildOrUpdateControllers(){const t=[],e=this.data.datasets;let i,s;for(this._removeUnreferencedMetasets(),i=0,s=e.length;i{this.getDatasetMeta(e).controller.reset()}),this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){const e=this.config;e.update();const i=this._options=e.createResolver(e.chartOptionScopes(),this.getContext()),s=this._animationsDisabled=!i.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),!1===this.notifyPlugins("beforeUpdate",{mode:t,cancelable:!0}))return;const n=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let t=0,e=this.data.datasets.length;t{t.reset()})),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(kn("z","_idx"));const{_active:a,_lastEvent:r}=this;r?this._eventHandler(r,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){u(this.scales,(t=>{ls.removeBox(this,t)})),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,e=new Set(Object.keys(this._listeners)),i=new Set(t.events);P(e,i)&&!!this._responsiveListeners===t.responsive||(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,e=this._getUniformDataChanges()||[];for(const{method:i,start:s,count:n}of e){An(t,s,"_removeElements"===i?-n:n)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const e=this.data.datasets.length,i=e=>new Set(t.filter((t=>t[0]===e)).map(((t,e)=>e+","+t.splice(1).join(",")))),s=i(0);for(let t=1;tt.split(","))).map((t=>({method:t[1],start:+t[2],count:+t[3]})))}_updateLayout(t){if(!1===this.notifyPlugins("beforeLayout",{cancelable:!0}))return;ls.update(this,this.width,this.height,t);const e=this.chartArea,i=e.width<=0||e.height<=0;this._layers=[],u(this.boxes,(t=>{i&&"chartArea"===t.position||(t.configure&&t.configure(),this._layers.push(...t._layers()))}),this),this._layers.forEach(((t,e)=>{t._idx=e})),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(!1!==this.notifyPlugins("beforeDatasetsUpdate",{mode:t,cancelable:!0})){for(let t=0,e=this.data.datasets.length;t=0;--e)this._drawDataset(t[e]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const e=this.ctx,i={meta:t,index:t.index,cancelable:!0},s=Ni(this,t);!1!==this.notifyPlugins("beforeDatasetDraw",i)&&(s&&Ie(e,s),t.controller.draw(),s&&ze(e),i.cancelable=!1,this.notifyPlugins("afterDatasetDraw",i))}isPointInArea(t){return Re(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,e,i,s){const n=Ki.modes[e];return"function"==typeof n?n(this,t,i,s):[]}getDatasetMeta(t){const e=this.data.datasets[t],i=this._metasets;let s=i.filter((t=>t&&t._dataset===e)).pop();return s||(s={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e&&e.order||0,index:t,_dataset:e,_parsed:[],_sorted:!1},i.push(s)),s}getContext(){return this.$context||(this.$context=Ci(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const e=this.data.datasets[t];if(!e)return!1;const i=this.getDatasetMeta(t);return"boolean"==typeof i.hidden?!i.hidden:!e.hidden}setDatasetVisibility(t,e){this.getDatasetMeta(t).hidden=!e}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,e,i){const s=i?"show":"hide",n=this.getDatasetMeta(t),o=n.controller._resolveAnimations(void 0,s);k(e)?(n.data[e].hidden=!i,this.update()):(this.setDatasetVisibility(t,i),o.update(n,{visible:i}),this.update((e=>e.datasetIndex===t?s:void 0)))}hide(t,e){this._updateVisibility(t,e,!1)}show(t,e){this._updateVisibility(t,e,!0)}_destroyDatasetMeta(t){const e=this._metasets[t];e&&e.controller&&e.controller._destroy(),delete this._metasets[t]}_stop(){let t,e;for(this.stop(),bt.remove(this),t=0,e=this.data.datasets.length;t{e.addEventListener(this,i,s),t[i]=s},s=(t,e,i)=>{t.offsetX=e,t.offsetY=i,this._eventHandler(t)};u(this.options.events,(t=>i(t,s)))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,e=this.platform,i=(i,s)=>{e.addEventListener(this,i,s),t[i]=s},s=(i,s)=>{t[i]&&(e.removeEventListener(this,i,s),delete t[i])},n=(t,e)=>{this.canvas&&this.resize(t,e)};let o;const a=()=>{s("attach",a),this.attached=!0,this.resize(),i("resize",n),i("detach",o)};o=()=>{this.attached=!1,s("resize",n),this._stop(),this._resize(0,0),i("attach",a)},e.isAttached(this.canvas)?a():o()}unbindEvents(){u(this._listeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._listeners={},u(this._responsiveListeners,((t,e)=>{this.platform.removeEventListener(this,e,t)})),this._responsiveListeners=void 0}updateHoverStyle(t,e,i){const s=i?"set":"remove";let n,o,a,r;for("dataset"===e&&(n=this.getDatasetMeta(t[0].datasetIndex),n.controller["_"+s+"DatasetHoverStyle"]()),a=0,r=t.length;a{const i=this.getDatasetMeta(t);if(!i)throw new Error("No dataset found at index "+t);return{datasetIndex:t,element:i.data[e],index:e}}));!f(i,e)&&(this._active=i,this._lastEvent=null,this._updateHoverStyles(i,e))}notifyPlugins(t,e,i){return this._plugins.notify(this,t,e,i)}isPluginEnabled(t){return 1===this._plugins._cache.filter((e=>e.plugin.id===t)).length}_updateHoverStyles(t,e,i){const s=this.options.hover,n=(t,e)=>t.filter((t=>!e.some((e=>t.datasetIndex===e.datasetIndex&&t.index===e.index)))),o=n(e,t),a=i?t:n(t,e);o.length&&this.updateHoverStyle(o,s.mode,!1),a.length&&s.mode&&this.updateHoverStyle(a,s.mode,!0)}_eventHandler(t,e){const i={event:t,replay:e,cancelable:!0,inChartArea:this.isPointInArea(t)},s=e=>(e.options.events||this.options.events).includes(t.native.type);if(!1===this.notifyPlugins("beforeEvent",i,s))return;const n=this._handleEvent(t,e,i.inChartArea);return i.cancelable=!1,this.notifyPlugins("afterEvent",i,s),(n||i.changed)&&this.render(),this}_handleEvent(t,e,i){const{_active:s=[],options:n}=this,o=e,a=this._getActiveElements(t,s,i,o),r=D(t),l=function(t,e,i,s){return i&&"mouseout"!==t.type?s?e:t:null}(t,this._lastEvent,i,r);i&&(this._lastEvent=null,d(n.onHover,[t,a,this],this),r&&d(n.onClick,[t,a,this],this));const h=!f(a,s);return(h||e)&&(this._active=a,this._updateHoverStyles(a,s,e)),this._lastEvent=l,h}_getActiveElements(t,e,i,s){if("mouseout"===t.type)return[];if(!i)return e;const n=this.options.hover;return this.getElementsAtEventForMode(t,n.mode,n,s)}}function Ln(){return u(Tn.instances,(t=>t._plugins.invalidate()))}function En(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class Rn{static override(t){Object.assign(Rn.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return En()}parse(){return En()}format(){return En()}add(){return En()}diff(){return En()}startOf(){return En()}endOf(){return En()}}var In={_date:Rn};function zn(t){const e=t.iScale,i=function(t,e){if(!t._cache.$bar){const i=t.getMatchingVisibleMetas(e);let s=[];for(let e=0,n=i.length;et-e)))}return t._cache.$bar}(e,t.type);let s,n,o,a,r=e._length;const l=()=>{32767!==o&&-32768!==o&&(k(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(s=0,n=i.length;sMath.abs(r)&&(l=r,h=a),e[i.axis]=h,e._custom={barStart:l,barEnd:h,start:n,end:o,min:a,max:r}}(t,e,i,s):e[i.axis]=i.parse(t,s),e}function Vn(t,e,i,s){const n=t.iScale,o=t.vScale,a=n.getLabels(),r=n===o,l=[];let h,c,d,u;for(h=i,c=i+s;ht.x,i="left",s="right"):(e=t.base"spacing"!==t,_indexable:t=>"spacing"!==t&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const e=t.data,{labels:{pointStyle:i,textAlign:s,color:n,useBorderRadius:o,borderRadius:a}}=t.legend.options;return e.labels.length&&e.datasets.length?e.labels.map(((e,r)=>{const l=t.getDatasetMeta(0).controller.getStyle(r);return{text:e,fillStyle:l.backgroundColor,fontColor:n,hidden:!t.getDataVisibility(r),lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:l.borderWidth,strokeStyle:l.borderColor,textAlign:s,pointStyle:i,borderRadius:o&&(a||l.borderRadius),index:r}})):[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}}};constructor(t,e){super(t,e),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,e){const i=this.getDataset().data,s=this._cachedMeta;if(!1===this._parsing)s._parsed=i;else{let n,a,r=t=>+i[t];if(o(i[t])){const{key:t="value"}=this._parsing;r=e=>+M(i[e],t)}for(n=t,a=t+e;nJ(t,r,l,!0)?1:Math.max(e,e*i,s,s*i),g=(t,e,s)=>J(t,r,l,!0)?-1:Math.min(e,e*i,s,s*i),p=f(0,h,d),m=f(E,c,u),x=g(C,h,d),b=g(C+E,c,u);s=(p-x)/2,n=(m-b)/2,o=-(p+x)/2,a=-(m+b)/2}return{ratioX:s,ratioY:n,offsetX:o,offsetY:a}}(u,d,r),x=(i.width-o)/f,b=(i.height-o)/g,_=Math.max(Math.min(x,b)/2,0),y=c(this.options.radius,_),v=(y-Math.max(y*r,0))/this._getVisibleDatasetWeightTotal();this.offsetX=p*y,this.offsetY=m*y,s.total=this.calculateTotal(),this.outerRadius=y-v*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-v*l,0),this.updateElements(n,0,n.length,t)}_circumference(t,e){const i=this.options,s=this._cachedMeta,n=this._getCircumference();return e&&i.animation.animateRotate||!this.chart.getDataVisibility(t)||null===s._parsed[t]||s.data[t].hidden?0:this.calculateCircumference(s._parsed[t]*n/O)}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.chartArea,r=o.options.animation,l=(a.left+a.right)/2,h=(a.top+a.bottom)/2,c=n&&r.animateScale,d=c?0:this.innerRadius,u=c?0:this.outerRadius,{sharedOptions:f,includeOptions:g}=this._getSharedOptions(e,s);let p,m=this._getRotation();for(p=0;p0&&!isNaN(t)?O*(Math.abs(t)/e):0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t],i.options.locale);return{label:s[t]||"",value:n}}getMaxBorderWidth(t){let e=0;const i=this.chart;let s,n,o,a,r;if(!t)for(s=0,n=i.data.datasets.length;s{const o=t.getDatasetMeta(0).controller.getStyle(n);return{text:e,fillStyle:o.backgroundColor,strokeStyle:o.borderColor,fontColor:s,lineWidth:o.borderWidth,pointStyle:i,hidden:!t.getDataVisibility(n),index:n}}))}return[]}},onClick(t,e,i){i.chart.toggleDataVisibility(e.index),i.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}};constructor(t,e){super(t,e),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart,s=i.data.labels||[],n=ne(e._parsed[t].r,i.options.locale);return{label:s[t]||"",value:n}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta.data;this._updateRadius(),this.updateElements(e,0,e.length,t)}getMinMax(){const t=this._cachedMeta,e={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return t.data.forEach(((t,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(se.max&&(e.max=s))})),e}_updateRadius(){const t=this.chart,e=t.chartArea,i=t.options,s=Math.min(e.right-e.left,e.bottom-e.top),n=Math.max(s/2,0),o=(n-Math.max(i.cutoutPercentage?n/100*i.cutoutPercentage:1,0))/t.getVisibleDatasetCount();this.outerRadius=n-o*this.index,this.innerRadius=this.outerRadius-o}updateElements(t,e,i,s){const n="reset"===s,o=this.chart,a=o.options.animation,r=this._cachedMeta.rScale,l=r.xCenter,h=r.yCenter,c=r.getIndexAngle(0)-.5*C;let d,u=c;const f=360/this.countVisibleElements();for(d=0;d{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&e++})),e}_computeAngle(t,e,i){return this.chart.getDataVisibility(t)?$(this.resolveDataElementOptions(t,e).angle||i):0}}var Un=Object.freeze({__proto__:null,BarController:class extends js{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,e,i,s){return Vn(t,e,i,s)}parseArrayData(t,e,i,s){return Vn(t,e,i,s)}parseObjectData(t,e,i,s){const{iScale:n,vScale:o}=t,{xAxisKey:a="x",yAxisKey:r="y"}=this._parsing,l="x"===n.axis?a:r,h="x"===o.axis?a:r,c=[];let d,u,f,g;for(d=i,u=i+s;dt.controller.options.grouped)),o=i.options.stacked,a=[],r=this._cachedMeta.controller.getParsed(e),l=r&&r[i.axis],h=t=>{const e=t._parsed.find((t=>t[i.axis]===l)),n=e&&e[t.vScale.axis];if(s(n)||isNaN(n))return!0};for(const i of n)if((void 0===e||!h(i))&&((!1===o||-1===a.indexOf(i.stack)||void 0===o&&void 0===i.stack)&&a.push(i.stack),i.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,e=this.chart.options.indexAxis;return Object.keys(t).filter((i=>t[i].axis===e)).shift()}_getAxis(){const t={},e=this.getFirstScaleIdForIndexAxis();for(const i of this.chart.data.datasets)t[l("x"===this.chart.options.indexAxis?i.xAxisID:i.yAxisID,e)]=!0;return Object.keys(t)}_getStackIndex(t,e,i){const s=this._getStacks(t,i),n=void 0!==e?s.indexOf(e):-1;return-1===n?s.length-1:n}_getRuler(){const t=this.options,e=this._cachedMeta,i=e.iScale,s=[];let n,o;for(n=0,o=e.data.length;n=i?1:-1)}(u,e,r)*a,f===r&&(x-=u/2);const t=e.getPixelForDecimal(0),s=e.getPixelForDecimal(1),o=Math.min(t,s),h=Math.max(t,s);x=Math.max(Math.min(x,h),o),d=x+u,i&&!c&&(l._stacks[e.axis]._visualValues[n]=e.getValueForPixel(d)-e.getValueForPixel(x))}if(x===e.getPixelForValue(r)){const t=F(u)*e.getLineWidthForValue(r)/2;x+=t,u-=t}return{size:u,base:x,head:d,center:d+u/2}}_calculateBarIndexPixels(t,e){const i=e.scale,n=this.options,o=n.skipNull,a=l(n.maxBarThickness,1/0);let r,h;const c=this._getAxisCount();if(e.grouped){const i=o?this._getStackCount(t):e.stackCount,d="flex"===n.barThickness?function(t,e,i,s){const n=e.pixels,o=n[t];let a=t>0?n[t-1]:null,r=t=0;--i)e=Math.max(e,t[i].size(this.resolveDataElementOptions(i))/2);return e>0&&e}getLabelAndValue(t){const e=this._cachedMeta,i=this.chart.data.labels||[],{xScale:s,yScale:n}=e,o=this.getParsed(t),a=s.getLabelForValue(o.x),r=n.getLabelForValue(o.y),l=o._custom;return{label:i[t]||"",value:"("+a+", "+r+(l?", "+l:"")+")"}}update(t){const e=this._cachedMeta.data;this.updateElements(e,0,e.length,t)}updateElements(t,e,i,s){const n="reset"===s,{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:r,includeOptions:l}=this._getSharedOptions(e,s),h=o.axis,c=a.axis;for(let d=e;d0&&this.getParsed(e-1);for(let i=0;i<_;++i){const g=t[i],_=x?g:{};if(i=b){_.skip=!0;continue}const v=this.getParsed(i),M=s(v[f]),w=_[u]=a.getPixelForValue(v[u],i),k=_[f]=o||M?r.getBasePixel():r.getPixelForValue(l?this.applyStack(r,v,l):v[f],i);_.skip=isNaN(w)||isNaN(k)||M,_.stop=i>0&&Math.abs(v[u]-y[u])>m,p&&(_.parsed=v,_.raw=h.data[i]),d&&(_.options=c||this.resolveDataElementOptions(i,g.active?"active":n)),x||this.updateElement(g,i,_,n),y=v}}getMaxOverflow(){const t=this._cachedMeta,e=t.dataset,i=e.options&&e.options.borderWidth||0,s=t.data||[];if(!s.length)return i;const n=s[0].size(this.resolveDataElementOptions(0)),o=s[s.length-1].size(this.resolveDataElementOptions(s.length-1));return Math.max(i,n,o)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}},PieController:class extends $n{static id="pie";static defaults={cutout:0,rotation:0,circumference:360,radius:"100%"}},PolarAreaController:Yn,RadarController:class extends js{static id="radar";static defaults={datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}};static overrides={aspectRatio:1,scales:{r:{type:"radialLinear"}}};getLabelAndValue(t){const e=this._cachedMeta.vScale,i=this.getParsed(t);return{label:e.getLabels()[t],value:""+e.getLabelForValue(i[e.axis])}}parseObjectData(t,e,i,s){return ii.bind(this)(t,e,i,s)}update(t){const e=this._cachedMeta,i=e.dataset,s=e.data||[],n=e.iScale.getLabels();if(i.points=s,"resize"!==t){const e=this.resolveDatasetElementOptions(t);this.options.showLine||(e.borderWidth=0);const o={_loop:!0,_fullLoop:n.length===s.length,options:e};this.updateElement(i,void 0,o,t)}this.updateElements(s,0,s.length,t)}updateElements(t,e,i,s){const n=this._cachedMeta.rScale,o="reset"===s;for(let a=e;a0&&this.getParsed(e-1);for(let c=e;c0&&Math.abs(i[f]-_[f])>x,m&&(p.parsed=i,p.raw=h.data[c]),u&&(p.options=d||this.resolveDataElementOptions(c,e.active?"active":n)),b||this.updateElement(e,c,p,n),_=i}this.updateSharedOptions(d,n,c)}getMaxOverflow(){const t=this._cachedMeta,e=t.data||[];if(!this.options.showLine){let t=0;for(let i=e.length-1;i>=0;--i)t=Math.max(t,e[i].size(this.resolveDataElementOptions(i))/2);return t>0&&t}const i=t.dataset,s=i.options&&i.options.borderWidth||0;if(!e.length)return s;const n=e[0].size(this.resolveDataElementOptions(0)),o=e[e.length-1].size(this.resolveDataElementOptions(e.length-1));return Math.max(s,n,o)/2}}});function Xn(t,e,i,s){const n=vi(t.options.borderRadius,["outerStart","outerEnd","innerStart","innerEnd"]);const o=(i-e)/2,a=Math.min(o,s*e/2),r=t=>{const e=(i-Math.min(o,t))*s/2;return Z(t,0,Math.min(o,e))};return{outerStart:r(n.outerStart),outerEnd:r(n.outerEnd),innerStart:Z(n.innerStart,0,a),innerEnd:Z(n.innerEnd,0,a)}}function qn(t,e,i,s){return{x:i+t*Math.cos(e),y:s+t*Math.sin(e)}}function Kn(t,e,i,s,n,o){const{x:a,y:r,startAngle:l,pixelMargin:h,innerRadius:c}=e,d=Math.max(e.outerRadius+s+i-h,0),u=c>0?c+s+i+h:0;let f=0;const g=n-l;if(s){const t=((c>0?c-s:0)+(d>0?d-s:0))/2;f=(g-(0!==t?g*t/(t+s):g))/2}const p=(g-Math.max(.001,g*d-i/C)/d)/2,m=l+p+f,x=n-p-f,{outerStart:b,outerEnd:_,innerStart:y,innerEnd:v}=Xn(e,u,d,x-m),M=d-b,w=d-_,k=m+b/M,S=x-_/w,P=u+y,D=u+v,O=m+y/P,A=x-v/D;if(t.beginPath(),o){const e=(k+S)/2;if(t.arc(a,r,d,k,e),t.arc(a,r,d,e,S),_>0){const e=qn(w,S,a,r);t.arc(e.x,e.y,_,S,x+E)}const i=qn(D,x,a,r);if(t.lineTo(i.x,i.y),v>0){const e=qn(D,A,a,r);t.arc(e.x,e.y,v,x+E,A+Math.PI)}const s=(x-v/u+(m+y/u))/2;if(t.arc(a,r,u,x-v/u,s,!0),t.arc(a,r,u,s,m+y/u,!0),y>0){const e=qn(P,O,a,r);t.arc(e.x,e.y,y,O+Math.PI,m-E)}const n=qn(M,m,a,r);if(t.lineTo(n.x,n.y),b>0){const e=qn(M,k,a,r);t.arc(e.x,e.y,b,m-E,k)}}else{t.moveTo(a,r);const e=Math.cos(k)*d+a,i=Math.sin(k)*d+r;t.lineTo(e,i);const s=Math.cos(S)*d+a,n=Math.sin(S)*d+r;t.lineTo(s,n)}t.closePath()}function Gn(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r,options:l}=e,{borderWidth:h,borderJoinStyle:c,borderDash:d,borderDashOffset:u,borderRadius:f}=l,g="inner"===l.borderAlign;if(!h)return;t.setLineDash(d||[]),t.lineDashOffset=u,g?(t.lineWidth=2*h,t.lineJoin=c||"round"):(t.lineWidth=h,t.lineJoin=c||"bevel");let p=e.endAngle;if(o){Kn(t,e,i,s,p,n);for(let e=0;en?(h=n/l,t.arc(o,a,l,i+h,s-h,!0)):t.arc(o,a,n,i+E,s-E),t.closePath(),t.clip()}(t,e,p),l.selfJoin&&p-a>=C&&0===f&&"miter"!==c&&function(t,e,i){const{startAngle:s,x:n,y:o,outerRadius:a,innerRadius:r,options:l}=e,{borderWidth:h,borderJoinStyle:c}=l,d=Math.min(h/a,G(s-i));if(t.beginPath(),t.arc(n,o,a-h/2,s+d/2,i-d/2),r>0){const e=Math.min(h/r,G(s-i));t.arc(n,o,r+h/2,i-e/2,s+e/2,!0)}else{const e=Math.min(h/2,a*G(s-i));if("round"===c)t.arc(n,o,e,i-C/2,s+C/2,!0);else if("bevel"===c){const a=2*e*e,r=-a*Math.cos(i+C/2)+n,l=-a*Math.sin(i+C/2)+o,h=a*Math.cos(s+C/2)+n,c=a*Math.sin(s+C/2)+o;t.lineTo(r,l),t.lineTo(h,c)}}t.closePath(),t.moveTo(0,0),t.rect(0,0,t.canvas.width,t.canvas.height),t.clip("evenodd")}(t,e,p),o||(Kn(t,e,i,s,p,n),t.stroke())}function Jn(t,e,i=e){t.lineCap=l(i.borderCapStyle,e.borderCapStyle),t.setLineDash(l(i.borderDash,e.borderDash)),t.lineDashOffset=l(i.borderDashOffset,e.borderDashOffset),t.lineJoin=l(i.borderJoinStyle,e.borderJoinStyle),t.lineWidth=l(i.borderWidth,e.borderWidth),t.strokeStyle=l(i.borderColor,e.borderColor)}function Zn(t,e,i){t.lineTo(i.x,i.y)}function Qn(t,e,i={}){const s=t.length,{start:n=0,end:o=s-1}=i,{start:a,end:r}=e,l=Math.max(n,a),h=Math.min(o,r),c=nr&&o>r;return{count:s,start:l,loop:e.loop,ilen:h(a+(h?r-t:t))%o,_=()=>{f!==g&&(t.lineTo(m,g),t.lineTo(m,f),t.lineTo(m,p))};for(l&&(d=n[b(0)],t.moveTo(d.x,d.y)),c=0;c<=r;++c){if(d=n[b(c)],d.skip)continue;const e=d.x,i=d.y,s=0|e;s===u?(ig&&(g=i),m=(x*m+e)/++x):(_(),t.lineTo(e,i),u=s,x=0,f=g=i),p=i}_()}function io(t){const e=t.options,i=e.borderDash&&e.borderDash.length;return!(t._decimated||t._loop||e.tension||"monotone"===e.cubicInterpolationMode||e.stepped||i)?eo:to}const so="function"==typeof Path2D;function no(t,e,i,s){so&&!e.options.segment?function(t,e,i,s){let n=e._path;n||(n=e._path=new Path2D,e.path(n,i,s)&&n.closePath()),Jn(t,e.options),t.stroke(n)}(t,e,i,s):function(t,e,i,s){const{segments:n,options:o}=e,a=io(e);for(const r of n)Jn(t,o,r.style),t.beginPath(),a(t,e,r,{start:i,end:i+s-1})&&t.closePath(),t.stroke()}(t,e,i,s)}class oo extends $s{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>"borderDash"!==t&&"fill"!==t};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,e){const i=this.options;if((i.tension||"monotone"===i.cubicInterpolationMode)&&!i.stepped&&!this._pointsUpdated){const s=i.spanGaps?this._loop:this._fullLoop;hi(this._points,i,t,s,e),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=zi(this,this.options.segment))}first(){const t=this.segments,e=this.points;return t.length&&e[t[0].start]}last(){const t=this.segments,e=this.points,i=t.length;return i&&e[t[i-1].end]}interpolate(t,e){const i=this.options,s=t[e],n=this.points,o=Ii(this,{property:e,start:s,end:s});if(!o.length)return;const a=[],r=function(t){return t.stepped?pi:t.tension||"monotone"===t.cubicInterpolationMode?mi:gi}(i);let l,h;for(l=0,h=o.length;l"borderDash"!==t};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,e,i){const s=this.getProps(["x","y"],i),{angle:n,distance:o}=X(s,{x:t,y:e}),{startAngle:a,endAngle:r,innerRadius:h,outerRadius:c,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),u=(this.options.spacing+this.options.borderWidth)/2,f=l(d,r-a),g=J(n,a,r)&&a!==r,p=f>=O||g,m=tt(o,h+u,c+u);return p&&m}getCenterPoint(t){const{x:e,y:i,startAngle:s,endAngle:n,innerRadius:o,outerRadius:a}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:r,spacing:l}=this.options,h=(s+n)/2,c=(o+a+l+r)/2;return{x:e+Math.cos(h)*c,y:i+Math.sin(h)*c}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:e,circumference:i}=this,s=(e.offset||0)/4,n=(e.spacing||0)/2,o=e.circular;if(this.pixelMargin="inner"===e.borderAlign?.33:0,this.fullCircles=i>O?Math.floor(i/O):0,0===i||this.innerRadius<0||this.outerRadius<0)return;t.save();const a=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(a)*s,Math.sin(a)*s);const r=s*(1-Math.sin(Math.min(C,i||0)));t.fillStyle=e.backgroundColor,t.strokeStyle=e.borderColor,function(t,e,i,s,n){const{fullCircles:o,startAngle:a,circumference:r}=e;let l=e.endAngle;if(o){Kn(t,e,i,s,l,n);for(let e=0;e("string"==typeof e?(i=t.push(e)-1,s.unshift({index:i,label:e})):isNaN(e)&&(i=null),i))(t,e,i,s);return n!==t.lastIndexOf(e)?i:n}function mo(t){const e=this.getLabels();return t>=0&&ts=e?s:t,a=t=>n=i?n:t;if(t){const t=F(s),e=F(n);t<0&&e<0?a(0):t>0&&e>0&&o(0)}if(s===n){let e=0===n?1:Math.abs(.05*n);a(n+e),t||o(s-e)}this.min=s,this.max=n}getTickLimit(){const t=this.options.ticks;let e,{maxTicksLimit:i,stepSize:s}=t;return s?(e=Math.ceil(this.max/s)-Math.floor(this.min/s)+1,e>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${s} would result generating up to ${e} ticks. Limiting to 1000.`),e=1e3)):(e=this.computeTickLimit(),i=i||11),i&&(e=Math.min(i,e)),e}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const t=this.options,e=t.ticks;let i=this.getTickLimit();i=Math.max(2,i);const n=function(t,e){const i=[],{bounds:n,step:o,min:a,max:r,precision:l,count:h,maxTicks:c,maxDigits:d,includeBounds:u}=t,f=o||1,g=c-1,{min:p,max:m}=e,x=!s(a),b=!s(r),_=!s(h),y=(m-p)/(d+1);let v,M,w,k,S=B((m-p)/g/f)*f;if(S<1e-14&&!x&&!b)return[{value:p},{value:m}];k=Math.ceil(m/S)-Math.floor(p/S),k>g&&(S=B(k*S/g/f)*f),s(l)||(v=Math.pow(10,l),S=Math.ceil(S*v)/v),"ticks"===n?(M=Math.floor(p/S)*S,w=Math.ceil(m/S)*S):(M=p,w=m),x&&b&&o&&H((r-a)/o,S/1e3)?(k=Math.round(Math.min((r-a)/S,c)),S=(r-a)/k,M=a,w=r):_?(M=x?a:M,w=b?r:w,k=h-1,S=(w-M)/k):(k=(w-M)/S,k=V(k,Math.round(k),S/1e3)?Math.round(k):Math.ceil(k));const P=Math.max(U(S),U(M));v=Math.pow(10,s(l)?P:l),M=Math.round(M*v)/v,w=Math.round(w*v)/v;let D=0;for(x&&(u&&M!==a?(i.push({value:a}),Mr)break;i.push({value:t})}return b&&u&&w!==r?i.length&&V(i[i.length-1].value,r,xo(r,y,t))?i[i.length-1].value=r:i.push({value:r}):b&&w!==r||i.push({value:w}),i}({maxTicks:i,bounds:t.bounds,min:t.min,max:t.max,precision:e.precision,step:e.stepSize,count:e.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:e.minRotation||0,includeBounds:!1!==e.includeBounds},this._range||this);return"ticks"===t.bounds&&j(n,this,"value"),t.reverse?(n.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),n}configure(){const t=this.ticks;let e=this.min,i=this.max;if(super.configure(),this.options.offset&&t.length){const s=(i-e)/Math.max(t.length-1,1)/2;e-=s,i+=s}this._startValue=e,this._endValue=i,this._valueRange=i-e}getLabelForValue(t){return ne(t,this.chart.options.locale,this.options.ticks.format)}}class _o extends bo{static id="linear";static defaults={ticks:{callback:ae.formatters.numeric}};determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?t:0,this.max=a(e)?e:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),e=t?this.width:this.height,i=$(this.options.ticks.minRotation),s=(t?Math.sin(i):Math.cos(i))||.001,n=this._resolveTickFontOptions(0);return Math.ceil(e/Math.min(40,n.lineHeight/s))}getPixelForValue(t){return null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const yo=t=>Math.floor(z(t)),vo=(t,e)=>Math.pow(10,yo(t)+e);function Mo(t){return 1===t/Math.pow(10,yo(t))}function wo(t,e,i){const s=Math.pow(10,i),n=Math.floor(t/s);return Math.ceil(e/s)-n}function ko(t,{min:e,max:i}){e=r(t.min,e);const s=[],n=yo(e);let o=function(t,e){let i=yo(e-t);for(;wo(t,e,i)>10;)i++;for(;wo(t,e,i)<10;)i--;return Math.min(i,yo(t))}(e,i),a=o<0?Math.pow(10,Math.abs(o)):1;const l=Math.pow(10,o),h=n>o?Math.pow(10,n):0,c=Math.round((e-h)*a)/a,d=Math.floor((e-h)/l/10)*l*10;let u=Math.floor((c-d)/Math.pow(10,o)),f=r(t.min,Math.round((h+d+u*Math.pow(10,o))*a)/a);for(;f=10?u=u<15?15:20:u++,u>=20&&(o++,u=2,a=o>=0?1:a),f=Math.round((h+d+u*Math.pow(10,o))*a)/a;const g=r(t.max,f);return s.push({value:g,major:Mo(g),significand:u}),s}class So extends tn{static id="logarithmic";static defaults={ticks:{callback:ae.formatters.logarithmic,major:{enabled:!0}}};constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(t,e){const i=bo.prototype.parse.apply(this,[t,e]);if(0!==i)return a(i)&&i>0?i:null;this._zero=!0}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!0);this.min=a(t)?Math.max(0,t):null,this.max=a(e)?Math.max(0,e):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!a(this._userMin)&&(this.min=t===vo(this.min,0)?vo(this.min,-1):vo(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let i=this.min,s=this.max;const n=e=>i=t?i:e,o=t=>s=e?s:t;i===s&&(i<=0?(n(1),o(10)):(n(vo(i,-1)),o(vo(s,1)))),i<=0&&n(vo(s,-1)),s<=0&&o(vo(i,1)),this.min=i,this.max=s}buildTicks(){const t=this.options,e=ko({min:this._userMin,max:this._userMax},this);return"ticks"===t.bounds&&j(e,this,"value"),t.reverse?(e.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),e}getLabelForValue(t){return void 0===t?"0":ne(t,this.chart.options.locale,this.options.ticks.format)}configure(){const t=this.min;super.configure(),this._startValue=z(t),this._valueRange=z(this.max)-z(t)}getPixelForValue(t){return void 0!==t&&0!==t||(t=this.min),null===t||isNaN(t)?NaN:this.getPixelForDecimal(t===this.min?0:(z(t)-this._startValue)/this._valueRange)}getValueForPixel(t){const e=this.getDecimalForPixel(t);return Math.pow(10,this._startValue+e*this._valueRange)}}function Po(t){const e=t.ticks;if(e.display&&t.display){const t=ki(e.backdropPadding);return l(e.font&&e.font.size,ue.font.size)+t.height}return 0}function Do(t,e,i,s,n){return t===s||t===n?{start:e-i/2,end:e+i/2}:tn?{start:e-i,end:e}:{start:e,end:e+i}}function Co(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},i=Object.assign({},e),s=[],o=[],a=t._pointLabels.length,r=t.options.pointLabels,l=r.centerPointLabels?C/a:0;for(let u=0;ue.r&&(r=(s.end-e.r)/o,t.r=Math.max(t.r,e.r+r)),n.starte.b&&(l=(n.end-e.b)/a,t.b=Math.max(t.b,e.b+l))}function Ao(t,e,i){const s=t.drawingArea,{extra:n,additionalAngle:o,padding:a,size:r}=i,l=t.getPointPosition(e,s+n+a,o),h=Math.round(Y(G(l.angle+E))),c=function(t,e,i){90===i||270===i?t-=e/2:(i>270||i<90)&&(t-=e);return t}(l.y,r.h,h),d=function(t){if(0===t||180===t)return"center";if(t<180)return"left";return"right"}(h),u=function(t,e,i){"right"===i?t-=e:"center"===i&&(t-=e/2);return t}(l.x,r.w,d);return{visible:!0,x:l.x,y:c,textAlign:d,left:u,top:c,right:u+r.w,bottom:c+r.h}}function To(t,e){if(!e)return!0;const{left:i,top:s,right:n,bottom:o}=t;return!(Re({x:i,y:s},e)||Re({x:i,y:o},e)||Re({x:n,y:s},e)||Re({x:n,y:o},e))}function Lo(t,e,i){const{left:n,top:o,right:a,bottom:r}=i,{backdropColor:l}=e;if(!s(l)){const i=wi(e.borderRadius),s=ki(e.backdropPadding);t.fillStyle=l;const h=n-s.left,c=o-s.top,d=a-n+s.width,u=r-o+s.height;Object.values(i).some((t=>0!==t))?(t.beginPath(),He(t,{x:h,y:c,w:d,h:u,radius:i}),t.fill()):t.fillRect(h,c,d,u)}}function Eo(t,e,i,s){const{ctx:n}=t;if(i)n.arc(t.xCenter,t.yCenter,e,0,O);else{let i=t.getPointPosition(0,e);n.moveTo(i.x,i.y);for(let o=1;ot,padding:5,centerPointLabels:!1}};static defaultRoutes={"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"};static descriptors={angleLines:{_fallback:"grid"}};constructor(t){super(t),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const t=this._padding=ki(Po(this.options)/2),e=this.width=this.maxWidth-t.width,i=this.height=this.maxHeight-t.height;this.xCenter=Math.floor(this.left+e/2+t.left),this.yCenter=Math.floor(this.top+i/2+t.top),this.drawingArea=Math.floor(Math.min(e,i)/2)}determineDataLimits(){const{min:t,max:e}=this.getMinMax(!1);this.min=a(t)&&!isNaN(t)?t:0,this.max=a(e)&&!isNaN(e)?e:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/Po(this.options))}generateTickLabels(t){bo.prototype.generateTickLabels.call(this,t),this._pointLabels=this.getLabels().map(((t,e)=>{const i=d(this.options.pointLabels.callback,[t,e],this);return i||0===i?i:""})).filter(((t,e)=>this.chart.getDataVisibility(e)))}fit(){const t=this.options;t.display&&t.pointLabels.display?Co(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(t,e,i,s){this.xCenter+=Math.floor((t-e)/2),this.yCenter+=Math.floor((i-s)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(t,e,i,s))}getIndexAngle(t){return G(t*(O/(this._pointLabels.length||1))+$(this.options.startAngle||0))}getDistanceFromCenterForValue(t){if(s(t))return NaN;const e=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-t)*e:(t-this.min)*e}getValueForDistanceFromCenter(t){if(s(t))return NaN;const e=t/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-e:this.min+e}getPointLabelContext(t){const e=this._pointLabels||[];if(t>=0&&t=0;n--){const e=t._pointLabelItems[n];if(!e.visible)continue;const o=s.setContext(t.getPointLabelContext(n));Lo(i,o,e);const a=Si(o.font),{x:r,y:l,textAlign:h}=e;Ne(i,t._pointLabels[n],r,l+a.lineHeight/2,a,{color:o.color,textAlign:h,textBaseline:"middle"})}}(this,o),s.display&&this.ticks.forEach(((t,e)=>{if(0!==e||0===e&&this.min<0){r=this.getDistanceFromCenterForValue(t.value);const i=this.getContext(e),a=s.setContext(i),l=n.setContext(i);!function(t,e,i,s,n){const o=t.ctx,a=e.circular,{color:r,lineWidth:l}=e;!a&&!s||!r||!l||i<0||(o.save(),o.strokeStyle=r,o.lineWidth=l,o.setLineDash(n.dash||[]),o.lineDashOffset=n.dashOffset,o.beginPath(),Eo(t,i,a,s),o.closePath(),o.stroke(),o.restore())}(this,a,r,o,l)}})),i.display){for(t.save(),a=o-1;a>=0;a--){const s=i.setContext(this.getPointLabelContext(a)),{color:n,lineWidth:o}=s;o&&n&&(t.lineWidth=o,t.strokeStyle=n,t.setLineDash(s.borderDash),t.lineDashOffset=s.borderDashOffset,r=this.getDistanceFromCenterForValue(e.reverse?this.min:this.max),l=this.getPointPosition(a,r),t.beginPath(),t.moveTo(this.xCenter,this.yCenter),t.lineTo(l.x,l.y),t.stroke())}t.restore()}}drawBorder(){}drawLabels(){const t=this.ctx,e=this.options,i=e.ticks;if(!i.display)return;const s=this.getIndexAngle(0);let n,o;t.save(),t.translate(this.xCenter,this.yCenter),t.rotate(s),t.textAlign="center",t.textBaseline="middle",this.ticks.forEach(((s,a)=>{if(0===a&&this.min>=0&&!e.reverse)return;const r=i.setContext(this.getContext(a)),l=Si(r.font);if(n=this.getDistanceFromCenterForValue(this.ticks[a].value),r.showLabelBackdrop){t.font=l.string,o=t.measureText(s.label).width,t.fillStyle=r.backdropColor;const e=ki(r.backdropPadding);t.fillRect(-o/2-e.left,-n-l.size/2-e.top,o+e.width,l.size+e.height)}Ne(t,s.label,0,-n,l,{color:r.color,strokeColor:r.textStrokeColor,strokeWidth:r.textStrokeWidth})})),t.restore()}drawTitle(){}}const Io={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},zo=Object.keys(Io);function Fo(t,e){return t-e}function Vo(t,e){if(s(e))return null;const i=t._adapter,{parser:n,round:o,isoWeekday:r}=t._parseOpts;let l=e;return"function"==typeof n&&(l=n(l)),a(l)||(l="string"==typeof n?i.parse(l,n):i.parse(l)),null===l?null:(o&&(l="week"!==o||!N(r)&&!0!==r?i.startOf(l,o):i.startOf(l,"isoWeek",r)),+l)}function Bo(t,e,i,s){const n=zo.length;for(let o=zo.indexOf(t);o=e?i[s]:i[n]]=!0}}else t[e]=!0}function No(t,e,i){const s=[],n={},o=e.length;let a,r;for(a=0;a=0&&(e[l].major=!0);return e}(t,s,n,i):s}class Ho extends tn{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,e={}){const i=t.time||(t.time={}),s=this._adapter=new In._date(t.adapters.date);s.init(e),b(i.displayFormats,s.formats()),this._parseOpts={parser:i.parser,round:i.round,isoWeekday:i.isoWeekday},super.init(t),this._normalized=e.normalized}parse(t,e){return void 0===t?null:Vo(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,e=this._adapter,i=t.time.unit||"day";let{min:s,max:n,minDefined:o,maxDefined:r}=this.getUserBounds();function l(t){o||isNaN(t.min)||(s=Math.min(s,t.min)),r||isNaN(t.max)||(n=Math.max(n,t.max))}o&&r||(l(this._getLabelBounds()),"ticks"===t.bounds&&"labels"===t.ticks.source||l(this.getMinMax(!1))),s=a(s)&&!isNaN(s)?s:+e.startOf(Date.now(),i),n=a(n)&&!isNaN(n)?n:+e.endOf(Date.now(),i)+1,this.min=Math.min(s,n-1),this.max=Math.max(s+1,n)}_getLabelBounds(){const t=this.getLabelTimestamps();let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;return t.length&&(e=t[0],i=t[t.length-1]),{min:e,max:i}}buildTicks(){const t=this.options,e=t.time,i=t.ticks,s="labels"===i.source?this.getLabelTimestamps():this._generate();"ticks"===t.bounds&&s.length&&(this.min=this._userMin||s[0],this.max=this._userMax||s[s.length-1]);const n=this.min,o=nt(s,n,this.max);return this._unit=e.unit||(i.autoSkip?Bo(e.minUnit,this.min,this.max,this._getLabelCapacity(n)):function(t,e,i,s,n){for(let o=zo.length-1;o>=zo.indexOf(i);o--){const i=zo[o];if(Io[i].common&&t._adapter.diff(n,s,i)>=e-1)return i}return zo[i?zo.indexOf(i):0]}(this,o.length,e.minUnit,this.min,this.max)),this._majorUnit=i.major.enabled&&"year"!==this._unit?function(t){for(let e=zo.indexOf(t)+1,i=zo.length;e+t.value)))}initOffsets(t=[]){let e,i,s=0,n=0;this.options.offset&&t.length&&(e=this.getDecimalForValue(t[0]),s=1===t.length?1-e:(this.getDecimalForValue(t[1])-e)/2,i=this.getDecimalForValue(t[t.length-1]),n=1===t.length?i:(i-this.getDecimalForValue(t[t.length-2]))/2);const o=t.length<3?.5:.25;s=Z(s,0,o),n=Z(n,0,o),this._offsets={start:s,end:n,factor:1/(s+1+n)}}_generate(){const t=this._adapter,e=this.min,i=this.max,s=this.options,n=s.time,o=n.unit||Bo(n.minUnit,e,i,this._getLabelCapacity(e)),a=l(s.ticks.stepSize,1),r="week"===o&&n.isoWeekday,h=N(r)||!0===r,c={};let d,u,f=e;if(h&&(f=+t.startOf(f,"isoWeek",r)),f=+t.startOf(f,h?"day":o),t.diff(i,e,o)>1e5*a)throw new Error(e+" and "+i+" are too far apart with stepSize of "+a+" "+o);const g="data"===s.ticks.source&&this.getDataTimestamps();for(d=f,u=0;d+t))}getLabelForValue(t){const e=this._adapter,i=this.options.time;return i.tooltipFormat?e.format(t,i.tooltipFormat):e.format(t,i.displayFormats.datetime)}format(t,e){const i=this.options.time.displayFormats,s=this._unit,n=e||i[s];return this._adapter.format(t,n)}_tickFormatFunction(t,e,i,s){const n=this.options,o=n.ticks.callback;if(o)return d(o,[t,e,i],this);const a=n.time.displayFormats,r=this._unit,l=this._majorUnit,h=r&&a[r],c=l&&a[l],u=i[e],f=l&&c&&u&&u.major;return this._adapter.format(t,s||(f?c:h))}generateTickLabels(t){let e,i,s;for(e=0,i=t.length;e0?a:1}getDataTimestamps(){let t,e,i=this._cache.data||[];if(i.length)return i;const s=this.getMatchingVisibleMetas();if(this._normalized&&s.length)return this._cache.data=s[0].controller.getAllParsedValues(this);for(t=0,e=s.length;t=t[r].pos&&e<=t[l].pos&&({lo:r,hi:l}=it(t,"pos",e)),({pos:s,time:o}=t[r]),({pos:n,time:a}=t[l])):(e>=t[r].time&&e<=t[l].time&&({lo:r,hi:l}=it(t,"time",e)),({time:s,pos:o}=t[r]),({time:n,pos:a}=t[l]));const h=n-s;return h?o+(a-o)*(e-s)/h:o}var $o=Object.freeze({__proto__:null,CategoryScale:class extends tn{static id="category";static defaults={ticks:{callback:mo}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const e=this._addedLabels;if(e.length){const t=this.getLabels();for(const{index:i,label:s}of e)t[i]===s&&t.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,e){if(s(t))return null;const i=this.getLabels();return((t,e)=>null===t?null:Z(Math.round(t),0,e))(e=isFinite(e)&&i[e]===t?e:po(i,t,l(e,t),this._addedLabels),i.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:e}=this.getUserBounds();let{min:i,max:s}=this.getMinMax(!0);"ticks"===this.options.bounds&&(t||(i=0),e||(s=this.getLabels().length-1)),this.min=i,this.max=s}buildTicks(){const t=this.min,e=this.max,i=this.options.offset,s=[];let n=this.getLabels();n=0===t&&e===n.length-1?n:n.slice(t,e+1),this._valueRange=Math.max(n.length-(i?0:1),1),this._startValue=this.min-(i?.5:0);for(let i=t;i<=e;i++)s.push({value:i});return s}getLabelForValue(t){return mo.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return"number"!=typeof t&&(t=this.parse(t)),null===t?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}},LinearScale:_o,LogarithmicScale:So,RadialLinearScale:Ro,TimeScale:Ho,TimeSeriesScale:class extends Ho{static id="timeseries";static defaults=Ho.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),e=this._table=this.buildLookupTable(t);this._minPos=jo(e,this.min),this._tableRange=jo(e,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:e,max:i}=this,s=[],n=[];let o,a,r,l,h;for(o=0,a=t.length;o=e&&l<=i&&s.push(l);if(s.length<2)return[{time:e,pos:0},{time:i,pos:1}];for(o=0,a=s.length;ot-e))}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const e=this.getDataTimestamps(),i=this.getLabelTimestamps();return t=e.length&&i.length?this.normalize(e.concat(i)):e.length?e:i,t=this._cache.all=t,t}getDecimalForValue(t){return(jo(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const e=this._offsets,i=this.getDecimalForPixel(t)/e.factor-e.end;return jo(this._table,i*this._tableRange+this._minPos,!0)}}});const Yo=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],Uo=Yo.map((t=>t.replace("rgb(","rgba(").replace(")",", 0.5)")));function Xo(t){return Yo[t%Yo.length]}function qo(t){return Uo[t%Uo.length]}function Ko(t){let e=0;return(i,s)=>{const n=t.getDatasetMeta(s).controller;n instanceof $n?e=function(t,e){return t.backgroundColor=t.data.map((()=>Xo(e++))),e}(i,e):n instanceof Yn?e=function(t,e){return t.backgroundColor=t.data.map((()=>qo(e++))),e}(i,e):n&&(e=function(t,e){return t.borderColor=Xo(e),t.backgroundColor=qo(e),++e}(i,e))}}function Go(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}var Jo={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,i){if(!i.enabled)return;const{data:{datasets:s},options:n}=t.config,{elements:o}=n,a=Go(s)||(r=n)&&(r.borderColor||r.backgroundColor)||o&&Go(o)||"rgba(0,0,0,0.1)"!==ue.borderColor||"rgba(0,0,0,0.1)"!==ue.backgroundColor;var r;if(!i.forceOverride&&a)return;const l=Ko(t);s.forEach(l)}};function Zo(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function Qo(t){t.data.datasets.forEach((t=>{Zo(t)}))}var ta={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,i)=>{if(!i.enabled)return void Qo(t);const n=t.width;t.data.datasets.forEach(((e,o)=>{const{_data:a,indexAxis:r}=e,l=t.getDatasetMeta(o),h=a||e.data;if("y"===Pi([r,t.options.indexAxis]))return;if(!l.controller.supportsDecimation)return;const c=t.scales[l.xAxisID];if("linear"!==c.type&&"time"!==c.type)return;if(t.options.parsing)return;let{start:d,count:u}=function(t,e){const i=e.length;let s,n=0;const{iScale:o}=t,{min:a,max:r,minDefined:l,maxDefined:h}=o.getUserBounds();return l&&(n=Z(it(e,o.axis,a).lo,0,i-1)),s=h?Z(it(e,o.axis,r).hi+1,n,i)-n:i-n,{start:n,count:s}}(l,h);if(u<=(i.threshold||4*n))return void Zo(e);let f;switch(s(a)&&(e._data=h,delete e.data,Object.defineProperty(e,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(t){this._data=t}})),i.algorithm){case"lttb":f=function(t,e,i,s,n){const o=n.samples||s;if(o>=i)return t.slice(e,e+i);const a=[],r=(i-2)/(o-2);let l=0;const h=e+i-1;let c,d,u,f,g,p=e;for(a[l++]=t[p],c=0;cu&&(u=f,d=t[s],g=s);a[l++]=d,p=g}return a[l++]=t[h],a}(h,d,u,n,i);break;case"min-max":f=function(t,e,i,n){let o,a,r,l,h,c,d,u,f,g,p=0,m=0;const x=[],b=e+i-1,_=t[e].x,y=t[b].x-_;for(o=e;og&&(g=l,d=o),p=(m*p+a.x)/++m;else{const i=o-1;if(!s(c)&&!s(d)){const e=Math.min(c,d),s=Math.max(c,d);e!==u&&e!==i&&x.push({...t[e],x:p}),s!==u&&s!==i&&x.push({...t[s],x:p})}o>0&&i!==u&&x.push(t[i]),x.push(a),h=e,m=0,f=g=l,c=d=u=o}}return x}(h,d,u,n);break;default:throw new Error(`Unsupported decimation algorithm '${i.algorithm}'`)}e._decimated=f}))},destroy(t){Qo(t)}};function ea(t,e,i,s){if(s)return;let n=e[t],o=i[t];return"angle"===t&&(n=G(n),o=G(o)),{property:t,start:n,end:o}}function ia(t,e,i){for(;e>t;e--){const t=i[e];if(!isNaN(t.x)&&!isNaN(t.y))break}return e}function sa(t,e,i,s){return t&&e?s(t[i],e[i]):t?t[i]:e?e[i]:0}function na(t,e){let i=[],s=!1;return n(t)?(s=!0,i=t):i=function(t,e){const{x:i=null,y:s=null}=t||{},n=e.points,o=[];return e.segments.forEach((({start:t,end:e})=>{e=ia(t,e,n);const a=n[t],r=n[e];null!==s?(o.push({x:a.x,y:s}),o.push({x:r.x,y:s})):null!==i&&(o.push({x:i,y:a.y}),o.push({x:i,y:r.y}))})),o}(t,e),i.length?new oo({points:i,options:{tension:0},_loop:s,_fullLoop:s}):null}function oa(t){return t&&!1!==t.fill}function aa(t,e,i){let s=t[e].fill;const n=[e];let o;if(!i)return s;for(;!1!==s&&-1===n.indexOf(s);){if(!a(s))return s;if(o=t[s],!o)return!1;if(o.visible)return s;n.push(s),s=o.fill}return!1}function ra(t,e,i){const s=function(t){const e=t.options,i=e.fill;let s=l(i&&i.target,i);void 0===s&&(s=!!e.backgroundColor);if(!1===s||null===s)return!1;if(!0===s)return"origin";return s}(t);if(o(s))return!isNaN(s.value)&&s;let n=parseFloat(s);return a(n)&&Math.floor(n)===n?function(t,e,i,s){"-"!==t&&"+"!==t||(i=e+i);if(i===e||i<0||i>=s)return!1;return i}(s[0],e,n,i):["origin","start","end","stack","shape"].indexOf(s)>=0&&s}function la(t,e,i){const s=[];for(let n=0;n=0;--e){const i=n[e].$filler;i&&(i.line.updateControlPoints(o,i.axis),s&&i.fill&&ua(t.ctx,i,o))}},beforeDatasetsDraw(t,e,i){if("beforeDatasetsDraw"!==i.drawTime)return;const s=t.getSortedVisibleDatasetMetas();for(let e=s.length-1;e>=0;--e){const i=s[e].$filler;oa(i)&&ua(t.ctx,i,t.chartArea)}},beforeDatasetDraw(t,e,i){const s=e.meta.$filler;oa(s)&&"beforeDatasetDraw"===i.drawTime&&ua(t.ctx,s,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const _a=(t,e)=>{let{boxHeight:i=e,boxWidth:s=e}=t;return t.usePointStyle&&(i=Math.min(i,e),s=t.pointStyleWidth||Math.min(s,e)),{boxWidth:s,boxHeight:i,itemHeight:Math.max(e,i)}};class ya extends $s{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e,i){this.maxWidth=t,this.maxHeight=e,this._margins=i,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const t=this.options.labels||{};let e=d(t.generateLabels,[this.chart],this)||[];t.filter&&(e=e.filter((e=>t.filter(e,this.chart.data)))),t.sort&&(e=e.sort(((e,i)=>t.sort(e,i,this.chart.data)))),this.options.reverse&&e.reverse(),this.legendItems=e}fit(){const{options:t,ctx:e}=this;if(!t.display)return void(this.width=this.height=0);const i=t.labels,s=Si(i.font),n=s.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:r}=_a(i,n);let l,h;e.font=s.string,this.isHorizontal()?(l=this.maxWidth,h=this._fitRows(o,n,a,r)+10):(h=this.maxHeight,l=this._fitCols(o,s,a,r)+10),this.width=Math.min(l,t.maxWidth||this.maxWidth),this.height=Math.min(h,t.maxHeight||this.maxHeight)}_fitRows(t,e,i,s){const{ctx:n,maxWidth:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.lineWidths=[0],h=s+a;let c=t;n.textAlign="left",n.textBaseline="middle";let d=-1,u=-h;return this.legendItems.forEach(((t,f)=>{const g=i+e/2+n.measureText(t.text).width;(0===f||l[l.length-1]+g+2*a>o)&&(c+=h,l[l.length-(f>0?0:1)]=0,u+=h,d++),r[f]={left:0,top:u,row:d,width:g,height:s},l[l.length-1]+=g+a})),c}_fitCols(t,e,i,s){const{ctx:n,maxHeight:o,options:{labels:{padding:a}}}=this,r=this.legendHitBoxes=[],l=this.columnSizes=[],h=o-t;let c=a,d=0,u=0,f=0,g=0;return this.legendItems.forEach(((t,o)=>{const{itemWidth:p,itemHeight:m}=function(t,e,i,s,n){const o=function(t,e,i,s){let n=t.text;n&&"string"!=typeof n&&(n=n.reduce(((t,e)=>t.length>e.length?t:e)));return e+i.size/2+s.measureText(n).width}(s,t,e,i),a=function(t,e,i){let s=t;"string"!=typeof e.text&&(s=va(e,i));return s}(n,s,e.lineHeight);return{itemWidth:o,itemHeight:a}}(i,e,n,t,s);o>0&&u+m+2*a>h&&(c+=d+a,l.push({width:d,height:u}),f+=d+a,g++,d=u=0),r[o]={left:f,top:u,col:g,width:p,height:m},d=Math.max(d,p),u+=m+a})),c+=d,l.push({width:d,height:u}),c}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:e,options:{align:i,labels:{padding:s},rtl:n}}=this,o=Oi(n,this.left,this.width);if(this.isHorizontal()){let n=0,a=ft(i,this.left+s,this.right-this.lineWidths[n]);for(const r of e)n!==r.row&&(n=r.row,a=ft(i,this.left+s,this.right-this.lineWidths[n])),r.top+=this.top+t+s,r.left=o.leftForLtr(o.x(a),r.width),a+=r.width+s}else{let n=0,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height);for(const r of e)r.col!==n&&(n=r.col,a=ft(i,this.top+t+s,this.bottom-this.columnSizes[n].height)),r.top=a,r.left+=this.left+s,r.left=o.leftForLtr(o.x(r.left),r.width),a+=r.height+s}}isHorizontal(){return"top"===this.options.position||"bottom"===this.options.position}draw(){if(this.options.display){const t=this.ctx;Ie(t,this),this._draw(),ze(t)}}_draw(){const{options:t,columnSizes:e,lineWidths:i,ctx:s}=this,{align:n,labels:o}=t,a=ue.color,r=Oi(t.rtl,this.left,this.width),h=Si(o.font),{padding:c}=o,d=h.size,u=d/2;let f;this.drawTitle(),s.textAlign=r.textAlign("left"),s.textBaseline="middle",s.lineWidth=.5,s.font=h.string;const{boxWidth:g,boxHeight:p,itemHeight:m}=_a(o,d),x=this.isHorizontal(),b=this._computeTitleHeight();f=x?{x:ft(n,this.left+c,this.right-i[0]),y:this.top+c+b,line:0}:{x:this.left+c,y:ft(n,this.top+b+c,this.bottom-e[0].height),line:0},Ai(this.ctx,t.textDirection);const _=m+c;this.legendItems.forEach(((y,v)=>{s.strokeStyle=y.fontColor,s.fillStyle=y.fontColor;const M=s.measureText(y.text).width,w=r.textAlign(y.textAlign||(y.textAlign=o.textAlign)),k=g+u+M;let S=f.x,P=f.y;r.setWidth(this.width),x?v>0&&S+k+c>this.right&&(P=f.y+=_,f.line++,S=f.x=ft(n,this.left+c,this.right-i[f.line])):v>0&&P+_>this.bottom&&(S=f.x=S+e[f.line].width+c,f.line++,P=f.y=ft(n,this.top+b+c,this.bottom-e[f.line].height));if(function(t,e,i){if(isNaN(g)||g<=0||isNaN(p)||p<0)return;s.save();const n=l(i.lineWidth,1);if(s.fillStyle=l(i.fillStyle,a),s.lineCap=l(i.lineCap,"butt"),s.lineDashOffset=l(i.lineDashOffset,0),s.lineJoin=l(i.lineJoin,"miter"),s.lineWidth=n,s.strokeStyle=l(i.strokeStyle,a),s.setLineDash(l(i.lineDash,[])),o.usePointStyle){const a={radius:p*Math.SQRT2/2,pointStyle:i.pointStyle,rotation:i.rotation,borderWidth:n},l=r.xPlus(t,g/2);Ee(s,a,l,e+u,o.pointStyleWidth&&g)}else{const o=e+Math.max((d-p)/2,0),a=r.leftForLtr(t,g),l=wi(i.borderRadius);s.beginPath(),Object.values(l).some((t=>0!==t))?He(s,{x:a,y:o,w:g,h:p,radius:l}):s.rect(a,o,g,p),s.fill(),0!==n&&s.stroke()}s.restore()}(r.x(S),P,y),S=gt(w,S+g+u,x?S+k:this.right,t.rtl),function(t,e,i){Ne(s,i.text,t,e+m/2,h,{strikethrough:i.hidden,textAlign:r.textAlign(i.textAlign)})}(r.x(S),P,y),x)f.x+=k+c;else if("string"!=typeof y.text){const t=h.lineHeight;f.y+=va(y,t)+c}else f.y+=_})),Ti(this.ctx,t.textDirection)}drawTitle(){const t=this.options,e=t.title,i=Si(e.font),s=ki(e.padding);if(!e.display)return;const n=Oi(t.rtl,this.left,this.width),o=this.ctx,a=e.position,r=i.size/2,l=s.top+r;let h,c=this.left,d=this.width;if(this.isHorizontal())d=Math.max(...this.lineWidths),h=this.top+l,c=ft(t.align,c,this.right-d);else{const e=this.columnSizes.reduce(((t,e)=>Math.max(t,e.height)),0);h=l+ft(t.align,this.top,this.bottom-e-t.labels.padding-this._computeTitleHeight())}const u=ft(a,c,c+d);o.textAlign=n.textAlign(ut(a)),o.textBaseline="middle",o.strokeStyle=e.color,o.fillStyle=e.color,o.font=i.string,Ne(o,e.text,u,h,i)}_computeTitleHeight(){const t=this.options.title,e=Si(t.font),i=ki(t.padding);return t.display?e.lineHeight+i.height:0}_getLegendItemAt(t,e){let i,s,n;if(tt(t,this.left,this.right)&&tt(e,this.top,this.bottom))for(n=this.legendHitBoxes,i=0;it.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:i,pointStyle:s,textAlign:n,color:o,useBorderRadius:a,borderRadius:r}}=t.legend.options;return t._getSortedDatasetMetas().map((t=>{const l=t.controller.getStyle(i?0:void 0),h=ki(l.borderWidth);return{text:e[t.index].label,fillStyle:l.backgroundColor,fontColor:o,hidden:!t.visible,lineCap:l.borderCapStyle,lineDash:l.borderDash,lineDashOffset:l.borderDashOffset,lineJoin:l.borderJoinStyle,lineWidth:(h.width+h.height)/4,strokeStyle:l.borderColor,pointStyle:s||l.pointStyle,rotation:l.rotation,textAlign:n||l.textAlign,borderRadius:a&&(r||l.borderRadius),datasetIndex:t.index}}),this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class wa extends $s{constructor(t){super(),this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,e){const i=this.options;if(this.left=0,this.top=0,!i.display)return void(this.width=this.height=this.right=this.bottom=0);this.width=this.right=t,this.height=this.bottom=e;const s=n(i.text)?i.text.length:1;this._padding=ki(i.padding);const o=s*Si(i.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=o:this.width=o}isHorizontal(){const t=this.options.position;return"top"===t||"bottom"===t}_drawArgs(t){const{top:e,left:i,bottom:s,right:n,options:o}=this,a=o.align;let r,l,h,c=0;return this.isHorizontal()?(l=ft(a,i,n),h=e+t,r=n-i):("left"===o.position?(l=i+t,h=ft(a,s,e),c=-.5*C):(l=n-t,h=ft(a,e,s),c=.5*C),r=s-e),{titleX:l,titleY:h,maxWidth:r,rotation:c}}draw(){const t=this.ctx,e=this.options;if(!e.display)return;const i=Si(e.font),s=i.lineHeight/2+this._padding.top,{titleX:n,titleY:o,maxWidth:a,rotation:r}=this._drawArgs(s);Ne(t,e.text,0,0,i,{color:e.color,maxWidth:a,rotation:r,textAlign:ut(e.align),textBaseline:"middle",translation:[n,o]})}}var ka={id:"title",_element:wa,start(t,e,i){!function(t,e){const i=new wa({ctx:t.ctx,options:e,chart:t});ls.configure(t,i,e),ls.addBox(t,i),t.titleBlock=i}(t,i)},stop(t){const e=t.titleBlock;ls.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,i){const s=t.titleBlock;ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Sa=new WeakMap;var Pa={id:"subtitle",start(t,e,i){const s=new wa({ctx:t.ctx,options:i,chart:t});ls.configure(t,s,i),ls.addBox(t,s),Sa.set(t,s)},stop(t){ls.removeBox(t,Sa.get(t)),Sa.delete(t)},beforeUpdate(t,e,i){const s=Sa.get(t);ls.configure(t,s,i),s.options=i},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Da={average(t){if(!t.length)return!1;let e,i,s=new Set,n=0,o=0;for(e=0,i=t.length;et+e))/s.size,y:n/o}},nearest(t,e){if(!t.length)return!1;let i,s,n,o=e.x,a=e.y,r=Number.POSITIVE_INFINITY;for(i=0,s=t.length;i-1?t.split("\n"):t}function Aa(t,e){const{element:i,datasetIndex:s,index:n}=e,o=t.getDatasetMeta(s).controller,{label:a,value:r}=o.getLabelAndValue(n);return{chart:t,label:a,parsed:o.getParsed(n),raw:t.data.datasets[s].data[n],formattedValue:r,dataset:o.getDataset(),dataIndex:n,datasetIndex:s,element:i}}function Ta(t,e){const i=t.chart.ctx,{body:s,footer:n,title:o}=t,{boxWidth:a,boxHeight:r}=e,l=Si(e.bodyFont),h=Si(e.titleFont),c=Si(e.footerFont),d=o.length,f=n.length,g=s.length,p=ki(e.padding);let m=p.height,x=0,b=s.reduce(((t,e)=>t+e.before.length+e.lines.length+e.after.length),0);if(b+=t.beforeBody.length+t.afterBody.length,d&&(m+=d*h.lineHeight+(d-1)*e.titleSpacing+e.titleMarginBottom),b){m+=g*(e.displayColors?Math.max(r,l.lineHeight):l.lineHeight)+(b-g)*l.lineHeight+(b-1)*e.bodySpacing}f&&(m+=e.footerMarginTop+f*c.lineHeight+(f-1)*e.footerSpacing);let _=0;const y=function(t){x=Math.max(x,i.measureText(t).width+_)};return i.save(),i.font=h.string,u(t.title,y),i.font=l.string,u(t.beforeBody.concat(t.afterBody),y),_=e.displayColors?a+2+e.boxPadding:0,u(s,(t=>{u(t.before,y),u(t.lines,y),u(t.after,y)})),_=0,i.font=c.string,u(t.footer,y),i.restore(),x+=p.width,{width:x,height:m}}function La(t,e,i,s){const{x:n,width:o}=i,{width:a,chartArea:{left:r,right:l}}=t;let h="center";return"center"===s?h=n<=(r+l)/2?"left":"right":n<=o/2?h="left":n>=a-o/2&&(h="right"),function(t,e,i,s){const{x:n,width:o}=s,a=i.caretSize+i.caretPadding;return"left"===t&&n+o+a>e.width||"right"===t&&n-o-a<0||void 0}(h,t,e,i)&&(h="center"),h}function Ea(t,e,i){const s=i.yAlign||e.yAlign||function(t,e){const{y:i,height:s}=e;return it.height-s/2?"bottom":"center"}(t,i);return{xAlign:i.xAlign||e.xAlign||La(t,e,i,s),yAlign:s}}function Ra(t,e,i,s){const{caretSize:n,caretPadding:o,cornerRadius:a}=t,{xAlign:r,yAlign:l}=i,h=n+o,{topLeft:c,topRight:d,bottomLeft:u,bottomRight:f}=wi(a);let g=function(t,e){let{x:i,width:s}=t;return"right"===e?i-=s:"center"===e&&(i-=s/2),i}(e,r);const p=function(t,e,i){let{y:s,height:n}=t;return"top"===e?s+=i:s-="bottom"===e?n+i:n/2,s}(e,l,h);return"center"===l?"left"===r?g+=h:"right"===r&&(g-=h):"left"===r?g-=Math.max(c,u)+n:"right"===r&&(g+=Math.max(d,f)+n),{x:Z(g,0,s.width-e.width),y:Z(p,0,s.height-e.height)}}function Ia(t,e,i){const s=ki(i.padding);return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-s.right:t.x+s.left}function za(t){return Ca([],Oa(t))}function Fa(t,e){const i=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return i?t.override(i):t}const Va={beforeTitle:e,title(t){if(t.length>0){const e=t[0],i=e.chart.data.labels,s=i?i.length:0;if(this&&this.options&&"dataset"===this.options.mode)return e.dataset.label||"";if(e.label)return e.label;if(s>0&&e.dataIndex{const e={before:[],lines:[],after:[]},n=Fa(i,t);Ca(e.before,Oa(Ba(n,"beforeLabel",this,t))),Ca(e.lines,Ba(n,"label",this,t)),Ca(e.after,Oa(Ba(n,"afterLabel",this,t))),s.push(e)})),s}getAfterBody(t,e){return za(Ba(e.callbacks,"afterBody",this,t))}getFooter(t,e){const{callbacks:i}=e,s=Ba(i,"beforeFooter",this,t),n=Ba(i,"footer",this,t),o=Ba(i,"afterFooter",this,t);let a=[];return a=Ca(a,Oa(s)),a=Ca(a,Oa(n)),a=Ca(a,Oa(o)),a}_createItems(t){const e=this._active,i=this.chart.data,s=[],n=[],o=[];let a,r,l=[];for(a=0,r=e.length;at.filter(e,s,n,i)))),t.itemSort&&(l=l.sort(((e,s)=>t.itemSort(e,s,i)))),u(l,(e=>{const i=Fa(t.callbacks,e);s.push(Ba(i,"labelColor",this,e)),n.push(Ba(i,"labelPointStyle",this,e)),o.push(Ba(i,"labelTextColor",this,e))})),this.labelColors=s,this.labelPointStyles=n,this.labelTextColors=o,this.dataPoints=l,l}update(t,e){const i=this.options.setContext(this.getContext()),s=this._active;let n,o=[];if(s.length){const t=Da[i.position].call(this,s,this._eventPosition);o=this._createItems(i),this.title=this.getTitle(o,i),this.beforeBody=this.getBeforeBody(o,i),this.body=this.getBody(o,i),this.afterBody=this.getAfterBody(o,i),this.footer=this.getFooter(o,i);const e=this._size=Ta(this,i),a=Object.assign({},t,e),r=Ea(this.chart,i,a),l=Ra(i,a,r,this.chart);this.xAlign=r.xAlign,this.yAlign=r.yAlign,n={opacity:1,x:l.x,y:l.y,width:e.width,height:e.height,caretX:t.x,caretY:t.y}}else 0!==this.opacity&&(n={opacity:0});this._tooltipItems=o,this.$context=void 0,n&&this._resolveAnimations().update(this,n),t&&i.external&&i.external.call(this,{chart:this.chart,tooltip:this,replay:e})}drawCaret(t,e,i,s){const n=this.getCaretPosition(t,i,s);e.lineTo(n.x1,n.y1),e.lineTo(n.x2,n.y2),e.lineTo(n.x3,n.y3)}getCaretPosition(t,e,i){const{xAlign:s,yAlign:n}=this,{caretSize:o,cornerRadius:a}=i,{topLeft:r,topRight:l,bottomLeft:h,bottomRight:c}=wi(a),{x:d,y:u}=t,{width:f,height:g}=e;let p,m,x,b,_,y;return"center"===n?(_=u+g/2,"left"===s?(p=d,m=p-o,b=_+o,y=_-o):(p=d+f,m=p+o,b=_-o,y=_+o),x=p):(m="left"===s?d+Math.max(r,h)+o:"right"===s?d+f-Math.max(l,c)-o:this.caretX,"top"===n?(b=u,_=b-o,p=m-o,x=m+o):(b=u+g,_=b+o,p=m+o,x=m-o),y=b),{x1:p,x2:m,x3:x,y1:b,y2:_,y3:y}}drawTitle(t,e,i){const s=this.title,n=s.length;let o,a,r;if(n){const l=Oi(i.rtl,this.x,this.width);for(t.x=Ia(this,i.titleAlign,i),e.textAlign=l.textAlign(i.titleAlign),e.textBaseline="middle",o=Si(i.titleFont),a=i.titleSpacing,e.fillStyle=i.titleColor,e.font=o.string,r=0;r0!==t))?(t.beginPath(),t.fillStyle=n.multiKeyBackground,He(t,{x:e,y:g,w:h,h:l,radius:r}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),He(t,{x:i,y:g+1,w:h-2,h:l-2,radius:r}),t.fill()):(t.fillStyle=n.multiKeyBackground,t.fillRect(e,g,h,l),t.strokeRect(e,g,h,l),t.fillStyle=a.backgroundColor,t.fillRect(i,g+1,h-2,l-2))}t.fillStyle=this.labelTextColors[i]}drawBody(t,e,i){const{body:s}=this,{bodySpacing:n,bodyAlign:o,displayColors:a,boxHeight:r,boxWidth:l,boxPadding:h}=i,c=Si(i.bodyFont);let d=c.lineHeight,f=0;const g=Oi(i.rtl,this.x,this.width),p=function(i){e.fillText(i,g.x(t.x+f),t.y+d/2),t.y+=d+n},m=g.textAlign(o);let x,b,_,y,v,M,w;for(e.textAlign=o,e.textBaseline="middle",e.font=c.string,t.x=Ia(this,m,i),e.fillStyle=i.bodyColor,u(this.beforeBody,p),f=a&&"right"!==m?"center"===o?l/2+h:l+2+h:0,y=0,M=s.length;y0&&e.stroke()}_updateAnimationTarget(t){const e=this.chart,i=this.$animations,s=i&&i.x,n=i&&i.y;if(s||n){const i=Da[t.position].call(this,this._active,this._eventPosition);if(!i)return;const o=this._size=Ta(this,t),a=Object.assign({},i,this._size),r=Ea(e,t,a),l=Ra(t,a,r,e);s._to===l.x&&n._to===l.y||(this.xAlign=r.xAlign,this.yAlign=r.yAlign,this.width=o.width,this.height=o.height,this.caretX=i.x,this.caretY=i.y,this._resolveAnimations().update(this,l))}}_willRender(){return!!this.opacity}draw(t){const e=this.options.setContext(this.getContext());let i=this.opacity;if(!i)return;this._updateAnimationTarget(e);const s={width:this.width,height:this.height},n={x:this.x,y:this.y};i=Math.abs(i)<.001?0:i;const o=ki(e.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;e.enabled&&a&&(t.save(),t.globalAlpha=i,this.drawBackground(n,t,s,e),Ai(t,e.textDirection),n.y+=o.top,this.drawTitle(n,t,e),this.drawBody(n,t,e),this.drawFooter(n,t,e),Ti(t,e.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,e){const i=this._active,s=t.map((({datasetIndex:t,index:e})=>{const i=this.chart.getDatasetMeta(t);if(!i)throw new Error("Cannot find a dataset at index "+t);return{datasetIndex:t,element:i.data[e],index:e}})),n=!f(i,s),o=this._positionChanged(s,e);(n||o)&&(this._active=s,this._eventPosition=e,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,e,i=!0){if(e&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const s=this.options,n=this._active||[],o=this._getActiveElements(t,n,e,i),a=this._positionChanged(o,t),r=e||!f(o,n)||a;return r&&(this._active=o,(s.enabled||s.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,e))),r}_getActiveElements(t,e,i,s){const n=this.options;if("mouseout"===t.type)return[];if(!s)return e.filter((t=>this.chart.data.datasets[t.datasetIndex]&&void 0!==this.chart.getDatasetMeta(t.datasetIndex).controller.getParsed(t.index)));const o=this.chart.getElementsAtEventForMode(t,n.mode,n,i);return n.reverse&&o.reverse(),o}_positionChanged(t,e){const{caretX:i,caretY:s,options:n}=this,o=Da[n.position].call(this,t,e);return!1!==o&&(i!==o.x||s!==o.y)}}var Na={id:"tooltip",_element:Wa,positioners:Da,afterInit(t,e,i){i&&(t.tooltip=new Wa({chart:t,options:i}))},beforeUpdate(t,e,i){t.tooltip&&t.tooltip.initialize(i)},reset(t,e,i){t.tooltip&&t.tooltip.initialize(i)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const i={tooltip:e};if(!1===t.notifyPlugins("beforeTooltipDraw",{...i,cancelable:!0}))return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",i)}},afterEvent(t,e){if(t.tooltip){const i=e.replay;t.tooltip.handleEvent(e.event,i,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:Va},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>"filter"!==t&&"itemSort"!==t&&"external"!==t,_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};return Tn.register(Un,$o,go,t),Tn.helpers={...Hi},Tn._adapters=In,Tn.Animation=As,Tn.Animations=Ts,Tn.animator=bt,Tn.controllers=nn.controllers.items,Tn.DatasetController=js,Tn.Element=$s,Tn.elements=go,Tn.Interaction=Ki,Tn.layouts=ls,Tn.platforms=Ds,Tn.Scale=tn,Tn.Ticks=ae,Object.assign(Tn,Un,$o,go,t,Ds),Tn.Chart=Tn,"undefined"!=typeof window&&(window.Chart=Tn),Tn})); +//# sourceMappingURL=chart.umd.min.js.map diff --git a/wp-content/plugins/compressx/includes/display_v2/js/compressx_bulk.js b/wp-content/plugins/compressx/includes/display_v2/js/compressx_bulk.js new file mode 100644 index 0000000..3327cf3 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/compressx_bulk.js @@ -0,0 +1,691 @@ +var cx_cancel_bulk_optimization=false; +var cx_pause_bulk_optimization=false; +var cx_bulk_task_running = false; + +jQuery('#cx-v2-start-now').on('click', function () +{ + compressx_start_bulk_optimization(); +}); + +jQuery('#cx-v2-cancel-bulk').on('click', function () +{ + if(cx_bulk_task_running) + { + var descript = compressx_bulk_i18n.cancel_confirm; + + var ret = confirm(descript); + if(ret === true) + { + cx_cancel_bulk_optimization=true; + jQuery('#cx-v2-cancel-bulk').css({'pointer-events': 'none', 'opacity': '0.4'}); + } + } + else + { + jQuery('#cx-v2-bulk-ready').show(); + jQuery('#cx-v2-bulk-progress').hide(); + } + +}); + +jQuery('#cx-v2-pause-bulk').on('click', function () +{ + var descript = compressx_bulk_i18n.pause_confirm; + + var ret = confirm(descript); + if(ret === true) + { + cx_pause_bulk_optimization=true; + jQuery('#cx-v2-pause-bulk').css({'pointer-events': 'none', 'opacity': '0.4'}); + } +}); + +// +jQuery('#cx_bulk_success_hide').on('click', function () +{ + jQuery('#cx_bulk_success').hide(); + jQuery('#cx-v2-bulk-ready').show(); + jQuery('#cx-v2-bulk-progress').hide(); +}); + +jQuery('#cx_bulk_error_hide').on('click', function () +{ + jQuery('#cx_bulk_error').hide(); + jQuery('#cx-v2-bulk-ready').show(); + jQuery('#cx-v2-bulk-progress').hide(); +}); + +jQuery('#cx-v2-log-copy').on('click', function() { + var logContent = jQuery('#cx-v2-live-log').text(); + if (logContent) + { + // Check if Clipboard API is available + if (navigator.clipboard && navigator.clipboard.writeText) + { + navigator.clipboard.writeText(logContent).then(function() + { + alert('Log copied to clipboard!'); + }).catch(function() { + // Fallback if clipboard API fails + }); + } + else + { + // Use fallback for non-HTTPS or unsupported browsers + } + } +}); + +jQuery('#cx-v2-log-download').on('click', function() +{ + location.href =ajaxurl+'?_wpnonce='+compressx_ajax_object.ajax_nonce+'&action=compressx_download_task_log'; +}); + +var currentLogFilename=''; + +jQuery('.cx-log-details').on('click', function(e) +{ + e.preventDefault(); + + var logFilename = jQuery(this).data('log'); + + compressx_open_log_details(logFilename); +}); + +function compressx_open_log_details(logFilename) +{ + var ajax_data = { + action: 'compressx_open_log', + filename: logFilename + }; + + compressx_post_request(ajax_data, function(response) + { + try { + response = JSON.parse(response); + if (response.result === 'success') + { + currentLogFilename = logFilename; + jQuery('#cx-v2-log-content').val(response.data); + jQuery('#cx-v2-log-created-date').text(response.create || '--'); + jQuery('#cx-v2-log-modal').show(); + jQuery('html, body').animate({ + scrollTop: jQuery('#cx-v2-log-modal').offset().top - 100 + }, 500); + } else { + alert('Failed to open log: ' + (response.error || 'Unknown error')); + } + } catch(err) { + alert('An error occurred while opening log.'); + } + }, function(XMLHttpRequest, textStatus, errorThrown) { + var error_message = compressx_output_ajaxerror('opening log', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('.cx-log-download').on('click', function(e) +{ + e.preventDefault(); + + var logFilename = jQuery(this).data('log'); + + var download_url = ajaxurl + + '?action=compressx_download_log&log=' + + logFilename + + '&nonce=' + compressx_ajax_object.ajax_nonce; + + window.location.href = download_url; +}); + +jQuery('.cx-log-delete').on('click', function(e) +{ + e.preventDefault(); + + var logFilename = jQuery(this).data('log'); + var $element= jQuery(this); + if (!confirm(compressx_bulk_i18n.delete_log_confirm)) + { + return; + } + + var ajax_data = { + action: 'compressx_delete_log', + filename: logFilename + }; + + compressx_post_request(ajax_data, function(response) { + try { + response = JSON.parse(response); + if (response.result === 'success') { + $element.closest('tr').fadeOut(function() { + jQuery(this).remove(); + }); + } else { + alert('Failed to delete log: ' + (response.error || 'Unknown error')); + } + } catch(err) { + alert('An error occurred while deleting log.'); + } + }, function(XMLHttpRequest, textStatus, errorThrown) { + var error_message = compressx_output_ajaxerror('deleting log', textStatus, errorThrown); + alert(error_message); + }); +}); + +jQuery('#cx-v2-download-current-log').on('click', function() +{ + //currentLogFilename + if (currentLogFilename === "") + { + return; + } + + var download_url = ajaxurl + + '?action=compressx_download_log&log=' + + currentLogFilename + + '&nonce=' + compressx_ajax_object.ajax_nonce; + + window.location.href = download_url;} +); + +jQuery('#cx-v2-close-log').on('click', function(e) +{ + jQuery('#cx-v2-log-modal').hide(); + currentLogFilename = ''; +}); + +function compressx_start_bulk_optimization() +{ + var force="0"; + + if(jQuery('#cx-v2-force-reprocess').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + + var ajax_data = { + 'action': 'compressx_start_scan_unoptimized_image', + 'force':force + }; + + cx_cancel_bulk_optimization=false; + jQuery('#cx-v2-cancel-bulk').css({'pointer-events': 'auto', 'opacity': '1'}); + cx_pause_bulk_optimization=false; + jQuery('#cx-v2-pause-bulk').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#cx-v2-bulk-ready').hide(); + jQuery('#cx-v2-bulk-progress').show(); + compressx_reset_bulk_progress(); + cx_bulk_task_running=true; + + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(); + return; + } + + if(cx_pause_bulk_optimization) + { + compressx_bulk_optimization_paused(); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + if(jsonarray.finished==true) + { + compressx_update_bulk_scan_progress(jsonarray.progress_text,jsonarray.progress_percent); + compressx_init_bulk_optimization_task(); + } + else + { + compressx_update_bulk_scan_progress(jsonarray.progress_text,jsonarray.progress_percent); + compressx_scanning_images(jsonarray.offset); + } + } + else + { + compressx_progress_error(jsonarray.error); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + var error_message = compressx_output_ajaxerror('scanning images', textStatus, errorThrown); + compressx_progress_error(error_message); + }); +} + +function compressx_scanning_images(offset) +{ + var force="0"; + + if(jQuery('#cx-v2-force-reprocess').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + + var ajax_data = { + 'action': 'compressx_start_scan_unoptimized_image', + 'force':force, + 'offset':offset + }; + + cx_cancel_bulk_optimization=false; + + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(); + return; + } + + if(cx_pause_bulk_optimization) + { + compressx_bulk_optimization_paused(); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + if(jsonarray.finished==true) + { + compressx_update_bulk_scan_progress(jsonarray.progress_text,jsonarray.progress_percent); + compressx_init_bulk_optimization_task(); + } + else + { + compressx_update_bulk_scan_progress(jsonarray.progress_text,jsonarray.progress_percent); + compressx_scanning_images(jsonarray.offset); + } + } + else + { + compressx_progress_error(jsonarray.error); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + var error_message = compressx_output_ajaxerror('scanning images', textStatus, errorThrown); + compressx_progress_error(error_message); + }); +} + + +function compressx_init_bulk_optimization_task() +{ + var force="0"; + + if(jQuery('#cx-v2-force-reprocess').prop('checked')) + { + force = '1'; + } + else { + force = '0'; + } + + var ajax_data = { + 'action': 'compressx_init_bulk_optimization_task', + 'force':force + }; + + compressx_post_request(ajax_data, function (data) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(); + return; + } + + if(cx_pause_bulk_optimization) + { + compressx_bulk_optimization_paused(); + return; + } + + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + compressx_get_task_log(); + compressx_run_optimize(); + } + else + { + if(jsonarray.no_unoptimized_images) + { + compressx_progress_finish(jsonarray.error,"Optimization Status:"); + } + else + { + compressx_progress_error(jsonarray.error); + } + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + var error_message = compressx_output_ajaxerror('start bulk optimization', textStatus, errorThrown); + compressx_progress_error(error_message); + }); +} + +function compressx_run_optimize() +{ + var ajax_data = { + 'action': 'compressx_run_optimize', + }; + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + else + { + compressx_progress_error(jsonarray.error); + } + } + catch(err) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + compressx_get_optimize_task_status(); + }); +} + +function compressx_get_optimize_task_status() +{ + var ajax_data = { + 'action': 'compressx_get_opt_progress' + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === 'success') + { + //progress_text,progress_percent,sub_progress_text,sub_progress_percent,optimized,errors,remaining + + compressx_update_bulk_progress(jsonarray.progress_text,jsonarray.progress_percent,jsonarray.sub_progress_text,jsonarray.sub_progress_percent,jsonarray.optimized,jsonarray.errors,jsonarray.remaining); + if(jsonarray.continue) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + else if(jsonarray.finished) + { + jQuery(document).trigger('compressx:hasUpdateImageData'); + compressx_progress_finish(jsonarray.message); + compressx_show_review_box(jsonarray); + } + else + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(jsonarray.message); + return; + } + + if(cx_pause_bulk_optimization) + { + compressx_bulk_optimization_paused(); + return; + } + + jQuery(document).trigger('compressx:hasUpdateImageData'); + compressx_run_optimize(); + } + } + else if (jsonarray.result === 'failed') + { + if(jsonarray.timeout) + { + if(cx_cancel_bulk_optimization) + { + compressx_bulk_optimization_canceled(jsonarray.message); + return; + } + + if(cx_pause_bulk_optimization) + { + compressx_bulk_optimization_paused(); + return; + } + + compressx_run_optimize(); + } + else + { + compressx_progress_error(jsonarray.error); + } + } + } + catch(err) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + } + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + setTimeout(function () + { + compressx_get_optimize_task_status(); + }, 1000); + }); +} + +function compressx_get_task_log(offset) +{ + if(!cx_bulk_task_running) + return; + + var ajax_data = { + 'action': 'compressx_get_task_log', + 'offset':offset + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === 'success') + { + var $logContainer = jQuery('#cx-v2-live-log'); + + $logContainer.append(jsonarray.content); + + if (jQuery('#cx-v2-log-autoscroll').is(':checked')) + { + $logContainer.scrollTop($logContainer[0].scrollHeight); + } + + compressx_limit_log_lines($logContainer, 5000); + + setTimeout(function () + { + compressx_get_task_log(jsonarray.offset); + }, 3000); + } + else + { + // + } + } + catch(err) + { + setTimeout(function () + { + compressx_get_task_log(0); + }, 3000); + } + + }, function(XMLHttpRequest, textStatus, errorThrown) + { + setTimeout(function () + { + compressx_get_task_log(0); + }, 3000); + }); +} + +function compressx_limit_log_lines($container,maxLines) +{ + var lines = $container.text().split('\n'); + + if (lines.length > maxLines) + { + var newLines = lines.slice(lines.length - maxLines); + $container.text(newLines.join('\n')); + } +} + +function compressx_reset_bulk_progress() +{ + jQuery('#cx-v2-progress-status').html("Ready"); + + jQuery('#cx-v2-scan-status').html("0 images scanned"); + jQuery('#cx-v2-scan-progress-bar').width("0%"); + + jQuery('#cx-v2-overall-progress-text').html("0 images processed"); + jQuery('#cx-v2-overall-progress-bar').width("0%"); + + jQuery('#cx-v2-job-current').html("None"); + jQuery('#cx-v2-job-progress-bar').width("0%"); + + jQuery('#cx-v2-stat-optimized').html("0"); + jQuery('#cx-v2-stat-errors').html("0"); + jQuery('#cx-v2-stat-remaining').html("0"); + + jQuery('#cx_bulk_warning').show(); + jQuery('#cx_bulk_success').hide(); + jQuery('#cx_bulk_error').hide(); + jQuery('#cx-v2-live-log').html(""); +} + +function compressx_bulk_optimization_canceled(message) +{ + //jQuery('#cx-v2-bulk-ready').show(); + //jQuery('#cx-v2-bulk-progress').hide(); + jQuery('#cx-v2-cancel-bulk').css({'pointer-events': 'auto', 'opacity': '1'}); + + jQuery('#cx_bulk_warning').hide(); + + jQuery('#cx_bulk_success').show(); + jQuery('#cx_bulk_success_title').html("The process has been canceled"); + jQuery('#cx_bulk_success_message').html(message); + cx_bulk_task_running=false; +} + +function compressx_bulk_optimization_paused() +{ + cx_pause_bulk_optimization=false; + jQuery('#cx-v2-pause-bulk').css({'pointer-events': 'auto', 'opacity': '1'}); +} + +function compressx_update_bulk_scan_progress(progress_text,progress_percent) +{ + jQuery('#cx-v2-progress-status').html("Scanning"); + + jQuery('#cx-v2-scan-status').html(progress_text); + jQuery('#cx-v2-scan-progress-bar').width(progress_percent+"%"); +} + +function compressx_update_bulk_progress(progress_text,progress_percent,sub_progress_text,sub_progress_percent,optimized,errors,remaining) +{ + + jQuery('#cx-v2-progress-status').html("Running"); + + jQuery('#cx-v2-overall-progress-text').html(progress_text); + jQuery('#cx-v2-overall-progress-bar').width(progress_percent+"%"); + + jQuery('#cx-v2-job-current').html(sub_progress_text); + jQuery('#cx-v2-job-progress-bar').width(sub_progress_percent+"%"); + + jQuery('#cx-v2-stat-optimized').html(optimized); + jQuery('#cx-v2-stat-errors').html(errors); + jQuery('#cx-v2-stat-remaining').html(remaining); +} + +function compressx_progress_finish(message,title=compressx_bulk_i18n.optimization_success) +{ + //jQuery('#cx-v2-bulk-ready').show(); + //jQuery('#cx-v2-bulk-progress').hide(); + + jQuery('#cx_bulk_warning').hide(); + + jQuery('#cx_bulk_success').show(); + jQuery('#cx_bulk_success_title').html(title); + jQuery('#cx_bulk_success_message').html(message); + cx_bulk_task_running=false; +} + +function compressx_progress_error(message) +{ + //jQuery('#cx-v2-bulk-ready').show(); + //jQuery('#cx-v2-bulk-progress').hide(); + + jQuery('#cx_bulk_warning').hide(); + + jQuery('#cx_bulk_error').show(); + jQuery('#cx_bulk_error_title').html("Error: Optimization Failed"); + jQuery('#cx_bulk_error_message').html(message); + cx_bulk_task_running=false; +} + +function compressx_show_review_box(jsonarray) +{ + if(jsonarray.show_review) + { + jQuery('#cx_rating_box').show(); + jQuery('#cx_size_of_opt_images').html(jsonarray.opt_size); + } +} + +window.addEventListener('click', function(e) +{ + if(cx_bulk_task_running && e.target.matches('a')){ + if(!confirm(compressx_bulk_i18n.leave_page_confirm)) + { + e.preventDefault(); + } + } +}); + +window.addEventListener("beforeunload", function (e) { + if (cx_bulk_task_running) + { + e.preventDefault(); + e.returnValue = "Leaving this page will interrupt the optimization task."; + return "Leaving this page will interrupt the optimization task."; + } +}); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/js/compressx_cdn.js b/wp-content/plugins/compressx/includes/display_v2/js/compressx_cdn.js new file mode 100644 index 0000000..cc7a94c --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/compressx_cdn.js @@ -0,0 +1,115 @@ +jQuery(document).ready(function($) { + $('#compressx_save_cdn').click(function() { + compressx_save_cdn_setting(); + }); + + $('#compressx_purge_cache').click(function() { + compressx_purge_cache(); + }); + + $('#compressx_cdn_provider').on('change', function() { + var provider = $(this).val(); + if (provider === 'cloudflare') { + $('#cloudflare_container').show(); + $('#bunnycdn_container').hide(); + } else if (provider === 'bunnycdn') { + $('#cloudflare_container').hide(); + $('#bunnycdn_container').show(); + } + }); + + $(document).trigger('compressx_cdn_v2_js_ready'); +}); + +function compressx_save_cdn_setting() { + var json = {}; + var option_type = 'cf_cdn'; + var action_name = 'compressx_save_cdn'; + + var save_override = jQuery(document).triggerHandler('compressx_cdn_v2_save_override'); + if (save_override) { + return save_override; + } + + var setting_data = compressx_ajax_data_transfer(option_type); + var json1 = JSON.parse(setting_data); + + jQuery.extend(json1, json); + setting_data = JSON.stringify(json1); + + var ajax_data = { + 'action': action_name, + 'setting': setting_data, + }; + + jQuery('#compressx_save_cdn').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_save_cdn_progress').show(); + + compressx_post_request(ajax_data, function (data) { + try { + var jsonarray = jQuery.parseJSON(data); + jQuery('#compressx_save_cdn').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_cdn_progress').hide(); + + if (jsonarray.result === 'success') { + jQuery('#compressx_save_cdn_text').removeClass("hidden"); + setTimeout(function () { + jQuery('#compressx_save_cdn_text').addClass('hidden'); + }, 3000); + } else { + alert(jsonarray.error); + } + } catch (err) { + alert(err); + jQuery('#compressx_save_cdn').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_cdn_progress').hide(); + } + }, function (XMLHttpRequest, textStatus, errorThrown) { + jQuery('#compressx_save_cdn').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_cdn_progress').hide(); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); +} + +function compressx_purge_cache() { + var json = {}; + var setting_data = compressx_ajax_data_transfer('cf_cdn'); + var json1 = JSON.parse(setting_data); + + jQuery.extend(json1, json); + setting_data = JSON.stringify(json1); + + var ajax_data = { + 'action': 'compressx_purge_cache', + 'setting': setting_data, + }; + + jQuery('#compressx_purge_cache').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_purge_cache_progress').show(); + + compressx_post_request(ajax_data, function (data) { + jQuery('#compressx_purge_cache_progress').hide(); + try { + var jsonarray = jQuery.parseJSON(data); + jQuery('#compressx_purge_cache').css({'pointer-events': 'auto', 'opacity': '1'}); + + if (jsonarray.result === 'success') { + jQuery('#compressx_purge_cache_text').removeClass("hidden"); + setTimeout(function () { + jQuery('#compressx_purge_cache_text').addClass('hidden'); + }, 3000); + } else { + alert(jsonarray.error); + } + } catch (err) { + alert(err); + jQuery('#compressx_purge_cache').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) { + jQuery('#compressx_purge_cache_progress').hide(); + jQuery('#compressx_purge_cache').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); +} diff --git a/wp-content/plugins/compressx/includes/display_v2/js/compressx_image_comparison.js b/wp-content/plugins/compressx/includes/display_v2/js/compressx_image_comparison.js new file mode 100644 index 0000000..2fa6247 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/compressx_image_comparison.js @@ -0,0 +1,337 @@ +// +let isHoveringComparison = false; +let hasUpdateImageData=false; +let latestImageData = null; +let currentComparisonMode = 'webp'; + +jQuery('#cx-v2-bulk-comparison-container').on('mouseenter', function() +{ + isHoveringComparison = true; +}).on('mouseleave', function() { + isHoveringComparison = false; +}); + +jQuery('#cx-v2-bulk-show-webp').on('click', function () { + switchComparisonMode('webp'); +}); + +jQuery('#cx-v2-bulk-show-avif').on('click', function () { + switchComparisonMode('avif'); +}); + +jQuery('#cx-v2-bulk-show-formats').on('click', function () { + switchComparisonMode('formats'); +}); + +function resetComparison() +{ + var $container = jQuery('#cx-v2-bulk-comparison-container'); + + // Use the dedicated destroy function + destroyComparison($container); + + // Reset opacity and add placeholder + $container.css('opacity', '1'); + $container.append('
                Comparison will appear here during optimization
                '); + + jQuery('#cx-v2-bulk-format-toggle').hide(); + + // Reset comparison buttons to default state + updateComparisonButtons(currentComparisonMode); + + jQuery('#cx-v2-original-size').text('--'); + jQuery('#cx-v2-webp-size').text('--'); + jQuery('#cx-v2-webp-savings').text(''); + jQuery('#cx-v2-avif-size').text('--'); + jQuery('#cx-v2-avif-savings').text(''); + + latestImageData = null; +} + +function destroyComparison($container) { + if ($container.hasClass('twentytwenty-container')) { + $container.off('.twentytwenty'); + $container.removeClass('twentytwenty-container'); + } + $container.empty(); +} + +function switchComparisonMode(mode) +{ + currentComparisonMode = mode; + updateComparisonButtons(mode); + + if (latestImageData) { + renderComparison(latestImageData, mode); + } +} + +function updateComparisonButtons(activeMode) +{ + jQuery('#cx-v2-bulk-show-webp, #cx-v2-bulk-show-avif, #cx-v2-bulk-show-formats') + .removeClass('hover:compressx-v2-bg-gray-100 compressx-v2-bg-green-500 compressx-v2-text-white compressx-v2-border-green-500') + .addClass('compressx-v2-bg-gray-50 compressx-v2-text-gray-700 compressx-v2-border-gray-300'); + + var activeButton = null; + if (activeMode === 'webp') { + activeButton = '#cx-v2-bulk-show-webp'; + } else if (activeMode === 'avif') { + activeButton = '#cx-v2-bulk-show-avif'; + } else if (activeMode === 'formats') { + activeButton = '#cx-v2-bulk-show-formats'; + } + + if (activeButton) + { + jQuery(activeButton) + .removeClass('compressx-v2-bg-gray-50 compressx-v2-text-gray-700 compressx-v2-border-gray-300') + .addClass('compressx-v2-bg-green-500 compressx-v2-text-white compressx-v2-border-green-500'); + } +} + +function renderComparison(imageData, mode) +{ + var $container = jQuery('#cx-v2-bulk-comparison-container'); + + $container.css({ + 'opacity': '0', + 'transition': 'opacity 0.3s ease' + }); + + // Completely destroy and rebuild the comparison container + destroyComparison($container); + + var beforeImg, afterImg, beforeLabel, afterLabel; + var hasWebP = imageData.webp_url && !imageData.webp_disabled; + var hasAVIF = imageData.avif_url && !imageData.avif_disabled; + + // Determine which buttons to show and default mode + var showToggle = hasWebP && hasAVIF; + var availableModes = []; + + if (hasWebP) availableModes.push('webp'); + if (hasAVIF) availableModes.push('avif'); + if (hasWebP && hasAVIF) availableModes.push('formats'); + + // Update button visibility + jQuery('#cx-v2-bulk-show-webp').toggle(hasWebP && hasAVIF); + jQuery('#cx-v2-bulk-show-avif').toggle(hasWebP && hasAVIF); + jQuery('#cx-v2-bulk-show-formats').toggle(hasWebP && hasAVIF); + + // Show or hide the toggle container + if (showToggle) { + jQuery('#cx-v2-bulk-format-toggle').show(); + } else { + jQuery('#cx-v2-bulk-format-toggle').hide(); + } + + // Auto-select appropriate mode if current mode is not available + if (!availableModes.includes(mode)) { + mode = availableModes[0] || 'webp'; + currentComparisonMode = mode; + updateComparisonButtons(mode); + } + + if (mode === 'webp' && hasWebP) { + beforeImg = imageData.original_url; + afterImg = imageData.webp_url; + beforeLabel = 'Original'; + afterLabel = 'WebP'; + } else if (mode === 'avif' && hasAVIF) { + beforeImg = imageData.original_url; + afterImg = imageData.avif_url; + beforeLabel = 'Original'; + afterLabel = 'AVIF'; + } else if (mode === 'formats' && hasWebP && hasAVIF) { + beforeImg = imageData.webp_url; + afterImg = imageData.avif_url; + beforeLabel = 'WebP'; + afterLabel = 'AVIF'; + } else { + $container.append('
                Comparison not available for this mode
                '); + $container.css('opacity', '1'); + return; + } + + $container.append(''); + $container.append(''); + + reinitializeTwentyTwenty($container, function() { + $container.css('opacity', '1'); + }, beforeLabel, afterLabel); +} + +function updateComparisonData(imageData) { + if (isHoveringComparison) { + return; + } + + latestImageData = imageData; + + if (imageData.original_size) { + jQuery('#cx-v2-original-size').text(imageData.original_size); + } + + if (imageData.webp_url && !imageData.webp_disabled) + { + jQuery('#cx-v2-webp-size').text(imageData.webp_size || '--'); + jQuery('#cx-v2-webp-savings').text(imageData.webp_savings || ''); + } + else { + jQuery('#cx-v2-webp-size').text('--'); + jQuery('#cx-v2-webp-savings').text(''); + } + + if (imageData.avif_url && !imageData.avif_disabled) + { + jQuery('#cx-v2-avif-size').text(imageData.avif_size || '--'); + jQuery('#cx-v2-avif-savings').text(imageData.avif_savings || ''); + } + else { + jQuery('#cx-v2-avif-size').text('--'); + jQuery('#cx-v2-avif-savings').text(''); + } + // Determine appropriate comparison mode based on available formats + var hasWebP = imageData.webp_url && !imageData.webp_disabled; + var hasAVIF = imageData.avif_url && !imageData.avif_disabled; + + var targetMode = currentComparisonMode; + + // Auto-switch to available format if current mode is not available + if (currentComparisonMode === 'webp' && !hasWebP && hasAVIF) { + targetMode = 'avif'; + } else if (currentComparisonMode === 'avif' && !hasAVIF && hasWebP) { + targetMode = 'webp'; + } else if (currentComparisonMode === 'formats' && !(hasWebP && hasAVIF)) { + targetMode = hasWebP ? 'webp' : 'avif'; + } else if (!hasWebP && !hasAVIF) { + // No formats available + targetMode = 'webp'; // Fallback + } else if (hasWebP && currentComparisonMode !== 'avif' && currentComparisonMode !== 'formats') { + targetMode = 'webp'; + } else if (hasAVIF && !hasWebP) { + targetMode = 'avif'; + } + + if (targetMode !== currentComparisonMode) { + currentComparisonMode = targetMode; + } + + renderComparison(imageData, currentComparisonMode); +} + +function reinitializeTwentyTwenty($container, callback, beforeLabel, afterLabel) { + var images = $container.find('img'); + var loadedCount = 0; + var totalImages = images.length; + + if (totalImages === 0) { + if (callback) callback(); + return; + } + + images.off('load.cxcmp').on('load.cxcmp', function () { + loadedCount++; + if (loadedCount !== totalImages) return; + + setTimeout(function () { + if (typeof jQuery.fn.twentytwenty !== 'function') { + if (callback) callback(); + return; + } + + var options = { + default_offset_pct: 0.5, + move_slider_on_hover: false, + move_with_handle_only: true, + click_to_move: false, + no_overlay: false, + before_label: beforeLabel || 'Before', + after_label: afterLabel || 'After' + }; + + var $img = $container.find('img').first(); + var naturalW = $img[0]?.naturalWidth || 0; + if (naturalW) { + $container.css({ + maxWidth: naturalW + 'px', + marginLeft: 'auto', + marginRight: 'auto' + }); + } + + $container.twentytwenty(options); + $container.find('img').css({ + 'max-width': '100%', + 'height': 'auto', + 'width': '100%', + 'display': 'block' + }); + + var raf = window.requestAnimationFrame || function (fn) { return setTimeout(fn, 0); }; + raf(async function () { + jQuery(window).trigger('resize.twentytwenty'); + callback && callback(); + }); + + }, 0); + }); + + images.each(function () { + if (this.complete && this.naturalHeight !== 0) { + jQuery(this).trigger('load.cxcmp'); + } + }); +} + +function init_latestImageData() +{ + var ajax_data = { + action: 'compressx_get_latest_image_data', + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = JSON.parse(data); + if (jsonarray.result === 'success') + { + updateComparisonData(jsonarray.current_image); + } + else + { + resetComparison(); + } + } + catch (err) + { + resetComparison(); + } + }, function(XMLHttpRequest, textStatus, errorThrown) { + resetComparison(); + }); +} + +function autoRefreshLatestImageData() +{ + if(!isHoveringComparison&&hasUpdateImageData) + { + init_latestImageData(); + hasUpdateImageData = false; + } + + setTimeout(autoRefreshLatestImageData, 10000); +} + +jQuery(document).on('compressx:hasUpdateImageData', function () { + hasUpdateImageData = true; +}); + +jQuery(document).ready(function ($) +{ + init_latestImageData(); + autoRefreshLatestImageData(); +}); + + diff --git a/wp-content/plugins/compressx/includes/display_v2/js/compressx_image_optimization.js b/wp-content/plugins/compressx/includes/display_v2/js/compressx_image_optimization.js new file mode 100644 index 0000000..4a2a744 --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/compressx_image_optimization.js @@ -0,0 +1,455 @@ +jQuery('#cx_hide_big_update').click(function() +{ + jQuery('#cx_big_update').hide(); + + var ajax_data = { + 'action': 'compressx_hide_big_update_v2', + }; + + compressx_post_request(ajax_data, function(data) + { + }, function(XMLHttpRequest, textStatus, errorThrown) { + }); +}); + +jQuery('#cx_show_size_threshold_tip').on('click', function() +{ + jQuery('#cx_size_threshold_tip').slideToggle(150); +}); + +jQuery('input:radio[name=compression_mode]').click(function(e) +{ + if(jQuery(this).prop('checked')) + { + //var $saveButton = jQuery("#cx-v2-save-settings"); + + let value = jQuery(this).prop('value'); + if(value==='smart') + { + //$saveButton.css({ 'pointer-events': 'none', 'opacity': '0.4' }); + + jQuery("#compressx_general_quality_setting").hide(); + jQuery("#compressx_smart_quality_setting").show(); + jQuery("#cx_compression_mode_smart").closest('label').addClass('compressx-v2-bg-white'); + jQuery("#cx_compression_mode_general").closest('label').removeClass('compressx-v2-bg-white'); + } + else if(value==='general') + { + //$saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + + jQuery("#compressx_general_quality_setting").show(); + jQuery("#compressx_smart_quality_setting").hide(); + jQuery("#cx_compression_mode_general").closest('label').addClass('compressx-v2-bg-white'); + jQuery("#cx_compression_mode_smart").closest('label').removeClass('compressx-v2-bg-white'); + } + } +}); + +jQuery('#cx_convert_to_webp').click(function() +{ + var value = '0'; + if(jQuery('#cx_convert_to_webp').prop('checked')) + { + value = '1'; + var descript = compressx_image_optimization_i18n.enable_webp_confirm; + } + else { + value = '0'; + var descript = compressx_image_optimization_i18n.disable_webp_confirm; + } + + var ret = confirm(descript); + if(ret === false) + { + if(jQuery('#cx_convert_to_webp').prop('checked')) + { + jQuery('#cx_convert_to_webp').prop('checked', false); + } + else + { + jQuery('#cx_convert_to_webp').prop('checked', true); + } + } + else + { + if(jQuery('#cx_convert_to_webp').prop('checked')) + { + jQuery('#cx_convert_to_webp').parent('label').addClass('compressx-v2-bg-white'); + } + else + { + jQuery('#cx_convert_to_webp').parent('label').removeClass('compressx-v2-bg-white'); + } + } +}); + +jQuery('#cx_convert_to_avif').click(function() +{ + var value = '0'; + if(jQuery('#cx_convert_to_avif').prop('checked')) + { + if(jQuery('#cx_converter_method_imagick').prop('checked')) + { + if(compressx_alert.imagick_avif) + { + var descript = compressx_image_optimization_i18n.imagick6_avif_warning; + } + else + { + var descript = compressx_image_optimization_i18n.enable_avif_confirm; + } + } + else + { + var descript = compressx_image_optimization_i18n.enable_avif_confirm; + } + + value = '1'; + } + else { + value = '0'; + var descript = compressx_image_optimization_i18n.disable_avif_confirm; + } + + var ret = confirm(descript); + if(ret === false) + { + if(jQuery('#cx_convert_to_avif').prop('checked')) + { + jQuery('#cx_convert_to_avif').prop('checked', false); + } + else + { + jQuery('#cx_convert_to_avif').prop('checked', true); + } + } + else + { + if(jQuery('#cx_convert_to_avif').prop('checked')) + { + jQuery('#cx_convert_to_avif').parent('label').addClass('compressx-v2-bg-white'); + } + else + { + jQuery('#cx_convert_to_avif').parent('label').removeClass('compressx-v2-bg-white'); + } + } +}); + +jQuery('#cx_converter_method_gd').click(function() +{ + if(jQuery('#cx_converter_method_gd').prop('checked')) + { + jQuery('#cx_converter_method_gd').parent('label').addClass('compressx-v2-bg-white'); + } + else + { + jQuery('#cx_converter_method_gd').parent('label').removeClass('compressx-v2-bg-white'); + } + + if(compressx_alert.support_gd_webp) + { + jQuery('#cx_convert_to_webp').prop('disabled', false); + jQuery('#cx_webp_status').removeClass("compressx-v2-text-red-600"); + jQuery('#cx_webp_status').addClass("compressx-v2-text-green-600"); + jQuery('#cx_webp_status').html(compressx_image_optimization_i18n.supported); + } + else + { + jQuery('#cx_convert_to_webp').prop('disabled', true); + jQuery('#cx_webp_status').addClass("compressx-v2-text-red-600"); + jQuery('#cx_webp_status').removeClass("compressx-v2-text-green-600"); + jQuery('#cx_webp_status').html(compressx_image_optimization_i18n.unsupported); + } + + if(compressx_alert.support_gd_avif) + { + jQuery('#cx_convert_to_avif').prop('disabled', false); + jQuery('#cx_avif_status').removeClass("compressx-v2-text-red-600"); + jQuery('#cx_avif_status').addClass("compressx-v2-text-green-600"); + jQuery('#cx_avif_status').html(compressx_image_optimization_i18n.supported); + } + else + { + jQuery('#cx_convert_to_avif').prop('disabled', true); + jQuery('#cx_avif_status').addClass("compressx-v2-text-red-600"); + jQuery('#cx_avif_status').removeClass("compressx-v2-text-green-600"); + jQuery('#cx_avif_status').html(compressx_image_optimization_i18n.unsupported); + } +}); + +jQuery('#cx_converter_method_imagick').click(function() +{ + if(jQuery('#cx_converter_method_imagick').prop('checked')) + { + jQuery('#cx_converter_method_imagick').parent('label').addClass('compressx-v2-bg-white'); + } + else + { + jQuery('#cx_converter_method_imagick').parent('label').removeClass('compressx-v2-bg-white'); + } + + if(compressx_alert.support_imagick_webp) + { + jQuery('#cx_convert_to_webp').prop('disabled', false); + jQuery('#cx_webp_status').removeClass("compressx-v2-text-red-600"); + jQuery('#cx_webp_status').addClass("compressx-v2-text-green-600"); + jQuery('#cx_webp_status').html(compressx_image_optimization_i18n.supported); + } + else + { + jQuery('#cx_convert_to_webp').prop('disabled', true); + jQuery('#cx_webp_status').addClass("compressx-v2-text-red-600"); + jQuery('#cx_webp_status').removeClass("compressx-v2-text-green-600"); + jQuery('#cx_webp_status').html(compressx_image_optimization_i18n.unsupported); + } + + if(compressx_alert.support_imagick_avif) + { + jQuery('#cx_convert_to_avif').prop('disabled', false); + jQuery('#cx_avif_status').removeClass("compressx-v2-text-red-600"); + jQuery('#cx_avif_status').addClass("compressx-v2-text-green-600"); + jQuery('#cx_avif_status').html(compressx_image_optimization_i18n.supported); + } + else + { + jQuery('#cx_convert_to_avif').prop('disabled', true); + jQuery('#cx_avif_status').addClass("compressx-v2-text-red-600"); + jQuery('#cx_avif_status').removeClass("compressx-v2-text-green-600"); + jQuery('#cx_avif_status').html("Unsupported"); + } +}); + +jQuery('#cx_start_bulk_optimization').click(function() +{ + let params = new URLSearchParams(window.location.search); + + params.set('view', 'bulk'); + + window.location.href = window.location.pathname + '?' + params.toString(); +}); + +jQuery('#cx_start_bulk_optimization_2').click(function() +{ + let params = new URLSearchParams(window.location.search); + + params.set('view', 'bulk'); + + window.location.href = window.location.pathname + '?' + params.toString(); +}); + +jQuery('#cx-v2-save-settings').click(function(e) +{ + e.preventDefault(); + + var $saveButton = jQuery(this); + $saveButton.css({ 'pointer-events': 'none', 'opacity': '0.4' }); + jQuery('#cx-v2-save-settings-progress').show(); + + var json = {}; + if(jQuery('#cx_convert_to_webp').prop('checked')) + { + json['convert_to_webp'] ='1'; + } + else + { + json['convert_to_webp'] ='0'; + } + + if(jQuery('#cx_convert_to_avif').prop('checked')) + { + json['convert_to_avif'] ='1'; + } + else + { + json['convert_to_avif'] ='0'; + } + + if(jQuery('#cx_converter_method_gd').prop('checked')) + { + json['converter_method'] = 'gd'; + } + else if(jQuery('#cx_converter_method_imagick').prop('checked')) + { + json['converter_method'] = 'imagick'; + } + else + { + json['converter_method'] = ''; + } + + json['auto_optimize'] = jQuery('#cx_enable_auto_optimize').attr('data-checked'); + + json['interface_version']= jQuery('input[name="cx-v2-interface-version"]:checked').val(); + json['image_load']= jQuery('input[name="cx-v2-browser"]:checked').val(); + json['resize']=jQuery('#cx-v2-resize-enable').attr('data-checked') === '1'; + json['resize_width']=jQuery('#cx-v2-resize-width').val(); + json['resize_height']=jQuery('#cx-v2-resize-height').val(); + json['remove_exif']=jQuery('input[name="cx-v2-exif"]:checked').val() === 'strip'; + json['auto_remove_larger_format']=jQuery('#cx-v2-avoid-larger').attr('data-checked') === '1'; + json['exclude_png']=jQuery('#cx-v2-exclude-png').is(':checked'); + json['exclude_png_webp'] =jQuery('#cx-v2-exclude-png-webp').is(':checked'); + json['converter_images_pre_request'] =jQuery('#cx-v2-throughput').val(); + json['quality_webp']=jQuery('#cx-v2-webp-quality-input').val(); + json['quality_avif']=jQuery('#cx-v2-avif-quality-input').val(); + + if (json['quality_webp'] < 1 || json['quality_webp'] > 100) { + alert('WebP Quality must be between 1 and 99.'); + return; + } + if ( json['quality_avif'] < 1 || json['quality_avif'] > 100) { + alert('AVIF Quality must be between 1 and 99.'); + return; + } + + var ajax_data = { + 'action': 'compressx_save_image_optimization_settings', + 'settings': JSON.stringify(json), + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = JSON.parse(data); + if (jsonarray.result === 'success') + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + + jQuery('#cx-v2-save-settings-text').removeClass('compressx-v2-hidden'); + setTimeout(function() { + jQuery('#cx-v2-save-settings-text').addClass('compressx-v2-hidden'); + }, 3000); + + if(jsonarray.interface_version_changed===true) + { + location.reload(); + } + } + else + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + alert(jsonarray.error || 'Failed to save settings.'); + } + } + catch (err) + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + alert('An error occurred while saving settings.'); + } + }, function(XMLHttpRequest, textStatus, errorThrown) { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + var error_message = compressx_output_ajaxerror('saving settings', textStatus, errorThrown); + alert(error_message); + }); +}); + +jQuery('#cx_enable_auto_optimize').on('click', function() +{ + updateAutoOptimizeSwitch(); +}); + +jQuery('#cx-v2-free-toggle-advanced').click(function(e) +{ + e.preventDefault(); + var advancedArrow = jQuery('#cx-v2-free-advanced-arrow'); + var advancedSection = jQuery('#cx-v2-free-advanced-section'); + + var isHidden =advancedSection.css('display') === 'none'; + + if (isHidden) + { + advancedSection.slideDown(300); + advancedArrow.removeClass('dashicons-arrow-right').addClass('dashicons-arrow-down'); + } + else + { + advancedSection.slideUp(300); + advancedArrow.removeClass('dashicons-arrow-down').addClass('dashicons-arrow-right'); + } +}); + +jQuery('.cx-v2-tab-btn').click(function(e) +{ + e.preventDefault(); + var $btn = jQuery(this); + var tabName = $btn.data('tab'); + + jQuery('.cx-v2-tab-btn').removeClass('compressx-v2-border-b-2 compressx-v2-border-blue-600 compressx-v2-font-medium').addClass('compressx-v2-text-slate-600'); + $btn.removeClass('compressx-v2-text-slate-600').addClass('compressx-v2-border-blue-600 compressx-v2-font-medium compressx-v2-border-b-2'); + + jQuery('[data-tab-panel]').addClass('compressx-v2-hidden'); + jQuery('[data-tab-panel="' + tabName + '"]').removeClass('compressx-v2-hidden'); +}); + +function updateAutoOptimizeSwitch() +{ + var $switchBtn = jQuery('#cx_enable_auto_optimize'); + var $knob = $switchBtn.find('span'); + + var currentState = $switchBtn.attr('data-checked'); + var newState = currentState === '1' ? '0' : '1'; + $switchBtn.attr('data-checked', newState); + + update_switch($switchBtn,$knob); +} + +jQuery('#cx-v2-avoid-larger').on('click', function() +{ + var $switchBtn = jQuery('#cx-v2-avoid-larger'); + var $knob = $switchBtn.find('span'); + + var currentState = $switchBtn.attr('data-checked'); + var newState = currentState === '1' ? '0' : '1'; + $switchBtn.attr('data-checked', newState); + update_switch($switchBtn,$knob); +}); + +jQuery('#cx-v2-resize-enable').on('click', function() +{ + var $switchBtn = jQuery('#cx-v2-resize-enable'); + var $knob = $switchBtn.find('span'); + + var currentState = $switchBtn.attr('data-checked'); + var newState = currentState === '1' ? '0' : '1'; + $switchBtn.attr('data-checked', newState); + update_switch($switchBtn,$knob); +}); + +function update_switch($switchBtn,$knob) +{ + var isChecked = $switchBtn.attr('data-checked') === '1'; + if (isChecked) { + $switchBtn.removeClass('compressx-v2-bg-gray-300'); + $switchBtn.addClass('compressx-v2-bg-blue-600'); + $switchBtn.removeClass('compressx-v2-border-gray-300'); + $switchBtn.addClass('compressx-v2-border-blue-600'); + $knob.css('transform', 'translateX(20px)'); + $switchBtn.attr('aria-checked', 'true'); + } else { + $switchBtn.addClass('compressx-v2-bg-gray-300'); + $switchBtn.removeClass('compressx-v2-bg-blue-600'); + $switchBtn.addClass('compressx-v2-border-gray-300'); + $switchBtn.removeClass('compressx-v2-border-blue-600'); + $knob.css('transform', 'translateX(0px)'); + $switchBtn.attr('aria-checked', 'false'); + } +} + +jQuery(document).ready(function ($) { + var $switchBtn = jQuery('#cx_enable_auto_optimize'); + var $knob = $switchBtn.find('span'); + update_switch($switchBtn,$knob); + + $switchBtn = jQuery('#cx-v2-avoid-larger'); + $knob = $switchBtn.find('span'); + update_switch($switchBtn,$knob); + + $switchBtn = jQuery('#cx-v2-resize-enable'); + $knob = $switchBtn.find('span'); + update_switch($switchBtn,$knob); +}); diff --git a/wp-content/plugins/compressx/includes/display_v2/js/compressx_log.js b/wp-content/plugins/compressx/includes/display_v2/js/compressx_log.js new file mode 100644 index 0000000..3cf9d8a --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/compressx_log.js @@ -0,0 +1,345 @@ +jQuery('#cx_log_list').on("click",'#cx_log_search_by_date',function() +{ + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + + compressx_get_logs_list(start_date,start_time,end_date,end_time); + +}); + +jQuery('#cx_log_list').on("click",'.first-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + compressx_get_logs_list(start_date,start_time,end_date,end_time,'first'); +}); + +jQuery('#cx_log_list').on("click",'.prev-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + var page=parseInt(jQuery(this).attr('value')); + compressx_get_logs_list(start_date,start_time,end_date,end_time,page-1); +}); + +jQuery('#cx_log_list').on("click",'.next-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + var page=parseInt(jQuery(this).attr('value')); + compressx_get_logs_list(start_date,start_time,end_date,end_time,page+1); +}); + +jQuery('#cx_log_list').on("click",'.last-page',function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + compressx_get_logs_list(start_date,start_time,end_date,end_time,'last'); +}); + +jQuery('#cx_log_list').on("keypress", '.current-page', function() { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + if(event.keyCode === 13){ + var page = jQuery(this).val(); + compressx_get_logs_list(start_date,start_time,end_date,end_time,page); + } +}); + +var currentLogFilename=""; + +function compressx_get_logs_list(start_date,start_time,end_date,end_time,page=0) +{ + var ajax_data = { + 'action':'compressx_get_logs_list', + 'start_date':start_date, + 'start_time':start_time, + 'end_date':end_date, + 'end_time':end_time, + 'page':page + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + jQuery('#cx_log_list').html(jsonarray.html); + jQuery('#cx_log_list').find('#cx_log_start_date').val(start_date); + jQuery('#cx_log_list').find('#cx_log_start_time').val(start_time); + jQuery('#cx_log_list').find('#cx_log_end_date').val(end_date); + jQuery('#cx_log_list').find('#cx_log_end_time').val(end_time); + } + else + { + alert(jsonarray.error); + } + } + catch(err) + { + alert(err); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('get logs list', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_close_log').click(function() +{ + jQuery('#cx_log_detail_section').hide(); +}); + +jQuery('#cx_log_list').on("click",'.cs-log-detail',function() +{ + var file_name = jQuery(this).closest('td').data('id'); + compressx_open_log(file_name); +}); + +function compressx_open_log(file_name) +{ + var ajax_data = { + 'action':'compressx_open_log', + 'filename':file_name + }; + + jQuery('#cx_log_name').html(file_name); + jQuery('#cx_read_optimize_log_content').html(""); + jQuery('#cx_log_detail_section').show(); + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + currentLogFilename = file_name; + jQuery('#cx_read_optimize_log_content').val(jsonarray.data); + jQuery('#cx_log_created_date').text(jsonarray.create || '--'); + jQuery('#cx_log_detail_section').show(); + jQuery('html, body').animate({ + scrollTop: jQuery('#cx_log_detail_section').offset().top - 100 + }, 500); + + //jQuery('#cx_read_optimize_log_content').html(jsonarray.html); + //jQuery('html, body').animate({scrollTop: jQuery("#cx_log_scroll_test").offset().top}, 'slow'); + } + else + { + jQuery('#cx_read_optimize_log_content').html(jsonarray.error); + } + } + catch(err) + { + alert(err); + var div = "Reading the log failed. Please try again."; + jQuery('#cx_read_optimize_log_content').html(div); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('open log', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_close_log').on('click', function() { + jQuery('#cx_log_detail_section').hide(); + currentLogFilename = ''; +}); + +jQuery('#cx_download_current_log').on('click', function() { + if (!currentLogFilename) { + alert('No log file is currently open'); + return; + } + + compressx_download_log(currentLogFilename) +}); + +function compressx_download_log(file_name) +{ + location.href =ajaxurl+'?_wpnonce='+compressx_ajax_object.ajax_nonce+'&action=compressx_download_log&log='+file_name; +} + +jQuery('#cx_log_list').on("click",'.cs-log-download',function() +{ + var file_name = jQuery(this).closest('td').data('id'); + compressx_download_log(file_name); +}); + +jQuery('#cx_log_list').on("click",'.cs-log-delete',function() +{ + var file_name = jQuery(this).closest('td').data('id'); + + var descript = 'Are you sure to delete this log file?'; + + var ret = confirm(descript); + if(ret === true) + { + compressx_delete_log(file_name); + } + +}); + +function compressx_delete_log(file_name) +{ + var ajax_data = { + 'action':'compressx_delete_log', + 'filename':file_name + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + + compressx_get_logs_list(start_date,start_time,end_date,end_time); + } + else + { + alert(jsonarray.error); + } + } + catch(err) + { + alert(err); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('delete log', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx_empty_log').click(function() +{ + var descript = 'Are you sure to delete All log file?'; + + var ret = confirm(descript); + if(ret === true) + { + compressx_delete_all_log(); + } +}); + +function compressx_delete_all_log() +{ + var ajax_data = { + 'action':'compressx_delete_all_log', + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + if (jsonarray.result === "success") + { + var start_date = jQuery('#cx_log_list').find('#cx_log_start_date').val(); + var start_time = jQuery('#cx_log_list').find('#cx_log_start_time').val(); + + var end_date = jQuery('#cx_log_list').find('#cx_log_end_date').val(); + var end_time = jQuery('#cx_log_list').find('#cx_log_end_time').val(); + + compressx_get_logs_list(start_date,start_time,end_date,end_time); + } + else + { + alert(jsonarray.error); + } + } + catch(err) + { + alert(err); + } + }, function(XMLHttpRequest, textStatus, errorThrown) + { + var error_message =compressx_output_ajaxerror('delete log', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery(document).ready(function($) { + $('#compressx_show_debug_form').on('click', function() { + $('#compressx_debug_form_section').show(); + $('html, body').animate({ + scrollTop: $('#compressx_debug_form_section').offset().top - 100 + }, 500); + }); + + $('#compressx_debug_submit').on('click', function() { + var user_mail = $('#compressx_user_mail').val().trim(); + var comment = $('#compressx_debug_comment').val().trim(); + + if (!user_mail) { + alert("Please enter your email address."); + $('#compressx_user_mail').focus(); + return; + } + + var $button = $(this); + var originalText = $button.text(); + $button.text("Sending...").prop('disabled', true); + + var ajax_data = { + action: 'compressx_send_debug_info', + user_mail: user_mail, + comment: comment, + }; + + compressx_post_request(ajax_data, function(data) { + try { + var response = jQuery.parseJSON(data); + if (response && response.result === 'success') { + alert("Debug information sent successfully!"); + $('#compressx_debug_form_section').hide(); + $('#compressx_user_mail').val(''); + $('#compressx_debug_comment').val(''); + } else { + alert(response.error || "Failed to send debug information."); + } + } catch(err) { + alert("Failed to send debug information."); + } + $button.text(originalText).prop('disabled', false); + }, function(XMLHttpRequest, textStatus, errorThrown) { + alert("Failed to send debug information."); + $button.text(originalText).prop('disabled', false); + }); + }); + + $('#compressx_download_debug_info').on('click', function() + { + cx_download_website_info(); + }); + + function cx_download_website_info() + { + location.href =ajaxurl+'?_wpnonce='+compressx_ajax_object.ajax_nonce+'&action=compressx_create_debug_package'; + } +}); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/display_v2/js/compressx_media-replace.js b/wp-content/plugins/compressx/includes/display_v2/js/compressx_media-replace.js new file mode 100644 index 0000000..2daaeaa --- /dev/null +++ b/wp-content/plugins/compressx/includes/display_v2/js/compressx_media-replace.js @@ -0,0 +1,444 @@ +jQuery('#cx_replace_media').click(function(e) +{ + e.preventDefault(); + + var input = document.getElementById('compressx-new-media-file'); + var file = input && input.files && input.files[0]; + + if (!file) + { + alert('Please select an image that you want to replace.'); + return; + } + + + var $saveButton = jQuery(this); + $saveButton.css({ 'pointer-events': 'none', 'opacity': '0.4' }); + jQuery('#cx_replace_media_progress').show(); + let attachment_id=jQuery('#compressx_attachment_id').val(); + var ajax_data = { + 'action': 'compressx_replace_media', + 'attachment_id': attachment_id, + }; + + compressx_file_upload_request( + ajax_data, + 'compressx-new-media-file', //file input id + 'image', //$_FILES['image'] + function(data) + { + try + { + var jsonarray = JSON.parse(data); + if (jsonarray.result === 'success') + { + //$saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx_replace_media_progress').hide(); + + jQuery('#cx_replace_media_text').removeClass('compressx-v2-hidden'); + setTimeout(function() { + jQuery('#cx_replace_media_text').addClass('compressx-v2-hidden'); + location.href=compressx_media_replace.redirect_url; + }, 3000); + } + else + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx_replace_media_progress').hide(); + alert(jsonarray.error || 'Failed to save settings.'); + } + } + catch (err) + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx_replace_media_progress').hide(); + alert(err); + } + }, + function(XMLHttpRequest, textStatus, errorThrown) + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx_replace_media_progress').hide(); + var error_message = compressx_output_ajaxerror('saving settings', textStatus, errorThrown); + alert(error_message); + }, + 30000 + ); +}); + +function compressx_file_upload_request(ajax_data, file_input_id, file_field_name, callback, error_callback, time_out) +{ + if (typeof time_out === 'undefined') time_out = 30000; + if (typeof file_field_name === 'undefined' || !file_field_name) file_field_name = 'image'; + + var form_data = (ajax_data instanceof FormData) ? ajax_data : new FormData(); + + if (!(ajax_data instanceof FormData)) { + for (var key in ajax_data) { + if (!ajax_data.hasOwnProperty(key)) continue; + form_data.append(key, ajax_data[key]); + } + } + + form_data.append('nonce', compressx_ajax_object.ajax_nonce); + + var input = document.getElementById(file_input_id); + var file = input && input.files && input.files[0]; + + if (!file) { + if (typeof error_callback === 'function') { + error_callback(null, 'no_file', 'No file selected.'); + } + return; + } + + form_data.append(file_field_name, file); + + jQuery.ajax({ + type: "post", + url: compressx_ajax_object.ajax_url, + data: form_data, + processData: false, + contentType: false, + success: function (data) { + callback(data); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { + error_callback(XMLHttpRequest, textStatus, errorThrown); + }, + timeout: time_out + }); +} + +jQuery(function ($) +{ + // ===== Helpers ===== + function cx_getSettingsPayload() + { + const auto_re_optimize = $('#cx_auto_re_optimize').is(':checked') ? 1 : 0; + const thumbnail_generation = $('input[name="thumbnail_strategy"]:checked').val() || 'default_fill'; + + return { + auto_re_optimize, + thumbnail_generation, + }; + } + + let ajaxTimer = null; + function compressx_save_media_replace_setting(triggerEl,triggerNotice) + { + window.clearTimeout(ajaxTimer); + + ajaxTimer = window.setTimeout(function () + { + const payload = cx_getSettingsPayload(); + + var ajax_data = { + 'action': 'compressx_save_media_replace_setting', + 'settings': payload, + }; + + jQuery(triggerEl).css({'pointer-events': 'none', 'opacity': '0.4'}); + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + jQuery(triggerEl).css({'pointer-events': 'auto', 'opacity': '1'}); + if (jsonarray.result === 'success') + { + jQuery(triggerNotice).removeClass("hidden"); + setTimeout(function () + { + jQuery(triggerNotice).addClass( 'hidden' ); + }, 3000); + } + + } + catch (err) + { + alert(err); + jQuery(triggerEl).css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('triggerEl').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); + }, 200); + } + + // ===== Bindings ===== + // checkbox change + $(document).on('change', '#cx_auto_re_optimize', function () + { + var notice= jQuery("#auto_re_optimize-saved-indicator"); + compressx_save_media_replace_setting(this,notice); + }); + + $(document).on('change', '#cx_backup_original', function () + { + var notice= jQuery("#cx_backup_original-saved-indicator"); + compressx_save_media_replace_setting(this,notice); + }); + + // radio change + $(document).on('change', 'input[name="thumbnail_strategy"]', function () + { + var thumbnail_generation = $('input[name="thumbnail_strategy"]:checked').val() || 'default_fill'; + var notice=null; + if(thumbnail_generation==='default_fill') + { + notice= jQuery("#default_fill-saved-indicator"); + } + else + { + notice= jQuery("#match_original-saved-indicator"); + } + compressx_save_media_replace_setting(this,notice); + }); + //cx_backup_keep_versions + $(document).on('change', '#cx_backup_keep_versions', function () + { + var notice= jQuery("#cx_backup_keep_versions-saved-indicator"); + compressx_save_media_replace_setting(this,notice); + }); + + $(document).on('change', '#cx_backup_keep_date', function () + { + var notice= jQuery("#cx_backup_keep_date-saved-indicator"); + compressx_save_media_replace_setting(this,notice); + }); +}); + +jQuery(function ($) +{ + var og_type= compressx_media_replace.type; + var $dz = $("#compressx-new-media-dropzone"); + var $inp = $("#compressx-new-media-file"); + + var $lay = $("#compressx-new-media-preview-layout"); + var $pclk = $("#compressx-new-media-preview-click"); + var $pre = $("#compressx-new-media-preview"); + + var $remove = $("#compressx-remove-new-media-preview"); + + var $dim = $("#compressx-new-media-dim"); + var $size = $("#compressx-new-media-size"); + var $fmt = $("#compressx-new-media-format"); + + var lastUrl = null; + + function humanSize(bytes) { + if (bytes === undefined || bytes === null) return "—"; + var units = ["B", "KB", "MB", "GB"], i = 0, n = bytes; + while (n >= 1024 && i < units.length - 1) { n /= 1024; i++; } + var fixed = i === 0 ? 0 : (n >= 10 ? 0 : 1); + return n.toFixed(fixed) + " " + units[i]; + } + + function getFormat(file) { + if (file.type) { + var p = file.type.split("/"); + return (p[1] || "—").toUpperCase(); + } + var m = (file.name || "").match(/\.([a-z0-9]+)$/i); + return m ? m[1].toUpperCase() : "—"; + } + + function showEmpty() { + $lay.hide(); + $dz.show(); + } + + function showFilled() { + $dz.hide(); + $lay.show(); + } + + function setFile(file) { + if (!file) return; + + if (!file.type || file.type.indexOf("image/") !== 0) { + alert("Please choose an image file."); + return; + } + + try + { + var dt = new DataTransfer(); + dt.items.add(file); + $inp[0].files = dt.files; + } catch (e) {} + + $size.text(humanSize(file.size)); + $fmt.text(getFormat(file)); + + var url = URL.createObjectURL(file); + var img = new Image(); + + img.onload = function () + { + $dim.text(img.naturalWidth + " × " + img.naturalHeight); + + if (lastUrl) URL.revokeObjectURL(lastUrl); + lastUrl = url; + + $pre.attr("src", url); + cx_showNotice(img.naturalWidth,img.naturalHeight,file.type); + + }; + + img.onerror = function () + { + URL.revokeObjectURL(url); + alert("Failed to read the image."); + $inp.val(""); + $dim.text("—"); $size.text("—"); $fmt.text("—"); + $pre.attr("src", ""); + showEmpty(); + }; + + img.src = url; + } + + function openDialog() { + $inp[0].click(); + } + + function removeImage() + { + $inp.val(""); + + $pre.attr("src", ""); + $dim.text("—"); + $size.text("—"); + $fmt.text("—"); + + if (lastUrl) { + URL.revokeObjectURL(lastUrl); + lastUrl = null; + } + + $lay.hide(); + $dz.show(); + } + + $dz.on("click", openDialog); + + $pclk.on("click", openDialog); + + $remove.on("click", removeImage); + + $inp.on("change", function () { + var file = this.files && this.files[0]; + if (file) setFile(file); + }); + + $dz.on("dragenter dragover", function (e) { + e.preventDefault(); e.stopPropagation(); + $dz.addClass("compressx-drop-active"); + }); + $dz.on("dragleave drop", function (e) { + e.preventDefault(); e.stopPropagation(); + $dz.removeClass("compressx-drop-active"); + }); + + $dz.on("drop", function (e) { + var files = e.originalEvent && e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files; + var file = files && files[0]; + if (file) setFile(file); + }); + + showEmpty(); + + function cx_showNotice(width,height,mimetype) + { + let og_w=$("#og_image_dimensions").data("width"); + let og_h=$("#og_image_dimensions").data("height"); + + let og_mime=$("#og_image_dimensions").data("mime"); + if(mimetype!==og_mime) + { + $("#cx-upload-notice").show(); + $("#cx_notice_title").html("File format must match"); + $("#cx_notice_content").html("The replacement file must use the same format as the current media ("+og_mime+" → "+mimetype+" detected). Please upload a "+og_type+" file to avoid unexpected issues."); + removeImage(); + return; + } + + showFilled(); + /* + if(og_w>width) + { + $("#cx-upload-notice").show(); + $("#cx_notice_title").html("Smaller Image Detected"); + $("#cx_notice_content").html("The replacement image is smaller than the original. Some larger thumbnail sizes may not be generated, which can affect pages that reference those sizes."); + } + else if(og_w b1.text.toLowerCase()) ? 1 : -1; + } else { + return (a1.icon > b1.icon) ? 1 : -1; + } + }, + }); +} + +jQuery(document).ready(function () +{ + compressx_init_exclude_tree(); + + jQuery('#cx-v2-show-more-size').click(function() { + jQuery('.cx-v2-thumbnail-size').show(); + jQuery(this).hide(); + }); + + jQuery('#cx-v2-save-settings').click(function(e) + { + e.preventDefault(); + + var $saveButton = jQuery(this); + var originalText = $saveButton.text(); + + $saveButton.css({ 'pointer-events': 'none', 'opacity': '0.4' }); + jQuery('#cx-v2-save-settings-progress').show(); + + var settings = { + size_settings: {}, + list_view_setting: {}, + cache_control_setting: {}, + scan_page_setting:{}, + }; + + jQuery('input[option="size_setting"]').each(function() { + var name = jQuery(this).attr('name'); + var checked = jQuery(this).is(':checked'); + settings.size_settings[name] = checked; + }); + + jQuery('input[option="list_view_setting"]').each(function() { + var name = jQuery(this).attr('name'); + var checked = jQuery(this).is(':checked'); + settings.list_view_setting[name] = checked ? '1' : '0'; + }); + + jQuery('input[option="cache_control_setting"]').each(function() { + var name = jQuery(this).attr('name'); + var checked = jQuery(this).is(':checked'); + settings.cache_control_setting[name] = checked ? '1' : '0'; + }); + + jQuery('input[option="scan_page_setting"]').each(function() { + var name = jQuery(this).attr('name'); + var value = parseInt(jQuery(this).val(), 10); + + if (isNaN(value) || value <= 0) { + value = 500; + } + + settings.scan_page_setting[name] = value; + }); + + var select_folders = jQuery('#compressx_exclude_dir_node').find('.cx-remove-custom-exclude-tree'); + var json = {}; + jQuery.each(select_folders, function () + { + var value=jQuery(this).data("id"); + //var value = select_item.data( 'id' ); + json[value]=value; + }); + + var exclude_node=JSON.stringify(json); + + // + var ajax_data = { + 'action': 'compressx_v2_save_settings', + 'settings': JSON.stringify(settings), + 'excludes':exclude_node, + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = JSON.parse(data); + if (jsonarray.result === 'success') + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + + jQuery('#cx-v2-save-settings-text').removeClass('hidden'); + setTimeout(function() { + jQuery('#cx-v2-save-settings-text').addClass('hidden'); + }, 3000); + } + else + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + alert(jsonarray.error || 'Failed to save settings.'); + } + } + catch (err) + { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + alert('An error occurred while saving settings.'); + } + }, function(XMLHttpRequest, textStatus, errorThrown) { + $saveButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-save-settings-progress').hide(); + var error_message = compressx_output_ajaxerror('saving settings', textStatus, errorThrown); + alert(error_message); + }); + }); +}); + +jQuery('#compressx_exclude_js_tree').on('click', '.cx-add-custom-exclude-tree', function() +{ + var id=jQuery(this).data("id"); + var node=jQuery(this).parent(); + + var select_folders = jQuery('#compressx_exclude_dir_node').find('.cx-remove-custom-exclude-tree'); + var json = {}; + var bfind=false; + + jQuery.each(select_folders, function () + { + var value=jQuery(this).data("id"); + if(value==id) + { + bfind=true; + } + }); + + if(bfind) + return; + + var ajax_data = { + 'action': 'compressx_add_exclude_folder', + 'id': id, + }; + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + + if (jsonarray.result === 'success') + { + jQuery('#compressx_exclude_dir_node').find('ul:first').append(jsonarray.html); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); + +}); + +jQuery('#compressx_exclude_dir_node').on('click', '.cx-remove-custom-exclude-tree', function() +{ + var id=jQuery(this).data("id"); + var node=jQuery(this).parent(); + node.remove(); +}); + +function compressx_add_exclude_folders() +{ + var select_folders = jQuery('#compressx_exclude_dir_node').find('.cx-remove-custom-exclude-tree'); + var json = {}; + jQuery.each(select_folders, function () + { + var value=jQuery(this).data("id"); + //var value = select_item.data( 'id' ); + json[value]=value; + }); + + var exclude_node=JSON.stringify(json); + var ajax_data = { + 'action': 'compressx_add_exclude_folders', + 'excludes': exclude_node, + }; + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'none', 'opacity': '0.4'}); + jQuery('#compressx_save_exclude_progress').show(); + + compressx_post_request(ajax_data, function (data) + { + try + { + var jsonarray = jQuery.parseJSON(data); + jQuery('#compressx_save_exclude_progress').hide(); + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + if (jsonarray.result === 'success') + { + jQuery('#compressx_save_exclude_text').removeClass("hidden"); + setTimeout(function () + { + jQuery('#compressx_save_exclude_text').addClass( 'hidden' ); + }, 3000); + + jQuery('#compressx_exclude_dir_node').html(jsonarray.html); + } + else { + alert(jsonarray.error); + } + } + catch (err) + { + alert(err); + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_save_exclude_progress').hide(); + } + }, function (XMLHttpRequest, textStatus, errorThrown) + { + jQuery('#compressx_add_exclude_folders').css({'pointer-events': 'auto', 'opacity': '1'}); + jQuery('#compressx_add_exclude_folders').hide(); + var error_message = compressx_output_ajaxerror('changing settings', textStatus, errorThrown); + alert(error_message); + }); +} + +jQuery('#cx-v2-delete-file').click(function() { + var confirm_text = jQuery('#cx-v2-confirm-delete-file').val(); + if (confirm_text !== 'DELETE') { + alert('Please type "DELETE" to confirm.'); + return; + } + + if (!confirm('Are you sure you want to delete all WebP and AVIF images? This action cannot be undone.')) { + return; + } + + var $deleteButton = jQuery(this); + $deleteButton.css({ 'pointer-events': 'none', 'opacity': '0.4' }); + jQuery('#cx-v2-delete-file-progress').show(); + + var ajax_data = { + 'action': 'compressx_delete_files' + }; + + compressx_post_request(ajax_data, function(data) + { + try + { + var jsonarray = JSON.parse(data); + if (jsonarray.result === 'success') + { + $deleteButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-delete-file-progress').hide(); + + jQuery('#cx-v2-delete-file-success').removeClass('hidden'); + jQuery('#cx-v2-confirm-delete-file').val(''); + setTimeout(function() { + jQuery('#cx-v2-delete-file-success').addClass('hidden'); + }, 3000); + } else { + $deleteButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-delete-file-progress').hide(); + alert(jsonarray.error || 'Failed to delete files.'); + } + } catch (err) { + $deleteButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-delete-file-progress').hide(); + alert('An error occurred while deleting files.'); + } + }, function(XMLHttpRequest, textStatus, errorThrown) { + $deleteButton.css({ 'pointer-events': 'auto', 'opacity': '1' }); + jQuery('#cx-v2-delete-file-progress').hide(); + var error_message = compressx_output_ajaxerror('deleting files', textStatus, errorThrown); + alert(error_message); + }); +}); \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/meta/class-compressx-custom-image-meta.php b/wp-content/plugins/compressx/includes/meta/class-compressx-custom-image-meta.php new file mode 100644 index 0000000..6cc7991 --- /dev/null +++ b/wp-content/plugins/compressx/includes/meta/class-compressx-custom-image-meta.php @@ -0,0 +1,175 @@ +prefix . "compressx_files_opt_meta"; + if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) + { + $sql = "CREATE TABLE $table_name ( + id int NOT NULL AUTO_INCREMENT, + path text NOT NULL, + type text NOT NULL, + path_hash CHAR(32), + convert_webp_status int, + convert_avif_status int, + error text, + quality text NOT NULL, + og_size int(10) unsigned, + convert_webp_size int(10) unsigned, + convert_avif_size int(10) unsigned, + meta text, + PRIMARY KEY (id), + UNIQUE KEY path_hash (path_hash) + );"; + //reference to upgrade.php file + dbDelta( $sql ); + } + } + + public static function get_custom_image_meta($filename) + { + global $wpdb; + $table_name = $wpdb->prefix . "compressx_files_opt_meta"; + $path_hash= md5( $filename ); + $results = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $table_name WHERE path_hash=%s",$path_hash), ARRAY_A ); + + if(empty($results)) + { + return false; + } + else + { + return $results[0]; + } + } + + public static function generate_custom_image_meta($filename,$options) + { + $image_optimize_meta['convert_webp_status']=0; + $image_optimize_meta['convert_avif_status']=0; + $image_optimize_meta['error']=""; + + $image_optimize_meta['quality']=$options['quality']; + + $image_optimize_meta['og_size']=filesize($filename); + $image_optimize_meta['convert_webp_size']=0; + $image_optimize_meta['convert_avif_size']=0; + + $image_optimize_meta['path'] = $filename; + $type=pathinfo($filename, PATHINFO_EXTENSION); + $image_optimize_meta['type'] =$type; + $image_optimize_meta['path_hash'] = md5( $filename ); + $image_optimize_meta['meta']=''; + + global $wpdb; + $path_hash= md5( $filename ); + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}compressx_files_opt_meta WHERE path_hash =%s",$path_hash),ARRAY_A); + if (empty($results)) + { + $wpdb->insert($wpdb->prefix.'compressx_files_opt_meta',$image_optimize_meta); + } + else + { + $where['path']=$filename; + $wpdb->update($wpdb->prefix.'compressx_files_opt_meta',$image_optimize_meta,$where); + } + + return $image_optimize_meta; + } + + public static function update_custom_image_meta($filename,$image_optimize_meta) + { + global $wpdb; + $path_hash= md5( $filename ); + $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}compressx_files_opt_meta WHERE path_hash =%s",$path_hash),ARRAY_A); + unset($image_optimize_meta['id']); + unset($image_optimize_meta['path_hash']); + if (empty($results)) + { + $wpdb->insert($wpdb->prefix.'compressx_files_opt_meta',$image_optimize_meta); + } + else + { + $where['path_hash']=$path_hash; + $wpdb->update($wpdb->prefix.'compressx_files_opt_meta',$image_optimize_meta,$where); + } + } + + public static function get_image_status($path) + { + $status['convert_webp_status']=CompressX_Custom_Image_Meta::is_convert_webp($path); + $status['convert_avif_status']=CompressX_Custom_Image_Meta::is_convert_avif($path); + + return $status; + } + + public static function is_convert_webp($path) + { + global $wpdb; + $table=$wpdb->prefix.'compressx_files_opt_meta'; + $path_hash= md5( $path ); + $result=$wpdb->get_results($wpdb->prepare("SELECT * FROM $table WHERE `path_hash`=%s AND `convert_webp_status`=1",$path_hash),ARRAY_N); + if(!empty($result) && sizeof($result)>0) + { + return true; + } + else + { + return false; + } + } + + public static function is_convert_avif($path) + { + global $wpdb; + $table=$wpdb->prefix.'compressx_files_opt_meta'; + $path_hash= md5( $path ); + $result=$wpdb->get_results($wpdb->prepare("SELECT * FROM $table WHERE `path_hash`=%s AND `convert_avif_status`=1",$path_hash),ARRAY_N); + if(!empty($result) && sizeof($result)>0) + { + return true; + } + else + { + return false; + } + } + + public static function get_convert_webp_size($path) + { + global $wpdb; + $table=$wpdb->prefix.'compressx_files_opt_meta'; + $path_hash= md5( $path ); + $result=$wpdb->get_results($wpdb->prepare("SELECT `convert_webp_size` FROM $table WHERE `path_hash`=%s",$path_hash),ARRAY_N); + if(!empty($result) && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } + + public static function get_convert_avif_size($path) + { + global $wpdb; + $table=$wpdb->prefix.'compressx_files_opt_meta'; + $path_hash= md5( $path ); + $result=$wpdb->get_results( $wpdb->prepare("SELECT `convert_avif_size` FROM $table WHERE `path_hash`=%s",$path_hash),ARRAY_N); + if(!empty($result) && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/meta/class-compressx-image-meta-v2.php b/wp-content/plugins/compressx/includes/meta/class-compressx-image-meta-v2.php new file mode 100644 index 0000000..1b92199 --- /dev/null +++ b/wp-content/plugins/compressx/includes/meta/class-compressx-image-meta-v2.php @@ -0,0 +1,1054 @@ +base_prefix . self::TABLE_SLUG; + } + + private static function get_blog_id() + { + if (is_multisite()) + { + return (int)get_current_blog_id(); + } + return 1; + } + + public static function ensure_table() + { + if (self::$ready) + { + return; + } + + global $wpdb; + $table_name =self::table_name(); + + $exists = $wpdb->get_var( + $wpdb->prepare("SHOW TABLES LIKE %s", $table_name) + ); + + if ($exists !== $table_name) + { + require_once ABSPATH . 'wp-admin/includes/upgrade.php'; + + $charset_collate = $wpdb->get_charset_collate(); + + $sql = "CREATE TABLE {$table_name} ( + id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + blog_id BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + attachment_id BIGINT(20) UNSIGNED NOT NULL, + + mime_type VARCHAR(40) NOT NULL DEFAULT '', + + status VARCHAR(20) NOT NULL DEFAULT '', + webp_converted TINYINT(1) NOT NULL DEFAULT 0, + avif_converted TINYINT(1) NOT NULL DEFAULT 0, + + og_file_size BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + webp_converted_size BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + avif_converted_size BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + + sum_size BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + webp_sum_converted_size BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + avif_sum_converted_size BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, + + resize_status TINYINT(1) NOT NULL DEFAULT 0, + + details LONGTEXT NULL, + + updated_at DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + created_at DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + data_version SMALLINT(5) UNSIGNED NOT NULL DEFAULT 1, + + PRIMARY KEY (id), + UNIQUE KEY uniq_blog_attachment (blog_id, attachment_id), + KEY idx_mime_type (mime_type), + KEY idx_status (status), + KEY idx_webp (webp_converted), + KEY idx_avif (avif_converted), + KEY idx_updated_at (updated_at) + ) {$charset_collate};"; + + dbDelta($sql); + } + + self::$ready = true; + } + + private static function get_row_id($image_id) + { + self::ensure_table(); + global $wpdb; + $table = self::table_name(); + $blog_id = self::get_blog_id(); + return (int) $wpdb->get_var( + $wpdb->prepare("SELECT id FROM {$table} WHERE blog_id=%d AND attachment_id=%d LIMIT 1", $blog_id, $image_id) + ); + } + + private static function get_row($image_id) + { + self::ensure_table(); + + global $wpdb; + $table = self::table_name(); + $blog_id = self::get_blog_id(); + $row = $wpdb->get_row( + $wpdb->prepare( + "SELECT * FROM {$table} WHERE blog_id=%d AND attachment_id=%d LIMIT 1", + $blog_id, + $image_id + ), + ARRAY_A + ); + + return $row ? $row : false; + } + + private static function row_to_meta($row) + { + $meta = array(); + + if (!empty($row['details'])) + { + $decoded = json_decode($row['details'], true); + if (is_array($decoded)) + { + $meta = $decoded; + } + } + + $meta['status'] = isset($row['status']) ? $row['status'] : ''; + $meta['webp_converted'] = isset($row['webp_converted']) ? (int)$row['webp_converted'] : 0; + $meta['avif_converted'] = isset($row['avif_converted']) ? (int)$row['avif_converted'] : 0; + + $meta['og_file_size'] = isset($row['og_file_size']) ? (int)$row['og_file_size'] : 0; + $meta['webp_converted_size'] = isset($row['webp_converted_size']) ? (int)$row['webp_converted_size'] : 0; + $meta['avif_converted_size'] = isset($row['avif_converted_size']) ? (int)$row['avif_converted_size'] : 0; + + $meta['sum_size'] = isset($row['sum_size']) ? (int)$row['sum_size'] : 0; + $meta['webp_sum_converted_size'] = isset($row['webp_sum_converted_size']) ? (int)$row['webp_sum_converted_size'] : 0; + $meta['avif_sum_converted_size'] = isset($row['avif_sum_converted_size']) ? (int)$row['avif_sum_converted_size'] : 0; + + + $meta['resize_status'] = isset($row['resize_status']) ? (int)$row['resize_status'] : 0; + + $meta['mime_type'] = isset($row['mime_type']) ? $row['mime_type'] : ''; + + return $meta; + } + + private static function upgrade_row($image_id, $meta) + { + self::ensure_table(); + + global $wpdb; + $table = self::table_name(); + $blog_id = self::get_blog_id(); + $post = get_post($image_id); + $mime_type = ''; + if ($post && $post->post_type === 'attachment') + { + $mime_type = (string)$post->post_mime_type; + } + + $details = self::fix_meta($meta); + + $now = current_time('mysql'); + + $data = array( + 'blog_id' => (int)$blog_id, + 'attachment_id' => (int)$image_id, + + 'mime_type' => $mime_type, + + 'status' => isset($meta['status']) ? (string)$meta['status'] : '', + 'webp_converted' => !empty($meta['webp_converted']) ? 1 : 0, + 'avif_converted' => !empty($meta['avif_converted']) ? 1 : 0, + + 'og_file_size' => isset($meta['og_file_size']) ? (int)$meta['og_file_size'] : 0, + 'webp_converted_size' => isset($meta['webp_converted_size']) ? (int)$meta['webp_converted_size'] : 0, + 'avif_converted_size' => isset($meta['avif_converted_size']) ? (int)$meta['avif_converted_size'] : 0, + + 'sum_size' => 0, + 'webp_sum_converted_size' => 0, + 'avif_sum_converted_size' => 0, + + + 'resize_status' => isset($meta['resize_status']) ? (int)$meta['resize_status'] : 0, + + 'details' => wp_json_encode($details), + 'updated_at' => $now, + ); + + $row_id = self::get_row_id($image_id); + + if ($row_id > 0) + { + $wpdb->update($table, $data, array('id' => $row_id)); + } else { + $data['created_at'] = $now; + $wpdb->insert($table, $data); + } + + return true; + } + + private static function upsert_row($image_id, $meta) + { + self::ensure_table(); + + global $wpdb; + $table = self::table_name(); + + $now = current_time('mysql'); + $blog_id = self::get_blog_id(); + $data = array( + 'blog_id' => (int)$blog_id, + 'attachment_id' => (int)$image_id, + 'mime_type' => isset($meta['mime_type']) ? (string)$meta['mime_type'] : '', + 'status' => isset($meta['status']) ? (string)$meta['status'] : '', + 'webp_converted' => !empty($meta['webp_converted']) ? 1 : 0, + 'avif_converted' => !empty($meta['avif_converted']) ? 1 : 0, + + 'og_file_size' => isset($meta['og_file_size']) ? (int)$meta['og_file_size'] : 0, + 'webp_converted_size' => isset($meta['webp_converted_size']) ? (int)$meta['webp_converted_size'] : 0, + 'avif_converted_size' => isset($meta['avif_converted_size']) ? (int)$meta['avif_converted_size'] : 0, + + 'sum_size' => isset($meta['sum_size']) ? (int)$meta['sum_size'] : 0, + 'webp_sum_converted_size' => isset($meta['webp_sum_converted_size']) ? (int)$meta['webp_sum_converted_size'] : 0, + 'avif_sum_converted_size' => isset($meta['avif_sum_converted_size']) ? (int)$meta['avif_sum_converted_size'] : 0, + + 'resize_status' => isset($meta['resize_status']) ? (int)$meta['resize_status'] : 0, + + 'details' => wp_json_encode($meta), + 'updated_at' => $now, + ); + + $row_id = self::get_row_id($image_id); + + if ($row_id > 0) + { + $result = $wpdb->update($table, $data, array('id' => $row_id)); + } else { + $data['created_at'] = $now; + $result = $wpdb->insert($table, $data); + } + + return ($result !== false); + } + + public static function fix_meta($old_meta) + { + unset($old_meta['quality']); + unset($old_meta['compressed']); + unset($old_meta['compressed_size']); + + return $old_meta; + } + + private static function delete_legacy_meta($image_id) + { + delete_post_meta($image_id,'compressx_image_meta'); + delete_post_meta($image_id,'compressx_image_progressing'); + delete_post_meta($image_id,'compressx_image_meta_status'); + + delete_post_meta($image_id,'compressx_image_meta_webp_converted'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted'); + delete_post_meta($image_id,'compressx_image_meta_compressed'); + + delete_post_meta($image_id,'compressx_image_meta_og_file_size'); + delete_post_meta($image_id,'compressx_image_meta_webp_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_compressed_size'); + } + + public static function upgrade_image_meta($image_id) + { + self::ensure_table(); + + if (self::get_row_id($image_id) > 0) + { + return true; + } + + $meta = get_post_meta($image_id, 'compressx_image_meta', true); + if (!is_array($meta) || empty($meta)) + { + return false; + } + + if(self::upgrade_row($image_id, $meta)) + { + self::delete_legacy_meta($image_id); + + return true; + } + else + { + return false; + } + } + + public static function has_image_meta($image_id) + { + self::ensure_table(); + if (self::get_row_id($image_id) > 0) + { + return true; + } + + if(empty(get_post_meta( $image_id, 'compressx_image_meta', true ))) + { + return false; + } + else + { + self::upgrade_image_meta($image_id); + return true; + } + } + + public static function get_image_meta($image_id) + { + self::ensure_table(); + + $row = self::get_row($image_id); + if ($row) + { + return self::row_to_meta($row); + } + + $legacy = get_post_meta($image_id, 'compressx_image_meta', true); + if (empty($legacy)) + { + return $legacy; + } + + // 3) upgrade + self::upgrade_image_meta($image_id); + + // 4) read again + $row = self::get_row($image_id); + if ($row) + { + return self::row_to_meta($row); + } + + return $legacy; + } + + public static function get_image_meta_value($image_id,$key) + { + $meta = self::get_image_meta($image_id); + + if (empty($meta) || !is_array($meta)) + { + return false; + } + + if (isset($meta[$key])) + { + return $meta[$key]; + } + + return false; + } + + public static function generate_images_meta($image_id, $options=array()) + { + self::ensure_table(); + + $file_path = get_attached_file($image_id); + $image_optimize_meta = array(); + + delete_post_meta($image_id, 'compressx_image_meta_webp_converted'); + delete_post_meta($image_id, 'compressx_image_meta_avif_converted'); + delete_post_meta($image_id, 'compressx_image_meta_compressed'); + delete_post_meta($image_id, 'compressx_image_meta_og_file_size'); + delete_post_meta($image_id, 'compressx_image_meta_webp_converted_size'); + delete_post_meta($image_id, 'compressx_image_meta_avif_converted_size'); + delete_post_meta($image_id, 'compressx_image_meta_compressed_size'); + delete_post_meta($image_id, 'compressx_image_meta_status'); + delete_post_meta($image_id, 'compressx_image_meta'); + + $post = get_post($image_id); + $image_optimize_meta['mime_type'] = ''; + if ($post && $post->post_type === 'attachment') + { + $image_optimize_meta['mime_type'] = (string)$post->post_mime_type; + } + + $image_optimize_meta['status'] = 'unoptimized'; + $image_optimize_meta['webp_converted'] = 0; + $image_optimize_meta['avif_converted'] = 0; + // $image_optimize_meta['compressed'] = 0; + + $image_optimize_meta['resize_status'] = 0; + $image_optimize_meta['compress_status'] = 0; + + // $image_optimize_meta['quality'] = $options['quality']; + + $image_optimize_meta['og_file_size'] = file_exists($file_path) ? (int)filesize($file_path) : 0; + + $image_optimize_meta['webp_converted_size'] = 0; + $image_optimize_meta['avif_converted_size'] = 0; + + $image_optimize_meta['sum_size'] = 0; + $image_optimize_meta['webp_sum_converted_size'] = 0; + $image_optimize_meta['avif_sum_converted_size'] = 0; + + $meta = wp_get_attachment_metadata($image_id, true); + + // og + $image_optimize_meta['size']['og'] = array( + 'convert_webp_status' => 0, + 'convert_avif_status' => 0, + 'status' => 'unoptimized', + 'error' => '', + 'file' => get_post_meta($image_id, '_wp_attached_file', true), + ); + + // thumbnails + if (!empty($meta['sizes']) && is_array($meta['sizes'])) + { + foreach ($meta['sizes'] as $size_key => $size_data) + { + $image_optimize_meta['size'][$size_key] = array( + 'convert_webp_status' => 0, + 'convert_avif_status' => 0, + 'file_size'=>0, + 'webp_converted_size'=>0, + 'avif_converted_size'=>0, + 'status' => 'unoptimized', + 'error' => '', + 'file' => isset($size_data['file']) ? $size_data['file'] : '', + ); + } + } + + self::upsert_row($image_id, $image_optimize_meta); + + return $image_optimize_meta; + } + + public static function update_images_meta_value($image_id, $key, $value) + { + $image_optimize_meta = self::get_image_meta($image_id); + if (empty($image_optimize_meta) || !is_array($image_optimize_meta)) { + $image_optimize_meta = array(); + } + + $image_optimize_meta[$key] = $value; + + self::update_images_meta($image_id, $image_optimize_meta); + } + + public static function update_image_meta_size($image_id, $size_key, $size_meta) + { + $image_optimize_meta = self::get_image_meta($image_id); + if (empty($image_optimize_meta) || !is_array($image_optimize_meta)) { + $image_optimize_meta = array(); + } + + if (!isset($image_optimize_meta['size']) || !is_array($image_optimize_meta['size'])) { + $image_optimize_meta['size'] = array(); + } + + $image_optimize_meta['size'][$size_key] = $size_meta; + + self::update_images_meta($image_id, $image_optimize_meta); + } + + private static function update_row($image_id, $meta) + { + self::ensure_table(); + + global $wpdb; + $table = self::table_name(); + + $row_id = self::get_row_id($image_id); + if ($row_id <= 0) + { + return false; + } + + $now = current_time('mysql'); + + $data = array( + 'mime_type' => isset($meta['mime_type']) ? (string)$meta['mime_type'] : '', + 'status' => isset($meta['status']) ? (string)$meta['status'] : '', + 'webp_converted' => !empty($meta['webp_converted']) ? 1 : 0, + 'avif_converted' => !empty($meta['avif_converted']) ? 1 : 0, + + 'og_file_size' => isset($meta['og_file_size']) ? (int)$meta['og_file_size'] : 0, + 'webp_converted_size' => isset($meta['webp_converted_size']) ? (int)$meta['webp_converted_size'] : 0, + 'avif_converted_size' => isset($meta['avif_converted_size']) ? (int)$meta['avif_converted_size'] : 0, + + 'sum_size' => isset($meta['sum_size']) ? (int)$meta['sum_size'] : 0, + 'webp_sum_converted_size' => isset($meta['webp_sum_converted_size']) ? (int)$meta['webp_sum_converted_size'] : 0, + 'avif_sum_converted_size' => isset($meta['avif_sum_converted_size']) ? (int)$meta['avif_sum_converted_size'] : 0, + + 'resize_status' => isset($meta['resize_status']) ? (int)$meta['resize_status'] : 0, + + 'details' => wp_json_encode($meta), + 'updated_at' => $now, + ); + + $result = $wpdb->update($table, $data, array('id' => $row_id)); + + return ($result !== false); + } + + public static function update_images_meta($image_id, $meta) + { + self::ensure_table(); + + $current = self::get_image_meta($image_id); + if (empty($current) || !is_array($current)) + { + return false; + } + + if (is_array($meta)) + { + $meta = array_replace_recursive($current, $meta); + } else { + $meta = $current; + } + + if (!isset($meta['mime_type']) || $meta['mime_type'] === '') + { + $post = get_post($image_id); + if ($post && $post->post_type === 'attachment') { + $meta['mime_type'] = (string)$post->post_mime_type; + } + } + + return self::update_row($image_id, $meta); + } + + public static function delete_image_meta($image_id) + { + self::ensure_table(); + + global $wpdb; + $table = self::table_name(); + $blog_id = self::get_blog_id(); + $result = $wpdb->delete( + $table, + array( + 'blog_id' => (int)$blog_id, + 'attachment_id' => (int)$image_id + ), + array('%d', '%d') + ); + + self::delete_legacy_meta($image_id); + + return ($result !== false); + } + + public static function delete_all_image_meta() + { + self::ensure_table(); + + global $wpdb; + $table = self::table_name(); + + $result = $wpdb->query("TRUNCATE TABLE {$table}"); + return ($result !== false); + } + + private static function get_row_value($image_id, $column) + { + self::ensure_table(); + + $allowed = array( + 'status', + 'mime_type', + 'webp_converted', + 'avif_converted', + 'og_file_size', + 'webp_converted_size', + 'avif_converted_size', + 'og_file_size', + 'webp_converted_size', + 'avif_converted_size', + + 'resize_status', + 'updated_at', + 'created_at', + 'data_version', + ); + + if (!in_array($column, $allowed, true)) { + return null; + } + + global $wpdb; + $table = self::table_name(); + + $sql = "SELECT {$column} FROM {$table} WHERE blog_id=%d AND attachment_id=%d LIMIT 1"; + $blog_id = self::get_blog_id(); + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared + $value = $wpdb->get_var($wpdb->prepare($sql, $blog_id, $image_id)); + + return $value; + } + + public static function get_image_meta_status($image_id) + { + $status = self::get_row_value($image_id, 'status'); + if (!is_null($status) && $status !== '') + { + return (string)$status; + } + + $meta = self::get_image_meta($image_id); + if (is_array($meta) && isset($meta['status'])) + { + return (string)$meta['status']; + } + + return ''; + } + + public static function update_image_meta_status($image_id, $status) + { + if(!self::has_image_meta($image_id)) + { + self::generate_images_meta($image_id); + } + + $meta['status'] = $status; + + return self::update_images_meta($image_id, $meta); + } + + public static function get_image_meta_webp_converted($image_id) + { + $val = self::get_row_value($image_id, 'webp_converted'); + if (!is_null($val)) { + return (int)$val; + } + + // fallback -> trigger upgrade if legacy exists + $meta = self::get_image_meta($image_id); + if (!is_array($meta)) { + return 0; + } + + $val = self::get_row_value($image_id, 'webp_converted'); + if (!is_null($val)) { + return (int)$val; + } + + return isset($meta['webp_converted']) ? (int)$meta['webp_converted'] : 0; + } + + public static function get_image_meta_avif_converted($image_id) + { + $val = self::get_row_value($image_id, 'avif_converted'); + if (!is_null($val)) { + return (int)$val; + } + + $meta = self::get_image_meta($image_id); + if (!is_array($meta)) { + return 0; + } + + $val = self::get_row_value($image_id, 'avif_converted'); + if (!is_null($val)) { + return (int)$val; + } + + return isset($meta['avif_converted']) ? (int)$meta['avif_converted'] : 0; + } + + public static function get_og_size($image_id) + { + $val = self::get_row_value($image_id, 'og_file_size'); + if (!is_null($val)) { + return (int)$val; + } + + $meta = self::get_image_meta($image_id); + if (!is_array($meta)) { + return 0; + } + + $val = self::get_row_value($image_id, 'og_file_size'); + if (!is_null($val)) { + return (int)$val; + } + + return isset($meta['og_file_size']) ? (int)$meta['og_file_size'] : 0; + } + + public static function get_webp_converted_size($image_id) + { + $val = self::get_row_value($image_id, 'webp_converted_size'); + if (!is_null($val)) { + return (int)$val; + } + + $meta = self::get_image_meta($image_id); + if (!is_array($meta)) { + return 0; + } + + $val = self::get_row_value($image_id, 'webp_converted_size'); + if (!is_null($val)) { + return (int)$val; + } + + return isset($meta['webp_converted_size']) ? (int)$meta['webp_converted_size'] : 0; + } + + public static function get_avif_converted_size($image_id) + { + $val = self::get_row_value($image_id, 'avif_converted_size'); + if (!is_null($val)) { + return (int)$val; + } + + $meta = self::get_image_meta($image_id); + if (!is_array($meta)) { + return 0; + } + + $val = self::get_row_value($image_id, 'avif_converted_size'); + if (!is_null($val)) { + return (int)$val; + } + + return isset($meta['avif_converted_size']) ? (int)$meta['avif_converted_size'] : 0; + } + + public static function update_webp_image_converted($image_id) + { + $meta = self::get_image_meta($image_id); + $meta['webp_converted']=1; + + $size=$meta['size']; + + $meta['webp_converted_size'] = 0; + + $meta['sum_size'] = 0; + $meta['webp_sum_converted_size'] = 0; + + foreach ($size as $size_key=>$size_meta) + { + if($size_meta['convert_webp_status']==0) + { + continue; + } + + if($size_key=="og") + { + $meta['webp_converted_size'] = $size_meta['webp_converted_size']; + } + + $meta['sum_size'] += $size_meta['file_size']; + $meta['webp_sum_converted_size'] += $size_meta['webp_converted_size']; + } + + return self::update_images_meta($image_id, $meta); + } + + public static function update_image_meta_webp_converted($image_id, $converted) + { + $meta = self::get_image_meta($image_id); + if (empty($meta) || !is_array($meta)) { + return false; + } + + $meta['webp_converted'] = !empty($converted) ? 1 : 0; + + return self::update_images_meta($image_id, $meta); + } + + public static function update_avif_image_converted($image_id) + { + $meta = self::get_image_meta($image_id); + $meta['avif_converted']=1; + + $size=$meta['size']; + + $meta['avif_converted_size'] = 0; + + $meta['sum_size'] = 0; + $meta['avif_sum_converted_size'] = 0; + + foreach ($size as $size_key=>$size_meta) + { + if($size_meta['convert_avif_status']==0) + { + continue; + } + + if($size_key=="og") + { + $meta['avif_converted_size'] = $size_meta['avif_converted_size']; + } + + $meta['sum_size'] += $size_meta['file_size']; + $meta['avif_sum_converted_size'] += $size_meta['avif_converted_size']; + } + + return self::update_images_meta($image_id, $meta); + } + + public static function update_image_meta_avif_converted($image_id, $converted) + { + $meta = self::get_image_meta($image_id); + if (empty($meta) || !is_array($meta)) { + return false; + } + + $meta['avif_converted'] = !empty($converted) ? 1 : 0; + + return self::update_images_meta($image_id, $meta); + } + + public static function update_webp_converted_size($image_id, $convert_size) + { + $meta = self::get_image_meta($image_id); + if (empty($meta) || !is_array($meta)) { + return false; + } + + $meta['webp_converted_size'] = max(0, (int)$convert_size); + + return self::update_images_meta($image_id, $meta); + } + + public static function update_avif_converted_size($image_id, $convert_size) + { + $meta = self::get_image_meta($image_id); + if (empty($meta) || !is_array($meta)) { + return false; + } + + $meta['avif_converted_size'] = max(0, (int)$convert_size); + + return self::update_images_meta($image_id, $meta); + } + + public static function update_og_size($image_id, $size) + { + $meta = self::get_image_meta($image_id); + if (empty($meta) || !is_array($meta)) { + return false; + } + + $meta['og_file_size'] = max(0, (int)$size); + + return self::update_images_meta($image_id, $meta); + } + + public static function is_image_optimized($image_id) + { + if(self::get_image_meta_status($image_id)==='optimized') + { + return true; + } + else + { + return false; + } + } + + public static function has_optimized_file($image_id) + { + $webp_converted= self::get_image_meta_webp_converted($image_id); + if($webp_converted) + { + return true; + } + + $avif_converted= self::get_image_meta_avif_converted($image_id); + + if($avif_converted) + { + return true; + } + else + { + return false; + } + } + + public static function is_webp_image($image_id) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='webp') + { + return true; + } + else + { + return false; + } + } + + public static function is_avif_image($image_id) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='avif') + { + return true; + } + else + { + return false; + } + } + + public static function update_image_failed($image_id, $error) + { + $meta = self::get_image_meta($image_id); + if (empty($meta) || !is_array($meta)) { + return false; + } + + $meta['status'] = 'failed'; + + if (!isset($meta['size']) || !is_array($meta['size'])) { + $meta['size'] = array(); + } + + if (!isset($meta['size']['og']) || !is_array($meta['size']['og'])) { + $meta['size']['og'] = array(); + } + + $meta['size']['og']['status'] = 'failed'; + $meta['size']['og']['error'] = (string)$error; + + return self::update_images_meta($image_id, $meta); + } + + public static function get_global_stats_ex() + { + self::ensure_table(); + + $update = get_transient('compressx_set_global_stats'); + $stats = CompressX_Options::get_option('compressx_global_stats_ex', array()); + + if (empty($stats) || empty($update) || !isset($stats['converted_percent'])) + { + $stats = array(); + $stats['converted_percent'] = 0; + + $images_count = CompressX_Image_Method::get_max_image_count(); + + global $wpdb; + $table = self::table_name(); + + $blog_id = self::get_blog_id(); + + $new_count = (int)$wpdb->get_var( + $wpdb->prepare( + "SELECT COUNT(*) FROM {$table} WHERE blog_id=%d AND status=%s", + $blog_id, + 'optimized' + ) + ); + + $old_only_count = (int)$wpdb->get_var( + $wpdb->prepare( + "SELECT COUNT(DISTINCT pm.post_id) + FROM {$wpdb->postmeta} pm + WHERE pm.meta_key=%s AND pm.meta_value=%s + AND NOT EXISTS ( + SELECT 1 FROM {$table} t + WHERE t.blog_id=%d AND t.attachment_id=pm.post_id + )", + 'compressx_image_meta_status', + 'optimized', + $blog_id + ) + ); + + $converted_images = $new_count + $old_only_count; + if ($converted_images > $images_count) + { + $converted_images = $images_count; + } + + if ($images_count > 0) + { + $stats['converted_percent'] = ($converted_images / $images_count) * 100; + $stats['converted_percent'] = round($stats['converted_percent'], 2); + } + else + { + $stats['converted_percent'] = 0; + } + + delete_transient('compressx_set_global_stats'); + CompressX_Options::update_option('compressx_global_stats_ex', $stats); + + return $stats; + } + else + { + return $stats; + } + } + + public static function get_image_progressing($image_id) + { + return get_post_meta( $image_id, 'compressx_image_progressing', true ); + } + + public static function update_image_progressing($image_id) + { + update_post_meta($image_id,'compressx_image_progressing',time()); + } + + public static function delete_image_progressing($image_id) + { + delete_post_meta($image_id,'compressx_image_progressing'); + } + + public static function clear_image_meta_status() + { + self::ensure_table(); + + global $wpdb; + + $table = self::table_name(); + $blog_id = self::get_blog_id(); + + return $wpdb->query( + $wpdb->prepare( + "UPDATE {$table} + SET status = %s, + updated_at = %s + WHERE blog_id = %d + AND status = %s", + 'unoptimized', + current_time('mysql'), + $blog_id, + 'skip' + ) + ); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/meta/class-compressx-image-meta.php b/wp-content/plugins/compressx/includes/meta/class-compressx-image-meta.php new file mode 100644 index 0000000..2f4c4dc --- /dev/null +++ b/wp-content/plugins/compressx/includes/meta/class-compressx-image-meta.php @@ -0,0 +1,621 @@ + $size_data ) + { + $image_optimize_meta['size'][$size_key]['compress_status']=0; + $image_optimize_meta['size'][$size_key]['convert_webp_status']=0; + $image_optimize_meta['size'][$size_key]['convert_avif_status']=0; + $image_optimize_meta['size'][$size_key]['status']="pending"; + $image_optimize_meta['size'][$size_key]['error']=""; + + $image_optimize_meta['size'][$size_key]['file']=$size_data['file']; + } + } + + //update_post_meta($image_id,'compressx_image_meta_og_file_size',$og_size); + //update_post_meta($image_id,'compressx_image_meta_webp_converted_size',0); + //update_post_meta($image_id,'compressx_image_meta_avif_converted_size',0); + //update_post_meta($image_id,'compressx_image_meta_compressed_size',0); + update_post_meta($image_id,'compressx_image_meta',$image_optimize_meta); + + return $image_optimize_meta; + } + + public static function delete_image_mete($image_id) + { + delete_post_meta($image_id,'compressx_image_meta'); + delete_post_meta($image_id,'compressx_image_progressing'); + delete_post_meta($image_id,'compressx_image_meta_status'); + //old + delete_post_meta($image_id,'compressx_image_meta_webp_converted'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted'); + delete_post_meta($image_id,'compressx_image_meta_og_file_size'); + delete_post_meta($image_id,'compressx_image_meta_webp_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted_size'); + + } + + public static function get_image_progressing($image_id) + { + return get_post_meta( $image_id, 'compressx_image_progressing', true ); + } + + public static function update_image_progressing($image_id) + { + update_post_meta($image_id,'compressx_image_progressing',time()); + } + + public static function delete_image_progressing($image_id) + { + delete_post_meta($image_id,'compressx_image_progressing'); + } + + public static function get_image_meta_status($image_id) + { + return get_post_meta( $image_id, 'compressx_image_meta_status', true ); + } + + public static function update_image_meta_status($image_id,$status) + { + if(self::has_image_meta($image_id)) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['status']=$status; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + update_post_meta($image_id,'compressx_image_meta_status',$status); + } + + public static function get_image_meta_webp_converted($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + + if(isset($meta['webp_converted'])) + { + return $meta['webp_converted']; + } + else + { + $converted=get_post_meta( $image_id, 'compressx_image_meta_webp_converted', true ); + if(empty($converted)) + { + return 0; + } + else + { + $meta['webp_converted']=$converted; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_webp_converted'); + return $converted; + } + } + } + + public static function get_image_meta_avif_converted($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + + if(isset($meta['avif_converted'])) + { + return $meta['avif_converted']; + } + else + { + $converted=get_post_meta( $image_id, 'compressx_image_meta_avif_converted', true ); + if(empty($converted)) + { + return 0; + } + else + { + $meta['avif_converted']=$converted; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_avif_converted'); + return $converted; + } + } + } + + public static function get_image_meta_compressed($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + + if(isset($meta['compressed'])) + { + return $meta['compressed']; + } + else + { + $compressed=get_post_meta( $image_id, 'compressx_image_meta_compressed', true ); + if(empty($compressed)) + { + return 0; + } + else + { + $meta['compressed']=$compressed; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_compressed'); + return $compressed; + } + } + } + + public static function update_image_meta_webp_converted($image_id,$converted) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['webp_converted']=$converted; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function update_image_meta_avif_converted($image_id,$converted) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['avif_converted']=$converted; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function update_image_meta_compressed($image_id,$compressed) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['compressed']=$compressed; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function update_webp_converted_size($image_id,$convert_size) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['webp_converted_size']=$convert_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function update_avif_converted_size($image_id,$convert_size) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['avif_converted_size']=$convert_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function update_compressed_size($image_id,$compressed_size) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['compressed_size']=$compressed_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function update_og_size($image_id,$size) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + $meta['og_file_size']=$size; + update_post_meta($image_id,'compressx_image_meta',$meta); + } + + public static function get_og_size($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + if(isset($meta['og_file_size'])) + { + return $meta['og_file_size']; + } + else + { + $og_size=get_post_meta( $image_id, 'compressx_image_meta_og_file_size', true ); + if(empty($og_size)) + { + return 0; + } + else + { + $meta['og_file_size']=$og_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_og_file_size'); + return $og_size; + } + } + } + + public static function get_webp_converted_size($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + if(isset($meta['webp_converted_size'])) + { + return $meta['webp_converted_size']; + } + else + { + $convert_size=get_post_meta( $image_id, 'compressx_image_meta_webp_converted_size', true ); + if(empty($convert_size)) + { + return 0; + } + else + { + $meta['webp_converted_size']=$convert_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_webp_converted_size'); + return $convert_size; + } + } + } + + public static function get_avif_converted_size($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + if(isset($meta['avif_converted_size'])) + { + return $meta['avif_converted_size']; + } + else + { + $convert_size=get_post_meta( $image_id, 'compressx_image_meta_avif_converted_size', true ); + if(empty($convert_size)) + { + return 0; + } + else + { + $meta['avif_converted_size']=$convert_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_avif_converted_size'); + return $convert_size; + } + } + } + + public static function get_compressed_size($image_id) + { + $meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + if(isset($meta['compressed_size'])) + { + return $meta['compressed_size']; + } + else + { + $convert_size=get_post_meta( $image_id, 'compressx_image_meta_compressed_size', true ); + if(empty($convert_size)) + { + return 0; + } + else + { + $meta['compressed_size']=$convert_size; + update_post_meta($image_id,'compressx_image_meta',$meta); + delete_post_meta($image_id,'compressx_image_meta_compressed_size'); + return $convert_size; + } + } + } + + public static function get_global_stats() + { + $update=get_transient( 'compressx_set_global_stats' ); + $stats=CompressX_Options::get_option('compressx_global_stats',array()); + if(empty($stats)||empty($update)||!isset($stat['webp_converted_percent'])) + { + $stats=array(); + $stats['webp_converted_percent']=0; + $stats['avif_converted_percent']=0; + + $webp_images_count=CompressX_Image_Method::get_max_webp_image_count(); + $avif_images_count=CompressX_Image_Method::get_max_avif_image_count(); + + $stats['avif_converted']=0; + $stats['webp_converted']=0; + + $stats['webp_total']=0; + $stats['avif_total']=0; + + $stats['webp_saved']=0; + $stats['avif_saved']=0; + + global $wpdb; + $result=$wpdb->get_results( "SELECT DISTINCT `post_id` FROM $wpdb->postmeta WHERE `meta_key`=\"compressx_image_meta_status\" AND `meta_value`=\"optimized\" ",ARRAY_N); + if($result && sizeof($result)>0) + { + foreach ($result as $item) + { + $image_id=$item[0]; + wp_cache_delete( $image_id, 'post_meta' ); + $og_size=self::get_og_size($image_id); + if($og_size>0) + { + if(self::get_image_meta_webp_converted($image_id)) + { + $stats['webp_converted']++; + $webp_size=self::get_webp_converted_size($image_id); + $stats['webp_total']+=$og_size; + $stats['webp_saved']+=$webp_size; + } + + if(self::get_image_meta_avif_converted($image_id)) + { + $stats['avif_converted']++; + $avif_size=self::get_avif_converted_size($image_id); + $stats['avif_total']+=$og_size; + $stats['avif_saved']+=$avif_size; + } + } + } + } + + // + if($webp_images_count>0) + { + $stats['webp_converted_percent'] = ( $stats['webp_converted'] / $webp_images_count ) * 100; + $stats['webp_converted_percent'] = round( $stats['webp_converted_percent'], 2 ); + } + else + { + $stats['webp_converted_percent']=0; + } + + if($avif_images_count>0) + { + $stats['avif_converted_percent'] = ( $stats['avif_converted'] / $avif_images_count ) * 100; + $stats['avif_converted_percent'] = round( $stats['avif_converted_percent'], 2); + } + + if($stats['webp_total']>$stats['webp_saved']) + { + $saved=$stats['webp_total']-$stats['webp_saved']; + $stats['webp_saved_percent'] = ( $saved / $stats['webp_total'] ) * 100; + $stats['webp_saved_percent'] = round( $stats['webp_saved_percent'], 2 ); + } + else + { + $stats['webp_saved_percent']=0; + } + + if($stats['avif_total']>$stats['avif_saved']) + { + $saved=$stats['avif_total']-$stats['avif_saved']; + + $stats['avif_saved_percent'] = ($saved / $stats['avif_total'] ) * 100; + $stats['avif_saved_percent'] = round( $stats['avif_saved_percent'], 2 ); + } + else + { + $stats['avif_saved_percent'] = 0; + } + + delete_transient('compressx_set_global_stats'); + CompressX_Options::update_option('compressx_global_stats',$stats); + return $stats; + } + else + { + return $stats; + } + } + + public static function get_global_stats_ex() + { + $update=get_transient( 'compressx_set_global_stats' ); + $stats=CompressX_Options::get_option('compressx_global_stats_ex',array()); + if(empty($stats)||empty($update)||!isset($stat['converted_percent'])) + { + $stats=array(); + $stats['converted_percent']=0; + + //$webp_images_count=CompressX_Image_Method::get_max_webp_image_count(); + $images_count=CompressX_Image_Method::get_max_image_count(); + + global $wpdb; + $result=$wpdb->get_results( "SELECT DISTINCT `post_id` FROM $wpdb->postmeta WHERE `meta_key`=\"compressx_image_meta_status\" AND `meta_value`=\"optimized\" ",ARRAY_N); + if($result && sizeof($result)>0) + { + $converted_images=sizeof($result); + } + else + { + $converted_images=0; + } + + // + if($images_count>0) + { + $stats['converted_percent'] = ($converted_images / $images_count ) * 100; + $stats['converted_percent'] = round( $stats['converted_percent'], 2 ); + } + else + { + $stats['converted_percent']=0; + } + + delete_transient('compressx_set_global_stats'); + CompressX_Options::update_option('compressx_global_stats_ex',$stats); + return $stats; + } + else + { + return $stats; + } + } + + public static function get_failed_images_count() + { + global $wpdb; + $result=$wpdb->get_results( "SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key='compressx_image_meta_status' AND meta_value = 'failed'",ARRAY_N); + if($result && sizeof($result)>0) + { + $count = $result[0][0]; + if(is_null($count)) + { + return 0; + } + else + { + return $count; + } + } + + return 0; + } + + public static function is_image_optimized($image_id) + { + if(self::get_image_meta_status($image_id)==='optimized') + { + return true; + } + else + { + return false; + } + } + + public static function is_webp_image($image_id) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='webp') + { + return true; + } + else + { + return false; + } + } + + public static function is_avif_image($image_id) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='avif') + { + return true; + } + else + { + return false; + } + } + + public static function update_image_failed($image_id,$error) + { + $image_optimize_meta=get_post_meta( $image_id, 'compressx_image_meta', true ); + + $image_optimize_meta['status']='failed'; + $image_optimize_meta['size']['og']['status']='failed'; + $image_optimize_meta['size']['og']['error']=$error; + + self::update_image_meta_status($image_id,'failed'); + self::update_images_meta($image_id,$image_optimize_meta); + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/method/class-compressx-image-method.php b/wp-content/plugins/compressx/includes/method/class-compressx-image-method.php new file mode 100644 index 0000000..473c299 --- /dev/null +++ b/wp-content/plugins/compressx/includes/method/class-compressx-image-method.php @@ -0,0 +1,605 @@ +get_results($wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type IN (%s,%s,%s,%s,%s)", $args ),ARRAY_N); + + if($result && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } + + public static function get_convert_to_webp() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + $convert_to_webp=CompressX_Options::get_option('compressx_output_format_webp','not init'); + if($convert_to_webp=='not init') + { + $convert_to_webp=CompressX_Options::set_default_output_format_webp(); + } + + if($converter_method=='gd') + { + if($convert_to_webp&&self::is_support_gd_webp()) + { + return true; + } + else + { + return false; + } + } + else + { + if($convert_to_webp&&self::is_support_imagick_webp()) + { + return true; + } + else + { + return false; + } + } + } + + public static function get_convert_to_avif() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + $convert_to_avif=CompressX_Options::get_option('compressx_output_format_avif','not init'); + if($convert_to_avif=='not init') + { + $convert_to_avif=CompressX_Options::set_default_output_format_avif(); + } + + if($converter_method=='gd') + { + if($convert_to_avif&&self::is_support_gd_avif()) + { + return true; + } + else + { + return false; + } + } + else + { + if($convert_to_avif&&self::is_support_imagick_avif()) + { + return true; + } + else + { + return false; + } + } + } + + public static function get_compress_to_webp() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + $convert_to_webp=CompressX_Options::get_option('compressx_output_format_webp','not init'); + if($convert_to_webp=='not init') + { + $convert_to_webp=CompressX_Options::set_default_output_format_webp(); + } + + if($converter_method=='gd') + { + if($convert_to_webp&&self::is_support_gd_webp()) + { + return true; + } + else + { + return false; + } + } + else + { + if($convert_to_webp&&self::is_support_imagick_webp()) + { + return true; + } + else + { + return false; + } + } + } + + public static function get_compress_to_avif() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + $convert_to_avif=CompressX_Options::get_option('compressx_output_format_avif','not init'); + if($convert_to_avif=='not init') + { + $convert_to_avif=CompressX_Options::set_default_output_format_avif(); + } + + if($converter_method=='gd') + { + if($convert_to_avif&&self::is_support_gd_avif()) + { + return true; + } + else + { + return false; + } + } + else + { + if($convert_to_avif&&self::is_support_imagick_avif()) + { + return true; + } + else + { + return false; + } + } + } + + public static function get_converter_method() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + return $converter_method; + } + + public static function get_max_webp_image_count() + { + global $wpdb; + + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png"); + + //$supported_mime_types=apply_filters('compressx_supported_mime_types',$supported_mime_types); + + $result=$wpdb->get_results( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type IN (%s,%s,%s) ",$supported_mime_types),ARRAY_N); + if($result && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } + + public static function get_max_avif_image_count() + { + global $wpdb; + + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png", + "image/webp"); + + //$supported_mime_types=apply_filters('compressx_supported_mime_types',$supported_mime_types); + + $result=$wpdb->get_results($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_mime_type IN (%s,%s,%s,%s) ",$supported_mime_types),ARRAY_N); + if($result && sizeof($result)>0) + { + return $result[0][0]; + } + else + { + return 0; + } + } + + public static function is_support_webp() + { + if( function_exists( 'gd_info' ) && function_exists( 'imagewebp' ) ) + { + return true; + } + + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + if( \Imagick::queryformats( 'WEBP' )) + { + return true; + } + } + + return false; + } + + public static function is_support_avif() + { + if( function_exists( 'gd_info' ) ) + { + $info=gd_info(); + if(isset($info["AVIF Support"])&&$info["AVIF Support"]) + { + return true; + } + } + + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + if( \Imagick::queryformats( 'AVIF' )) + { + return true; + } + } + + return false; + } + + public static function is_support_gd() + { + if( function_exists( 'gd_info' ) ) + { + return true; + } + else + { + return false; + } + } + + public static function is_support_gd_webp() + { + if( function_exists( 'gd_info' ) && function_exists( 'imagewebp' ) ) + { + return true; + } + else + { + return false; + } + } + + public static function is_support_gd_avif() + { + if( function_exists( 'gd_info' ) && function_exists( 'imageavif' )) + { + $info=gd_info(); + if(isset($info["AVIF Support"])&&$info["AVIF Support"]) + { + return true; + } + } + + return false; + } + + public static function is_support_imagick() + { + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + if( \Imagick::queryformats( 'WEBP' )) + { + return true; + } + } + + return false; + } + + public static function is_support_imagick_webp() + { + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + if( \Imagick::queryformats( 'WEBP' )) + { + return true; + } + } + + return false; + } + + public static function is_support_imagick_avif() + { + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + if( \Imagick::queryformats( 'AVIF' )) + { + return true; + } + } + + return false; + } + + public static function is_exclude_avif($image_id,$options) + { + $file_path = get_attached_file( $image_id ); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($options['exclude_png']&&$type== 'png') + { + return true; + } + else if($options['exclude_jpg_avif']&&$type== 'jpg') + { + return true; + } + else + { + return false; + } + } + + public static function is_exclude_webp($image_id,$options) + { + $file_path = get_attached_file( $image_id ); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($options['exclude_png_webp']&&$type== 'png') + { + return true; + } + else if($options['exclude_jpg_webp']&&$type== 'jpg') + { + return true; + } + else + { + return false; + } + } + + public static function transfer_path($path) + { + $path = str_replace('\\','/',$path); + $values = explode('/',$path); + return implode(DIRECTORY_SEPARATOR,$values); + } + + public static function need_convert_to_webp($post_id,$exclude_regex_folder) + { + if(!CompressX_Image_Meta_V2::get_image_meta_webp_converted($post_id)) + { + if(!CompressX_Image_Method::exclude_path($post_id,$exclude_regex_folder)) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public static function need_convert_to_avif($post_id,$exclude_regex_folder) + { + if(!CompressX_Image_Meta_V2::get_image_meta_avif_converted($post_id)) + { + if(!CompressX_Image_Method::exclude_path($post_id,$exclude_regex_folder)) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public static function exclude_path($post_id,$exclude_regex_folder) + { + if(empty($exclude_regex_folder)) + { + return false; + } + + $file_path = get_attached_file( $post_id ); + $file_path = CompressX_Image_Method::transfer_path($file_path); + if (CompressX_Image_Method::regex_match($exclude_regex_folder, $file_path)) + { + return true; + } + else + { + return false; + } + } + + public static function regex_match($regex_array,$string) + { + if(empty($regex_array)) + { + return false; + } + + foreach ($regex_array as $regex) + { + if(preg_match($regex,$string)) + { + return true; + } + } + + return false; + } + + public static function get_opt_folder_size() + { + try + { + $compressx_path=WP_CONTENT_DIR."/compressx-nextgen/uploads"; + $bytestotal = 0; + $path = realpath($compressx_path); + if($path!==false && $path!='' && file_exists($path)) + { + foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object){ + $bytestotal += $object->getSize(); + } + } + return $bytestotal; + } + catch (Exception $e) + { + return 0; + } + } + + public static function supported_mime_types_ex() + { + $supported_mime_types = array( + "image/jpg", + "image/jpeg", + "image/png", + "image/webp", + "image/avif"); + + $supported_mime_types=apply_filters('compressx_supported_mime_types',$supported_mime_types); + + return $supported_mime_types; + } + + public static function delete_image($image_id) + { + $files=array(); + $file_path = get_attached_file( $image_id ); + $meta = wp_get_attachment_metadata( $image_id, true ); + + if ( ! empty( $meta['sizes'] ) ) + { + foreach ( $meta['sizes'] as $size_key => $size_data ) + { + $filename= path_join( dirname( $file_path ), $size_data['file'] ); + $files[$size_key] =$filename; + } + + if(!in_array($file_path,$files)) + { + $files['og']=$file_path; + } + } + else + { + $files['og']=$file_path; + } + + foreach ($files as $size_key=>$file) + { + $file=self::get_output_path($file); + $webp_file =$file.'.webp'; + $avif_file =$file.'.avif'; + if(file_exists($webp_file)) + @wp_delete_file($webp_file); + + if(file_exists($avif_file)) + @wp_delete_file($avif_file); + + if(file_exists($file)) + @wp_delete_file($file); + + } + + delete_transient('compressx_set_global_stats'); + CompressX_Image_Meta_V2::delete_image_meta($image_id); + } + + public static function get_output_path($og_path) + { + $compressx_path=WP_CONTENT_DIR."/compressx-nextgen/uploads"; + + if(is_multisite()) + { + $tmp_id=get_current_blog_id(); + $main_site_id = get_main_site_id(); + switch_to_blog($main_site_id); + $upload_dir = wp_get_upload_dir(); + switch_to_blog($tmp_id); + } + else + { + $upload_dir = wp_get_upload_dir(); + } + + $upload_root=self::transfer_path($upload_dir['basedir']); + $attachment_dir=dirname($og_path); + $attachment_dir=self::transfer_path($attachment_dir); + $sub_dir=str_replace($upload_root,'',$attachment_dir); + $sub_dir=untrailingslashit($sub_dir); + $sub_dir=ltrim( $sub_dir, '/\\' ); + $real_path=$compressx_path.'/'.$sub_dir; + + if(!file_exists($real_path)) + { + wp_mkdir_p($real_path); + } + + return $real_path.'/'.basename($og_path); + } + + //exclude_path_ex + public static function exclude_path_ex($file_path,$exclude_regex_folder) + { + if(empty($exclude_regex_folder)) + { + return false; + } + + $file_path = CompressX_Image_Method::transfer_path($file_path); + if (CompressX_Image_Method::regex_match($exclude_regex_folder, $file_path)) + { + return true; + } + else + { + return false; + } + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/includes/method/class-compressx-image-opt-method.php b/wp-content/plugins/compressx/includes/method/class-compressx-image-opt-method.php new file mode 100644 index 0000000..3784968 --- /dev/null +++ b/wp-content/plugins/compressx/includes/method/class-compressx-image-opt-method.php @@ -0,0 +1,1868 @@ +setImageFormat( "WEBP" ); + $image->setImageCompressionQuality( $quality ); + if(isset($options['remove_exif'])&&$options['remove_exif']) + { + $profiles = $image->getImageProfiles("icc", true); + $image->stripImage(); + + if(!empty($profiles)) + { + if(isset($profiles['icm'])) + $image->profileImage("icm", $profiles['icm']); + $image->profileImage("icc", $profiles['icc']); + } + } + + if($image->writeImage( $out )) + { + $image->clear(); + $image->destroy(); + + $ret['result']='success'; + return $ret; + } + else + { + $image->clear(); + $image->destroy(); + $ret['result']='failed'; + $ret['error']='writeImage failed'; + return $ret; + } + } + else if($type=='avif') + { + if($options['quality']=="custom") + { + $quality=isset($options['quality_avif'])?$options['quality_avif']: 60; + } + else if($options['quality']=='lossless') + { + $quality=80; + } + else if($options['quality']=='lossy_minus') + { + $quality=75; + } + else if($options['quality']=='lossy') + { + $quality=60; + } + else if($options['quality']=='lossy_plus') + { + $quality=50; + } + else if($options['quality']=='lossy_super') + { + $quality=40; + } + else + { + $quality=80; + } + + $image->setImageFormat( "AVIF" ); + $image->setCompressionQuality( $quality ); + if(isset($options['remove_exif'])&&$options['remove_exif']) + { + $profiles = $image->getImageProfiles("icc", true); + $image->stripImage(); + + if(!empty($profiles)) + { + if(isset($profiles['icm'])) + $image->profileImage("icm", $profiles['icm']); + $image->profileImage("icc", $profiles['icc']); + } + } + + if($image->writeImage( $out )) + { + $image->clear(); + $image->destroy(); + + $ret['result']='success'; + return $ret; + } + else + { + $image->clear(); + $image->destroy(); + $ret['result']='failed'; + $ret['error']='writeImage failed'; + return $ret; + } + } + else + { + $image->clear(); + $image->destroy(); + + $ret['result']='failed'; + $ret['error']='type not support'; + return $ret; + } + } + catch ( Exception $e ) + { + $ret['result']='failed'; + $ret['error']=$e->getMessage(); + return $ret; + } + } + + public static function convert_webp_gd_ex($in,$out,$options) + { + if(!CompressX_Image_Method::is_support_gd()) + { + $ret['result']='failed'; + $ret['error']='not support gd'; + return $ret; + } + + $quality=CompressX_Options::get_webp_quality($options); + + $type=pathinfo($in, PATHINFO_EXTENSION); + + if (file_exists($out)) + { + @wp_delete_file($out); + } + + if ($type == 'jpeg' ||$type == 'jpg') + { + $img = imagecreatefromjpeg($in); + if(!$img) + { + $ret['result']='failed'; + $ret['error']='imagecreatefromjpeg failed'; + return $ret; + } + else + { + $img=self::correctImageOrientation($in,$img); + $result = imagewebp($img, $out, $quality); + if (PHP_VERSION_ID < 80000) + { + imagedestroy($img); + } + if (!$result) + { + $ret['result']='failed'; + $ret['error']='imagewebp failed'; + return $ret; + } + else + { + if (filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='imagewebp failed'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + } + } + else if ($type== 'png') + { + $img = imagecreatefrompng($in); + if(!$img) + { + $ret['result']='failed'; + $ret['error']='imagecreatefrompng failed'; + return $ret; + } + else + { + if(imagepalettetotruecolor($img)) + { + if(imagealphablending($img, true)) + { + if(imagesavealpha($img, true)) + { + $result = imagewebp($img, $out, $quality); + if (PHP_VERSION_ID < 80000) + { + imagedestroy($img); + } + if (!$result) + { + $ret['result']='failed'; + $ret['error']='imagewebp failed'; + return $ret; + } + else + { + if (filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='imagewebp failed'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='imagesavealpha failed'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='imagealphablending failed'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='imagepalettetotruecolor failed'; + return $ret; + } + } + } + elseif($type=='webp') + { + $image = imagecreatefromwebp($in); + if(imagewebp($image, $out, $quality)) + { + if (PHP_VERSION_ID < 80000) + { + imagedestroy($image); + } + + if(filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='imagewebp failed'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + else + { + if (PHP_VERSION_ID < 80000) + { + imagedestroy($image); + } + $ret['result']='failed'; + $ret['error']='imagewebp failed'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='type not support'; + return $ret; + } + } + + public static function correctImageOrientation($sourcePath,$image) + { + $orientation = 1; + if (function_exists('exif_read_data')) { + $exif = @exif_read_data($sourcePath); + if (!empty($exif['Orientation'])) { + $orientation = $exif['Orientation']; + } + } + + switch ($orientation) { + case 2: + imageflip( $image, IMG_FLIP_HORIZONTAL ); + break; + case 3: + $image = imagerotate( $image, 180, 0 ); + break; + case 4: + imageflip( $image, IMG_FLIP_HORIZONTAL ); + $image = imagerotate( $image, 180, 0 ); + break; + case 5: + imageflip( $image, IMG_FLIP_VERTICAL ); + $image = imagerotate( $image, -90, 0 ); + break; + case 6: + $image = imagerotate( $image, -90, 0 ); + break; + case 7: + imageflip( $image, IMG_FLIP_VERTICAL ); + $image = imagerotate( $image, 90, 0 ); + break; + case 8: + $image = imagerotate( $image, 90, 0 ); + break; + } + return $image; + } + + public static function convert_webp_imagick_ex($in,$out,$options) + { + if(!CompressX_Image_Method::is_support_imagick()) + { + $ret['result']='failed'; + $ret['error']='not support imagick'; + return $ret; + } + + $quality=CompressX_Options::get_webp_quality($options); + + if (file_exists($out)) + { + @wp_delete_file($out); + } + + try + { + $image = new Imagick($in); + if ( ! in_array( "WEBP", $image->queryFormats() ) ) + { + $ret['result']='failed'; + $ret['error']="not support webp"; + return $ret; + } + + if (method_exists($image, 'autoOrient')) + { + $image->autoOrient(); + } else { + $orientation = $image->getImageOrientation(); + switch ($orientation) { + case Imagick::ORIENTATION_BOTTOMRIGHT: + $image->rotateImage("#000", 180); + break; + case Imagick::ORIENTATION_RIGHTTOP: + $image->rotateImage("#000", 90); + break; + case Imagick::ORIENTATION_LEFTBOTTOM: + $image->rotateImage("#000", -90); + break; + } + $image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT); + } + + $image->setImageFormat( "WEBP" ); + if(isset($options['remove_exif'])&&$options['remove_exif']) + { + $profiles = $image->getImageProfiles("icc", true); + $image->stripImage(); + + if(!empty($profiles)) + { + if(isset($profiles['icm'])) + $image->profileImage("icm", $profiles['icm']); + $image->profileImage("icc", $profiles['icc']); + } + } + $image->setImageCompressionQuality( $quality ); + $blob = $image->getImageBlob(); + if ( ! file_put_contents( $out, $blob ) ) + { + $ret['result']='failed'; + $ret['error']="convert webp failed"; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + catch ( Exception $e ) + { + $ret['result']='failed'; + $ret['error']=$e->getMessage(); + return $ret; + } + } + + public static function convert_avif_gd_ex($in,$out,$options) + { + if(!CompressX_Image_Method::is_support_gd()) + { + $ret['result']='failed'; + $ret['error']='not support gd'; + return $ret; + } + + $quality=CompressX_Options::get_avif_quality($options); + + $type=pathinfo($in, PATHINFO_EXTENSION); + + if (file_exists($out)) + { + @wp_delete_file($out); + } + + if ($type == 'jpeg' ||$type == 'jpg') + { + $img = imagecreatefromjpeg($in); + if(!$img) + { + $ret['result']='failed'; + $ret['error']='imagecreatefromjpeg failed'; + return $ret; + } + else + { + $img=self::correctImageOrientation($in,$img); + $result = imageavif($img, $out, $quality); + if (PHP_VERSION_ID < 80000) + { + imagedestroy($img); + } + if (!$result) + { + $ret['result']='failed'; + $ret['error']='imageavif failed'; + return $ret; + } + else + { + if (filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='Converted image is 0 KB and has been deleted. This usually happens because your AVIF library is not working properly. Please check the AVIF library.'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + } + } + else if ($type== 'png') + { + $img = imagecreatefrompng($in); + if(!$img) + { + $ret['result']='failed'; + $ret['error']='imagecreatefrompng failed'; + return $ret; + } + else + { + if(imagepalettetotruecolor($img)) + { + if(imagealphablending($img, true)) + { + if(imagesavealpha($img, true)) + { + $result = imageavif($img, $out, $quality); + if (PHP_VERSION_ID < 80000) + { + imagedestroy($img); + } + if (!$result) + { + $ret['result']='failed'; + $ret['error']='imageavif failed'; + return $ret; + } + else + { + if (filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='Converted image is 0 KB and has been deleted. This usually happens because your AVIF library is not working properly. Please check the AVIF library.'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='imagesavealpha failed'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='imagealphablending failed'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='imagepalettetotruecolor failed'; + return $ret; + } + } + } + else if ($type == 'webp') + { + $img = imagecreatefromwebp($in); + if(!$img) + { + $ret['result']='failed'; + $ret['error']='imagecreatefromwebp failed'; + return $ret; + } + else + { + $result = imageavif($img, $out, $quality); + if (PHP_VERSION_ID < 80000) + { + imagedestroy($img); + } + if (!$result) + { + $ret['result']='failed'; + $ret['error']='imageavif failed'; + return $ret; + } + else + { + if (filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='Converted image is 0 KB and has been deleted. This usually happens because your AVIF library is not working properly. Please check the AVIF library.'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + } + } + else if($type=='avif') + { + $image = imagecreatefromavif($in); + if(imageavif($image, $out, $quality)) + { + if (PHP_VERSION_ID < 80000) + { + imagedestroy($image); + } + + if(filesize($out)==0) + { + @wp_delete_file($out); + $ret['result']='failed'; + $ret['error']='Converted image is 0 KB and has been deleted. This usually happens because your AVIF library is not working properly. Please check the AVIF library.'; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + else + { + if (PHP_VERSION_ID < 80000) + { + imagedestroy($image); + } + $ret['result']='failed'; + $ret['error']='imageavif failed'; + return $ret; + } + } + else + { + $ret['result']='failed'; + $ret['error']='type not support'; + return $ret; + } + } + + public static function convert_avif_imagick_ex($in,$out,$options) + { + if(!CompressX_Image_Method::is_support_imagick()) + { + $ret['result']='failed'; + $ret['error']='not support imagick'; + return $ret; + } + + $quality=CompressX_Options::get_avif_quality($options); + + if (file_exists($out)) + { + @wp_delete_file($out); + } + + try + { + $image = new Imagick($in); + if ( ! in_array( "AVIF", $image->queryFormats() ) ) + { + $ret['result']='failed'; + $ret['error']="not support webp"; + return $ret; + } + + if (method_exists($image, 'autoOrient')) + { + $image->autoOrient(); + } else { + $orientation = $image->getImageOrientation(); + switch ($orientation) { + case Imagick::ORIENTATION_BOTTOMRIGHT: + $image->rotateImage("#000", 180); + break; + case Imagick::ORIENTATION_RIGHTTOP: + $image->rotateImage("#000", 90); + break; + case Imagick::ORIENTATION_LEFTBOTTOM: + $image->rotateImage("#000", -90); + break; + } + $image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT); + } + + $image->setImageFormat( "AVIF" ); + + if(isset($options['remove_exif'])&&$options['remove_exif']) + { + $profiles = $image->getImageProfiles("icc", true); + $image->stripImage(); + + if(!empty($profiles)) + { + if(isset($profiles['icm'])) + $image->profileImage("icm", $profiles['icm']); + $image->profileImage("icc", $profiles['icc']); + } + } + $image->setCompressionQuality($quality); + $blob = $image->getImageBlob(); + if ( ! file_put_contents( $out, $blob ) ) + { + $ret['result']='failed'; + $ret['error']="convert avif failed"; + return $ret; + } + + $ret['result']='success'; + return $ret; + } + catch ( Exception $e ) + { + $ret['result']='failed'; + $ret['error']=$e->getMessage(); + return $ret; + } + } + + public static function exclude_path($post_id,$exclude_regex_folder) + { + return CompressX_Image_Method::exclude_path($post_id,$exclude_regex_folder); + } + + public static function supported_mime_types_ex() + { + return CompressX_Image_Method::supported_mime_types_ex(); + } + + public static function transfer_path($path) + { + return CompressX_Image_Method::transfer_path($path); + } + + public static function need_compress($image_id,$options) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='webp') + { + return $options['compressed_webp']; + } + else if($type=='avif') + { + return $options['compressed_avif']; + } + + return false; + } + + public static function need_convert_to_webp_ex($image_id,$options) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='webp'||$type=='avif') + { + return false; + } + + return $options['convert_to_webp']; + } + + public static function need_convert_to_avif_ex($image_id,$options) + { + $file_path = get_attached_file($image_id); + $type=pathinfo($file_path, PATHINFO_EXTENSION); + + if($type=='avif') + { + return false; + } + + return $options['convert_to_avif']; + } + + public static function compress_image($image_id,$options,$log=false) + { + $success=true; + $has_compress=true; + $image_optimize_meta =CompressX_Image_Meta_V2::get_image_meta($image_id); + $uploads=wp_get_upload_dir(); + if(CompressX_Image_Opt_Method::need_compress($image_id,$options)) + { + if(CompressX_Image_Meta_V2::get_image_meta_compressed($image_id)==0) + { + $file_path = get_attached_file($image_id); + + foreach ($image_optimize_meta['size'] as $size_key => $size_meta) + { + if(CompressX_Image_Opt_Method::skip_size($size_key,$options)) + { + continue; + } + + if ($size_meta['compress_status'] == 0) + { + if ($size_key == "og") + { + $filename = $file_path; + } + else if(CompressX_Image_Opt_Method::is_elementor_thumbs($size_key)) + { + $filename = $uploads['basedir'].'/'.$size_meta['file']; + } + else + { + $filename = path_join(dirname($file_path), $size_meta['file']); + } + + $output_path=CompressX_Image_Method::get_output_path($filename); + + CompressX_Image_Opt_Method::WriteLog($log,'Start Compression '.basename($filename),'notice'); + + if(!file_exists($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'File '.basename($filename).' not exist,so skip compress.','notice'); + $image_optimize_meta['size'][$size_key]['compress_status']=1; + $image_optimize_meta['size'][$size_key]['status']='optimized'; + continue; + } + + if($options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::compress_image_gd_ex($filename,$output_path,$options); + } + else if($options['converter_method']=='imagick') + { + $ret=CompressX_Image_Opt_Method::compress_image_imagick_ex($filename,$output_path,$options); + } + else + { + $ret=CompressX_Image_Opt_Method::compress_image_gd_ex($filename,$output_path,$options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($log,'Compression '.basename($filename).' succeeded.','notice'); + $image_optimize_meta['size'][$size_key]['compress_status']=1; + $image_optimize_meta['size'][$size_key]['status']='optimized'; + + if($options['auto_remove_larger_format']) + { + if(filesize($output_path)>filesize($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'Compressed size larger than original size, deleting file '.basename($output_path).'.','notice'); + @wp_delete_file($output_path); + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_compressed_size($image_id,filesize($filename)); + } + } + else + { + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_compressed_size($image_id,filesize($output_path)); + } + } + } + else + { + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_compressed_size($image_id,filesize($output_path)); + } + } + + + CompressX_Image_Meta_V2::update_images_meta($image_id,$image_optimize_meta); + } + else + { + CompressX_Image_Opt_Method::WriteLog($log,'Compression '.basename($filename).' failed. Error:'.$ret['error'],'notice'); + $image_optimize_meta['size'][$size_key]['compress_status']=0; + $image_optimize_meta['size'][$size_key]['status']='failed'; + $image_optimize_meta['size'][$size_key]['error']=$ret['error']; + CompressX_Image_Meta_V2::update_images_meta($image_id,$image_optimize_meta); + + $success=false; + $has_compress=false; + } + + } + } + + if($has_compress) + CompressX_Image_Meta_V2::update_image_meta_compressed($image_id,1); + } + } + + return $success; + } + + public static function convert_to_webp($image_id,$options,$log=false) + { + $success=true; + $has_convert=true; + $image_optimize_meta =CompressX_Image_Meta_V2::get_image_meta($image_id); + $uploads=wp_get_upload_dir(); + if(CompressX_Image_Opt_Method::need_convert_to_webp_ex($image_id,$options)) + { + if(CompressX_Image_Meta_V2::get_image_meta_webp_converted($image_id)==0) + { + $file_path = get_attached_file( $image_id ); + + foreach ($image_optimize_meta['size'] as $size_key=>$size_meta) + { + if(CompressX_Image_Opt_Method::skip_size($size_key,$options)) + { + continue; + } + + if($size_meta['convert_webp_status']==0) + { + if($size_key=="og") + { + $filename= $file_path; + } + else if(CompressX_Image_Opt_Method::is_elementor_thumbs($size_key)) + { + $filename = $uploads['basedir'].'/'.$size_meta['file']; + } + else + { + $filename= path_join( dirname( $file_path ), $size_meta['file'] ); + } + + $output_path=CompressX_Image_Method::get_output_path($filename); + $output_path=$output_path.'.webp'; + + CompressX_Image_Opt_Method::WriteLog($log,'Start WebP conversion '.basename($filename),'notice'); + + if(!file_exists($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'File '.basename($filename).' not exist,so skip convert.','notice'); + $image_optimize_meta['size'][$size_key]['convert_webp_status']=1; + $image_optimize_meta['size'][$size_key]['status']='optimized'; + continue; + } + + if($options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::convert_webp_gd_ex($filename,$output_path,$options); + } + else if($options['converter_method']=='imagick') + { + $ret=CompressX_Image_Opt_Method::convert_webp_imagick_ex($filename,$output_path,$options); + } + else + { + $ret=CompressX_Image_Opt_Method::convert_webp_gd_ex($filename,$output_path,$options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to WebP succeeded.','notice'); + $image_optimize_meta['size'][$size_key]['convert_webp_status']=1; + $image_optimize_meta['size'][$size_key]['status']='optimized'; + + if($options['auto_remove_larger_format']) + { + if(filesize($output_path)>filesize($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'WebP size larger than original size, deleting file '.basename($output_path).'.','notice'); + @wp_delete_file($output_path); + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_webp_converted_size($image_id,filesize($filename)); + } + } + else + { + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_webp_converted_size($image_id,filesize($output_path)); + } + } + } + else + { + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_webp_converted_size($image_id,filesize($output_path)); + } + } + + + CompressX_Image_Meta_V2::update_images_meta($image_id,$image_optimize_meta); + } + else + { + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to WebP failed. Error:'.$ret['error'],'notice'); + $image_optimize_meta['size'][$size_key]['convert_webp_status']=0; + $image_optimize_meta['size'][$size_key]['status']='failed'; + $image_optimize_meta['size'][$size_key]['error']=$ret['error']; + CompressX_Image_Meta_V2::update_images_meta($image_id,$image_optimize_meta); + + $success=false; + $has_convert=false; + } + } + } + + if($has_convert) + CompressX_Image_Meta_V2::update_image_meta_webp_converted($image_id,1); + } + } + + return $success; + } + + public static function convert_to_avif($image_id,$options,$log=false) + { + $success=true; + $has_convert=true; + $image_optimize_meta =CompressX_Image_Meta_V2::get_image_meta($image_id); + $uploads=wp_get_upload_dir(); + if(CompressX_Image_Opt_Method::need_convert_to_avif_ex($image_id,$options)) + { + if(CompressX_Image_Meta_V2::get_image_meta_avif_converted($image_id)==0) + { + $file_path = get_attached_file( $image_id ); + + foreach ($image_optimize_meta['size'] as $size_key=>$size_meta) + { + if(CompressX_Image_Opt_Method::skip_size($size_key,$options)) + { + continue; + } + + if($size_meta['convert_avif_status']==0) + { + if($size_key=="og") + { + $filename= $file_path; + } + else if(CompressX_Image_Opt_Method::is_elementor_thumbs($size_key)) + { + $filename = $uploads['basedir'].'/'.$size_meta['file']; + } + else + { + $filename= path_join( dirname( $file_path ), $size_meta['file'] ); + } + + $output_path=CompressX_Image_Method::get_output_path($filename); + $output_path=$output_path.'.avif'; + + CompressX_Image_Opt_Method::WriteLog($log,'Start AVIF conversion:'.basename($filename),'notice'); + + if(!file_exists($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'File '.basename($filename).' not exist,so skip convert.','notice'); + $image_optimize_meta['size'][$size_key]['convert_avif_status']=1; + $image_optimize_meta['size'][$size_key]['status']='optimized'; + continue; + } + + if($options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::convert_avif_gd_ex($filename,$output_path,$options); + } + else if($options['converter_method']=='imagick') + { + CompressX_Image_Opt_Method::WriteLog($log,'test imagick '.basename($filename),'notice'); + $ret=CompressX_Image_Opt_Method::convert_avif_imagick_ex($filename,$output_path,$options); + } + else + { + $ret=CompressX_Image_Opt_Method::convert_avif_gd_ex($filename,$output_path,$options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to AVIF succeeded.','notice'); + $image_optimize_meta['size'][$size_key]['convert_avif_status']=1; + $image_optimize_meta['size'][$size_key]['status']='optimized'; + + if($options['auto_remove_larger_format']) + { + if(filesize($output_path)>filesize($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'AVIF size larger than original size, deleting file '.basename($output_path).'.','notice'); + @wp_delete_file($output_path); + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_avif_converted_size($image_id,filesize($filename)); + } + } + else + { + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_avif_converted_size($image_id,filesize($output_path)); + } + } + } + else + { + if($size_key=="og") + { + CompressX_Image_Meta_V2::update_avif_converted_size($image_id,filesize($output_path)); + } + } + + CompressX_Image_Meta_V2::update_images_meta($image_id,$image_optimize_meta); + } + else + { + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to AVIF failed. Error:'.$ret['error'],'notice'); + $image_optimize_meta['size'][$size_key]['convert_avif_status']=0; + $image_optimize_meta['size'][$size_key]['status']='failed'; + $image_optimize_meta['size'][$size_key]['error']=$ret['error']; + CompressX_Image_Meta_V2::update_images_meta($image_id,$image_optimize_meta); + + $success=false; + $has_convert=false; + } + } + } + + if($has_convert) + CompressX_Image_Meta_V2::update_image_meta_avif_converted($image_id,1); + } + } + + return $success; + } + + public static function custom_convert_to_webp($filename,$options,$log=false) + { + $success=true; + + if(CompressX_Image_Opt_Method::custom_need_convert_to_webp_ex($filename,$options)) + { + if(CompressX_Custom_Image_Meta::is_convert_webp($filename)==0) + { + $output_path=CompressX_Image_Opt_Method::get_custom_output_path($filename); + $output_path=$output_path.'.webp'; + + CompressX_Image_Opt_Method::WriteLog($log,'Start WebP conversion '.basename($filename),'notice'); + + if($options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::convert_webp_gd_ex($filename,$output_path,$options); + } + else if($options['converter_method']=='imagick') + { + $ret=CompressX_Image_Opt_Method::convert_webp_imagick_ex($filename,$output_path,$options); + } + else + { + $ret=CompressX_Image_Opt_Method::convert_webp_gd_ex($filename,$output_path,$options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to WebP succeeded.','notice'); + if($options['auto_remove_larger_format']) + { + if(filesize($output_path)>filesize($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'WebP size larger than original size, deleting file '.basename($output_path).'.','notice'); + @wp_delete_file($output_path); + $convert_webp_size=filesize($filename); + } + else + { + $convert_webp_size=filesize($output_path); + } + } + else + { + $convert_webp_size=filesize($output_path); + } + + $image_optimize_meta['convert_webp_status']=1; + $image_optimize_meta['convert_webp_size']=$convert_webp_size; + CompressX_Custom_Image_Meta::update_custom_image_meta($filename,$image_optimize_meta); + } + else + { + $image_optimize_meta['convert_webp_status']=0; + $image_optimize_meta['convert_webp_size']=0; + $image_optimize_meta['error']=$ret['error']; + CompressX_Custom_Image_Meta::update_custom_image_meta($filename,$image_optimize_meta); + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to WebP failed. Error:'.$ret['error'],'notice'); + $success=false; + } + } + } + + return $success; + } + + public static function custom_convert_to_avif($filename,$options,$log=false) + { + $success=true; + + if(CompressX_Image_Opt_Method::custom_need_convert_to_avif_ex($filename,$options)) + { + if(CompressX_Custom_Image_Meta::is_convert_avif($filename)==0) + { + $output_path=CompressX_Image_Opt_Method::get_custom_output_path($filename); + $output_path=$output_path.'.avif'; + + CompressX_Image_Opt_Method::WriteLog($log,'Start AVIF conversion:'.basename($filename),'notice'); + + if($options['converter_method']=='gd') + { + $ret=CompressX_Image_Opt_Method::convert_avif_gd_ex($filename,$output_path,$options); + } + else if($options['converter_method']=='imagick') + { + CompressX_Image_Opt_Method::WriteLog($log,'test imagick '.basename($filename),'notice'); + $ret=CompressX_Image_Opt_Method::convert_avif_imagick_ex($filename,$output_path,$options); + } + else + { + $ret=CompressX_Image_Opt_Method::convert_avif_gd_ex($filename,$output_path,$options); + } + + if($ret['result']=='success') + { + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to AVIF succeeded.','notice'); + + if($options['auto_remove_larger_format']) + { + if(filesize($output_path)>filesize($filename)) + { + CompressX_Image_Opt_Method::WriteLog($log,'AVIF size larger than original size, deleting file '.basename($output_path).'.','notice'); + @wp_delete_file($output_path); + $avif_converted_size=filesize($filename); + } + else + { + $avif_converted_size=filesize($output_path); + } + } + else + { + $avif_converted_size=filesize($output_path); + } + + $image_optimize_meta['convert_avif_status']=1; + $image_optimize_meta['convert_avif_size']=$avif_converted_size; + CompressX_Custom_Image_Meta::update_custom_image_meta($filename,$image_optimize_meta); + } + else + { + $image_optimize_meta['convert_avif_status']=0; + $image_optimize_meta['convert_avif_size']=0; + $image_optimize_meta['error']=$ret['error']; + CompressX_Custom_Image_Meta::update_custom_image_meta($filename,$image_optimize_meta); + CompressX_Image_Opt_Method::WriteLog($log,'Converting '.basename($filename).' to AVIF failed. Error:'.$ret['error'],'notice'); + + $success=false; + } + } + } + + return $success; + } + + public static function resize($image_id,$options,$log=false) + { + if($options['resize_enable']==false) + { + return true; + } + + $image_meta = wp_get_attachment_metadata($image_id); + $original_file_path = wp_get_original_image_path( $image_id ); + + if(empty($original_file_path)) + return false; + + $imagesize = wp_getimagesize( $original_file_path ); + $og_width = $imagesize[0]; + $og_height = $imagesize[1]; + + + $max_width=isset($options['resize_width'])?$options['resize_width']:2560; + $max_height=isset($options['resize_height'])?$options['resize_height']:2560; + if ( ( $og_width < $max_width ) || ( $og_height < $max_height) ) + { + return true; + } + /* + $resize_method=isset($resize['method'])?$resize['method']:'auto'; + if($resize_method==='width') + { + $max_height='0'; + } + else if($resize_method==='height') + { + $max_width='0'; + }*/ + + CompressX_Image_Opt_Method::WriteLog($log,'Start resizing image id:'.$image_id,'notice'); + + $saved_data=image_make_intermediate_size($original_file_path,$max_width,$max_height); + if($saved_data===false) + { + return false; + } + + $resize_path = path_join( dirname( $original_file_path ),$saved_data['file']); + if (!file_exists($resize_path)) + { + return false; + } + + $suffix='scaled'; + $dir = pathinfo( $original_file_path, PATHINFO_DIRNAME ); + $ext = pathinfo( $original_file_path, PATHINFO_EXTENSION ); + $name = wp_basename( $original_file_path, ".$ext" ); + $scaled_file_path=trailingslashit( $dir ) . "{$name}-{$suffix}.{$ext}"; + + @copy($resize_path,$scaled_file_path); + + if(!empty($image_meta['sizes'])) + { + $path_parts = pathinfo($resize_path ); + $filename = ! empty( $path_parts['basename'] ) ? $path_parts['basename'] : $path_parts['filename']; + $unlink=true; + foreach ( $image_meta['sizes'] as $image_size ) + { + if ( false === strpos( $image_size['file'], $filename ) ) + { + continue; + } + $unlink = false; + } + + if($unlink) + { + @wp_delete_file($resize_path ); + } + } + else + { + @wp_delete_file( $resize_path ); + } + + + // Update the attached file meta. + update_attached_file( $image_id, _wp_relative_upload_path( $scaled_file_path ) ); + + // Width and height of the new image. + $image_meta['width'] = $saved_data['width']; + $image_meta['height'] = $saved_data['height']; + + // Make the file path relative to the upload dir. + $image_meta['file'] = _wp_relative_upload_path( $scaled_file_path ); + + // Add image file size. + $image_meta['filesize'] = wp_filesize( $scaled_file_path ); + + // Store the original image file name in image_meta. + $image_meta['original_image'] = wp_basename( $original_file_path ); + update_post_meta( $image_id, '_wp_attachment_metadata', $image_meta ); + CompressX_Image_Meta_V2::update_og_size($image_id,$image_meta['filesize']); + return true; + } + + public static function resize_ex($image_id,$options,$metadata,$log=false) + { + if($options['resize_enable']==false) + { + $ret['result']='success'; + $ret['meta']=$metadata; + return $ret; + } + + $image_meta = $metadata; + $original_file_path = wp_get_original_image_path( $image_id ); + + if(empty($original_file_path)) + { + $ret['result']='failed'; + $ret['meta']=$metadata; + return $ret; + } + + $imagesize = wp_getimagesize( $original_file_path ); + $og_width = $imagesize[0]; + $og_height = $imagesize[1]; + + + $max_width=isset($options['resize_width'])?$options['resize_width']:2560; + $max_height=isset($options['resize_height'])?$options['resize_height']:2560; + if ( ( $og_width < $max_width ) || ( $og_height < $max_height) ) + { + $ret['result']='success'; + $ret['meta']=$metadata; + return $ret; + } + /* + $resize_method=isset($resize['method'])?$resize['method']:'auto'; + if($resize_method==='width') + { + $max_height='0'; + } + else if($resize_method==='height') + { + $max_width='0'; + }*/ + + CompressX_Image_Opt_Method::WriteLog($log,'Start resizing image id:'.$image_id,'notice'); + + $saved_data=image_make_intermediate_size($original_file_path,$max_width,$max_height); + if($saved_data===false) + { + $ret['result']='failed'; + $ret['meta']=$metadata; + return $ret; + } + + $resize_path = path_join( dirname( $original_file_path ),$saved_data['file']); + if (!file_exists($resize_path)) + { + $ret['result']='failed'; + $ret['meta']=$metadata; + return $ret; + } + + $suffix='scaled'; + $dir = pathinfo( $original_file_path, PATHINFO_DIRNAME ); + $ext = pathinfo( $original_file_path, PATHINFO_EXTENSION ); + $name = wp_basename( $original_file_path, ".$ext" ); + $scaled_file_path=trailingslashit( $dir ) . "{$name}-{$suffix}.{$ext}"; + + @copy($resize_path,$scaled_file_path); + + if(!empty($image_meta['sizes'])) + { + $path_parts = pathinfo($resize_path ); + $filename = ! empty( $path_parts['basename'] ) ? $path_parts['basename'] : $path_parts['filename']; + $unlink=true; + foreach ( $image_meta['sizes'] as $image_size ) + { + if ( false === strpos( $image_size['file'], $filename ) ) + { + continue; + } + $unlink = false; + } + + if($unlink) + { + @wp_delete_file($resize_path ); + } + } + else + { + @wp_delete_file( $resize_path ); + } + + + // Update the attached file meta. + update_attached_file( $image_id, _wp_relative_upload_path( $scaled_file_path ) ); + + // Width and height of the new image. + $image_meta['width'] = $saved_data['width']; + $image_meta['height'] = $saved_data['height']; + + // Make the file path relative to the upload dir. + $image_meta['file'] = _wp_relative_upload_path( $scaled_file_path ); + + // Add image file size. + $image_meta['filesize'] = wp_filesize( $scaled_file_path ); + + // Store the original image file name in image_meta. + $image_meta['original_image'] = wp_basename( $original_file_path ); + CompressX_Image_Meta_V2::update_og_size($image_id,$image_meta['filesize']); + + $ret['result']='success'; + $ret['meta']=$image_meta; + return $ret; + } + + public static function WriteLog($log,$text,$type) + { + if (is_a($log, 'CompressX_Log')) + { + $log->WriteLog($text,$type); + } + else if(is_a($log, 'CompressX_Log_Ex')) + { + $log->WriteLog($text,$type); + } + else + { + $log=new CompressX_Log(); + $log->OpenLogFile(); + $log->WriteLog($text,$type); + } + } + + public static function custom_need_convert_to_webp_ex($filename,$options) + { + $type=pathinfo($filename, PATHINFO_EXTENSION); + + if($type=='webp'||$type=='avif') + { + return false; + } + + return $options['convert_to_webp']; + } + + public static function custom_need_convert_to_avif_ex($filename,$options) + { + $type=pathinfo($filename, PATHINFO_EXTENSION); + + if($type=='avif') + { + return false; + } + + return $options['convert_to_avif']; + } + + public static function is_elementor_thumbs($size_key) + { + if(substr($size_key, 0,strlen('elementor_custom'))=='elementor_custom') + { + return true; + } + else + { + return false; + } + } + + public static function get_output_path($og_path) + { + return CompressX_Image_Method::get_output_path($og_path); + } + + public static function get_custom_output_path($og_path) + { + $compressx_path=WP_CONTENT_DIR."/compressx-nextgen"; + + $upload_root=CompressX_Image_Method::transfer_path(WP_CONTENT_DIR.'/'); + $attachment_dir=dirname($og_path); + $attachment_dir=CompressX_Image_Method::transfer_path($attachment_dir); + $sub_dir=str_replace($upload_root,'',$attachment_dir); + $sub_dir=untrailingslashit($sub_dir); + $real_path=$compressx_path.'/'.$sub_dir; + + if(!file_exists($real_path)) + { + wp_mkdir_p($real_path); + } + + return $real_path.'/'.basename($og_path); + } + + public static function delete_image($image_id) + { + $files=array(); + $file_path = get_attached_file( $image_id ); + $meta = wp_get_attachment_metadata( $image_id, true ); + + if ( ! empty( $meta['sizes'] ) ) + { + foreach ( $meta['sizes'] as $size_key => $size_data ) + { + $filename= path_join( dirname( $file_path ), $size_data['file'] ); + $files[$size_key] =$filename; + } + + if(!in_array($file_path,$files)) + { + $files['og']=$file_path; + } + } + else + { + $files['og']=$file_path; + } + + foreach ($files as $size_key=>$file) + { + $file=CompressX_Image_Method::get_output_path($file); + $webp_file =$file.'.webp'; + $avif_file =$file.'.avif'; + if(file_exists($webp_file)) + @wp_delete_file($webp_file); + + if(file_exists($avif_file)) + @wp_delete_file($avif_file); + + if(file_exists($file)) + @wp_delete_file($file); + + } + + delete_post_meta($image_id,'compressx_image_meta_status'); + delete_post_meta($image_id,'compressx_image_meta_webp_converted'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted'); + delete_post_meta($image_id,'compressx_image_meta_compressed'); + + delete_post_meta($image_id,'compressx_image_meta_og_file_size'); + delete_post_meta($image_id,'compressx_image_meta_webp_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_avif_converted_size'); + delete_post_meta($image_id,'compressx_image_meta_compressed_size'); + delete_post_meta($image_id,'compressx_image_meta'); + delete_post_meta($image_id,'compressx_image_progressing'); + + CompressX_Image_Meta_V2::delete_image_meta($image_id); + do_action('compressx_delete_image',$image_id); + } + + public static function set_default_compress_server() + { + return CompressX_Options::set_default_compress_server(); + } + + public static function set_default_output_format_webp() + { + return CompressX_Options::set_default_output_format_webp(); + } + + public static function set_default_output_format_avif() + { + return CompressX_Options::set_default_output_format_avif(); + } + + public static function check_imagick_avif() + { + if ( extension_loaded( 'imagick' ) && class_exists( '\Imagick' ) ) + { + $info = \Imagick::getVersion(); + $versionString = $info['versionString']; + $version="7.0"; + if (preg_match('/^ImageMagick (\d+\.\d+\.\d+)(?:-\d+)?/', $versionString, $matches)) + { + $mainVersion = $matches[1]; + if(version_compare($mainVersion,$version,'>')) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + else + { + return false; + } + } + + public static function is_current_support_webp() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + if($converter_method=="gd") + { + if(CompressX_Image_Method::is_support_gd_webp()) + { + return true; + } + else + { + return false; + } + } + else if($converter_method=="imagick") + { + if(CompressX_Image_Opt_Method::is_support_imagick_webp()) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public static function is_current_support_avif() + { + $converter_method=CompressX_Options::get_option('compressx_converter_method',false); + + if(empty($converter_method)) + { + $converter_method=CompressX_Options::set_default_compress_server(); + } + + if($converter_method=="gd") + { + if(CompressX_Image_Method::is_support_gd_avif()) + { + return true; + } + else + { + return false; + } + } + else if($converter_method=="imagick") + { + if(CompressX_Image_Method::is_support_imagick_avif()) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + } + + public static function get_convert_to_webp() + { + return CompressX_Image_Method::get_convert_to_webp(); + } + + public static function get_convert_to_avif() + { + return CompressX_Image_Method::get_convert_to_avif(); + } + + public static function get_compress_to_webp() + { + return CompressX_Image_Method::get_compress_to_webp(); + } + + public static function get_compress_to_avif() + { + return CompressX_Image_Method::get_compress_to_avif(); + } + + public static function get_converter_method() + { + return CompressX_Image_Method::get_converter_method(); + } + + public static function skip_size($size_key,$options) + { + if(isset($options['skip_size'])&&isset($options['skip_size'][$size_key])) + { + return $options['skip_size'][$size_key]; + } + + return false; + } +} \ No newline at end of file diff --git a/wp-content/plugins/compressx/languages/compressx.pot b/wp-content/plugins/compressx/languages/compressx.pot new file mode 100644 index 0000000..d677963 --- /dev/null +++ b/wp-content/plugins/compressx/languages/compressx.pot @@ -0,0 +1,2304 @@ +# Copyright (C) 2026 WPvivid Team +# This file is distributed under the GPL-3.0+. +msgid "" +msgstr "" +"Project-Id-Version: CompressX - AVIF & WebP Converter 0.9.36\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/compressx\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2026-04-16T12:19:04+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.11.0\n" +"X-Domain: compressx\n" + +#. Plugin Name of the plugin +#: compressx.php +msgid "CompressX - AVIF & WebP Converter" +msgstr "" + +#. Description of the plugin +#: compressx.php +msgid "Convert JPG and PNG images to WebP and AVIF, compress WebP and AVIF." +msgstr "" + +#. Author of the plugin +#: compressx.php +msgid "WPvivid Team" +msgstr "" + +#. Author URI of the plugin +#: compressx.php +msgid "https://compressx.io" +msgstr "" + +#: includes/class-compressx-cloudflare-cdn.php:18 +msgid "Zone ID is required, please enter a valid Zone ID" +msgstr "" + +#: includes/class-compressx-cloudflare-cdn.php:25 +msgid "Cloudflare email is required, please enter your Cloudflare email." +msgstr "" + +#: includes/class-compressx-cloudflare-cdn.php:32 +msgid "Global API key is required, please enter your Cloudflare global API key." +msgstr "" + +#: includes/class-compressx-cloudflare-cdn.php:58 +#: includes/class-compressx-cloudflare-cdn.php:78 +msgid "Connecting to Cloudflare failed:" +msgstr "" + +#: includes/class-compressx-custom-imgoptim-task.php:42 +#: includes/class-compressx-imgoptim-task.php:45 +msgid "No unoptimized images found." +msgstr "" + +#: includes/class-compressx-custom-imgoptim-task.php:123 +#: includes/class-compressx-custom-imgoptim-task.php:310 +#: includes/class-compressx-custom-imgoptim-task.php:313 +#: includes/class-compressx-imgoptim-task.php:133 +#: includes/class-compressx-imgoptim-task.php:509 +msgid "All image(s) optimized successfully." +msgstr "" + +#: includes/class-compressx-custom-imgoptim-task.php:361 +msgid "Finish Optimizing images." +msgstr "" + +#: includes/class-compressx-custom-imgoptim-task.php:422 +msgid "Task timed out" +msgstr "" + +#: includes/class-compressx-imgoptim-task.php:506 +msgid "Finish optimizing images." +msgstr "" + +#: includes/class-compressx-log.php:376 +msgid "Data and Time" +msgstr "" + +#: includes/class-compressx-log.php:377 +#: includes/class-compressx-log.php:746 +msgid "Log File Name" +msgstr "" + +#: includes/class-compressx-log.php:378 +msgid "Log Size" +msgstr "" + +#: includes/class-compressx-log.php:379 +#: includes/class-compressx-log.php:748 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:543 +msgid "Actions" +msgstr "" + +#: includes/class-compressx-log.php:452 +#: includes/class-compressx-log.php:820 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:553 +msgid "Details" +msgstr "" + +#: includes/class-compressx-log.php:453 +#: includes/class-compressx-log.php:821 +#: includes/display/class-compressx-system-info.php:75 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:450 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:554 +msgid "Download" +msgstr "" + +#: includes/class-compressx-log.php:454 +#: includes/class-compressx-log.php:822 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:555 +#: includes/display_v2/class-compressx-settings-display.php:354 +msgid "Delete" +msgstr "" + +#: includes/class-compressx-log.php:745 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:540 +msgid "Date & Time" +msgstr "" + +#: includes/class-compressx-log.php:747 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:542 +msgid "Size" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:42 +#: includes/display/class-compressx-custom-media-lib.php:118 +#: includes/display/class-compressx-custom-media-lib.php:129 +msgid "CompressX" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:53 +msgid "Converting..." +msgstr "" + +#: includes/class-compressx-manual-optimization.php:57 +msgid "Convert" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:119 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:497 +msgid "Original" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:120 +msgid "Webp" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:120 +#: includes/class-compressx-manual-optimization.php:121 +msgid "Saved" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:121 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:513 +#: includes/display_v2/class-compressx-image-optimization-display.php:556 +#: includes/display_v2/class-compressx-image-optimization-display.php:751 +#: includes/display_v2/class-compressx-image-optimization-display.php:773 +#: includes/display_v2/class-compressx-image-optimization-display.php:795 +#: includes/display_v2/class-compressx-image-optimization-display.php:817 +#: includes/display_v2/class-compressx-image-optimization-display.php:869 +#: includes/display_v2/class-compressx-image-optimization-display.php:891 +#: includes/display_v2/class-compressx-image-optimization-display.php:913 +#: includes/display_v2/class-compressx-image-optimization-display.php:935 +#: includes/display_v2/class-compressx-image-optimization-display.php:957 +#: includes/display_v2/class-compressx-image-optimization-display.php:979 +msgid "AVIF" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:122 +msgid "Thumbnails generated" +msgstr "" + +#: includes/class-compressx-manual-optimization.php:129 +msgid "Delete the WebP and AVIF images generated by CompressX." +msgstr "" + +#. translators: %1$s: plugins name +#: includes/class-compressx.php:198 +msgid "It seems that multiple image optimization plugins are installed on the website. This may cause conflicts while optimizing your images. In order to optimize your images properly and effectively, you may consider disabling other image optimization plugins: %1$s." +msgstr "" + +#: includes/display/class-compressx-advanced-compression-level-display.php:183 +#: includes/display/class-compressx-cdn.php:139 +#: includes/display/class-compressx-dashboard.php:767 +#: includes/display/class-compressx-dashboard.php:796 +#: includes/display/class-compressx-dashboard.php:1091 +#: includes/display/class-compressx-dashboard.php:1412 +#: includes/display/class-compressx-dashboard.php:1482 +#: includes/display_v2/class-compressx-cdn-display.php:245 +#: includes/display_v2/class-compressx-image-optimization-display.php:1867 +#: includes/display_v2/class-compressx-settings-display.php:414 +msgid "Saved!" +msgstr "" + +#: includes/display/class-compressx-cdn.php:78 +#: includes/display_v2/class-compressx-cdn-display.php:70 +msgid "Cloudflare Integration" +msgstr "" + +#: includes/display/class-compressx-cdn.php:84 +msgid "Cloudflare E-mail: " +msgstr "" + +#: includes/display/class-compressx-cdn.php:90 +msgid "Global API Key: " +msgstr "" + +#: includes/display/class-compressx-cdn.php:96 +msgid "Zone ID: " +msgstr "" + +#: includes/display/class-compressx-cdn.php:102 +msgid "Purge Cache Automatically: " +msgstr "" + +#: includes/display/class-compressx-cdn.php:106 +msgid "Purge all cache automatically after successfully converting images in bulk." +msgstr "" + +#: includes/display/class-compressx-cdn.php:110 +msgid "Purge all cache automatically after 5 minutes of manually converting images on media library." +msgstr "" + +#: includes/display/class-compressx-cdn.php:115 +msgid "Cloudflare Email:" +msgstr "" + +#: includes/display/class-compressx-cdn.php:115 +msgid "Email address associated to your Cloudflare account" +msgstr "" + +#: includes/display/class-compressx-cdn.php:116 +msgid "Global API Key:" +msgstr "" + +#: includes/display/class-compressx-cdn.php:116 +#: includes/display_v2/class-compressx-cdn-display.php:80 +msgid "A key for granting access to Cloudflare API to perform actions. You can find it in your Cloudflare dashboard > My Profile > API Tokens > Global API Key." +msgstr "" + +#: includes/display/class-compressx-cdn.php:117 +msgid "Zone ID:" +msgstr "" + +#: includes/display/class-compressx-cdn.php:117 +#: includes/display_v2/class-compressx-cdn-display.php:106 +msgid "A zone ID is generated automatically when a domain is added to Cloudflare and is required for API operations. You can find it in your Cloudflare Dashboard > The website overview > API section." +msgstr "" + +#: includes/display/class-compressx-cdn.php:122 +#: includes/display_v2/class-compressx-cdn-display.php:137 +msgid "Purge All Cloudflare CDN Cache Manually" +msgstr "" + +#: includes/display/class-compressx-cdn.php:127 +#: includes/display_v2/class-compressx-cdn-display.php:143 +msgid "Done!" +msgstr "" + +#: includes/display/class-compressx-cdn.php:134 +#: includes/display/class-compressx-dashboard.php:1086 +#: includes/display/class-compressx-dashboard.php:1407 +#: includes/display/class-compressx-dashboard.php:1477 +#: includes/display_v2/class-compressx-cdn-display.php:239 +#: includes/display_v2/class-compressx-image-optimization-display.php:1860 +#: includes/display_v2/class-compressx-settings-display.php:407 +msgid "Save Changes" +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:43 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:43 +#: includes/display_v2/class-compressx-settings-display.php:266 +msgid "Custom Folders" +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:46 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:46 +#: includes/display_v2/class-compressx-settings-display.php:268 +#: includes/display_v2/class-compressx-settings-display.php:272 +msgid "Select custom folders in the /wp-content folder and process images inside them." +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:55 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:55 +msgid "Media Files Found: " +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:56 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:56 +msgid "Total Savings: " +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:57 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:57 +msgid "Processed Media Files: " +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:61 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:61 +#: includes/display_v2/class-compressx-settings-display.php:318 +msgid "Bulk Process Now" +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:62 +#: includes/display/class-compressx-dashboard.php:953 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:62 +#: includes/display_v2/class-compressx-settings-display.php:319 +msgid "Cancel Processing" +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:66 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:306 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:66 +#: includes/display_v2/class-compressx-settings-display.php:323 +msgid "Force all images to be re-processed" +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:198 +msgid "Included Folders: " +msgstr "" + +#: includes/display/class-compressx-custom-bulk-action.php:198 +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:198 +#: includes/display_v2/class-compressx-settings-display.php:288 +msgid "Media files inside these folders will be processed" +msgstr "" + +#: includes/display/class-compressx-custom-media-lib.php:44 +#: includes/display/class-compressx-custom-media-lib.php:60 +msgid "Not support" +msgstr "" + +#: includes/display/class-compressx-custom-media-lib.php:66 +#: includes/display/class-compressx-custom-media-lib.php:99 +#: includes/display/class-compressx-custom-media-lib.php:115 +msgid "Skipped" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:121 +msgid "If the plugin has helped you, perhaps you could leave us a nice review and give us 5 stars? It would mean a lot to us and would be very motivating!" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:123 +msgid "Yes, let me give a nice review" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:124 +#: includes/display_v2/class-compressx-image-optimization-display.php:155 +msgid "Ask me later" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:125 +msgid "I already did:)" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:126 +#: includes/display_v2/class-compressx-image-optimization-display.php:161 +#: includes/display_v2/class-compressx-media-replace-display.php:593 +msgid "Dismiss" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:232 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:272 +#: includes/display_v2/class-compressx-image-optimization-display.php:281 +msgid "Your server does not have GD or Imagick extension installed, images cannot be converted to WebP or AVIF on the website.Please install GD or Imagick PHP extension and restart the server service to convert images to WebP and AVIF." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:242 +#: includes/display_v2/class-compressx-image-optimization-display.php:309 +msgid "We've detected a cache plugin on the site which may be causing rewrite rules of CompressX to fail. Please clear website cache to ensure the rewrite rules take effect." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:248 +#: includes/display_v2/class-compressx-image-optimization-display.php:316 +msgid ".htaccess rewrite rules - we've detected that .htaccess write rules are not executed on your Apache server, this can be because the server is not configured correctly for using .htaccess file from custom locations. For more details, please read this doc - How-to: Config Apache htaccess Rules" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:254 +#: includes/display_v2/class-compressx-image-optimization-display.php:323 +msgid "We’ve detected that you use Nginx server. Nginx server does not support .htaccess rewrite rules and needs additional configurations to work. For more details, please read this doc - How-to: Config Nginx htaccess Rules" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:260 +#: includes/display_v2/class-compressx-image-optimization-display.php:331 +msgid "We've detected that the server is LiteSpeed, which requires a service restart for rewrite rules to take effect. Please restart the Litespeed service to make CompressX rewrite rules effective." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:266 +#: includes/display_v2/class-compressx-image-optimization-display.php:339 +msgid "We’ve not detected an Apache or Nginx server. You may be using a different web server that we have not tested our plugin on." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:298 +msgid "Outputted to WEBP" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:304 +msgid "Outputted to AVIF" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:470 +msgid "Images Scanning" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:474 +msgid "Bulk Processing" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:478 +msgid "Finished" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:483 +#: includes/display/class-compressx-dashboard.php:494 +msgid "CompressX is processing the images. Keep the page open to finish the bulk action." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:495 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:575 +#: includes/display_v2/class-compressx-system-info-display.php:202 +#: includes/display_v2/class-compressx-system-info-display.php:339 +msgid "Close" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:730 +#: includes/display_v2/class-compressx-image-optimization-display.php:488 +msgid "Enable it to convert the new uploaded images." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:741 +#: includes/display_v2/class-compressx-image-optimization-display.php:498 +msgid "Library to Process Images" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:747 +msgid "Choose the PHP extension to process images." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:748 +msgid "GD is a PHP extension for handling image optimization.It may be slightly faster at processing large images but supports fewer image formats" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:749 +msgid "Imagick is another image optimization library that supports more image formats and produces higher quality images." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:754 +#: includes/display_v2/class-compressx-image-optimization-display.php:508 +msgid "Check Environment" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:770 +msgid "Output Formats: " +msgstr "" + +#: includes/display/class-compressx-dashboard.php:789 +#: includes/display_v2/class-compressx-image-optimization-display.php:542 +msgid "Convert .jpg and .png images to WebP or/and AVIF format." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:790 +msgid "If the original image is a WebP image, it will be converted to AVIF (if checked) and compressed." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:791 +msgid "If the original image is an AVIF image, it will be compressed." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:836 +msgid "Compression Level" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:910 +msgid "Custom Compression Level" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:927 +msgid "Customize the compression level, a value of 100 means lossless compression, less than 100 means lossy compression. The recommended/default value is 80 for WebP and 60 for AVIF." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:934 +msgid "Save and Close" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:952 +msgid "Start Bulk Processing" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:959 +msgid "Process images only in the WordPress media library (Uploads) in bulk." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:973 +msgid "Force all images to be re-processed." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1033 +msgid "Choose the thumbnail sizes you want to process." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1079 +#: includes/display_v2/class-compressx-settings-display.php:141 +msgid "Choose thumbnail sizes you want to process. Some themes may generate new thumbnail sizes sometimes, then you'll need to reprocess the thumbnails sizes using the Bulk Processing function." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1107 +#: includes/display_v2/class-compressx-settings-display.php:340 +msgid "Delete Images Generated by CompressX" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1123 +msgid "All WebP and AVIF images and data in the database generated by CompressX will be deleted. Please proceed with caution. Original images will not be affected." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1226 +#: includes/display_v2/class-compressx-image-optimization-display.php:1621 +msgid "General Settings" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1232 +msgid "Change Style" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1236 +msgid "New Style" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1241 +msgid "Old Style" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1247 +msgid "Choose between the new style and the old style. After saving, the page will automatically redirect to the selected style." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1254 +#: includes/display_v2/class-compressx-image-optimization-display.php:1626 +msgid "Browser compatibility" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1258 +msgid "Use rewrite rule" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1263 +msgid "Compatible Rewrite Rule (Beta)" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1268 +#: includes/display_v2/class-compressx-image-optimization-display.php:1641 +msgid "Use picture tag" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1274 +msgid "Rewrite rule:Load WebP and AVIF images by adding rewrite rules to the .htaccess file. So if the browser supports AVIF, AVIF images will be loaded. If AVIF is not supported, WebP images will be loaded. If both formats are not supported, the original .jpg and .png images will be loaded if any.The '.htaccess' refers to '/wp-content/.htaccess'." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1276 +msgid "Compatible Rewrite Rule (Beta): An alternative set of rewrite rules for broader server compatibility. Try it when the standard \"Rewrite Rule\" fails." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1279 +msgid "Picture tag: Load WebP and AVIF images by replacing tags with tags. You can use it when .htaccess can not take effect on your server. For example, if you are not able to restart an OpenLiteSpeed server which is required for .htaccess to take effect. This method works for most browsers but does not support images in CSS." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1287 +msgid "Do not convert PNG images" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1291 +msgid "Do not convert PNG to WebP format" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1296 +msgid "Do not convert PNG to AVIF format" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1311 +msgid "Remove EXIF data" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1315 +msgid "Remove EXIF data(unavailable for the GD conversion method)" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1321 +#: includes/display_v2/class-compressx-image-optimization-display.php:1677 +msgid "Remove metadata recorded in images (Only supported by Imagick), including geolocation,timestamps, authorship, image summary, etc. This helps to protect your privacy." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1328 +msgid "Parameters of processing images" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1340 +msgid "images processed per ajax request." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1346 +msgid "This value indicates how many WordPress image attachments (including original images and thumbnails) can be processed in one AJAX cycle. For example, if the value is set to 1, the plugin will process 1 attachment, which may include 1 original image and 20 thumbnails. Typically, web hosting services allow an AJAX execution time of 120 seconds, during which 3 image attachments can be processed, equating to 3 original images and 60 thumbnails. The default value is set to 5." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1354 +#: includes/display/class-compressx-dashboard.php:1358 +msgid "Automatic removal of files in output formats larger than the original ones" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1364 +#: includes/display_v2/class-compressx-image-optimization-display.php:1694 +msgid "Auto-delete larger AVIF/WebP images Automatically delete AVIF/WebP images when they are larger than the original images." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1371 +msgid "Auto-resizing large images" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1376 +msgid "Enable auto-resizing large images" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1378 +msgid "Maximum Width:" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1379 +msgid "Maximum Height:" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1384 +#: includes/display_v2/class-compressx-image-optimization-display.php:1649 +msgid "This option allows you to enter a width and height, so large images will be proportionately resized upon upload. For example, if you set 1280 px for the width, all large images will be resized in proportion to 1280 px in width upon upload." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1391 +msgid "Remove 'Header always set Cache-Control \"private\"' from .htaccess file." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1395 +msgid "Remove 'Header always set Cache-Control \"private\"' from .htaccess file,the '.htaccess' refers to '/wp-content/.htaccess'" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1401 +#: includes/display_v2/class-compressx-settings-display.php:382 +msgid "You can try to check this option if the site cannot be cached by Cloudflare." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1435 +#: includes/display_v2/class-compressx-settings-display.php:205 +msgid "Exclude Folders" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1439 +#: includes/display_v2/class-compressx-settings-display.php:207 +#: includes/display_v2/class-compressx-settings-display.php:211 +msgid "Select folders in the Uploads folder (media library) and exclude them from the processing." +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1446 +#: includes/display_v2/class-compressx-settings-display.php:219 +msgid "Media library(Uploads):" +msgstr "" + +#: includes/display/class-compressx-dashboard.php:1454 +#: includes/display_v2/class-compressx-settings-display.php:227 +msgid "Excluded Folders:" +msgstr "" + +#: includes/display/class-compressx-display.php:361 +msgid "Are you sure to enable WebP as output format? This will convert your images to WebP format." +msgstr "" + +#: includes/display/class-compressx-display.php:362 +msgid "Are you sure to disable WebP as output format?" +msgstr "" + +#: includes/display/class-compressx-display.php:363 +msgid "We detect that you use ImageMagick 6.x, this version has a known bug that can cause AVIF conversion timeout. Enabling AVIF conversion with this version is not recommended. Are you sure you wish to proceed?" +msgstr "" + +#: includes/display/class-compressx-display.php:364 +msgid "Are you sure to enable AVIF as output format? This will convert your images to AVIF format." +msgstr "" + +#: includes/display/class-compressx-display.php:365 +msgid "Are you sure to disable AVIF as output format?" +msgstr "" + +#: includes/display/class-compressx-display.php:366 +#: includes/display_v2/class-compressx-image-optimization-display.php:551 +#: includes/display_v2/class-compressx-image-optimization-display.php:558 +#: includes/display_v2/class-compressx-system-info-display.php:105 +#: includes/display_v2/class-compressx-system-info-display.php:113 +#: includes/display_v2/class-compressx-system-info-display.php:135 +#: includes/display_v2/class-compressx-system-info-display.php:143 +msgid "Supported" +msgstr "" + +#: includes/display/class-compressx-display.php:367 +#: includes/display_v2/class-compressx-image-optimization-display.php:551 +#: includes/display_v2/class-compressx-image-optimization-display.php:558 +#: includes/display_v2/class-compressx-image-optimization-display.php:568 +#: includes/display_v2/class-compressx-system-info-display.php:107 +#: includes/display_v2/class-compressx-system-info-display.php:115 +#: includes/display_v2/class-compressx-system-info-display.php:137 +#: includes/display_v2/class-compressx-system-info-display.php:145 +msgid "Unsupported" +msgstr "" + +#: includes/display/class-compressx-display.php:368 +msgid "Failed to save settings." +msgstr "" + +#: includes/display/class-compressx-display.php:369 +msgid "An error occurred while saving settings." +msgstr "" + +#: includes/display/class-compressx-display.php:379 +msgid "Are you sure to cancel this progressing?" +msgstr "" + +#: includes/display/class-compressx-display.php:380 +msgid "Are you sure to pause this progressing?" +msgstr "" + +#: includes/display/class-compressx-display.php:381 +msgid "Are you sure you want to delete this log file?" +msgstr "" + +#: includes/display/class-compressx-display.php:382 +msgid "Are you sure you want to leave this page?" +msgstr "" + +#: includes/display/class-compressx-display.php:383 +msgid "Optimization Success" +msgstr "" + +#: includes/display/class-compressx-display.php:785 +msgid "Documentation" +msgstr "" + +#: includes/display/class-compressx-display.php:786 +msgid "Troubleshooting" +msgstr "" + +#: includes/display/class-compressx-display.php:787 +msgid "Support" +msgstr "" + +#: includes/display/class-compressx-display.php:865 +msgid "Enjoying CompressX? Please" +msgstr "" + +#: includes/display/class-compressx-display.php:867 +msgid "leave us a" +msgstr "" + +#: includes/display/class-compressx-display.php:869 +msgid "review" +msgstr "" + +#: includes/display/class-compressx-display.php:871 +msgid "it helps a lot!" +msgstr "" + +#: includes/display/class-compressx-logs.php:55 +msgid "Logs: " +msgstr "" + +#: includes/display/class-compressx-logs.php:57 +#: includes/display_v2/class-compressx-system-info-display.php:314 +msgid "Empty Logs" +msgstr "" + +#: includes/display/class-compressx-system-info.php:48 +msgid "There are two ways available to send us the debug information. The first one is recommended." +msgstr "" + +#: includes/display/class-compressx-system-info.php:51 +msgid "Method 1." +msgstr "" + +#: includes/display/class-compressx-system-info.php:51 +msgid "If you have configured SMTP on your site, enter your email address and click the button below to send us the relevant information (website info and errors logs) when you are encountering errors. This will help us figure out what happened. Once the issue is resolved, we will inform you by your email address." +msgstr "" + +#: includes/display/class-compressx-system-info.php:55 +msgid "CompressX support email:" +msgstr "" + +#: includes/display/class-compressx-system-info.php:58 +msgid "Your email:" +msgstr "" + +#: includes/display/class-compressx-system-info.php:63 +msgid "Please describe your problem here." +msgstr "" + +#: includes/display/class-compressx-system-info.php:66 +msgid "Send Debug Information to Us" +msgstr "" + +#: includes/display/class-compressx-system-info.php:68 +msgid "Send succeeded." +msgstr "" + +#: includes/display/class-compressx-system-info.php:72 +msgid "Method 2." +msgstr "" + +#: includes/display/class-compressx-system-info.php:72 +msgid "If you didn’t configure SMTP on your site, click the button below to download the relevant information (website info and error logs) to your PC when you are encountering some errors. Sending the files to us will help us diagnose what happened." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:31 +msgid "Addons" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:34 +msgid "Extra utilities to simplify your workflow and manage images beyond compression." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:39 +msgid "Upgrade Now" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:55 +msgid "Advanced Compression Level Settings" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:58 +msgid "Maximize image optimization with smart algorithms that reduce file size while preserving visual quality. Ideal for users who want the best balance of speed and image clarity for their site" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:66 +msgid "Remove JPG/PNG Thumbnails" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:69 +msgid "Automatically delete original JPG/PNG thumbnails after converting them to WebP or AVIF to free up disk space." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:77 +msgid "Cron Support" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:80 +msgid "Automates your image optimization workflows with a robust cron system, flexibly scheduling AVIF/WebP conversions for new, existing, and popular images." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:88 +msgid "Thumbnails Generation/reGeneration" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:91 +msgid "Regenerate thumbnails (WebP, AVIF, JPG, or PNG) for your website images based on your settings. Add custom thumbnail sizes. Remove unused and orphan thumbnails and their metadata." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:99 +msgid "WP-CLI" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:102 +msgid "Use WP-CLI to efficiently convert images in your WordPress media library. You can choose to convert all images, or a specific image, or convert the latest n images." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:112 +msgid "Watermark" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:115 +msgid "Add watermarks to your images during the process of uploading, bulk WebP/AVIF conversion, and thumbnail regeneration (WebP, AVIF, JPG, or PNG)." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:123 +msgid "CDN Integration" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:126 +msgid "Integrate with Cloudflare Pro and and BunnyCDN to convert and serve your website images as WebP/AVIF formats. Enable 'Vary for images' to dynamically serve correct variants." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:134 +msgid "Roles and Capabilities" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:137 +msgid "Control CompressX Pro settings and features by setting a super admin. The super admin can grant access for other user roles include admin." +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:145 +msgid "Multisite Support" +msgstr "" + +#: includes/display_v2/class-compressx-addons-display.php:148 +msgid "Manage and optimize images across all sites in your WordPress Multisite network from a single dashboard." +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:247 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:291 +#: includes/display_v2/class-compressx-image-optimization-display.php:70 +#: includes/display_v2/class-compressx-image-optimization-display.php:595 +msgid "Bulk Optimization" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:250 +msgid "CompressX will scan and optimize all your images in bulk." +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:292 +msgid "Free Mode" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:296 +msgid "CompressX will scan and optimize your images. You can either start right now or schedule it later" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:296 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:316 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:326 +#: includes/display_v2/class-compressx-image-optimization-display.php:678 +msgid "Pro" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:300 +#: includes/display_v2/class-compressx-media-replace-display.php:557 +msgid "Note:" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:300 +msgid "Pro users" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:300 +msgid "can close this page and processing will continue in the background. Free users must keep this page open until completion." +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:313 +msgid "Start Now" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:316 +msgid "Run immediately in the foreground (Free) or background" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:322 +msgid "Schedule" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:325 +msgid "Use your configured schedule to process automatically." +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:341 +msgid "Bulk Optimization in Progress" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:343 +msgid "Ready" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:351 +#: includes/display_v2/class-compressx-media-replace-display.php:599 +msgid "Warning:" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:353 +msgid "You must keep this page open until completion." +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:364 +#: includes/display_v2/class-compressx-bulk-optimization-display.php:379 +#: includes/display_v2/class-compressx-image-optimization-display.php:262 +msgid "Got it" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:407 +msgid "images processed" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:414 +msgid "Current Job" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:423 +msgid "Processed" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:427 +#: includes/display_v2/class-compressx-system-info-display.php:190 +msgid "Failed" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:431 +msgid "Remaining" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:437 +msgid "Cancel" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:444 +msgid "Live Log" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:447 +msgid "Auto-scroll" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:449 +msgid "Copy" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:455 +msgid "[Waiting for optimization to start...]" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:468 +msgid "Image Comparison" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:470 +msgid "This comparison updates automatically for the images being optimized. After completion, the last processed image will remain visible." +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:477 +msgid "Comparison will appear here during optimization" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:483 +msgid "Original vs WebP" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:486 +msgid "Original vs AVIF" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:489 +msgid "WebP vs AVIF" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:504 +#: includes/display_v2/class-compressx-image-optimization-display.php:549 +#: includes/display_v2/class-compressx-image-optimization-display.php:747 +#: includes/display_v2/class-compressx-image-optimization-display.php:769 +#: includes/display_v2/class-compressx-image-optimization-display.php:791 +#: includes/display_v2/class-compressx-image-optimization-display.php:813 +#: includes/display_v2/class-compressx-image-optimization-display.php:865 +#: includes/display_v2/class-compressx-image-optimization-display.php:887 +#: includes/display_v2/class-compressx-image-optimization-display.php:909 +#: includes/display_v2/class-compressx-image-optimization-display.php:931 +#: includes/display_v2/class-compressx-image-optimization-display.php:953 +#: includes/display_v2/class-compressx-image-optimization-display.php:975 +msgid "WebP" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:532 +msgid "Recent 10 Logs" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:533 +msgid "View All" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:541 +msgid "Log File" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:569 +#: includes/display_v2/class-compressx-system-info-display.php:333 +msgid "Activity Log" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:573 +#: includes/display_v2/class-compressx-system-info-display.php:337 +msgid "Download Log" +msgstr "" + +#: includes/display_v2/class-compressx-bulk-optimization-display.php:583 +#: includes/display_v2/class-compressx-system-info-display.php:347 +msgid "Open log file created:" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:45 +msgid "CDN Provider" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:46 +msgid "Select your CDN provider to configure integration details." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:49 +msgid "Cloudflare" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:50 +msgid "BunnyCDN" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:71 +msgid "Provide credentials to allow CompressX to connect with Cloudflare." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:76 +msgid "Global API Key" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:89 +msgid "Cloudflare Email" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:93 +msgid "Email address associated to your Cloudflare account." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:102 +msgid "Zone ID" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:122 +#: includes/display_v2/class-compressx-cdn-display.php:184 +msgid "Features" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:127 +#: includes/display_v2/class-compressx-cdn-display.php:197 +msgid "Purge cache automatically after bulk image optimization." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:132 +#: includes/display_v2/class-compressx-cdn-display.php:202 +msgid "Purge cache automatically after manual image conversions (5 min delay)." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:140 +msgid "Processing..." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:158 +msgid "BunnyCDN Integration" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:162 +msgid "Provide credentials to allow CompressX to connect with BunnyCDN." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:163 +#: includes/display_v2/class-compressx-image-optimization-display.php:722 +#: includes/display_v2/class-compressx-image-optimization-display.php:840 +#: includes/display_v2/class-compressx-image-optimization-display.php:1767 +#: includes/display_v2/class-compressx-image-optimization-display.php:1825 +msgid "Pro only" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:167 +msgid "Access Key" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:169 +#: includes/display_v2/class-compressx-cdn-display.php:175 +msgid "Pro Feature" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:173 +msgid "Pull Zone ID" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:190 +msgid "Enable" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:190 +msgid "Vary for Images" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:191 +msgid "(ensures proper delivery of image variants across browsers)." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:207 +msgid "Purge All BunnyCDN Cache Manually" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:222 +msgid "CDN Support" +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:225 +msgid "Connect CompressX with your CDN to deliver optimized images worldwide, with automatic cache purging and faster performance." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:242 +msgid "Saving..." +msgstr "" + +#: includes/display_v2/class-compressx-cdn-display.php:288 +#: includes/display_v2/class-compressx-image-optimization-display.php:1914 +#: includes/display_v2/class-compressx-settings-display.php:456 +msgid "Tip" +msgstr "" + +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:190 +#: includes/display_v2/class-compressx-settings-display.php:280 +msgid "wp-content:" +msgstr "" + +#: includes/display_v2/class-compressx-custom-bulk-action-v2.php:198 +#: includes/display_v2/class-compressx-settings-display.php:288 +msgid "Included Folders:" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:61 +msgid "Image Optimization Settings" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:64 +msgid "Apply best-practice optimization to new uploads and historical images. The defaults balance quality and size for most sites." +msgstr "" + +#. translators: %s: optimized image size wrapped in a span element. +#: includes/display_v2/class-compressx-image-optimization-display.php:130 +msgid "🎉 CompressX.io has optimized %s of images for you!" +msgstr "" + +#. translators: %s: highlighted text for "5-star review". +#: includes/display_v2/class-compressx-image-optimization-display.php:141 +msgid "If CompressX has helped you, could you leave us a %s?" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:143 +msgid "5-star review" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:146 +msgid "Your feedback motivates us to keep improving 🚀" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:152 +msgid "Yes, I'll leave a review" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:158 +msgid "I already did 🙂" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:229 +msgid "Big Update – Same Features, Better Experience" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:234 +msgid "We've redesigned the interface to make it cleaner and easier to use." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:235 +msgid "Every feature from the old version is still here — just better organized." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:240 +msgid "Refreshed UI – simpler navigation and setup" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:242 +msgid "Switch Back Option – if you feel something is missing, you can return to the old UI anytime" +msgstr "" + +#. translators: %s: support forum URL. +#: includes/display_v2/class-compressx-image-optimization-display.php:251 +msgid "If you notice a feature missing, let us know — we'll fix it quickly." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:256 +msgid "Don't worry: the old UI will stay available and maintained until the new interface is fully stable." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:465 +msgid "Global & Output Formats" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:482 +msgid "Auto-optimize new uploads" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:503 +msgid "Choose the PHP extension for image processing. GD is faster for large images but supports fewer formats. Imagick supports more formats and produces higher quality results." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:516 +msgid "GD" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:518 +msgid "Default PHP library" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:518 +#: includes/display_v2/class-compressx-image-optimization-display.php:528 +#: includes/display_v2/class-compressx-system-info-display.php:94 +#: includes/display_v2/class-compressx-system-info-display.php:125 +msgid "Not Installed" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:526 +msgid "Imagick" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:528 +msgid "Better performance" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:537 +msgid "Output Formats" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:567 +msgid "Note: If the server lacks codecs, it will show as" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:569 +msgid "and be disabled automatically." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:583 +msgid "Image Quality Presets" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:588 +msgid "Choose the most appropriate compression level. Higher quality means larger file sizes but better image appearance." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:619 +msgid "Global Preset" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:620 +msgid "WooCommerce Images" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:622 +msgid "WordPress Standard Images" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:634 +msgid "Global Compression Mode" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:638 +msgid "Choose how compression quality is applied across your images." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:644 +msgid "Lossless:" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:645 +msgid "Default:" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:659 +#: includes/display_v2/class-compressx-media-replace-display.php:265 +msgid "General" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:662 +msgid "Use a single fixed compression quality for all images." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:665 +msgid "The simplest settings for common websites." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:677 +#: includes/display_v2/class-compressx-media-replace-display.php:271 +msgid "Smart" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:680 +msgid "Learn more" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:684 +msgid "Automatically adjust quality based on image size." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:687 +msgid "Higher quality for small images, stronger compression for large images." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:721 +msgid "Enable to control compression levels for WooCommerce-specific images." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:728 +#: includes/display_v2/class-compressx-image-optimization-display.php:846 +msgid "Reset to Default" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:738 +msgid "Product Featured Image" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:740 +msgid "Webp (85-90), AVIF (85-90)---brand/visual integrity important" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:760 +msgid "Product Gallery Image" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:762 +msgid "Webp (75-85), AVIF (75-85)---visual but secondary to main image" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:782 +msgid "Variation-Specific Image" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:784 +msgid "Webp (75-85), AVIF (75-85)---often similar to gallery use" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:804 +msgid "Category Image (Taxonomy)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:806 +msgid "Webp (70-80), AVIF (70-80)---smaller, not full focus" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:839 +msgid "Enable to fine-tune compression levels for common WordPress image types." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:856 +msgid "Site Logo" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:858 +msgid "Webp (88+), AVIF (85+)---branding clarity is essential" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:878 +msgid "Header Background" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:880 +msgid "Webp (75-85), AVIF (75-85)---may span full width, retain clarity" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:900 +msgid "Featured Image (Post)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:902 +#: includes/display_v2/class-compressx-image-optimization-display.php:924 +msgid "Webp (85-90), AVIF (85-90)---visually impactful, often shared" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:922 +msgid "Featured Image (Page)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:944 +msgid "Image in Sidebar" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:946 +msgid "Webp (60-75), AVIF (60-75)---small visual element" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:966 +msgid "Image Field Used via ACF" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:968 +msgid "Webp (70-80), AVIF (70-80)---depends on context, often supportive" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1003 +#: includes/display_v2/class-compressx-image-optimization-display.php:1061 +msgid "Compression Quality (1–99)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1139 +msgid "Smart Quality Rules" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1142 +msgid "Define how compression quality changes based on image size." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1148 +msgid "Tip:" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1149 +msgid "In most cases, you do not need to change any settings below." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1150 +msgid "Smart mode works well with the default values for most sites." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1160 +msgid "Size Threshold" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1163 +msgid "Define the split point between fixed and adaptive compression." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1164 +#: includes/display_v2/class-compressx-image-optimization-display.php:1256 +#: includes/display_v2/class-compressx-image-optimization-display.php:1292 +msgid "Why?" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1168 +msgid "Images ≤" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1172 +msgid "KB use fixed quality" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1176 +msgid "Recommended value: 30KB – 100KB." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1182 +msgid "Why a size threshold?" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1185 +msgid "Very small images are more sensitive to quality changes." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1186 +msgid "Using a fixed quality helps preserve visual clarity." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1196 +msgid "Small Images (≤ Threshold)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1199 +msgid "Fixed compression quality is applied." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1203 +msgid "WebP Fixed Quality" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1217 +msgid "AVIF Fixed Quality" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1233 +msgid "Large Images (> Threshold)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1236 +msgid "Compression quality decreases automatically as image size increases." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1242 +msgid "WebP Quality Range" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1246 +#: includes/display_v2/class-compressx-image-optimization-display.php:1282 +msgid "Quality at Threshold" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1249 +#: includes/display_v2/class-compressx-image-optimization-display.php:1285 +msgid "(Inherited)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1253 +#: includes/display_v2/class-compressx-image-optimization-display.php:1289 +msgid "Threshold → 4MB" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1256 +#: includes/display_v2/class-compressx-image-optimization-display.php:1292 +msgid " to " +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1256 +#: includes/display_v2/class-compressx-image-optimization-display.php:1292 +msgid "Lower quality, smaller file size." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1262 +#: includes/display_v2/class-compressx-image-optimization-display.php:1298 +msgid "Quality ≥ 4MB" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1278 +msgid "AVIF Quality Range" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1627 +msgid "Choose how to deliver WebP/AVIF images: via .htaccess rewrite rules (standard or compatible for broader support) or picture tags (when .htaccess doesn't work, but excludes CSS images)." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1633 +msgid "Use rewrite rule (default)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1637 +msgid "Compatible rewrite rule (Beta)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1648 +msgid "Max dimensions" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1669 +msgid "px (images larger than this will be downscaled proportionally)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1676 +msgid "EXIF data" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1682 +msgid "Keep (default)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1686 +msgid "Strip" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1693 +msgid "Avoid larger files" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1707 +msgid "If optimized file is larger, keep original" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1713 +msgid "Format exclusions" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1714 +msgid "Select the formats you want to exclude from conversion. This can help reduce server load and improve performance." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1719 +msgid "Do not convert PNG to WebP" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1723 +msgid "Do not convert PNG to AVIF" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1730 +msgid "Queue throughput" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1731 +msgid "Number of WordPress image attachments (including original and thumbnails) processed per AJAX cycle. Default is 5." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1735 +msgid "Process 5 images per batch (recommended)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1736 +msgid "Process 10 images per batch" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1737 +msgid "Process 20 images per batch" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1738 +msgid "Process 1 image per batch (safest)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1740 +msgid "Est. ~300 images/hour (depends on server performance)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1753 +msgid "View More Settings" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1765 +msgid "New Upload (Cron)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1766 +msgid "Choose when to process new uploads: immediately (real-time but may delay availability), after a delay (recommended to avoid workflow interruption), or during scheduled low-traffic windows (minimizes server impact)." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1775 +msgid "Process immediately on upload" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1777 +msgid "Images are optimized right after uploading. May cause short delays on image availability during conversion." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1785 +msgid "(Recommended) Delay processing" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1787 +msgid "Process images after" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1794 +msgid "minutes of uploading" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1797 +msgid "Helps avoid slowdowns during peak uploads by deferring conversion slightly." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1805 +msgid "Scheduled processing window" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1807 +msgid "Daily:" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1809 +msgid "to" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1813 +msgid "Process new uploads only within a set time window (e.g. overnight) to reduce server load." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1823 +msgid "Watermark (optional)" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1824 +msgid "Enable this option to automatically tag newly uploaded images, making them ready for batch watermarking. This feature allows you to easily identify and process recent uploads for watermark application, streamlining your image protection process." +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1838 +msgid "Mark new uploads for watermarking" +msgstr "" + +#: includes/display_v2/class-compressx-image-optimization-display.php:1864 +#: includes/display_v2/class-compressx-media-replace-display.php:226 +#: includes/display_v2/class-compressx-settings-display.php:358 +#: includes/display_v2/class-compressx-settings-display.php:411 +msgid "Loading..." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:32 +#: includes/display_v2/class-compressx-media-replace-display.php:33 +#: includes/display_v2/class-compressx-media-replace-display.php:56 +#: includes/display_v2/class-compressx-media-replace-display.php:130 +#: includes/display_v2/class-compressx-media-replace-display.php:198 +#: includes/display_v2/class-compressx-media-replace-display.php:223 +msgid "Replace Media" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:79 +msgid "Upload & Replace Media File" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:83 +msgid "Replace this attachment and regenerate thumbnails according to your settings." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:133 +msgid "Upload a new file" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:135 +msgid "Click to replace this file via CompressX." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:201 +msgid " Safely replace this media file without changing its URL." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:228 +msgid "Success!" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:258 +msgid "Current Compression Settings" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:272 +#: includes/display_v2/class-compressx-media-replace-display.php:340 +msgid "(Pro)" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:276 +msgid "Formats:" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:276 +msgid "WebP, AVIF" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:277 +msgid "Thumbnails:" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:277 +msgid "All Selected Thumbnail sizes" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:291 +msgid "Auto re-optimize after replacement" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:292 +#: includes/display_v2/class-compressx-media-replace-display.php:308 +#: includes/display_v2/class-compressx-media-replace-display.php:321 +msgid "✓ Saved" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:295 +msgid "Replace all WordPress-generated thumbnails with new ones created from the replaced file, then re-optimize them automatically." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:299 +msgid "Thumbnail Generation Strategy" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:307 +msgid "Use current default sizes and fill missing ones (Recommended)" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:311 +msgid "Generate thumbnails using the current default sizes and automatically create any missing sizes." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:320 +msgid "Match original thumbnail sizes" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:324 +msgid "Generate new thumbnails strictly based on the original image's existing thumbnail sizes." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:340 +msgid "Keep temporary versions after replacement" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:348 +msgid "Keep up to" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:362 +msgid "versions" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:368 +msgid "Retention period" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:371 +msgid "1 day" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:372 +msgid "3 days" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:373 +msgid "7 days" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:378 +msgid "Versions are removed automatically after expiration." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:382 +msgid "This is a short-term safety buffer, not a backup system." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:401 +msgid "After Replacement" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:405 +msgid "✓ URL unchanged" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:406 +msgid "✓ Attachment ID unchanged" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:407 +msgid "✓ Thumbnails regenerated (PNG/JPG/WEBP/AVIF)" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:408 +msgid "✓ Formats re-optimized" +msgstr "" + +#. translators: %d: number of days the previous version is retained. +#: includes/display_v2/class-compressx-media-replace-display.php:412 +msgid "✓ The previous version will be kept for %d day." +msgstr "" + +#. translators: %d: number of generated thumbnails. +#: includes/display_v2/class-compressx-media-replace-display.php:523 +#: includes/display_v2/class-compressx-media-replace-display.php:528 +msgid "Thumbnails: %d" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:540 +msgid "Current Media" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:545 +#: includes/display_v2/class-compressx-media-replace-display.php:619 +msgid "Replace preview" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:549 +#: includes/display_v2/class-compressx-media-replace-display.php:623 +msgid "Format:" +msgstr "" + +#. translators: %s: documentation URL. +#: includes/display_v2/class-compressx-media-replace-display.php:562 +msgid "The image preview may still show a cached version due to browser or CDN caching. Learn more..." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:581 +msgid "New Media" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:584 +msgid "For best visual consistency, upload an image with a similar width (or slightly wider) than the original." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:585 +msgid "Learn more..." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:608 +msgid "Upload new media" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:611 +msgid "Click to upload or drag and drop a file here" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:614 +msgid "The file will replace the current media without changing the URL." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:622 +msgid "Dimensions:" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:624 +msgid "File size:" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:629 +msgid "Remove the uploaded file" +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:702 +msgid "No file uploaded." +msgstr "" + +#: includes/display_v2/class-compressx-media-replace-display.php:710 +msgid "No attachment_id." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:41 +msgid "Global Settings" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:44 +msgid "Manage all core settings in one place." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:66 +msgid "Image Optimization" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:139 +msgid "Thumbnail Sizes to Process" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:145 +msgid "Select which image sizes CompressX should optimize. These apply to both new uploads and bulk processing." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:161 +msgid "Show more sizes…" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:171 +msgid "Original image" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:189 +msgid "Some themes or plugins may generate additional image sizes. If new sizes appear, you may need to reprocess them using the Bulk Processing tool." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:227 +msgid "Media files inside these folders will" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:227 +msgid "NOT" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:227 +msgid "be processed" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:312 +msgid "Media Files Found:" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:313 +msgid "Total Savings:" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:314 +msgid "Processed Media Files:" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:345 +msgid "This will permanently delete all" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:345 +msgid "and" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:345 +msgid "images and database records generated by CompressX." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:346 +msgid "Your original images will not be affected, and you can always generate new WebP/AVIF versions again by re-optimizing." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:351 +msgid "Type DELETE to confirm" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:361 +msgid "Deleted!" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:364 +msgid "Enter" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:364 +msgid "and click Delete to confirm this action." +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:380 +#: includes/display_v2/class-compressx-settings-display.php:393 +msgid "Remove 'Header always set Cache-Control \"private\"' from .htaccess file" +msgstr "" + +#: includes/display_v2/class-compressx-settings-display.php:386 +msgid "The '.htaccess' refers to '/wp-content/.htaccess'" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:39 +msgid "Logs & System Information" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:42 +msgid "Access error logs and system details to quickly diagnose issues and ensure CompressX is running smoothly." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:56 +msgid "System Information" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:59 +msgid "Send Debug Info" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:66 +msgid "Environment" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:68 +msgid "Server:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:69 +msgid "WordPress:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:70 +msgid "PHP:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:72 +#: includes/display_v2/class-compressx-system-info-display.php:162 +#: includes/display_v2/class-compressx-system-info-display.php:188 +msgid "OK" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:76 +msgid "Home URL:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:84 +msgid "Image Libraries" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:86 +msgid "GD Extension:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:90 +#: includes/display_v2/class-compressx-system-info-display.php:123 +msgid "Installed" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:90 +#: includes/display_v2/class-compressx-system-info-display.php:123 +msgid "Active" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:94 +#: includes/display_v2/class-compressx-system-info-display.php:125 +msgid "Missing" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:102 +#: includes/display_v2/class-compressx-system-info-display.php:132 +msgid "WebP:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:110 +#: includes/display_v2/class-compressx-system-info-display.php:140 +msgid "AVIF:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:121 +msgid "Imagick:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:156 +msgid "Resources" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:158 +msgid "Memory Current:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:159 +msgid "Memory Peak:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:160 +msgid "Memory Limit:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:170 +msgid "WordPress Setup" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:172 +msgid "Theme:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:173 +msgid "Plugins:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:184 +msgid "View full list" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:186 +msgid "Rewrite Rules:" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:188 +msgid "Success" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:190 +msgid "Error" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:200 +msgid "Active Plugins" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:210 +msgid "Plugin" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:211 +msgid "Path" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:212 +msgid "Status" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:259 +msgid "Method 1 (Recommended)" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:262 +msgid "Send debug info directly via email if SMTP is configured. We'll notify you once it's resolved." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:267 +msgid "CompressX Support Email" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:272 +msgid "Your Email" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:273 +msgid "you@example.com" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:279 +msgid "Problem Description" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:280 +msgid "Please describe your problem here..." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:285 +msgid "Send Debug Information" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:291 +msgid "Method 2 (Alternative)" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:294 +msgid "If SMTP is not configured, download the debug information (website info & error logs) and send it to us manually." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:297 +msgid "Download Debug File" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:312 +msgid "Logs" +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:593 +#: includes/display_v2/class-compressx-system-info-display.php:601 +#: includes/display_v2/class-compressx-system-info-display.php:704 +#: includes/display_v2/class-compressx-system-info-display.php:717 +msgid "The log not found " +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:610 +msgid "Unable to open the log file." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:842 +msgid "GD extension is not installed or enabled." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:844 +msgid "The GD extension has been properly installed." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:852 +msgid "The imagick extension has been properly installed." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:857 +msgid "Imagick extension is not installed or enabled." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:998 +msgid "User's email address is required." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:1004 +msgid "Please enter a valid email address." +msgstr "" + +#: includes/display_v2/class-compressx-system-info-display.php:1079 +msgid "Unable to send email. Please check the configuration of email server." +msgstr "" diff --git a/wp-content/plugins/compressx/readme.txt b/wp-content/plugins/compressx/readme.txt new file mode 100644 index 0000000..ae44978 --- /dev/null +++ b/wp-content/plugins/compressx/readme.txt @@ -0,0 +1,218 @@ +=== CompressX — AVIF & WebP Converter, Media Replacement === +Contributors: compressxio +Tags: convert WebP, convert AVIF, WebP, AVIF, optimization +Requires at least: 5.8 +Tested up to: 7.0.2 +Requires PHP: 7.0 +Stable tag: 0.9.39 +License: GPLv3 or later +License URI: https://www.gnu.org/licenses/gpl-3.0.en.html + +AVIF & WebP converter with built-in media replacement for local image optimization. + +== Description == +CompressX is a free, lightweight WebP & AVIF conversion and media replacement plugin for WordPress. It allows you to easily convert JPG and PNG images to WebP and AVIF formats, compress WebP and AVIF images, and replace media files without changing their URLs or attachment IDs. All AVIF and WebP conversions are performed locally on your web server. + +== Core Features == + += 1. Convert AVIF & Compress AVIF = +Convert jpg, png, and WebP images on your WordPress website to AVIF format, and compress AVIF images according to the compression level you set. +If the original image is already in AVIF format which is supported since WordPress 6.5, the original AVIF image will only be compressed. += 2. Convert WebP & Compress WebP = +Convert jpg, png images on your WordPress website to WebP format, and compress WebP images according to the compression level you set. +If the original image is already in WebP format which is supported since WordPress 5.8, the original WebP image will only be compressed. += 3. Media Replacement & Auto Re-Optimization = +Safely replace an existing media file without changing its URL or attachment ID. When a new image is uploaded as a replacement, the system automatically regenerates thumbnails, applies your configured format conversion and compression rules, resizes where needed, and re-optimizes the file. += 4. Exclude Folders = +Select specific folders in your media library and prevent images inside them from being processed. += 5. Custom Folders = +Select folders that are in the wp-content folder but outside the Uploads (media library) and process images inside them. += 6. Auto-Process New Images = +Automatically convert new images uploaded to a WordPress website to WebP/AVIF format and compress WebP/AVIF images upon upload. += 7. Auto-Remove Large Images = +Automatically remove converted AVIF/WebP images when they are larger than original images. += 8. Restore Original Images = +Your images will be reverted to their original state and all AVIF/WebP images and data in the database generated by CompressX will be removed when CompressX is uninstalled. + +== Minimum Requirements to use CompressX == +* Character Encoding UTF-8 +* PHP version 7.0 +* MySQL version 4.1 +* WordPress 5.8 + +== Screenshots == +1. Converting PNG/JPG images to WebP +2. Converting PNG/JPG images to AVIF +3. Compressing WebP images +4. Compressing AVIF images + +== Installation == + += Install CompressX = +1.Go to your sites admin dashboard. +2.Navigate to Plugins Menu and search for CompressX. +3.Find CompressX and click Install Now. +4. Click Activate. + +== External Services == +This plugin optionally connects to the [Cloudflare API](https://api.cloudflare.com/) to purge your CDN cache. It sends the Cloudflare Zone ID, account email, and Global API Key whenever the "Purge Cloudflare Cache" button is clicked or automatically upon optimization completion (if enabled in settings). This service is provided by Cloudflare, Inc: [Terms of Service](https://www.cloudflare.com/terms/), [Privacy Policy](https://www.cloudflare.com/privacypolicy/). + +== Frequently Asked Questions == += What does CompressX do? = +CompressX converts JPG/PNG images on your WordPress website to WebP and AVIF formats, compress WebP and AVIF images locally, and replace existing medias for free! += Does CompressX convert AVIF? Is it a free feature? = +Yes, CompressX supports AVIF conversion and compression, the AVIF conversion and compression feature is completely free. += Does CompressX convert WebP? Is it a free feature? = +Yes, CompressX supports WebP conversion and compression, the WebP conversion and compression feature is completely free. += Do you provide support for CompressX? Where? = +Yes, absolutely. Whenever you need help, start a thread on the support forum or [contact us](https://compressx.io/contact-us/). += Do you have any get-started guides/docs? = +Yes, we do. Here is a [tutorial](https://compressx.io/docs/compressx-overview/) for you to quickly get started with CompressX. + +== Changelog == += 0.9.39 = +- Added an option to control the number of images processed in each scan batch. +- Improved scan efficiency for websites with a large number of images. += 0.9.38 = +- Successfully tested with WordPress 7.0. += 0.9.37 = +- Improved localization support to align with the updated plugin interface. += 0.9.36 = +- Fixed some bugs in the plugin code. +- Optimized the plugin code. +- Refined the plugin readme file. += 0.9.35 = +- Added a feature of replacing an image in your media library by uploading a new image. +- Fixed some bugs in the plugin code. +- Optimized plugin UI. += 0.9.34 = +- Added a custom database table for saving CompressX image data. +- Fixed some bugs in the plugin code. +- Optimized plugin UI and core code. += 0.9.33 = +- Major update to the plugin user interface. +- Fixed some bugs in the plugin code. +- Successfully tested with PHP 8.5. +- Successfully tested with WordPress 6.9. += 0.9.32 = +- Fixed: Manual image conversions from media library would fail. += 0.9.31 = +- Fixed some bugs in the plugin code. += 0.9.30 = +- Fixed: Custom compression level settings could not be saved. += 0.9.29 = +- Added a compatible rewrite rule option for broader server compatibility. +- Optimized the efficiency of batch scanning, especially for sites with many images. += 0.9.28 = +- Fixed: Incorrect image statistics calculation. +- Added support for image rotation during WebP/AVIF conversion. +- Fixed: Image resizing data could not be updated in the database. += 0.9.27 = +- Refactored the plugin code and optimized the code structure. +- Optimized and reduced CompressX entries in postmeta table. +- Fixed some UI bugs. += 0.9.26 = +- Expanded compatibility to support a wider range of server configurations. +- Added a clear warning about potential AVIF conversion timeouts when using ImageMagick 6.x. +- Enhanced compatibility of .htaccess rewrite rules to accommodate diverse server settings. +- Optimized bulk image processing to skip stuck images. +- Optimized the plugin code. += 0.9.25 = +- Fixed a UI bug. +- Optimized the plugin code. += 0.9.24 = +- Fixed: CDN integration settings could not be saved correctly. +- Optimized the plugin code and UI. += 0.9.23 = +- Added support for conversion of Elementor custom thumbnails size. +- Added support for conversion in media library grid view and image edit page. += 0.9.22 = +- Fixed: Picture tag did not take all sizes in srcset. +- Fixed: Conversion would fail if image's MIME type did not match the MIME type saved in posts. +- Optimized the plugin UI. += 0.9.21 = +- Added an option of 'Do not convert PNG to WebP'. +- Added an option to automatically purge cache after manual conversion from media library. +- Optimized the plugin UI. +- Canceled support for grid view of media library. Only list view is supported. += 0.9.20 = +- Optimized process of scanning a large number of images. +- Successfully tested with WordPress 6.7. += 0.9.19 = +- Optimized image scanning method in the bulk processing workflow. += 0.9.18 = +- Fixed: Default compression level for bulk processing was wrongly set to lossless. += 0.9.17 = +- Added an option of 'picture tag' to load WebP and AVIF images. +- Optimized the plugin UI. +- Optimized the plugin code. += 0.9.16 = +- Fixed a UI bug that would appear when folders that do not exist were added to exclusion rules. +- Optimized the plugin code. += 0.9.15 = +- Fixed some bugs in the plugin code. +- Optimized the plugin code. += 0.9.14 = +- Added support for multilanguage translation. +- Added an option to exclude PNG images from conversion. +- Added an option to delete cache control settings from .htaccess file. +- Fixed: WebP images could not be displayed as AVIF after conversion. +- Optimized the plugin UI. +- Optimized the plugin code. += 0.9.13 = +- Added support for Cloudflare CDN. +- Fixed: Settings of 'auto-resizing large images' could not take effect. +- Optimized the plugin code. += 0.9.12 = +- Fixed a UI bug where WebP option could not be selected in some cases. +- Fixed: Images would be repeatedly processed when EXIF removal option was enabled. +- Optimized the plugin code. += 0.9.11 = +- Added an option to delete converted images. +- Optimized the plugin UI. +- Fixed some bugs in the plugin code. +- Optimized the plugin code. += 0.9.10 = +- Fixed: Image quality would not be changed after AVIF conversion with Imagick. +- Fixed: Incorrect compression quality with Imagick and Lossless compression level. +- Fixed: Custom compression level would not take effect. +- Optimized the plugin code. += 0.9.9 = +- Added an option to set how many images to process per ajax request. +- Fixed some bugs in the plugin code. +- Optimized the plugin code. += 0.9.8 = +- Added a Debug section. +- Fixed some bugs in the plugin code. +- Optimized the plugin code. += 0.9.7 = +- Fixed the path error of rewrite rules that appeared in some environments. +- Fixed: Some settings could not take effect. +- Fixed some bugs in the plugin code. +- Optimized the plugin code. += 0.9.6 = +- Fixed a bug where AVIF output format could not be enabled. +- Fixed some bugs in the plugin code. +- Optimized the plugin code. += 0.9.5 = +- Fixed a bug in the plugin code. +- Optimized the plugin code. += 0.9.4 = +- Fixed a critical bug in the plugin code. +- Optimized the plugin code. += 0.9.3 = +- Fixed a critical bug in the plugin code. +- Optimized the plugin code. += 0.9.2 = +- Added a check for the case where multiple image optimization plugins are activated. +- Fixed some bugs in the plugin code. +- Optimized the plugin code. +- Successfully tested with WordPress 6.6. += 0.9.1 = +- Initial release. Hello world! + +== Upgrade Notice == +Latest version 0.9.39: += 0.9.39 = +- Added an option to control the number of images processed in each scan batch. +- Improved scan efficiency for websites with a large number of images. \ No newline at end of file diff --git a/wp-content/plugins/compressx/uninstall.php b/wp-content/plugins/compressx/uninstall.php new file mode 100644 index 0000000..78387a6 --- /dev/null +++ b/wp-content/plugins/compressx/uninstall.php @@ -0,0 +1,26 @@ +service_exists() ) { + $integration = add_submenu_page( + 'wpcf7-dashboard', + __( 'Integration with External API', 'contact-form-7' ), + __( 'Integration', 'contact-form-7' ) + . wpcf7_admin_menu_change_notice( 'wpcf7-integration' ), + 'wpcf7_manage_integration', + 'wpcf7-integration', + 'wpcf7_admin_integration_page' + ); + + add_action( 'load-' . $integration, 'wpcf7_load_integration_page', 10, 0 ); + } +} + + +function wpcf7_admin_menu_change_notice( $menu_slug = '' ) { + $counts = apply_filters( 'wpcf7_admin_menu_change_notice', + array( + 'wpcf7' => 0, + 'wpcf7-new' => 0, + 'wpcf7-integration' => 0, + ) + ); + + if ( empty( $menu_slug ) ) { + $count = absint( array_sum( $counts ) ); + } elseif ( isset( $counts[$menu_slug] ) ) { + $count = absint( $counts[$menu_slug] ); + } else { + $count = 0; + } + + if ( $count ) { + return sprintf( + ' %2$s', + $count, + esc_html( number_format_i18n( $count ) ) + ); + } + + return ''; +} + + +add_action( + 'admin_enqueue_scripts', + 'wpcf7_admin_enqueue_scripts', + 10, 1 +); + +function wpcf7_admin_enqueue_scripts( $hook_suffix ) { + if ( ! str_contains( $hook_suffix, 'wpcf7' ) ) { + return; + } + + wp_enqueue_style( 'contact-form-7-admin', + wpcf7_plugin_url( 'admin/includes/css/styles.css' ), + array(), WPCF7_VERSION, 'all' + ); + + if ( wpcf7_is_rtl() ) { + wp_enqueue_style( 'contact-form-7-admin-rtl', + wpcf7_plugin_url( 'admin/includes/css/styles-rtl.css' ), + array(), WPCF7_VERSION, 'all' + ); + } + + $assets = include wpcf7_plugin_path( 'admin/includes/js/index.asset.php' ); + + $assets = wp_parse_args( $assets, array( + 'dependencies' => array(), + 'version' => WPCF7_VERSION, + ) ); + + wp_enqueue_script( 'wpcf7-admin', + wpcf7_plugin_url( 'admin/includes/js/index.js' ), + $assets['dependencies'], + $assets['version'], + array( 'in_footer' => true ) + ); + + wp_set_script_translations( 'wpcf7-admin', 'contact-form-7' ); + + $wpcf7_obj = array( + 'apiSettings' => array( + 'root' => sanitize_url( rest_url( 'contact-form-7/v1' ) ), + 'namespace' => 'contact-form-7/v1', + ), + ); + + $post = wpcf7_get_current_contact_form(); + + if ( $post ) { + $wpcf7_obj = array_merge( $wpcf7_obj, array( + 'nonce' => array( + 'save' => wp_create_nonce( + sprintf( + 'wpcf7-save-contact-form_%s', + $post->initial() ? -1 : $post->id() + ) + ), + 'copy' => wp_create_nonce( + sprintf( + 'wpcf7-copy-contact-form_%s', + $post->initial() ? -1 : $post->id() + ) + ), + 'delete' => wp_create_nonce( + sprintf( + 'wpcf7-delete-contact-form_%s', + $post->initial() ? -1 : $post->id() + ) + ), + ), + 'configValidator' => array( + 'errors' => array(), + 'docUrl' => WPCF7_ConfigValidator::get_doc_link(), + ), + ) ); + + if ( + current_user_can( 'wpcf7_edit_contact_form', $post->id() ) and + wpcf7_validate_configuration() + ) { + $config_validator = new WPCF7_ConfigValidator( $post ); + $config_validator->restore(); + + $wpcf7_obj['configValidator'] = array_merge( + $wpcf7_obj['configValidator'], + array( + 'errors' => $config_validator->collect_error_messages( + array( 'decodes_html_entities' => true ) + ), + ) + ); + } + } + + wp_add_inline_script( 'wpcf7-admin', + sprintf( + 'var wpcf7 = %s;', + wp_json_encode( $wpcf7_obj, JSON_PRETTY_PRINT ) + ), + 'before' + ); +} + + +add_filter( + 'set_screen_option_wpcf7_contact_forms_per_page', + static function ( $result, $option, $value ) { + $wpcf7_screens = array( + 'wpcf7_contact_forms_per_page', + ); + + if ( in_array( $option, $wpcf7_screens, true ) ) { + $result = $value; + } + + return $result; + }, + 10, 3 +); + + +function wpcf7_load_dashboard_page() { + do_action( 'wpcf7_admin_load', + wpcf7_superglobal_get( 'page' ), + wpcf7_current_action() + ); + + require_once WPCF7_PLUGIN_DIR . '/admin/includes/dashboard.php'; + + wpcf7_dashboard_setup(); + + wp_enqueue_script( 'dashboard' ); +} + + +function wpcf7_admin_dashboard_page() { + global $wp_meta_boxes; + + $screen = get_current_screen(); + $page = $screen->id; + $core_widget_ids = array_keys( wpcf7_dashboard_widgets() ); + + foreach ( $wp_meta_boxes[$page] as $context => $priorities ) { + foreach ( $priorities as $priority => $boxes ) { + if ( ! in_array( $priority, array( 'high', 'core' ), true ) ) { + continue; + } + + foreach ( $boxes as $box_id => $box ) { + if ( in_array( $box_id, $core_widget_ids, true ) ) { + continue; + } + + if ( ! isset( $priorities['default'][$box_id] ) ) { + $wp_meta_boxes[$page][$context]['default'][$box_id] = $box; + } elseif ( ! isset( $priorities['low'][$box_id] ) ) { + $wp_meta_boxes[$page][$context]['low'][$box_id] = $box; + } + + unset( $wp_meta_boxes[$page][$context][$priority][$box_id] ); + } + } + } + + require_once WPCF7_PLUGIN_DIR . '/admin/dashboard.php'; +} + + +function wpcf7_load_contact_form_admin() { + global $plugin_page; + + $action = wpcf7_current_action(); + + do_action( 'wpcf7_admin_load', + wpcf7_superglobal_get( 'page' ), + $action + ); + + if ( 'save' === $action ) { + $id = wpcf7_superglobal_post( 'post_ID', '-1' ); + + check_admin_referer( 'wpcf7-save-contact-form_' . $id ); + + if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { + wp_die( + esc_html( __( 'You are not allowed to edit this item.', 'contact-form-7' ) ) + ); + } + + $contact_form = wpcf7_save_contact_form( + array_merge( + wp_unslash( $_REQUEST ), + array( + 'id' => $id, + 'title' => wpcf7_superglobal_post( 'post_title', null ), + 'locale' => wpcf7_superglobal_post( 'wpcf7-locale', null ), + 'form' => wpcf7_superglobal_post( 'wpcf7-form', '' ), + 'mail' => wpcf7_superglobal_post( 'wpcf7-mail', array() ), + 'mail_2' => wpcf7_superglobal_post( 'wpcf7-mail-2', array() ), + 'messages' => wpcf7_superglobal_post( 'wpcf7-messages', array() ), + 'additional_settings' => wpcf7_superglobal_post( 'wpcf7-additional-settings', '' ), + ) + ) + ); + + if ( $contact_form and wpcf7_validate_configuration() ) { + $config_validator = new WPCF7_ConfigValidator( $contact_form ); + $config_validator->validate(); + $config_validator->save(); + } + + $query = array( + 'post' => $contact_form ? $contact_form->id() : 0, + 'active-tab' => wpcf7_canonicalize_name( + wpcf7_superglobal_post( 'active-tab' ) + ), + ); + + if ( ! $contact_form ) { + $query['message'] = 'failed'; + } elseif ( -1 === (int) $id ) { + $query['message'] = 'created'; + } else { + $query['message'] = 'saved'; + } + + $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); + wp_safe_redirect( $redirect_to ); + exit(); + } + + if ( 'copy' === $action ) { + $id = absint( $_POST['post_ID'] ?? $_REQUEST['post'] ?? '' ); + + check_admin_referer( 'wpcf7-copy-contact-form_' . $id ); + + if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { + wp_die( + esc_html( __( 'You are not allowed to edit this item.', 'contact-form-7' ) ) + ); + } + + $query = array(); + + if ( $contact_form = wpcf7_contact_form( $id ) ) { + $new_contact_form = $contact_form->copy(); + $new_contact_form->save(); + + $query['post'] = $new_contact_form->id(); + $query['message'] = 'created'; + } + + $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); + + wp_safe_redirect( $redirect_to ); + exit(); + } + + if ( 'delete' === $action ) { + $nonce_action = 'bulk-posts'; + + if ( + $post_id = wpcf7_superglobal_post( 'post_ID' ) or + ! is_array( $post_id = wpcf7_superglobal_request( 'post', array() ) ) + ) { + $nonce_action = sprintf( 'wpcf7-delete-contact-form_%s', $post_id ); + } + + check_admin_referer( $nonce_action ); + + $posts = array_filter( (array) $post_id ); + + $deleted = 0; + + foreach ( $posts as $post ) { + $post = WPCF7_ContactForm::get_instance( $post ); + + if ( empty( $post ) ) { + continue; + } + + if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) ) { + wp_die( + esc_html( __( 'You are not allowed to delete this item.', 'contact-form-7' ) ) + ); + } + + if ( ! $post->delete() ) { + wp_die( + esc_html( __( 'Error in deleting.', 'contact-form-7' ) ) + ); + } + + $deleted += 1; + } + + $query = array(); + + if ( ! empty( $deleted ) ) { + $query['message'] = 'deleted'; + } + + $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); + + wp_safe_redirect( $redirect_to ); + exit(); + } + + $post = null; + + if ( 'wpcf7-new' === $plugin_page ) { + $post = WPCF7_ContactForm::get_template( array( + 'locale' => wpcf7_superglobal_get( 'locale', null ), + ) ); + } elseif ( $post_id = wpcf7_superglobal_get( 'post' ) ) { + $post = WPCF7_ContactForm::get_instance( $post_id ); + } + + $current_screen = get_current_screen(); + + $help_tabs = new WPCF7_Help_Tabs( $current_screen ); + + if ( $post and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) { + $help_tabs->set_help_tabs( 'edit' ); + } else { + // Construct a list table before get_column_headers() is called. + WPCF7_List_Table::get_instance(); + + add_screen_option( 'per_page', array( + 'default' => 20, + 'option' => 'wpcf7_contact_forms_per_page', + ) ); + + $help_tabs->set_help_tabs( 'list' ); + } +} + + +function wpcf7_admin_management_page() { + if ( $post = wpcf7_get_current_contact_form() ) { + $post_id = $post->initial() ? -1 : $post->id(); + + require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php'; + require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php'; + return; + } + + if ( + 'validate' === wpcf7_current_action() and + wpcf7_validate_configuration() and + current_user_can( 'wpcf7_edit_contact_forms' ) + ) { + wpcf7_admin_bulk_validate_page(); + return; + } + + require_once WPCF7_PLUGIN_DIR . '/admin/contact-forms.php'; +} + + +function wpcf7_admin_add_new_page() { + $post = wpcf7_get_current_contact_form(); + + if ( ! $post ) { + $post = WPCF7_ContactForm::get_template(); + } + + $post_id = -1; + + require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php'; + require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php'; +} + + +function wpcf7_load_integration_page() { + do_action( 'wpcf7_admin_load', + wpcf7_superglobal_get( 'page' ), + wpcf7_current_action() + ); + + $integration = WPCF7_Integration::get_instance(); + + if ( + $service_name = wpcf7_superglobal_request( 'service' ) and + $integration->service_exists( $service_name ) + ) { + $service = $integration->get_service( $service_name ); + $service->load( wpcf7_current_action() ); + } + + $help_tabs = new WPCF7_Help_Tabs( get_current_screen() ); + $help_tabs->set_help_tabs( 'integration' ); +} + + +function wpcf7_admin_integration_page() { + require_once WPCF7_PLUGIN_DIR . '/admin/integration.php'; +} + + +add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message', 10, 3 ); + +function wpcf7_admin_updated_message( $page, $action, $object ) { + if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ), true ) ) { + return; + } + + $message_type = wpcf7_superglobal_request( 'message' ); + + if ( ! $message_type ) { + return; + } + + $notice_type = 'success'; + + if ( 'created' === $message_type ) { + $message = __( 'Contact form created.', 'contact-form-7' ); + } elseif ( 'saved' === $message_type ) { + $message = __( 'Contact form saved.', 'contact-form-7' ); + } elseif ( 'deleted' === $message_type ) { + $message = __( 'Contact form deleted.', 'contact-form-7' ); + } elseif ( 'failed' === $message_type ) { + $notice_type = 'error'; + $message = __( 'There was an error saving the contact form.', 'contact-form-7' ); + } elseif ( 'validated' === $message_type ) { + $bulk_validate = WPCF7::get_option( 'bulk_validate', array() ); + $count_invalid = absint( $bulk_validate['count_invalid'] ?? 0 ); + + if ( $count_invalid ) { + $notice_type = 'warning'; + + $message = sprintf( + /* translators: %s: number of contact forms */ + _n( + 'Configuration validation completed. %s invalid contact form was found.', + 'Configuration validation completed. %s invalid contact forms were found.', + $count_invalid, 'contact-form-7' + ), + number_format_i18n( $count_invalid ) + ); + } else { + $message = __( 'Configuration validation completed. No invalid contact form was found.', 'contact-form-7' ); + } + } + + if ( ! empty( $message ) ) { + wp_admin_notice( + $message, + array( 'type' => $notice_type ) + ); + } +} + + +add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 ); + +function wpcf7_plugin_action_links( $links, $file ) { + if ( WPCF7_PLUGIN_BASENAME !== $file ) { + return $links; + } + + if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) { + return $links; + } + + $settings_link = wpcf7_link( + menu_page_url( 'wpcf7-dashboard', false ), + __( 'Settings', 'contact-form-7' ) + ); + + array_unshift( $links, $settings_link ); + + return $links; +} + + +add_action( 'wpcf7_admin_warnings', 'wpcf7_old_wp_version_error', 10, 3 ); + +function wpcf7_old_wp_version_error( $page, $action, $object ) { + $wp_version = get_bloginfo( 'version' ); + + if ( version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) { + wp_admin_notice( + sprintf( + /* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */ + __( 'Contact Form 7 %1$s requires WordPress %2$s or higher. Please update WordPress first.', 'contact-form-7' ), + WPCF7_VERSION, + WPCF7_REQUIRED_WP_VERSION, + admin_url( 'update-core.php' ) + ), + array( 'type' => 'warning' ) + ); + } +} + + +add_action( 'wpcf7_admin_warnings', 'wpcf7_not_allowed_to_edit', 10, 3 ); + +function wpcf7_not_allowed_to_edit( $page, $action, $object ) { + if ( $object instanceof WPCF7_ContactForm ) { + $contact_form = $object; + } else { + return; + } + + if ( ! current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) { + wp_admin_notice( + __( 'You are not allowed to edit this contact form.', 'contact-form-7' ), + array( 'type' => 'warning' ) + ); + } +} + + +add_action( 'wpcf7_admin_warnings', 'wpcf7_ctct_deprecated_warning', 10, 3 ); + +function wpcf7_ctct_deprecated_warning( $page, $action, $object ) { + $service = WPCF7_ConstantContact::get_instance(); + + if ( $service->is_active() ) { + wp_admin_notice( + sprintf( + /* translators: 1: URL to announcement post, 2: URL to Brevo integration doc */ + __( 'Contact Form 7 has completed the removal of the Constant Contact integration. We recommend Brevo as an alternative.', 'contact-form-7' ), + 'https://contactform7.com/2025/01/08/complete-removal-of-constant-contact-integration/', + 'https://contactform7.com/sendinblue-integration/' + ), + array( 'type' => 'warning' ) + ); + } +} + + +add_action( 'wpcf7_admin_warnings', 'wpcf7_captcha_future_warning', 10, 3 ); + +function wpcf7_captcha_future_warning( $page, $action, $object ) { + $service = WPCF7_RECAPTCHA::get_instance(); + + if ( $service->is_active() ) { + wp_admin_notice( + sprintf( + /* translators: %s: URL to Turnstile integration doc */ + __( 'Attention reCAPTCHA users: Google attempts to make all reCAPTCHA users migrate to reCAPTCHA Enterprise, meaning Google charges you for API calls exceeding the free tier. Contact Form 7 supports Cloudflare Turnstile, and we recommend it unless you have reasons to use reCAPTCHA.', 'contact-form-7' ), + 'https://contactform7.com/turnstile-integration/' + ), + array( 'type' => 'warning' ) + ); + } +} diff --git a/wp-content/plugins/contact-form-7/admin/contact-forms.php b/wp-content/plugins/contact-form-7/admin/contact-forms.php new file mode 100644 index 0000000..ccd4453 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/contact-forms.php @@ -0,0 +1,90 @@ +prepare_items(); + +$formatter = new WPCF7_HTMLFormatter( array( + 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( + 'form' => array( + 'method' => true, + ), + ) ), +) ); + +$formatter->append_start_tag( 'div', array( + 'class' => 'wrap', + 'id' => 'wpcf7-contact-form-list-table', +) ); + +$formatter->append_start_tag( 'h1', array( + 'class' => 'wp-heading-inline', +) ); + +$formatter->append_preformatted( + esc_html( __( 'Contact Forms', 'contact-form-7' ) ) +); + +$formatter->end_tag( 'h1' ); + +if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) { + $formatter->append_preformatted( + wpcf7_link( + menu_page_url( 'wpcf7-new', false ), + __( 'Add Contact Form', 'contact-form-7' ), + array( 'class' => 'page-title-action' ) + ) + ); +} + +if ( $search_keyword = wpcf7_superglobal_request( 's' ) ) { + $formatter->append_start_tag( 'span', array( + 'class' => 'subtitle', + ) ); + + $formatter->append_preformatted( + sprintf( + /* translators: %s: Search query. */ + __( 'Search results for: %s', 'contact-form-7' ), + esc_html( $search_keyword ) + ) + ); + + $formatter->end_tag( 'span' ); +} + +$formatter->append_start_tag( 'hr', array( + 'class' => 'wp-header-end', +) ); + +$formatter->call_user_func( static function () { + do_action( 'wpcf7_admin_warnings', + 'wpcf7', wpcf7_current_action(), null + ); + + do_action( 'wpcf7_admin_notices', + 'wpcf7', wpcf7_current_action(), null + ); +} ); + +$formatter->append_start_tag( 'form', array( + 'method' => 'get', +) ); + +$formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'name' => 'page', + 'value' => wpcf7_superglobal_request( 'page' ), +) ); + +$formatter->call_user_func( static function () use ( $list_table ) { + $list_table->search_box( + __( 'Search Contact Forms', 'contact-form-7' ), + 'wpcf7-contact' + ); + + $list_table->display(); +} ); + +$formatter->print(); diff --git a/wp-content/plugins/contact-form-7/admin/dashboard.php b/wp-content/plugins/contact-form-7/admin/dashboard.php new file mode 100644 index 0000000..f8832f3 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/dashboard.php @@ -0,0 +1,39 @@ +append_start_tag( 'div', array( + 'class' => 'wrap', +) ); + +$formatter->append_start_tag( 'h1' ); + +$formatter->append_preformatted( + esc_html( __( 'Contact Form 7 Dashboard', 'contact-form-7' ) ) +); + +$formatter->end_tag( 'h1' ); + +$formatter->call_user_func( static function () { + do_action( 'wpcf7_admin_warnings', + 'wpcf7-dashboard', + wpcf7_current_action(), + null + ); + + do_action( 'wpcf7_admin_notices', + 'wpcf7-dashboard', + wpcf7_current_action(), + null + ); +} ); + +$formatter->append_start_tag( 'div', array( + 'id' => 'dashboard-widgets-wrap', +) ); + +$formatter->call_user_func( 'wp_dashboard' ); + +$formatter->print(); diff --git a/wp-content/plugins/contact-form-7/admin/edit-contact-form.php b/wp-content/plugins/contact-form-7/admin/edit-contact-form.php new file mode 100644 index 0000000..d8afd71 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/edit-contact-form.php @@ -0,0 +1,416 @@ + array_merge( wpcf7_kses_allowed_html(), array( + 'form' => array( + 'method' => true, + 'action' => true, + 'id' => true, + 'class' => true, + 'disabled' => true, + ), + ) ), +) ); + +$formatter->append_start_tag( 'div', array( + 'class' => 'wrap', + 'id' => 'wpcf7-contact-form-editor', +) ); + +$formatter->append_start_tag( 'h1', array( + 'class' => 'wp-heading-inline', +) ); + +$formatter->append_preformatted( + esc_html( $post->initial() + ? __( 'Add Contact Form', 'contact-form-7' ) + : __( 'Edit Contact Form', 'contact-form-7' ) + ) +); + +$formatter->end_tag( 'h1' ); + +if ( ! $post->initial() and current_user_can( 'wpcf7_edit_contact_forms' ) ) { + $formatter->append_whitespace(); + + $formatter->append_preformatted( + wpcf7_link( + menu_page_url( 'wpcf7-new', false ), + __( 'Add Contact Form', 'contact-form-7' ), + array( 'class' => 'page-title-action' ) + ) + ); +} + +$formatter->append_start_tag( 'hr', array( + 'class' => 'wp-header-end', +) ); + +$formatter->call_user_func( static function () use ( $post ) { + do_action( 'wpcf7_admin_warnings', + $post->initial() ? 'wpcf7-new' : 'wpcf7', + wpcf7_current_action(), + $post + ); + + do_action( 'wpcf7_admin_notices', + $post->initial() ? 'wpcf7-new' : 'wpcf7', + wpcf7_current_action(), + $post + ); +} ); + +if ( $post ) { + $formatter->append_start_tag( 'form', array( + 'method' => 'post', + 'action' => esc_url( add_query_arg( + array( 'post' => $post_id ), + menu_page_url( 'wpcf7', false ) + ) ), + 'id' => 'wpcf7-admin-form-element', + 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ), + ) ); + + if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { + $formatter->call_user_func( static function () use ( $post_id ) { + wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id ); + } ); + } + + $formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'id' => 'post_ID', + 'name' => 'post_ID', + 'value' => (int) $post_id, + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'id' => 'wpcf7-locale', + 'name' => 'wpcf7-locale', + 'value' => $post->locale(), + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'id' => 'hiddenaction', + 'name' => 'action', + 'value' => 'save', + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'id' => 'active-tab', + 'name' => 'active-tab', + 'value' => wpcf7_superglobal_get( 'active-tab' ), + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'poststuff', + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'post-body', + 'class' => 'metabox-holder columns-2 wp-clearfix', + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'post-body-content', + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'titlediv', + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'titlewrap', + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'name' => 'post_title', + 'value' => $post->initial() ? '' : $post->title(), + 'id' => 'title', + 'spellcheck' => 'true', + 'autocomplete' => 'off', + 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ), + 'placeholder' => __( 'Enter title here', 'contact-form-7' ), + 'aria-label' => __( 'Enter title here', 'contact-form-7' ), + ) ); + + $formatter->end_tag( 'div' ); // #titlewrap + + $formatter->append_start_tag( 'div', array( + 'class' => 'inside', + ) ); + + if ( ! $post->initial() ) { + $formatter->append_start_tag( 'div', array( + 'id' => 'wpcf7-shortcode-wrap', + 'class' => 'hide-shortcode', + ) ); + + $formatter->append_start_tag( 'button', array( + 'class' => 'toggle-shortcode alignright button-link', + 'type' => 'button', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Toggle shortcode', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'button' ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'wpcf7-shortcode-inside', + ) ); + + if ( $shortcode = $post->shortcode() ) { + $formatter->append_start_tag( 'p', array( + 'class' => 'description', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => 'wpcf7-shortcode', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Shortcodes are only needed in the Classic Editor environment; otherwise, use the Contact Form 7 block in the Block Editor.', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'label' ); + + $formatter->append_whitespace(); + + $formatter->append_start_tag( 'span', array( + 'class' => 'shortcode wp-ui-highlight', + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'id' => 'wpcf7-shortcode', + 'readonly' => true, + 'class' => 'large-text code selectable', + 'value' => $shortcode, + ) ); + + $formatter->end_tag( 'p' ); + } + + $formatter->end_tag( 'div' ); // #wpcf7-shortcode-inside + $formatter->end_tag( 'div' ); // #wpcf7-shortcode-wrap + } + + $formatter->end_tag( 'div' ); // .inside + $formatter->end_tag( 'div' ); // #titlediv + $formatter->end_tag( 'div' ); // #post-body-content + + $formatter->append_start_tag( 'div', array( + 'id' => 'postbox-container-1', + 'class' => 'postbox-container', + ) ); + + if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { + $formatter->append_start_tag( 'section', array( + 'id' => 'submitdiv', + 'class' => 'postbox', + ) ); + + $formatter->append_start_tag( 'h2' ); + + $formatter->append_preformatted( + esc_html( __( 'Status', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'h2' ); + + $formatter->append_start_tag( 'div', array( + 'class' => 'inside', + ) ); + + $formatter->append_start_tag( 'div', array( + 'class' => 'submitbox', + 'id' => 'submitpost', + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'minor-publishing-actions', + ) ); + + $formatter->append_start_tag( 'div', array( + 'class' => 'hidden', + ) ); + + $formatter->append_start_tag( 'button', array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => 'wpcf7-save', + 'value' => __( 'Save', 'contact-form-7' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Save', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'div' ); // .hidden + + if ( ! $post->initial() ) { + $formatter->append_start_tag( 'button', array( + 'type' => 'submit', + 'name' => 'wpcf7-copy', + 'class' => 'copy button-link', + 'value' => __( 'Duplicate', 'contact-form-7' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Duplicate', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'button' ); + } + + $formatter->end_tag( 'div' ); // #minor-publishing-actions + + $formatter->append_start_tag( 'div', array( + 'id' => 'misc-publishing-actions', + ) ); + + $formatter->call_user_func( static function () use ( $post_id ) { + do_action( 'wpcf7_admin_misc_pub_section', $post_id ); + } ); + + $formatter->end_tag( 'div' ); // #misc-publishing-actions + + $formatter->append_start_tag( 'div', array( + 'id' => 'major-publishing-actions', + ) ); + + if ( ! $post->initial() ) { + $formatter->append_start_tag( 'div', array( + 'id' => 'delete-action', + ) ); + + $formatter->append_start_tag( 'button', array( + 'type' => 'submit', + 'name' => 'wpcf7-delete', + 'class' => 'delete submitdelete', + 'value' => __( 'Delete', 'contact-form-7' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Delete', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'div' ); // #delete-action + } + + $formatter->append_start_tag( 'div', array( + 'id' => 'publishing-action', + ) ); + + $formatter->append_preformatted( '' ); + + $formatter->append_start_tag( 'button', array( + 'type' => 'submit', + 'class' => 'button-primary', + 'name' => 'wpcf7-save', + 'value' => __( 'Save', 'contact-form-7' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Save', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'div' ); // #publishing-action + + $formatter->append_preformatted( '
                ' ); + + $formatter->end_tag( 'div' ); // #major-publishing-actions + $formatter->end_tag( 'div' ); // #submitpost + $formatter->end_tag( 'div' ); // .inside + $formatter->end_tag( 'section' ); // #submitdiv + } + + $formatter->end_tag( 'div' ); // #postbox-container-1 + + $formatter->append_start_tag( 'div', array( + 'id' => 'postbox-container-2', + 'class' => 'postbox-container', + ) ); + + $formatter->append_start_tag( 'div', array( + 'id' => 'contact-form-editor', + ) ); + + $formatter->call_user_func( static function () use ( $post, $post_id ) { + $editor = new WPCF7_Editor( $post ); + $panels = array(); + + if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { + $panels = array( + 'form-panel' => array( + 'title' => __( 'Form', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_form', + ), + 'mail-panel' => array( + 'title' => __( 'Mail', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_mail', + ), + 'messages-panel' => array( + 'title' => __( 'Messages', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_messages', + ), + ); + + $additional_settings = $post->prop( 'additional_settings' ); + + if ( ! is_scalar( $additional_settings ) ) { + $additional_settings = ''; + } + + $additional_settings = trim( $additional_settings ); + $additional_settings = explode( "\n", $additional_settings ); + $additional_settings = array_filter( $additional_settings ); + $additional_settings = count( $additional_settings ); + + $panels['additional-settings-panel'] = array( + 'title' => $additional_settings + ? sprintf( + /* translators: %d: number of additional settings */ + __( 'Additional Settings (%d)', 'contact-form-7' ), + $additional_settings + ) + : __( 'Additional Settings', 'contact-form-7' ), + 'callback' => 'wpcf7_editor_panel_additional_settings', + ); + } + + $panels = apply_filters( 'wpcf7_editor_panels', $panels ); + + foreach ( $panels as $id => $panel ) { + $editor->add_panel( $id, $panel['title'], $panel['callback'] ); + } + + $editor->display(); + } ); + + $formatter->end_tag( 'div' ); // #contact-form-editor + $formatter->end_tag( 'div' ); // #postbox-container-2 + $formatter->end_tag( 'div' ); // #post-body + + $formatter->append_preformatted( '
                ' ); + + $formatter->end_tag( 'div' ); // #poststuff + $formatter->end_tag( 'form' ); +} + +$formatter->end_tag( 'div' ); // .wrap + +$formatter->print(); + +$tag_generator = WPCF7_TagGenerator::get_instance(); +$tag_generator->print_panels( $post ); + +do_action( 'wpcf7_admin_footer', $post ); diff --git a/wp-content/plugins/contact-form-7/admin/includes/admin-functions.php b/wp-content/plugins/contact-form-7/admin/includes/admin-functions.php new file mode 100644 index 0000000..0130550 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/admin-functions.php @@ -0,0 +1,24 @@ +add( $name, $title, $callback, $options ); +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/ajax-actions.php b/wp-content/plugins/contact-form-7/admin/includes/ajax-actions.php new file mode 100644 index 0000000..1d82746 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/ajax-actions.php @@ -0,0 +1,80 @@ +prop( 'sendinblue' ) : array(), + array( + 'enable_contact_list' => false, + 'contact_lists' => array(), + 'enable_transactional_email' => false, + 'email_template' => 0, + ) + ); + + wpcf7_sendinblue_editor_lists( $prop['contact_lists'] ); + + wp_die(); +} + + +add_action( + 'wp_ajax_wpcf7-sendinblue-email-template', + 'wpcf7_ajax_sendinblue_email_template', + 10, 0 +); + +/** + * Ajax action to update the email templates in the Brevo editor panel. + */ +function wpcf7_ajax_sendinblue_email_template() { + $contact_form = wpcf7_contact_form( wpcf7_superglobal_get( 'id' ) ); + + $prop = wp_parse_args( + $contact_form ? $contact_form->prop( 'sendinblue' ) : array(), + array( + 'enable_contact_list' => false, + 'contact_lists' => array(), + 'enable_transactional_email' => false, + 'email_template' => 0, + ) + ); + + wpcf7_sendinblue_editor_templates( $prop['email_template'] ); + + wp_die(); +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/config-validator.php b/wp-content/plugins/contact-form-7/admin/includes/config-validator.php new file mode 100644 index 0000000..f06d77e --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/config-validator.php @@ -0,0 +1,182 @@ + 'validate' ), + menu_page_url( 'wpcf7', false ) + ), + __( 'Validate Contact Form 7 Configuration', 'contact-form-7' ) + ) + ), + array( 'type' => 'warning' ) + ); +} + +add_action( 'wpcf7_admin_load', 'wpcf7_load_bulk_validate_page', 10, 2 ); + +function wpcf7_load_bulk_validate_page( $page, $action ) { + if ( + 'wpcf7' !== $page or + 'validate' !== $action or + ! wpcf7_validate_configuration() or + 'POST' !== wpcf7_superglobal_server( 'REQUEST_METHOD' ) + ) { + return; + } + + check_admin_referer( 'wpcf7-bulk-validate' ); + + if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { + wp_die( wp_kses_data( __( 'You are not allowed to validate configuration.', 'contact-form-7' ) ) ); + } + + $contact_forms = WPCF7_ContactForm::find(); + + $result = array( + 'timestamp' => time(), + 'version' => WPCF7_VERSION, + 'count_valid' => 0, + 'count_invalid' => 0, + ); + + foreach ( $contact_forms as $contact_form ) { + $config_validator = new WPCF7_ConfigValidator( $contact_form ); + $config_validator->validate(); + $config_validator->save(); + + if ( $config_validator->is_valid() ) { + $result['count_valid'] += 1; + } else { + $result['count_invalid'] += 1; + } + } + + WPCF7::update_option( 'bulk_validate', $result ); + + $redirect_to = add_query_arg( + array( + 'message' => 'validated', + ), + menu_page_url( 'wpcf7', false ) + ); + + wp_safe_redirect( $redirect_to ); + exit(); +} + +function wpcf7_admin_bulk_validate_page() { + $contact_forms = WPCF7_ContactForm::find(); + $count = WPCF7_ContactForm::count(); + + $submit_text = sprintf( + /* translators: %s: number of contact forms */ + _n( + 'Validate %s contact form now', + 'Validate %s contact forms now', + $count, 'contact-form-7' + ), + number_format_i18n( $count ) + ); + + $formatter = new WPCF7_HTMLFormatter( array( + 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( + 'form' => array( + 'action' => true, + 'method' => true, + ), + ) ), + ) ); + + $formatter->append_start_tag( 'div', array( + 'class' => 'wrap', + ) ); + + $formatter->append_start_tag( 'h1' ); + + $formatter->append_preformatted( + esc_html( __( 'Validate Configuration', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'h1' ); + + $formatter->append_start_tag( 'form', array( + 'method' => 'post', + 'action' => '', + ) ); + + $formatter->append_start_tag( 'p' ); + + $formatter->call_user_func( static function () { + wp_nonce_field( 'wpcf7-bulk-validate' ); + } ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'name' => 'action', + 'value' => 'validate', + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'submit', + 'class' => 'button', + 'value' => $submit_text, + ) ); + + $formatter->end_tag( 'form' ); + + $formatter->append_preformatted( + wpcf7_link( + 'https://contactform7.com/configuration-validator-faq/', + __( 'FAQ about Configuration Validator', 'contact-form-7' ) + ) + ); + + $formatter->print(); +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/css/styles-rtl.css b/wp-content/plugins/contact-form-7/admin/includes/css/styles-rtl.css new file mode 100644 index 0000000..9cd65f4 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/css/styles-rtl.css @@ -0,0 +1,62 @@ +/* + * Form Tab + */ +.tag-generator-panel { + text-align: right; +} + +.tag-generator-dialog > .close-button { + right: auto; + left: 8px; +} + +form.tag-generator-panel[data-version="1"] { + .control-box > fieldset > legend { + border: 1px solid #dfdfdf; + border-right: 4px solid #00a0d2; + } + + .insert-box input.tag { + float: right; + } + + .insert-box .submitbox input[type="button"] { + float: left; + } +} + +/* + * Mail Tab + */ +.contact-form-editor-box-mail span.mailtag { + margin: 0 4px 0 0; +} + +/* + * Integration + */ +.card { + border-left: 1px solid #e5e5e5; + border-right: 4px solid #e5e5e5; +} + +.card img.icon { + float: right; + margin: 8px -8px 8px 8px; +} + +.card h2.title { + float: right; +} + +.card .infobox { + float: left; +} + +/* + * Dashboard + */ +#wpcf7_dashboard_right_now li a::before, +#wpcf7_get_support li a::before { + padding: 0 0 0 5px; +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/css/styles.css b/wp-content/plugins/contact-form-7/admin/includes/css/styles.css new file mode 100644 index 0000000..7cb2759 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/css/styles.css @@ -0,0 +1,566 @@ +#wpcf7-contact-form-editor a .dashicons { + text-decoration: none; +} + +#wpcf7-shortcode-wrap { + margin-top: 1ex; +} + +#wpcf7-shortcode-wrap button.toggle-shortcode { + text-decoration: none; +} + +#wpcf7-shortcode-wrap button.toggle-shortcode::after { + font: 1.2rem dashicons; + content: "\f343" / ""; + padding-inline-start: 2px; + vertical-align: top; +} + +#wpcf7-shortcode-wrap.hide-shortcode button.toggle-shortcode::after { + content: "\f347" / ""; +} + +#wpcf7-shortcode-wrap.hide-shortcode #wpcf7-shortcode-inside { + display: none; +} + +#wpcf7-shortcode-wrap p.description { + margin: 8px 2px 0; +} + +#wpcf7-shortcode-wrap p.description label { + cursor: pointer; +} + +#wpcf7-shortcode-wrap span.shortcode { + display: block; + margin: 2px 0; +} + +#wpcf7-shortcode-wrap span.shortcode input { + font-size: 12px; + border: none; + box-shadow: none; + padding: 4px 8px; + margin: 0; + background: transparent; + color: #fff; + width: 100%; +} + +#submitpost button.copy { + margin-bottom: 10px; + text-decoration: none; +} + +#submitpost button.delete { + padding: 0; + margin: 0; + border: none; + cursor: pointer; + background: inherit; + color: #a00; +} + +#submitpost button.delete:hover { + color: #dc3232; /* Red */ +} + +#submitpost button.delete:focus { + outline: thin dotted; +} + +.postbox-container .postbox h3 { + border-bottom: 1px solid transparent; +} + +div.config-error, +span.config-error, +ul.config-error { + color: #444; + font-style: normal; + font-size: 13px; +} + +ul.config-error { + margin: 2px 0; +} + +ul.config-error li { + list-style: none; + padding: 2px 2px; + margin: 0; +} + +#misc-publishing-actions .config-error { + line-height: 2; +} + +[data-config-field][aria-invalid="true"] { + border-color: #dc3232; +} + +#contact-form-editor-tabs .icon-in-circle, +#contact-form-editor .config-error .icon-in-circle, +.wp-list-table .config-error .icon-in-circle, +.icon-in-circle { + display: inline-block; + vertical-align: baseline; + margin: 1px 6px 0; + padding: 0 5px; + min-width: 7px; + height: 17px; + border-radius: 11px; + background-color: #ca4a1f; + color: #fff; + font-size: 12px; + font-weight: bold; + line-height: 17px; + text-align: center; + z-index: 26; +} + +/* + * Tabs + */ +#contact-form-editor-tabs { + border-bottom: 1px solid #aaa; + padding: 9px 10px 0; + margin: 0; +} + +#contact-form-editor-tabs button { + display: inline-block; + border: 1px solid #ccc; + border-bottom: 1px solid #aaa; + padding: 6px 10px; + margin: 0 4px -1px; + color: #333; + background-color: #e4e4e4; + font-size: 14px; + font-weight: normal; + line-height: 20px; +} + +#contact-form-editor-tabs button[aria-selected="true"] { + border-top: 1px solid #aaa; + border-right: 1px solid #aaa; + border-left: 1px solid #aaa; + border-bottom: 1px solid #f5f5f5; + color: #000; + background-color: #f5f5f5; + font-weight: bold; +} + +#contact-form-editor-tabs button:hover { + color: #000; +} + +#contact-form-editor .contact-form-editor-panel > div.config-error { + margin-bottom: 1.4em; +} + +#contact-form-editor-tabs button[aria-selected="true"] .icon-in-circle { + display: none; +} + +#contact-form-editor .contact-form-editor-panel h2 { + font-size: 18px; + font-weight: 400; + line-height: 24px; + margin: 8px 0; + padding: 0; +} + +#contact-form-editor .contact-form-editor-panel { + background-color: #f5f5f5; + border: 1px solid #aaa; + border-top: none; + padding: 16px; +} + +#contact-form-editor .form-table th { + width: 100px; +} + +#contact-form-editor .contact-form-editor-panel fieldset legend { + line-height: 1.5; + margin: 0.6em 0 0.4em; +} + +/* + * Form Tab + */ +#tag-generator-list button { + font-size: 12px; + height: 26px; + line-height: 24px; + margin: 2px; + padding: 0 8px 1px; +} + +.tag-generator-dialog { + padding: 12px; + border: 1px solid #c3c4c7; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); + height: 720px; + width: 720px; + overflow: auto; +} + +.tag-generator-dialog::backdrop { + background: rgb(0 0 0 / 50%); +} + +.tag-generator-dialog > .close-button { + position: absolute; + top: 8px; + right: 8px; +} + +form.tag-generator-panel { + display: flex; + flex-direction: column; + height: 720px; + width: 720px; + max-height: 100%; + max-width: 100%; + margin-block-end: 0; +} + +form.tag-generator-panel[data-version="2"] { + &:invalid .mail-tag-tip { + display: none; + } + + .description-box { + box-sizing: border-box; + flex: none; + margin-inline: -12px; + padding-inline: 12px; + border-bottom: 1px solid #dfdfdf; + } + + .control-box { + box-sizing: border-box; + flex: auto; + display: flex; + flex-direction: column; + gap: 12px 0; + min-height: 120px; + overflow: auto; + } + + .control-box > fieldset { + margin-block: 8px; + margin-inline-start: 10em; + line-height: 2.25; + } + + .control-box > fieldset > legend { + font-weight: bolder; + margin-block: 8px; + margin-inline-start: -10em; + line-height: 1.25; + } + + .control-box input[type="text"] { + width: 20rem; + max-width: 88%; + } + + .control-box input[type="number"] { + width: 8rem; + max-width: 44%; + } + + .control-box textarea { + height: 12ex; + width: 20rem; + max-width: 88%; + } + + .control-box select { + width: 20rem; + max-width: 88%; + } + + .control-box input:invalid, + .control-box textarea:invalid { + background-color: #ffe9de; + } + + .insert-box { + box-sizing: border-box; + flex: none; + margin-block-end: -12px; + margin-inline: -12px; + padding-block: 24px 12px; + padding-inline: 12px; + background-color: #fcfcfc; + border-top: 1px solid #dfdfdf; + } + + .insert-box .flex-container { + display: flex; + } + + .insert-box .flex-container > [data-tag-part="tag"] { + flex: auto; + margin-inline-end: 8px; + } + + .insert-box .mail-tag-tip::before { + font: 1.2rem dashicons; + content: "\f348" / ""; + color: #646970; + padding-inline-end: 4px; + vertical-align: top; + } +} + +form.tag-generator-panel[data-version="1"] { + .control-box { + padding: 0; + margin: 0; + overflow: auto; + flex-grow: 1; + } + + .control-box > fieldset > legend { + border: 1px solid #dfdfdf; + border-left: 4px solid #00a0d2; + background: #f7fcfe; + padding: 4px 12px; + margin: 4px 0; + line-height: 1.4em; + width: 100%; + box-sizing: border-box; + } + + table { + width: 100%; + } + + table.form-table th { + width: 120px; + padding: 4px 10px 4px 0; + font-size: 13px; + } + + table.form-table td { + padding: 4px 10px; + font-size: 13px; + } + + .control-box input.oneline { + width: 200px; + } + + .control-box input.large-text { + width: 400px; + } + + .control-box textarea.values { + width: 200px; + height: 6em; + } + + .control-box input[type="number"], + .control-box input[type="date"] { + width: 88px; + } + + .control-box table caption { + text-align: left; + font-size: 110%; + font-weight: bold; + color: #777; + margin: 10px 0 5px; + } + + .control-box table.form-table td label { + line-height: 1.1em; + } + + .control-box table.form-table td label .description { + line-height: 1.4em; + } + + .insert-box { + margin: 0 -15px -15px; + padding: 8px 16px; + background-color: #fcfcfc; + border-top: 1px solid #dfdfdf; + overflow: auto; + } + + .insert-box input.tag { + width: 510px; + float: left; + background-color: transparent; + box-shadow: none; + } + + .insert-box .submitbox { + padding: 0; + } + + .insert-box .submitbox input[type="button"] { + float: right; + } + + .insert-box .description label { + cursor: text; + } +} + +/* + * Mail Tab + */ +.contact-form-editor-box-mail span.mailtag { + display: inline-block; + margin: 0 0 0 4px; + padding: 1px 2px; + cursor: pointer; + color: #000; +} + +.contact-form-editor-box-mail span.mailtag.used { + color: #666; +} + +.contact-form-editor-box-mail span.mailtag.unused { + font-weight: bold; +} + +/* + * Messages Tab + */ +#messages-panel p.description { + margin: 5px 0 10px; +} + +/* + * Tabs for integration modules + */ +#sendinblue-panel table tr.inactive ~ tr { + display: none; +} + +#sendinblue-panel .dashicons { + text-decoration: none; +} + +#sendinblue-panel td p { + margin-top: 12px; +} + +/* + * List Table + */ +#wpcf7-contact-form-list-table .column-title .tag { + display: inline-block; + margin: 4px 6px 4px 0; + padding: 4px 6px; + background-color: #eff2ff; + color: #1e1e1e; + border: none; +} + +#wpcf7-contact-form-list-table .column-title .tag.warning { + background-color: #fff2ef; +} + +/* + * Integration + */ +.card { + background: #fff none repeat scroll 0 0; + border: 1px solid #e5e5e5; + border-left: 4px solid #e5e5e5; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); + margin-top: 20px; + max-width: 520px; + min-width: 255px; + padding: 0.7em 2em 1em; + position: relative; +} + +.card.active { + border-color: #00a0d2; +} + +#constant_contact.card.active { + border-color: #dc3232; +} + +.card img.icon { + float: left; + margin: 8px 8px 8px -8px; +} + +.card h2.title { + float: left; + max-width: 240px; + font-size: 1.3em; + font-weight: 600; +} + +.card .infobox { + float: right; + font-size: 13px; + color: #666; + margin: 1em; + line-height: 1.5; + max-width: 240px; +} + +.card .inside .form-table th { + padding: 15px 10px 15px 0; + width: 160px; +} + +.card .inside .form-table td { + padding: 10px 10px; +} + +.card .checkboxes li { + margin: 0; +} + +/* + * Dashboard + */ +#wpcf7_dashboard_right_now li a::before, +#wpcf7_get_support li a::before { + content: "\f109" / ""; + padding: 0 5px 0 0; + color: #646970; + font: normal 20px/1 dashicons; + display: inline-block; + position: relative; + text-decoration: none !important; + vertical-align: top; +} + +#wpcf7_dashboard_right_now li.page-count a::before { + content: "\f105" / ""; +} + +#wpcf7_dashboard_right_now li.active-integration a::before { + content: "\f137" / ""; +} + +#wpcf7_dashboard_right_now li.flamingo a::before { + content: "\f17d" / ""; +} + +#wpcf7_get_support li.public a::before { + content: "\f307" / ""; +} + +#wpcf7_get_support li.private a::before { + content: "\f468" / ""; +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/dashboard.php b/wp-content/plugins/contact-form-7/admin/includes/dashboard.php new file mode 100644 index 0000000..7032d9f --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/dashboard.php @@ -0,0 +1,314 @@ + array( + 'widget_name' => __( 'At a Glance', 'contact-form-7' ), + ), + 'wpcf7_dashboard_news' => array( + 'widget_name' => __( 'News', 'contact-form-7' ), + ), + 'wpcf7_get_support' => array( + 'widget_name' => __( 'Get Support', 'contact-form-7' ), + 'context' => 'side', + ), + 'wpcf7_spam_protection' => array( + 'widget_name' => __( 'Spam Protection', 'contact-form-7' ), + 'context' => 'side', + ), + 'wpcf7_save_messages' => array( + 'widget_name' => __( 'Save Messages', 'contact-form-7' ), + 'context' => 'side', + ), + ); +} + + +/** + * Adds dashboard widgets to the Contact Form 7 Dashboard screen. + */ +function wpcf7_dashboard_setup() { + foreach ( wpcf7_dashboard_widgets() as $widget_id => $widget ) { + wp_add_dashboard_widget( + $widget_id, + $widget['widget_name'] ?? '', + $widget['callback'] ?? $widget_id, + $widget['control_callback'] ?? null, + $widget['callback_args'] ?? null, + $widget['context'] ?? 'normal', + $widget['priority'] ?? 'core' + ); + } + + do_action( 'wpcf7_dashboard_setup' ); +} + + +/** + * Defines the "At a Glance" dashboard widget content. + */ +function wpcf7_dashboard_right_now() { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'ul' ); + + $formatter->append_start_tag( 'li', array( + 'class' => 'page-count', + ) ); + + $formatter->append_start_tag( 'a', array( + 'href' => menu_page_url( 'wpcf7', false ), + ) ); + + WPCF7_ContactForm::find(); + $count = WPCF7_ContactForm::count(); + + $formatter->append_preformatted( + esc_html( sprintf( + /* translators: %s: number of contact forms */ + _n( + '%s Contact form', + '%s Contact forms', + $count, + 'contact-form-7' + ), + number_format_i18n( $count ) + ) ) + ); + + if ( current_user_can( 'wpcf7_manage_integration' ) ) { + $integration = WPCF7_Integration::get_instance(); + + $services = array( 'sendinblue', 'turnstile', 'recaptcha', 'stripe' ); + + foreach ( $services as $service_name ) { + if ( $integration->service_exists( $service_name ) ) { + $service = $integration->get_service( $service_name ); + + if ( $service->is_active() ) { + $formatter->append_start_tag( 'li', array( + 'class' => sprintf( + 'active-integration %s', + $service_name + ), + ) ); + + $setup_page_link = add_query_arg( + array( + 'service' => $service_name, + 'action' => 'setup', + ), + menu_page_url( 'wpcf7-integration', false ) + ); + + $formatter->append_start_tag( 'a', array( + 'href' => $setup_page_link, + ) ); + + $formatter->append_preformatted( + sprintf( + /* translators: %s: service name */ + __( '%s integration is active', 'contact-form-7' ), + $service->get_title() + ) + ); + } + } + } + } + + if ( defined( 'FLAMINGO_VERSION' ) ) { + $formatter->append_start_tag( 'li', array( + 'class' => 'flamingo', + ) ); + + $formatter->append_start_tag( 'a', array( + 'href' => menu_page_url( 'flamingo_inbound', false ), + ) ); + + $formatter->append_preformatted( + sprintf( + /* translators: %s: Flamingo version */ + __( 'Flamingo (version %s) is active', 'contact-form-7' ), + FLAMINGO_VERSION + ) + ); + } + + $formatter->end_tag( 'ul' ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + esc_html( sprintf( + /* translators: %s: Contact Form 7 version string */ + __( 'Contact Form 7 version %s is running.', 'contact-form-7' ), + WPCF7_VERSION + ) ) + ); + + $formatter->print(); +} + + +/** + * Defines the "News" dashboard widget content. + */ +function wpcf7_dashboard_news() { + echo '
                '; + + wpcf7_dashboard_cf7com_news(); + + echo '
                '; +} + + +/** + * Retrieves the news feed from the contactform7.com site. + */ +function wpcf7_dashboard_cf7com_news() { + wp_dashboard_cached_rss_widget( + 'wpcf7_dashboard_cf7com_news', + 'wp_dashboard_primary_output', + array( + 'news' => array( + 'link' => 'https://contactform7.com/', + 'url' => 'https://contactform7.com/feed/', + 'title' => __( 'Contact Form 7 official site', 'contact-form-7' ), + 'items' => 6, + 'show_summary' => 0, + 'show_author' => 0, + 'show_date' => 1, + ), + ) + ); +} + + +/** + * Defines the "Get Support" dashboard widget content. + */ +function wpcf7_get_support() { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + __( 'Do you need help? These support channels are available:', 'contact-form-7' ) + ); + + $formatter->append_start_tag( 'ul' ); + + $formatter->append_start_tag( 'li', array( + 'class' => 'public', + ) ); + + $formatter->append_start_tag( 'a', array( + 'href' => 'https://wordpress.org/support/plugin/contact-form-7/', + ) ); + + $formatter->append_preformatted( + __( 'Public support forum on WordPress.org', 'contact-form-7' ) + ); + + $formatter->append_start_tag( 'li', array( + 'class' => 'private', + ) ); + + $formatter->append_start_tag( 'a', array( + 'href' => 'https://contactform7.com/custom-development/', + ) ); + + $formatter->append_preformatted( + __( 'Private support by Codeable experts', 'contact-form-7' ) + ); + + $formatter->end_tag( 'ul' ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + sprintf( + /* translators: 1: URL to the docs page, 2: URL to the FAQ page */ + __( 'Or, consult the docs and FAQ.', 'contact-form-7' ), + 'https://contactform7.com/docs/', + 'https://contactform7.com/faq/' + ) + ); + + $formatter->print(); +} + + +/** + * Defines the "Spam Protection" dashboard widget content. + */ +function wpcf7_spam_protection() { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + __( 'Spammers target everything. Your contact forms are not an exception.', 'contact-form-7' ) + ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + sprintf( + /* translators: 1: URL to the Turnstile doc page, 2: URL to the Akismet doc page */ + __( 'To provide effective protection, Contact Form 7 recommends using Turnstile (good at blocking bots) and Akismet (good at blocking human spammers) together.', 'contact-form-7' ), + 'https://contactform7.com/turnstile-integration/', + 'https://contactform7.com/spam-filtering-with-akismet/' + ) + ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + sprintf( + /* translators: %s: URL to the Disallowed list doc page */ + __( 'You can also block submissions that contain specific keywords or come from specific IP addresses (Disallowed list).', 'contact-form-7' ), + 'https://contactform7.com/comment-blacklist/' + ) + ); + + $formatter->print(); +} + + +/** + * Defines the "Save Messages" dashboard widget content. + */ +function wpcf7_save_messages() { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + sprintf( + /* translators: %s: URL to the Flamingo doc page */ + __( 'Contact Form 7 itself doesn’t have a feature to store submitted messages; therefore, there is always a risk of losing important messages. Contact Form 7 recommends installing a separate plugin called Flamingo, which is dedicated to storing messages in the database.', 'contact-form-7' ), + 'https://contactform7.com/save-submitted-messages-with-flamingo/' + ) + ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_preformatted( + sprintf( + /* translators: %s: URL to the Brevo integration doc page */ + __( 'If you use contact forms for customer relationship management, consider activating the Brevo integration. With the integration, Contact Form 7 can safely connect to the leading CRM platform in Europe, while protecting user privacy.', 'contact-form-7' ), + 'https://contactform7.com/sendinblue-integration/' + ) + ); + + $formatter->print(); +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/editor.php b/wp-content/plugins/contact-form-7/admin/includes/editor.php new file mode 100644 index 0000000..3f174db --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/editor.php @@ -0,0 +1,559 @@ +contact_form = $contact_form; + } + + public function add_panel( $panel_id, $title, $callback ) { + if ( wpcf7_is_name( $panel_id ) ) { + $this->panels[$panel_id] = array( + 'title' => $title, + 'callback' => $callback, + ); + } + } + + public function display() { + if ( empty( $this->panels ) ) { + return; + } + + $active_panel_id = wpcf7_superglobal_get( 'active-tab' ); + + if ( ! array_key_exists( $active_panel_id, $this->panels ) ) { + $active_panel_id = array_key_first( $this->panels ); + } + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'nav', array( + 'id' => 'contact-form-editor-tabs', + 'role' => 'tablist', + 'aria-label' => __( 'Contact form editor tabs', 'contact-form-7' ), + 'data-active-tab' => absint( array_search( + $active_panel_id, array_keys( $this->panels ), true + ) ), + ) ); + + foreach ( $this->panels as $panel_id => $panel ) { + $active = $panel_id === $active_panel_id; + + $formatter->append_start_tag( 'button', array( + 'type' => 'button', + 'role' => 'tab', + 'aria-selected' => $active ? 'true' : 'false', + 'aria-controls' => $panel_id, + 'id' => sprintf( '%s-tab', $panel_id ), + 'tabindex' => $active ? '0' : '-1', + 'data-panel' => $panel_id, + ) ); + + $formatter->append_preformatted( esc_html( $panel['title'] ) ); + } + + $formatter->end_tag( 'nav' ); + + foreach ( $this->panels as $panel_id => $panel ) { + $active = $panel_id === $active_panel_id; + + $formatter->append_start_tag( 'section', array( + 'role' => 'tabpanel', + 'aria-labelledby' => sprintf( '%s-tab', $panel_id ), + 'id' => $panel_id, + 'class' => 'contact-form-editor-panel', + 'tabindex' => '0', + 'hidden' => ! $active, + ) ); + + if ( is_callable( $panel['callback'] ) ) { + $formatter->call_user_func( $panel['callback'], $this->contact_form ); + } + + $formatter->end_tag( 'section' ); + } + + $formatter->print(); + } +} + +function wpcf7_editor_panel_form( $post ) { + $description = sprintf( + /* translators: %s: URL to support page about the form template */ + __( 'You can edit the form template here. For details, see Editing form template.', 'contact-form-7' ), + 'https://contactform7.com/editing-form-template/' + ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'h2' ); + $formatter->append_preformatted( esc_html( __( 'Form', 'contact-form-7' ) ) ); + $formatter->end_tag( 'h2' ); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend' ); + $formatter->append_preformatted( $description ); + $formatter->end_tag( 'legend' ); + + $formatter->call_user_func( static function () { + $tag_generator = WPCF7_TagGenerator::get_instance(); + $tag_generator->print_buttons(); + } ); + + $formatter->append_start_tag( 'textarea', array( + 'id' => 'wpcf7-form', + 'name' => 'wpcf7-form', + 'cols' => 100, + 'rows' => 24, + 'class' => 'large-text code', + 'data-config-field' => 'form.body', + ) ); + + $formatter->append_preformatted( esc_textarea( $post->prop( 'form' ) ) ); + + $formatter->end_tag( 'textarea' ); + + $formatter->print(); +} + +function wpcf7_editor_panel_mail( $post ) { + wpcf7_editor_box_mail( $post ); + + echo '
                '; + + wpcf7_editor_box_mail( $post, array( + 'id' => 'wpcf7-mail-2', + 'name' => 'mail_2', + 'title' => __( 'Mail (2)', 'contact-form-7' ), + 'use' => __( 'Use Mail (2)', 'contact-form-7' ), + ) ); +} + +function wpcf7_editor_box_mail( $post, $options = '' ) { + $options = wp_parse_args( $options, array( + 'id' => 'wpcf7-mail', + 'name' => 'mail', + 'title' => __( 'Mail', 'contact-form-7' ), + 'use' => null, + ) ); + + $id = esc_attr( $options['id'] ); + + $mail = wp_parse_args( $post->prop( $options['name'] ), array( + 'active' => false, + 'recipient' => '', + 'sender' => '', + 'subject' => '', + 'body' => '', + 'additional_headers' => '', + 'attachments' => '', + 'use_html' => false, + 'exclude_blank' => false, + ) ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'div', array( + 'class' => 'contact-form-editor-box-mail', + 'id' => $id, + ) ); + + $formatter->append_start_tag( 'h2' ); + $formatter->append_preformatted( esc_html( $options['title'] ) ); + $formatter->end_tag( 'h2' ); + + if ( ! empty( $options['use'] ) ) { + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-active', $id ), + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'id' => sprintf( '%s-active', $id ), + 'name' => sprintf( '%s[active]', $id ), + 'data-config-field' => '', + 'data-toggle' => sprintf( '%s-fieldset', $id ), + 'value' => '1', + 'checked' => $mail['active'], + ) ); + + $formatter->append_whitespace(); + $formatter->append_preformatted( esc_html( $options['use'] ) ); + $formatter->end_tag( 'label' ); + + $formatter->append_start_tag( 'p', array( + 'class' => 'description', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Mail (2) is an additional mail template often used as an autoresponder.', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'p' ); + } + + $formatter->append_start_tag( 'fieldset', array( + 'id' => sprintf( '%s-fieldset', $id ), + ) ); + + $formatter->append_start_tag( 'legend' ); + + $description = sprintf( + /* translators: %s: URL to support page about the email template */ + __( 'You can edit the email template here. For details, see Setting up mail.', 'contact-form-7' ), + 'https://contactform7.com/setting-up-mail/' + ); + + $formatter->append_preformatted( $description ); + + $formatter->append_start_tag( 'br' ); + + $formatter->append_preformatted( + esc_html( __( 'In the following fields, you can use these mail-tags:', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'br' ); + + $formatter->call_user_func( static function () use ( $post, $options ) { + $post->suggest_mail_tags( $options['name'] ); + } ); + + $formatter->end_tag( 'legend' ); + + $formatter->append_start_tag( 'table', array( + 'class' => 'form-table', + ) ); + + $formatter->append_start_tag( 'tbody' ); + + $formatter->append_start_tag( 'tr' ); + + $formatter->append_start_tag( 'th', array( + 'scope' => 'row', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-recipient', $id ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'To', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'td' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'id' => sprintf( '%s-recipient', $id ), + 'name' => sprintf( '%s[recipient]', $id ), + 'class' => 'large-text code', + 'size' => 70, + 'value' => $mail['recipient'], + 'data-config-field' => sprintf( '%s.recipient', $options['name'] ), + ) ); + + $formatter->end_tag( 'tr' ); + + $formatter->append_start_tag( 'tr' ); + + $formatter->append_start_tag( 'th', array( + 'scope' => 'row', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-sender', $id ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'From', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'td' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'id' => sprintf( '%s-sender', $id ), + 'name' => sprintf( '%s[sender]', $id ), + 'class' => 'large-text code', + 'size' => 70, + 'value' => $mail['sender'], + 'data-config-field' => sprintf( '%s.sender', $options['name'] ), + ) ); + + $formatter->end_tag( 'tr' ); + + $formatter->append_start_tag( 'tr' ); + + $formatter->append_start_tag( 'th', array( + 'scope' => 'row', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-subject', $id ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Subject', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'td' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'id' => sprintf( '%s-subject', $id ), + 'name' => sprintf( '%s[subject]', $id ), + 'class' => 'large-text code', + 'size' => 70, + 'value' => $mail['subject'], + 'data-config-field' => sprintf( '%s.subject', $options['name'] ), + ) ); + + $formatter->end_tag( 'tr' ); + + $formatter->append_start_tag( 'tr' ); + + $formatter->append_start_tag( 'th', array( + 'scope' => 'row', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-additional-headers', $id ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Additional headers', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'td' ); + + $formatter->append_start_tag( 'textarea', array( + 'id' => sprintf( '%s-additional-headers', $id ), + 'name' => sprintf( '%s[additional_headers]', $id ), + 'cols' => 100, + 'rows' => 4, + 'class' => 'large-text code', + 'data-config-field' => sprintf( '%s.additional_headers', $options['name'] ), + ) ); + + $formatter->append_preformatted( + esc_textarea( $mail['additional_headers'] ) + ); + + $formatter->end_tag( 'tr' ); + + $formatter->append_start_tag( 'tr' ); + + $formatter->append_start_tag( 'th', array( + 'scope' => 'row', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-body', $id ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Message body', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'td' ); + + $formatter->append_start_tag( 'textarea', array( + 'id' => sprintf( '%s-body', $id ), + 'name' => sprintf( '%s[body]', $id ), + 'cols' => 100, + 'rows' => 18, + 'class' => 'large-text code', + 'data-config-field' => sprintf( '%s.body', $options['name'] ), + ) ); + + $formatter->append_preformatted( + esc_textarea( $mail['body'] ) + ); + + $formatter->end_tag( 'textarea' ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-exclude-blank', $id ), + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'id' => sprintf( '%s-exclude-blank', $id ), + 'name' => sprintf( '%s[exclude_blank]', $id ), + 'value' => '1', + 'checked' => $mail['exclude_blank'], + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'Exclude a line from output if all of its mail-tags are blank', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'p' ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-use-html', $id ), + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'id' => sprintf( '%s-use-html', $id ), + 'name' => sprintf( '%s[use_html]', $id ), + 'value' => '1', + 'checked' => $mail['use_html'], + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'Use HTML content type', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'tr' ); + + $formatter->append_start_tag( 'tr' ); + + $formatter->append_start_tag( 'th', array( + 'scope' => 'row', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( '%s-attachments', $id ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'File attachments', 'contact-form-7' ) ) + ); + + $formatter->append_start_tag( 'td' ); + + $formatter->append_start_tag( 'textarea', array( + 'id' => sprintf( '%s-attachments', $id ), + 'name' => sprintf( '%s[attachments]', $id ), + 'cols' => 100, + 'rows' => 4, + 'class' => 'large-text code', + 'data-config-field' => sprintf( '%s.attachments', $options['name'] ), + ) ); + + $formatter->append_preformatted( + esc_textarea( $mail['attachments'] ) + ); + + $formatter->end_tag( 'textarea' ); + $formatter->end_tag( 'tr' ); + + $formatter->print(); +} + +function wpcf7_editor_panel_messages( $post ) { + $description = sprintf( + /* translators: %s: URL to support page about the messages editor */ + __( 'You can edit messages used in various situations here. For details, see Editing messages.', 'contact-form-7' ), + 'https://contactform7.com/editing-messages/' + ); + + $messages = wpcf7_messages(); + + if ( + isset( $messages['captcha_not_match'] ) and + ! wpcf7_use_really_simple_captcha() + ) { + unset( $messages['captcha_not_match'] ); + } + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'h2' ); + + $formatter->append_preformatted( + esc_html( __( 'Messages', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'h2' ); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend' ); + $formatter->append_preformatted( $description ); + $formatter->end_tag( 'legend' ); + + foreach ( $messages as $key => $arr ) { + $field_id = sprintf( 'wpcf7-message-%s', strtr( $key, '_', '-' ) ); + $field_name = sprintf( 'wpcf7-messages[%s]', $key ); + + $formatter->append_start_tag( 'p', array( + 'class' => 'description', + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => $field_id, + ) ); + + $formatter->append_preformatted( esc_html( $arr['description'] ) ); + $formatter->append_start_tag( 'br' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'id' => $field_id, + 'name' => $field_name, + 'class' => 'large-text', + 'size' => 70, + 'value' => $post->message( $key, false ), + 'data-config-field' => sprintf( 'messages.%s', $key ), + ) ); + } + + $formatter->print(); +} + +function wpcf7_editor_panel_additional_settings( $post ) { + $description = sprintf( + /* translators: %s: URL to support page about the additional settings editor */ + __( 'You can add customization code snippets here. For details, see Additional settings.', 'contact-form-7' ), + 'https://contactform7.com/additional-settings/' + ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'h2' ); + + $formatter->append_preformatted( + esc_html( __( 'Additional Settings', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'h2' ); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend' ); + $formatter->append_preformatted( $description ); + $formatter->end_tag( 'legend' ); + + $formatter->append_start_tag( 'textarea', array( + 'id' => 'wpcf7-additional-settings', + 'name' => 'wpcf7-additional-settings', + 'cols' => 100, + 'rows' => 24, + 'class' => 'large-text', + 'data-config-field' => 'additional_settings.body', + ) ); + + $formatter->append_preformatted( + esc_textarea( $post->prop( 'additional_settings' ) ) + ); + + $formatter->end_tag( 'textarea' ); + + $formatter->print(); +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/help-tabs.php b/wp-content/plugins/contact-form-7/admin/includes/help-tabs.php new file mode 100644 index 0000000..ae74906 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/help-tabs.php @@ -0,0 +1,106 @@ +screen = $screen; + } + + public function set_help_tabs( $screen_type ) { + switch ( $screen_type ) { + case 'list': + $this->screen->add_help_tab( array( + 'id' => 'list_overview', + 'title' => __( 'Overview', 'contact-form-7' ), + 'content' => $this->content( 'list_overview' ), + ) ); + + $this->screen->add_help_tab( array( + 'id' => 'list_available_actions', + 'title' => __( 'Available Actions', 'contact-form-7' ), + 'content' => $this->content( 'list_available_actions' ), + ) ); + + $this->sidebar(); + + return; + case 'edit': + $this->screen->add_help_tab( array( + 'id' => 'edit_overview', + 'title' => __( 'Overview', 'contact-form-7' ), + 'content' => $this->content( 'edit_overview' ), + ) ); + + $this->screen->add_help_tab( array( + 'id' => 'edit_form_tags', + 'title' => __( 'Form-tags', 'contact-form-7' ), + 'content' => $this->content( 'edit_form_tags' ), + ) ); + + $this->screen->add_help_tab( array( + 'id' => 'edit_mail_tags', + 'title' => __( 'Mail-tags', 'contact-form-7' ), + 'content' => $this->content( 'edit_mail_tags' ), + ) ); + + $this->sidebar(); + + return; + case 'integration': + $this->screen->add_help_tab( array( + 'id' => 'integration_overview', + 'title' => __( 'Overview', 'contact-form-7' ), + 'content' => $this->content( 'integration_overview' ), + ) ); + + $this->sidebar(); + + return; + } + } + + private function content( $name ) { + $content = array(); + + $content['list_overview'] = '

                ' . __( 'On this screen, you can manage contact forms your team has created with Contact Form 7. You can embed contact forms in post content or a block theme template by inserting a Contact Form 7 block. For use in the classic editor environment, traditional shortcodes are also provided.', 'contact-form-7' ) . '

                '; + + $content['list_available_actions'] = '

                ' . __( 'Hovering over a row in the contact forms list will display action links that allow you to manage your contact form. You can perform the following actions:', 'contact-form-7' ) . '

                '; + $content['list_available_actions'] .= '

                ' . __( 'Edit - Navigates to the editing screen for that contact form. You can also reach that screen by clicking on the contact form title.', 'contact-form-7' ) . '

                '; + $content['list_available_actions'] .= '

                ' . __( 'Duplicate - Clones that contact form. A cloned contact form inherits all content from the original, but has a different ID.', 'contact-form-7' ) . '

                '; + + $content['edit_overview'] = '

                ' . __( 'On this screen, you can edit a contact form. A contact form is comprised of the following components:', 'contact-form-7' ) . '

                '; + $content['edit_overview'] .= '

                ' . __( 'Title is the title of a contact form. This title is only used for labeling a contact form, and can be edited.', 'contact-form-7' ) . '

                '; + $content['edit_overview'] .= '

                ' . __( 'Form is a content of HTML form. You can use arbitrary HTML, which is allowed inside a form element. You can also use Contact Form 7’s form-tags here.', 'contact-form-7' ) . '

                '; + $content['edit_overview'] .= '

                ' . __( 'Mail manages a mail template (headers and message body) that this contact form will send when users submit it. You can use Contact Form 7’s mail-tags here.', 'contact-form-7' ) . '

                '; + $content['edit_overview'] .= '

                ' . __( 'Mail (2) is an additional mail template that works similar to Mail. Mail (2) is different in that it is sent only when Mail has been sent successfully.', 'contact-form-7' ) . '

                '; + $content['edit_overview'] .= '

                ' . __( 'In Messages, you can edit various types of messages used for this contact form. These messages are relatively short messages, like a validation error message you see when you leave a required field blank.', 'contact-form-7' ) . '

                '; + $content['edit_overview'] .= '

                ' . __( 'Additional Settings provides a place where you can customize the behavior of this contact form by adding code snippets.', 'contact-form-7' ) . '

                '; + + $content['edit_form_tags'] = '

                ' . __( 'A form-tag is a short code enclosed in square brackets used in a form content. A form-tag generally represents an input field, and its components can be separated into four parts: type, name, options, and values. Contact Form 7 supports several types of form-tags including text fields, number fields, date fields, checkboxes, radio buttons, menus, file-uploading fields, CAPTCHAs, and quiz fields.', 'contact-form-7' ) . '

                '; + $content['edit_form_tags'] .= '

                ' . __( 'While form-tags have a comparatively complex syntax, you do not need to know the syntax to add form-tags because you can use the straightforward tag generator (Generate Tag button on this screen).', 'contact-form-7' ) . '

                '; + + $content['edit_mail_tags'] = '

                ' . __( 'A mail-tag is also a short code enclosed in square brackets that you can use in every Mail and Mail (2) field. A mail-tag represents a user input value through an input field of a corresponding form-tag.', 'contact-form-7' ) . '

                '; + $content['edit_mail_tags'] .= '

                ' . __( 'There are also special mail-tags that have specific names, but do not have corresponding form-tags. They are used to represent meta information of form submissions like the submitter’s IP address or the URL of the page.', 'contact-form-7' ) . '

                '; + + $content['integration_overview'] = '

                ' . __( 'On this screen, you can manage services that are available through Contact Form 7. Using API will allow you to collaborate with any services that are available.', 'contact-form-7' ) . '

                '; + $content['integration_overview'] .= '

                ' . __( 'You may need to first sign up for an account with the service that you plan to use. When you do so, you would need to authorize Contact Form 7 to access the service with your account.', 'contact-form-7' ) . '

                '; + $content['integration_overview'] .= '

                ' . __( 'Any information you provide will not be shared with service providers without your authorization.', 'contact-form-7' ) . '

                '; + + if ( ! empty( $content[$name] ) ) { + return $content[$name]; + } + } + + public function sidebar() { + $content = '

                ' . __( 'For more information:', 'contact-form-7' ) . '

                '; + $content .= '

                ' . wpcf7_link( 'https://contactform7.com/docs/', __( 'Docs', 'contact-form-7' ) ) . '

                '; + $content .= '

                ' . wpcf7_link( 'https://contactform7.com/faq/', __( 'FAQ', 'contact-form-7' ) ) . '

                '; + $content .= '

                ' . wpcf7_link( 'https://contactform7.com/support/', __( 'Support', 'contact-form-7' ) ) . '

                '; + + $this->screen->set_help_sidebar( $content ); + } +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/js/index.asset.php b/wp-content/plugins/contact-form-7/admin/includes/js/index.asset.php new file mode 100644 index 0000000..2ee666d --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/js/index.asset.php @@ -0,0 +1,10 @@ + array( + 'wp-api-fetch', + 'wp-i18n', + 'wp-url', + ), + 'version' => WPCF7_VERSION, +); diff --git a/wp-content/plugins/contact-form-7/admin/includes/js/index.js b/wp-content/plugins/contact-form-7/admin/includes/js/index.js new file mode 100644 index 0000000..4db3b71 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/js/index.js @@ -0,0 +1 @@ +(()=>{"use strict";const e=window.wp.i18n,t=document.querySelector("#contact-form-editor"),a=window.wp.apiFetch,r=e=>{const t=document.createElement("span");return t.classList.add("icon-in-circle"),t.setAttribute("aria-hidden","true"),t.append(e),t},c=e=>e.replace(/[^0-9a-z]+/gi,"-"),n=e=>{const t=document.querySelector(`#${e.dataset?.toggle}`);t&&(e.checked?t.classList.remove("hidden"):t.classList.add("hidden"))},o=["https://contactform7.com/","https://my.sendinblue.com/"],l=()=>{document.querySelectorAll("#wpcf7-contact-form-editor a[href]").forEach(e=>s(e))},s=t=>{if(!t.matches("a[href]"))return!1;const a=t.getAttribute("href");if(!o.some(e=>a.startsWith(e)))return!1;if(t.setAttribute("target","_blank"),t.setAttribute("rel","external noreferrer noopener"),!t.querySelector(".dashicons-external")){const e=document.createElement("span");e.classList.add("dashicons","dashicons-external"),e.setAttribute("aria-hidden","true"),t.append(" ",e)}if(!t.querySelector(".screen-reader-text")){const a=document.createElement("span");a.classList.add("screen-reader-text"),a.textContent=(0,e.__)("(opens in a new tab)","contact-form-7"),t.append(a)}},i=()=>{document.querySelectorAll("#contact-form-editor .config-error").forEach(e=>{e.remove()}),document.querySelectorAll("#contact-form-editor [data-config-field]").forEach(e=>{const t=e.dataset.configField;u(t).length?(e.setAttribute("aria-invalid","true"),e.setAttribute("aria-describedby",c(`wpcf7-config-error-for-${t}`)),e.after(m(t))):e.removeAttribute("aria-invalid")}),document.querySelectorAll("#contact-form-editor-tabs [data-panel] .icon-in-circle").forEach(e=>{e.remove()}),document.querySelectorAll("#contact-form-editor-tabs [data-panel]").forEach(e=>{d(e.dataset.panel)&&e.append(r("!"))});let t=0;document.querySelectorAll("#contact-form-editor .contact-form-editor-panel").forEach(a=>{const c=d(a.id);if(c){t+=c;const n=document.createElement("div");n.classList.add("config-error"),n.append(r("!"),(0,e.sprintf)((0,e._n)("%d configuration error detected in this tab panel.","%d configuration errors detected in this tab panel.",c,"contact-form-7"),c)),a.prepend(n)}})},d=e=>document.querySelectorAll(`#${e} ul.config-error li`)?.length,u=e=>{const t=[];for(const a in wpcf7.configValidator.errors)a===e&&t.push(...wpcf7.configValidator.errors[a]);return t},m=e=>{if(!e)return"";const t=document.createElement("ul");return t.setAttribute("id",c(`wpcf7-config-error-for-${e}`)),t.classList.add("config-error"),u(e).forEach(e=>{if(!e.message)return;const a=document.createElement("li");if(a.append(r("!")),e.link){const t=document.createElement("a");t.setAttribute("href",e.link),t.append(e.message),s(t),a.append(" ",t)}else a.append(" ",e.message);t.append(a)}),t},f=e=>{const t=e.dataset.id,a=e.querySelector('[name="name"]');let r=a?.value.trim()??"";a&&(r||=`${t}-${Math.floor(1e3*Math.random())}`,a.value=r),e.querySelectorAll(".tag").forEach(t=>{const a=e.querySelector('[name="tagtype"]')?.value||t.name;a&&(t.value=p(a,e))}),e.querySelectorAll("span.mail-tag").forEach(e=>{e.innerText=`[${r}]`}),e.querySelectorAll("input.mail-tag").forEach(e=>{e.value=`[${r}]`})},p=(e,t)=>{const a=t.querySelector(`.scope.${e}`)??t,r=e+(t.querySelector('[name="required"]:checked')?"*":""),c=t.querySelector('[name="name"]')?.value??"",n=[];a.querySelectorAll(".option").forEach(e=>{"checkbox"===e.type?e.checked&&n.push(e.name):"radio"===e.type?e.checked&&!e.classList.contains("default")&&n.push(`${e.name}:${e.value}`):""!==e.value&&(e.classList.contains("filetype")?n.push(`${e.name}:${e.value.split(/[,|\s]+/).join("|")}`):e.classList.contains("color")?n.push(`${e.name}:#${e.value}`):"class"===e.name?e.value.split(" ").forEach(e=>{n.push(`class:${e}`)}):n.push(`${e.name}:${e.value}`))}),"radio"===e&&n.push("default:1");const o=a.querySelector('[name="values"]')?.value.split("\n").map(e=>e.trim()).filter(e=>""!==e).map(e=>`"${e.replace(/["]/g,""")}"`)??[],l=[r,c,n.join(" "),o.join(" ")].map(e=>e.trim()).filter(e=>""!==e),s=a.querySelector('[name="content"]')?.value.trim();return s?`[${l.join(" ")}] ${s} [/${r}]`:`[${l.join(" ")}]`},h=e=>{const t=g(e);t?(e.querySelectorAll('[data-tag-part="tag"]').forEach(e=>{e.value=t}),e.querySelectorAll('[data-taggen="insert-tag"]').forEach(e=>{e.disabled=!1}),e.querySelectorAll('[data-tag-part="mail-tag"]').forEach(t=>{const a=e.querySelector('[data-tag-part="name"]');a&&(t.innerText=`[${a.value.trim()}]`)})):(e.querySelectorAll('[data-tag-part="tag"]').forEach(e=>{e.value=""}),e.querySelectorAll('[data-taggen="insert-tag"]').forEach(e=>{e.disabled=!0}))},g=e=>{const t=e.querySelector('[data-tag-part="basetype"]')?.value.trim();if(!t)return;if(e.querySelector(":invalid"))return;let a=t;const r=e.querySelector('[data-tag-part="type-suffix"]');r&&(["checkbox","radio"].includes(r?.type)?a+=r.checked?r.value.trim():"":a+=r.value.trim());const c=e.querySelector('[data-tag-part="name"]');let n=c?.value.trim()??"";c&&(n||=`${t}-${Math.floor(1e3*Math.random())}`,c.value=n);const o=[];e.querySelectorAll('[data-tag-part="option"]').forEach(e=>{const t=e.dataset.tagOption?.trim();t&&(["checkbox","radio"].includes(e?.type)&&!e.checked||t.split(" ").forEach(t=>{t.endsWith(":")?e.value?.split(" ").forEach(e=>{(e=e.trim())&&o.push(t+e)}):o.push(t)}))});const l=e.querySelector('[data-tag-part="value"]')?.value.split("\n").map(e=>e.trim()).filter(e=>""!==e).map(e=>`"${e.replace(/["]/g,""")}"`)??[],s=[a,n,o.join(" "),l.join(" ")].map(e=>e.trim()).filter(e=>""!==e),i=e.querySelector('[data-tag-part="content"]')?.value.trim();return i?`[${s.join(" ")}] ${i} [/${a}]`:`[${s.join(" ")}]`},v=e=>{const t=document.querySelector("#wpcf7-admin-form-element");if(!t)return;let a=!1;t.querySelectorAll("input, textarea, select").forEach(e=>{if(!a)switch(e.type){case"button":case"hidden":case"image":case"reset":case"search":case"submit":break;case"checkbox":case"radio":a=e.defaultChecked!==e.checked;break;case"select-multiple":case"select-one":e.querySelectorAll("option").forEach(e=>{a||e.defaultSelected===e.selected||(a=!0)});break;default:a=e.defaultValue!==e.value}}),a&&e.preventDefault()},y=window.wp.url;document.addEventListener("DOMContentLoaded",r=>{t&&t.querySelectorAll(':scope > [role="tablist"]').forEach(e=>{const a=e.querySelectorAll(':scope > [role="tab"]');let r=parseInt(e.dataset.activeTab);e.addEventListener("keydown",t=>{["ArrowLeft","ArrowRight"].includes(t.key)&&(a[r].setAttribute("tabindex","-1"),"ArrowLeft"===t.key&&(r-=1,r<0&&(r=a.length-1)),"ArrowRight"===t.key&&(r+=1,a.length<=r&&(r=0)),a[r].setAttribute("tabindex","0"),a[r].focus(),e.dataset.activeTab=r)}),a.forEach(a=>{a.addEventListener("click",r=>{const c=a.getAttribute("aria-controls");if(!c)return;const n=c.split(" ").reduceRight((e,a)=>{const r=t.querySelector(`#${a}`);return r&&(e=r),e},null);n&&(e.querySelectorAll(':scope > [aria-selected="true"]').forEach(e=>{e.setAttribute("aria-selected","false")}),a.setAttribute("aria-selected","true"),t.querySelectorAll(':scope > [role="tabpanel"]').forEach(e=>{e.setAttribute("hidden","hidden")}),n.removeAttribute("hidden"),document.querySelectorAll('input[name="active-tab"]').forEach(e=>{e.value=n.id}))})})}),document.querySelectorAll("#contact-form-editor [data-config-field]").forEach(e=>{e.addEventListener("change",e=>{const t=document.querySelector('[name="post_ID"]')?.value;t&&0{const{namespace:t}=wpcf7.apiSettings,r=`/${t}/contact-forms/${e}`,c=new FormData;document.querySelectorAll("#contact-form-editor [data-config-field]").forEach(e=>{const t=e.name?.replace(/^wpcf7-/,"").replace(/-/g,"_");if(!t)return;let a;["checkbox","radio"].includes(e.type)?e.checked&&(a=e.value):a=e.value,void 0!==a&&(t.endsWith("[]")?c.append(t,a):c.set(t,a))}),c.set("context","dry-run"),a({path:r,method:"POST",body:c}).then(e=>{wpcf7.configValidator.errors=e.config_errors,i()})})(t)})}),i(),document.querySelectorAll('[data-taggen="open-dialog"]').forEach(e=>{e.addEventListener("click",t=>{const a=document.querySelector(`#${e.dataset.target}`);if(a){const e=a.querySelector("form.tag-generator-panel");e&&("1"===e.dataset.version?(e=>{f(e),e.querySelectorAll(".control-box").forEach(t=>{t.addEventListener("change",t=>{var a;"name"===(a=t.target).name&&(a.value=a.value.replace(/[^0-9a-zA-Z:._-]/g,"").replace(/^[^a-zA-Z]+/,"")),a.classList.contains("numeric")&&(a.value=a.value.replace(/[^0-9.-]/g,"")),a.classList.contains("idvalue")&&(a.value=a.value.replace(/[^-0-9a-zA-Z_]/g,"")),a.classList.contains("classvalue")&&(a.value=a.value.split(" ").map(e=>e.replace(/[^-0-9a-zA-Z_]/g,"")).join(" ").replace(/\s+/g," ").trim()),a.classList.contains("color")&&(a.value=a.value.replace(/[^0-9a-fA-F]/g,"")),a.classList.contains("filesize")&&(a.value=a.value.replace(/[^0-9kKmMbB]/g,"")),a.classList.contains("filetype")&&(a.value=a.value.replace(/[^0-9a-zA-Z.,|\s]/g,"")),a.classList.contains("date")&&(a.value.match(/^\d{4}-\d{2}-\d{2}$/)||(a.value="")),"values"===a.name&&(a.value=a.value.trim()),f(e)})})})(e):"2"===e.dataset.version&&(e=>{e.reset()??h(e),e.querySelectorAll(".control-box").forEach(t=>{t.addEventListener("change",t=>{h(e)}),t.addEventListener("keyup",t=>{"text"!==(t.target.type??"")&&"textarea"!==t.target.tagName?.toLowerCase()||h(e)})})})(e)),a.showModal()}})}),document.querySelectorAll("dialog.tag-generator-dialog").forEach(e=>{e.querySelectorAll('[data-taggen="close-dialog"]').forEach(t=>{t.addEventListener("click",t=>e.close(""))}),e.querySelectorAll('[data-taggen="insert-tag"], .insert-tag').forEach(t=>{t.addEventListener("click",t=>{const a=e.querySelector('[data-tag-part="tag"], .tag');e.close(a?.value)})}),e.addEventListener("close",t=>{const a=document.querySelector("textarea#wpcf7-form");if(null===a)return;if(""===e.returnValue)return;const r=a.selectionEnd??0;0===r&&(e.returnValue+="\n\n"),a.value=a.value.substring(0,r)+e.returnValue+a.value.substring(r),a.selectionStart=r,a.selectionEnd=r+e.returnValue.length,a.focus()})}),(()=>{const e=document.querySelector("#wpcf7-admin-form-element");e&&(window.addEventListener("beforeunload",v),e.addEventListener("submit",e=>{e.submitter?.name&&"wpcf7-copy"===e.submitter.name||window.removeEventListener("beforeunload",v)}))})(),(()=>{const e=document.querySelector("#wpcf7_dashboard_news .cf7com-news");if(e&&!e.querySelector(".rss-widget")){const t=(0,y.addQueryArgs)(ajaxurl,{action:"wpcf7-dashboard-widgets",widget:"dashboard_primary"});fetch(t).then(e=>e.text()).then(t=>{e.innerHTML=t})}})(),(()=>{const e=document.querySelector('[name="post_ID"]')?.value,t=document.querySelector("#wpcf7-sendinblue-editor-lists");if(e&&t){const a=(0,y.addQueryArgs)(ajaxurl,{action:"wpcf7-sendinblue-contact-lists",id:e});fetch(a).then(e=>e.text()).then(e=>{t.innerHTML=e}).then(l)}})(),(()=>{const e=document.querySelector('[name="post_ID"]')?.value,t=document.querySelector("#wpcf7-sendinblue-editor-templates");if(e&&t){const a=(0,y.addQueryArgs)(ajaxurl,{action:"wpcf7-sendinblue-email-template",id:e});fetch(a).then(e=>e.text()).then(e=>{t.innerHTML=e}).then(l)}})();const c=document.querySelector("input#title");c&&""===c.value&&c.focus(),document.querySelector("#wpcf7-shortcode-wrap .toggle-shortcode")?.addEventListener("click",e=>{document.querySelector("#wpcf7-shortcode-wrap")?.classList.toggle("hide-shortcode")}),document.querySelector("#wpcf7-admin-form-element")?.addEventListener("submit",t=>{const a=document.querySelector('#wpcf7-admin-form-element [name="action"]'),r=document.querySelector('#wpcf7-admin-form-element [name="_wpnonce"]');"wpcf7-save"===t.submitter?.name&&(a&&(a.value="save"),r&&(r.value=wpcf7.nonce.save),document.querySelectorAll("#wpcf7-admin-form-element #publishing-action .spinner").forEach(e=>{e.classList.add("is-active")})),"wpcf7-copy"===t.submitter?.name&&(a&&(a.value="copy"),r&&(r.value=wpcf7.nonce.copy)),"wpcf7-delete"===t.submitter?.name&&(window.confirm((0,e.__)("You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.","contact-form-7"))?(a&&(a.value="delete"),r&&(r.value=wpcf7.nonce.delete)):t.preventDefault())}),document.querySelectorAll('.contact-form-editor-box-mail span.mailtag, [data-tag-part="mail-tag"]').forEach(e=>{e.addEventListener("click",t=>{const a=document.createRange();a.selectNodeContents(e),window.getSelection().addRange(a)})}),document.querySelectorAll("input.selectable").forEach(e=>{e.addEventListener("click",t=>{e.focus(),e.select()})}),document.querySelectorAll("[data-toggle]").forEach(e=>{n(e),e.addEventListener("change",t=>{n(e)})}),document.querySelectorAll("#wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email").forEach(e=>{e.addEventListener("change",t=>{e.checked?e.closest("tr").classList.remove("inactive"):e.closest("tr").classList.add("inactive")})}),l()})})(); \ No newline at end of file diff --git a/wp-content/plugins/contact-form-7/admin/includes/list-table.php b/wp-content/plugins/contact-form-7/admin/includes/list-table.php new file mode 100644 index 0000000..75686ba --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/list-table.php @@ -0,0 +1,330 @@ + 'post', + 'plural' => 'posts', + 'ajax' => false, + ) ); + } + + public function prepare_items() { + $current_orderby = wpcf7_superglobal_get( 'orderby' ); + $current_order = wpcf7_superglobal_get( 'order' ); + + list( $columns, $hidden, $sortable ) = $this->get_column_info(); + + foreach ( array_keys( $columns ) as $column_key ) { + if ( isset( $sortable[$column_key] ) ) { + $orderby = $sortable[$column_key][0] ?? ''; + $initial_order = $sortable[$column_key][4] ?? ''; + + if ( '' === $current_orderby and $initial_order ) { + $current_orderby = $orderby; + $current_order = $initial_order; + + break; + } + } + } + + $per_page = $this->get_items_per_page( 'wpcf7_contact_forms_per_page' ); + + $args = array( + 'posts_per_page' => $per_page, + 'orderby' => $current_orderby, + 'order' => $current_order, + 'offset' => ( $this->get_pagenum() - 1 ) * $per_page, + 's' => wpcf7_superglobal_get( 's' ), + ); + + $this->items = WPCF7_ContactForm::find( $args ); + + $total_items = WPCF7_ContactForm::count(); + $total_pages = ceil( $total_items / $per_page ); + + $this->set_pagination_args( array( + 'total_items' => $total_items, + 'total_pages' => $total_pages, + 'per_page' => $per_page, + ) ); + } + + public function get_columns() { + return array( + 'cb' => '', + 'title' => __( 'Title', 'contact-form-7' ), + 'author' => __( 'Author', 'contact-form-7' ), + 'date' => __( 'Date', 'contact-form-7' ), + ); + } + + protected function get_sortable_columns() { + return array( + 'title' => array( + 'title', + false, + __( 'Title', 'contact-form-7' ), + __( 'Table ordered by Title.', 'contact-form-7' ), + 'asc', + ), + 'author' => array( + 'author', + false, + __( 'Author', 'contact-form-7' ), + __( 'Table ordered by Author.', 'contact-form-7' ), + ), + 'date' => array( + 'date', + true, + __( 'Date', 'contact-form-7' ), + __( 'Table ordered by Date.', 'contact-form-7' ), + ), + ); + } + + protected function get_bulk_actions() { + $post_type_obj = get_post_type_object( WPCF7_ContactForm::post_type ); + + if ( current_user_can( $post_type_obj->cap->edit_posts ) ) { + return array( + 'delete' => __( 'Delete', 'contact-form-7' ), + ); + } else { + return array(); + } + } + + public function column_default( $item, $column_name ) { + do_action( 'wpcf7_manage_custom_column', $column_name, $item->id() ); + } + + public function column_cb( $item ) { + $post_type_obj = get_post_type_object( WPCF7_ContactForm::post_type ); + $show = current_user_can( $post_type_obj->cap->edit_post, $item->id() ); + + if ( ! $show ) { + return ''; + } + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'input', array( + 'id' => sprintf( 'cb-select-%d', $item->id() ), + 'type' => 'checkbox', + 'name' => sprintf( '%s[]', $this->_args['singular'] ), + 'value' => $item->id(), + ) ); + + $formatter->append_start_tag( 'label', array( + 'for' => sprintf( 'cb-select-%d', $item->id() ), + ) ); + + $formatter->append_start_tag( 'span', array( + 'class' => 'screen-reader-text', + ) ); + + $formatter->append_preformatted( + esc_html( sprintf( + /* translators: %s: contact form title */ + __( 'Select %s', 'contact-form-7' ), + $item->title() + ) ) + ); + + $formatter->print(); + } + + public function column_title( $item ) { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'strong' ); + + $edit_link = add_query_arg( + array( + 'post' => absint( $item->id() ), + 'action' => 'edit', + ), + menu_page_url( 'wpcf7', false ) + ); + + $formatter->append_start_tag( 'a', array( + 'class' => 'row-title', + 'href' => esc_url( $edit_link ), + 'aria-label' => sprintf( + /* translators: %s: title of contact form */ + __( 'Edit “%s”', 'contact-form-7' ), + $item->title() + ), + ) ); + + $formatter->append_preformatted( esc_html( $item->title() ) ); + + $formatter->end_tag( 'strong' ); + + $post_type_obj = get_post_type_object( WPCF7_ContactForm::post_type ); + + if ( $item->is_true( 'subscribers_only' ) ) { + $formatter->append_start_tag( 'span', array( + 'class' => 'tag info', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'subscribers only', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'span' ); + } + + if ( $item->is_true( 'demo_mode' ) ) { + $formatter->append_start_tag( 'span', array( + 'class' => 'tag info', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'demo mode', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'span' ); + } + + if ( $item->is_true( 'skip_mail' ) ) { + $formatter->append_start_tag( 'span', array( + 'class' => 'tag info', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'skip mail', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'span' ); + } + + if ( $item->is_true( 'do_not_store' ) ) { + $formatter->append_start_tag( 'span', array( + 'class' => 'tag info', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'do not store', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'span' ); + } + + if ( + wpcf7_validate_configuration() and + current_user_can( $post_type_obj->cap->edit_post, $item->id() ) + ) { + $config_validator = new WPCF7_ConfigValidator( $item ); + $config_validator->restore(); + + if ( $count_errors = $config_validator->count_errors() ) { + $formatter->append_start_tag( 'span', array( + 'class' => 'tag warning', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'has config errors', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'span' ); + } + } + + $formatter->print(); + } + + protected function handle_row_actions( $item, $column_name, $primary ) { + if ( $column_name !== $primary ) { + return ''; + } + + $edit_link = add_query_arg( + array( + 'post' => absint( $item->id() ), + 'action' => 'edit', + ), + menu_page_url( 'wpcf7', false ) + ); + + $actions = array( + 'edit' => wpcf7_link( $edit_link, __( 'Edit', 'contact-form-7' ) ), + ); + + if ( current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { + $copy_link = add_query_arg( + array( + 'post' => absint( $item->id() ), + 'action' => 'copy', + ), + menu_page_url( 'wpcf7', false ) + ); + + $copy_link = wp_nonce_url( + $copy_link, + 'wpcf7-copy-contact-form_' . absint( $item->id() ) + ); + + $actions = array_merge( $actions, array( + 'copy' => wpcf7_link( + $copy_link, + __( 'Duplicate', 'contact-form-7' ) + ), + ) ); + } + + return $this->row_actions( $actions ); + } + + public function column_author( $item ) { + $post = get_post( $item->id() ); + + if ( ! $post ) { + return; + } + + $author = get_userdata( $post->post_author ); + + if ( false === $author ) { + return; + } + + echo esc_html( $author->display_name ); + } + + public function column_date( $item ) { + $datetime = get_post_datetime( $item->id() ); + + if ( false === $datetime ) { + return ''; + } + + $t_time = sprintf( + /* translators: 1: date, 2: time */ + __( '%1$s at %2$s', 'contact-form-7' ), + /* translators: date format, see https://www.php.net/date */ + $datetime->format( __( 'Y/m/d', 'contact-form-7' ) ), + /* translators: time format, see https://www.php.net/date */ + $datetime->format( __( 'g:i a', 'contact-form-7' ) ) + ); + + echo $t_time; + } +} diff --git a/wp-content/plugins/contact-form-7/admin/includes/tag-generator.php b/wp-content/plugins/contact-form-7/admin/includes/tag-generator.php new file mode 100644 index 0000000..844c53c --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/includes/tag-generator.php @@ -0,0 +1,627 @@ + '1', + ) ); + + $this->panels[$id] = array( + 'title' => $title, + 'content' => 'tag-generator-panel-' . $id, + 'options' => $options, + 'callback' => $callback, + ); + + if ( version_compare( $options['version'], '2', '<' ) ) { + $message = sprintf( + /* translators: 1: version, 2: tag generator title */ + __( 'Use of tag generator instances older than version 2 is deprecated. Version %1$s instance (%2$s) detected.', 'contact-form-7' ), + $options['version'], + $title + ); + + wp_trigger_error( __METHOD__, $message, E_USER_DEPRECATED ); + } + + return true; + } + + + /** + * Renders form-tag generator calling buttons. + */ + public function print_buttons() { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'span', array( + 'id' => 'tag-generator-list', + 'class' => 'hide-if-no-js', + ) ); + + foreach ( (array) $this->panels as $panel ) { + $formatter->append_start_tag( 'button', array( + 'type' => 'button', + 'data-taggen' => 'open-dialog', + 'data-target' => $panel['content'], + 'title' => sprintf( + /* translators: %s: title of form-tag */ + __( 'Form-tag Generator: %s', 'contact-form-7' ), + $panel['title'] + ), + ) ); + + $formatter->append_preformatted( esc_html( $panel['title'] ) ); + } + + $formatter->print(); + } + + + /** + * Renders form-tag generator dialog panels (hidden until called). + */ + public function print_panels( WPCF7_ContactForm $contact_form ) { + $formatter = new WPCF7_HTMLFormatter( array( + 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( + 'dialog' => array( + 'id' => true, + 'class' => true, + ), + 'form' => array( + 'method' => true, + 'class' => true, + 'data-*' => true, + ), + ) ), + ) ); + + foreach ( (array) $this->panels as $id => $panel ) { + $callback = $panel['callback']; + + $options = array_merge( $panel['options'], array( + 'id' => $id, + 'title' => $panel['title'], + 'content' => $panel['content'], + ) ); + + if ( is_callable( $callback ) ) { + $formatter->append_start_tag( 'dialog', array( + 'id' => $options['content'], + 'class' => 'tag-generator-dialog', + ) ); + + $formatter->append_start_tag( 'button', array( + 'class' => 'close-button', + 'title' => __( 'Close this dialog box', 'contact-form-7' ), + 'data-taggen' => 'close-dialog', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Close', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'button' ); + + $formatter->append_start_tag( 'form', array( + 'method' => 'dialog', + 'class' => 'tag-generator-panel', + 'data-id' => $options['id'], + 'data-version' => $options['version'], + ) ); + + $formatter->call_user_func( $callback, $contact_form, $options ); + + $formatter->close_all_tags(); + } + } + + $formatter->print(); + } + +} + + +/** + * Class helps to implement a form-tag generator content. + */ +class WPCF7_TagGeneratorGenerator { + + private $key = ''; + + + /** + * The constructor. + */ + public function __construct( $key ) { + $this->key = $key; + } + + + /** + * Returns a unique reference ID. + */ + public function ref( $suffix = '' ) { + $ref = sprintf( '%s-%s', $this->key, $suffix ); + $ref = strtolower( $ref ); + $ref = preg_replace( '/[^0-9a-z-]/', '', $ref ); + $ref = preg_replace( '/[-]+/', '-', $ref ); + $ref = trim( $ref, '-' ); + return $ref; + } + + + /** + * Calls one of the template methods. + */ + public function print( $part, $options = '' ) { + if ( is_callable( array( $this, $part ) ) ) { + call_user_func( array( $this, $part ), $options ); + } + } + + + /** + * Template method for field type field. + */ + private function field_type( $options = '' ) { + $options = wp_parse_args( $options, array( + 'with_required' => false, + 'with_optional' => false, + 'select_options' => array(), + ) ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend', array( + 'id' => $this->ref( 'type-legend' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Field type', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'legend' ); + + $formatter->append_start_tag( 'select', array( + 'data-tag-part' => 'basetype', + 'aria-labelledby' => $this->ref( 'type-legend' ), + ) ); + + foreach ( (array) $options['select_options'] as $basetype => $title ) { + $formatter->append_start_tag( 'option', array( + 'value' => $basetype, + ) ); + + $formatter->append_preformatted( esc_html( $title ) ); + } + + $formatter->end_tag( 'select' ); + + if ( $options['with_required'] ) { + $formatter->append_start_tag( 'br' ); + $formatter->append_start_tag( 'label' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'data-tag-part' => 'type-suffix', + 'value' => '*', + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'This is a required field.', 'contact-form-7' ) ) + ); + } + + if ( $options['with_optional'] ) { + $formatter->append_start_tag( 'br' ); + $formatter->append_start_tag( 'label' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'data-tag-part' => 'option', + 'data-tag-option' => 'optional', + 'checked' => true, + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'This checkbox is optional.', 'contact-form-7' ) ) + ); + } + + $formatter->print(); + } + + + /** + * Template method for field name field. + */ + private function field_name( $options = '' ) { + $options = wp_parse_args( $options, array( + 'ask_if' => '', + ) ); + +?> +
                + + + + +
                + + +
                + +
                + + +
                + +
                + + +
                + 'number', + 'title' => __( 'Length', 'contact-form-7' ), + 'min_option' => 'minlength:', + 'max_option' => 'maxlength:', + 'accept_minus' => false, + ) ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend' ); + $formatter->append_preformatted( esc_html( $options['title'] ) ); + $formatter->end_tag( 'legend' ); + + $formatter->append_start_tag( 'label' ); + + $formatter->append_preformatted( + esc_html( __( 'Min', 'contact-form-7' ) ) + ); + + $formatter->append_whitespace(); + + $formatter->append_start_tag( 'input', array( + 'type' => $options['type'], + 'data-tag-part' => 'option', + 'data-tag-option' => $options['min_option'], + 'min' => $options['accept_minus'] ? null : 0, + ) ); + + $formatter->end_tag( 'label' ); + + $formatter->append_preformatted( ' ⇔ ' ); + + $formatter->append_start_tag( 'label' ); + + $formatter->append_preformatted( + esc_html( __( 'Max', 'contact-form-7' ) ) + ); + + $formatter->append_whitespace(); + + $formatter->append_start_tag( 'input', array( + 'type' => $options['type'], + 'data-tag-part' => 'option', + 'data-tag-option' => $options['max_option'], + 'min' => $options['accept_minus'] ? null : 0, + ) ); + + $formatter->end_tag( 'label' ); + + $formatter->print(); + } + + + /** + * Template method for default value field. + */ + private function default_value( $options = '' ) { + $options = wp_parse_args( $options, array( + 'type' => 'text', + 'title' => __( 'Default value', 'contact-form-7' ), + 'with_placeholder' => false, + 'use_content' => false, + ) ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend', array( + 'id' => $this->ref( 'value-legend' ), + ) ); + + $formatter->append_preformatted( esc_html( $options['title'] ) ); + + $formatter->end_tag( 'legend' ); + + $formatter->append_start_tag( 'input', array( + 'type' => $options['type'], + 'data-tag-part' => $options['use_content'] ? 'content' : 'value', + 'aria-labelledby' => $this->ref( 'value-legend' ), + ) ); + + if ( $options['with_placeholder'] ) { + $formatter->append_start_tag( 'br' ); + $formatter->append_start_tag( 'label' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'data-tag-part' => 'option', + 'data-tag-option' => 'placeholder', + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'Use this text as the placeholder.', 'contact-form-7' ) ) + ); + } + + $formatter->print(); + } + + + /** + * Template method for selectable values useful for checkboxes or a menu. + */ + private function selectable_values( $options = '' ) { + $options = wp_parse_args( $options, array( + 'first_as_label' => false, + 'use_label_element' => false, + ) ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'fieldset' ); + + $formatter->append_start_tag( 'legend', array( + 'id' => $this->ref( 'selectable-values-legend' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Selectable values', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'legend' ); + + $formatter->append_start_tag( 'span', array( + 'id' => $this->ref( 'selectable-values-description' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( 'One item per line.', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'span' ); + + $formatter->append_start_tag( 'br' ); + + $formatter->append_start_tag( 'textarea', array( + 'required' => true, + 'data-tag-part' => 'value', + 'aria-labelledby' => $this->ref( 'selectable-values-legend' ), + 'aria-describedby' => $this->ref( 'selectable-values-description' ), + ) ); + + $formatter->append_preformatted( + esc_html( __( "Option 1\nOption 2\nOption 3", 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'textarea' ); + + if ( $options['first_as_label'] ) { + $formatter->append_start_tag( 'br' ); + $formatter->append_start_tag( 'label' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'checked' => 'checked' === $options['first_as_label'], + 'data-tag-part' => 'option', + 'data-tag-option' => 'first_as_label', + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'Use the first item as a label.', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'label' ); + } + + if ( $options['use_label_element'] ) { + $formatter->append_start_tag( 'br' ); + $formatter->append_start_tag( 'label' ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'checkbox', + 'checked' => 'checked' === $options['use_label_element'], + 'data-tag-part' => 'option', + 'data-tag-option' => 'use_label_element', + ) ); + + $formatter->append_whitespace(); + + $formatter->append_preformatted( + esc_html( __( 'Wrap each item with a label element.', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'label' ); + } + + $formatter->print(); + } + + + /** + * Template method for insert-box content including the result form-tag. + */ + private function insert_box_content( $options = '' ) { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'div', array( + 'class' => 'flex-container', + ) ); + + $formatter->append_start_tag( 'input', array( + 'type' => 'text', + 'class' => 'code selectable', + 'readonly' => true, + 'data-tag-part' => 'tag', + 'aria-label' => __( 'The form-tag to be inserted into the form template', 'contact-form-7' ), + ) ); + + $formatter->append_whitespace(); + + $formatter->append_start_tag( 'button', array( + 'type' => 'button', + 'class' => 'button button-primary', + 'data-taggen' => 'insert-tag', + ) ); + + $formatter->append_preformatted( + esc_html( __( 'Insert Tag', 'contact-form-7' ) ) + ); + + $formatter->end_tag( 'button' ); + + $formatter->print(); + } + + + /** + * Template method for a tip message about mail-tag. + */ + private function mail_tag_tip( $options = '' ) { + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'p', array( + 'class' => 'mail-tag-tip', + ) ); + + $formatter->append_preformatted( sprintf( + /* translators: %s: mail-tag corresponding to the form-tag */ + esc_html( __( 'To use the user input in the email, insert the corresponding mail-tag %s into the email template.', 'contact-form-7' ) ), + '' + ) ); + + $formatter->print(); + } + +} diff --git a/wp-content/plugins/contact-form-7/admin/integration.php b/wp-content/plugins/contact-form-7/admin/integration.php new file mode 100644 index 0000000..eda5d86 --- /dev/null +++ b/wp-content/plugins/contact-form-7/admin/integration.php @@ -0,0 +1,71 @@ +service_exists( $service_name ) ) { + $service = $integration->get_service( $service_name ); +} + +$formatter = new WPCF7_HTMLFormatter( array( + 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( + 'form' => array( + 'action' => true, + 'method' => true, + ), + ) ), +) ); + +$formatter->append_start_tag( 'div', array( + 'class' => 'wrap', + 'id' => 'wpcf7-integration', +) ); + +$formatter->append_start_tag( 'h1' ); + +$formatter->append_preformatted( + esc_html( __( 'Integration with External API', 'contact-form-7' ) ) +); + +$formatter->end_tag( 'h1' ); + +$formatter->append_start_tag( 'p' ); + +$formatter->append_preformatted( + sprintf( + /* translators: %s: URL to support page about integration with external APIs */ + __( 'You can expand the possibilities of your contact forms by integrating them with external services. For details, see Integration with external APIs.', 'contact-form-7' ), + 'https://contactform7.com/integration-with-external-apis/' + ) +); + +$formatter->end_tag( 'p' ); + +$formatter->call_user_func( + static function () use ( $integration, $service, $service_name ) { + do_action( 'wpcf7_admin_warnings', + 'wpcf7-integration', wpcf7_current_action(), $service + ); + + do_action( 'wpcf7_admin_notices', + 'wpcf7-integration', wpcf7_current_action(), $service + ); + + if ( $service ) { + $message = wpcf7_superglobal_request( 'message' ); + $service->admin_notice( $message ); + + $integration->list_services( array( + 'include' => $service_name, + ) ); + } else { + $integration->list_services(); + } + } +); + +$formatter->print(); diff --git a/wp-content/plugins/contact-form-7/assets/icon.png b/wp-content/plugins/contact-form-7/assets/icon.png new file mode 100644 index 0000000..f66eefa Binary files /dev/null and b/wp-content/plugins/contact-form-7/assets/icon.png differ diff --git a/wp-content/plugins/contact-form-7/assets/icon.svg b/wp-content/plugins/contact-form-7/assets/icon.svg new file mode 100644 index 0000000..33df0bd --- /dev/null +++ b/wp-content/plugins/contact-form-7/assets/icon.svg @@ -0,0 +1 @@ + diff --git a/wp-content/plugins/contact-form-7/includes/block-editor/block-editor.php b/wp-content/plugins/contact-form-7/includes/block-editor/block-editor.php new file mode 100644 index 0000000..5a272ed --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/block-editor/block-editor.php @@ -0,0 +1,15 @@ + array( + 'react-jsx-runtime', + 'wp-api-fetch', + 'wp-block-editor', + 'wp-blocks', + 'wp-components', + 'wp-element', + 'wp-i18n', + 'wp-url', + ), + 'version' => WPCF7_VERSION, +); diff --git a/wp-content/plugins/contact-form-7/includes/block-editor/index.js b/wp-content/plugins/contact-form-7/includes/block-editor/index.js new file mode 100644 index 0000000..f12e248 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/block-editor/index.js @@ -0,0 +1 @@ +(()=>{"use strict";const t=window.wp.i18n,e=window.wp.blocks,l=window.wp.blockEditor,a=window.ReactJSXRuntime,r=(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 242.5 239.46",children:[(0,a.jsx)("defs",{children:(0,a.jsx)("clipPath",{id:"clip-path",transform:"translate(1.72)",children:(0,a.jsx)("circle",{className:"cls-1",cx:"119.73",cy:"119.73",r:"116.15",fill:"none"})})}),(0,a.jsx)("g",{id:"Layer_2","data-name":"Layer 2",children:(0,a.jsxs)("g",{id:"Layer_1","data-name":"Layer 1",children:[(0,a.jsxs)("g",{className:"cls-2",clipPath:"url(#clip-path)",children:[(0,a.jsx)("circle",{className:"cls-3",cx:"121.45",cy:"119.73",r:"116.15",fill:"#33c6f4"}),(0,a.jsx)("path",{className:"cls-4",d:"M239.32,167.79c-53.41-24-108.37-91.46-113-94.55s-10.84.77-10.84.77c-3.87-6.19-10.06.77-10.06.77C76.77,123.55.14,170.11.14,170.11S36.94,237.79,122,237.79C208.48,237.79,239.32,167.79,239.32,167.79Z",transform:"translate(1.72)",fill:"#1b447e"}),(0,a.jsx)("path",{className:"cls-5",d:"M67.48,116.58s15.48-7,12.38,4.65-15.48,28.64-11.61,29.41S83,140.58,86.06,142.12s5.42.78,3.87,6.2-3.1,9.29,0,9.29,5.42-7,9.29-13.94,10.06-3.87,12.38-1.55,9.29,15.49,14.71,13.94,8.51-8.52,6.19-24,1.55-20.12,1.55-20.12,4.64-2.32,13.16,8.51,24,27.09,26.31,26.32-10.83-17.8-7.74-19.35,15.48,2.32,21.68,7.74c0,0,2.12,8.87,2.12.36L126.31,73.24,115.47,74l-10.06.77S80.64,111.94,67.48,116.58Z",transform:"translate(1.72)",fill:"#fff"}),(0,a.jsx)("path",{className:"cls-6",d:"M239.32,170.11c-53.41-24-108.37-93.78-113-96.87s-10.84.77-10.84.77c-3.87-6.19-10.06.77-10.06.77C76.77,123.55.14,170.11.14,170.11",transform:"translate(1.72)",fill:"none",stroke:"#221e1f",strokeMiterlimit:"10",strokeWidth:"8px"})]}),(0,a.jsx)("circle",{className:"cls-6",cx:"121.45",cy:"119.73",r:"116.15",fill:"none",stroke:"#1b447e",strokeMiterlimit:"10",strokeWidth:"8px"})]})})]}),o=window.wp.element,s=window.wp.components,c=window.wp.apiFetch,n=window.wp.url,i=async t=>c({path:(0,n.addQueryArgs)("/contact-form-7/v1/contact-forms",{posts_per_page:20,orderby:"modified",order:"DESC",...t})}).then(t=>t),m=t=>{let e="[contact-form-7]";return t.hash?e=e.replace(/\]$/,` id="${t.hash}"]`):t.id&&(e=e.replace(/\]$/,` id="${t.id}"]`)),t.title&&(e=e.replace(/\]$/,` title="${t.title}"]`)),t.htmlId&&(e=e.replace(/\]$/,` html_id="${t.htmlId}"]`)),t.htmlName&&(e=e.replace(/\]$/,` html_name="${t.htmlName}"]`)),t.htmlTitle&&(e=e.replace(/\]$/,` html_title="${t.htmlTitle}"]`)),t.htmlClass&&(e=e.replace(/\]$/,` html_class="${t.htmlClass}"]`)),"raw_form"===t.output&&(e=e.replace(/\]$/,` output="${t.output}"]`)),e},h=t=>{const e=ajaxurl.replace(/\/admin-ajax\.php$/,"/admin.php");return(0,n.addQueryArgs)(e,{page:"wpcf7",post:t.id,action:"edit"})},d={from:[],to:[{type:"block",blocks:["core/shortcode"],transform:t=>{const l=m(t);return(0,e.createBlock)("core/shortcode",{text:l})}}]};(0,e.registerBlockType)("contact-form-7/contact-form-selector",{icon:r,transforms:d,edit:function({attributes:e,setAttributes:r}){const c=t=>t.reduce((t,e)=>t.set(e.id,e),new Map),[n,m]=(0,o.useState)(()=>c([]));return(0,o.useEffect)(()=>{i().then(t=>{m(c(t))})},[]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(l.InspectorControls,{children:[!!e.id&&(0,a.jsx)(s.PanelBody,{title:e.title,children:(0,a.jsx)(s.ExternalLink,{href:h(e),children:(0,t.__)("Edit this contact form","contact-form-7")})}),!!e.id&&(0,a.jsxs)(s.PanelBody,{title:(0,t.__)("Form attributes","contact-form-7"),initialOpen:!1,children:[(0,a.jsx)(s.TextControl,{label:(0,t.__)("ID","contact-form-7"),value:e.htmlId,onChange:t=>r({htmlId:t}),help:(0,t.__)("Used for the id attribute value of the form element.","contact-form-7")}),(0,a.jsx)(s.TextControl,{label:(0,t.__)("Name","contact-form-7"),value:e.htmlName,onChange:t=>r({htmlName:t}),help:(0,t.__)("Used for the name attribute value of the form element.","contact-form-7")}),(0,a.jsx)(s.TextControl,{label:(0,t.__)("Title","contact-form-7"),value:e.htmlTitle,onChange:t=>r({htmlTitle:t}),help:(0,t.__)("Used for the aria-label attribute value of the form element.","contact-form-7")}),(0,a.jsx)(s.TextControl,{label:(0,t.__)("Class","contact-form-7"),value:e.htmlClass,onChange:t=>r({htmlClass:t}),help:(0,t.__)("Used for the class attribute value of the form element.","contact-form-7")})]})]}),(0,a.jsx)("div",{...(0,l.useBlockProps)({className:"components-placeholder",style:{marginTop:"28px",marginBottom:"28px"}}),children:(0,a.jsx)(s.ComboboxControl,{label:(0,t.__)("Select a contact form:","contact-form-7"),options:(t=>{const e=[];for(const[l,a]of t)e.push({value:l,label:a.title});return e})(n),value:e.id,onChange:t=>r({id:parseInt(t),hash:n.get(parseInt(t))?.hash,title:n.get(parseInt(t))?.title}),onFilterValueChange:t=>{i({search:t}).then(t=>{m(c(t))})}})})]})},save:({attributes:t})=>{const e=m(t);return(0,a.jsx)("div",{...l.useBlockProps.save(),children:e})}})})(); \ No newline at end of file diff --git a/wp-content/plugins/contact-form-7/includes/capabilities.php b/wp-content/plugins/contact-form-7/includes/capabilities.php new file mode 100644 index 0000000..663ed76 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/capabilities.php @@ -0,0 +1,28 @@ + WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_read_contact_form' => WPCF7_ADMIN_READ_CAPABILITY, + 'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY, + 'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_delete_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY, + 'wpcf7_manage_integration' => 'manage_options', + 'wpcf7_submit' => 'read', + ); + + $meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps ); + + $caps = array_diff( $caps, array_keys( $meta_caps ) ); + + if ( isset( $meta_caps[$cap] ) ) { + $caps[] = $meta_caps[$cap]; + } + + return $caps; +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator/actions.php b/wp-content/plugins/contact-form-7/includes/config-validator/actions.php new file mode 100644 index 0000000..f9d7528 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator/actions.php @@ -0,0 +1,29 @@ + 'unsafe_email_without_protection', + ); + + foreach ( $contact_forms as $contact_form ) { + $config_validator = new WPCF7_ConfigValidator( $contact_form, $options ); + $config_validator->restore(); + $config_validator->validate(); + $config_validator->save(); + } + } +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator/additional-settings.php b/wp-content/plugins/contact-form-7/includes/config-validator/additional-settings.php new file mode 100644 index 0000000..471e5f7 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator/additional-settings.php @@ -0,0 +1,30 @@ +supports( 'deprecated_settings' ) ) { + $deprecated_settings_used = + $this->contact_form->additional_setting( 'on_sent_ok' ) || + $this->contact_form->additional_setting( 'on_submit' ); + + if ( $deprecated_settings_used ) { + $this->add_error( $section, 'deprecated_settings', + array( + 'message' => __( 'Deprecated settings are used.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'deprecated_settings' ); + } + } + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator/form.php b/wp-content/plugins/contact-form-7/includes/config-validator/form.php new file mode 100644 index 0000000..7e30242 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator/form.php @@ -0,0 +1,280 @@ +contact_form->prop( 'form' ); + + if ( $this->supports( 'multiple_controls_in_label' ) ) { + if ( $this->detect_multiple_controls_in_label( $section, $form ) ) { + $this->add_error( $section, 'multiple_controls_in_label', + array( + 'message' => __( 'Multiple form controls are in a single label element.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'multiple_controls_in_label' ); + } + } + + if ( $this->supports( 'unavailable_names' ) ) { + $ng_names = $this->detect_unavailable_names( $section, $form ); + + if ( $ng_names ) { + $this->add_error( $section, 'unavailable_names', + array( + 'message' => + /* translators: %names%: a list of form control names */ + __( 'Unavailable names (%names%) are used for form controls.', 'contact-form-7' ), + 'params' => array( 'names' => implode( ', ', $ng_names ) ), + ) + ); + } else { + $this->remove_error( $section, 'unavailable_names' ); + } + } + + if ( $this->supports( 'unavailable_html_elements' ) ) { + if ( $this->detect_unavailable_html_elements( $section, $form ) ) { + $this->add_error( $section, 'unavailable_html_elements', + array( + 'message' => __( 'Unavailable HTML elements are used in the form template.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'unavailable_html_elements' ); + } + } + + if ( $this->supports( 'dots_in_names' ) ) { + if ( $this->detect_dots_in_names( $section, $form ) ) { + $this->add_error( $section, 'dots_in_names', + array( + 'message' => __( 'Dots are used in form-tag names.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'dots_in_names' ); + } + } + + if ( $this->supports( 'colons_in_names' ) ) { + if ( $this->detect_colons_in_names( $section, $form ) ) { + $this->add_error( $section, 'colons_in_names', + array( + 'message' => __( 'Colons are used in form-tag names.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'colons_in_names' ); + } + } + + if ( $this->supports( 'upload_filesize_overlimit' ) ) { + if ( $this->detect_upload_filesize_overlimit( $section, $form ) ) { + $this->add_error( $section, 'upload_filesize_overlimit', + array( + 'message' => __( 'Uploadable file size exceeds PHP’s maximum acceptable size.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'upload_filesize_overlimit' ); + } + } + } + + + /** + * Detects errors of multiple form controls in a single label. + * + * @link https://contactform7.com/configuration-errors/multiple-controls-in-label/ + */ + public function detect_multiple_controls_in_label( $section, $content ) { + $pattern = '%(.+?)%s'; + + if ( preg_match_all( $pattern, $content, $matches ) ) { + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + + foreach ( $matches[1] as $insidelabel ) { + $tags = $form_tags_manager->scan( $insidelabel ); + $fields_count = 0; + + foreach ( $tags as $tag ) { + $is_multiple_controls_container = wpcf7_form_tag_supports( + $tag->type, 'multiple-controls-container' + ); + + $is_zero_controls_container = wpcf7_form_tag_supports( + $tag->type, 'zero-controls-container' + ); + + if ( $is_multiple_controls_container ) { + $fields_count += count( $tag->values ); + + if ( $tag->has_option( 'free_text' ) ) { + $fields_count += 1; + } + } elseif ( $is_zero_controls_container ) { + $fields_count += 0; + } elseif ( ! empty( $tag->name ) ) { + $fields_count += 1; + } + + if ( 1 < $fields_count ) { + return true; + } + } + } + } + + return false; + } + + + /** + * Detects errors of unavailable form-tag names. + * + * @link https://contactform7.com/configuration-errors/unavailable-names/ + */ + public function detect_unavailable_names( $section, $content ) { + $public_query_vars = array( 'm', 'p', 'posts', 'w', 'cat', + 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', + 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', + 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', + 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', + 'pagename', 'page_id', 'error', 'attachment', 'attachment_id', + 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', + 'cpage', 'post_type', 'embed', + ); + + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + + $ng_named_tags = $form_tags_manager->filter( $content, array( + 'name' => $public_query_vars, + ) ); + + $ng_names = array(); + + foreach ( $ng_named_tags as $tag ) { + $ng_names[] = sprintf( '"%s"', $tag->name ); + } + + if ( $ng_names ) { + return array_unique( $ng_names ); + } + + return false; + } + + + /** + * Detects errors of unavailable HTML elements. + * + * @link https://contactform7.com/configuration-errors/unavailable-html-elements/ + */ + public function detect_unavailable_html_elements( $section, $content ) { + $pattern = '%(?:]|)%i'; + + if ( preg_match( $pattern, $content ) ) { + return true; + } + + return false; + } + + + /** + * Detects errors of dots in form-tag names. + * + * @link https://contactform7.com/configuration-errors/dots-in-names/ + */ + public function detect_dots_in_names( $section, $content ) { + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + + $tags = $form_tags_manager->filter( $content, array( + 'feature' => 'name-attr', + ) ); + + foreach ( $tags as $tag ) { + if ( str_contains( $tag->raw_name, '.' ) ) { + return true; + } + } + + return false; + } + + + /** + * Detects errors of colons in form-tag names. + * + * @link https://contactform7.com/configuration-errors/colons-in-names/ + */ + public function detect_colons_in_names( $section, $content ) { + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + + $tags = $form_tags_manager->filter( $content, array( + 'feature' => 'name-attr', + ) ); + + foreach ( $tags as $tag ) { + if ( str_contains( $tag->raw_name, ':' ) ) { + return true; + } + } + + return false; + } + + + /** + * Detects errors of uploadable file size overlimit. + * + * @link https://contactform7.com/configuration-errors/upload-filesize-overlimit + */ + public function detect_upload_filesize_overlimit( $section, $content ) { + $upload_max_filesize = ini_get( 'upload_max_filesize' ); + + if ( ! $upload_max_filesize ) { + return false; + } + + $upload_max_filesize = strtolower( $upload_max_filesize ); + $upload_max_filesize = trim( $upload_max_filesize ); + + if ( ! preg_match( '/^(\d+)([kmg]?)$/', $upload_max_filesize, $matches ) ) { + return false; + } + + if ( 'k' === $matches[2] ) { + $upload_max_filesize = (int) $matches[1] * KB_IN_BYTES; + } elseif ( 'm' === $matches[2] ) { + $upload_max_filesize = (int) $matches[1] * MB_IN_BYTES; + } elseif ( 'g' === $matches[2] ) { + $upload_max_filesize = (int) $matches[1] * GB_IN_BYTES; + } else { + $upload_max_filesize = (int) $matches[1]; + } + + $form_tags_manager = WPCF7_FormTagsManager::get_instance(); + + $tags = $form_tags_manager->filter( $content, array( + 'basetype' => 'file', + ) ); + + foreach ( $tags as $tag ) { + if ( $upload_max_filesize < $tag->get_limit_option() ) { + return true; + } + } + + return false; + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator/mail.php b/wp-content/plugins/contact-form-7/includes/config-validator/mail.php new file mode 100644 index 0000000..ef20b45 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator/mail.php @@ -0,0 +1,585 @@ + false, + 'callback' => + array( $this, 'replace_mail_tags_with_minimum_input_callback' ), + ) ); + + $content = new WPCF7_MailTaggedText( $content, $options ); + + return $content->replace_tags(); + } + + + /** + * Callback function for WPCF7_MailTaggedText. Replaces mail-tags with + * the most conservative inputs. + */ + public function replace_mail_tags_with_minimum_input_callback( $matches ) { + // allow [[foo]] syntax for escaping a tag + if ( '[' === $matches[1] and ']' === $matches[4] ) { + return substr( $matches[0], 1, -1 ); + } + + $tag = $matches[0]; + $tagname = $matches[2]; + $values = $matches[3]; + + $mail_tag = new WPCF7_MailTag( $tag, $tagname, $values ); + $field_name = $mail_tag->field_name(); + + $example_email = 'example@example.com'; + $example_text = 'example'; + $example_blank = ''; + + // for back-compat + $field_name = preg_replace( '/^wpcf7\./', '_', $field_name ); + + if ( '_site_admin_email' === $field_name ) { + return get_bloginfo( 'admin_email', 'raw' ); + + } elseif ( '_user_agent' === $field_name ) { + return $example_text; + + } elseif ( '_user_email' === $field_name ) { + return $this->contact_form->is_true( 'subscribers_only' ) + ? $example_email + : $example_blank; + + } elseif ( str_starts_with( $field_name, '_user_' ) ) { + return $this->contact_form->is_true( 'subscribers_only' ) + ? $example_text + : $example_blank; + + } elseif ( str_starts_with( $field_name, '_' ) ) { + return str_ends_with( $field_name, '_email' ) + ? $example_email + : $example_text; + + } + + static $opcalcset = array(); + + if ( ! isset( $opcalcset[$this->contact_form->id()] ) ) { + $opcalcset[$this->contact_form->id()] = + new WPCF7_MailTag_OutputCalculator( $this->contact_form ); + } + + $opcalc = $opcalcset[$this->contact_form->id()]; + $op = $opcalc->calc_output( $mail_tag ); + + if ( WPCF7_MailTag_OutputCalculator::email === $op ) { + return $example_email; + } elseif ( ! ( WPCF7_MailTag_OutputCalculator::blank & $op ) ) { + return $example_text; + } else { + return $example_blank; + } + } + + + /** + * Runs error detection for the mail sections. + */ + public function validate_mail( $template = 'mail' ) { + if ( + $this->contact_form->is_true( 'demo_mode' ) or + $this->contact_form->is_true( 'skip_mail' ) + ) { + return; + } + + $components = (array) $this->contact_form->prop( $template ); + + if ( ! $components ) { + return; + } + + if ( 'mail' !== $template and empty( $components['active'] ) ) { + return; + } + + $components = wp_parse_args( $components, array( + 'subject' => '', + 'sender' => '', + 'recipient' => '', + 'additional_headers' => '', + 'body' => '', + 'attachments' => '', + ) ); + + $this->validate_mail_subject( + $template, + $components['subject'] + ); + + $this->validate_mail_sender( + $template, + $components['sender'] + ); + + $this->validate_mail_recipient( + $template, + $components['recipient'] + ); + + $this->validate_mail_additional_headers( + $template, + $components['additional_headers'] + ); + + $this->validate_mail_body( + $template, + $components['body'] + ); + + $this->validate_mail_attachments( + $template, + $components['attachments'] + ); + } + + + /** + * Runs error detection for the mail subject section. + */ + public function validate_mail_subject( $template, $content ) { + $section = sprintf( '%s.subject', $template ); + + if ( $this->supports( 'maybe_empty' ) ) { + if ( $this->detect_maybe_empty( $section, $content ) ) { + $this->add_error( $section, 'maybe_empty', + array( + 'message' => __( 'There is a possible empty field.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'maybe_empty' ); + } + } + } + + + /** + * Runs error detection for the mail sender section. + */ + public function validate_mail_sender( $template, $content ) { + $section = sprintf( '%s.sender', $template ); + + if ( $this->supports( 'invalid_mailbox_syntax' ) ) { + if ( $this->detect_invalid_mailbox_syntax( $section, $content ) ) { + $this->add_error( $section, 'invalid_mailbox_syntax', + array( + 'message' => __( 'Invalid mailbox syntax is used.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'invalid_mailbox_syntax' ); + } + } + + if ( $this->supports( 'email_not_in_site_domain' ) ) { + $this->remove_error( $section, 'email_not_in_site_domain' ); + + if ( ! $this->has_error( $section, 'invalid_mailbox_syntax' ) ) { + $sender = $this->replace_mail_tags( $content ); + $sender = wpcf7_strip_newline( $sender ); + + if ( ! wpcf7_is_email_in_site_domain( $sender ) ) { + $this->add_error( $section, 'email_not_in_site_domain', + array( + 'message' => __( 'Sender email address does not belong to the site domain.', 'contact-form-7' ), + ) + ); + } + } + } + } + + + /** + * Runs error detection for the mail recipient section. + */ + public function validate_mail_recipient( $template, $content ) { + $section = sprintf( '%s.recipient', $template ); + + if ( $this->supports( 'invalid_mailbox_syntax' ) ) { + if ( $this->detect_invalid_mailbox_syntax( $section, $content ) ) { + $this->add_error( $section, 'invalid_mailbox_syntax', + array( + 'message' => __( 'Invalid mailbox syntax is used.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'invalid_mailbox_syntax' ); + } + } + + if ( $this->supports( 'unsafe_email_without_protection' ) ) { + $this->remove_error( $section, 'unsafe_email_without_protection' ); + + if ( ! $this->has_error( $section, 'invalid_mailbox_syntax' ) ) { + if ( + $this->detect_unsafe_email_without_protection( $section, $content ) + ) { + $this->add_error( $section, 'unsafe_email_without_protection', + array( + 'message' => __( 'Unsafe email config is used without sufficient protection.', 'contact-form-7' ), + ) + ); + } + } + } + } + + + /** + * Runs error detection for the mail additional headers section. + */ + public function validate_mail_additional_headers( $template, $content ) { + $section = sprintf( '%s.additional_headers', $template ); + + $invalid_mail_headers = array(); + $invalid_mailbox_fields = array(); + $unsafe_email_fields = array(); + + foreach ( explode( "\n", $content ) as $header ) { + $header = trim( $header ); + + if ( '' === $header ) { + continue; + } + + $is_valid_header = preg_match( + '/^([0-9A-Za-z-]+):(.*)$/', + $header, + $matches + ); + + if ( ! $is_valid_header ) { + $invalid_mail_headers[] = $header; + continue; + } + + $header_name = $matches[1]; + $header_value = trim( $matches[2] ); + + if ( + in_array( + strtolower( $header_name ), array( 'reply-to', 'cc', 'bcc' ), true + ) and + '' !== $header_value and + $this->detect_invalid_mailbox_syntax( $section, $header_value ) + ) { + $invalid_mailbox_fields[] = $header_name; + continue; + } + + if ( + in_array( strtolower( $header_name ), array( 'cc', 'bcc' ), true ) and + $this->detect_unsafe_email_without_protection( $section, $header_value ) + ) { + $unsafe_email_fields[] = $header_name; + } + } + + if ( $this->supports( 'invalid_mail_header' ) ) { + if ( ! empty( $invalid_mail_headers ) ) { + $this->add_error( $section, 'invalid_mail_header', + array( + 'message' => __( 'There are invalid mail header fields.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'invalid_mail_header' ); + } + } + + if ( $this->supports( 'invalid_mailbox_syntax' ) ) { + if ( ! empty( $invalid_mailbox_fields ) ) { + foreach ( $invalid_mailbox_fields as $header_name ) { + $this->add_error( $section, 'invalid_mailbox_syntax', + array( + 'message' => __( 'Invalid mailbox syntax is used in the %name% field.', 'contact-form-7' ), + 'params' => array( 'name' => $header_name ), + ) + ); + } + } else { + $this->remove_error( $section, 'invalid_mailbox_syntax' ); + } + } + + if ( $this->supports( 'unsafe_email_without_protection' ) ) { + if ( ! empty( $unsafe_email_fields ) ) { + $this->add_error( $section, 'unsafe_email_without_protection', + array( + 'message' => __( 'Unsafe email config is used without sufficient protection.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'unsafe_email_without_protection' ); + } + } + } + + + /** + * Runs error detection for the mail body section. + */ + public function validate_mail_body( $template, $content ) { + $section = sprintf( '%s.body', $template ); + + if ( $this->supports( 'maybe_empty' ) ) { + if ( $this->detect_maybe_empty( $section, $content ) ) { + $this->add_error( $section, 'maybe_empty', + array( + 'message' => __( 'There is a possible empty field.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'maybe_empty' ); + } + } + } + + + /** + * Runs error detection for the mail attachments section. + */ + public function validate_mail_attachments( $template, $content ) { + $section = sprintf( '%s.attachments', $template ); + + $total_size = 0; + $files_not_found = array(); + $files_out_of_content = array(); + + if ( '' !== $content ) { + $attachables = array(); + + $tags = $this->contact_form->scan_form_tags( + array( 'type' => array( 'file', 'file*' ) ) + ); + + foreach ( $tags as $tag ) { + $name = $tag->name; + + if ( ! str_contains( $content, "[{$name}]" ) ) { + continue; + } + + $limit = (int) $tag->get_limit_option(); + + if ( empty( $attachables[$name] ) or $attachables[$name] < $limit ) { + $attachables[$name] = $limit; + } + } + + $total_size = array_sum( $attachables ); + + foreach ( explode( "\n", $content ) as $line ) { + $line = trim( $line ); + + if ( '' === $line or str_starts_with( $line, '[' ) ) { + continue; + } + + if ( $this->detect_file_not_found( $section, $line ) ) { + $files_not_found[] = $line; + } elseif ( $this->detect_file_not_in_content_dir( $section, $line ) ) { + $files_out_of_content[] = $line; + } else { + $total_size += (int) @filesize( path_join( WP_CONTENT_DIR, $line ) ); + } + } + } + + if ( $this->supports( 'file_not_found' ) ) { + if ( ! empty( $files_not_found ) ) { + foreach ( $files_not_found as $line ) { + $this->add_error( $section, 'file_not_found', + array( + 'message' => __( 'Attachment file does not exist at %path%.', 'contact-form-7' ), + 'params' => array( 'path' => $line ), + ) + ); + } + } else { + $this->remove_error( $section, 'file_not_found' ); + } + } + + if ( $this->supports( 'file_not_in_content_dir' ) ) { + if ( ! empty( $files_out_of_content ) ) { + $this->add_error( $section, 'file_not_in_content_dir', + array( + 'message' => __( 'It is not allowed to use files outside the wp-content directory.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'file_not_in_content_dir' ); + } + } + + if ( $this->supports( 'attachments_overweight' ) ) { + $max = 25 * MB_IN_BYTES; // 25 MB + + if ( $max < $total_size ) { + $this->add_error( $section, 'attachments_overweight', + array( + 'message' => __( 'The total size of attachment files is too large.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'attachments_overweight' ); + } + } + } + + + /** + * Detects errors of invalid mailbox syntax. + * + * @link https://contactform7.com/configuration-errors/invalid-mailbox-syntax/ + */ + public function detect_invalid_mailbox_syntax( $section, $content ) { + $content = $this->replace_mail_tags( $content ); + $content = wpcf7_strip_newline( $content ); + + if ( ! wpcf7_is_mailbox_list( $content ) ) { + return true; + } + + return false; + } + + + /** + * Detects errors of empty message fields. + * + * @link https://contactform7.com/configuration-errors/maybe-empty/ + */ + public function detect_maybe_empty( $section, $content ) { + $content = $this->replace_mail_tags( $content ); + $content = wpcf7_strip_newline( $content ); + + if ( '' === $content ) { + return true; + } + + return false; + } + + + /** + * Detects errors of nonexistent attachment files. + * + * @link https://contactform7.com/configuration-errors/file-not-found/ + */ + public function detect_file_not_found( $section, $content ) { + $path = path_join( WP_CONTENT_DIR, $content ); + + if ( ! is_readable( $path ) or ! is_file( $path ) ) { + return true; + } + + return false; + } + + + /** + * Detects errors of attachment files out of the content directory. + * + * @link https://contactform7.com/configuration-errors/file-not-in-content-dir/ + */ + public function detect_file_not_in_content_dir( $section, $content ) { + $path = path_join( WP_CONTENT_DIR, $content ); + + if ( ! wpcf7_is_file_path_in_content_dir( $path ) ) { + return true; + } + + return false; + } + + + /** + * Detects errors of that unsafe email config is used without + * sufficient protection. + * + * @link https://contactform7.com/configuration-errors/unsafe-email-without-protection/ + */ + public function detect_unsafe_email_without_protection( $section, $content ) { + if ( $this->contact_form->is_true( 'subscribers_only' ) ) { + return false; + } + + static $is_captcha_active = null; + + if ( null === $is_captcha_active ) { + $is_captcha_active = call_user_func( static function () { + $recaptcha = WPCF7_RECAPTCHA::get_instance(); + $turnstile = WPCF7_Turnstile::get_instance(); + return $recaptcha->is_active() || $turnstile->is_active(); + } ); + } + + if ( $is_captcha_active ) { + return false; + } + + $example_email = 'user-specified@example.com'; + + // Replace mail-tags connected to an email type form-tag first. + $content = $this->replace_mail_tags( $content, array( + 'callback' => function ( $matches ) use ( $example_email ) { + // allow [[foo]] syntax for escaping a tag + if ( '[' === $matches[1] and ']' === $matches[4] ) { + return substr( $matches[0], 1, -1 ); + } + + $tag = $matches[0]; + $tagname = $matches[2]; + $values = $matches[3]; + + $mail_tag = new WPCF7_MailTag( $tag, $tagname, $values ); + $field_name = $mail_tag->field_name(); + + $form_tags = $this->contact_form->scan_form_tags( + array( 'name' => $field_name ) + ); + + if ( $form_tags ) { + $form_tag = new WPCF7_FormTag( $form_tags[0] ); + + if ( 'email' === $form_tag->basetype ) { + return $example_email; + } + } + + return $tag; + }, + ) ); + + // Replace remaining mail-tags. + $content = $this->replace_mail_tags( $content ); + + $content = wpcf7_strip_newline( $content ); + + if ( str_contains( $content, $example_email ) ) { + return true; + } + + return false; + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator/messages.php b/wp-content/plugins/contact-form-7/includes/config-validator/messages.php new file mode 100644 index 0000000..5417cf2 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator/messages.php @@ -0,0 +1,57 @@ +contact_form->prop( 'messages' ); + + if ( ! $messages ) { + return; + } + + if ( + isset( $messages['captcha_not_match'] ) and + ! wpcf7_use_really_simple_captcha() + ) { + unset( $messages['captcha_not_match'] ); + } + + foreach ( $messages as $key => $message ) { + $section = sprintf( 'messages.%s', $key ); + + if ( $this->supports( 'html_in_message' ) ) { + if ( $this->detect_html_in_message( $section, $message ) ) { + $this->add_error( $section, 'html_in_message', + array( + 'message' => __( 'HTML tags are used in a message.', 'contact-form-7' ), + ) + ); + } else { + $this->remove_error( $section, 'html_in_message' ); + } + } + } + } + + + /** + * Detects errors of HTML uses in a message. + * + * @link https://contactform7.com/configuration-errors/html-in-message/ + */ + public function detect_html_in_message( $section, $content ) { + $stripped = wp_strip_all_tags( $content ); + + if ( $stripped !== $content ) { + return true; + } + + return false; + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/config-validator/validator.php b/wp-content/plugins/contact-form-7/includes/config-validator/validator.php new file mode 100644 index 0000000..3ddcc25 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/config-validator/validator.php @@ -0,0 +1,386 @@ + null, + 'exclude' => null, + ) ); + + $this->contact_form = $contact_form; + + if ( isset( $options['include'] ) ) { + $this->include = (array) $options['include']; + } + + if ( isset( $options['exclude'] ) ) { + $this->exclude = (array) $options['exclude']; + } + } + + + /** + * Returns the contact form object that is tied to this validator. + */ + public function contact_form() { + return $this->contact_form; + } + + + /** + * Returns true if no error has been detected. + */ + public function is_valid() { + return ! $this->count_errors(); + } + + + /** + * Returns true if the given error code is supported by this instance. + */ + public function supports( $error_code ) { + if ( isset( $this->include ) ) { + $supported_codes = array_intersect( self::error_codes, $this->include ); + } else { + $supported_codes = self::error_codes; + } + + if ( isset( $this->exclude ) ) { + $supported_codes = array_diff( $supported_codes, $this->exclude ); + } + + return in_array( $error_code, $supported_codes, true ); + } + + + /** + * Counts detected errors. + */ + public function count_errors( $options = '' ) { + $options = wp_parse_args( $options, array( + 'section' => '', + 'code' => '', + ) ); + + $count = 0; + + foreach ( $this->errors as $key => $errors ) { + if ( preg_match( '/^mail_[0-9]+\.(.*)$/', $key, $matches ) ) { + $key = sprintf( 'mail.%s', $matches[1] ); + } + + if ( + $options['section'] and + $key !== $options['section'] and + preg_replace( '/\..*$/', '', $key, 1 ) !== $options['section'] + ) { + continue; + } + + foreach ( $errors as $error ) { + if ( empty( $error ) ) { + continue; + } + + if ( $options['code'] and $error['code'] !== $options['code'] ) { + continue; + } + + $count += 1; + } + } + + return $count; + } + + + /** + * Collects messages for detected errors. + */ + public function collect_error_messages( $options = '' ) { + $options = wp_parse_args( $options, array( + 'decodes_html_entities' => false, + ) ); + + $error_messages = array(); + + foreach ( $this->errors as $section => $errors ) { + $error_messages[$section] = array(); + + foreach ( $errors as $error ) { + if ( empty( $error['args']['message'] ) ) { + $message = $this->get_default_message( $error['code'] ); + } elseif ( empty( $error['args']['params'] ) ) { + $message = $error['args']['message']; + } else { + $message = $this->build_message( + $error['args']['message'], + $error['args']['params'] + ); + } + + if ( $options['decodes_html_entities'] ) { + $message = html_entity_decode( $message, ENT_HTML5 ); + } + + $link = ''; + + if ( ! empty( $error['args']['link'] ) ) { + $link = $error['args']['link']; + } + + $error_messages[$section][] = array( + 'message' => $message, + 'link' => esc_url( $link ), + ); + } + } + + return $error_messages; + } + + + /** + * Builds an error message by replacing placeholders. + */ + public function build_message( $message, $params = '' ) { + $params = wp_parse_args( $params, array() ); + + foreach ( $params as $key => $val ) { + if ( ! preg_match( '/^[0-9A-Za-z_]+$/', $key ) ) { // invalid key + continue; + } + + $placeholder = '%' . $key . '%'; + + if ( false !== stripos( $message, $placeholder ) ) { + $message = str_ireplace( $placeholder, $val, $message ); + } + } + + return $message; + } + + + /** + * Returns a default message that is used when the message for the error + * is not specified. + */ + public function get_default_message( $code = '' ) { + return __( 'Configuration error is detected.', 'contact-form-7' ); + } + + + /** + * Returns true if the specified section has the specified error. + * + * @param string $section The section where the error detected. + * @param string $code The unique code of the error. + */ + public function has_error( $section, $code ) { + if ( empty( $this->errors[$section] ) ) { + return false; + } + + foreach ( (array) $this->errors[$section] as $error ) { + if ( isset( $error['code'] ) and $error['code'] === $code ) { + return true; + } + } + + return false; + } + + + /** + * Adds a validation error. + * + * @param string $section The section where the error detected. + * @param string $code The unique code of the error. + * @param string|array $args Optional options for the error. + */ + public function add_error( $section, $code, $args = '' ) { + $args = wp_parse_args( $args, array( + 'message' => '', + 'params' => array(), + ) ); + + $available_error_codes = (array) apply_filters( + 'wpcf7_config_validator_available_error_codes', + self::error_codes, + $this->contact_form + ); + + if ( ! in_array( $code, $available_error_codes, true ) ) { + return false; + } + + if ( ! isset( $args['link'] ) ) { + $args['link'] = self::get_doc_link( $code ); + } + + if ( ! isset( $this->errors[$section] ) ) { + $this->errors[$section] = array(); + } + + $this->errors[$section][] = array( + 'code' => $code, + 'args' => $args, + ); + + return true; + } + + + /** + * Removes an error. + * + * @param string $section The section where the error detected. + * @param string $code The unique code of the error. + */ + public function remove_error( $section, $code ) { + if ( empty( $this->errors[$section] ) ) { + return; + } + + foreach ( (array) $this->errors[$section] as $key => $error ) { + if ( isset( $error['code'] ) and $error['code'] === $code ) { + unset( $this->errors[$section][$key] ); + } + } + + if ( empty( $this->errors[$section] ) ) { + unset( $this->errors[$section] ); + } + } + + + /** + * The main validation runner. + * + * @return bool True if there is no error detected. + */ + public function validate() { + $this->validate_form(); + $this->validate_mail( 'mail' ); + $this->validate_mail( 'mail_2' ); + $this->validate_messages(); + $this->validate_additional_settings(); + + do_action( 'wpcf7_config_validator_validate', $this ); + + return $this->is_valid(); + } + + + /** + * Saves detected errors as a post meta data. + */ + public function save() { + if ( $this->contact_form->initial() ) { + return; + } + + delete_post_meta( $this->contact_form->id(), '_config_validation' ); + + if ( $this->errors ) { + update_post_meta( + $this->contact_form->id(), '_config_validation', $this->errors + ); + } + } + + + /** + * Restore errors from the database. + */ + public function restore() { + $config_errors = get_post_meta( + $this->contact_form->id(), '_config_validation', true + ); + + foreach ( (array) $config_errors as $section => $errors ) { + if ( empty( $errors ) ) { + continue; + } + + foreach ( (array) $errors as $error ) { + if ( ! empty( $error['code'] ) ) { + $code = $error['code']; + $args = isset( $error['args'] ) ? $error['args'] : ''; + $this->add_error( $section, $code, $args ); + } + } + } + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/contact-form-functions.php b/wp-content/plugins/contact-form-7/includes/contact-form-functions.php new file mode 100644 index 0000000..fd8c3dc --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/contact-form-functions.php @@ -0,0 +1,479 @@ + array( + array( + 'key' => '_old_cf7_unit_id', + 'type' => 'DECIMAL', + 'value' => $old_id, + ), + ), + 'posts_per_page' => 1, + ) ); + + if ( empty( $contact_forms ) ) { + return null; + } + + return wpcf7_contact_form( $contact_forms[0] ); +} + + +/** + * Searches for a contact form by a hash string. + * + * @param string $hash Part of a hash string. + * @return WPCF7_ContactForm Contact form object. + */ +function wpcf7_get_contact_form_by_hash( $hash ) { + if ( ! preg_match( '/^[0-9a-f]{7,}$/', $hash ) ) { + return null; + } + + $contact_forms = WPCF7_ContactForm::find( array( + 'meta_query' => array( + array( + 'key' => '_hash', + 'compare' => 'REGEXP', + 'value' => '^' . $hash, + ), + ), + 'posts_per_page' => 1, + ) ); + + if ( $contact_forms ) { + return wpcf7_contact_form( $contact_forms[0] ); + } +} + + +/** + * Searches for a contact form by title. + * + * @param string $title Title of contact form. + * @return WPCF7_ContactForm|null Contact form object if found, null otherwise. + */ +function wpcf7_get_contact_form_by_title( $title ) { + if ( ! is_string( $title ) or '' === $title ) { + return null; + } + + $contact_forms = WPCF7_ContactForm::find( array( + 'title' => $title, + 'posts_per_page' => 1, + ) ); + + if ( $contact_forms ) { + return wpcf7_contact_form( $contact_forms[0] ); + } +} + + +/** + * Returns the contact form that is currently processed. + * + * This is a wrapper for WPCF7_ContactForm::get_current(). + * + * @return WPCF7_ContactForm|null Contact form object, or null if none is set. + */ +function wpcf7_get_current_contact_form(): ?WPCF7_ContactForm { + return WPCF7_ContactForm::get_current(); +} + + +/** + * Returns true if it is in the state that a non-Ajax submission is accepted. + */ +function wpcf7_is_posted() { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return false; + } + + return $contact_form->is_posted(); +} + + +/** + * Retrieves the user input value through a non-Ajax submission. + * + * @param string $name Name of form control. + * @param string $default_value Optional default value. + * @return string The user input value through the form-control. + */ +function wpcf7_get_hangover( $name, $default_value = null ) { + if ( ! wpcf7_is_posted() ) { + return $default_value; + } + + $submission = WPCF7_Submission::get_instance(); + + if ( ! $submission or $submission->is( 'mail_sent' ) ) { + return $default_value; + } + + return wpcf7_superglobal_post( $name, $default_value ); +} + + +/** + * Retrieves an HTML snippet of validation error on the given form control. + * + * @param string $name Name of form control. + * @return string Validation error message in a form of HTML snippet. + */ +function wpcf7_get_validation_error( $name ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return ''; + } + + return $contact_form->validation_error( $name ); +} + + +/** + * Returns a reference key to a validation error message. + * + * @param string $name Name of form control. + * @param string $unit_tag Optional. Unit tag of the contact form. + * @return string Reference key code. + */ +function wpcf7_get_validation_error_reference( $name, $unit_tag = '' ) { + if ( '' === $unit_tag ) { + $contact_form = wpcf7_get_current_contact_form(); + + if ( $contact_form and $contact_form->validation_error( $name ) ) { + $unit_tag = $contact_form->unit_tag(); + } else { + return null; + } + } + + return preg_replace( '/[^0-9a-z_-]+/i', '', + sprintf( + '%1$s-ve-%2$s', + $unit_tag, + $name + ) + ); +} + + +/** + * Retrieves a message for the given status. + */ +function wpcf7_get_message( $status ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) { + return ''; + } + + return $contact_form->message( $status ); +} + + +/** + * Returns a class names list for a form-tag of the specified type. + * + * @param string $type Form-tag type. + * @param string $default_classes Optional default classes. + * @return string Whitespace-separated list of class names. + */ +function wpcf7_form_controls_class( $type, $default_classes = '' ) { + $type = trim( $type ); + + if ( is_string( $default_classes ) ) { + $default_classes = explode( ' ', $default_classes ); + } + + $classes = array( + 'wpcf7-form-control', + sprintf( 'wpcf7-%s', rtrim( $type, '*' ) ), + ); + + if ( str_ends_with( $type, '*' ) ) { + $classes[] = 'wpcf7-validates-as-required'; + } + + $classes = array_merge( $classes, $default_classes ); + $classes = array_filter( array_unique( $classes ) ); + + return implode( ' ', $classes ); +} + + +/** + * Callback function for the contact-form-7 shortcode. + */ +function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) { + if ( is_feed() ) { + return '[contact-form-7]'; + } + + if ( 'contact-form-7' === $code ) { + $atts = shortcode_atts( + array( + 'id' => '', + 'title' => '', + 'html_id' => '', + 'html_name' => '', + 'html_title' => '', + 'html_class' => '', + 'output' => 'form', + ), + $atts, 'wpcf7' + ); + + $id = trim( $atts['id'] ); + $title = trim( $atts['title'] ); + + $contact_form = wpcf7_get_contact_form_by_hash( $id ); + + if ( ! $contact_form ) { + $contact_form = wpcf7_contact_form( $id ); + } + + if ( ! $contact_form ) { + $contact_form = wpcf7_get_contact_form_by_title( $title ); + } + + } else { + if ( is_string( $atts ) ) { + $atts = explode( ' ', $atts, 2 ); + } + + $id = (int) array_shift( $atts ); + $contact_form = wpcf7_get_contact_form_by_old_id( $id ); + } + + if ( ! $contact_form ) { + return sprintf( + '

                %1$s %2$s

                ', + esc_html( __( 'Error:', 'contact-form-7' ) ), + esc_html( __( "Contact form not found.", 'contact-form-7' ) ) + ); + } + + $callback = static function ( $contact_form, $atts ) { + return $contact_form->form_html( $atts ); + }; + + $output = wpcf7_switch_locale( + $contact_form->locale(), + $callback, + $contact_form, $atts + ); + + do_action( 'wpcf7_shortcode_callback', $contact_form, $atts ); + + return $output; +} + + +/** + * Saves the contact form data. + */ +function wpcf7_save_contact_form( $data = '', $context = 'save' ) { + $data = wp_parse_args( $data, array( + 'id' => -1, + 'title' => null, + 'locale' => null, + 'form' => null, + 'mail' => null, + 'mail_2' => null, + 'messages' => null, + 'additional_settings' => null, + ) ); + + $data['id'] = (int) $data['id']; + + if ( -1 === $data['id'] ) { + $contact_form = WPCF7_ContactForm::get_template(); + } else { + $contact_form = wpcf7_contact_form( $data['id'] ); + } + + if ( empty( $contact_form ) ) { + return false; + } + + if ( null !== $data['title'] ) { + $contact_form->set_title( $data['title'] ); + } + + if ( null !== $data['locale'] ) { + $contact_form->set_locale( $data['locale'] ); + } + + $properties = array(); + + if ( null !== $data['form'] ) { + $properties['form'] = wpcf7_sanitize_form( $data['form'] ); + } + + if ( null !== $data['mail'] ) { + $properties['mail'] = wpcf7_sanitize_mail( $data['mail'] ); + $properties['mail']['active'] = true; + } + + if ( null !== $data['mail_2'] ) { + $properties['mail_2'] = wpcf7_sanitize_mail( $data['mail_2'] ); + } + + if ( null !== $data['messages'] ) { + $properties['messages'] = wpcf7_sanitize_messages( $data['messages'] ); + } + + if ( null !== $data['additional_settings'] ) { + $properties['additional_settings'] = wpcf7_sanitize_additional_settings( + $data['additional_settings'] + ); + } + + $contact_form->set_properties( $properties ); + + do_action( 'wpcf7_save_contact_form', $contact_form, $data, $context ); + + if ( 'save' === $context ) { + $contact_form->save(); + } + + return $contact_form; +} + + +/** + * Sanitizes the form property data. + */ +function wpcf7_sanitize_form( $input, $default_template = '' ) { + if ( null === $input ) { + return $default_template; + } + + $output = trim( $input ); + + if ( ! current_user_can( 'unfiltered_html' ) ) { + $output = wpcf7_kses( $output, 'form' ); + } + + return $output; +} + + +/** + * Sanitizes the mail property data. + */ +function wpcf7_sanitize_mail( $input, $defaults = array() ) { + $input = wp_parse_args( $input, array( + 'active' => false, + 'subject' => '', + 'sender' => '', + 'recipient' => '', + 'body' => '', + 'additional_headers' => '', + 'attachments' => '', + 'use_html' => false, + 'exclude_blank' => false, + ) ); + + $input = wp_parse_args( $input, $defaults ); + + $output = array(); + $output['active'] = (bool) $input['active']; + $output['subject'] = trim( $input['subject'] ); + $output['sender'] = trim( $input['sender'] ); + $output['recipient'] = trim( $input['recipient'] ); + $output['body'] = trim( $input['body'] ); + + if ( ! current_user_can( 'unfiltered_html' ) ) { + $output['body'] = wpcf7_kses( $output['body'], 'mail' ); + } + + $output['additional_headers'] = ''; + + $headers = str_replace( "\r\n", "\n", $input['additional_headers'] ); + $headers = explode( "\n", $headers ); + + foreach ( $headers as $header ) { + $header = trim( $header ); + + if ( '' !== $header ) { + $output['additional_headers'] .= $header . "\n"; + } + } + + $output['additional_headers'] = trim( $output['additional_headers'] ); + $output['attachments'] = trim( $input['attachments'] ); + $output['use_html'] = (bool) $input['use_html']; + $output['exclude_blank'] = (bool) $input['exclude_blank']; + + return $output; +} + + +/** + * Sanitizes the messages property data. + */ +function wpcf7_sanitize_messages( $input, $defaults = array() ) { + $output = array(); + + foreach ( wpcf7_messages() as $key => $val ) { + if ( isset( $input[$key] ) ) { + $output[$key] = trim( $input[$key] ); + } elseif ( isset( $defaults[$key] ) ) { + $output[$key] = $defaults[$key]; + } + } + + return $output; +} + + +/** + * Sanitizes the additional settings property data. + */ +function wpcf7_sanitize_additional_settings( $input, $default_template = '' ) { + if ( null === $input ) { + return $default_template; + } + + $output = trim( $input ); + return $output; +} + + +/** + * Generates a random hash string for a contact form. + * + * @param int $post_id Post ID. + * @return string SHA-1 hash. + */ +function wpcf7_generate_contact_form_hash( $post_id ) { + return hash( 'sha256', implode( '|', array( + get_current_user_id(), + $post_id, + time(), + home_url(), + ) ) ); +} diff --git a/wp-content/plugins/contact-form-7/includes/contact-form-template.php b/wp-content/plugins/contact-form-7/includes/contact-form-template.php new file mode 100644 index 0000000..a120552 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/contact-form-template.php @@ -0,0 +1,206 @@ + %2$s + [text* your-name autocomplete:name] + + + + + + + +[submit "%6$s"]', + __( '(optional)', 'contact-form-7' ), + __( 'Your name', 'contact-form-7' ), + __( 'Your email', 'contact-form-7' ), + __( 'Subject', 'contact-form-7' ), + __( 'Your message', 'contact-form-7' ), + __( 'Submit', 'contact-form-7' ) + ); + + return trim( $template ); + } + + public static function mail() { + $template = array( + 'subject' => sprintf( + /* translators: 1: blog name, 2: [your-subject] */ + _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ), + '[_site_title]', + '[your-subject]' + ), + 'sender' => sprintf( + '%s <%s>', + '[_site_title]', + self::from_email() + ), + 'body' => + sprintf( + /* translators: %s: [your-name] [your-email] */ + __( 'From: %s', 'contact-form-7' ), + '[your-name] [your-email]' + ) . "\n" + . sprintf( + /* translators: %s: [your-subject] */ + __( 'Subject: %s', 'contact-form-7' ), + '[your-subject]' + ) . "\n\n" + . __( 'Message Body:', 'contact-form-7' ) + . "\n" . '[your-message]' . "\n\n" + . '-- ' . "\n" + . sprintf( + /* translators: 1: blog name, 2: blog URL */ + __( 'This is a notification that a contact form was submitted on your website (%1$s %2$s).', 'contact-form-7' ), + '[_site_title]', + '[_site_url]' + ), + 'recipient' => '[_site_admin_email]', + 'additional_headers' => 'Reply-To: [your-email]', + 'attachments' => '', + 'use_html' => 0, + 'exclude_blank' => 0, + ); + + return $template; + } + + public static function mail_2() { + $template = array( + 'active' => false, + 'subject' => sprintf( + /* translators: 1: blog name, 2: [your-subject] */ + _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ), + '[_site_title]', + '[your-subject]' + ), + 'sender' => sprintf( + '%s <%s>', + '[_site_title]', + self::from_email() + ), + 'body' => + __( 'Message Body:', 'contact-form-7' ) + . "\n" . '[your-message]' . "\n\n" + . '-- ' . "\n" + . sprintf( + /* translators: 1: blog name, 2: blog URL */ + __( 'This email is a receipt for your contact form submission on our website (%1$s %2$s) in which your email address was used. If that was not you, please ignore this message.', 'contact-form-7' ), + '[_site_title]', + '[_site_url]' + ), + 'recipient' => '[your-email]', + 'additional_headers' => sprintf( + 'Reply-To: %s', + '[_site_admin_email]' + ), + 'attachments' => '', + 'use_html' => 0, + 'exclude_blank' => 0, + ); + + return $template; + } + + public static function from_email() { + $admin_email = get_option( 'admin_email' ); + + if ( wpcf7_is_localhost() ) { + return $admin_email; + } + + $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); + $sitename = strtolower( $sitename ); + + if ( 'www.' === substr( $sitename, 0, 4 ) ) { + $sitename = substr( $sitename, 4 ); + } + + if ( strpbrk( $admin_email, '@' ) === '@' . $sitename ) { + return $admin_email; + } + + return 'wordpress@' . $sitename; + } + + public static function messages() { + $messages = array(); + + foreach ( wpcf7_messages() as $key => $arr ) { + $messages[$key] = $arr['default']; + } + + return $messages; + } +} + +function wpcf7_messages() { + $messages = array( + 'mail_sent_ok' => array( + 'description' => __( 'Sender’s message was sent successfully', 'contact-form-7' ), + 'default' => __( 'Thank you for your message. It has been sent.', 'contact-form-7' ), + ), + + 'mail_sent_ng' => array( + 'description' => __( 'Sender’s message failed to send', 'contact-form-7' ), + 'default' => __( 'There was an error trying to send your message. Please try again later.', 'contact-form-7' ), + ), + + 'validation_error' => array( + 'description' => __( 'Validation errors occurred', 'contact-form-7' ), + 'default' => __( 'One or more fields have an error. Please check and try again.', 'contact-form-7' ), + ), + + 'spam' => array( + 'description' => __( 'Submission was referred to as spam', 'contact-form-7' ), + 'default' => __( 'There was an error trying to send your message. Please try again later.', 'contact-form-7' ), + ), + + 'accept_terms' => array( + 'description' => __( 'There are terms that the sender must accept', 'contact-form-7' ), + 'default' => __( 'You must accept the terms and conditions before sending your message.', 'contact-form-7' ), + ), + + 'invalid_required' => array( + 'description' => __( 'There is a field that the sender must fill in', 'contact-form-7' ), + 'default' => __( 'Please fill out this field.', 'contact-form-7' ), + ), + + 'invalid_too_long' => array( + 'description' => __( 'There is a field with input that is longer than the maximum allowed length', 'contact-form-7' ), + 'default' => __( 'This field has a too long input.', 'contact-form-7' ), + ), + + 'invalid_too_short' => array( + 'description' => __( 'There is a field with input that is shorter than the minimum allowed length', 'contact-form-7' ), + 'default' => __( 'This field has a too short input.', 'contact-form-7' ), + ), + ); + + return apply_filters( 'wpcf7_messages', $messages ); +} diff --git a/wp-content/plugins/contact-form-7/includes/contact-form.php b/wp-content/plugins/contact-form-7/includes/contact-form.php new file mode 100644 index 0000000..f09dc2e --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/contact-form.php @@ -0,0 +1,1381 @@ + array( + 'name' => __( 'Contact Forms', 'contact-form-7' ), + 'singular_name' => __( 'Contact Form', 'contact-form-7' ), + ), + 'rewrite' => false, + 'query_var' => false, + 'public' => false, + 'capability_type' => 'page', + 'capabilities' => array( + 'edit_post' => 'wpcf7_edit_contact_form', + 'read_post' => 'wpcf7_read_contact_form', + 'delete_post' => 'wpcf7_delete_contact_form', + 'edit_posts' => 'wpcf7_edit_contact_forms', + 'edit_others_posts' => 'wpcf7_edit_contact_forms', + 'publish_posts' => 'wpcf7_edit_contact_forms', + 'read_private_posts' => 'wpcf7_edit_contact_forms', + ), + ) ); + } + + + /** + * Retrieves contact form data that match given conditions. + * + * @param string|array $args Optional. Arguments to be passed to WP_Query. + * @return array Array of WPCF7_ContactForm objects. + */ + public static function find( $args = '' ) { + $defaults = array( + 'post_status' => 'any', + 'posts_per_page' => -1, + 'offset' => 0, + 'orderby' => 'ID', + 'order' => 'ASC', + ); + + $args = wp_parse_args( $args, $defaults ); + + $args['post_type'] = self::post_type; + + $q = new WP_Query(); + $posts = $q->query( $args ); + + self::$found_items = $q->found_posts; + + $objs = array(); + + foreach ( $posts as $post ) { + $objs[] = new self( $post ); + } + + return $objs; + } + + + /** + * Returns a contact form data filled by default template contents. + * + * @param string|array $options Optional. Contact form options. + * @return WPCF7_ContactForm A new contact form object. + */ + public static function get_template( $options = '' ) { + $options = wp_parse_args( $options, array( + 'locale' => null, + 'title' => __( 'Untitled', 'contact-form-7' ), + ) ); + + if ( ! isset( $options['locale'] ) ) { + $options['locale'] = determine_locale(); + } + + $callback = static function ( $options ) { + $contact_form = new self(); + $contact_form->title = $options['title']; + $contact_form->locale = $options['locale']; + + $properties = $contact_form->get_properties(); + + foreach ( $properties as $key => $value ) { + $default_template = WPCF7_ContactFormTemplate::get_default( $key ); + + if ( isset( $default_template ) ) { + $properties[$key] = $default_template; + } + } + + $contact_form->properties = $properties; + + return $contact_form; + }; + + $contact_form = wpcf7_switch_locale( + $options['locale'], + $callback, + $options + ); + + self::$current = apply_filters( 'wpcf7_contact_form_default_pack', + $contact_form, $options + ); + + return self::$current; + } + + + /** + * Creates a WPCF7_ContactForm object and sets it as the current instance. + * + * @param WPCF7_ContactForm|WP_Post|int $post Object or post ID. + * @return WPCF7_ContactForm|null Contact form object. Null if unset. + */ + public static function get_instance( $post ) { + $contact_form = null; + + if ( $post instanceof self ) { + $contact_form = $post; + } elseif ( ! empty( $post ) ) { + $post = get_post( $post ); + + if ( isset( $post ) and self::post_type === get_post_type( $post ) ) { + $contact_form = new self( $post ); + } + } + + return self::$current = $contact_form; + } + + + /** + * Generates a "unit-tag" for the given contact form ID. + * + * @return string Unit-tag. + */ + private static function generate_unit_tag( $id = 0 ) { + static $global_count = 0; + + $global_count += 1; + + if ( in_the_loop() ) { + $unit_tag = sprintf( 'wpcf7-f%1$d-p%2$d-o%3$d', + absint( $id ), + get_the_ID(), + $global_count + ); + } else { + $unit_tag = sprintf( 'wpcf7-f%1$d-o%2$d', + absint( $id ), + $global_count + ); + } + + return $unit_tag; + } + + + /** + * Constructor. + */ + private function __construct( $post = null ) { + $post = get_post( $post ); + + if ( $post and self::post_type === get_post_type( $post ) ) { + $this->id = $post->ID; + $this->name = $post->post_name; + $this->title = $post->post_title; + $this->locale = get_post_meta( $post->ID, '_locale', true ); + $this->hash = get_post_meta( $post->ID, '_hash', true ); + + $this->construct_properties( $post ); + $this->upgrade(); + } else { + $this->construct_properties(); + } + + do_action( 'wpcf7_contact_form', $this ); + } + + + /** + * Magic method for property overloading. + */ + public function __get( $name ) { + /* translators: 1: property name, 2: method name */ + $message = __( '%1$s property of a WPCF7_ContactForm object is no longer accessible. Use %2$s method instead.', 'contact-form-7' ); + + if ( 'id' === $name ) { + wp_trigger_error( + '', + sprintf( $message, 'id', 'id()' ), + E_USER_DEPRECATED + ); + + return $this->id; + } elseif ( 'title' === $name ) { + wp_trigger_error( + '', + sprintf( $message, 'title', 'title()' ), + E_USER_DEPRECATED + ); + + return $this->title; + } elseif ( $prop = $this->prop( $name ) ) { + wp_trigger_error( + '', + sprintf( $message, $name, 'prop(\'' . $name . '\')' ), + E_USER_DEPRECATED + ); + + return $prop; + } + } + + + /** + * Returns true if this contact form is not yet saved to the database. + */ + public function initial() { + return empty( $this->id ); + } + + + /** + * Constructs contact form properties. This is called only once + * from the constructor. + */ + private function construct_properties( $post = null ) { + $builtin_properties = array( + 'form' => '', + 'mail' => array(), + 'mail_2' => array(), + 'messages' => array(), + 'additional_settings' => '', + ); + + $properties = apply_filters( + 'wpcf7_pre_construct_contact_form_properties', + $builtin_properties, $this + ); + + // Filtering out properties with invalid name + $properties = array_filter( + $properties, + static function ( $key ) { + $sanitized_key = sanitize_key( $key ); + return $key === $sanitized_key; + }, + ARRAY_FILTER_USE_KEY + ); + + foreach ( $properties as $name => $val ) { + $prop = $this->retrieve_property( $name ); + + if ( isset( $prop ) ) { + $properties[$name] = $prop; + } + } + + $this->properties = $properties; + + foreach ( $properties as $name => $val ) { + $properties[$name] = apply_filters( + "wpcf7_contact_form_property_{$name}", + $val, $this + ); + } + + $this->properties = $properties; + + $properties = (array) apply_filters( + 'wpcf7_contact_form_properties', + $properties, $this + ); + + $this->properties = $properties; + } + + + /** + * Retrieves contact form property of the specified name from the database. + * + * @param string $name Property name. + * @return array|string|null Property value. Null if property does not exist. + */ + private function retrieve_property( $name ) { + $property = null; + + if ( ! $this->initial() ) { + $post_id = $this->id; + + if ( metadata_exists( 'post', $post_id, '_' . $name ) ) { + $property = get_post_meta( $post_id, '_' . $name, true ); + } elseif ( metadata_exists( 'post', $post_id, $name ) ) { + $property = get_post_meta( $post_id, $name, true ); + } + } + + return $property; + } + + + /** + * Returns the value for the given property name. + * + * @param string $name Property name. + * @return array|string|null Property value. Null if property does not exist. + */ + public function prop( $name ) { + $props = $this->get_properties(); + return isset( $props[$name] ) ? $props[$name] : null; + } + + + /** + * Returns all the properties. + * + * @return array This contact form's properties. + */ + public function get_properties() { + return (array) $this->properties; + } + + + /** + * Updates properties. + * + * @param array $properties New properties. + */ + public function set_properties( $properties ) { + $defaults = $this->get_properties(); + + $properties = wp_parse_args( $properties, $defaults ); + $properties = array_intersect_key( $properties, $defaults ); + + $this->properties = $properties; + } + + + /** + * Returns ID of this contact form. + * + * @return int The ID. + */ + public function id() { + return $this->id; + } + + + /** + * Returns unit-tag for this contact form. + * + * @return string Unit-tag. + */ + public function unit_tag() { + return $this->unit_tag; + } + + + /** + * Returns name (slug) of this contact form. + * + * @return string Name. + */ + public function name() { + return $this->name; + } + + + /** + * Returns title of this contact form. + * + * @return string Title. + */ + public function title() { + return $this->title; + } + + + /** + * Set a title for this contact form. + * + * @param string $title Title. + */ + public function set_title( $title ) { + $title = wp_strip_all_tags( $title, true ); + $title = wpcf7_strip_whitespaces( $title ); + + if ( '' === $title ) { + $title = __( 'Untitled', 'contact-form-7' ); + } + + $this->title = $title; + } + + + /** + * Returns the locale code of this contact form. + * + * @return string Locale code. Empty string if no valid locale is set. + */ + public function locale() { + if ( wpcf7_is_valid_locale( $this->locale ) ) { + return $this->locale; + } else { + return ''; + } + } + + + /** + * Sets a locale for this contact form. + * + * @param string $locale Locale code. + */ + public function set_locale( $locale ) { + $locale = trim( $locale ); + + if ( wpcf7_is_valid_locale( $locale ) ) { + $this->locale = $locale; + } else { + $this->locale = 'en_US'; + } + } + + + /** + * Retrieves the random hash string tied to this contact form. + * + * @param int $length Length of hash string. + * @return string Hash string unique to this contact form. + */ + public function hash( $length = 7 ) { + return substr( $this->hash, 0, absint( $length ) ); + } + + + /** + * Returns the specified shortcode attribute value. + * + * @param string $name Shortcode attribute name. + * @return string|null Attribute value. Null if the attribute does not exist. + */ + public function shortcode_attr( $name ) { + if ( isset( $this->shortcode_atts[$name] ) ) { + return (string) $this->shortcode_atts[$name]; + } + } + + + /** + * Returns true if this contact form is identical to the submitted one. + */ + public function is_posted() { + if ( ! WPCF7_Submission::get_instance() ) { + return false; + } + + $unit_tag = wpcf7_superglobal_post( '_wpcf7_unit_tag' ); + + if ( empty( $unit_tag ) ) { + return false; + } + + return $this->unit_tag() === $unit_tag; + } + + + /** + * Generates HTML that represents a form. + * + * @param string|array $options Optional. Form options. + * @return string HTML output. + */ + public function form_html( $options = '' ) { + $options = wp_parse_args( $options, array( + 'html_id' => '', + 'html_name' => '', + 'html_title' => '', + 'html_class' => '', + 'output' => 'form', + ) ); + + $this->shortcode_atts = $options; + + if ( 'raw_form' === $options['output'] ) { + return sprintf( + '
                %s
                ', + esc_html( $this->prop( 'form' ) ) + ); + } + + if ( + $this->is_true( 'subscribers_only' ) and + ! current_user_can( 'wpcf7_submit', $this->id() ) + ) { + $notice = sprintf( + '

                %s

                ', + wp_kses_data( __( 'This contact form is available only for logged in users.', 'contact-form-7' ) ) + ); + + return apply_filters( 'wpcf7_subscribers_only_notice', $notice, $this ); + } + + $this->unit_tag = self::generate_unit_tag( $this->id ); + + $action_url = wpcf7_get_request_uri(); + + if ( $frag = strstr( $action_url, '#' ) ) { + $action_url = substr( $action_url, 0, -strlen( $frag ) ); + } + + $action_url .= '#' . $this->unit_tag(); + + $action_url = apply_filters( 'wpcf7_form_action_url', $action_url ); + + if ( + str_starts_with( $action_url, '//' ) or + ! str_starts_with( $action_url, '/' ) and + ! str_starts_with( $action_url, home_url() ) + ) { + return sprintf( + '

                %1$s %2$s

                ', + esc_html( __( 'Error:', 'contact-form-7' ) ), + esc_html( __( 'Invalid action URL is detected.', 'contact-form-7' ) ) + ); + } + + $lang_tag = str_replace( '_', '-', $this->locale ); + + if ( preg_match( '/^([a-z]+-[a-z]+)-/i', $lang_tag, $matches ) ) { + $lang_tag = $matches[1]; + } + + $html = "\n" . sprintf( '
                ', + wpcf7_format_atts( array( + 'class' => 'wpcf7 no-js', + 'id' => $this->unit_tag(), + ( get_option( 'html_type' ) === 'text/html' ) ? 'lang' : 'xml:lang' + => $lang_tag, + 'dir' => wpcf7_is_rtl( $this->locale ) ? 'rtl' : 'ltr', + 'data-wpcf7-id' => $this->id(), + ) ) + ); + + $html .= "\n" . $this->screen_reader_response() . "\n"; + + $id_attr = apply_filters( 'wpcf7_form_id_attr', + preg_replace( '/[^A-Za-z0-9:._-]/', '', $options['html_id'] ) + ); + + $name_attr = apply_filters( 'wpcf7_form_name_attr', + preg_replace( '/[^A-Za-z0-9:._-]/', '', $options['html_name'] ) + ); + + $title_attr = apply_filters( 'wpcf7_form_title_attr', $options['html_title'] ); + + $class = 'wpcf7-form'; + + if ( $this->is_posted() ) { + $submission = WPCF7_Submission::get_instance(); + + $data_status_attr = $this->form_status_class_name( + $submission->get_status() + ); + + $class .= sprintf( ' %s', $data_status_attr ); + } else { + $data_status_attr = 'init'; + $class .= ' init'; + } + + if ( $options['html_class'] ) { + $class .= ' ' . $options['html_class']; + } + + if ( $this->in_demo_mode() ) { + $class .= ' demo'; + } + + $class = explode( ' ', $class ); + $class = array_map( 'sanitize_html_class', $class ); + $class = array_filter( $class ); + $class = array_unique( $class ); + $class = implode( ' ', $class ); + $class = apply_filters( 'wpcf7_form_class_attr', $class ); + + $enctype = wpcf7_enctype_value( apply_filters( 'wpcf7_form_enctype', '' ) ); + $autocomplete = apply_filters( 'wpcf7_form_autocomplete', '' ); + + $atts = array( + 'action' => esc_url( $action_url ), + 'method' => 'post', + 'class' => ( '' !== $class ) ? $class : null, + 'id' => ( '' !== $id_attr ) ? $id_attr : null, + 'name' => ( '' !== $name_attr ) ? $name_attr : null, + 'aria-label' => ( '' !== $title_attr ) + ? $title_attr : __( 'Contact form', 'contact-form-7' ), + 'enctype' => ( '' !== $enctype ) ? $enctype : null, + 'autocomplete' => ( '' !== $autocomplete ) ? $autocomplete : null, + 'novalidate' => true, + 'data-status' => $data_status_attr, + ); + + $atts += (array) apply_filters( 'wpcf7_form_additional_atts', array() ); + + $html .= sprintf( '
                ', wpcf7_format_atts( $atts ) ) . "\n"; + $html .= $this->form_hidden_fields(); + $html .= $this->form_elements(); + + if ( ! $this->responses_count ) { + $html .= $this->form_response_output(); + } + + $html .= "\n" . '
                '; + $html .= "\n" . '
                '; + + return $html . "\n"; + } + + + /** + * Returns the class name that matches the given form status. + */ + private function form_status_class_name( $status ) { + switch ( $status ) { + case 'init': + $class = 'init'; + break; + case 'validation_failed': + $class = 'invalid'; + break; + case 'acceptance_missing': + $class = 'unaccepted'; + break; + case 'spam': + $class = 'spam'; + break; + case 'aborted': + $class = 'aborted'; + break; + case 'mail_sent': + $class = 'sent'; + break; + case 'mail_failed': + $class = 'failed'; + break; + default: + $class = sprintf( + 'custom-%s', + preg_replace( '/[^0-9a-z]+/i', '-', $status ) + ); + } + + return $class; + } + + + /** + * Returns a set of hidden fields. + */ + private function form_hidden_fields() { + $hidden_fields = array( + '_wpcf7' => $this->id(), + '_wpcf7_version' => WPCF7_VERSION, + '_wpcf7_locale' => $this->locale(), + '_wpcf7_unit_tag' => $this->unit_tag(), + '_wpcf7_container_post' => 0, + '_wpcf7_posted_data_hash' => '', + ); + + if ( in_the_loop() ) { + $hidden_fields['_wpcf7_container_post'] = (int) get_the_ID(); + } + + if ( $this->nonce_is_active() and is_user_logged_in() ) { + $hidden_fields['_wpnonce'] = wpcf7_create_nonce(); + } + + $hidden_fields += (array) apply_filters( + 'wpcf7_form_hidden_fields', array() + ); + + $formatter = new WPCF7_HTMLFormatter(); + + $formatter->append_start_tag( 'fieldset', array( + 'class' => 'hidden-fields-container', + ) ); + + foreach ( $hidden_fields as $name => $value ) { + $formatter->append_start_tag( 'input', array( + 'type' => 'hidden', + 'name' => $name, + 'value' => $value, + ) ); + } + + return $formatter->output() . "\n"; + } + + + /** + * Returns the visible response output for a form submission. + */ + public function form_response_output() { + $status = 'init'; + $class = 'wpcf7-response-output'; + $content = ''; + + if ( $this->is_posted() ) { // Post response output for non-AJAX + $submission = WPCF7_Submission::get_instance(); + $status = $submission->get_status(); + $content = $submission->get_response(); + } + + $atts = array( + 'class' => trim( $class ), + 'aria-hidden' => 'true', + ); + + $output = sprintf( '
                %2$s
                ', + wpcf7_format_atts( $atts ), + esc_html( $content ) + ); + + $output = apply_filters( 'wpcf7_form_response_output', + $output, $class, $content, $this, $status + ); + + $this->responses_count += 1; + + return $output; + } + + + /** + * Returns the response output that is only accessible from screen readers. + */ + public function screen_reader_response() { + $primary_response = ''; + $validation_errors = array(); + + if ( $this->is_posted() ) { // Post response output for non-AJAX + $submission = WPCF7_Submission::get_instance(); + $primary_response = $submission->get_response(); + + if ( $invalid_fields = $submission->get_invalid_fields() ) { + foreach ( (array) $invalid_fields as $name => $field ) { + $list_item = esc_html( $field['reason'] ); + + if ( $field['idref'] ) { + $list_item = sprintf( + '%2$s', + esc_attr( $field['idref'] ), + $list_item + ); + } + + $validation_error_id = wpcf7_get_validation_error_reference( + $name, + $this->unit_tag() + ); + + if ( $validation_error_id ) { + $list_item = sprintf( + '
              • %2$s
              • ', + esc_attr( $validation_error_id ), + $list_item + ); + + $validation_errors[] = $list_item; + } + } + } + } + + $primary_response = sprintf( + '

                %s

                ', + esc_html( $primary_response ) + ); + + $validation_errors = sprintf( + '
                  %s
                ', + implode( "\n", $validation_errors ) + ); + + $output = sprintf( + '
                %1$s %2$s
                ', + $primary_response, + $validation_errors + ); + + return $output; + } + + + /** + * Returns a validation error for the specified input field. + * + * @param string $name Input field name. + */ + public function validation_error( $name ) { + $error = ''; + + if ( $this->is_posted() ) { + $submission = WPCF7_Submission::get_instance(); + + if ( $invalid_field = $submission->get_invalid_field( $name ) ) { + $error = trim( $invalid_field['reason'] ); + } + } + + if ( ! $error ) { + return $error; + } + + $atts = array( + 'class' => 'wpcf7-not-valid-tip', + 'aria-hidden' => 'true', + ); + + $error = sprintf( + '%2$s', + wpcf7_format_atts( $atts ), + esc_html( $error ) + ); + + return apply_filters( 'wpcf7_validation_error', $error, $name, $this ); + } + + + /** + * Replaces all form-tags in the form template with corresponding HTML. + * + * @return string Replaced form content. + */ + public function replace_all_form_tags() { + $manager = WPCF7_FormTagsManager::get_instance(); + $form = $this->prop( 'form' ); + + if ( wpcf7_autop_or_not() ) { + $form = $manager->replace_with_placeholders( $form ); + $form = wpcf7_autop( $form ); + $form = $manager->restore_from_placeholders( $form ); + } + + $form = $manager->replace_all( $form ); + $this->scanned_form_tags = $manager->get_scanned_tags(); + + return $form; + } + + + /** + * Replaces all form-tags in the form template with corresponding HTML. + * + * @deprecated 4.6 Use replace_all_form_tags() + * + * @return string Replaced form content. + */ + public function form_do_shortcode() { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_ContactForm::replace_all_form_tags' + ); + + return $this->replace_all_form_tags(); + } + + + /** + * Scans form-tags from the form template. + * + * @param string|array|null $cond Optional. Filters. Default null. + * @return array Form-tags matching the given filter conditions. + */ + public function scan_form_tags( $cond = null ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + if ( empty( $this->scanned_form_tags ) ) { + $this->scanned_form_tags = $manager->scan( $this->prop( 'form' ) ); + } + + $tags = $this->scanned_form_tags; + + return $manager->filter( $tags, $cond ); + } + + + /** + * Scans form-tags from the form template. + * + * @deprecated 4.6 Use scan_form_tags() + * + * @param string|array|null $cond Optional. Filters. Default null. + * @return array Form-tags matching the given filter conditions. + */ + public function form_scan_shortcode( $cond = null ) { + wpcf7_deprecated_function( __METHOD__, '4.6', + 'WPCF7_ContactForm::scan_form_tags' + ); + + return $this->scan_form_tags( $cond ); + } + + + /** + * Replaces all form-tags in the form template with corresponding HTML. + * + * @return string Replaced form content. wpcf7_form_elements filters applied. + */ + public function form_elements() { + return apply_filters( 'wpcf7_form_elements', + $this->replace_all_form_tags() + ); + } + + + /** + * Collects mail-tags available for this contact form. + * + * @param string|array $options Optional. Search options. + * @return array Mail-tag names. + */ + public function collect_mail_tags( $options = '' ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + $options = wp_parse_args( $options, array( + 'include' => array(), + 'exclude' => $manager->collect_tag_types( 'not-for-mail' ), + ) ); + + $tags = $this->scan_form_tags(); + $mailtags = array(); + + foreach ( (array) $tags as $tag ) { + $type = $tag->basetype; + + if ( empty( $type ) ) { + continue; + } elseif ( ! empty( $options['include'] ) ) { + if ( ! in_array( $type, $options['include'], true ) ) { + continue; + } + } elseif ( ! empty( $options['exclude'] ) ) { + if ( in_array( $type, $options['exclude'], true ) ) { + continue; + } + } + + $mailtags[] = $tag->name; + } + + $mailtags = array_unique( $mailtags ); + $mailtags = array_filter( $mailtags ); + $mailtags = array_values( $mailtags ); + + return apply_filters( 'wpcf7_collect_mail_tags', $mailtags, $options, $this ); + } + + + /** + * Prints a mail-tag suggestion list. + * + * @param string $template_name Optional. Mail template name. Default 'mail'. + */ + public function suggest_mail_tags( $template_name = 'mail' ) { + $mail = wp_parse_args( $this->prop( $template_name ), + array( + 'active' => false, + 'recipient' => '', + 'sender' => '', + 'subject' => '', + 'body' => '', + 'additional_headers' => '', + 'attachments' => '', + 'use_html' => false, + 'exclude_blank' => false, + ) + ); + + $mail = array_filter( $mail ); + + foreach ( (array) $this->collect_mail_tags() as $mail_tag ) { + $pattern = sprintf( + '/\[(_[a-z]+_)?%s([ \t]+[^]]+)?\]/', + preg_quote( $mail_tag, '/' ) + ); + + $used = preg_grep( $pattern, $mail ); + + echo sprintf( + '[%2$s]', + 'mailtag code ' . ( $used ? 'used' : 'unused' ), + esc_html( $mail_tag ) + ); + } + } + + + /** + * Submits this contact form. + * + * @param string|array $options Optional. Submission options. Default empty. + * @return array Result of submission. + */ + public function submit( $options = '' ) { + $options = wp_parse_args( $options, array( + 'skip_mail' => ( + $this->in_demo_mode() || + $this->is_true( 'skip_mail' ) || + ! empty( $this->skip_mail ) + ), + ) ); + + if ( + $this->is_true( 'subscribers_only' ) and + ! current_user_can( 'wpcf7_submit', $this->id() ) + ) { + $result = array( + 'contact_form_id' => $this->id(), + 'status' => 'error', + 'message' => __( 'This contact form is available only for logged in users.', 'contact-form-7' ), + ); + + return $result; + } + + $submission = WPCF7_Submission::get_instance( $this, array( + 'skip_mail' => $options['skip_mail'], + ) ); + + $result = array( + 'contact_form_id' => $this->id(), + ); + + $result += $submission->get_result(); + + if ( $this->in_demo_mode() ) { + $result['demo_mode'] = true; + } + + do_action( 'wpcf7_submit', $this, $result ); + + return $result; + } + + + /** + * Returns message used for given status. + * + * @param string $status Status. + * @param bool $filter Optional. Whether filters are applied. Default true. + * @return string Message. + */ + public function message( $status, $filter = true ) { + $messages = $this->prop( 'messages' ); + $message = isset( $messages[$status] ) ? $messages[$status] : ''; + + if ( $filter ) { + $message = $this->filter_message( $message, $status ); + } + + return $message; + } + + + /** + * Filters a message. + * + * @param string $message Message to filter. + * @param string $status Optional. Status. Default empty. + * @return string Filtered message. + */ + public function filter_message( $message, $status = '' ) { + $message = wpcf7_mail_replace_tags( $message ); + $message = apply_filters( 'wpcf7_display_message', $message, $status ); + $message = wp_strip_all_tags( $message ); + + return $message; + } + + + /** + * Returns the additional setting value searched by name. + * + * @param string $name Name of setting. + * @return string Additional setting value. + */ + public function pref( $name ) { + $settings = $this->additional_setting( $name ); + + if ( $settings ) { + return $settings[0]; + } + } + + + /** + * Returns additional setting values searched by name. + * + * @param string $name Name of setting. + * @param int $max Maximum result item count. + * @return array Additional setting values. + */ + public function additional_setting( $name, $max = 1 ) { + $settings = (array) explode( "\n", $this->prop( 'additional_settings' ) ); + + $pattern = '/^([a-zA-Z0-9_]+)[\t ]*:(.*)$/'; + $count = 0; + $values = array(); + + foreach ( $settings as $setting ) { + if ( preg_match( $pattern, $setting, $matches ) ) { + if ( $matches[1] !== $name ) { + continue; + } + + if ( ! $max or $count < (int) $max ) { + $values[] = trim( $matches[2] ); + $count += 1; + } + } + } + + return $values; + } + + + /** + * Returns true if the specified setting has a truthy string value. + * + * @param string $name Name of setting. + * @return bool True if the setting value is 'on', 'true', or '1'. + */ + public function is_true( $name ) { + return in_array( + $this->pref( $name ), + array( 'on', 'true', '1' ), + true + ); + } + + + /** + * Returns true if this contact form is in the demo mode. + */ + public function in_demo_mode() { + return $this->is_true( 'demo_mode' ); + } + + + /** + * Returns true if nonce is active for this contact form. + */ + public function nonce_is_active() { + $is_active = WPCF7_VERIFY_NONCE; + + if ( $this->is_true( 'subscribers_only' ) ) { + $is_active = true; + } + + return (bool) apply_filters( 'wpcf7_verify_nonce', $is_active, $this ); + } + + + /** + * Returns true if the specified setting has a falsey string value. + * + * @param string $name Name of setting. + * @return bool True if the setting value is 'off', 'false', or '0'. + */ + public function is_false( $name ) { + return in_array( + $this->pref( $name ), + array( 'off', 'false', '0' ), + true + ); + } + + + /** + * Upgrades this contact form properties. + */ + private function upgrade() { + $mail = $this->prop( 'mail' ); + + if ( is_array( $mail ) and ! isset( $mail['recipient'] ) ) { + $mail['recipient'] = get_option( 'admin_email' ); + } + + $this->properties['mail'] = $mail; + + $messages = $this->prop( 'messages' ); + + if ( is_array( $messages ) ) { + foreach ( wpcf7_messages() as $key => $arr ) { + if ( ! isset( $messages[$key] ) ) { + $messages[$key] = $arr['default']; + } + } + } + + $this->properties['messages'] = $messages; + } + + + /** + * Stores this contact form properties to the database. + * + * @return int The post ID on success. The value 0 on failure. + */ + public function save() { + $title = wp_slash( $this->title ); + $props = wp_slash( $this->get_properties() ); + + $post_content = implode( "\n", wpcf7_array_flatten( $props ) ); + + if ( $this->initial() ) { + $post_id = wp_insert_post( array( + 'post_type' => self::post_type, + 'post_status' => 'publish', + 'post_title' => $title, + 'post_content' => trim( $post_content ), + ) ); + } else { + $post_id = wp_update_post( array( + 'ID' => (int) $this->id, + 'post_status' => 'publish', + 'post_title' => $title, + 'post_content' => trim( $post_content ), + ) ); + } + + if ( $post_id ) { + foreach ( $props as $prop => $value ) { + update_post_meta( $post_id, '_' . $prop, + wpcf7_normalize_newline_deep( $value ) + ); + } + + if ( wpcf7_is_valid_locale( $this->locale ) ) { + update_post_meta( $post_id, '_locale', $this->locale ); + } + + add_post_meta( $post_id, '_hash', + wpcf7_generate_contact_form_hash( $post_id ), + true // Unique + ); + + if ( $this->initial() ) { + $this->id = $post_id; + do_action( 'wpcf7_after_create', $this ); + } else { + do_action( 'wpcf7_after_update', $this ); + } + + do_action( 'wpcf7_after_save', $this ); + } + + return $post_id; + } + + + /** + * Makes a copy of this contact form. + * + * @return WPCF7_ContactForm New contact form object. + */ + public function copy() { + $new = new self(); + $new->title = $this->title . '_copy'; + $new->locale = $this->locale; + $new->properties = $this->properties; + + return apply_filters( 'wpcf7_copy', $new, $this ); + } + + + /** + * Deletes this contact form. + * + * @return bool True if deletion succeeded, false otherwise. + */ + public function delete() { + if ( $this->initial() ) { + return false; + } + + if ( wp_delete_post( $this->id, true ) ) { + $this->id = 0; + return true; + } + + return false; + } + + + /** + * Returns a WordPress shortcode for this contact form. + */ + public function shortcode( $options = '' ) { + $options = wp_parse_args( $options, array( + 'use_old_format' => false + ) ); + + $title = str_replace( array( '"', '[', ']' ), '', $this->title ); + + if ( $options['use_old_format'] ) { + $old_unit_id = (int) get_post_meta( $this->id, '_old_cf7_unit_id', true ); + + if ( $old_unit_id ) { + $shortcode = sprintf( + '[contact-form %1$d "%2$s"]', + $old_unit_id, + $title + ); + } else { + $shortcode = ''; + } + } else { + $shortcode = sprintf( + '[contact-form-7 id="%1$s" title="%2$s"]', + $this->hash(), + $title + ); + } + + return apply_filters( 'wpcf7_contact_form_shortcode', + $shortcode, $options, $this + ); + } +} diff --git a/wp-content/plugins/contact-form-7/includes/controller.php b/wp-content/plugins/contact-form-7/includes/controller.php new file mode 100644 index 0000000..9f2a52b --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/controller.php @@ -0,0 +1,185 @@ +submit(); + } +} + + +/** + * Registers main scripts and styles. + */ +add_action( + 'wp_enqueue_scripts', + static function () { + $assets = include wpcf7_plugin_path( 'includes/js/index.asset.php' ); + + $assets = wp_parse_args( $assets, array( + 'dependencies' => array(), + 'version' => WPCF7_VERSION, + ) ); + + wp_register_script( + 'contact-form-7', + wpcf7_plugin_url( 'includes/js/index.js' ), + array_merge( + $assets['dependencies'], + array( 'swv' ) + ), + $assets['version'], + array( 'in_footer' => true ) + ); + + wp_set_script_translations( 'contact-form-7', 'contact-form-7' ); + + wp_register_script( + 'contact-form-7-html5-fallback', + wpcf7_plugin_url( 'includes/js/html5-fallback.js' ), + array( 'jquery-ui-datepicker' ), + WPCF7_VERSION, + array( 'in_footer' => true ) + ); + + if ( wpcf7_load_js() ) { + wpcf7_enqueue_scripts(); + } + + wp_register_style( + 'contact-form-7', + wpcf7_plugin_url( 'includes/css/styles.css' ), + array(), + WPCF7_VERSION, + 'all' + ); + + wp_register_style( + 'contact-form-7-rtl', + wpcf7_plugin_url( 'includes/css/styles-rtl.css' ), + array( 'contact-form-7' ), + WPCF7_VERSION, + 'all' + ); + + wp_register_style( + 'jquery-ui-smoothness', + wpcf7_plugin_url( + 'includes/js/jquery-ui/themes/smoothness/jquery-ui.min.css' + ), + array(), + '1.12.1', + 'screen' + ); + + if ( wpcf7_load_css() ) { + wpcf7_enqueue_styles(); + } + }, + 10, 0 +); + + +/** + * Enqueues scripts. + */ +function wpcf7_enqueue_scripts() { + wp_enqueue_script( 'contact-form-7' ); + + $wpcf7_obj = array( + 'api' => array( + 'root' => sanitize_url( get_rest_url() ), + 'namespace' => 'contact-form-7/v1', + ), + ); + + if ( defined( 'WP_CACHE' ) and WP_CACHE ) { + $wpcf7_obj = array_merge( $wpcf7_obj, array( + 'cached' => 1, + ) ); + } + + wp_add_inline_script( 'contact-form-7', + sprintf( + 'var wpcf7 = %s;', + wp_json_encode( $wpcf7_obj, JSON_PRETTY_PRINT ) + ), + 'before' + ); + + do_action( 'wpcf7_enqueue_scripts' ); +} + + +/** + * Returns true if the main script is enqueued. + */ +function wpcf7_script_is() { + return wp_script_is( 'contact-form-7' ); +} + + +/** + * Enqueues styles. + */ +function wpcf7_enqueue_styles() { + wp_enqueue_style( 'contact-form-7' ); + + if ( wpcf7_is_rtl() ) { + wp_enqueue_style( 'contact-form-7-rtl' ); + } + + do_action( 'wpcf7_enqueue_styles' ); +} + + +/** + * Returns true if the main stylesheet is enqueued. + */ +function wpcf7_style_is() { + return wp_style_is( 'contact-form-7' ); +} + + +add_action( + 'wp_enqueue_scripts', + 'wpcf7_html5_fallback', + 20, 0 +); + +/** + * Enqueues scripts and styles for the HTML5 fallback. + */ +function wpcf7_html5_fallback() { + if ( ! wpcf7_support_html5_fallback() ) { + return; + } + + if ( wpcf7_script_is() ) { + wp_enqueue_script( 'contact-form-7-html5-fallback' ); + } + + if ( wpcf7_style_is() ) { + wp_enqueue_style( 'jquery-ui-smoothness' ); + } +} diff --git a/wp-content/plugins/contact-form-7/includes/css/styles-rtl.css b/wp-content/plugins/contact-form-7/includes/css/styles-rtl.css new file mode 100644 index 0000000..5f1088c --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/css/styles-rtl.css @@ -0,0 +1,11 @@ +.wpcf7-not-valid-tip { + direction: rtl; +} + +.use-floating-validation-tip .wpcf7-not-valid-tip { + right: 1em; +} + +.wpcf7-list-item { + margin: 0 1em 0 0; +} diff --git a/wp-content/plugins/contact-form-7/includes/css/styles.css b/wp-content/plugins/contact-form-7/includes/css/styles.css new file mode 100644 index 0000000..93c7ec1 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/css/styles.css @@ -0,0 +1,177 @@ +.wpcf7 .screen-reader-response { + position: absolute; + overflow: hidden; + clip: rect(1px, 1px, 1px, 1px); + clip-path: inset(50%); + height: 1px; + width: 1px; + margin: -1px; + padding: 0; + border: 0; + word-wrap: normal !important; + word-break: normal !important; +} + +.wpcf7 .hidden-fields-container { + display: none; +} + +.wpcf7 form .wpcf7-response-output { + margin: 2em 0.5em 1em; + padding: 0.2em 1em; + border: 2px solid #00a0d2; /* Blue */ +} + +.wpcf7 form.init .wpcf7-response-output, +.wpcf7 form.resetting .wpcf7-response-output, +.wpcf7 form.submitting .wpcf7-response-output { + display: none; +} + +.wpcf7 form.sent .wpcf7-response-output { + border-color: #46b450; /* Green */ +} + +.wpcf7 form.failed .wpcf7-response-output, +.wpcf7 form.aborted .wpcf7-response-output { + border-color: #dc3232; /* Red */ +} + +.wpcf7 form.spam .wpcf7-response-output { + border-color: #f56e28; /* Orange */ +} + +.wpcf7 form.invalid .wpcf7-response-output, +.wpcf7 form.unaccepted .wpcf7-response-output, +.wpcf7 form.payment-required .wpcf7-response-output { + border-color: #ffb900; /* Yellow */ +} + +.wpcf7-form-control-wrap { + position: relative; +} + +.wpcf7-not-valid-tip { + color: #dc3232; /* Red */ + font-size: 1em; + font-weight: normal; + display: block; +} + +.use-floating-validation-tip .wpcf7-not-valid-tip { + position: relative; + top: -2ex; + left: 1em; + z-index: 100; + border: 1px solid #dc3232; + background: #fff; + padding: 0.2em 0.8em; + width: 24em; +} + +.wpcf7-list-item { + display: inline-block; + margin: 0 0 0 1em; +} + +.wpcf7-list-item-label::before, +.wpcf7-list-item-label::after { + content: " "; +} + +.wpcf7-spinner { + visibility: hidden; + display: inline-block; + background-color: #23282d; /* Dark Gray 800 */ + opacity: 0.75; + width: 24px; + height: 24px; + border: none; + border-radius: 100%; + padding: 0; + margin: 0 24px; + position: relative; +} + +form.submitting .wpcf7-spinner { + visibility: visible; +} + +.wpcf7-spinner::before { + content: ""; + position: absolute; + background-color: #fbfbfc; /* Light Gray 100 */ + top: 4px; + left: 4px; + width: 6px; + height: 6px; + border: none; + border-radius: 100%; + transform-origin: 8px 8px; + animation-name: spin; + animation-duration: 1000ms; + animation-timing-function: linear; + animation-iteration-count: infinite; +} + +@media (prefers-reduced-motion: reduce) { + .wpcf7-spinner::before { + animation-name: blink; + animation-duration: 2000ms; + } +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + + to { + transform: rotate(360deg); + } +} + +@keyframes blink { + from { + opacity: 0; + } + + 50% { + opacity: 1; + } + + to { + opacity: 0; + } +} + +.wpcf7 [inert] { + opacity: 0.5; +} + +.wpcf7 input[type="file"] { + cursor: pointer; +} + +.wpcf7 input[type="file"]:disabled { + cursor: default; +} + +.wpcf7 .wpcf7-submit:disabled { + cursor: not-allowed; +} + +.wpcf7 input[type="url"], +.wpcf7 input[type="email"], +.wpcf7 input[type="tel"] { + direction: ltr; +} + +.wpcf7-reflection > output { + display: list-item; + list-style: none; +} + +.wpcf7-reflection > output[hidden] { + display: none; +} diff --git a/wp-content/plugins/contact-form-7/includes/file.php b/wp-content/plugins/contact-form-7/includes/file.php new file mode 100644 index 0000000..1294808 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/file.php @@ -0,0 +1,429 @@ + false, + 'filetypes' => '', + 'limit' => MB_IN_BYTES, + ) ); + + foreach ( array( 'name', 'size', 'tmp_name', 'error' ) as $key ) { + if ( ! isset( $file[$key] ) ) { + $file[$key] = array(); + } + } + + $names = wpcf7_array_flatten( $file['name'] ); + $sizes = wpcf7_array_flatten( $file['size'] ); + $tmp_names = wpcf7_array_flatten( $file['tmp_name'] ); + $errors = wpcf7_array_flatten( $file['error'] ); + + foreach ( $errors as $error ) { + if ( ! empty( $error ) and UPLOAD_ERR_NO_FILE !== $error ) { + return new WP_Error( 'wpcf7_upload_failed_php_error', + wpcf7_get_message( 'upload_failed_php_error' ) + ); + } + } + + // Move uploaded file to tmp dir + $uploads_dir = wpcf7_upload_tmp_dir(); + $uploads_dir = wpcf7_maybe_add_random_dir( $uploads_dir ); + + $uploaded_files = array(); + + foreach ( $names as $key => $name ) { + $tmp_name = $tmp_names[$key]; + + if ( empty( $tmp_name ) or ! is_uploaded_file( $tmp_name ) ) { + continue; + } + + $filename = $name; + $filename = wpcf7_canonicalize( $filename, array( 'strto' => 'as-is' ) ); + $filename = wpcf7_antiscript_file_name( $filename ); + + $filename = apply_filters( 'wpcf7_upload_file_name', + $filename, $name, $options + ); + + $filename = wp_unique_filename( $uploads_dir, $filename ); + $new_file = path_join( $uploads_dir, $filename ); + + // phpcs:ignore Generic.PHP.ForbiddenFunctions.Found + if ( false === @move_uploaded_file( $tmp_name, $new_file ) ) { + return new WP_Error( 'wpcf7_upload_failed', + wpcf7_get_message( 'upload_failed' ) + ); + } + + // Make sure the uploaded file is only readable for the owner process. + $filesystem->chmod( $new_file, 0400 ); + + $uploaded_files[] = $new_file; + } + + return $uploaded_files; +} + + +add_filter( + 'wpcf7_messages', + 'wpcf7_file_messages', + 10, 1 +); + +/** + * A wpcf7_messages filter callback that adds messages for + * file-uploading fields. + */ +function wpcf7_file_messages( $messages ) { + return array_merge( $messages, array( + 'upload_failed' => array( + 'description' => __( 'Uploading a file fails for any reason', 'contact-form-7' ), + 'default' => __( 'There was an unknown error uploading the file.', 'contact-form-7' ), + ), + + 'upload_file_type_invalid' => array( + 'description' => __( 'Uploaded file is not allowed for file type', 'contact-form-7' ), + 'default' => __( 'You are not allowed to upload files of this type.', 'contact-form-7' ), + ), + + 'upload_file_too_large' => array( + 'description' => __( 'Uploaded file is too large', 'contact-form-7' ), + 'default' => __( 'The uploaded file is too large.', 'contact-form-7' ), + ), + + 'upload_failed_php_error' => array( + 'description' => __( 'Uploading a file fails for PHP error', 'contact-form-7' ), + 'default' => __( 'There was an error uploading the file.', 'contact-form-7' ), + ), + ) ); +} + + +add_filter( + 'wpcf7_form_enctype', + 'wpcf7_file_form_enctype_filter', + 10, 1 +); + +/** + * A wpcf7_form_enctype filter callback that sets the enctype attribute + * to multipart/form-data if the form has file-uploading fields. + */ +function wpcf7_file_form_enctype_filter( $enctype ) { + $multipart = (bool) wpcf7_scan_form_tags( array( + 'feature' => 'file-uploading', + ) ); + + if ( $multipart ) { + $enctype = 'multipart/form-data'; + } + + return $enctype; +} + + +/** + * Converts a MIME type string to an array of corresponding file extensions. + * + * @param string $mime MIME type. + * Wildcard (*) is available for the subtype part. + * @return array Corresponding file extensions. + */ +function wpcf7_convert_mime_to_ext( $mime ) { + static $mime_types = array(); + + $mime_types = wp_get_mime_types(); + + $results = array(); + + if ( preg_match( '%^([a-z]+)/([*]|[a-z0-9.+-]+)$%i', $mime, $matches ) ) { + foreach ( $mime_types as $key => $val ) { + if ( + '*' === $matches[2] and str_starts_with( $val, $matches[1] . '/' ) or + $val === $matches[0] + ) { + $results = array_merge( $results, explode( '|', $key ) ); + } + } + } + + $results = array_unique( $results ); + $results = array_filter( $results ); + $results = array_values( $results ); + + return $results; +} + + +/** + * Returns a formatted list of acceptable filetypes. + * + * @param string|array $types Optional. Array of filetypes. + * @param string $format Optional. Pre-defined format designator. + * @return string Formatted list of acceptable filetypes. + */ +function wpcf7_acceptable_filetypes( $types = 'default', $format = 'regex' ) { + if ( 'default' === $types or empty( $types ) ) { + $types = array( + 'audio/*', + 'video/*', + 'image/*', + ); + } else { + $types = array_map( + static function ( $type ) { + if ( is_string( $type ) ) { + return preg_split( '/[\s|,]+/', strtolower( $type ) ); + } + }, + (array) $types + ); + + $types = wpcf7_array_flatten( $types ); + $types = array_filter( array_unique( $types ) ); + } + + if ( 'attr' === $format or 'attribute' === $format ) { + $types = array_map( + static function ( $type ) { + if ( ! str_contains( $type, '/' ) ) { + return sprintf( '.%s', trim( $type, '.' ) ); + } elseif ( preg_match( '%^([a-z]+)/[*]$%i', $type, $matches ) ) { + if ( + in_array( $matches[1], array( 'audio', 'video', 'image' ), true ) + ) { + return $type; + } else { + return ''; + } + } elseif ( wpcf7_convert_mime_to_ext( $type ) ) { + return $type; + } + }, + $types + ); + + $types = array_filter( $types ); + + return implode( ',', $types ); + + } elseif ( 'regex' === $format ) { + $types = array_map( + static function ( $type ) { + if ( ! str_contains( $type, '/' ) ) { + return preg_quote( trim( $type, '.' ) ); + } elseif ( $type = wpcf7_convert_mime_to_ext( $type ) ) { + return $type; + } + }, + $types + ); + + $types = wpcf7_array_flatten( $types ); + $types = array_filter( array_unique( $types ) ); + + return implode( '|', $types ); + } + + return ''; +} + + +add_action( + 'wpcf7_init', + 'wpcf7_init_uploads', + 10, 0 +); + +/** + * Initializes the temporary directory for uploaded files. + */ +function wpcf7_init_uploads() { + $dir = wpcf7_upload_tmp_dir(); + + if ( ! is_dir( $dir ) or ! wp_is_writable( $dir ) ) { + return; + } + + $htaccess_file = path_join( $dir, '.htaccess' ); + + if ( file_exists( $htaccess_file ) ) { + list( $first_line_comment ) = (array) file( + $htaccess_file, + FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES + ); + + if ( '# Apache 2.4+' === $first_line_comment ) { + return; + } + } + + $filesystem = WPCF7_Filesystem::get_instance(); + + $htaccess_body = ' +# Apache 2.4+ + + Require all denied + + +# Apache 2.2 + + Deny from all + +'; + + $filesystem->put_contents( $htaccess_file, ltrim( $htaccess_body ) ); +} + + +/** + * Creates a child directory with a randomly generated name. + * + * @param string $dir The parent directory path. + * @return string The child directory path if created, otherwise the parent. + */ +function wpcf7_maybe_add_random_dir( $dir ) { + do { + $dir_new = path_join( $dir, zeroise( wp_rand(), 10 ) ); + } while ( file_exists( $dir_new ) ); + + if ( wp_mkdir_p( $dir_new ) ) { + return $dir_new; + } + + return $dir; +} + + +/** + * Returns the directory path for uploaded files. + * + * @return string Directory path. + */ +function wpcf7_upload_tmp_dir() { + static $output = ''; + + if ( $output ) { + return $output; + } + + if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) ) { + $dir = path_join( WP_CONTENT_DIR, WPCF7_UPLOADS_TMP_DIR ); + wp_mkdir_p( $dir ); + + if ( wpcf7_is_file_path_in_content_dir( $dir ) ) { + return $output = $dir; + } + } + + $dir = path_join( wpcf7_upload_dir( 'dir' ), 'wpcf7_uploads' ); + wp_mkdir_p( $dir ); + + return $output = $dir; +} + + +add_action( + 'shutdown', + 'wpcf7_cleanup_upload_files', + 20, 0 +); + +/** + * Cleans up files in the temporary directory for uploaded files. + * + * @param int $seconds Files older than this are removed. Default 60. + * @param int $max Maximum number of files to be removed in a function call. + * Default 100. + */ +function wpcf7_cleanup_upload_files( $seconds = 60, $max = 100 ) { + $dir = trailingslashit( wpcf7_upload_tmp_dir() ); + + if ( + ! is_dir( $dir ) or + ! is_readable( $dir ) or + ! wp_is_writable( $dir ) + ) { + return; + } + + $seconds = absint( $seconds ); + $max = absint( $max ); + $count = 0; + + if ( $handle = opendir( $dir ) ) { + while ( false !== ( $file = readdir( $handle ) ) ) { + if ( '.' === $file or '..' === $file or '.htaccess' === $file ) { + continue; + } + + $mtime = @filemtime( path_join( $dir, $file ) ); + + if ( $mtime and time() < $mtime + $seconds ) { // less than $seconds old + continue; + } + + wpcf7_rmdir_p( path_join( $dir, $file ) ); + $count += 1; + + if ( $max <= $count ) { + break; + } + } + + closedir( $handle ); + } +} + + +add_action( + 'wpcf7_admin_warnings', + 'wpcf7_file_display_warning_message', + 10, 3 +); + +/** + * Displays warning messages about file-uploading fields. + */ +function wpcf7_file_display_warning_message( $page, $action, $object ) { + if ( $object instanceof WPCF7_ContactForm ) { + $contact_form = $object; + } else { + return; + } + + $has_tags = (bool) $contact_form->scan_form_tags( array( + 'feature' => 'file-uploading', + ) ); + + if ( ! $has_tags ) { + return; + } + + $uploads_dir = wpcf7_upload_tmp_dir(); + + if ( ! is_dir( $uploads_dir ) or ! wp_is_writable( $uploads_dir ) ) { + wp_admin_notice( + sprintf( + /* translators: %s: the path of the temporary folder */ + __( 'This contact form has file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7' ), + $uploads_dir + ), + array( 'type' => 'warning' ) + ); + } +} diff --git a/wp-content/plugins/contact-form-7/includes/filesystem.php b/wp-content/plugins/contact-form-7/includes/filesystem.php new file mode 100644 index 0000000..43c6faf --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/filesystem.php @@ -0,0 +1,127 @@ +connect(); + } + + + /** + * Connects to the filesystem. + * + * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. + */ + private function connect() { + global $wp_filesystem; + + if ( $this->filesystem ) { + return false; + } + + require_once ABSPATH . 'wp-admin/includes/file.php'; + require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'; + require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php'; + + ob_start(); + $credentials = request_filesystem_credentials( '' ); + ob_end_clean(); + + if ( false === $credentials or ! WP_Filesystem( $credentials ) ) { + wp_trigger_error( + __FUNCTION__, + __( 'Could not access filesystem.', 'contact-form-7' ) + ); + } + + if ( $wp_filesystem instanceof WP_Filesystem_Base ) { + $this->filesystem = $wp_filesystem; + } else { + $this->filesystem = new WP_Filesystem_Direct( 1 ); + } + + if ( ! defined( 'FS_CHMOD_DIR' ) ) { + define( 'FS_CHMOD_DIR', fileperms( ABSPATH ) & 0777 | 0755 ); + } + + if ( ! defined( 'FS_CHMOD_FILE' ) ) { + define( 'FS_CHMOD_FILE', fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); + } + } + + + /** + * Changes filesystem permissions. + * + * @param string $file Path to the file. + * @param int|false $mode Optional. The permissions as octal number. + * @param bool $recursive Optional. If set to true, + * changes file permissions recursively. Default false. + * @return bool True on success, false on failure. + */ + public function chmod( $file, $mode = false, $recursive = false ) { + return $this->filesystem->chmod( $file, $mode, $recursive ); + } + + + /** + * Deletes a file or directory. + * + * @param string $file Path to the file or directory. + * @param bool $recursive Optional. If set to true, deletes + * files and folders recursively. Default false. + * @param string|false $type Type of resource. + * 'f' for file, 'd' for directory. Default false. + * @return bool True on success, false on failure. + */ + public function delete( $file, $recursive = false, $type = false ) { + return $this->filesystem->delete( $file, $recursive, $type ); + } + + + /** + * Writes a string to a file. + * + * @param string $file Path to the file where to write the data. + * @param string $contents The data to write. + * @param int $mode The file permissions as octal number. + * @return bool True on success, false on failure. + */ + public function put_contents( $file, $contents, $mode = false ) { + return $this->filesystem->put_contents( $file, $contents, $mode ); + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/form-tag.php b/wp-content/plugins/contact-form-7/includes/form-tag.php new file mode 100644 index 0000000..0553f51 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/form-tag.php @@ -0,0 +1,620 @@ + $value ) { + if ( property_exists( __CLASS__, $key ) ) { + $this->{$key} = $value; + } + } + } + } + + + /** + * Returns true if the type has a trailing asterisk. + */ + public function is_required() { + return str_ends_with( $this->type, '*' ); + } + + + /** + * Returns true if the form-tag has a specified option. + */ + public function has_option( $option_name ) { + $pattern = sprintf( '/^%s(:.+)?$/i', preg_quote( $option_name, '/' ) ); + return (bool) preg_grep( $pattern, $this->options ); + } + + + /** + * Retrieves option values with the specified option name. + * + * @param string $option_name Option name. + * @param string $pattern Optional. A regular expression pattern or one of + * the keys of preset patterns. If specified, only options + * whose value part matches this pattern will be returned. + * @param bool $single Optional. If true, only the first matching option + * will be returned. Default false. + * @return string|array|bool The option value or an array of option values. + * False if there is no option matches the pattern. + */ + public function get_option( $option_name, $pattern = '', $single = false ) { + $preset_patterns = array( + 'date' => '[0-9]{4}-[0-9]{2}-[0-9]{2}', + 'int' => '[0-9]+', + 'signed_int' => '[-]?[0-9]+', + 'num' => '(?:[0-9]+|(?:[0-9]+)?[.][0-9]+)', + 'signed_num' => '[-]?(?:[0-9]+|(?:[0-9]+)?[.][0-9]+)', + 'class' => '[-0-9a-zA-Z_]+', + 'id' => '[-0-9a-zA-Z_]+', + ); + + if ( isset( $preset_patterns[$pattern] ) ) { + $pattern = $preset_patterns[$pattern]; + } + + if ( '' === $pattern ) { + $pattern = '.+'; + } + + $pattern = sprintf( + '/^%s:%s$/i', + preg_quote( $option_name, '/' ), + $pattern + ); + + if ( $single ) { + $matches = $this->get_first_match_option( $pattern ); + + if ( ! $matches ) { + return false; + } + + return substr( $matches[0], strlen( $option_name ) + 1 ); + } else { + $matches_a = $this->get_all_match_options( $pattern ); + + if ( ! $matches_a ) { + return false; + } + + $results = array(); + + foreach ( $matches_a as $matches ) { + $results[] = substr( $matches[0], strlen( $option_name ) + 1 ); + } + + return $results; + } + } + + + /** + * Retrieves the id option value from the form-tag. + */ + public function get_id_option() { + static $used = array(); + + $option = $this->get_option( 'id', 'id', true ); + + if ( + ! $option or + str_starts_with( $option, 'wpcf7' ) or + in_array( $option, $used, true ) + ) { + return false; + } + + $used[] = $option; + + return $option; + } + + + /** + * Retrieves the class option value from the form-tag. + * + * @param string|array $default_classes Optional. Preset classes as an array + * or a whitespace-separated list. Default empty string. + * @return string|bool A whitespace-separated list of classes. + * False if there is no class to return. + */ + public function get_class_option( $default_classes = '' ) { + if ( is_string( $default_classes ) ) { + $default_classes = explode( ' ', $default_classes ); + } + + $options = array_merge( + (array) $default_classes, + (array) $this->get_option( 'class' ) + ); + + $options = array_map( 'sanitize_html_class', $options ); + $options = array_filter( array_unique( $options ) ); + + if ( empty( $options ) ) { + return false; + } + + return implode( ' ', $options ); + } + + + /** + * Retrieves the autocomplete option value from the form-tag. + * + * @return string|bool A whitespace-separated list of tokens. + * False if there is no token to return. + */ + public function get_autocomplete_option() { + $options = (array) $this->get_option( 'autocomplete', '[-0-9a-zA-Z|]+' ); + + $options = array_reduce( $options, static function ( $carry, $item ) { + return array_merge( $carry, + array_map( 'strtolower', explode( '|', $item ) ) + ); + }, array() ); + + $options = array_filter( $options, static function ( $item ) { + return preg_match( '/^[a-z]+(?:-[0-9a-z]+)*$/', $item ); + } ); + + $options = array_unique( $options ); + + if ( empty( $options ) ) { + return false; + } elseif ( in_array( 'off', $options, true ) ) { + return 'off'; + } elseif ( in_array( 'on', $options, true ) ) { + return 'on'; + } else { + return implode( ' ', $options ); + } + } + + + /** + * Retrieves the size option value from the form-tag. + * + * @param string $default_value Optional default value. + * @return string The option value. + */ + public function get_size_option( $default_value = false ) { + $option = $this->get_option( 'size', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( '%^([0-9]*)/[0-9]*$%' ); + + foreach ( $matches_a as $matches ) { + if ( isset( $matches[1] ) and '' !== $matches[1] ) { + return $matches[1]; + } + } + + return $default_value; + } + + + /** + * Retrieves the maxlength option value from the form-tag. + * + * @param string $default_value Optional default value. + * @return string The option value. + */ + public function get_maxlength_option( $default_value = false ) { + $option = $this->get_option( 'maxlength', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( + '%^(?:[0-9]*x?[0-9]*)?/([0-9]+)$%' + ); + + foreach ( $matches_a as $matches ) { + if ( isset( $matches[1] ) and '' !== $matches[1] ) { + return $matches[1]; + } + } + + return $default_value; + } + + + /** + * Retrieves the minlength option value from the form-tag. + * + * @param string $default_value Optional default value. + * @return string The option value. + */ + public function get_minlength_option( $default_value = false ) { + $option = $this->get_option( 'minlength', 'int', true ); + + if ( $option ) { + return $option; + } else { + return $default_value; + } + } + + + /** + * Retrieves the cols option value from the form-tag. + * + * @param string $default_value Optional default value. + * @return string The option value. + */ + public function get_cols_option( $default_value = false ) { + $option = $this->get_option( 'cols', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( + '%^([0-9]*)x([0-9]*)(?:/[0-9]+)?$%' + ); + + foreach ( $matches_a as $matches ) { + if ( isset( $matches[1] ) and '' !== $matches[1] ) { + return $matches[1]; + } + } + + return $default_value; + } + + + /** + * Retrieves the rows option value from the form-tag. + * + * @param string $default_value Optional default value. + * @return string The option value. + */ + public function get_rows_option( $default_value = false ) { + $option = $this->get_option( 'rows', 'int', true ); + + if ( $option ) { + return $option; + } + + $matches_a = $this->get_all_match_options( + '%^([0-9]*)x([0-9]*)(?:/[0-9]+)?$%' + ); + + foreach ( $matches_a as $matches ) { + if ( isset( $matches[2] ) and '' !== $matches[2] ) { + return $matches[2]; + } + } + + return $default_value; + } + + + /** + * Retrieves a date-type option value from the form-tag. + * + * @param string $option_name A date-type option name, such as 'min' or 'max'. + * @return string|bool The option value in YYYY-MM-DD format. False if the + * option does not exist or the date value is invalid. + */ + public function get_date_option( $option_name ) { + $option_value = $this->get_option( $option_name, '', true ); + + if ( empty( $option_value ) ) { + return false; + } + + $date = apply_filters( 'wpcf7_form_tag_date_option', + null, + array( $option_name => $option_value ) + ); + + if ( $date ) { + $date_pattern = '/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/'; + + if ( + preg_match( $date_pattern, $date, $matches ) and + checkdate( $matches[2], $matches[3], $matches[1] ) + ) { + return $date; + } + } else { + $datetime_obj = date_create_immutable( + preg_replace( '/[_]+/', ' ', $option_value ), + wp_timezone() + ); + + if ( $datetime_obj ) { + return $datetime_obj->format( 'Y-m-d' ); + } + } + + return false; + } + + + /** + * Retrieves the default option value from the form-tag. + * + * @param string|array $default_value Optional default value. + * @param string|array $args Optional options for the option value retrieval. + * @return string|array The option value. If the multiple option is enabled, + * an array of option values. + */ + public function get_default_option( $default_value = '', $args = '' ) { + $args = wp_parse_args( $args, array( + 'multiple' => false, + 'shifted' => false, + ) ); + + $options = (array) $this->get_option( 'default' ); + $values = array(); + + if ( empty( $options ) ) { + return $args['multiple'] ? $values : $default_value; + } + + foreach ( $options as $opt ) { + $opt = sanitize_key( $opt ); + + if ( 'user_' === substr( $opt, 0, 5 ) and is_user_logged_in() ) { + $primary_props = array( 'user_login', 'user_email', 'user_url' ); + $opt = in_array( $opt, $primary_props, true ) ? $opt : substr( $opt, 5 ); + + $user = wp_get_current_user(); + $user_prop = $user->get( $opt ); + + if ( ! empty( $user_prop ) ) { + if ( $args['multiple'] ) { + $values[] = $user_prop; + } else { + return $user_prop; + } + } + + } elseif ( 'post_meta' === $opt and in_the_loop() ) { + if ( $args['multiple'] ) { + $values = array_merge( $values, + get_post_meta( get_the_ID(), $this->name ) + ); + } else { + $val = (string) get_post_meta( get_the_ID(), $this->name, true ); + + if ( strlen( $val ) ) { + return $val; + } + } + + } elseif ( + 'get' === $opt and + $vals = wpcf7_superglobal_get( $this->name ) + ) { + $vals = array_map( 'wpcf7_sanitize_query_var', (array) $vals ); + + if ( $args['multiple'] ) { + $values = array_merge( $values, $vals ); + } else { + $val = isset( $vals[0] ) ? (string) $vals[0] : ''; + + if ( strlen( $val ) ) { + return $val; + } + } + + } elseif ( + 'post' === $opt and + $vals = wpcf7_superglobal_post( $this->name ) + ) { + $vals = array_map( 'wpcf7_sanitize_query_var', (array) $vals ); + + if ( $args['multiple'] ) { + $values = array_merge( $values, $vals ); + } else { + $val = isset( $vals[0] ) ? (string) $vals[0] : ''; + + if ( strlen( $val ) ) { + return $val; + } + } + + } elseif ( 'shortcode_attr' === $opt ) { + if ( $contact_form = WPCF7_ContactForm::get_current() ) { + $val = $contact_form->shortcode_attr( $this->name ); + + if ( isset( $val ) and strlen( $val ) ) { + if ( $args['multiple'] ) { + $values[] = $val; + } else { + return $val; + } + } + } + + } elseif ( preg_match( '/^[0-9_]+$/', $opt ) ) { + $nums = explode( '_', $opt ); + + foreach ( $nums as $num ) { + $num = absint( $num ); + $num = $args['shifted'] ? $num : $num - 1; + + if ( isset( $this->values[$num] ) ) { + if ( $args['multiple'] ) { + $values[] = $this->values[$num]; + } else { + return $this->values[$num]; + } + } + } + } + } + + if ( $args['multiple'] ) { + $values = array_unique( $values ); + return $values; + } else { + return $default_value; + } + } + + + /** + * Retrieves the data option value from the form-tag. + * + * @param string|array $args Optional options for the option value retrieval. + * @return mixed The option value. + */ + public function get_data_option( $args = '' ) { + $options = (array) $this->get_option( 'data' ); + + return apply_filters( 'wpcf7_form_tag_data_option', null, $options, $args ); + } + + + /** + * Retrieves the limit option value from the form-tag. + * + * @param int $default_value Optional default value. Default 1048576. + * @return int The option value. + */ + public function get_limit_option( $default_value = MB_IN_BYTES ) { + $pattern = '/^limit:([1-9][0-9]*)([kKmM]?[bB])?$/'; + + $matches = $this->get_first_match_option( $pattern ); + + if ( $matches ) { + $size = (int) $matches[1]; + + if ( ! empty( $matches[2] ) ) { + $kbmb = strtolower( $matches[2] ); + + if ( 'kb' === $kbmb ) { + $size *= KB_IN_BYTES; + } elseif ( 'mb' === $kbmb ) { + $size *= MB_IN_BYTES; + } + } + + return $size; + } + + return (int) $default_value; + } + + + /** + * Retrieves the value of the first option matches the given + * regular expression pattern. + * + * @param string $pattern Regular expression pattern. + * @return array|bool Option value as an array of matched strings. + * False if there is no option matches the pattern. + */ + public function get_first_match_option( $pattern ) { + foreach ( (array) $this->options as $option ) { + if ( preg_match( $pattern, $option, $matches ) ) { + return $matches; + } + } + + return false; + } + + + /** + * Retrieves values of options that match the given + * regular expression pattern. + * + * @param string $pattern Regular expression pattern. + * @return array Array of arrays of strings that match the pattern. + */ + public function get_all_match_options( $pattern ) { + $result = array(); + + foreach ( (array) $this->options as $option ) { + if ( preg_match( $pattern, $option, $matches ) ) { + $result[] = $matches; + } + } + + return $result; + } + + + /** + * Assigns a value to the specified offset. + * + * @link https://www.php.net/manual/en/arrayaccess.offsetset.php + */ + #[ReturnTypeWillChange] + public function offsetSet( $offset, $value ) { + if ( property_exists( __CLASS__, $offset ) ) { + $this->{$offset} = $value; + } + } + + + /** + * Returns the value at specified offset. + * + * @link https://www.php.net/manual/en/arrayaccess.offsetget.php + */ + #[ReturnTypeWillChange] + public function offsetGet( $offset ) { + if ( property_exists( __CLASS__, $offset ) ) { + return $this->{$offset}; + } + + return null; + } + + + /** + * Returns true if the specified offset exists. + * + * @link https://www.php.net/manual/en/arrayaccess.offsetexists.php + */ + #[ReturnTypeWillChange] + public function offsetExists( $offset ) { + return property_exists( __CLASS__, $offset ); + } + + + /** + * Unsets an offset. + * + * @link https://www.php.net/manual/en/arrayaccess.offsetunset.php + */ + #[ReturnTypeWillChange] + public function offsetUnset( $offset ) { + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/form-tags-manager.php b/wp-content/plugins/contact-form-7/includes/form-tags-manager.php new file mode 100644 index 0000000..00aef52 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/form-tags-manager.php @@ -0,0 +1,615 @@ +add( $tag_types, $callback, $features ); +} + + +/** + * Wrapper function of WPCF7_FormTagsManager::remove(). + */ +function wpcf7_remove_form_tag( $tag_type ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + return $manager->remove( $tag_type ); +} + + +/** + * Wrapper function of WPCF7_FormTagsManager::replace_all(). + */ +function wpcf7_replace_all_form_tags( $content ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + return $manager->replace_all( $content ); +} + + +/** + * Wrapper function of WPCF7_ContactForm::scan_form_tags(). + */ +function wpcf7_scan_form_tags( $cond = null ) { + $contact_form = WPCF7_ContactForm::get_current(); + + if ( $contact_form ) { + return $contact_form->scan_form_tags( $cond ); + } + + return array(); +} + + +/** + * Wrapper function of WPCF7_FormTagsManager::tag_type_supports(). + */ +function wpcf7_form_tag_supports( $tag_type, $feature ) { + $manager = WPCF7_FormTagsManager::get_instance(); + + return $manager->tag_type_supports( $tag_type, $feature ); +} + + +/** + * The singleton instance of this class manages the collection of form-tags. + */ +class WPCF7_FormTagsManager { + + private static $instance; + + private $tag_types = array(); + private $scanned_tags = null; // Tags scanned at the last time of scan() + private $placeholders = array(); + + private function __construct() {} + + + /** + * Returns the singleton instance. + * + * @return WPCF7_FormTagsManager The singleton manager. + */ + public static function get_instance() { + self::$instance ??= new self(); + + return self::$instance; + } + + + /** + * Returns scanned form-tags. + * + * @return array Array of WPCF7_FormTag objects. + */ + public function get_scanned_tags() { + return $this->scanned_tags; + } + + + /** + * Registers form-tag types to the manager. + * + * @param string|array $tag_types The name of the form-tag type or + * an array of the names. + * @param callable $callback The callback to generates a form control HTML + * for a form-tag in this type. + * @param string|array $features Optional. Features a form-tag + * in this type supports. + */ + public function add( $tag_types, $callback, $features = '' ) { + if ( ! is_callable( $callback ) ) { + return; + } + + if ( true === $features ) { // for back-compat + $features = array( 'name-attr' => true ); + } + + $features = wp_parse_args( $features, array() ); + + $tag_types = array_filter( array_unique( (array) $tag_types ) ); + + foreach ( $tag_types as $tag_type ) { + $tag_type = $this->sanitize_tag_type( $tag_type ); + + if ( ! $this->tag_type_exists( $tag_type ) ) { + $this->tag_types[$tag_type] = array( + 'function' => $callback, + 'features' => $features, + ); + } + } + } + + + /** + * Returns true if the given tag type exists. + */ + public function tag_type_exists( $tag_type ) { + return isset( $this->tag_types[$tag_type] ); + } + + + /** + * Returns true if the tag type supports the features. + * + * @param string $tag_type The name of the form-tag type. + * @param array|string $features The feature to check or an array of features. + * @return bool True if the form-tag type supports at least one of + * the given features, false otherwise. + */ + public function tag_type_supports( $tag_type, $features ) { + $features = array_filter( (array) $features ); + + if ( isset( $this->tag_types[$tag_type]['features'] ) ) { + return (bool) array_intersect( + array_keys( array_filter( $this->tag_types[$tag_type]['features'] ) ), + $features + ); + } + + return false; + } + + + /** + * Returns form-tag types that support the given features. + * + * @param array|string $features Optional. The feature to check or + * an array of features. Default empty array. + * @param bool $invert Optional. If this value is true, returns form-tag + * types that do not support the given features. Default false. + * @return array An array of form-tag types. If the $features param is empty, + * returns all form-tag types that have been registered. + */ + public function collect_tag_types( $features = array(), $invert = false ) { + $tag_types = array_keys( $this->tag_types ); + + if ( empty( $features ) ) { + return $tag_types; + } + + $output = array(); + + foreach ( $tag_types as $tag_type ) { + if ( + ! $invert and $this->tag_type_supports( $tag_type, $features ) or + $invert and ! $this->tag_type_supports( $tag_type, $features ) + ) { + $output[] = $tag_type; + } + } + + return $output; + } + + + /** + * Sanitizes the form-tag type name. + */ + private function sanitize_tag_type( $tag_type ) { + $tag_type = preg_replace( '/[^a-zA-Z0-9_*]+/', '_', $tag_type ); + $tag_type = rtrim( $tag_type, '_' ); + $tag_type = strtolower( $tag_type ); + return $tag_type; + } + + + /** + * Deregisters the form-tag type. + */ + public function remove( $tag_type ) { + unset( $this->tag_types[$tag_type] ); + } + + + /** + * Normalizes the text content that includes form-tags. + */ + public function normalize( $content ) { + if ( empty( $this->tag_types ) ) { + return $content; + } + + $content = preg_replace_callback( + '/' . $this->tag_regex() . '/su', + array( $this, 'normalize_callback' ), + $content + ); + + return $content; + } + + + /** + * The callback function used within normalize(). + */ + private function normalize_callback( $matches ) { + // allow [[foo]] syntax for escaping a tag + if ( '[' === $matches[1] and ']' === $matches[6] ) { + return $matches[0]; + } + + $tag = $matches[2]; + + $attr = trim( preg_replace( '/[\r\n\t ]+/', ' ', $matches[3] ) ); + $attr = strtr( $attr, array( '<' => '<', '>' => '>' ) ); + + $content = trim( $matches[5] ); + $content = str_replace( "\n", '', $content ); + + $result = $matches[1] . '[' . $tag + . ( $attr ? ' ' . $attr : '' ) + . ( $matches[4] ? ' ' . $matches[4] : '' ) + . ']' + . ( $content ? $content . '[/' . $tag . ']' : '' ) + . $matches[6]; + + return $result; + } + + + /** + * Replace all form-tags in the given text with placeholders. + */ + public function replace_with_placeholders( $content ) { + if ( empty( $this->tag_types ) ) { + return $content; + } + + $this->placeholders = array(); + + $callback = function ( $matches ) { + // Allow [[foo]] syntax for escaping a tag. + if ( '[' === $matches[1] and ']' === $matches[6] ) { + return $matches[0]; + } + + $tag = $matches[0]; + $tag_type = $matches[2]; + + $block_or_hidden = $this->tag_type_supports( + $tag_type, + array( 'display-block', 'display-hidden' ) + ); + + if ( $block_or_hidden ) { + $placeholder_tag_name = WPCF7_HTMLFormatter::placeholder_block; + } else { + $placeholder_tag_name = WPCF7_HTMLFormatter::placeholder_inline; + } + + $placeholder = sprintf( + '<%1$s id="%2$s" />', + $placeholder_tag_name, + hash( 'sha256', $tag ) + ); + + list( $placeholder ) = + WPCF7_HTMLFormatter::normalize_start_tag( $placeholder ); + + $this->placeholders[$placeholder] = $tag; + + return $placeholder; + }; + + return preg_replace_callback( + '/' . $this->tag_regex() . '/su', + $callback, + $content + ); + } + + + /** + * Replace placeholders in the given text with original form-tags. + */ + public function restore_from_placeholders( $content ) { + return str_replace( + array_keys( $this->placeholders ), + array_values( $this->placeholders ), + $content + ); + } + + + /** + * Replaces all form-tags in the text content. + * + * @param string $content The text content including form-tags. + * @return string The result of replacements. + */ + public function replace_all( $content ) { + return $this->scan( $content, true ); + } + + + /** + * Scans form-tags in the text content. + * + * @param string $content The text content including form-tags. + * @param bool $replace Optional. Whether scanned form-tags will be + * replaced. Default false. + * @return array|string An array of scanned form-tags if $replace is false. + * Otherwise text that scanned form-tags are replaced. + */ + public function scan( $content, $replace = false ) { + $this->scanned_tags = array(); + + if ( empty( $this->tag_types ) ) { + if ( $replace ) { + return $content; + } else { + return $this->scanned_tags; + } + } + + if ( $replace ) { + $content = preg_replace_callback( + '/' . $this->tag_regex() . '/su', + array( $this, 'replace_callback' ), + $content + ); + + return $content; + } else { + preg_replace_callback( + '/' . $this->tag_regex() . '/su', + array( $this, 'scan_callback' ), + $content + ); + + return $this->scanned_tags; + } + } + + + /** + * Filters form-tags based on a condition array argument. + * + * @param array|string $input The original form-tags collection. + * If it is a string, scans form-tags from it. + * @param array $cond The conditions that filtering will be based on. + * @return array The filtered form-tags collection. + */ + public function filter( $input, $cond ) { + if ( is_array( $input ) ) { + $tags = $input; + } elseif ( is_string( $input ) ) { + $tags = $this->scan( $input ); + } else { + $tags = $this->scanned_tags; + } + + $cond = wp_parse_args( $cond, array( + 'type' => array(), + 'basetype' => array(), + 'name' => array(), + 'feature' => array(), + ) ); + + $cond = array_map( static function ( $c ) { + return array_filter( array_map( 'trim', (array) $c ) ); + }, $cond ); + + $tags = array_filter( + (array) $tags, + function ( $tag ) use ( $cond ) { + $tag = new WPCF7_FormTag( $tag ); + + if ( + $cond['type'] and + ! in_array( $tag->type, $cond['type'], true ) + ) { + return false; + } + + if ( + $cond['basetype'] and + ! in_array( $tag->basetype, $cond['basetype'], true ) + ) { + return false; + } + + if ( + $cond['name'] and + ! in_array( $tag->name, $cond['name'], true ) + ) { + return false; + } + + foreach ( $cond['feature'] as $feature ) { + if ( str_starts_with( $feature, '!' ) ) { // Negation + $feature = trim( substr( $feature, 1 ) ); + + if ( $this->tag_type_supports( $tag->type, $feature ) ) { + return false; + } + } else { + if ( ! $this->tag_type_supports( $tag->type, $feature ) ) { + return false; + } + } + } + + return true; + } + ); + + return array_values( $tags ); + } + + + /** + * Returns the regular expression for a form-tag. + */ + private function tag_regex() { + $tag_types = implode( '|', + array_map( 'preg_quote', array_keys( $this->tag_types ) ) + ); + + $whitespaces = wpcf7_get_unicode_whitespaces(); + + return '(\[?)' + . '\[(' . $tag_types . ')' + . '(?:[' . $whitespaces . ']+(.*?))?' + . '(?:[' . $whitespaces . ']+(\/))?\]' + . '(?:([^[]*?)\[\/\2\])?' + . '(\]?)'; + } + + + /** + * The callback function for the form-tag replacement. + */ + private function replace_callback( $matches ) { + return $this->scan_callback( $matches, true ); + } + + + /** + * The callback function for the form-tag scanning. + */ + private function scan_callback( $matches, $replace = false ) { + // allow [[foo]] syntax for escaping a tag + if ( '[' === $matches[1] and ']' === $matches[6] ) { + return substr( $matches[0], 1, -1 ); + } + + $tag_type = $matches[2]; + $tag_basetype = trim( $tag_type, '*' ); + $attr = $this->parse_atts( $matches[3] ); + + $scanned_tag = array( + 'type' => $tag_type, + 'basetype' => $tag_basetype, + 'raw_name' => '', + 'name' => '', + 'options' => array(), + 'raw_values' => array(), + 'values' => array(), + 'pipes' => null, + 'labels' => array(), + 'attr' => '', + 'content' => '', + ); + + if ( $this->tag_type_supports( $tag_type, 'singular' ) ) { + $tags_in_same_basetype = $this->filter( + $this->scanned_tags, + array( 'basetype' => $tag_basetype ) + ); + + if ( $tags_in_same_basetype ) { + // Another tag in the same base type already exists. Ignore this one. + return $matches[0]; + } + } + + if ( $this->tag_type_supports( $tag_type, 'name-attr' ) ) { + if ( ! is_array( $attr ) ) { + return $matches[0]; // Invalid form-tag. + } + + $scanned_tag['raw_name'] = (string) array_shift( $attr['options'] ); + + if ( ! wpcf7_is_name( $scanned_tag['raw_name'] ) ) { + return $matches[0]; // Invalid name is used. Ignore this tag. + } + + $scanned_tag['name'] = strtr( $scanned_tag['raw_name'], '.', '_' ); + } + + if ( is_array( $attr ) ) { + $scanned_tag['options'] = (array) $attr['options']; + $scanned_tag['raw_values'] = (array) $attr['values']; + + if ( WPCF7_USE_PIPE ) { + $pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] ); + $scanned_tag['values'] = $pipes->collect_befores(); + $scanned_tag['pipes'] = $pipes; + } else { + $scanned_tag['values'] = $scanned_tag['raw_values']; + } + + $scanned_tag['labels'] = $scanned_tag['values']; + + } else { + $scanned_tag['attr'] = $attr; + } + + $scanned_tag['values'] = array_map( 'trim', $scanned_tag['values'] ); + $scanned_tag['labels'] = array_map( 'trim', $scanned_tag['labels'] ); + + $content = trim( $matches[5] ); + $content = preg_replace( "/$/m", '', $content ); + $scanned_tag['content'] = $content; + + $scanned_tag = apply_filters( 'wpcf7_form_tag', $scanned_tag, $replace ); + + $scanned_tag = new WPCF7_FormTag( $scanned_tag ); + + $this->scanned_tags[] = $scanned_tag; + + if ( $replace ) { + $callback = $this->tag_types[$tag_type]['function']; + return $matches[1] . call_user_func( $callback, $scanned_tag ) . $matches[6]; + } else { + return $matches[0]; + } + } + + + /** + * Parses the attributes of a form-tag to extract the name, + * options, and values. + * + * @param string $text Attributes of a form-tag. + * @return array|string An associative array of the options and values + * if the input is in the correct syntax, + * otherwise the input text itself. + */ + private function parse_atts( $text ) { + $atts = array( + 'options' => array(), + 'values' => array(), + ); + + $whitespaces = wpcf7_get_unicode_whitespaces(); + + $text = preg_replace( '/[\x{00a0}\x{200b}]+/u', ' ', $text ); + $text = wpcf7_strip_whitespaces( $text ); + + $pattern = '%^([-+*=0-9a-zA-Z:.!?#$&@_/|\%' . $whitespaces . ']*?)' + . '((?:' + . '[' . $whitespaces . ']*"[^"]*"' + . '|' + . '[' . $whitespaces . ']*\'[^\']*\'' + . ')*)$%u'; + + if ( preg_match( $pattern, $text, $matches ) ) { + if ( ! empty( $matches[1] ) ) { + $atts['options'] = preg_split( + sprintf( '/[%s]+/u', $whitespaces ), + wpcf7_strip_whitespaces( $matches[1] ) + ); + } + + if ( ! empty( $matches[2] ) ) { + preg_match_all( '/"[^"]*"|\'[^\']*\'/', $matches[2], $matched_values ); + $atts['values'] = wpcf7_strip_quote_deep( $matched_values[0] ); + } + } else { + $atts = $text; + } + + return $atts; + } + +} diff --git a/wp-content/plugins/contact-form-7/includes/formatting.php b/wp-content/plugins/contact-form-7/includes/formatting.php new file mode 100644 index 0000000..9194c9b --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/formatting.php @@ -0,0 +1,634 @@ +/is', + static function ( $matches ) use ( &$placeholders ) { + $placeholder = sprintf( + '<%1$s id="%2$s" />', + WPCF7_HTMLFormatter::placeholder_inline, + hash( 'sha256', $matches[0] ) + ); + + list( $placeholder ) = + WPCF7_HTMLFormatter::normalize_start_tag( $placeholder ); + + $placeholders[$placeholder] = $matches[0]; + + return $placeholder; + }, + $input + ); + + $formatter = new WPCF7_HTMLFormatter( array( + 'auto_br' => $br, + 'allowed_html' => null, + ) ); + + $chunks = $formatter->separate_into_chunks( $input ); + + $output = $formatter->format( $chunks ); + + // Restore from placeholders. + $output = str_replace( + array_keys( $placeholders ), + array_values( $placeholders ), + $output + ); + + return $output; +} + + +/** + * Newline preservation help function for wpcf7_autop(). + * + * @deprecated 5.7 Unnecessary to use any more. + * + * @param array $matches preg_replace_callback() matches array. + * @return string Text including newline placeholders. + */ +function wpcf7_autop_preserve_newline_callback( $matches ) { + return str_replace( "\n", '', $matches[0] ); +} + + +/** + * Sanitizes the query variables. + * + * @param string $text Query variable. + * @return string Text sanitized. + */ +function wpcf7_sanitize_query_var( $text ) { + $text = wp_unslash( $text ); + $text = wp_scrub_utf8( $text ); + + if ( str_contains( $text, '<' ) ) { + $text = wp_pre_kses_less_than( $text ); + $text = wp_strip_all_tags( $text ); + } + + $text = preg_replace( '/%[a-f0-9]{2}/i', '', $text ); + $text = preg_replace( '/ +/', ' ', $text ); + $text = trim( $text, ' ' ); + + return $text; +} + + +/** + * Strips quote characters surrounding the input. + * + * @param string $text Input text. + * @return string Processed output. + */ +function wpcf7_strip_quote( $text ) { + $text = wpcf7_strip_whitespaces( $text ); + + if ( preg_match( '/^"(.*)"$/s', $text, $matches ) ) { + $text = $matches[1]; + } elseif ( preg_match( "/^'(.*)'$/s", $text, $matches ) ) { + $text = $matches[1]; + } + + return $text; +} + + +/** + * Navigates through an array, object, or scalar, and + * strips quote characters surrounding the each value. + * + * @param mixed $input The array or string to be processed. + * @return mixed Processed value. + */ +function wpcf7_strip_quote_deep( $input ) { + if ( is_string( $input ) ) { + return wpcf7_strip_quote( $input ); + } + + if ( is_array( $input ) ) { + $result = array(); + + foreach ( $input as $key => $text ) { + $result[$key] = wpcf7_strip_quote_deep( $text ); + } + + return $result; + } +} + + +/** + * Normalizes newline characters. + * + * @param string $text Input text. + * @param string $to Optional. The newline character that is used in the output. + * @return string Normalized text. + */ +function wpcf7_normalize_newline( $text, $to = "\n" ) { + if ( ! is_string( $text ) ) { + return $text; + } + + $nls = array( "\r\n", "\r", "\n" ); + + if ( ! in_array( $to, $nls, true ) ) { + return $text; + } + + return str_replace( $nls, $to, $text ); +} + + +/** + * Navigates through an array, object, or scalar, and + * normalizes newline characters in the each value. + * + * @param mixed $input The array or string to be processed. + * @param string $to Optional. The newline character that is used in the output. + * @return mixed Processed value. + */ +function wpcf7_normalize_newline_deep( $input, $to = "\n" ) { + if ( is_array( $input ) ) { + $result = array(); + + foreach ( $input as $key => $text ) { + $result[$key] = wpcf7_normalize_newline_deep( $text, $to ); + } + + return $result; + } + + return wpcf7_normalize_newline( $input, $to ); +} + + +/** + * Strips newline characters. + * + * @param string $text Input text. + * @return string Processed one-line text. + */ +function wpcf7_strip_newline( $text ) { + $text = (string) $text; + $text = str_replace( array( "\r", "\n" ), '', $text ); + return wpcf7_strip_whitespaces( $text ); +} + + +/** + * Canonicalizes text. + * + * @param string $text Input text. + * @param string|array|object $options Options. + * @return string Canonicalized text. + */ +function wpcf7_canonicalize( $text, $options = '' ) { + // for back-compat + if ( + is_string( $options ) and + '' !== $options and + ! str_contains( $options, '=' ) + ) { + $options = array( + 'strto' => $options, + ); + } + + $options = wp_parse_args( $options, array( + 'strto' => 'lower', + 'strip_separators' => false, + ) ); + + static $charset = null; + + if ( ! isset( $charset ) ) { + $charset = get_option( 'blog_charset' ); + + $is_utf8 = in_array( + $charset, + array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), + true + ); + + if ( $is_utf8 ) { + $charset = 'UTF-8'; + } + } + + $text = html_entity_decode( $text, ENT_QUOTES | ENT_HTML5, $charset ); + + if ( function_exists( 'mb_convert_kana' ) ) { + $text = mb_convert_kana( $text, 'asKV', $charset ); + } + + if ( $options['strip_separators'] ) { + $text = preg_replace( '/[\r\n\t ]+/', '', $text ); + } else { + $text = preg_replace( '/[\r\n\t ]+/', ' ', $text ); + } + + if ( 'lower' === $options['strto'] ) { + if ( function_exists( 'mb_strtolower' ) ) { + $text = mb_strtolower( $text, $charset ); + } else { + $text = strtolower( $text ); + } + } elseif ( 'upper' === $options['strto'] ) { + if ( function_exists( 'mb_strtoupper' ) ) { + $text = mb_strtoupper( $text, $charset ); + } else { + $text = strtoupper( $text ); + } + } + + return wpcf7_strip_whitespaces( $text ); +} + + +/** + * Returns a canonical keyword usable for a name or an ID purposes. + */ +function wpcf7_canonicalize_name( $text ) { + return preg_replace( '/[^0-9a-z]+/i', '-', $text ); +} + + +/** + * Sanitizes Contact Form 7's form unit-tag. + * + * @param string $tag Unit-tag. + * @return string Sanitized unit-tag. + */ +function wpcf7_sanitize_unit_tag( $tag ) { + $tag = preg_replace( '/[^A-Za-z0-9_-]/', '', (string) $tag ); + return $tag; +} + + +/** + * Converts a file name to one that is not executable as a script. + * + * @param string $filename File name. + * @return string Converted file name. + */ +function wpcf7_antiscript_file_name( $filename ) { + $filename = wp_basename( $filename ); + + // Apply part of protection logic from sanitize_file_name(). + $filename = str_replace( + array( + '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', + '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}', + '%', '+', '’', '«', '»', '”', '“', chr( 0 ) + ), + '', + $filename + ); + + $filename = preg_replace( '/[\r\n\t -]+/', '-', $filename ); + $filename = preg_replace( '/[\pC\pZ]+/iu', '', $filename ); + + $parts = explode( '.', $filename ); + + if ( count( $parts ) < 2 ) { + return $filename; + } + + $script_pattern = '/^(php|phtml|pl|py|rb|cgi|asp|aspx)\d?$/i'; + + $filename = array_shift( $parts ); + $extension = array_pop( $parts ); + + foreach ( $parts as $part ) { + if ( preg_match( $script_pattern, $part ) ) { + $filename .= '.' . $part . '_'; + } else { + $filename .= '.' . $part; + } + } + + if ( preg_match( $script_pattern, $extension ) ) { + $filename .= '.' . $extension . '_.txt'; + } else { + $filename .= '.' . $extension; + } + + return $filename; +} + + +/** + * Masks a password with asterisks (*). + * + * @param int $right Length of right-hand unmasked text. Default 0. + * @param int $left Length of left-hand unmasked text. Default 0. + * @return string Text of masked password. + */ +function wpcf7_mask_password( $text, $right = 0, $left = 0 ) { + $length = strlen( $text ); + + $right = absint( $right ); + $left = absint( $left ); + + if ( $length < $right + $left ) { + $right = $left = 0; + } + + if ( $length <= 48 ) { + $masked = str_repeat( '*', $length - ( $right + $left ) ); + } elseif ( $right + $left < 48 ) { + $masked = str_repeat( '*', 48 - ( $right + $left ) ); + } else { + $masked = '****'; + } + + $left_unmasked = $left ? substr( $text, 0, $left ) : ''; + $right_unmasked = $right ? substr( $text, -1 * $right ) : ''; + + $text = $left_unmasked . $masked . $right_unmasked; + + return $text; +} + + +/** + * Returns an array of allowed HTML tags and attributes for a given context. + * + * @param string $context Context used to decide allowed tags and attributes. + * @return array Array of allowed HTML tags and their allowed attributes. + */ +function wpcf7_kses_allowed_html( $context = 'form' ) { + static $allowed_tags = array(); + + if ( isset( $allowed_tags[$context] ) ) { + return apply_filters( + 'wpcf7_kses_allowed_html', + $allowed_tags[$context], + $context + ); + } + + $allowed_tags[$context] = wp_kses_allowed_html( 'post' ); + + if ( 'form' === $context ) { + $additional_tags_for_form = array( + 'datalist' => array(), + 'fieldset' => array( + 'disabled' => true, + 'name' => true, + ), + 'input' => array( + 'accept' => true, + 'alt' => true, + 'autocomplete' => true, + 'capture' => true, + 'checked' => true, + 'disabled' => true, + 'list' => true, + 'max' => true, + 'maxlength' => true, + 'min' => true, + 'minlength' => true, + 'multiple' => true, + 'name' => true, + 'pattern' => true, + 'placeholder' => true, + 'readonly' => true, + 'required' => true, + 'size' => true, + 'step' => true, + 'type' => true, + 'value' => true, + ), + 'optgroup' => array( + 'disabled' => true, + 'label' => true, + ), + 'option' => array( + 'disabled' => true, + 'label' => true, + 'selected' => true, + 'value' => true, + ), + 'output' => array( + 'for' => true, + 'name' => true, + ), + 'select' => array( + 'autocomplete' => true, + 'disabled' => true, + 'multiple' => true, + 'name' => true, + 'required' => true, + 'size' => true, + ), + 'textarea' => array( + 'autocomplete' => true, + 'cols' => true, + 'disabled' => true, + 'maxlength' => true, + 'minlength' => true, + 'name' => true, + 'placeholder' => true, + 'readonly' => true, + 'required' => true, + 'rows' => true, + 'wrap' => true, + ), + ); + + $allowed_tags[$context] = array_merge( + $allowed_tags[$context], + $additional_tags_for_form + ); + + $allowed_tags[$context] = array_map( + static function ( $elm ) { + $global_attributes = array( + 'aria-atomic' => true, + 'aria-checked' => true, + 'aria-controls' => true, + 'aria-current' => true, + 'aria-describedby' => true, + 'aria-details' => true, + 'aria-disabled' => true, + 'aria-expanded' => true, + 'aria-hidden' => true, + 'aria-invalid' => true, + 'aria-label' => true, + 'aria-labelledby' => true, + 'aria-live' => true, + 'aria-relevant' => true, + 'aria-required' => true, + 'aria-selected' => true, + 'class' => true, + 'data-*' => true, + 'dir' => true, + 'hidden' => true, + 'id' => true, + 'inputmode' => true, + 'lang' => true, + 'popover' => true, + 'role' => true, + 'spellcheck' => true, + 'style' => true, + 'tabindex' => true, + 'title' => true, + 'xml:lang' => true, + ); + + return array_merge( $global_attributes, (array) $elm ); + }, + $allowed_tags[$context] + ); + } + + return apply_filters( + 'wpcf7_kses_allowed_html', + $allowed_tags[$context], + $context + ); +} + + +/** + * Sanitizes content for allowed HTML tags for the specified context. + * + * @param string $input Content to filter. + * @param string $context Context used to decide allowed tags and attributes. + * @return string Filtered text with allowed HTML tags and attributes intact. + */ +function wpcf7_kses( $input, $context = 'form' ) { + $output = wp_kses( + $input, + wpcf7_kses_allowed_html( $context ) + ); + + return $output; +} + + +/** + * Returns a formatted string of HTML attributes. + * + * @param array $atts Associative array of attribute name and value pairs. + * @return string Formatted HTML attributes. + */ +function wpcf7_format_atts( $atts ) { + $atts_filtered = array(); + + foreach ( $atts as $name => $value ) { + $name = strtolower( trim( $name ) ); + + if ( ! preg_match( '/^[a-z_:][a-z_:.0-9-]*$/', $name ) ) { + continue; + } + + static $boolean_attributes = array( + 'checked', + 'disabled', + 'inert', + 'multiple', + 'readonly', + 'required', + 'selected', + ); + + if ( in_array( $name, $boolean_attributes, true ) and '' === $value ) { + $value = false; + } + + if ( is_numeric( $value ) ) { + $value = (string) $value; + } + + if ( null === $value or false === $value ) { + unset( $atts_filtered[$name] ); + } elseif ( true === $value ) { + $atts_filtered[$name] = $name; // boolean attribute + } elseif ( is_string( $value ) ) { + $atts_filtered[$name] = trim( $value ); + } + } + + $output = ''; + + foreach ( $atts_filtered as $name => $value ) { + $output .= sprintf( ' %1$s="%2$s"', $name, esc_attr( $value ) ); + } + + return trim( $output ); +} + + +/** + * Returns the regular expression pattern that represents + * whitespace characters Unicode defines. + * + * @link https://www.unicode.org/Public/UCD/latest/ucd/PropList.txt + * + * @return string Regular expression pattern. + */ +function wpcf7_get_unicode_whitespaces() { + return '\x09-\x0D\x20\x85\xA0\x{1680}\x{2000}-\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}'; +} + + +/** + * Strips surrounding whitespaces. + * + * @link https://contactform7.com/2024/07/13/consistent-handling-policy-of-surrounding-whitespaces/ + * + * @param string|array $input Input text. + * @param string $side The side from which whitespaces are stripped. + * 'start', 'end', or 'both' (default). + * @return string|array Output text. + */ +function wpcf7_strip_whitespaces( $input, $side = 'both' ) { + if ( is_array( $input ) ) { + return array_map( + static function ( $i ) use ( $side ) { + return wpcf7_strip_whitespaces( $i, $side ); + }, + $input + ); + } + + // https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html + $whitespaces = wpcf7_get_unicode_whitespaces() . '\x{FEFF}'; + + if ( 'end' !== $side ) { + // Strip leading whitespaces + $input = preg_replace( + sprintf( '/^[%s]+/u', $whitespaces ), + '', + $input + ); + } + + if ( 'start' !== $side ) { + // Strip trailing whitespaces + $input = preg_replace( + sprintf( '/[%s]+$/u', $whitespaces ), + '', + $input + ); + } + + return $input; +} diff --git a/wp-content/plugins/contact-form-7/includes/functions.php b/wp-content/plugins/contact-form-7/includes/functions.php new file mode 100644 index 0000000..38699f7 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/functions.php @@ -0,0 +1,754 @@ + $uploads['basedir'], + 'url' => $uploads['baseurl'], + ) ); + + if ( 'dir' === $type ) { + return $uploads['dir']; + } if ( 'url' === $type ) { + return $uploads['url']; + } + + return $uploads; +} + + +/** + * Verifies that a correct security nonce was used with time limit. + * + * @param string $nonce Nonce value that was used for verification. + * @param string $action Optional. Context to what is taking place. + * Default 'wp_rest'. + * @return int|bool 1 if the nonce is generated between 0-12 hours ago, + * 2 if the nonce is generated between 12-24 hours ago. + * False if the nonce is invalid. + */ +function wpcf7_verify_nonce( $nonce, $action = 'wp_rest' ) { + return wp_verify_nonce( $nonce, $action ); +} + + +/** + * Creates a cryptographic token tied to a specific action, user, user session, + * and window of time. + * + * @param string $action Optional. Context to what is taking place. + * Default 'wp_rest'. + * @return string The token. + */ +function wpcf7_create_nonce( $action = 'wp_rest' ) { + return wp_create_nonce( $action ); +} + + +/** + * Converts multi-dimensional array to a flat array. + * + * @param mixed $input Array or item of array. + * @return array Flatten array. + */ +function wpcf7_array_flatten( $input ) { + if ( ! is_array( $input ) ) { + return array( $input ); + } + + $output = array(); + + foreach ( $input as $value ) { + $output = array_merge( $output, wpcf7_array_flatten( $value ) ); + } + + return $output; +} + + +/** + * Excludes unset or blank text values from the given array. + * + * @param array $input The array. + * @return array Array without blank text values. + */ +function wpcf7_exclude_blank( $input ) { + $output = array_filter( $input, + static function ( $i ) { + return isset( $i ) && '' !== $i; + } + ); + + return array_values( $output ); +} + + +/** + * Creates a comma-separated list from a multi-dimensional array. + * + * @param mixed $input Array or item of array. + * @param string|array $options Optional. Output options. + * @return string Comma-separated list. + */ +function wpcf7_flat_join( $input, $options = '' ) { + $options = wp_parse_args( $options, array( + 'separator' => ', ', + ) ); + + $input = wpcf7_array_flatten( $input ); + $output = array(); + + foreach ( $input as $value ) { + if ( is_scalar( $value ) ) { + $output[] = trim( (string) $value ); + } + } + + return implode( $options['separator'], $output ); +} + + +/** + * Returns true if HTML5 is supported. + */ +function wpcf7_support_html5() { + return (bool) wpcf7_apply_filters_deprecated( + 'wpcf7_support_html5', + array( true ), + '5.6', + '' + ); +} + + +/** + * Returns true if HTML5 fallback is active. + */ +function wpcf7_support_html5_fallback() { + return (bool) apply_filters( 'wpcf7_support_html5_fallback', false ); +} + + +/** + * Returns true if the Really Simple CAPTCHA plugin is used for contact forms. + */ +function wpcf7_use_really_simple_captcha() { + return apply_filters( 'wpcf7_use_really_simple_captcha', + WPCF7_USE_REALLY_SIMPLE_CAPTCHA + ); +} + + +/** + * Returns true if config validation is active. + */ +function wpcf7_validate_configuration() { + return apply_filters( 'wpcf7_validate_configuration', + WPCF7_VALIDATE_CONFIGURATION + ); +} + + +/** + * Returns true if wpcf7_autop() is applied. + */ +function wpcf7_autop_or_not( $options = '' ) { + $options = wp_parse_args( $options, array( + 'for' => 'form', + ) ); + + return (bool) apply_filters( 'wpcf7_autop_or_not', WPCF7_AUTOP, $options ); +} + + +/** + * Returns true if JavaScript for this plugin is loaded. + */ +function wpcf7_load_js() { + return apply_filters( 'wpcf7_load_js', WPCF7_LOAD_JS ); +} + + +/** + * Returns true if CSS for this plugin is loaded. + */ +function wpcf7_load_css() { + return apply_filters( 'wpcf7_load_css', WPCF7_LOAD_CSS ); +} + + +/** + * Builds an HTML anchor element. + * + * @param string $url Link URL. + * @param string $anchor_text Anchor label text. + * @param string|array $atts Optional. HTML attributes. + * @return string Formatted anchor element. + */ +function wpcf7_link( $url, $anchor_text, $atts = '' ) { + $atts = wp_parse_args( $atts, array( + 'id' => null, + 'class' => null, + ) ); + + $atts = array_merge( $atts, array( + 'href' => esc_url( $url ), + ) ); + + return sprintf( + '%2$s', + wpcf7_format_atts( $atts ), + esc_html( $anchor_text ) + ); +} + + +/** + * Returns the current request URL. + */ +function wpcf7_get_request_uri() { + static $request_uri = ''; + + if ( empty( $request_uri ) ) { + $request_uri = add_query_arg( array() ); + $request_uri = '/' . ltrim( $request_uri, '/' ); + } + + return sanitize_url( $request_uri ); +} + + +/** + * Registers post types used for this plugin. + */ +function wpcf7_register_post_types() { + if ( class_exists( 'WPCF7_ContactForm' ) ) { + WPCF7_ContactForm::register_post_type(); + return true; + } else { + return false; + } +} + + +/** + * Returns the version string of this plugin. + * + * @param string|array $options Optional. Output options. + * @return string Version string. + */ +function wpcf7_version( $options = '' ) { + $options = wp_parse_args( $options, array( + 'limit' => -1, + 'only_major' => false, + ) ); + + if ( $options['only_major'] ) { + $options['limit'] = 2; + } + + $options['limit'] = (int) $options['limit']; + + $ver = WPCF7_VERSION; + $ver = strtr( $ver, '_-+', '...' ); + $ver = preg_replace( '/[^0-9.]+/', '.$0.', $ver ); + $ver = preg_replace( '/[.]+/', '.', $ver ); + $ver = trim( $ver, '.' ); + $ver = explode( '.', $ver ); + + if ( -1 < $options['limit'] ) { + $ver = array_slice( $ver, 0, $options['limit'] ); + } + + $ver = implode( '.', $ver ); + + return $ver; +} + + +/** + * Returns array entries that match the given version. + * + * @param string $version The version to search for. + * @param array $input Search target array. + * @return array|bool Array of matched entries. False on failure. + */ +function wpcf7_version_grep( $version, array $input ) { + $pattern = '/^' . preg_quote( (string) $version, '/' ) . '(?:\.|$)/'; + + return preg_grep( $pattern, $input ); +} + + +/** + * Returns an enctype attribute value. + * + * @param string $enctype Enctype value. + * @return string Enctype value. Empty if not a valid enctype. + */ +function wpcf7_enctype_value( $enctype ) { + $enctype = trim( $enctype ); + + if ( empty( $enctype ) ) { + return ''; + } + + $valid_enctypes = array( + 'application/x-www-form-urlencoded', + 'multipart/form-data', + 'text/plain', + ); + + if ( in_array( $enctype, $valid_enctypes, true ) ) { + return $enctype; + } + + $pattern = '%^enctype="(' . implode( '|', $valid_enctypes ) . ')"$%'; + + if ( preg_match( $pattern, $enctype, $matches ) ) { + return $matches[1]; // for back-compat + } + + return ''; +} + + +/** + * Removes directory recursively. + * + * @param string $dir Directory path. + * @return bool True on success, false on failure. + */ +function wpcf7_rmdir_p( $dir ) { + $filesystem = WPCF7_Filesystem::get_instance(); + + return $filesystem->delete( $dir, true ); +} + + +/** + * Builds a URL-encoded query string. + * + * @link https://developer.wordpress.org/reference/functions/_http_build_query/ + * + * @param array $data URL query parameters. + * @param string $key Optional. If specified, used to prefix key name. + * @return string Query string. + */ +function wpcf7_build_query( $data, $key = '' ) { + $sep = '&'; + $ret = array(); + + foreach ( (array) $data as $k => $v ) { + $k = urlencode( $k ); + + if ( ! empty( $key ) ) { + $k = $key . '%5B' . $k . '%5D'; + } + + if ( null === $v ) { + continue; + } elseif ( false === $v ) { + $v = '0'; + } + + if ( is_array( $v ) or is_object( $v ) ) { + array_push( $ret, wpcf7_build_query( $v, $k ) ); + } else { + array_push( $ret, $k . '=' . urlencode( $v ) ); + } + } + + return implode( $sep, $ret ); +} + + +/** + * Returns the number of code units in a string. + * + * @link http://www.w3.org/TR/html5/infrastructure.html#code-unit-length + * + * @param string $text Input string. + * @return int|false The number of code units, or false if + * mb_convert_encoding is not available. + */ +function wpcf7_count_code_units( $text ) { + static $use_mb = null; + + if ( is_null( $use_mb ) ) { + $use_mb = function_exists( 'mb_convert_encoding' ); + } + + if ( ! $use_mb ) { + return false; + } + + $text = (string) $text; + + if ( '' === $text ) { + return 0; + } + + $text = str_replace( "\r\n", "\n", $text ); + + $text = mb_convert_encoding( + $text, + 'UTF-16', + mb_detect_encoding( $text, mb_detect_order(), true ) ?: 'UTF-8' + ); + + return intdiv( mb_strlen( $text, '8bit' ), 2 ); +} + + +/** + * Returns true if WordPress is running on the localhost. + */ +function wpcf7_is_localhost() { + $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); + + return in_array( + strtolower( $sitename ), + array( 'localhost', '127.0.0.1' ), + true + ); +} + + +/** + * Marks a function as deprecated and informs when it has been used. + * + * @param string $function_name The function that was called. + * @param string $version The version of Contact Form 7 that deprecated + * the function. + * @param string $replacement The function that should have been called. + */ +function wpcf7_deprecated_function( $function_name, $version, $replacement ) { + + if ( ! WP_DEBUG ) { + return; + } + + if ( function_exists( '__' ) ) { + /* translators: 1: PHP function name, 2: version number, 3: alternative function name */ + $message = __( 'Function %1$s is deprecated since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' ); + } else { + $message = 'Function %1$s is deprecated since Contact Form 7 version %2$s! Use %3$s instead.'; + } + + $message = sprintf( $message, $function_name, $version, $replacement ); + + wp_trigger_error( '', $message, E_USER_DEPRECATED ); +} + + +/** + * Fires functions attached to a deprecated filter hook. + * + * @param string $hook_name The name of the filter hook. + * @param array $args Array of additional function arguments to be + * passed to apply_filters(). + * @param string $version The version of Contact Form 7 that deprecated + * the hook. + * @param string $replacement The hook that should have been used. + */ +function wpcf7_apply_filters_deprecated( $hook_name, $args, $version, $replacement = '' ) { + if ( ! has_filter( $hook_name ) ) { + return $args[0]; + } + + if ( WP_DEBUG and apply_filters( 'deprecated_hook_trigger_error', true ) ) { + if ( $replacement ) { + wp_trigger_error( + '', + sprintf( + /* translators: 1: WordPress hook name, 2: version number, 3: alternative hook name */ + __( 'Hook %1$s is deprecated since Contact Form 7 version %2$s! Use %3$s instead.', 'contact-form-7' ), + $hook_name, + $version, + $replacement + ), + E_USER_DEPRECATED + ); + } else { + wp_trigger_error( + '', + sprintf( + /* translators: 1: WordPress hook name, 2: version number */ + __( 'Hook %1$s is deprecated since Contact Form 7 version %2$s with no alternative available.', 'contact-form-7' ), + $hook_name, + $version + ), + E_USER_DEPRECATED + ); + } + } + + return apply_filters_ref_array( $hook_name, $args ); +} + + +/** + * Marks something as being incorrectly called. + * + * @param string $function_name The function that was called. + * @param string $message A message explaining what has been done incorrectly. + * @param string $version The version of Contact Form 7 where the message + * was added. + */ +function wpcf7_doing_it_wrong( $function_name, $message, $version ) { + + if ( ! WP_DEBUG ) { + return; + } + + if ( function_exists( '__' ) ) { + if ( $version ) { + $version = sprintf( + /* translators: %s: Contact Form 7 version number. */ + __( '(This message was added in Contact Form 7 version %s.)', 'contact-form-7' ), + $version + ); + } + + wp_trigger_error( + '', + sprintf( + /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: Contact Form 7 version number. */ + __( 'Function %1$s was called incorrectly. %2$s %3$s', 'contact-form-7' ), + $function_name, + $message, + $version + ), + E_USER_NOTICE + ); + } else { + if ( $version ) { + $version = sprintf( + '(This message was added in Contact Form 7 version %s.)', + $version + ); + } + + wp_trigger_error( + '', + sprintf( + 'Function %1$s was called incorrectly. %2$s %3$s', + $function_name, + $message, + $version + ), + E_USER_NOTICE + ); + } +} + + +/** + * Triggers an error about a remote HTTP request and response. + * + * @param string $url The resource URL. + * @param array $request Request arguments. + * @param array|WP_Error $response The response or WP_Error on failure. + */ +function wpcf7_log_remote_request( $url, $request, $response ) { + + if ( ! WP_DEBUG ) { + return; + } + + $log = sprintf( + /* translators: 1: response code, 2: message, 3: body, 4: URL */ + __( 'HTTP Response: %1$s %2$s %3$s from %4$s', 'contact-form-7' ), + (int) wp_remote_retrieve_response_code( $response ), + wp_remote_retrieve_response_message( $response ), + wp_remote_retrieve_body( $response ), + $url + ); + + $log = apply_filters( 'wpcf7_log_remote_request', + $log, $url, $request, $response + ); + + if ( $log ) { + wp_trigger_error( '', $log, E_USER_NOTICE ); + } +} + + +/** + * Anonymizes an IP address by masking local part. + * + * @param string $ip_addr The original IP address. + * @return string|bool Anonymized IP address, or false on failure. + */ +function wpcf7_anonymize_ip_addr( $ip_addr ) { + if ( + ! function_exists( 'inet_ntop' ) or + ! function_exists( 'inet_pton' ) + ) { + return $ip_addr; + } + + $packed = inet_pton( $ip_addr ); + + if ( false === $packed ) { + return $ip_addr; + } + + if ( 4 === strlen( $packed ) ) { // IPv4 + $mask = '255.255.255.0'; + } elseif ( 16 === strlen( $packed ) ) { // IPv6 + $mask = 'ffff:ffff:ffff:0000:0000:0000:0000:0000'; + } else { + return $ip_addr; + } + + return inet_ntop( $packed & inet_pton( $mask ) ); +} + + +/** + * Retrieves a sanitized value from the $_GET superglobal. + * + * @param string $key Array key. + * @param mixed $default The default value returned when + * the specified superglobal is not set. + * @return mixed Sanitized value. + */ +function wpcf7_superglobal_get( $key, $default = '' ) { + return wpcf7_superglobal( 'get', $key ) ?? $default; +} + + +/** + * Retrieves a sanitized value from the $_POST superglobal. + * + * @param string $key Array key. + * @param mixed $default The default value returned when + * the specified superglobal is not set. + * @return mixed Sanitized value. + */ +function wpcf7_superglobal_post( $key, $default = '' ) { + return wpcf7_superglobal( 'post', $key ) ?? $default; +} + + +/** + * Retrieves a sanitized value from the $_REQUEST superglobal. + * + * @param string $key Array key. + * @param mixed $default The default value returned when + * the specified superglobal is not set. + * @return mixed Sanitized value. + */ +function wpcf7_superglobal_request( $key, $default = '' ) { + return wpcf7_superglobal( 'request', $key ) ?? $default; +} + + +/** + * Retrieves a sanitized value from the $_SERVER superglobal. + * + * @param string $key Array key. + * @param mixed $default The default value returned when + * the specified superglobal is not set. + * @return mixed Sanitized value. + */ +function wpcf7_superglobal_server( $key, $default = '' ) { + return wpcf7_superglobal( 'server', $key ) ?? $default; +} + + +/** + * Retrieves a sanitized value from the specified superglobal. + * + * @param string $superglobal A superglobal type. + * @param string $key Array key. + * @return string|array|null Sanitized value. Null if the array key + * doesn't exist. + */ +function wpcf7_superglobal( $superglobal, $key ) { + $superglobals = array( + 'get' => $_GET, + 'post' => $_POST, + 'request' => $_REQUEST, + 'server' => $_SERVER, + ); + + if ( isset( $superglobals[$superglobal][$key] ) ) { + return map_deep( + $superglobals[$superglobal][$key], + static function ( $val ) { + $val = wp_unslash( $val ); + $val = wp_scrub_utf8( $val ); + $val = wp_kses_no_null( $val ); + $val = wpcf7_strip_whitespaces( $val ); + return $val; + } + ); + } + + return null; +} diff --git a/wp-content/plugins/contact-form-7/includes/html-formatter.php b/wp-content/plugins/contact-form-7/includes/html-formatter.php new file mode 100644 index 0000000..d6a65b8 --- /dev/null +++ b/wp-content/plugins/contact-form-7/includes/html-formatter.php @@ -0,0 +1,870 @@ +options = wp_parse_args( $options, array( + 'auto_br' => true, + 'auto_indent' => true, + 'allowed_html' => wpcf7_kses_allowed_html(), + ) ); + } + + + /** + * Separates the given text into chunks of HTML. Each chunk must be an + * associative array that includes 'position', 'type', and 'content' keys. + * + * @param string $input Text to be separated into chunks. + * @return iterable Iterable of chunks. + */ + public function separate_into_chunks( $input ) { + $input_bytelength = strlen( $input ); + $position = 0; + + while ( $position < $input_bytelength ) { + $next_tag = preg_match( + '/(?:|<(?:\/?)[a-z].*?>)/is', + $input, + $matches, + PREG_OFFSET_CAPTURE, + $position + ); + + if ( ! $next_tag ) { + yield array( + 'position' => $position, + 'type' => self::text, + 'content' => substr( $input, $position ), + ); + + break; + } + + $next_tag = $matches[0][0]; + $next_tag_position = $matches[0][1]; + + if ( $position < $next_tag_position ) { + yield array( + 'position' => $position, + 'type' => self::text, + 'content' => substr( + $input, + $position, + $next_tag_position - $position + ), + ); + } + + if ( ' $next_tag_position, + 'type' => $next_tag_type, + 'content' => substr( + $input, + $next_tag_position, + strlen( $next_tag ) + ), + ); + + $position = $next_tag_position + strlen( $next_tag ); + } + } + + + /** + * Normalizes content in each chunk. This may change the type and position + * of the chunk. + * + * @param iterable $chunks The original chunks. + * @return iterable Normalized chunks. + */ + public function pre_format( $chunks ) { + $position = 0; + + foreach ( $chunks as $chunk ) { + $chunk['position'] = $position; + + // Standardize newline characters to "\n". + $chunk['content'] = str_replace( + array( "\r\n", "\r" ), "\n", $chunk['content'] + ); + + if ( self::start_tag === $chunk['type'] ) { + list( $chunk['content'] ) = + self::normalize_start_tag( $chunk['content'] ); + + // Replace
                by a line break. + if ( + $this->options['auto_br'] and + preg_match( '/^$/i', $chunk['content'] ) + ) { + $chunk['type'] = self::text; + $chunk['content'] = "\n"; + } + } + + yield $chunk; + $position = self::calc_next_position( $chunk ); + } + } + + + /** + * Concatenates neighboring text chunks to create a single chunk. + * + * @param iterable $chunks The original chunks. + * @return iterable Processed chunks. + */ + public function concatenate_texts( $chunks ) { + $position = 0; + $text_left = null; + + foreach ( $chunks as $chunk ) { + $chunk['position'] = $position; + + if ( self::text === $chunk['type'] ) { + if ( isset( $text_left ) ) { + $text_left['content'] .= $chunk['content']; + } else { + $text_left = $chunk; + } + + continue; + } + + if ( isset( $text_left ) ) { + yield $text_left; + $chunk['position'] = self::calc_next_position( $text_left ); + $text_left = null; + } + + yield $chunk; + $position = self::calc_next_position( $chunk ); + } + + if ( isset( $text_left ) ) { + yield $text_left; + } + } + + + /** + * Outputs formatted HTML based on the given chunks. + * + * @param iterable $chunks The original chunks. + * @return string Formatted HTML. + */ + public function format( $chunks ) { + $chunks = $this->pre_format( $chunks ); + $chunks = $this->concatenate_texts( $chunks ); + + $this->output = ''; + $this->stacked_elements = array(); + + foreach ( $chunks as $chunk ) { + + if ( self::text === $chunk['type'] ) { + $this->append_text( $chunk['content'] ); + } + + if ( self::start_tag === $chunk['type'] ) { + $this->start_tag( $chunk['content'] ); + } + + if ( self::end_tag === $chunk['type'] ) { + $this->end_tag( $chunk['content'] ); + } + + if ( self::comment === $chunk['type'] ) { + $this->append_comment( $chunk['content'] ); + } + } + + return $this->output(); + } + + + /** + * Appends preformatted text to the output property. + */ + public function append_preformatted( $content ) { + $this->output .= $content; + } + + + /** + * Appends whitespace to the output property. + */ + public function append_whitespace() { + $this->append_preformatted( ' ' ); + } + + + /** + * Appends a text node content to the output property. + * + * @param string $content Text node content. + */ + public function append_text( $content ) { + if ( $this->is_inside( array( 'pre', 'template' ) ) ) { + $this->append_preformatted( $content ); + return; + } + + if ( + empty( $this->stacked_elements ) or + $this->has_parent( 'p' ) or + $this->has_parent( self::p_parent_elements ) + ) { + // Close

                if the content starts with multiple line breaks. + if ( preg_match( '/^\s*\n\s*\n\s*/', $content ) ) { + $this->end_tag( 'p' ); + } + + // Split up the contents into paragraphs, separated by double line breaks. + $paragraphs = preg_split( '/\s*\n\s*\n\s*/', $content ); + + $paragraphs = array_filter( $paragraphs, static function ( $paragraph ) { + return '' !== wpcf7_strip_whitespaces( $paragraph ); + } ); + + $paragraphs = array_values( $paragraphs ); + + if ( $paragraphs ) { + if ( $this->is_inside( 'p' ) ) { + $paragraph = array_shift( $paragraphs ); + + $paragraph = self::normalize_paragraph( + $paragraph, + $this->options['auto_br'] + ); + + $this->append_preformatted( $paragraph ); + } + + foreach ( $paragraphs as $paragraph ) { + $this->start_tag( 'p' ); + + $paragraph = wpcf7_strip_whitespaces( $paragraph, 'start' ); + + $paragraph = self::normalize_paragraph( + $paragraph, + $this->options['auto_br'] + ); + + $this->append_preformatted( $paragraph ); + } + } + + // Close

                if the content ends with multiple line breaks. + if ( preg_match( '/\s*\n\s*\n\s*$/', $content ) ) { + $this->end_tag( 'p' ); + } + + // Cases where the content is a single line break. + if ( preg_match( '/^\s*\n\s*$/', $content ) ) { + $auto_br = $this->options['auto_br'] && $this->is_inside( 'p' ); + + $content = self::normalize_paragraph( $content, $auto_br ); + + $this->append_preformatted( $content ); + } + } else { + $auto_br = $this->options['auto_br'] && + $this->has_parent( self::br_parent_elements ); + + $content = self::normalize_paragraph( $content, $auto_br ); + + $this->append_preformatted( $content ); + } + } + + + /** + * Appends a start tag to the output property. + * + * @param string $tag A start tag. + */ + public function start_tag( $tag ) { + list( $tag, $tag_name ) = self::normalize_start_tag( $tag ); + + if ( + in_array( $tag_name, self::p_child_elements, true ) and + ! $this->is_inside( 'p' ) and + ! $this->is_inside( self::p_child_elements ) and + ! $this->has_parent( self::p_nonparent_elements ) + ) { + // Open

                if it does not exist. + $this->start_tag( 'p' ); + } + + $this->append_start_tag( $tag_name, array(), $tag ); + } + + + /** + * Appends a start tag to the output property. + * + * @param string $tag_name Tag name. + * @param array $atts Associative array of attribute name and value pairs. + * @param string $tag A start tag. + */ + public function append_start_tag( $tag_name, $atts = array(), $tag = '' ) { + if ( ! self::validate_tag_name( $tag_name ) ) { + wp_trigger_error( + __METHOD__, + sprintf( + /* translators: %s: Invalid HTML tag name */ + __( 'Invalid tag name (%s) is specified.', 'contact-form-7' ), + $tag_name + ), + E_USER_WARNING + ); + + return false; + } + + if ( WP_DEBUG and ! empty( $this->options['allowed_html'] ) ) { + $html_disallowance = array(); + + if ( ! isset( $this->options['allowed_html'][$tag_name] ) ) { + $html_disallowance = array( + 'element' => $tag_name, + ); + } else { + $atts_allowed = $this->options['allowed_html'][$tag_name]; + + $atts_disallowed = array_diff_ukey( $atts, $atts_allowed, + static function ( $key_1, $key_2 ) use ( $atts_allowed ) { + if ( + str_starts_with( $key_1, 'data-' ) and + ! empty( $atts_allowed['data-*'] ) and + preg_match( '/^data-[a-z0-9_-]+$/', $key_1 ) + ) { + return 0; + } else { + return $key_1 === $key_2 ? 0 : 1; + } + } + ); + + if ( ! empty( $atts_disallowed ) ) { + $html_disallowance = array( + 'element' => $tag_name, + 'attributes' => array_keys( $atts_disallowed ), + ); + } + } + + if ( $html_disallowance ) { + $notice = sprintf( + /* translators: %s: JSON-formatted array of disallowed HTML */ + __( 'HTML Disallowance: %s', 'contact-form-7' ), + wp_json_encode( $html_disallowance, JSON_PRETTY_PRINT ) + ); + + wp_trigger_error( __METHOD__, $notice, E_USER_NOTICE ); + } + } + + if ( + 'p' === $tag_name or + in_array( $tag_name, self::p_parent_elements, true ) or + in_array( $tag_name, self::p_nonparent_elements, true ) + ) { + // Close

                if it exists. + $this->end_tag( 'p' ); + } + + if ( 'dd' === $tag_name or 'dt' === $tag_name ) { + // Close

                and
                if closing tag is omitted. + $this->end_tag( 'dd' ); + $this->end_tag( 'dt' ); + } + + if ( 'li' === $tag_name ) { + // Close
              • if closing tag is omitted. + $this->end_tag( 'li' ); + } + + if ( 'optgroup' === $tag_name ) { + // Close if closing tag is omitted. + $this->end_tag( 'option' ); + $this->end_tag( 'optgroup' ); + } + + if ( 'option' === $tag_name ) { + // Close