HEX
Server: Apache/2.4.58 (IUS)
System: Linux fromcolo1.linveo.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: u100898694 (7904)
PHP: 8.1.29
Disabled: symlink,shell_exec,exec,proc_close,proc_open,popen,system,dl,passthru,escapeshellarg,escapeshellcmd,proc_get_status,proc_nice,proc_terminate,pclose,ini_alter,virtual,openlog,apache_child_terminate,apache_setenv,define_syslog_variables,highlight_file,ini_get_all,ini_restore,inject_code,openlog,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,posix_setuid,posix_uname,syslog,system,show_source,pcntl_exec,virtual,suexec,dbmopen,dl,disk_free_space,diskfreespace,leak,apache_get_modules,apache_get_version,apache_note,apache_setenv,highlight_file
Upload Files
File: /home/u100898694/samak-danesh.com/wp-content/themes/bloglo/inc/admin/assets/js/dev/bloglo-admin.js
//--------------------------------------------------------------------//
// Bloglo script that handles our admin functionality.
//--------------------------------------------------------------------//

(function ($) {
  "use strict";

  /**
   * Holds most important methods that bootstrap the whole admin area.
   *
   * @type {Object}
   */
  var BlogloAdmin = {
    /**
     * Start the engine.
     *
     * @since 1.0.0
     */
    init: function () {
      // Document ready
      $(document).ready(BlogloAdmin.ready);

      // Window load
      $(window).on("load", BlogloAdmin.load);

      // Bind UI actions
      BlogloAdmin.bindUIActions();

      // Trigger event when Bloglo fully loaded
      $(document).trigger("blogloReady");
    },

    //--------------------------------------------------------------------//
    // Events
    //--------------------------------------------------------------------//

    /**
     * Document ready.
     *
     * @since 1.0.0
     */
    ready: function () {},

    /**
     * Window load.
     *
     * @since 1.0.0
     */
    load: function () {
      // Trigger resize once everything loaded.
      window.dispatchEvent(new Event("resize"));
    },

    /**
     * Window resize.
     *
     * @since 1.0.0
     */
    resize: function () {},

    //--------------------------------------------------------------------//
    // Functions
    //--------------------------------------------------------------------//

    /**
     * Bind UI actions.
     *
     * @since 1.0.0
     */
    bindUIActions: function () {
      var $wrap = $("#wpwrap");
      var $body = $("body");
      var $this;

      $wrap.on("click", ".plugins .hester-btn:not(.active)", function (e) {
        e.preventDefault();

        if ($wrap.find(".plugins .hester-btn.in-progress").length) {
          return;
        }

        $this = $(this);

        BlogloAdmin.pluginAction($this);
      });

      $(document).on(
        "wp-plugin-install-success",
        BlogloAdmin.pluginInstallSuccess
      );
      $(document).on("wp-plugin-install-error", BlogloAdmin.pluginInstallError);
    },

    pluginAction: function ($button) {
      $button
        .addClass("in-progress")
        .attr("disabled", "disabled")
        .html(hester_strings.texts[$button.data("action") + "-inprogress"]);

      if ("install" === $button.data("action")) {
        if (
          wp.updates.shouldRequestFilesystemCredentials &&
          !wp.updates.ajaxLocked
        ) {
          wp.updates.requestFilesystemCredentials(event);

          $(document).on("credential-modal-cancel", function () {
            $button
              .removeAttr("disabled")
              .removeClass("in-progress")
              .html(hester_strings.texts.install);

            wp.a11y.speak(wp.updates.l10n.updateCancel, "polite");
          });
        }

        wp.updates.installPlugin({
          slug: $button.data("plugin"),
        });
      } else {
        var data = {
          _ajax_nonce: hester_strings.wpnonce, // eslint-disable-line camelcase
          plugin: $button.data("plugin"),
          action: "hester-plugin-" + $button.data("action"),
        };

        $.post(hester_strings.ajaxurl, data, function (response) {
          if (response.success) {
            if ($button.data("redirect")) {
              window.location.href = $button.data("redirect");
            } else {
              location.reload();
            }
          } else {
            $(".plugins .hester-btn.in-progress")
              .removeAttr("disabled")
              .removeClass("in-progress primary")
              .addClass("secondary")
              .html(hester_strings.texts.retry);
          }
        });
      }
    },

    pluginInstallSuccess: function (event, response) {
      event.preventDefault();

      var $message = jQuery(event.target);
      var $init = $message.data("init");
      var activatedSlug;

      if ("undefined" === typeof $init) {
        activatedSlug = response.slug;
      } else {
        activatedSlug = $init;
      }

      var $button = $('.plugins a[data-plugin="' + activatedSlug + '"]');

      $button.data("action", "activate");

      BlogloAdmin.pluginAction($button);
    },

    pluginInstallError: function (event, response) {
      event.preventDefault();

      var $message = jQuery(event.target);
      var $init = $message.data("init");
      var activatedSlug;

      if ("undefined" === typeof $init) {
        activatedSlug = response.slug;
      } else {
        activatedSlug = $init;
      }

      var $button = $('.plugins a[data-plugin="' + activatedSlug + '"]');

      $button
        .attr("disabled", "disabled")
        .removeClass("in-progress primary")
        .addClass("secondary")
        .html(wp.updates.l10n.installFailedShort);
    },
  }; // END var BlogloAdmin

  BlogloAdmin.init();
  window.blogloadmin = BlogloAdmin;
})(jQuery);