Skip to content

Commit

Permalink
v1.29.1
Browse files Browse the repository at this point in the history
  • Loading branch information
optipic-io committed Jul 12, 2022
1 parent 6ff7852 commit bf72528
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion optipic/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>optipic</name>
<displayName><![CDATA[OptiPic]]></displayName>
<version><![CDATA[1.29.0]]></version>
<version><![CDATA[1.29.1]]></version>
<description><![CDATA[OptiPic - image optimization via smart CDN. The module automates the process of optimizing and compressing all images on the site according to the recommendations of Google PageSpeed Insights.]]></description>
<author><![CDATA[OptiPic]]></author>
<tab><![CDATA[seo]]></tab>
Expand Down
17 changes: 16 additions & 1 deletion optipic/optipic.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ class Optipic extends Module
const EXCLUSIONS_URL = 'OPTIPIC_EXCLUSIONS_URL';
const WHITELIST_IMG_URL = 'OPTIPIC_WHITELIST_IMG_URL';
const SRCSET_ATTRS = 'OPTIPIC_SRCSET_ATTRS';
const CDN_DOMAIN = 'OPTIPIC_CDN_DOMAIN';

public function __construct()
{
$this->name = 'optipic';
$this->version = '1.29.0';
$this->version = '1.29.1';
$this->author = 'OptiPic';
$this->tab = 'seo';
$this->need_instance = 0;
Expand Down Expand Up @@ -60,6 +61,7 @@ public function install()
!Configuration::updateValue(self::EXCLUSIONS_URL, '') ||
!Configuration::updateValue(self::WHITELIST_IMG_URL, '') ||
!Configuration::updateValue(self::SRCSET_ATTRS, '') ||
!Configuration::updateValue(self::CDN_DOMAIN, '') ||
!$this->registerHook('actionOutputHTMLBefore') ||
!$this->registerHook('displayBackOfficeHeader')
) {
Expand All @@ -79,6 +81,7 @@ public function uninstall()
|| !Configuration::deleteByName(self::EXCLUSIONS_URL)
|| !Configuration::deleteByName(self::WHITELIST_IMG_URL)
|| !Configuration::deleteByName(self::SRCSET_ATTRS)
|| !Configuration::deleteByName(self::CDN_DOMAIN)
) {
return false;
}
Expand All @@ -99,13 +102,15 @@ public function getContent()
$settings['exclusions_url']= (string) Tools::getValue(self::EXCLUSIONS_URL);
$settings['whitelist_img_urls']= (string) Tools::getValue(self::WHITELIST_IMG_URL);
$settings['srcset_attrs']= (string) Tools::getValue(self::SRCSET_ATTRS);
$settings['cdn_domain']= (string) Tools::getValue(self::CDN_DOMAIN);

if (!Validate::isGenericName($settings['autoreplace_active'])
|| !Validate::isGenericName($settings['site_id'])
|| !Validate::isGenericName($settings['domains'])
|| !Validate::isGenericName($settings['exclusions_url'])
|| !Validate::isGenericName($settings['whitelist_img_urls'])
|| !Validate::isGenericName($settings['srcset_attrs'])
|| !Validate::isGenericName($settings['cdn_domain'])
) {
$output .= $this->displayError($this->l('Invalid Configuration value'));
} else {
Expand Down Expand Up @@ -186,6 +191,13 @@ public function displayForm()
'rows' => 3,
'desc' => $this->l('List of tag attributes, in which you need to replace srcset-markup of images. Each on a new line'),
],
[
'type' => 'text',
'label' => $this->l('CDN domain'),
'desc' => $this->l('Domain through which CDN OptiPic will work. You can use your subdomain (img.yourdomain.com, optipic.yourdomain.com, etc.) instead of the standard cdn.optipic.io. To connect your subdomain, contact OptiPic technical support.'),
'name' => self::CDN_DOMAIN,
'size' => 20
],
],
'submit' => [
'title' => $this->l('Save'),
Expand Down Expand Up @@ -218,6 +230,7 @@ public function displayForm()
$helper->fields_value[self::EXCLUSIONS_URL] = Tools::getValue(self::EXCLUSIONS_URL, Configuration::get(self::EXCLUSIONS_URL));
$helper->fields_value[self::WHITELIST_IMG_URL] = Tools::getValue(self::WHITELIST_IMG_URL, Configuration::get(self::WHITELIST_IMG_URL));
$helper->fields_value[self::SRCSET_ATTRS] = Tools::getValue(self::SRCSET_ATTRS, Configuration::get(self::SRCSET_ATTRS));
$helper->fields_value[self::CDN_DOMAIN] = Tools::getValue(self::CDN_DOMAIN, Configuration::get(self::CDN_DOMAIN));



Expand Down Expand Up @@ -246,6 +259,7 @@ public function getSettings()
//!='' ? explode("\n", str_replace(array("\r\n", "\n", "\r"), PHP_EOL, Configuration::get(self::WHITELIST_IMG_URL, ''))) : array(),
'srcset_attrs' => Configuration::get(self::SRCSET_ATTRS, ''),
//!='' ? explode("\n", str_replace(array("\r\n", "\n", "\r"), PHP_EOL, Configuration::get(self::SRCSET_ATTRS, ''))) : array(),
'cdn_domain' => Configuration::get(self::CDN_DOMAIN, ''),
);
}

Expand All @@ -258,6 +272,7 @@ public function setSettings($settings)
Configuration::updateValue(self::EXCLUSIONS_URL, $settings['exclusions_url']);
Configuration::updateValue(self::WHITELIST_IMG_URL, $settings['whitelist_img_urls']);
Configuration::updateValue(self::SRCSET_ATTRS, $settings['srcset_attrs']);
Configuration::updateValue(self::CDN_DOMAIN, $settings['cdn_domain']);
}

public function hookActionOutputHTMLBefore(array $params)
Expand Down
4 changes: 2 additions & 2 deletions optipic/translations/ru.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
$_MODULE['<{optipic}prestashop>optipic_' . md5('Replace only URLs of images starting with a mask')] = 'Подменять только URL изображений, начинающихся с маски';
$_MODULE['<{optipic}prestashop>optipic_' . md5('List of "srcset" attributes')] = 'Список "srcset" атрибутов';
$_MODULE['<{optipic}prestashop>optipic_' . md5('List of tag attributes, in which you need to replace srcset-markup of images. Each on a new line')] = 'Список атрибутов тегов, в которых нужно заменить srcset-разметку изображений. Каждый на новой строке';


$_MODULE['<{optipic}prestashop>optipic_' . md5('CDN domain')] = 'CDN домен';
$_MODULE['<{optipic}prestashop>optipic_' . md5('Domain through which CDN OptiPic will work. You can use your subdomain (img.yourdomain.com, optipic.yourdomain.com, etc.) instead of the standard cdn.optipic.io. To connect your subdomain, contact OptiPic technical support.')] = 'Домен через который будет работать CDN OptiPic. Вы можете использовать поддомен вашего домена (img.yourdomain.com, optipic.yourdomain.com и т.п.) вместо стандартного cdn.optipic.io. Для подключению своего поддомена обратитесь в техподдержку OptiPic.';

0 comments on commit bf72528

Please sign in to comment.