芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/stripe-payments/includes/class-asp-addons-helper.php
addon = $addon; if ( is_admin() ) { $this->asp_admin = AcceptStripePayments_Admin::get_instance(); add_action( 'activate_' . $this->auc_plugin_path, array( $this, 'remove_auc_notice' ) ); } } public function remove_auc_notice() { if ( ! empty( $this->item_hash ) ) { AcceptStripePayments_Admin::remove_admin_notice_by_hash( $this->item_hash ); } } public function init_tasks() { add_action( 'init', array( $this, 'load_text_domain' ) ); if ( is_admin() ) { $this->add_settings_link(); $this->check_updates(); } } public function log( $msg, $success = true ) { if ( method_exists( 'ASP_Debug_Logger', 'log' ) ) { ASP_Debug_Logger::log( $msg, $success, $this->addon->ADDON_SHORT_NAME ); } } public function check_updates() { if ( ! is_admin() ) { return; } if ( class_exists( 'ASP_Addons_Update_Checker' ) ) { if ( empty( $this->addon->SLUG ) || empty( $this->addon->file ) ) { return; } ASP_Addons_Update_Checker::check_updates( $this->addon->SLUG, $this->addon->file ); } else { // let's display admin notice to install Addons Update Checker (if the message is not yet dismissed) $user_id = get_current_user_id(); if ( empty( $user_id ) ) { return; } if ( ! current_user_can( 'install_plugins' ) && ! current_user_can( 'activate_plugins' ) ) { return; } $notice_dismissed = get_user_meta( $user_id, 'asp_dismiss_auc_msg', true ); if ( ! empty( $notice_dismissed ) ) { return; } $admin_url = get_admin_url(); $dismiss_url = add_query_arg( 'asp_dismiss_auc_msg', '1', $admin_url ); $dismiss_url = wp_nonce_url( $dismiss_url, 'asp_dismiss_auc_msg' ); $dismiss_msg = '
' . __( 'Don\'t show this message again', 'stripe-payments' ) . '
'; $this->item_hash = AcceptStripePayments_Admin::add_admin_notice( 'warning', // translators: %1$s is plugin name, %2$s is a link to plugin page sprintf( __( '
%1$s
Please install the
Stripe Payments Addons Update Checker
plugin to keep your addons upto date.', 'stripe-payments' ), __( 'Accept Stripe Payments', 'stripe-payments' ), 'https://s-plugins.com/update-checker-plugin-for-the-addons/' ) . $dismiss_msg, false ); } } public function check_ver() { if ( version_compare( WP_ASP_PLUGIN_VERSION, $this->addon->MIN_ASP_VER ) < 0 ) { add_action( 'admin_notices', array( $this, 'display_min_version_error' ) ); return false; } return true; } public function add_settings_link() { add_filter( 'plugin_action_links', array( $this, 'settings_link' ), 10, 2 ); } public function load_text_domain() { if ( ! empty( $this->addon->file ) && ! empty( $this->addon->textdomain ) ) { load_plugin_textdomain( $this->addon->textdomain, false, dirname( plugin_basename( $this->addon->file ) ) . '/languages/' ); } } public function settings_link( $links, $file ) { if ( plugin_basename( $this->addon->file ) === $file && ! empty( $this->addon->SETTINGS_TAB_NAME ) ) { $settings_link = sprintf( '
%s
', $this->addon->SETTINGS_TAB_NAME, __( 'Settings', 'stripe-payments' ) ); array_unshift( $links, $settings_link ); } return $links; } public function display_min_version_error() { $class = 'notice notice-error'; // translators: %1$s - plugin name, %2$s - min core plugin version, %3$s - installed core plugin version $message = sprintf( __( '%1$s requires Stripe Payments plugin minimum version to be %2$s (you have version %3$s installed). Please update Stripe Payments plugin.', 'stripe-payments' ), $this->addon->ADDON_FULL_NAME, $this->addon->MIN_ASP_VER, WP_ASP_PLUGIN_VERSION ); printf( '
%2$s
', esc_attr( $class ), esc_html( $message ) ); } public function add_settings_section( $title, $descr_callback = null ) { //$descr_callback added since 1.9.8 add_settings_section( 'AcceptStripePayments-' . $this->addon->SETTINGS_TAB_NAME . '-section', $title, $descr_callback, $this->asp_admin->plugin_slug . '-' . $this->addon->SETTINGS_TAB_NAME ); $this->section = 'AcceptStripePayments-' . $this->addon->SETTINGS_TAB_NAME . '-section'; } public function add_settings_field( $name, $title, $desc, $size = 10 ) { $this->asp_admin = AcceptStripePayments_Admin::get_instance(); add_settings_field( $name, $title, array( $this->asp_admin, 'settings_field_callback' ), $this->asp_admin->plugin_slug . '-' . $this->addon->SETTINGS_TAB_NAME, $this->section, array( 'field' => $name, 'size' => $size, 'desc' => $desc, ) ); } } class_alias( 'ASP_Addons_Helper', 'ASPAddonsHelper' );