Plugin Directory

Changeset 3360513


Ignore:
Timestamp:
09/12/2025 12:22:48 PM (5 months ago)
Author:
sirv
Message:

tagging version 8.0.2

Location:
sirv/tags/8.0.2
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sirv/tags/8.0.2/plugdata/css/wp-options.css

    r3342799 r3360513  
    23392339    gap: 5px;
    23402340}
     2341
     2342ul.sirv-option-folder-issues {
     2343    color: red;
     2344    margin-top: 0;
     2345}
     2346
     2347ul.sirv-option-folder-issues li {
     2348    margin-bottom: 0;
     2349}
  • sirv/tags/8.0.2/plugdata/includes/classes/exclude.class.php

    r2934979 r3360513  
    1212
    1313    $excludeInput = get_option($excludeType);
    14     if($excludeType == 'SIRV_EXCLUDE_FILES'){
     14    if ( $excludeType == 'SIRV_EXCLUDE_FILES' ) {
    1515      $currentPath = self::clearCurrentPath($currentPath);
    16     } else if($excludeType == 'SIRV_EXCLUDE_RESPONSIVE_FILES'){
     16    } else if ( $excludeType == 'SIRV_EXCLUDE_RESPONSIVE_FILES' ) {
    1717        $currentPath['src'] = self::clearCurrentPath($currentPath['src']);
    1818    }
     
    4242  protected static function loop($excludePaths, $currentPath){
    4343    for ($i=0; $i < count($excludePaths); $i++) {
    44       if(! is_array($currentPath)){
    45         if (self::singleCheck($excludePaths[$i], $currentPath)) return true;
    46       }else{
    47         if(self::multipleCheck($excludePaths[$i], $currentPath)) return true;
     44      if ( ! is_array($currentPath) ) {
     45        if ( self::singleCheck($excludePaths[$i], $currentPath) ) return true;
     46      } else {
     47        if( self::multipleCheck($excludePaths[$i], $currentPath) ) return true;
    4848      }
    4949    }
     
    5656    $expression = self::convertExcludeStrToRegEx($excludePath);
    5757
     58    if ( $excludePath == '/' ) return self::is_homepage($currentPath);
     59
    5860    return self::check($currentPath, $expression);
    5961  }
     
    6264  protected static function multipleCheck($excludePath, $currentPath){
    6365    foreach ($currentPath as $attrName => $attrVal) {
    64       if($attrName == 'src'){
     66      if ( $attrName == 'src' ) {
    6567        $result = self::singleCheck($excludePath, $attrVal);
    66       }else if($attrName == 'class'){
     68      } else if ( $attrName == 'class' ) {
    6769        $explodedClasses = explode(" ", $attrVal);
    6870        $result = in_array($excludePath, $explodedClasses);
    69       }else{
     71      } else {
    7072        $result = $excludePath == $attrVal;
    7173      }
    7274
    73       if($result) return true;
     75      if( $result ) return true;
    7476    }
    7577
     
    8183    return preg_match('/' . $expression . '/', $path) != false;
    8284  }
     85
     86  public static function is_homepage($currentPath){
     87    if ($currentPath == '/' || is_home() || is_front_page() ) return true;
     88
     89    $home_url = get_home_url();
     90
     91    if ( $home_url === "" || $home_url === false ) return false;
     92
     93    $home_url .= Utils::endsWith($home_url, '/') ? '' : '/';
     94
     95    $currentPathInfo = parse_url($currentPath);
     96    $home_url_info = parse_url($home_url);
     97
     98    $checkCurrentPath = isset($currentPathInfo['query']) ? $currentPathInfo['path'] . '?' . $currentPathInfo['query'] : $currentPathInfo['path'];
     99
     100
     101    if ( $checkCurrentPath == $home_url_info['path'] ) return true;
     102
     103    return false;
     104  }
     105
    83106}
  • sirv/tags/8.0.2/plugdata/js/wp-options.js

    r3342799 r3360513  
    3838
    3939        Validator.prototype.email = function(fieldValue){
    40             //let regex = /^((?!\.)[\w-_.]*[^.])(@\w+)(\.\w+(\.\w+)?[^.\W])$/i;
    41             //let regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/i;
    4240            let regex = /^[a-z0-9!#$%&'"*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'"*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;
    4341            return !regex.test(fieldValue);
     
    6361            result = stringsArr.filter(function(str){return fieldValue.indexOf(str) !== -1});
    6462            return result.length > 0;
     63        }
     64
     65
     66        Validator.prototype.url = function(fieldValue){
     67            const regex = /^http(s)?:\/\//i;
     68            return regex.test(fieldValue);
     69        }
     70
     71
     72        Validator.prototype.folder = function(fieldValue){
     73            const regex = /^[a-zA-Z0-9\-\+\_\.\!\*\'\( \)\/\s]+$/i;
     74
     75            return !regex.test(fieldValue);
    6576        }
    6677
     
    811822        //sanitize folder name on sirv
    812823        $('#sirv-save-options').on('submit', function () {
    813             let folderOnSirv = $("[name='SIRV_FOLDER']").val();
    814             let sanitizedFolderOnSirv = folderOnSirv == '' ? 'WP_' + get_current_domain() : folderOnSirv.replace(/^[\/]*(.*?)[\/]*$/ig, '$1');
    815             if(sanitizedFolderOnSirv == '') sanitizedFolderOnSirv = 'WP_' + get_current_domain();
    816             $("[name='SIRV_FOLDER']").val(sanitizedFolderOnSirv);
     824            const folderOnSirv = $("[name='SIRV_FOLDER']").val().trim();
     825            const $folderOptionIssuesBlock = $(".sirv-option-folder-issues");
     826            const validator = new Validator();
     827            const issues = [];
     828
     829            $folderOptionIssuesBlock.empty();
     830
     831            if(validator.invalidValidate(folderOnSirv, validator.empty)){
     832                issues.push("Folder cannot be empty");
     833            }
     834
     835            if (folderOnSirv.startsWith("/") || folderOnSirv.endsWith("/")) {
     836                issues.push("Folder cannot start or end with /");
     837            }
     838
     839            if(validator.invalidValidate(folderOnSirv, validator.url)){
     840                issues.push("Folder cannot be a URL");
     841            }
     842
     843            if (validator.invalidValidate(folderOnSirv, validator.folder)) {
     844                issues.push("Folder can contain only letters, numbers, - + _ . ! * ' ( ) / or space.");
     845            }
     846
     847            if (issues.length > 0) {
     848                showInputIssues($folderOptionIssuesBlock, issues);
     849
     850                return false
     851            }
     852
     853            /* let sanitizedFolderOnSirv = folderOnSirv == '' ? 'WP_' + get_current_domain() : folderOnSirv.replace(/^[\/]*(.*?)[\/]*$/ig, '$1');
     854            if(sanitizedFolderOnSirv == '') sanitizedFolderOnSirv = 'WP_' + get_current_domain(); */
     855            $("[name='SIRV_FOLDER']").val(folderOnSirv);
    817856
    818857            return true;
    819858        });
     859
     860        //event listener for option sirv-text-to-input-option-text-cancel
     861        $(document).on('sirv-text-to-input-option-text-cancel', function(e) {
     862            const id = e.detail.id;
     863
     864            switch (id) {
     865                case "foldername":
     866                    $(".sirv-option-folder-issues").empty();
     867                    $(".sirv-warning-on-folder-change").addClass("sirv-hide");
     868                    break;
     869
     870                default:
     871                    break;
     872            }
     873        });
     874
     875
     876        function showInputIssues(element, issues) {
     877            const documentFragment = $(document.createDocumentFragment());
     878
     879            issues.forEach(issue => {
     880                documentFragment.append($(`<li>${issue}</li>`));
     881            });
     882
     883            element.append(documentFragment);
     884        }
    820885
    821886
     
    855920
    856921            const $button = $(this);
     922            const id = $button.attr('data-id') || "";
    857923            const type = $button.attr('data-type')
    858924            const $showValuePart = $(this).parent().find('.sirv-text-to-input-option-text-part');
     
    873939                $showValuePart.show();
    874940                $inputValuePart.hide();
     941
     942                if (id){
     943                    document.dispatchEvent(
     944                        new CustomEvent('sirv-text-to-input-option-text-cancel', {
     945                            detail: {
     946                                id
     947                            },
     948                        })
     949                    );
     950                }
    875951            }
    876952        }
  • sirv/tags/8.0.2/plugdata/submenu_pages/settings.php

    r3342799 r3360513  
    7070          <?php
    7171          if ($is_accountInfo_muted) {
    72             //$domains_mute_message = 'Option is disabled due to exceeding API usage rate limit. Refresh this page in <b>' . Utils::get_minutes(sirv_get_mute_expired_at($accountInfoEndpoint)) . ' minutes</b>';
    7372            $domains_mute_message = 'You\'ve exceeded your hourly API limit. This option is temporarily inaccessible for <b>' . Utils::get_minutes(sirv_get_mute_expired_at($accountInfoEndpoint)) . ' minutes</b>. Please try again after that or inform the <a href="https://sirv.com/help/support/#support" target="_blank">Sirv support team</a> if you keep seeing this message.';
    7473            echo '<div class="sirv-message-container">' . Utils::showMessage($domains_mute_message, 'warning') . '</div>';
     
    9089            ?>
    9190          </select>
     91
     92          <?php if ($is_accountInfo_muted || count($domains) <= 1) { ?>
     93            <input type="hidden" id="sirv_choose_domain" name="SIRV_CDN_URL" value="<?php echo $sirvCDNurl; ?>">
     94          <?php } ?>
     95
    9296        </td>
    9397      </tr>
     
    114118                  type="text"
    115119                  style="min-width: auto;"
    116                   placeholder="<?php echo htmlspecialchars($sirv_folder); ?>"
     120                  placeholder="e.g. WordPress or WP/media"
    117121                  value="<?php echo htmlspecialchars($sirv_folder); ?>"
    118                   name="SIRV_FOLDER" data-restore-value="<?php echo htmlspecialchars($sirv_folder); ?>"
    119                 >
     122                  name="SIRV_FOLDER" data-restore-value="<?php echo htmlspecialchars($sirv_folder); ?>">
    120123              </div>
    121               <a class="sirv-option-edit" href="#" data-type="render">Change</a>
     124              <a class="sirv-option-edit" href="#" data-type="render" data-id="foldername">Change</a>
    122125            </div>
    123126          </div>
     127          <ul class="sirv-option-folder-issues"></ul>
    124128          <div class="sirv-push-message-container sirv-push-message-warning sirv-hide sirv-warning-on-folder-change">
    125129            <div class="sirv-push-message sirv-push-message-warning-icon">
  • sirv/tags/8.0.2/plugdata/woo_templates/woo-product-template.php

    r3332255 r3360513  
    55 * This template for displaying Sirv Media Viewer in WC product pages
    66 *
    7  * @version 9.0.0
     7 * @version 9.7.0
    88 */
    99
  • sirv/tags/8.0.2/readme.txt

    r3342799 r3360513  
    66Requires at least: 3.0.1
    77Tested up to: 6.8.2
    8 Stable tag: 8.0.1
     8Stable tag: 8.0.2
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    224224== Changelog ==
    225225
     226= 8.0.2 (2025-09-12) =
     227* Fixed issue with incorrect display of "Folder name on Sirv".
     228* Added validation for option "Folder name on Sirv".
     229* Added option to use "/" to exclude home page from image replacement.
     230
    226231= 8.0.1 (2025-08-11) =
    227232* Fixed issue that could prevent "Folder name on Sirv" from working.
  • sirv/tags/8.0.2/sirv.php

    r3342799 r3360513  
    55 * Plugin URI: http://sirv.com
    66 * Description: Fully-automatic image optimization, next-gen formats (WebP), responsive resizing, lazy loading and CDN delivery. Every best-practice your website needs. Use "Add Sirv Media" button to embed images, galleries, zooms, 360 spins and streaming videos in posts / pages. Stunning media viewer for WooCommerce. Watermarks, text titles... every WordPress site deserves this plugin! <a href="admin.php?page=sirv/data/options.php">Settings</a>
    7  * Version:           8.0.1
     7 * Version:           8.0.2
    88 * Requires PHP:      5.6
    99 * Requires at least: 3.0.1
     
    1616
    1717
    18 define('SIRV_PLUGIN_VERSION', '8.0.1');
     18define('SIRV_PLUGIN_VERSION', '8.0.2');
    1919define('SIRV_PLUGIN_DIR', 'sirv');
    2020define('SIRV_PLUGIN_SUBDIR', 'plugdata');
     
    20242024  $exclude_str = '';
    20252025
    2026   if(!empty($new_data)){
     2026  if( !empty($new_data) ){
    20272027    $data = Exclude::parseExcludePaths($new_data);
    20282028    $home_url = home_url();
     
    60696069
    60706070  $email = trim(strtolower($_POST['email']));
    6071   $alias = $_POST['sirv_account'];
     6071  $account_token = $_POST['sirv_account'];
    60726072
    60736073  $sirvAPIClient = sirv_getAPIClient();
    60746074
    6075   if ( !empty($alias) ) {
    6076     $response = $sirvAPIClient->setupClientCredentials($alias);
     6075  if ( !empty($account_token) ) {
     6076    $response = $sirvAPIClient->setupClientCredentials($account_token);
    60776077    if ( $response['status'] ) {
    60786078      update_option('SIRV_ACCOUNT_EMAIL', sanitize_email($email));
Note: See TracChangeset for help on using the changeset viewer.