HEX
Server: nginx/1.28.0
System: Linux yisu-68a5f20334161 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: www (1000)
PHP: 8.2.28
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/q.autos58.cn/wp-content/themes/morenews/admin-dashboard/assets/js/plugin-installer.js
var n = window.AFTHRAMPES_JS || {};

jQuery(document).ready(function ($) {
  'use strict';

  var is_loading = false;

  function handleAjaxError(aft) {
    aft.removeClass('installing');
    is_loading = false;
  }

  n.install_plugin = function (aft, plugin) {
    is_loading = true;
    aft.addClass('installing');

    $.ajax({
      type: 'POST',
      url: aft_installer_localize.ajax_url,
      data: {
        action: 'morenews_plugin_installer',
        plugin: plugin,
        nonce: aft_installer_localize.admin_nonce,
        dataType: 'json',
      },
      success: function (data) {
        if (data && data.status === 'success') {
          aft
            .attr('class', 'activate button button-primary')
            .html(aft_installer_localize.activate_btn);
        } else {
          aft.removeClass('installing');
        }
        is_loading = false;
      },
      error: function () {
        handleAjaxError(aft);
      },
    });
  };

  n.activate_plugin = function (aft, plugin) {
    aft.addClass('installing');

    $.ajax({
      type: 'POST',
      url: aft_installer_localize.ajax_url,
      data: {
        action: 'morenews_plugin_activation',
        plugin: plugin,
        nonce: aft_installer_localize.admin_nonce,
        dataType: 'json',
      },
      success: function (data) {
        if (data && data.status === 'success') {
          aft
            .attr('class', 'installed button disabled')
            .html(aft_installer_localize.installed_btn);

          if (data.plugin === 'templatespare') {
            aft
              .attr('href', data.redirectUrl)
              .removeClass('disabled installed')
              .attr('class', 'button-primary templatespare primary')
              .html('Get Starter Sites');
          } else {
            aft.removeClass('installing');
          }
        }
        is_loading = false;
      },
      error: function () {
        handleAjaxError(aft);
      },
    });
  };

  $(document).on('click', '.aft-plugin-installer a.button', function (e) {
    e.preventDefault();

    var aft = $(this),
      plugin = aft.data('slug');

    if (!aft.hasClass('disabled') && !is_loading) {
      if (aft.hasClass('install')) {
        n.install_plugin(aft, plugin);
      } else if (aft.hasClass('activate')) {
        n.activate_plugin(aft, plugin);
      }
    }
  });

  $('.aft-dismiss-notice').on('click', function () {
    $.ajax({
      type: 'POST',
      url: aft_installer_localize.ajax_url,
      data: {
        action: 'aft_notice_dismiss',
        nonce: aft_installer_localize.admin_nonce,
      },
      success: function (data) {
        if (data.status === 'success') {
          $('.aft-notice-content-wrapper').remove();
        }
      },
    });
  });

  $(document).on(
    'click',
    '.aft-bulk-active-plugin-installer a.button',
    function (e) {
      e.preventDefault();
      e.stopPropagation(); // Prevent the event from bubbling up

      var aft = $(this),
        install = aft.data('install'),
        activate = aft.data('activate'),
        page = aft.data('page');

      aft.addClass('installing');

      $.ajax({
        type: 'POST',
        url: ajaxurl,
        data: {
          action: 'morenews_plugin_installer_activation',
          install: install,
          activate: activate,
          page: page,
          nonce: aft_installer_localize.admin_nonce,
          dataType: 'json',
        },
        success: function (response) {
          if (response.status === 'success') {
            window.location.href = response.url;
          }
        },
      });
    }
  );
});