private function updateMelisPlugin($pageId, $plugin, $pluginId, $content, $updateSettings = false)
    {

        $pluginContent         = $content;
        $pluginSessionSettings = isset($_SESSION['meliscms']['content-pages'][$pageId]['private:melisPluginSettings'][$pluginId]) ?
            $_SESSION['meliscms']['content-pages'][$pageId]['private:melisPluginSettings'][$pluginId] : '';
        $pluginSettings        = (array) json_decode($pluginSessionSettings);
        
        if($plugin == 'melisTag') {

            $pattern = '/type\=\"([html|media|textarea]*\")/';
            if(preg_match($pattern, $pluginContent, $matches)) {
                $type = isset($matches[0]) ? $matches[0] : null;
                if($type) {
                    // apply sizes
                    if($pluginSettings) {
                        /* $replacement   = $type .' width_desktop="'.$pluginSettings['width_desktop'].
                            '" width_tablet="'.$pluginSettings['width_tablet'].
                            '" width_mobile="'.$pluginSettings['width_mobile'].'"';
                        $pluginContent = preg_replace($pattern, $replacement, $pluginContent); */
                        
                        $pluginContent = $this->setPluginWidthXmlAttribute($pluginContent, $pluginSettings);
                    }
                }
            }
        }
        else {
            $pattern = '\<'.$plugin.'\sid\=\"(.*?)*\"';

            if(preg_match('/'.$pattern.'/', $pluginContent, $matches)) {
                $id = isset($matches[0]) ? $matches[0] : null;
                
                if($id) {
                    if($pluginSettings) {
                        /* $replacement   = $id .' width_desktop="'.$pluginDesktop.
                            '" width_tablet="'.$pluginTablet.
                            '" width_mobile="'.$pluginMobile.'"';
                        $pluginContent = preg_replace('/'.$pattern.'/', $replacement, $pluginContent); */
                        
                        $pluginContent = $this->setPluginWidthXmlAttribute($pluginContent, $pluginSettings);
                    }
                }
            }
        }
        

        if(isset($_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId])) {
            $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId] =
                $this->getPluginContentWithInsertedContainerId($pageId, $plugin, $pluginId, $pluginContent);

            $pluginContent = $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId];
            if($updateSettings) {

                $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId] = $this->reapplySettings($pageId, $plugin, $pluginId, $pluginContent);
            }

            if($plugin == 'melisTag') {
                $content =  $this->updateContent($pageId, $plugin, $pluginId, $pluginContent);
                $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId] = $content;
            }

        }

    }
private function updateMelisPlugin($pageId, $plugin, $pluginId, $content, $updateSettings = false)
    {

        $pluginContent         = $content;
        $pluginSessionSettings = isset($_SESSION['meliscms']['content-pages'][$pageId]['private:melisPluginSettings'][$pluginId]) ?
            $_SESSION['meliscms']['content-pages'][$pageId]['private:melisPluginSettings'][$pluginId] : '';
        $pluginSettings        = (array) json_decode($pluginSessionSettings);
        
        if($plugin == 'melisTag') {

            $pattern = '/type\=\"([html|media|textarea]*\")/';
            if(preg_match($pattern, $pluginContent, $matches)) {
                $type = isset($matches[0]) ? $matches[0] : null;
                if($type) {
                    // apply sizes
                    if($pluginSettings) {
                        /* $replacement   = $type .' width_desktop="'.$pluginSettings['width_desktop'].
                            '" width_tablet="'.$pluginSettings['width_tablet'].
                            '" width_mobile="'.$pluginSettings['width_mobile'].'"';
                        $pluginContent = preg_replace($pattern, $replacement, $pluginContent); */
                        
                        $pluginContent = $this->setPluginWidthXmlAttribute($pluginContent, $pluginSettings);
                    }
                }
            }
        }
        else {
            $pattern = '\<'.$plugin.'\sid\=\"(.*?)*\"';

            if(preg_match('/'.$pattern.'/', $pluginContent, $matches)) {
                $id = isset($matches[0]) ? $matches[0] : null;
                
                if($id) {
                    if($pluginSettings) {
                        /* $replacement   = $id .' width_desktop="'.$pluginDesktop.
                            '" width_tablet="'.$pluginTablet.
                            '" width_mobile="'.$pluginMobile.'"';
                        $pluginContent = preg_replace('/'.$pattern.'/', $replacement, $pluginContent); */
                        
                        $pluginContent = $this->setPluginWidthXmlAttribute($pluginContent, $pluginSettings);
                    }
                }
            }
        }
        

        if(isset($_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId])) {
            $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId] =
                $this->getPluginContentWithInsertedContainerId($pageId, $plugin, $pluginId, $pluginContent);

            $pluginContent = $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId];
            if($updateSettings) {

                $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId] = $this->reapplySettings($pageId, $plugin, $pluginId, $pluginContent);
            }

            if($plugin == 'melisTag') {
                $content =  $this->updateContent($pageId, $plugin, $pluginId, $pluginContent);
                $_SESSION['meliscms']['content-pages'][$pageId][$plugin][$pluginId] = $content;
            }

        }

    }
