Plugin Directory

Changeset 3335462


Ignore:
Timestamp:
07/28/2025 03:43:43 PM (8 months ago)
Author:
scaleflex
Message:
  • Add option for sort default
  • Add progress bar for upload
  • Add option keep all plugin data when deactivating the plugin
Location:
scaleflex-vxp-dam-dmo
Files:
57 added
8 edited

Legend:

Unmodified
Added
Removed
  • scaleflex-vxp-dam-dmo/trunk/README.txt

    r3334147 r3335462  
    55Tested up to: 6.8
    66Requires at least: 4.8
    7 Stable tag: 1.0.12
     7Stable tag: 1.0.13
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    170170
    171171= 1.0.1 =
    172 Refactor and fix bug
     172* Refactor and fix bug
    173173
    174174= 1.0.2 =
    175 Fix bug JS
     175* Fix bug JS
    176176
    177177= 1.0.3 =
    178 Refactor and fix bug
     178* Refactor and fix bug
    179179
    180180= 1.0.4 =
    181 Fix bug
     181* Fix bug
    182182
    183183= 1.0.5 =
    184 Fix bug on Classic Editor
     184* Fix bug on Classic Editor
    185185
    186186= 1.0.6 =
    187 Fix conflict version php
     187* Fix conflict version php
    188188
    189189= 1.0.7 =
    190 Refactor and fix bug
     190* Refactor and fix bug
    191191
    192192= 1.0.8 =
    193 Rename the plugin
     193* Rename the plugin
    194194
    195195= 1.0.9 =
    196 Fix bug sync asset
     196* Fix bug sync asset
    197197
    198198= 1.0.10 =
    199 Add example url for webhook
     199* Add example url for webhook
    200200
    201201= 1.0.11 =
    202 Fix query issue
     202* Fix query issue
    203203
    204204= 1.0.12 =
    205 Fix the UI of upload button
     205* Fix the UI of upload button
     206
     207= 1.0.13 =
     208* Add option for sort default
     209* Add progress bar for upload
     210* Add option keep all plugin data when deactivating the plugin
     211
    206212
    207213== Upgrade Notice ==
  • scaleflex-vxp-dam-dmo/trunk/assets/js/dam-widget/fmaw.js

    r3320917 r3335462  
    157157                const widgetDiv = document.createElement("div");
    158158                widgetDiv.id = "filerobot-widget";
     159                const progressPanelDiv = document.createElement("div");
     160                progressPanelDiv.id = "filerobot-progress-panel";
    159161                jQuery(media_frame).html('<div class="attachments-browser has-load-more"></div>');
    160162                jQuery(media_frame).find('.attachments-browser').append(widgetDiv);
     163                jQuery(media_frame).find('.attachments-browser').append(progressPanelDiv);
    161164            }
    162165
  • scaleflex-vxp-dam-dmo/trunk/assets/js/dam-widget/sfxvxp-widget-page.js

    r3320917 r3335462  
    4242
    4343                // Plugins
    44                 let Explorer  = Filerobot.Explorer;
    45                 let XHRUpload = Filerobot.XHRUpload;
     44                const Explorer  = Filerobot.Explorer;
     45                const XHRUpload = Filerobot.XHRUpload;
     46                const ProgressPanel = Filerobot.ProgressPanel
    4647
    4748                let queryString = window.location.search;
     
    6465                }
    6566
     67                let defaultSort = {
     68                    by: 'name',
     69                    order: 'asc'
     70                };
     71                let sort_default_option = sfxvxp_admin_meta.sfxvxp_sort_default_option;
     72                if (sort_default_option !== '' && sort_default_option !== null) {
     73                    switch (sort_default_option) {
     74                        case 'name_asc':
     75                            defaultSort.by = 'name';
     76                            defaultSort.order = 'asc';
     77                            break;
     78                        case 'name_desc':
     79                            defaultSort.by = 'name';
     80                            defaultSort.order = 'desc';
     81                            break;
     82                        case 'created_asc':
     83                            defaultSort.by = 'created_at';
     84                            defaultSort.order = 'asc';
     85                            break;
     86                        case 'created_desc':
     87                            defaultSort.by = 'created_at';
     88                            defaultSort.order = 'desc';
     89                            break;
     90                        case 'updated_asc':
     91                            defaultSort.by = 'modified_at';
     92                            defaultSort.order = 'asc';
     93                            break;
     94                        case 'updated_desc':
     95                            defaultSort.by = 'modified_at';
     96                            defaultSort.order = 'desc';
     97                            break;
     98                        default:
     99                            break;
     100                    }
     101                }
     102
    66103                filerobot
    67104                    .use(Explorer, {
    68105                        config: {
    69                             rootFolderPath: directory
     106                            rootFolderPath: directory,
     107                            defaultSort
    70108                        },
    71109                        target: '#filerobot-widget',
     
    80118                        hideDownloadButtonIcon: true,
    81119                        preventDownloadDefaultBehavior: true,
     120                        showProgressDetails: true,
    82121                        locale: {
    83122                            strings: {
     
    86125                            }
    87126                        },
     127                    })
     128                    .use(ProgressPanel, {
     129                        target: '#filerobot-progress-panel',
    88130                    })
    89131                    .use(XHRUpload)
  • scaleflex-vxp-dam-dmo/trunk/assets/js/deactivate-popup.js

    r3320917 r3335462  
    3434    modal.style.borderRadius = "8px";
    3535    modal.style.width = "400px";
    36     modal.style.textAlign = "center";
    3736    modal.style.boxShadow = "0 4px 10px rgba(0, 0, 0, 0.2)";
    3837
     
    4039    let title = document.createElement("h3");
    4140    title.innerText = "Scaleflex VXP";
     41    title.style.textAlign = "center";
    4242
    4343    // Content
     
    4949    let question = document.createElement("p");
    5050    question.innerText = "Are you sure you want to deactivate the plugin?";
     51
     52    // Select option text
     53    let optionText = document.createElement("p");
     54    optionText.innerText = "Please select an option below to deactivate the plugin:";
     55
     56    // Radio button
     57    let radioContainer = document.createElement("div");
     58    radioContainer.style.marginTop = "15px";
     59    radioContainer.style.textAlign = "left";
     60
     61    let radioWrapper0 = document.createElement("div");
     62
     63    let radio0 = document.createElement("input");
     64    radio0.type = "radio";
     65    radio0.name = "keep_data";
     66    radio0.value = "0";
     67    radio0.id = "keep_data_0";
     68
     69    let label0 = document.createElement("label");
     70    label0.htmlFor = "keep_data_0";
     71    label0.innerText = "Delete all plugin data.";
     72
     73    radioWrapper0.appendChild(radio0);
     74    radioWrapper0.appendChild(label0);
     75
     76    let radioWrapper1 = document.createElement("div");
     77    radioWrapper1.style.marginTop = "5px";
     78
     79    let radio1 = document.createElement("input");
     80    radio1.type = "radio";
     81    radio1.name = "keep_data";
     82    radio1.value = "1";
     83    radio1.id = "keep_data_1";
     84    radio1.defaultChecked = true;
     85
     86    let label1 = document.createElement("label");
     87    label1.htmlFor = "keep_data_1";
     88    label1.innerText = "Keep all plugin data.";
     89
     90    radioWrapper1.appendChild(radio1);
     91    radioWrapper1.appendChild(label1);
     92
     93    radioContainer.appendChild(radioWrapper0);
     94    radioContainer.appendChild(radioWrapper1);
    5195
    5296    // Submit
     
    70114    skipBtn.onclick = closeModal;
    71115
     116    let divButton = document.createElement("div");
     117    divButton.style.textAlign = "center";
     118    divButton.appendChild(submitBtn);
     119    divButton.appendChild(skipBtn);
     120
    72121    modal.appendChild(title);
    73122    modal.appendChild(message);
    74123    modal.appendChild(question);
    75     modal.appendChild(submitBtn);
    76     modal.appendChild(skipBtn);
     124    modal.appendChild(optionText);
     125    modal.appendChild(radioContainer);
     126    modal.appendChild(divButton);
    77127    overlay.appendChild(modal);
    78128    document.body.appendChild(overlay);
     
    82132
    83133function closeModalAndSendRequest() {
     134    let keep_data = jQuery('input[name="keep_data"]:checked').val();
    84135    const data = {
    85         action: 'sfxvxp_deactivate_plugin'
     136        action: 'sfxvxp_deactivate_plugin',
     137        keep_data: keep_data
    86138    };
    87139
     
    128180            if (res.data.sfxvxp_version === 'dam') {
    129181                if (parseInt(res.data.storage_location)) {
    130                     jQuery('#sfxMessage').html('Deactivating the plugin removes all DAM asset links from your WordPress database and relinks the assets to the local storage. DAM metadata will be deleted in WordPress.');
     182                    jQuery('#sfxMessage').html('Deactivating the plugin with the option "Delete all plugin data" will remove all DAM asset links from your WordPress database and relink the assets to local storage. DAM metadata will be deleted in WordPress.');
    131183                } else {
    132                     jQuery('#sfxMessage').html('Deactivating the plugin removes all DAM asset links from your WordPress database, breaking your images. We highly recommend migrating and relinking your DAM assets in WordPress before proceeding.');
     184                    jQuery('#sfxMessage').html('Deactivating the plugin with the option "Delete all plugin data" will remove all DAM asset links from your WordPress database, breaking your images. We highly recommend migrating and relinking your DAM assets in WordPress before proceeding.');
    133185                }
    134186            }
  • scaleflex-vxp-dam-dmo/trunk/function/register-action.php

    r3330817 r3335462  
    184184            ['type' => 'boolean', 'sanitize_callback' => 'sanitize_text_field', 'default' => false]
    185185        );
     186        register_setting(
     187            'sfxvxp_dam_options_group',
     188            'sfxvxp_dam_sort_default_option',
     189            ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => 'name_asc']
     190        );
    186191
    187192        //DMO
     
    567572            'sizes' => $sizes,
    568573            'sfxvxp_media_default' => includes_url('/images/media/default.png'),
    569             'sfxvxp_nonce' => wp_create_nonce('sfxvxp_action')
     574            'sfxvxp_nonce' => wp_create_nonce('sfxvxp_action'),
     575            'sfxvxp_sort_default_option' => get_option('sfxvxp_dam_sort_default_option', 'name_asc'),
    570576        ];
    571577
     
    10831089    public function sfxvxp_deactivate_plugin()
    10841090    {
    1085         delete_option('sfxvxp_version');
    1086         delete_option('sfxvxp_dam_token');
    1087         delete_option('sfxvxp_dam_sec');
    1088         delete_option('sfxvxp_dam_directory');
    1089         delete_option('sfxvxp_dam_keep_file');
    1090         delete_option('sfxvxp_dam_sync_dam_metadata_to_wp');
    1091         delete_option('sfxvxp_dam_sync_selection_metadata');
    1092         delete_option('sfxvxp_dam_sync_alt_text');
    1093         delete_option('sfxvxp_dam_sync_title');
    1094         delete_option('sfxvxp_dam_sync_description');
    1095         delete_option('sfxvxp_dam_sync_caption');
    1096         delete_option('sfxvxp_dam_resize_option');
    1097         delete_option('sfxvxp_dam_sync_assets_from_dam_to_wp');
    1098         delete_option('sfxvxp_dam_metadata_to_get_attachment_id');
    1099         delete_option('sfxvxp_dam_use_widget_only');
    1100 
    1101         // Delete DAM data
    1102         global $wpdb;
    1103         $wpdb->sfxvxp_metadata_table = $wpdb->prefix . 'postmeta';
    1104         $wpdb->query("DELETE FROM $wpdb->sfxvxp_metadata_table WHERE meta_key IN ('sfxvxp_dam_metadata', 'sfxvxp_dam_uuid', 'sfxvxp_dam_select_metadata', 'sfxvxp_dam_status')");
    1105 
    1106         // Delete DMO data
    1107         delete_option('sfxvxp_dmo_token_cname');
    1108         delete_option('sfxvxp_dmo_standard_mode');
    1109         delete_option('sfxvxp_dmo_use_origin_url');
    1110         delete_option('sfxvxp_dmo_lazy_loading');
    1111         delete_option('sfxvxp_dmo_ignore_svg');
    1112         delete_option('sfxvxp_dmo_prevent_image_upsize');
    1113         delete_option('sfxvxp_dmo_image_quality');
    1114         delete_option('sfxvxp_dmo_maximum_pixel_ratio');
    1115         delete_option('sfxvxp_dmo_remove_v7');
    1116         delete_option('sfxvxp_dmo_image_size_attributes');
    1117         delete_option('sfxvxp_dmo_url_signature');
    1118         delete_option('sfxvxp_dmo_custom_function');
    1119         delete_option('sfxvxp_dmo_custom_library');
    1120         delete_option('sfxvxp_dmo_skip_classes');
    1121         delete_option('sfxvxp_dmo_skip_files');
    1122         delete_option('sfxvxp_dmo_enable_srcset');
    1123         delete_option('sfxvxp_dmo_srcset_widths');
    1124 
    1125         wp_send_json(['success' => true, 'message' => 'All plugin data deleted, deactivate the plugin.']);
     1091        if (isset($_POST['keep_data']) && (int)sanitize_text_field(wp_unslash($_POST['keep_data'])) == 0) {
     1092            delete_option('sfxvxp_version');
     1093            delete_option('sfxvxp_dam_token');
     1094            delete_option('sfxvxp_dam_sec');
     1095            delete_option('sfxvxp_dam_directory');
     1096            delete_option('sfxvxp_dam_keep_file');
     1097            delete_option('sfxvxp_dam_sync_dam_metadata_to_wp');
     1098            delete_option('sfxvxp_dam_sync_selection_metadata');
     1099            delete_option('sfxvxp_dam_sync_alt_text');
     1100            delete_option('sfxvxp_dam_sync_title');
     1101            delete_option('sfxvxp_dam_sync_description');
     1102            delete_option('sfxvxp_dam_sync_caption');
     1103            delete_option('sfxvxp_dam_resize_option');
     1104            delete_option('sfxvxp_dam_sync_assets_from_dam_to_wp');
     1105            delete_option('sfxvxp_dam_metadata_to_get_attachment_id');
     1106            delete_option('sfxvxp_dam_use_widget_only');
     1107            delete_option('sfxvxp_dam_sort_default_option');
     1108
     1109            delete_option('sfxvxp_setup_completed');
     1110
     1111            // Delete DAM data
     1112            global $wpdb;
     1113            $wpdb->sfxvxp_metadata_table = $wpdb->prefix . 'postmeta';
     1114            $wpdb->query("DELETE FROM $wpdb->sfxvxp_metadata_table WHERE meta_key IN ('sfxvxp_dam_metadata', 'sfxvxp_dam_uuid', 'sfxvxp_dam_select_metadata', 'sfxvxp_dam_status')");
     1115
     1116            // Delete DMO data
     1117            delete_option('sfxvxp_dmo_token_cname');
     1118            delete_option('sfxvxp_dmo_standard_mode');
     1119            delete_option('sfxvxp_dmo_use_origin_url');
     1120            delete_option('sfxvxp_dmo_lazy_loading');
     1121            delete_option('sfxvxp_dmo_ignore_svg');
     1122            delete_option('sfxvxp_dmo_prevent_image_upsize');
     1123            delete_option('sfxvxp_dmo_image_quality');
     1124            delete_option('sfxvxp_dmo_maximum_pixel_ratio');
     1125            delete_option('sfxvxp_dmo_remove_v7');
     1126            delete_option('sfxvxp_dmo_image_size_attributes');
     1127            delete_option('sfxvxp_dmo_url_signature');
     1128            delete_option('sfxvxp_dmo_custom_function');
     1129            delete_option('sfxvxp_dmo_custom_library');
     1130            delete_option('sfxvxp_dmo_skip_classes');
     1131            delete_option('sfxvxp_dmo_skip_files');
     1132            delete_option('sfxvxp_dmo_enable_srcset');
     1133            delete_option('sfxvxp_dmo_srcset_widths');
     1134
     1135            wp_send_json(['success' => true, 'message' => 'All plugin data deleted, deactivate the plugin.']);
     1136        }
     1137        wp_send_json(['success' => true, 'message' => 'Deactivate the plugin.']);
    11261138    }
    11271139
  • scaleflex-vxp-dam-dmo/trunk/pages/part/dam-setting.php

    r3329668 r3335462  
    155155
    156156    <h2 class="text-center" style="margin-top: 35px; font-size: 1.6em;">Advanced Settings</h2>
     157
     158    <div class="SfxInputGroup-root">
     159        <label class="SfxLabel-root">
     160            <span class="SfxLabel-text"><b>Sort Default Option</b></span>
     161        </label>
     162        <div class="SfxInput-root">
     163            <div class="SfxInput-inputContent">
     164                <div class="SfxInput-fieldWrapper">
     165                    <?php
     166                    $sfxvxp_dam_sort_default_option = get_option('sfxvxp_dam_sort_default_option', 'name_asc');
     167                    ?>
     168                    <select name="sfxvxp_dam_sort_default_option" id="sfxvxp_dam_sort_default_option"
     169                            class="SfxInput-Base SfxInput-Select">
     170                        <option value="name_asc" <?php if ($sfxvxp_dam_sort_default_option == "name_asc") echo 'selected'; ?>>
     171                            Name ASC
     172                        </option>
     173                        <option value="name_desc" <?php if ($sfxvxp_dam_sort_default_option == "name_desc") echo 'selected'; ?>>
     174                            Name DESC
     175                        </option>
     176                        <option value="created_asc" <?php if ($sfxvxp_dam_sort_default_option == "created_asc") echo 'selected'; ?>>
     177                            Created ASC
     178                        </option>
     179                        <option value="created_desc" <?php if ($sfxvxp_dam_sort_default_option == "created_desc") echo 'selected'; ?>>
     180                            Created DESC
     181                        </option>
     182                        <option value="updated_asc" <?php if ($sfxvxp_dam_sort_default_option == "updated_asc") echo 'selected'; ?>>
     183                            Updated ASC
     184                        </option>
     185                        <option value="updated_desc" <?php if ($sfxvxp_dam_sort_default_option == "updated_desc") echo 'selected'; ?>>
     186                            Updated DESC
     187                        </option>
     188                    </select>
     189                </div>
     190            </div>
     191        </div>
     192    </div>
    157193
    158194    <div class="SfxInputGroup-root">
  • scaleflex-vxp-dam-dmo/trunk/pages/sfxvxp_dam_widget_page.php

    r3320917 r3335462  
    11<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
    22<div id="filerobot-widget"></div>
     3<div id="filerobot-progress-panel"></div>
  • scaleflex-vxp-dam-dmo/trunk/scaleflex-vxp.php

    r3334147 r3335462  
    33 * Plugin Name: Scaleflex VXP - DAM, DMO
    44 * Description: Scaleflex VXP centralizes, manages, optimizes and accelerates your media assets such as images, videos and document in one single source of truth, improving team collaboration and brand consistency.
    5  * Version: 1.0.12
     5 * Version: 1.0.13
    66 * Author: Scaleflex
    77 * Author URI: https://www.scaleflex.com
     
    1818
    1919// Define plugin constants
    20 define('SFXVXP_VERSION', '1.0.12');
     20define('SFXVXP_VERSION', '1.0.13');
    2121define('SFXVXP_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2222define('SFXVXP_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    6969    delete_transient('sfxvxp_attachments_cron_lock');
    7070    delete_transient('sfxvxp_dam_sass_key');
    71 
    72     delete_option('sfxvxp_setup_completed');
    7371//    error_log('Remove cron job: sfxvxp_dam_sync_cron');
    7472}
Note: See TracChangeset for help on using the changeset viewer.