Plugin Directory

Changeset 3162539


Ignore:
Timestamp:
10/04/2024 08:01:39 AM (18 months ago)
Author:
moazsup
Message:

Fixed an issue with special characters in file name

Location:
embed-sharepoint-onedrive-documents
Files:
106 added
6 edited

Legend:

Unmodified
Added
Removed
  • embed-sharepoint-onedrive-documents/trunk/API/class-azure.php

    r3157334 r3162539  
    489489        );
    490490        $url      = sprintf( $this->endpoints['folder_items_by_path'], $item_path );
     491        $this->manual_escape_url($url);
    491492        $response = $this->handler->mo_sps_get_request( $url, $args );
    492493
    493494        return $response;
    494495    }
     496
     497    function manual_escape_url( &$url ) {
     498        $characters_to_be_replaced = array(
     499            "{" => "%7B",
     500            " " => "%20",
     501            "[" => "%5B",
     502            "}" => "%7D",
     503            "]" => "%5D",
     504            "`" => "%60",
     505            "&" => "%26",
     506            "'" => "%27",
     507            "^" => "%5E"
     508        );
     509        foreach ( $characters_to_be_replaced as $char => $value ) {
     510            $url = str_replace( $char, $value, $url );
     511        }
     512    }
    495513}
  • embed-sharepoint-onedrive-documents/trunk/API/class-customermosps.php

    r3157536 r3162539  
    33 * This miniOrange Embed SharePoint OneDrive Documents allows you to connect with SharePoint and embed documents on WordPress site pages and posts.
    44 * Copyright (C) 2015 miniOrange
     5 *
     6 * @package     embed-sharepoint-onedrive-documents
     7 * @license     MIT
    58 */
    69
     
    324327            'email'       => array(
    325328                'customerKey' => $customer_key,
    326                 'from_email'  => $from_email,
     329                'fromEmail'  => $from_email,
    327330                'fromName'    => 'Xecurify',
    328331                'toEmail'     => 'info@xecurify.com',
  • embed-sharepoint-onedrive-documents/trunk/Wrappers/class-wpwrapper.php

    r3157334 r3162539  
    245245    }
    246246
    247     /**
    248     * Helper function to return the sanitized $_POST array
    249     *
    250     * @param array $array $_POST array.
    251     * @return array
    252     */
    253     public static function mo_sps_sanitize_array_map( $array ) {
     247    /**
     248    * Helper function to return the sanitized $_POST array
     249    *
     250    * @param array $array $_POST array.
     251    * @return array
     252    */
     253    public static function mo_sps_sanitize_array_map( $array ) {
    254254        $result = array();
    255255        foreach ( $array as $key => $value ) {
     
    257257                $key = sanitize_text_field( $key );
    258258            }
     259
    259260            if ( ! is_array( $value ) ) {
    260                 $value = sanitize_text_field( $value );
     261                if ( preg_match( '#^/drives/#', $value ) ) {
     262                    $value = wp_kses( ( $value ), array() );
     263                } else {
     264                    $value = sanitize_text_field( $value );
     265                }
    261266            }
     267
    262268            $result[ $key ] = $value;
    263269        }
     
    310316        delete_option( 'mo_sps_admin_api_key' );
    311317        delete_option( 'mo_sps_customer_token' );
    312 
    313318    }
    314319
     
    359364        return esc_url( plugin_dir_url( MO_SPS_PLUGIN_FILE ) . 'images/' . $image_name );
    360365    }
    361 
    362366}
  • embed-sharepoint-onedrive-documents/trunk/embed-sharepoint-onedrive-documents.php

    r3157536 r3162539  
    44Plugin URI: https://plugins.miniorange.com/
    55Description: This plugin allows you to sync and embed SharePoint documents, folders, and files in WordPress. You can download and preview SharePoint files directly from WordPress.
    6 Version: 2.3.0
     6Version: 2.3.1
    77Author: miniOrange
    88License: MIT
     
    2525
    2626define( 'MO_SPS_PLUGIN_URL', plugins_url( '', __FILE__ ) );
    27 define( 'MO_SPS_PLUGIN_VERSION', '2.2.9' );
     27define( 'MO_SPS_PLUGIN_VERSION', '2.3.1' );
    2828define( 'MO_SPS_PLUGIN_FILE', __FILE__ );
    2929/**
  • embed-sharepoint-onedrive-documents/trunk/includes/js/ajax.js

    r3157334 r3162539  
    403403      }
    404404      else {
    405       // var relative_path = web_url.split(encodeURI(config['drive_name'])).pop();
     405        // var relative_path = web_url.split(encodeURI(config['drive_name'])).pop();
    406406        if(doc_sync_data.connector == 'onedrive' && doc_sync_data.app_type == 'auto') {
    407           const [first, ...rest] = web_url.split(encodeURI('Documents'));
    408           var relative_path = rest.join(encodeURI('Documents'));
     407          var drive_name = config['drive_name'] === 'OneDrive' ? 'Documents' : config['drive_name'];
     408          const [first, ...rest] = web_url.split(encodeURI(drive_name));
     409          var relative_path = rest.join(encodeURI(drive_name));
    409410        }
    410411        var path_ele = [];
  • embed-sharepoint-onedrive-documents/trunk/readme.txt

    r3157536 r3162539  
    66Tested up to: 6.6
    77Requires PHP: 5.6
    8 Stable tag: 2.3.0
     8Stable tag: 2.3.1
    99License: MIT
    1010
     
    145145
    146146== ChangeLog ==
     147
     148= 2.3.1 =
     149* Fixed issue with the folders containing space in name
     150* BugFIX for OneDrive Business libraries
    147151
    148152= 2.3.0 =
     
    299303== Upgrade Notice ==
    300304
     305= 2.3.1 =
     306* Fixed issue with the folders containing space in name
     307* BugFIX for OneDrive Business libraries
     308
    301309= 2.3.0 =
    302310* Compatibility with WordPress 6.6
Note: See TracChangeset for help on using the changeset viewer.