private function updateMelisPlugin ( $ pageId , $ plugin , $ pluginId , $ content , $ updateSettings = false ) { $ pluginContent = $ content ; $ pluginSessionSettings = isset ( $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ 'private:melisPluginSettings' ] [ $ pluginId ] ) ? $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ 'private:melisPluginSettings' ] [ $ pluginId ] : '' ; $ pluginSettings = ( array ) json_decode ( $ pluginSessionSettings ) ; if ( $ plugin == 'melisTag' ) { $ pattern = '/type\=\"([html|media|textarea]*\")/' ; if ( preg_match ( $ pattern , $ pluginContent , $ matches ) ) { $ type = isset ( $ matches [ 0 ] ) ? $ matches [ 0 ] : null ; if ( $ type ) { // apply sizes if ( $ pluginSettings ) { /* $replacement   = $type .' width_desktop="'.$pluginSettings['width_desktop'].
                            '" width_tablet="'.$pluginSettings['width_tablet'].
                            '" width_mobile="'.$pluginSettings['width_mobile'].'"';
                        $pluginContent = preg_replace($pattern, $replacement, $pluginContent); */ $ pluginContent = $ this -> setPluginWidthXmlAttribute ( $ pluginContent , $ pluginSettings ) ; } } } } else { $ pattern = '\<' . $ plugin . '\sid\=\"(.*?)*\"' ; if ( preg_match ( '/' . $ pattern . '/' , $ pluginContent , $ matches ) ) { $ id = isset ( $ matches [ 0 ] ) ? $ matches [ 0 ] : null ; if ( $ id ) { if ( $ pluginSettings ) { /* $replacement   = $id .' width_desktop="'.$pluginDesktop.
                            '" width_tablet="'.$pluginTablet.
                            '" width_mobile="'.$pluginMobile.'"';
                        $pluginContent = preg_replace('/'.$pattern.'/', $replacement, $pluginContent); */ $ pluginContent = $ this -> setPluginWidthXmlAttribute ( $ pluginContent , $ pluginSettings ) ; } } } } if ( isset ( $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ $ plugin ] [ $ pluginId ] ) ) { $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ $ plugin ] [ $ pluginId ] = $ this -> getPluginContentWithInsertedContainerId ( $ pageId , $ plugin , $ pluginId , $ pluginContent ) ; $ pluginContent = $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ $ plugin ] [ $ pluginId ] ; if ( $ updateSettings ) { $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ $ plugin ] [ $ pluginId ] = $ this -> reapplySettings ( $ pageId , $ plugin , $ pluginId , $ pluginContent ) ; } if ( $ plugin == 'melisTag' ) { $ content = $ this -> updateContent ( $ pageId , $ plugin , $ pluginId , $ pluginContent ) ; $ _SESSION [ 'meliscms' ] [ 'content-pages' ] [ $ pageId ] [ $ plugin ] [ $ pluginId ] = $ content ; } } }
This method modifies the tag plugin xml attribute
applying the changes of the width
@param $pageId
@param $plugin
@param $pluginId
@param $content
This method modifies the tag plugin xml attribute applying the changes of the width