HEX
Server: nginx/1.24.0
System: Linux mail.365consultoria.com 6.8.0-1057-oracle #58~22.04.1-Ubuntu SMP Tue Jun 30 18:20:56 UTC 2026 aarch64
User: www (1002)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/laet.adv.br/wp-content/themes/betheme/muffin-options/fields/visual/field_visual.js
(function($) {

  /* globals _, fieldVisualJS, jQuery, quicktags, tinymce, wp */

  "use strict";

  var MfnFieldVisual = (function() {

    var __editorSettings = {};
    var newEditor = true;

    function init() {

      if (typeof window.wpEditorL10n === "undefined") {
        newEditor = false;
      }

      bind();

      if (newEditor) {
        mergeSettings();
      }

    }

    /**
     * Bind events
     */

    function bind() {

      // event fired after popup created, before show

      $(document).on('mfn:builder:edit', function(event, el, type) {
        create(el, type);
      });

      // event fired after popup close, before destroy

      $(document).on('mfn:builder:close', function(event, el, type) {
        destroy(el, type);
      });

    }

    /**
     * Merge Settings
     */

    function mergeSettings() {
      __editorSettings = {
        tinymce: _.extend(
          window.wpEditorL10n.tinymce.settings, {
            menubar: false,
            statusbar: false,
            external_plugins: {
              'mfnsc': fieldVisualJS.mfnsc,
            },
            toolbar1: "formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,wp_more,spellchecker,dfw,wp_adv,mfnsc",
            toolbar2: "strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help",
          }
        ),
      };
    }

    /**
     * Create Tiny MCE instance
     */

    function create(el, type) {

      if ('visual' == type) {

        try {
          // try/catch: tinymce or quicktags may not exist in WP 5.0+

          jQuery('.mfn-popup textarea.editor').attr('id', 'mfn-editor');

          jQuery('#content-tmce.wp-switch-editor').click();

          quicktags({
            id: 'mfn-editor'
          });

          if (newEditor) {
            wp.oldEditor.initialize('mfn-editor', __editorSettings);
          } else {
            tinymce.execCommand('mceAddEditor', true, 'mfn-editor');
          }

          jQuery('.switch-html', el).click(function() {
            jQuery(this).closest('.wp-editor-wrap').removeClass('tmce-active').addClass('html-active');
          });

          jQuery('.switch-tmce', el).click(function() {
            jQuery(this).closest('.wp-editor-wrap').removeClass('html-active').addClass('tmce-active');
          });

        } catch (err) {}

      }

    }

    /**
     * Destroy Tiny MCE instance
     * Prepare data to save in WP friendly format
     */

    function destroy(el, type) {

      if ('visual' == type) {

        try {
          // try/catch: tinymce or quicktags may not exist in WP 5.0+

          if (!tinymce.getContent) {
            tinymce.execCommand('mceToggleEditor', false, 'mfn-editor');
          }

          /*
           * Do NOT change order of below lines
           * Get editor content, save it to variable, destroy editor, set textarea content
           */

          var editorContent = tinymce.get('mfn-editor').getContent();

          jQuery('.wp-editor-wrap', el).removeClass('html-active').addClass('tmce-active');

          if (newEditor) {
            wp.oldEditor.remove('mfn-editor');
          } else {
            tinymce.execCommand('mceRemoveEditor', false, 'mfn-editor');
          }

          jQuery('#mfn-editor').val(editorContent);

        } catch (err) {}

        jQuery('#mfn-editor').removeAttr('id');

      }

    }

    /**
     * Return
     * Method to start the closure
     */

    return {
      init: init
    };

  })();

  /**
   * $(document).ready
   * Specify a function to execute when the DOM is fully loaded.
   */

  $(function() {
    MfnFieldVisual.init();
  });

})(jQuery);