Plugin Directory

Changeset 2999478


Ignore:
Timestamp:
11/21/2023 10:28:12 AM (16 months ago)
Author:
jorisvanmontfort
Message:

1.2.4

Location:
jvm-rich-text-icons/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • jvm-rich-text-icons/trunk/plugin.php

    r2890094 r2999478  
    33 * Plugin Name: JVM rich text icons
    44 * Description: Add Font Awesome icons, or icons from a custom icon set to the Gutenberg editor.
    5  * Version: 1.2.3
     5 * Version: 1.2.4
    66 * Author: Joris van Montfort
    77 * Author URI: https://jorisvm.nl
     
    1111 * @category Gutenberg
    1212 * @author Joris van Montfort
    13  * @version 1.2.3
     13 * @version 1.2.4
    1414 * @package JVM rich text icons
    1515 */
     
    2424
    2525if (is_admin()) {
    26     require_once plugin_dir_path( __FILE__ ) . 'src/settings.php';
     26   require_once plugin_dir_path( __FILE__ ) . 'src/settings.php';
    2727}
    2828
  • jvm-rich-text-icons/trunk/readme.txt

    r2890094 r2999478  
    8888== Changelog ==
    8989
     90= 1.2.4 =
     91Security update. Fixed a vulnerability issue in the uploader and plugin settings.
     92
    9093= 1.2.3 =
    9194Fixed the thick border around the toolbar button by using the correct toolbar button markup.
  • jvm-rich-text-icons/trunk/src/settings.php

    r2789395 r2999478  
    2020     */
    2121    public function try_add_settings() {
    22         $show_settings = apply_filters('jvm_richtext_icons_show_settings', true);
    23         if ($show_settings) {
    24             add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
    25             add_action( 'admin_init', array( $this, 'page_init' ) );
    26             add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ));
    27 
    28             // Ajax calls
    29             add_action('wp_ajax_jvm-rich-text-icons-delete-icon', array( $this, 'ajax_delete_icon'));
    30             add_action('wp_ajax_jvm-rich-text-icons-upload-icon', array( $this, 'ajax_upload_icon'));
    31 
    32             // Notice on settings screen if a custom icon set is loaded
    33             add_action('admin_notices', array($this, 'admin_notice'));
     22        $user = wp_get_current_user();
     23        // Only admin users have access to the settings.
     24        if (in_array( 'administrator', (array) $user->roles ) ) {
     25
     26            $show_settings = apply_filters('jvm_richtext_icons_show_settings', true);
     27            if ($show_settings) {
     28                add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
     29                add_action( 'admin_init', array( $this, 'page_init' ) );
     30                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ));
     31
     32                // Ajax calls
     33                if (current_user_can( 'upload_files' )) {
     34                    add_action('wp_ajax_jvm-rich-text-icons-delete-icon', array( $this, 'ajax_delete_icon'));
     35                    add_action('wp_ajax_jvm-rich-text-icons-upload-icon', array( $this, 'ajax_upload_icon'));
     36                }
     37
     38                // Notice on settings screen if a custom icon set is loaded
     39                add_action('admin_notices', array($this, 'admin_notice'));
     40            }
    3441        }
    3542    }
     
    117124     */
    118125    public function ajax_upload_icon() {
    119         if (isset($_FILES['file'])) {
     126        if (isset($_FILES['file']) && wp_verify_nonce($_GET['nonce'], 'jvm-rich-text-icons-upload-icon' )) {
    120127            // Check if file is SVG as we only accept SVG files
    121             if ($_FILES['file']['type'] == 'image/svg+xml') {
     128            $pi = pathinfo($_FILES['file']['name']);
     129            if ($_FILES['file']['type'] == 'image/svg+xml' && strtolower($pi['extension']) == 'svg') {
    122130               
    123131                $base = JVM_Richtext_icons::get_svg_directory();
Note: See TracChangeset for help on using the changeset viewer.