Plugin Directory

Changeset 3381737


Ignore:
Timestamp:
10/21/2025 09:04:38 AM (6 months ago)
Author:
scaleflex
Message:
  • Add option "Maximum asset (image, video, and other) weight to also store on the WordPress server"
  • Add feature "AI asset search"
  • Add option "Enable views"
Location:
scaleflex-vxp-dam-dmo
Files:
56 added
2 deleted
9 edited

Legend:

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

    r3362651 r3381737  
    1 === Scaleflex VXP - DAM & Cloudimage Visual Optimization ===
     1=== Scaleflex VXP - DAM & Cloudimage ===
    22Contributors: Scaleflex
    33Tags: DAM, DMO, Cloudimage, Asset Management, optimize, storage
    44Requires PHP: 7.3
    5 Tested up to: 6.8
     5Tested up to: 6.8.3
    66Requires at least: 4.8
    7 Stable tag: 1.0.25
     7Stable tag: 1.0.26
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    251251* Skip download the asset when option storage location is "DAM Only"
    252252
     253= 1.0.26 =
     254* Add option "Maximum asset (image, video, and other) weight to also store on the WordPress server"
     255* Add feature "AI asset search"
     256* Add option "Enable views"
     257
    253258== Upgrade Notice ==
    254259
  • scaleflex-vxp-dam-dmo/trunk/assets/css/setting-page.css

    r3360327 r3381737  
    7070
    7171.SfxInputGroup-root {
    72     margin-bottom: 1rem;
     72    margin-bottom: 1.2rem;
    7373}
    7474
     
    7979    align-items: center;
    8080    color: rgb(118, 138, 159);
    81     font-size: 14px;
     81    font-size: 15px;
    8282    line-height: 16px;
    8383    font-style: normal;
     
    393393    color: rgb(118, 138, 159);
    394394    padding: 5px 0;
     395    line-height: 1.4;
    395396}
    396397
  • scaleflex-vxp-dam-dmo/trunk/assets/js/dam-widget/sfxvxp-widget-page.js

    r3360489 r3381737  
    2727
    2828                var exportButtonText = sfxvxp_admin_meta.insert_btn;
    29                 if (Filerobot === undefined) {
    30                     let Filerobot = window.Filerobot ;
     29                if (ScaleflexWidget === undefined) {
     30                    let ScaleflexWidget = window.ScaleflexWidget ;
    3131                }
    3232
     
    3636                let scaleflexWidget = null;
    3737
    38                 scaleflexWidget = Filerobot.Core({
     38                scaleflexWidget = ScaleflexWidget.Core({
    3939                    securityTemplateID : demoSecurityTemplateID,
    4040                    container          : demoContainer,
     
    4242
    4343                // Plugins
    44                 const Explorer  = Filerobot.Explorer;
    45                 const XHRUpload = Filerobot.XHRUpload;
    46                 const ProgressPanel = Filerobot.ProgressPanel
     44                const Explorer  = ScaleflexWidget.Explorer;
     45                const XHRUpload = ScaleflexWidget.XHRUpload;
     46                const ProgressPanel = ScaleflexWidget.ProgressPanel
    4747
    4848                let queryString = window.location.search;
     
    131131                        }
    132132                    },
    133                     // ExploreViewComponent: ScaleflexWidget.Explorer.ExploreViewComponent
     133                    ExploreViewComponent: ScaleflexWidget.Explorer.ExploreViewComponent,
     134                    views: sfxvxp_admin_meta.sfxvxp_dam_widget_views
    134135                }
    135136
    136137                //Hide transformation in download options in context menu and action bar.
    137138                widgetConfig.hideDownloadVariationsOption = parseInt(sfxvxp_admin_meta.sfxvxp_dam_disable_transformations);
     139                widgetConfig.enableAIEmbed = (parseInt(sfxvxp_admin_meta.sfxvxp_dam_enable_ai_embed) === 1) ? true : false;
    138140
    139141                if (wp.media !== undefined) {
     
    301303    }).catch((error) => {
    302304        console.error('Error when inserting asset:', error);
    303         alert('An error occurred while inserting content. Please try again..');
     305        alert('An error occurred while inserting content. Please try again.');
    304306    });
    305307}
  • scaleflex-vxp-dam-dmo/trunk/assets/js/sfxvxp-settings-page.js

    r3360327 r3381737  
    1919        const sfxvxp_dam_sync_selection_metadata_data = JSON.parse(sfxvxp_dam_sync_selection_metadata_value);
    2020        jQuery('#sfxvxp_dam_sync_selection_metadata').val(sfxvxp_dam_sync_selection_metadata_data);
     21
     22        jQuery('#sfxvxp_dam_widget_views_selection .sfx-checkbox-item').on('click', function () {
     23            let selection = ['ASSETS', 'FOLDERS'];
     24            jQuery('#sfxvxp_dam_widget_views_selection .field-item').each(function () {
     25                if (this.checked) {
     26                    selection.push(this.value);
     27                }
     28            });
     29            jQuery('#sfxvxp_dam_widget_views').val(JSON.stringify(selection));
     30        });
    2131
    2232        jQuery('#sfxvxp_dam_token, #sfxvxp_dam_sec, #sfxvxp_dam_directory').on('change', function () {
     
    125135                jQuery('#sfxDamEnable').hide();
    126136            }
    127         });
     137
     138            if (jQuery(this).val() == 1 && jQuery('#sfxvxp_dam_keep_file').val() == 1) {
     139                jQuery('#sfx_skip_download_file_size').show();
     140            } else {
     141                jQuery('#sfx_skip_download_file_size').hide();
     142            }
     143        });
     144
     145        jQuery('#sfxvxp_dam_keep_file').on('change', function () {
     146            if (jQuery(this).val() == 1 && jQuery('#sfxvxp_dam_use_widget_only').val() == 1) {
     147                jQuery('#sfx_skip_download_file_size').show();
     148            } else {
     149                jQuery('#sfx_skip_download_file_size').hide();
     150            }
     151        });
     152
     153
    128154
    129155        jQuery('#sfxvxp_dam_sync_assets_from_dam_to_wp').on('change', function () {
     
    140166        });
    141167
    142         jQuery('.sfx-checkbox-item').on('click', function () {
     168        jQuery('#sfxvxp_dam_sync_selection_metadata_custom_meta_fields .sfx-checkbox-item').on('click', function () {
    143169            let selection = [];
    144             jQuery('.field-item').each(function () {
     170            jQuery('#sfxvxp_dam_sync_selection_metadata_custom_meta_fields .field-item').each(function () {
    145171                if (this.checked) {
    146172                    let value = {
  • scaleflex-vxp-dam-dmo/trunk/function/register-action.php

    r3362651 r3381737  
    5454        add_action('admin_menu', [$this, 'sfxvxp_add_admin_menu']);
    5555        add_action('admin_init', [$this, 'sfxvxp_register_settings']);
    56         add_action('admin_enqueue_scripts', [$this, 'sfxvxp_enqueue_admin_assets']);
     56        add_action('admin_enqueue_scripts', [$this, 'sfxvxp_enqueue_admin_assets'], 999, 1);
    5757        add_action('wp_ajax_sfxvxp_fetch_plugin_option', [$this, 'sfxvxp_fetch_plugin_option']);
    5858
     
    193193            'sfxvxp_dam_disable_transformations',
    194194            ['type' => 'boolean', 'sanitize_callback' => 'sanitize_text_field', 'default' => false]
     195        );
     196        register_setting(
     197            'sfxvxp_dam_options_group',
     198            'sfxvxp_dam_skip_download_file_size',
     199            ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => 0]
     200        );
     201        register_setting(
     202            'sfxvxp_dam_options_group',
     203            'sfxvxp_dam_enable_ai_embed',
     204            ['type' => 'boolean', 'sanitize_callback' => 'sanitize_text_field', 'default' => false]
     205        );
     206        register_setting(
     207            'sfxvxp_dam_options_group',
     208            'sfxvxp_dam_widget_views',
     209            ['type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'default' => '["ASSETS", "FOLDERS"]']
    195210        );
    196211
     
    474489        // Add Styles
    475490        wp_enqueue_style('sfxvxp-core-css', SFXVXP_PLUGIN_URL . 'assets/css/dam-widget/core.css', [], SFXVXP_VERSION);
    476         wp_enqueue_style('sfxvxp-lib-css', SFXVXP_PLUGIN_URL . 'assets/css/dam-widget/filerobot-widget.min.css', [], SFXVXP_VERSION);
     491        wp_enqueue_style('sfxvxp-lib-css', SFXVXP_PLUGIN_URL . 'assets/css/dam-widget/scaleflex-widget.min.css', [], SFXVXP_VERSION);
    477492        wp_enqueue_style('sfxvxp-flexboxgrid', SFXVXP_PLUGIN_URL . 'assets/css/dam-widget/flexboxgrid.min.css', [], SFXVXP_VERSION);
    478493        wp_enqueue_style('sfxvxp-acf-fmaw', SFXVXP_PLUGIN_URL . 'assets/css/dam-widget/acf-fmaw.css', [], SFXVXP_VERSION);
     
    487502        );
    488503
    489         wp_register_script('sfxvxp_fmaw', SFXVXP_PLUGIN_URL . 'assets/js/dam-widget/filerobot-widget.min.js', ['jquery'], SFXVXP_VERSION, true);
     504        wp_register_script('sfxvxp_fmaw', SFXVXP_PLUGIN_URL . 'assets/js/dam-widget/scaleflex-widget.min.js', ['jquery'], SFXVXP_VERSION, true);
    490505        wp_register_script('sfxvxp_media_tab', SFXVXP_PLUGIN_URL . 'assets/js/dam-widget/fmaw.js', ['sfxvxp_fmaw'], SFXVXP_VERSION, true);
    491506//        $response = $this->test_connection($this->dam_token, $this->dam_sec, $this->dame_directory);
     
    554569            'sfxvxp_nonce' => wp_create_nonce('sfxvxp_action'),
    555570            'sfxvxp_sort_default_option' => get_option('sfxvxp_dam_sort_default_option', 'name_asc'),
     571            'sfxvxp_dam_widget_views' => json_decode(get_option('sfxvxp_dam_widget_views', '["ASSETS", "FOLDERS"]')),
    556572            'sfxvxp_dam_disable_transformations' => get_option('sfxvxp_dam_disable_transformations', false),
     573            'sfxvxp_dam_enable_ai_embed' => get_option('sfxvxp_dam_enable_ai_embed', false),
    557574        ];
    558575    }
     
    10851102            delete_option('sfxvxp_dam_use_widget_only');
    10861103            delete_option('sfxvxp_dam_sort_default_option');
    1087 
     1104            delete_option('sfxvxp_dam_disable_transformations');
     1105            delete_option('sfxvxp_dam_skip_download_file_size');
     1106            delete_option('sfxvxp_dam_enable_ai_embed');
     1107            delete_option('sfxvxp_dam_widget_views');
    10881108            delete_option('sfxvxp_setup_completed');
    10891109
  • scaleflex-vxp-dam-dmo/trunk/function/vxp-helper.php

    r3362651 r3381737  
    162162        $attachment_metadata = [];
    163163        if ($keep_local_file == 1) {
    164             if ($file->size->bytes > 40 * 1024 * 1024) {
     164            $skip_download_file_size = get_option('sfxvxp_dam_skip_download_file_size', 0);
     165            $skip_download_file_size = (int)$skip_download_file_size * 1024 * 1024;
     166            if ($skip_download_file_size > 0 && $file->size->bytes > $skip_download_file_size) {
    165167                $attachment_metadata = $this->generateMetadataManual($file_url, $file, $file_path, $attachment_id);
    166168                wp_update_attachment_metadata($attachment_id, $attachment_metadata);
  • scaleflex-vxp-dam-dmo/trunk/pages/part/dam-setting.php

    r3360327 r3381737  
    194194        </div>
    195195
     196        <div id="sfxvxp_dam_widget_views_block">
     197            <?php
     198            $sfxvxp_dam_widget_views = get_option('sfxvxp_dam_widget_views', '["ASSETS", "FOLDERS"]');
     199            $selected_widget_views = json_decode($sfxvxp_dam_widget_views);
     200            ?>
     201            <div class="SfxInputGroup-root">
     202                <label class="SfxLabel-root">
     203                    <span class="SfxLabel-text"><b>Enable Views</b></span>
     204                </label>
     205                <div class="SfxDescription">
     206                    <b>NOTE: </b> some views can be hidden if you don't have permission provided in <b style="color: #c40b0a">securityTemplateId</b>.
     207                </div>
     208                <input type="hidden" id="sfxvxp_dam_widget_views" name="sfxvxp_dam_widget_views" value="<?php echo esc_attr(htmlspecialchars(wp_json_encode($selected_widget_views))); ?>">
     209                <div id="sfxvxp_dam_widget_views_selection" style="margin-top: 5px">
     210                    <div class="sfx-checkbox-item">
     211                        <label for="selection_widget_view_COLLECTIONS">
     212                            <input type="checkbox" id="selection_widget_view_COLLECTIONS"
     213                                   value="COLLECTIONS"
     214                                   data-title="COLLECTIONS"
     215                                   class="field-item"
     216                                <?php if (in_array('COLLECTIONS', $selected_widget_views)) echo 'checked'; ?>
     217                                   name="selection_widget_view_COLLECTIONS">
     218                            COLLECTIONS
     219                        </label>
     220                    </div>
     221                    <div class="sfx-checkbox-item">
     222                        <label for="selection_widget_view_LABELS">
     223                            <input type="checkbox" id="selection_widget_view_LABELS"
     224                                   value="LABELS"
     225                                   data-title="LABELS"
     226                                   class="field-item"
     227                                <?php if (in_array('LABELS', $selected_widget_views)) echo 'checked'; ?>
     228                                   name="selection_widget_view_COLLECTIONS">
     229                            LABELS
     230                        </label>
     231                    </div>
     232                </div>
     233            </div>
     234        </div>
     235
     236        <div class="SfxInputGroup-root">
     237            <label class="SfxLabel-root">
     238                <span class="SfxLabel-text"><b>Enable AI Asset Search</b></span>
     239            </label>
     240            <div class="SfxDescription">
     241                This option add in the DAM widget a switch allowing user to perform a AI Search on the DAM library.
     242                <br>
     243                <b>Attention: </b>This option, once activated, will allow users to run AI searches in the library. It is available on the assumption that a Visual AI package is part of your subscription and that you have previously activated image embedding on your library and for uploads, and that you have enough AI credits to run some specific AI requests (eg. find similar). Please contact your administrator and our support team if you are unsure.
     244            </div>
     245            <div class="SfxInput-root">
     246                <div class="SfxInput-inputContent">
     247                    <div class="SfxInput-fieldWrapper">
     248                        <?php
     249                        $sfxvxp_dam_enable_ai_embed = get_option('sfxvxp_dam_enable_ai_embed', false);
     250                        ?>
     251                        <select name="sfxvxp_dam_enable_ai_embed" id="sfxvxp_dam_enable_ai_embed"
     252                                class="SfxInput-Base SfxInput-Select">
     253                            <option value="0" <?php if ($sfxvxp_dam_enable_ai_embed == 0) echo 'selected'; ?>>
     254                                Disable
     255                            </option>
     256                            <option value="1" <?php if ($sfxvxp_dam_enable_ai_embed == 1) echo 'selected'; ?>>
     257                                Enable
     258                            </option>
     259                        </select>
     260                    </div>
     261                </div>
     262            </div>
     263        </div>
     264
    196265        <div class="SfxInputGroup-root">
    197266            <label class="SfxLabel-root">
     
    223292    <div class="SfxInputGroup-root">
    224293        <label class="SfxLabel-root">
    225             <span class="SfxLabel-text"><b>Storage location</b></span>
     294            <span class="SfxLabel-text"><b>Storage Location</b></span>
    226295        </label>
    227296        <div class="SfxDescription">
     
    249318                </div>
    250319            </div>
     320        </div>
     321    </div>
     322
     323    <?php
     324    $sfxvxp_dam_skip_download_file_size = get_option('sfxvxp_dam_skip_download_file_size', 0);
     325    ?>
     326    <div class="SfxInputGroup-root" id="sfx_skip_download_file_size" <?php if ($sfxvxp_dam_keep_file == 1 && $sfxvxp_dam_use_widget_only == 1) { echo 'style="display: block;"'; } else { echo 'style="display: none;"'; } ?>>
     327        <label class="SfxLabel-root">
     328            <span class="SfxLabel-text"><b>Maximum asset (image, video, and other) weight to also store on the WordPress server:</b></span>
     329        </label>
     330        <div class="SfxInput-root">
     331            <div class="SfxInput-inputContent">
     332                <div class="SfxInput-fieldWrapper">
     333                    <select name="sfxvxp_dam_skip_download_file_size" id="sfxvxp_dam_skip_download_file_size"
     334                            class="SfxInput-Base SfxInput-Select">
     335                        <option value="name_asc" <?php if ($sfxvxp_dam_skip_download_file_size == 0) echo 'selected'; ?>>
     336                            Unlimited
     337                        </option>
     338                        <option value="2" <?php if ($sfxvxp_dam_skip_download_file_size == 2) echo 'selected'; ?>>
     339                            2 MB
     340                        </option>
     341                        <option value="5" <?php if ($sfxvxp_dam_skip_download_file_size == 5) echo 'selected'; ?>>
     342                            5 MB
     343                        </option>
     344                        <option value="10" <?php if ($sfxvxp_dam_skip_download_file_size == 10) echo 'selected'; ?>>
     345                            10 MB
     346                        </option>
     347                        <option value="20" <?php if ($sfxvxp_dam_skip_download_file_size == 20) echo 'selected'; ?>>
     348                            20 MB
     349                        </option>
     350                        <option value="50" <?php if ($sfxvxp_dam_skip_download_file_size == 50) echo 'selected'; ?>>
     351                            50 MB
     352                        </option>
     353                        <option value="100" <?php if ($sfxvxp_dam_skip_download_file_size == 100) echo 'selected'; ?>>
     354                            100 MB
     355                        </option>
     356                    </select>
     357                </div>
     358            </div>
     359        </div>
     360        <div class="SfxDescription">
     361            This option allows you to define the maximum file size that can be downloaded to WordPress local storage when adding media. It helps prevent local storage from being saturated by large files and avoids network timeouts during downloads. Reduce the value if you encounter issues such as <b>“An error occurred while inserting content. Please try again.”</b>
     362            <br>
     363            <b>Warning: </b>Limiting the size will also make larger files unavailable in your posts or pages if you deactivate and remove the Scaleflex plugin. Where assets will be stored. In any case, WordPress will use optimized asset links from the DAM to display and accelerate assets in WordPress.
    251364        </div>
    252365    </div>
  • scaleflex-vxp-dam-dmo/trunk/pages/sfxvxp_dam_widget_page.php

    r3351054 r3381737  
    11<?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
    2 <div id="scaleflex-widget"></div>
     2<div id="scaleflex-widget" style="margin-top: 1.5rem"></div>
    33<div id="scaleflex-widget-progress-panel"></div>
  • scaleflex-vxp-dam-dmo/trunk/scaleflex-vxp.php

    r3362651 r3381737  
    11<?php
    22/**
    3  * Plugin Name: Scaleflex VXP - DAM & Cloudimage Visual Optimization
     3 * Plugin Name: Scaleflex VXP - DAM & Cloudimage
    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.25
     5 * Version: 1.0.26
    66 * Author: Scaleflex
    77 * Author URI: https://www.scaleflex.com
     
    1818
    1919// Define plugin constants
    20 define('SFXVXP_VERSION', '1.0.25');
     20define('SFXVXP_VERSION', '1.0.26');
    2121define('SFXVXP_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2222define('SFXVXP_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    8686        $url = esc_url(add_query_arg(
    8787            'page',
    88             'scaleflex-vxp-settings',
     88            'scaleflex-vxp',
    8989            get_admin_url() . 'admin.php'
    9090        ));
Note: See TracChangeset for help on using the changeset viewer.