Plugin Directory

Changeset 3248106


Ignore:
Timestamp:
02/27/2025 09:19:18 PM (13 months ago)
Author:
artilab
Message:

Optimize load image 1.3.1

Location:
picture-tag
Files:
6 edited
10 copied

Legend:

Unmodified
Added
Removed
  • picture-tag/tags/1.3.1/README.md

    r3238162 r3248106  
    11# Picture Tag
    22
    3 **Version:** 1.3.0 
     3**Version:** 1.3.1 
    44**Author:** Artilab
    55
  • picture-tag/tags/1.3.1/includes/helpers.php

    r3209252 r3248106  
    2828}
    2929
    30 // Check if a file exists at a given URL
    31 function arti_check_if_file_exists( $url ) {
    32     $response = wp_remote_head( $url );
     30/**
     31 * Global cache for storing file check results
     32 */
     33global $arti_file_exists_cache;
     34if (!isset($arti_file_exists_cache)) {
     35    $arti_file_exists_cache = [];
     36}
    3337
    34     if ( is_wp_error( $response ) ) {
    35         return false;
     38/**
     39 * Optimized function for checking if a file exists
     40 *
     41 * @param string $url File URL to check
     42 * @param bool $force_check Force check, ignoring cache
     43 * @return bool True if file exists, false if not
     44 */
     45function arti_check_if_file_exists($url, $force_check = false) {
     46    global $arti_file_exists_cache;
     47   
     48    // Return cached result if available and not forcing a check
     49    if (!$force_check && isset($arti_file_exists_cache[$url])) {
     50        return $arti_file_exists_cache[$url];
    3651    }
     52   
     53    // Check if this is a local file
     54    $upload_dir = wp_get_upload_dir();
     55    $base_url = $upload_dir['baseurl'];
     56    $base_dir = $upload_dir['basedir'];
     57   
     58    // Convert URL to local path
     59    $file_path = str_replace(
     60        [site_url(), $base_url],
     61        [ABSPATH, $base_dir],
     62        $url
     63    );
     64   
     65    // Use quick check for local file
     66    $exists = file_exists($file_path);
     67   
     68    // Store result in cache
     69    $arti_file_exists_cache[$url] = $exists;
     70   
     71    return $exists;
     72}
    3773
    38     $status_code = wp_remote_retrieve_response_code( $response );
     74/**
     75 * Batch check existence of multiple files simultaneously
     76 *
     77 * @param array $urls Array of URLs to check
     78 * @return array Array with results where keys are URLs and values are boolean results
     79 */
     80function arti_batch_check_files_exist($urls) {
     81    global $arti_file_exists_cache;
     82   
     83    $uncached_urls = [];
     84    $results = [];
     85   
     86    // First check cache
     87    foreach ($urls as $url) {
     88        if (isset($arti_file_exists_cache[$url])) {
     89            $results[$url] = $arti_file_exists_cache[$url];
     90        } else {
     91            $uncached_urls[] = $url;
     92        }
     93    }
     94   
     95    if (empty($uncached_urls)) {
     96        return $results;
     97    }
     98   
     99    // Process local URLs
     100    $upload_dir = wp_get_upload_dir();
     101    $base_url = $upload_dir['baseurl'];
     102    $base_dir = $upload_dir['basedir'];
     103    $site_url = site_url();
     104   
     105    // Check local files
     106    foreach ($uncached_urls as $url) {
     107        $file_path = str_replace(
     108            [$site_url, $base_url],
     109            [ABSPATH, $base_dir],
     110            $url
     111        );
     112        $exists = file_exists($file_path);
     113        $results[$url] = $exists;
     114        $arti_file_exists_cache[$url] = $exists;
     115    }
     116   
     117    return $results;
     118}
    39119
    40     return $status_code === 200;
     120/**
     121 * Clear the file exists check cache
     122 */
     123function arti_clear_file_exists_cache() {
     124    global $arti_file_exists_cache;
     125    $arti_file_exists_cache = [];
    41126}
  • picture-tag/tags/1.3.1/includes/template-functions.php

    r3238162 r3248106  
    88 */
    99function arti_generate_picture_tag( $image_id, $sizes, $attr ) {
     10    static $transient_cache = [];
     11   
     12    // Create a unique key for caching the result
     13    $cache_key = 'arti_picture_' . $image_id . '_' . md5(serialize($sizes) . serialize($attr));
     14   
     15    // Check local cache (within a single request)
     16    if (isset($transient_cache[$cache_key])) {
     17        return $transient_cache[$cache_key];
     18    }
     19   
     20    // Check transient in database (between requests)
     21    $cached_html = get_transient($cache_key);
     22    if ($cached_html !== false) {
     23        $transient_cache[$cache_key] = $cached_html;
     24        return $cached_html;
     25    }
     26   
    1027    $upload_dir = wp_get_upload_dir();
    11 
    12     $webp_base_url = str_replace( $upload_dir['baseurl'], $upload_dir['baseurl'] . get_option( 'arti_webp_path', '/../compressx-nextgen/uploads' ), $upload_dir['baseurl'] );
    13     $avif_base_url = str_replace( $upload_dir['baseurl'], $upload_dir['baseurl'] . get_option( 'arti_avif_path', '/../compressx-nextgen/uploads' ), $upload_dir['baseurl'] );
    14 
     28    $webp_base_url = str_replace($upload_dir['baseurl'], $upload_dir['baseurl'] . get_option('arti_webp_path', '/../compressx-nextgen/uploads'), $upload_dir['baseurl']);
     29    $avif_base_url = str_replace($upload_dir['baseurl'], $upload_dir['baseurl'] . get_option('arti_avif_path', '/../compressx-nextgen/uploads'), $upload_dir['baseurl']);
     30
     31    $webp_urls = [];
     32    $avif_urls = [];
     33    $original_srcset = [];
    1534    $webp_srcset = [];
    1635    $avif_srcset = [];
    17     $original_srcset = [];
    18 
    19     foreach ( $sizes as $scale => $size ) {
    20         $image_src = wp_get_attachment_image_src( $image_id, $size );
    21         if ( $image_src ) {
     36    $scale_mapping = [];
     37
     38    // First collect all URLs that need to be checked
     39    foreach ($sizes as $scale => $size) {
     40        $image_src = wp_get_attachment_image_src($image_id, $size);
     41        if ($image_src) {
    2242            $image_url_size = $image_src[0];
    23             $image_webp_url = str_replace( $upload_dir['baseurl'], $webp_base_url, $image_url_size ) . '.webp';
    24             $image_avif_url = str_replace( $upload_dir['baseurl'], $avif_base_url, $image_url_size ) . '.avif';
    25 
    26             if ( arti_check_if_file_exists( $image_webp_url ) ) {
    27                 $webp_srcset[] = esc_url( $image_webp_url ) . " {$scale}";
     43            $image_webp_url = str_replace($upload_dir['baseurl'], $webp_base_url, $image_url_size) . '.webp';
     44            $image_avif_url = str_replace($upload_dir['baseurl'], $avif_base_url, $image_url_size) . '.avif';
     45           
     46            $webp_urls[$image_webp_url] = $scale;
     47            $avif_urls[$image_avif_url] = $scale;
     48            $original_srcset[] = esc_url($image_url_size) . " {$scale}";
     49           
     50            $scale_mapping[$image_webp_url] = $scale;
     51            $scale_mapping[$image_avif_url] = $scale;
     52        }
     53    }
     54   
     55    // Batch check all WebP files
     56    if (!empty($webp_urls)) {
     57        $webp_results = arti_batch_check_files_exist(array_keys($webp_urls));
     58        foreach ($webp_results as $url => $exists) {
     59            if ($exists) {
     60                $scale = $scale_mapping[$url];
     61                $webp_srcset[] = esc_url($url) . " {$scale}";
    2862            }
    29             if ( arti_check_if_file_exists( $image_avif_url ) ) {
    30                 $avif_srcset[] = esc_url( $image_avif_url ) . " {$scale}";
     63        }
     64    }
     65   
     66    // Batch check all AVIF files
     67    if (!empty($avif_urls)) {
     68        $avif_results = arti_batch_check_files_exist(array_keys($avif_urls));
     69        foreach ($avif_results as $url => $exists) {
     70            if ($exists) {
     71                $scale = $scale_mapping[$url];
     72                $avif_srcset[] = esc_url($url) . " {$scale}";
    3173            }
    32             $original_srcset[] = esc_url( $image_url_size ) . " {$scale}";
    3374        }
    3475    }
     
    3677    ob_start(); ?>
    3778<picture>
    38   <?php if ( ! empty( $avif_srcset ) ) : ?>
    39   <source srcset="<?php echo esc_attr( implode( ', ', $avif_srcset ) ); ?>" type="image/avif" />
     79  <?php if (!empty($avif_srcset)) : ?>
     80  <source srcset="<?php echo esc_attr(implode(', ', $avif_srcset)); ?>" type="image/avif" />
    4081  <?php endif; ?>
    41   <?php if ( ! empty( $webp_srcset ) ) : ?>
    42   <source srcset="<?php echo esc_attr( implode( ', ', $webp_srcset ) ); ?>" type="image/webp" />
     82  <?php if (!empty($webp_srcset)) : ?>
     83  <source srcset="<?php echo esc_attr(implode(', ', $webp_srcset)); ?>" type="image/webp" />
    4384  <?php endif; ?>
    44   <source srcset="<?php echo esc_attr( implode( ', ', $original_srcset ) ); ?>" type="image/jpeg" />
    45   <?php echo wp_get_attachment_image( $image_id, $sizes['1x'], false, arti_render_custom_attributes( $attr ) ); ?>
     85  <source srcset="<?php echo esc_attr(implode(', ', $original_srcset)); ?>" type="image/jpeg" />
     86  <?php echo wp_get_attachment_image($image_id, $sizes['1x'], false, arti_render_custom_attributes($attr)); ?>
    4687</picture>
    4788<?php
    48     return ob_get_clean();
     89    $html = ob_get_clean();
     90   
     91    // Save result in cache for 12 hours
     92    set_transient($cache_key, $html, 12 * HOUR_IN_SECONDS);
     93    $transient_cache[$cache_key] = $html;
     94   
     95    return $html;
    4996}
    5097
     
    126173    echo wp_kses( $html, $allowed_tags );
    127174}
     175
     176/**
     177 * Clear cache when media files are updated
     178 */
     179function arti_clear_picture_cache($attachment_id) {
     180    global $wpdb;
     181   
     182    // Delete all transients related to this image
     183    $wpdb->query($wpdb->prepare(
     184        "DELETE FROM $wpdb->options WHERE option_name LIKE %s",
     185        '_transient_arti_picture_' . $attachment_id . '_%'
     186    ));
     187   
     188    // Also clear expired transients
     189    $wpdb->query($wpdb->prepare(
     190        "DELETE FROM $wpdb->options WHERE option_name LIKE %s",
     191        '_transient_timeout_arti_picture_' . $attachment_id . '_%'
     192    ));
     193   
     194    // Clear global file check cache
     195    arti_clear_file_exists_cache();
     196}
     197
     198// Add hooks for clearing cache when media is updated
     199add_action('edit_attachment', 'arti_clear_picture_cache');
     200add_action('add_attachment', 'arti_clear_picture_cache');
     201add_action('delete_attachment', 'arti_clear_picture_cache');
  • picture-tag/tags/1.3.1/picture-tag.php

    r3238162 r3248106  
    33 * Plugin Name: Picture Tag
    44 * Description: Picture Tag with Custom Path Settings
    5  * Version: 1.3.0
     5 * Version: 1.3.1
    66 * Author: Artilab
    77 * Author URI: https://artilab.pro/
     
    1717
    1818define( 'ARTI_PICTURE_TAG_PLUGIN', __FILE__ );
    19 define( 'ARTI_PICTURE_TAG_PLUGIN_DIR', untrailingslashit( dirname( ARTI_PICTURE_TAG_PLUGIN ) ) );
    20 define( 'ARTI_PICTURE_TAG_PLUGIN_VERSION', '1.3.0' );
     19define( 'ARTI_PICTURE_TAG_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     20define( 'ARTI_PICTURE_TAG_PLUGIN_VERSION', '1.3.1' );
    2121
    2222
    2323// Include plugin files
    24 require_once plugin_dir_path( __FILE__ ) . 'includes/settings.php';
    25 require_once plugin_dir_path( __FILE__ ) . 'includes/helpers.php';
    26 require_once plugin_dir_path( __FILE__ ) . 'includes/template-functions.php';
    27 require_once plugin_dir_path( __FILE__ ) . 'includes/shortcode.php';
     24require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/settings.php';
     25require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/helpers.php';
     26require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/template-functions.php';
     27require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/shortcode.php';
    2828
    2929// Initialize plugin
  • picture-tag/tags/1.3.1/readme.txt

    r3238162 r3248106  
    55Tested up to:      6.7
    66Requires PHP:      7.4
    7 Stable tag:        1.3.0
     7Stable tag:        1.3.1
    88License:           GPL-2.0-or-later
    99License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    4949== Changelog ==
    5050
     51= 1.3.1 =
     52* Improved performance by focusing only on local file operations
     53* Improved code readability with clearer documentation
     54* Fixed potential timeout issues when checking image formats
     55
    5156= 1.3.0 =
    5257* Added support for custom data-* attributes in ```[arti_picture]``` shortcode.
  • picture-tag/trunk/README.md

    r3238162 r3248106  
    11# Picture Tag
    22
    3 **Version:** 1.3.0 
     3**Version:** 1.3.1 
    44**Author:** Artilab
    55
  • picture-tag/trunk/includes/helpers.php

    r3209252 r3248106  
    2828}
    2929
    30 // Check if a file exists at a given URL
    31 function arti_check_if_file_exists( $url ) {
    32     $response = wp_remote_head( $url );
     30/**
     31 * Global cache for storing file check results
     32 */
     33global $arti_file_exists_cache;
     34if (!isset($arti_file_exists_cache)) {
     35    $arti_file_exists_cache = [];
     36}
    3337
    34     if ( is_wp_error( $response ) ) {
    35         return false;
     38/**
     39 * Optimized function for checking if a file exists
     40 *
     41 * @param string $url File URL to check
     42 * @param bool $force_check Force check, ignoring cache
     43 * @return bool True if file exists, false if not
     44 */
     45function arti_check_if_file_exists($url, $force_check = false) {
     46    global $arti_file_exists_cache;
     47   
     48    // Return cached result if available and not forcing a check
     49    if (!$force_check && isset($arti_file_exists_cache[$url])) {
     50        return $arti_file_exists_cache[$url];
    3651    }
     52   
     53    // Check if this is a local file
     54    $upload_dir = wp_get_upload_dir();
     55    $base_url = $upload_dir['baseurl'];
     56    $base_dir = $upload_dir['basedir'];
     57   
     58    // Convert URL to local path
     59    $file_path = str_replace(
     60        [site_url(), $base_url],
     61        [ABSPATH, $base_dir],
     62        $url
     63    );
     64   
     65    // Use quick check for local file
     66    $exists = file_exists($file_path);
     67   
     68    // Store result in cache
     69    $arti_file_exists_cache[$url] = $exists;
     70   
     71    return $exists;
     72}
    3773
    38     $status_code = wp_remote_retrieve_response_code( $response );
     74/**
     75 * Batch check existence of multiple files simultaneously
     76 *
     77 * @param array $urls Array of URLs to check
     78 * @return array Array with results where keys are URLs and values are boolean results
     79 */
     80function arti_batch_check_files_exist($urls) {
     81    global $arti_file_exists_cache;
     82   
     83    $uncached_urls = [];
     84    $results = [];
     85   
     86    // First check cache
     87    foreach ($urls as $url) {
     88        if (isset($arti_file_exists_cache[$url])) {
     89            $results[$url] = $arti_file_exists_cache[$url];
     90        } else {
     91            $uncached_urls[] = $url;
     92        }
     93    }
     94   
     95    if (empty($uncached_urls)) {
     96        return $results;
     97    }
     98   
     99    // Process local URLs
     100    $upload_dir = wp_get_upload_dir();
     101    $base_url = $upload_dir['baseurl'];
     102    $base_dir = $upload_dir['basedir'];
     103    $site_url = site_url();
     104   
     105    // Check local files
     106    foreach ($uncached_urls as $url) {
     107        $file_path = str_replace(
     108            [$site_url, $base_url],
     109            [ABSPATH, $base_dir],
     110            $url
     111        );
     112        $exists = file_exists($file_path);
     113        $results[$url] = $exists;
     114        $arti_file_exists_cache[$url] = $exists;
     115    }
     116   
     117    return $results;
     118}
    39119
    40     return $status_code === 200;
     120/**
     121 * Clear the file exists check cache
     122 */
     123function arti_clear_file_exists_cache() {
     124    global $arti_file_exists_cache;
     125    $arti_file_exists_cache = [];
    41126}
  • picture-tag/trunk/includes/template-functions.php

    r3238162 r3248106  
    88 */
    99function arti_generate_picture_tag( $image_id, $sizes, $attr ) {
     10    static $transient_cache = [];
     11   
     12    // Create a unique key for caching the result
     13    $cache_key = 'arti_picture_' . $image_id . '_' . md5(serialize($sizes) . serialize($attr));
     14   
     15    // Check local cache (within a single request)
     16    if (isset($transient_cache[$cache_key])) {
     17        return $transient_cache[$cache_key];
     18    }
     19   
     20    // Check transient in database (between requests)
     21    $cached_html = get_transient($cache_key);
     22    if ($cached_html !== false) {
     23        $transient_cache[$cache_key] = $cached_html;
     24        return $cached_html;
     25    }
     26   
    1027    $upload_dir = wp_get_upload_dir();
    11 
    12     $webp_base_url = str_replace( $upload_dir['baseurl'], $upload_dir['baseurl'] . get_option( 'arti_webp_path', '/../compressx-nextgen/uploads' ), $upload_dir['baseurl'] );
    13     $avif_base_url = str_replace( $upload_dir['baseurl'], $upload_dir['baseurl'] . get_option( 'arti_avif_path', '/../compressx-nextgen/uploads' ), $upload_dir['baseurl'] );
    14 
     28    $webp_base_url = str_replace($upload_dir['baseurl'], $upload_dir['baseurl'] . get_option('arti_webp_path', '/../compressx-nextgen/uploads'), $upload_dir['baseurl']);
     29    $avif_base_url = str_replace($upload_dir['baseurl'], $upload_dir['baseurl'] . get_option('arti_avif_path', '/../compressx-nextgen/uploads'), $upload_dir['baseurl']);
     30
     31    $webp_urls = [];
     32    $avif_urls = [];
     33    $original_srcset = [];
    1534    $webp_srcset = [];
    1635    $avif_srcset = [];
    17     $original_srcset = [];
    18 
    19     foreach ( $sizes as $scale => $size ) {
    20         $image_src = wp_get_attachment_image_src( $image_id, $size );
    21         if ( $image_src ) {
     36    $scale_mapping = [];
     37
     38    // First collect all URLs that need to be checked
     39    foreach ($sizes as $scale => $size) {
     40        $image_src = wp_get_attachment_image_src($image_id, $size);
     41        if ($image_src) {
    2242            $image_url_size = $image_src[0];
    23             $image_webp_url = str_replace( $upload_dir['baseurl'], $webp_base_url, $image_url_size ) . '.webp';
    24             $image_avif_url = str_replace( $upload_dir['baseurl'], $avif_base_url, $image_url_size ) . '.avif';
    25 
    26             if ( arti_check_if_file_exists( $image_webp_url ) ) {
    27                 $webp_srcset[] = esc_url( $image_webp_url ) . " {$scale}";
     43            $image_webp_url = str_replace($upload_dir['baseurl'], $webp_base_url, $image_url_size) . '.webp';
     44            $image_avif_url = str_replace($upload_dir['baseurl'], $avif_base_url, $image_url_size) . '.avif';
     45           
     46            $webp_urls[$image_webp_url] = $scale;
     47            $avif_urls[$image_avif_url] = $scale;
     48            $original_srcset[] = esc_url($image_url_size) . " {$scale}";
     49           
     50            $scale_mapping[$image_webp_url] = $scale;
     51            $scale_mapping[$image_avif_url] = $scale;
     52        }
     53    }
     54   
     55    // Batch check all WebP files
     56    if (!empty($webp_urls)) {
     57        $webp_results = arti_batch_check_files_exist(array_keys($webp_urls));
     58        foreach ($webp_results as $url => $exists) {
     59            if ($exists) {
     60                $scale = $scale_mapping[$url];
     61                $webp_srcset[] = esc_url($url) . " {$scale}";
    2862            }
    29             if ( arti_check_if_file_exists( $image_avif_url ) ) {
    30                 $avif_srcset[] = esc_url( $image_avif_url ) . " {$scale}";
     63        }
     64    }
     65   
     66    // Batch check all AVIF files
     67    if (!empty($avif_urls)) {
     68        $avif_results = arti_batch_check_files_exist(array_keys($avif_urls));
     69        foreach ($avif_results as $url => $exists) {
     70            if ($exists) {
     71                $scale = $scale_mapping[$url];
     72                $avif_srcset[] = esc_url($url) . " {$scale}";
    3173            }
    32             $original_srcset[] = esc_url( $image_url_size ) . " {$scale}";
    3374        }
    3475    }
     
    3677    ob_start(); ?>
    3778<picture>
    38   <?php if ( ! empty( $avif_srcset ) ) : ?>
    39   <source srcset="<?php echo esc_attr( implode( ', ', $avif_srcset ) ); ?>" type="image/avif" />
     79  <?php if (!empty($avif_srcset)) : ?>
     80  <source srcset="<?php echo esc_attr(implode(', ', $avif_srcset)); ?>" type="image/avif" />
    4081  <?php endif; ?>
    41   <?php if ( ! empty( $webp_srcset ) ) : ?>
    42   <source srcset="<?php echo esc_attr( implode( ', ', $webp_srcset ) ); ?>" type="image/webp" />
     82  <?php if (!empty($webp_srcset)) : ?>
     83  <source srcset="<?php echo esc_attr(implode(', ', $webp_srcset)); ?>" type="image/webp" />
    4384  <?php endif; ?>
    44   <source srcset="<?php echo esc_attr( implode( ', ', $original_srcset ) ); ?>" type="image/jpeg" />
    45   <?php echo wp_get_attachment_image( $image_id, $sizes['1x'], false, arti_render_custom_attributes( $attr ) ); ?>
     85  <source srcset="<?php echo esc_attr(implode(', ', $original_srcset)); ?>" type="image/jpeg" />
     86  <?php echo wp_get_attachment_image($image_id, $sizes['1x'], false, arti_render_custom_attributes($attr)); ?>
    4687</picture>
    4788<?php
    48     return ob_get_clean();
     89    $html = ob_get_clean();
     90   
     91    // Save result in cache for 12 hours
     92    set_transient($cache_key, $html, 12 * HOUR_IN_SECONDS);
     93    $transient_cache[$cache_key] = $html;
     94   
     95    return $html;
    4996}
    5097
     
    126173    echo wp_kses( $html, $allowed_tags );
    127174}
     175
     176/**
     177 * Clear cache when media files are updated
     178 */
     179function arti_clear_picture_cache($attachment_id) {
     180    global $wpdb;
     181   
     182    // Delete all transients related to this image
     183    $wpdb->query($wpdb->prepare(
     184        "DELETE FROM $wpdb->options WHERE option_name LIKE %s",
     185        '_transient_arti_picture_' . $attachment_id . '_%'
     186    ));
     187   
     188    // Also clear expired transients
     189    $wpdb->query($wpdb->prepare(
     190        "DELETE FROM $wpdb->options WHERE option_name LIKE %s",
     191        '_transient_timeout_arti_picture_' . $attachment_id . '_%'
     192    ));
     193   
     194    // Clear global file check cache
     195    arti_clear_file_exists_cache();
     196}
     197
     198// Add hooks for clearing cache when media is updated
     199add_action('edit_attachment', 'arti_clear_picture_cache');
     200add_action('add_attachment', 'arti_clear_picture_cache');
     201add_action('delete_attachment', 'arti_clear_picture_cache');
  • picture-tag/trunk/picture-tag.php

    r3238162 r3248106  
    33 * Plugin Name: Picture Tag
    44 * Description: Picture Tag with Custom Path Settings
    5  * Version: 1.3.0
     5 * Version: 1.3.1
    66 * Author: Artilab
    77 * Author URI: https://artilab.pro/
     
    1717
    1818define( 'ARTI_PICTURE_TAG_PLUGIN', __FILE__ );
    19 define( 'ARTI_PICTURE_TAG_PLUGIN_DIR', untrailingslashit( dirname( ARTI_PICTURE_TAG_PLUGIN ) ) );
    20 define( 'ARTI_PICTURE_TAG_PLUGIN_VERSION', '1.3.0' );
     19define( 'ARTI_PICTURE_TAG_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     20define( 'ARTI_PICTURE_TAG_PLUGIN_VERSION', '1.3.1' );
    2121
    2222
    2323// Include plugin files
    24 require_once plugin_dir_path( __FILE__ ) . 'includes/settings.php';
    25 require_once plugin_dir_path( __FILE__ ) . 'includes/helpers.php';
    26 require_once plugin_dir_path( __FILE__ ) . 'includes/template-functions.php';
    27 require_once plugin_dir_path( __FILE__ ) . 'includes/shortcode.php';
     24require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/settings.php';
     25require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/helpers.php';
     26require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/template-functions.php';
     27require_once ARTI_PICTURE_TAG_PLUGIN_DIR . 'includes/shortcode.php';
    2828
    2929// Initialize plugin
  • picture-tag/trunk/readme.txt

    r3238162 r3248106  
    55Tested up to:      6.7
    66Requires PHP:      7.4
    7 Stable tag:        1.3.0
     7Stable tag:        1.3.1
    88License:           GPL-2.0-or-later
    99License URI:       https://www.gnu.org/licenses/gpl-2.0.html
     
    4949== Changelog ==
    5050
     51= 1.3.1 =
     52* Improved performance by focusing only on local file operations
     53* Improved code readability with clearer documentation
     54* Fixed potential timeout issues when checking image formats
     55
    5156= 1.3.0 =
    5257* Added support for custom data-* attributes in ```[arti_picture]``` shortcode.
Note: See TracChangeset for help on using the changeset viewer.