Plugin Directory

Changeset 3089813


Ignore:
Timestamp:
05/21/2024 04:12:22 AM (22 months ago)
Author:
ashikcse
Message:

fix issues and add admin notice.

Location:
cits-support-svg-webp-media-upload/trunk
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • cits-support-svg-webp-media-upload/trunk/init.php

    r3085990 r3089813  
    1313License: GPL2
    1414*/
    15 
     15define('CITS_PLUGIN_URL', plugin_dir_url(__FILE__));
     16define('CITS_PLUGIN_PATH', plugin_dir_path(__FILE__));
    1617require_once __DIR__ . '/vendor/autoload.php';
    1718
    1819class CITS_SUPPORT_SVG_WEBP_MEDIA {
    1920    public function __construct() {
     21        add_action('admin_enqueue_scripts', array($this, 'cits_enqueue_admin_styles'));
     22         
    2023        add_filter('upload_mimes', array($this, 'cits_upload_media_mimes'));
    2124        add_filter('file_is_displayable_image', array($this, 'cits_is_displayable_webp'), 10, 2);
     
    2326        add_filter('wp_check_filetype_and_ext', array($this, 'cits_check_types'), 10, 4);
    2427        add_filter('wp_handle_upload_prefilter', array($this, 'cits_sanitize_svg')); 
     28       
     29        // Include the admin file
     30        include CITS_PLUGIN_PATH . 'admin/cits-admin.php';
    2531    }
    2632   
     
    5965            $type = $check_filetype['type'];
    6066            $proper_filename = $filename;
    61             if ($type && 0 === strpos($type, 'image/') && $ext !== 'svg') {
     67            if ($type && (0 === strpos($type, 'image/')) && ($ext !== 'svg' && $ext !== 'webp' && $ext !== 'ico')) {
    6268                $ext = $type = false;
    63             } 
     69            }
    6470            $checked = compact('ext', 'type', 'proper_filename');
    6571        }
     
    123129        return $file;
    124130    }
     131   
     132    function cits_enqueue_admin_styles() {
     133        wp_enqueue_style('cits_admin_css', CITS_PLUGIN_URL . 'admin/cits-admin.css');
     134    }
    125135}
    126136
  • cits-support-svg-webp-media-upload/trunk/readme.txt

    r3085996 r3089813  
    2222*  ICO Media support
    2323
     24== Video Tutorial ==
     25How to Install and Active Plugin
     26https://www.youtube.com/watch?v=ag_ujxvW9Uo
     27
    2428== Installation ==
    2529
Note: See TracChangeset for help on using the changeset viewer.