Файловый менеджер - Редактировать - /home/kunzqhe/photostocker/2/ajax.tar
Назад
class-yoast-dismissable-notice.php 0000644 00000003617 15154375005 0013307 0 ustar 00 <?php /** * WPSEO plugin file. * * @package WPSEO\Admin\Ajax */ /** * This class will catch the request to dismiss the target notice (set by notice_name) * and will store the dismiss status as an user meta in the database. */ class Yoast_Dismissable_Notice_Ajax { /** * Notice type toggle value for user notices. * * @var string */ const FOR_USER = 'user_meta'; /** * Notice type toggle value for network notices. * * @var string */ const FOR_NETWORK = 'site_option'; /** * Notice type toggle value for site notices. * * @var string */ const FOR_SITE = 'option'; /** * Name of the notice that will be dismissed. * * @var string */ private $notice_name; /** * The type of the current notice. * * @var string */ private $notice_type; /** * Initialize the hooks for the AJAX request. * * @param string $notice_name The name for the hook to catch the notice. * @param string $notice_type The notice type. */ public function __construct( $notice_name, $notice_type = self::FOR_USER ) { $this->notice_name = $notice_name; $this->notice_type = $notice_type; add_action( 'wp_ajax_wpseo_dismiss_' . $notice_name, [ $this, 'dismiss_notice' ] ); } /** * Handles the dismiss notice request. */ public function dismiss_notice() { check_ajax_referer( 'wpseo-dismiss-' . $this->notice_name ); $this->save_dismissed(); wp_die( 'true' ); } /** * Storing the dismissed value in the database. The target location is based on the set notification type. */ private function save_dismissed() { if ( $this->notice_type === self::FOR_SITE ) { update_option( 'wpseo_dismiss_' . $this->notice_name, 1 ); return; } if ( $this->notice_type === self::FOR_NETWORK ) { update_site_option( 'wpseo_dismiss_' . $this->notice_name, 1 ); return; } update_user_meta( get_current_user_id(), 'wpseo_dismiss_' . $this->notice_name, 1 ); } } class-yoast-plugin-conflict-ajax.php 0000644 00000005545 15154375005 0013551 0 ustar 00 <?php /** * WPSEO plugin file. * * @package WPSEO\Admin\Ajax */ /** * Class Yoast_Plugin_Conflict_Ajax. */ class Yoast_Plugin_Conflict_Ajax { /** * Option identifier where dismissed conflicts are stored. * * @var string */ private $option_name = 'wpseo_dismissed_conflicts'; /** * List of notification identifiers that have been dismissed. * * @var array */ private $dismissed_conflicts = []; /** * Initialize the hooks for the AJAX request. */ public function __construct() { add_action( 'wp_ajax_wpseo_dismiss_plugin_conflict', [ $this, 'dismiss_notice' ] ); } /** * Handles the dismiss notice request. */ public function dismiss_notice() { check_ajax_referer( 'dismiss-plugin-conflict' ); $conflict_data = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); $this->dismissed_conflicts = $this->get_dismissed_conflicts( $conflict_data['section'] ); $this->compare_plugins( $conflict_data['plugins'] ); $this->save_dismissed_conflicts( $conflict_data['section'] ); wp_die( 'true' ); } /** * Getting the user option from the database. * * @return bool|array */ private function get_dismissed_option() { return get_user_meta( get_current_user_id(), $this->option_name, true ); } /** * Getting the dismissed conflicts from the database * * @param string $plugin_section Type of conflict group (such as Open Graph or sitemap). * * @return array */ private function get_dismissed_conflicts( $plugin_section ) { $dismissed_conflicts = $this->get_dismissed_option(); if ( is_array( $dismissed_conflicts ) && array_key_exists( $plugin_section, $dismissed_conflicts ) ) { return $dismissed_conflicts[ $plugin_section ]; } return []; } /** * Storing the conflicting plugins as an user option in the database. * * @param string $plugin_section Plugin conflict type (such as Open Graph or sitemap). */ private function save_dismissed_conflicts( $plugin_section ) { $dismissed_conflicts = $this->get_dismissed_option(); $dismissed_conflicts[ $plugin_section ] = $this->dismissed_conflicts; update_user_meta( get_current_user_id(), $this->option_name, $dismissed_conflicts ); } /** * Loop through the plugins to compare them with the already stored dismissed plugin conflicts. * * @param array $posted_plugins Plugin set to check. */ public function compare_plugins( array $posted_plugins ) { foreach ( $posted_plugins as $posted_plugin ) { $this->compare_plugin( $posted_plugin ); } } /** * Check if plugin is already dismissed, if not store it in the array that will be saved later. * * @param string $posted_plugin Plugin to check against dismissed conflicts. */ private function compare_plugin( $posted_plugin ) { if ( ! in_array( $posted_plugin, $this->dismissed_conflicts, true ) ) { $this->dismissed_conflicts[] = $posted_plugin; } } } class-shortcode-filter.php 0000644 00000001667 15154375005 0011654 0 ustar 00 <?php /** * WPSEO plugin file. * * @package WPSEO\Admin\Ajax */ /** * Class WPSEO_Shortcode_Filter. * * Used for parsing WP shortcodes with AJAX. */ class WPSEO_Shortcode_Filter { /** * Initialize the AJAX hooks. */ public function __construct() { add_action( 'wp_ajax_wpseo_filter_shortcodes', [ $this, 'do_filter' ] ); } /** * Parse the shortcodes. */ public function do_filter() { check_ajax_referer( 'wpseo-filter-shortcodes', 'nonce' ); $shortcodes = filter_input( INPUT_POST, 'data', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ); $parsed_shortcodes = []; foreach ( $shortcodes as $shortcode ) { $parsed_shortcodes[] = [ 'shortcode' => $shortcode, 'output' => do_shortcode( $shortcode ), ]; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: WPSEO_Utils::format_json_encode is considered safe. wp_die( WPSEO_Utils::format_json_encode( $parsed_shortcodes ) ); } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка