-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c20a4b
commit d193995
Showing
10 changed files
with
74 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
/** | ||
* @package JUImage | ||
* @since 4.0 | ||
* @subpackage Class | ||
* | ||
* @author Denys D. Nosov ([email protected]) | ||
* @copyright (C) 2011-2021 by Denys D. Nosov (https://joomla-ua.org) | ||
* @copyright (C) 2011-2022 by Denys D. Nosov (https://joomla-ua.org) | ||
* @license GNU General Public License version 2 or later | ||
* | ||
* @since 4.0 | ||
* @package JUImage | ||
*/ | ||
|
||
include_once __DIR__ . '/vendor/autoload.php'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extension type="library" version="@minjversion@" method="upgrade"> | ||
<extension type="library" | ||
version="@minjversion@" | ||
method="upgrade"> | ||
<name>JUImage</name> | ||
<libraryname>juimage</libraryname> | ||
<creationDate>@date@</creationDate> | ||
<author>Denys Nosov</author> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>https://joomla-ua.org</authorUrl> | ||
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> | ||
<copyright>(C) 2006-2021 Joomla! Ukraine. All rights reserved.</copyright> | ||
<copyright>(C) 2006-2022 Joomla! Ukraine. All rights reserved.</copyright> | ||
<version>@version@</version> | ||
<packager>Joomla! Ukraine</packager> | ||
<packagerurl>https://joomla-ua.org</packagerurl> | ||
|
@@ -20,6 +22,8 @@ | |
<file>blank.png</file> | ||
</files> | ||
<updateservers> | ||
<server type="extension" priority="1" name="juimage">https://joomla-ua.org/update/lib/juimage.xml</server> | ||
<server type="extension" | ||
priority="1" | ||
name="juimage">https://joomla-ua.org/update/lib/juimage.xml</server> | ||
</updateservers> | ||
</extension> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
<?php | ||
/** | ||
* @package JUImage | ||
* @since 5.0 | ||
* @subpackage Class | ||
* | ||
* @author Denys D. Nosov ([email protected]) | ||
* @copyright (C) 2016-2021 by Denys D. Nosov (https://joomla-ua.org) | ||
* @copyright (C) 2016-2022 by Denys D. Nosov (https://joomla-ua.org) | ||
* @license GNU General Public License version 2 or later | ||
* | ||
* @since 5.0 | ||
* @package JUImage | ||
*/ | ||
|
||
/** | ||
* Installation class to perform additional changes during install/uninstall/update | ||
* | ||
* @since 5.0 | ||
* @package JUImage | ||
* | ||
* @since 5.0 | ||
*/ | ||
class JUImageInstallerScript | ||
{ | ||
|
@@ -73,17 +73,17 @@ public function postflight() | |
$path . 'vendor/rosell-dk/webp-convert/src/Converters/Binaries' | ||
]; | ||
|
||
foreach( $files AS $file ) | ||
foreach($files as $file) | ||
{ | ||
if( file_exists($file) ) | ||
if(file_exists($file)) | ||
{ | ||
unlink($file); | ||
} | ||
} | ||
|
||
foreach( $folders AS $folder ) | ||
foreach($folders as $folder) | ||
{ | ||
if( is_dir($folder) ) | ||
if(is_dir($folder)) | ||
{ | ||
$this->unlinkRecursive($folder, 1); | ||
} | ||
|
@@ -100,29 +100,31 @@ public function postflight() | |
*/ | ||
public function unlinkRecursive($dir, $deleteRootToo) | ||
{ | ||
if( !$dh = opendir($dir) ) | ||
if(!$dh = opendir($dir)) | ||
{ | ||
return; | ||
return true; | ||
} | ||
|
||
while( false !== ($obj = readdir($dh)) ) | ||
while(false !== ($obj = readdir($dh))) | ||
{ | ||
if( $obj === '.' || $obj === '..' ) | ||
if($obj === '.' || $obj === '..') | ||
{ | ||
continue; | ||
} | ||
|
||
if( !unlink($dir . '/' . $obj) ) | ||
if(!unlink($dir . '/' . $obj)) | ||
{ | ||
$this->unlinkRecursive($dir . '/' . $obj, true); | ||
} | ||
} | ||
|
||
closedir($dh); | ||
|
||
if( $deleteRootToo ) | ||
if($deleteRootToo) | ||
{ | ||
rmdir($dir); | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
/** | ||
* @package JUImage | ||
* @since 5.0 | ||
* @subpackage Class | ||
* | ||
* @author Denys D. Nosov ([email protected]) | ||
* @copyright (C) 2011-2021 by Denys D. Nosov (https://joomla-ua.org) | ||
* @copyright (C) 2011-2022 by Denys D. Nosov (https://joomla-ua.org) | ||
* @license GNU General Public License version 2 or later | ||
* | ||
* @since 5.0 | ||
* @package JUImage | ||
*/ | ||
|
||
use Joomla\CMS\Plugin\CMSPlugin; | ||
|
@@ -17,9 +17,9 @@ | |
/** | ||
* JUImage plugin class. | ||
* | ||
* @since 5.0 | ||
* @package JUImage plugin | ||
* | ||
* @since 5.0 | ||
*/ | ||
class plgSystemJUImage extends CMSPlugin | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<extension type="plugin" version="@minjversion@" group="system" method="upgrade"> | ||
<extension type="plugin" | ||
version="@minjversion@" | ||
group="system" | ||
method="upgrade"> | ||
<name>System - JUImage</name> | ||
<author>Denys Nosov</author> | ||
<creationDate>@date@</creationDate> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>https://joomla-ua.org</authorUrl> | ||
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> | ||
<copyright>(C) 2019-2021 Joomla! Ukraine. All rights reserved.</copyright> | ||
<copyright>(C) 2019-2022 Joomla! Ukraine. All rights reserved.</copyright> | ||
<version>@version@</version> | ||
<description>Register JUImage library.</description> | ||
<files> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<extension type="package" version="@minjversion@" method="upgrade"> | ||
<extension type="package" | ||
version="@minjversion@" | ||
method="upgrade"> | ||
<name>JUImage</name> | ||
<packagename>juimage</packagename> | ||
<creationDate>@date@</creationDate> | ||
<packager>Joomla! Ukraine</packager> | ||
<copyright>(C) 2016-2021 Denys Nosov, Joomla! Ukraine</copyright> | ||
<copyright>(C) 2016-2022 Denys Nosov, Joomla! Ukraine</copyright> | ||
<packageremail>[email protected]</packageremail> | ||
<packagerurl>https://joomla-ua.org</packagerurl> | ||
<author>Denys Nosov, Joomla! Ukraine</author> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>https://joomla-ua.org</authorUrl> | ||
<version>@version@</version> | ||
<description/> | ||
<description /> | ||
<scriptfile>script.php</scriptfile> | ||
<update>https://joomla-ua.org/update/lib/juimage.xml</update> | ||
<updateservers> | ||
<server type="extension" priority="1" name="juimage">https://joomla-ua.org/update/lib/juimage.xml</server> | ||
<server type="extension" | ||
priority="1" | ||
name="juimage">https://joomla-ua.org/update/lib/juimage.xml</server> | ||
</updateservers> | ||
<files folder="packages"> | ||
<file type="plugin" id="juimage" group="system">plg_system_juimage.zip</file> | ||
<file type="library" id="juimage">lib_juimage.zip</file> | ||
<file type="plugin" | ||
id="juimage" | ||
group="system">plg_system_juimage.zip</file> | ||
<file type="library" | ||
id="juimage">lib_juimage.zip</file> | ||
</files> | ||
</extension> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<?php | ||
/** | ||
* @package JUImage | ||
* @since 4.0 | ||
* @subpackage Class | ||
* | ||
* @author Denys D. Nosov ([email protected]) | ||
* @copyright (C) 2011-2021 by Denys D. Nosov (https://joomla-ua.org) | ||
* @copyright (C) 2011-2022 by Denys D. Nosov (https://joomla-ua.org) | ||
* @license GNU General Public License version 2 or later | ||
* | ||
* @since 4.0 | ||
* @package JUImage | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
@@ -71,17 +71,17 @@ public function postflight() | |
$path . 'vendor/rosell-dk/webp-convert/src/Converters/Binaries' | ||
]; | ||
|
||
foreach( $files AS $file ) | ||
foreach($files as $file) | ||
{ | ||
if( file_exists($file) ) | ||
if(file_exists($file)) | ||
{ | ||
unlink($file); | ||
} | ||
} | ||
|
||
foreach( $folders AS $folder ) | ||
foreach($folders as $folder) | ||
{ | ||
if( is_dir($folder) ) | ||
if(is_dir($folder)) | ||
{ | ||
$this->unlinkRecursive($folder, 1); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
* @subpackage Class | ||
* | ||
* @author Denys D. Nosov ([email protected]) | ||
* @copyright (C) 2016-2021 by Denys D. Nosov (https://joomla-ua.org) | ||
* @copyright (C) 2016-2022 by Denys D. Nosov (https://joomla-ua.org) | ||
* @license GNU General Public License version 2 or later | ||
* | ||
* @package JUImage | ||
|
@@ -115,7 +115,7 @@ private function thumb($url, array $attr = []) | |
$url = $this->createVideoThumb($url); | ||
} | ||
|
||
$headers = get_headers($url); | ||
$headers = get_headers($url, true); | ||
if(strpos($headers[ 0 ], '200') === false) | ||
{ | ||
$_error = true; | ||
|
@@ -132,7 +132,7 @@ private function thumb($url, array $attr = []) | |
|
||
$img_name = pathinfo($url)[ 'filename' ]; | ||
$img_url = strtolower($img_name); | ||
$img_url = preg_replace('#[[:punct:]]#', '', $img_url); | ||
$img_url = preg_replace('#[:punct:]#', '', $img_url); | ||
$img_url = preg_replace('#[а-яёєїіЁЄЇІ]#iu', '', $img_url); | ||
$img_url = str_replace([ ' +', ' ' ], [ '_', '' ], $img_url); | ||
} | ||
|
@@ -176,7 +176,7 @@ private function thumb($url, array $attr = []) | |
if($_error === true) | ||
{ | ||
$error_image = implode($error_image); | ||
$url = $error_image === '' ? $this->path . '/' . $this->img_blank : $error_image; | ||
$url = ($error_image === '' ? $this->path . '/' . $this->img_blank : $error_image); | ||
} | ||
|
||
// Image Size | ||
|
@@ -190,8 +190,7 @@ private function thumb($url, array $attr = []) | |
|
||
// Path to Folder | ||
$subfolder = $img_cache . '/' . $img_size . '/' . $img_name; | ||
|
||
$uri_attr = []; | ||
$uri_attr = []; | ||
if(!empty($attr) && is_array($attr)) | ||
{ | ||
foreach($attr as $k => $v) | ||
|
@@ -334,7 +333,6 @@ private function createThumb($url, $img_cache, $target, array $attr = []) | |
private function createVideoThumb($url, $video_detect = false) | ||
{ | ||
$urls = parse_url($url); | ||
|
||
if($video_detect === true) | ||
{ | ||
return $urls[ 'host' ] === 'youtu.be' || $urls[ 'host' ] === 'youtube.com' || $urls[ 'host' ] === 'www.youtube.com' || $urls[ 'host' ] === 'vimeo.com'; | ||
|
@@ -414,6 +412,7 @@ private function youtube($id) | |
private function vimeo($id) | ||
{ | ||
$vimeo = json_decode(file_get_contents('https://vimeo.com/api/v2/video/' . $id . '.json')); | ||
|
||
if(!empty($vimeo)) | ||
{ | ||
return $vimeo[ 0 ]->thumbnail_large; | ||
|
@@ -452,7 +451,7 @@ private function makeDir($dir) | |
*/ | ||
private function http($url) | ||
{ | ||
$header = get_headers($url); | ||
$header = get_headers($url, true); | ||
|
||
return substr($header[ 0 ], 9, 3); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters