File manager - Edit - /home/rangceb/diohome.com/wp-includes6790ed/pomo/polylang.zip
Back
PK ��\1z� polylang.phpnu �[��� <?php /** * Polylang * * @package Polylang * @author WP SYNTEX * @license GPL-3.0-or-later * * @wordpress-plugin * Plugin Name: Polylang * Plugin URI: https://polylang.pro * Description: Adds multilingual capability to WordPress * Version: 3.1 * Requires at least: 5.4 * Requires PHP: 5.6 * Author: WP SYNTEX * Author URI: https://polylang.pro * Text Domain: polylang * Domain Path: /languages * License: GPL v3 or later * License URI: https://www.gnu.org/licenses/gpl-3.0.txt * * Copyright 2011-2019 Frédéric Demarle * Copyright 2019-2021 WP SYNTEX * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ if ( ! defined( 'ABSPATH' ) ) { exit; // Don't access directly. }; if ( defined( 'POLYLANG_VERSION' ) ) { // The user is attempting to activate a second plugin instance, typically Polylang and Polylang Pro. require_once ABSPATH . 'wp-admin/includes/plugin.php'; require_once ABSPATH . 'wp-includes/pluggable.php'; if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate this plugin. // WP does not allow us to send a custom meaningful message, so just tell the plugin has been deactivated. wp_safe_redirect( add_query_arg( 'deactivate', 'true', remove_query_arg( 'activate' ) ) ); exit; } } else { // Go on loading the plugin define( 'POLYLANG_VERSION', '3.1' ); define( 'PLL_MIN_WP_VERSION', '5.4' ); define( 'PLL_MIN_PHP_VERSION', '5.6' ); define( 'POLYLANG_FILE', __FILE__ ); define( 'POLYLANG_DIR', __DIR__ ); // Whether we are using Polylang or Polylang Pro, get the filename of the plugin in use. if ( ! defined( 'POLYLANG_ROOT_FILE' ) ) { define( 'POLYLANG_ROOT_FILE', __FILE__ ); } if ( ! defined( 'POLYLANG_BASENAME' ) ) { define( 'POLYLANG_BASENAME', plugin_basename( __FILE__ ) ); // Plugin name as known by WP. require __DIR__ . '/vendor/autoload.php'; } define( 'POLYLANG', ucwords( str_replace( '-', ' ', dirname( POLYLANG_BASENAME ) ) ) ); if ( empty( $_GET['deactivate-polylang'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification new Polylang(); } } PK ��\��Z�� � uninstall.phpnu �[��� <?php /** * @package Polylang */ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { // If uninstall not called from WordPress exit exit; } /** * Manages Polylang uninstallation * The goal is to remove ALL Polylang related data in db * * @since 0.5 */ class PLL_Uninstall { /** * Constructor: manages uninstall for multisite * * @since 0.5 */ public function __construct() { global $wpdb; // Don't do anything except if the constant PLL_REMOVE_ALL_DATA is explicitely defined and true. if ( ! defined( 'PLL_REMOVE_ALL_DATA' ) || ! PLL_REMOVE_ALL_DATA ) { return; } // Check if it is a multisite uninstall - if so, run the uninstall function for each blog id if ( is_multisite() ) { foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) { switch_to_blog( $blog_id ); $this->uninstall(); } restore_current_blog(); } else { $this->uninstall(); } } /** * Removes ALL plugin data * only when the relevant option is active * * @since 0.5 */ public function uninstall() { global $wpdb; do_action( 'pll_uninstall' ); // Need to register the taxonomies $pll_taxonomies = array( 'language', 'term_language', 'post_translations', 'term_translations' ); foreach ( $pll_taxonomies as $taxonomy ) { register_taxonomy( $taxonomy, null, array( 'label' => false, 'public' => false, 'query_var' => false, 'rewrite' => false ) ); } $languages = get_terms( 'language', array( 'hide_empty' => false ) ); // Delete users options foreach ( get_users( array( 'fields' => 'ID' ) ) as $user_id ) { delete_user_meta( $user_id, 'pll_filter_content' ); delete_user_meta( $user_id, 'pll_dismissed_notices' ); // Legacy meta. foreach ( $languages as $lang ) { delete_user_meta( $user_id, 'description_' . $lang->slug ); } } // Delete menu language switchers $ids = get_posts( array( 'post_type' => 'nav_menu_item', 'numberposts' => -1, 'nopaging' => true, 'fields' => 'ids', 'meta_key' => '_pll_menu_item', ) ); foreach ( $ids as $id ) { wp_delete_post( $id, true ); } // Delete the strings translations. register_post_type( 'polylang_mo', array( 'rewrite' => false, 'query_var' => false ) ); $ids = get_posts( array( 'post_type' => 'polylang_mo', 'post_status' => 'any', 'numberposts' => -1, 'nopaging' => true, 'fields' => 'ids', ) ); foreach ( $ids as $id ) { wp_delete_post( $id, true ); } // Delete all what is related to languages and translations $term_ids = array(); $tt_ids = array(); foreach ( get_terms( $pll_taxonomies, array( 'hide_empty' => false ) ) as $term ) { $term_ids[] = (int) $term->term_id; $tt_ids[] = (int) $term->term_taxonomy_id; } if ( ! empty( $term_ids ) ) { $term_ids = array_unique( $term_ids ); $wpdb->query( "DELETE FROM {$wpdb->terms} WHERE term_id IN ( " . implode( ',', $term_ids ) . ' )' ); // PHPCS:ignore WordPress.DB.PreparedSQL.NotPrepared $wpdb->query( "DELETE FROM {$wpdb->term_taxonomy} WHERE term_id IN ( " . implode( ',', $term_ids ) . ' )' ); // PHPCS:ignore WordPress.DB.PreparedSQL.NotPrepared } if ( ! empty( $tt_ids ) ) { $tt_ids = array_unique( $tt_ids ); $wpdb->query( "DELETE FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN ( " . implode( ',', $tt_ids ) . ' )' ); // PHPCS:ignore WordPress.DB.PreparedSQL.NotPrepared } // Delete options delete_option( 'polylang' ); delete_option( 'widget_polylang' ); // Automatically created by WP delete_option( 'polylang_wpml_strings' ); // Strings registered with icl_register_string delete_option( 'polylang_licenses' ); delete_option( 'pll_dismissed_notices' ); // Delete transients delete_transient( 'pll_languages_list' ); } } new PLL_Uninstall(); PK ��\�3 admin/admin.phpnu �[��� <?php /** * @package Polylang */ /** * Main Polylang class for admin (except Polylang pages), accessible from @see PLL(). * * @since 1.2 */ class PLL_Admin extends PLL_Admin_Base { /** * @var PLL_Admin_Filters */ public $filters; /** * @var PLL_Admin_Filters_Columns */ public $filters_columns; /** * @var PLL_Admin_Filters_Post */ public $filters_post; /** * @var PLL_Admin_Filters_Term */ public $filters_term; /** * @var PLL_Admin_Filters_Media */ public $filters_media; /** * @since 2.9 * * @var PLL_Filters_Sanitization */ public $filters_sanitization; /** * @var PLL_Admin_Block_Editor */ public $block_editor; /** * @var PLL_Admin_Classic_Editor */ public $classic_editor; /** * @var PLL_Admin_Nav_Menu */ public $nav_menu; /** * @var PLL_Admin_Filters_Widgets_Options */ public $filters_widgets_options; /** * Setups filters and action needed on all admin pages and on plugins page. * * @since 1.2 * * @param PLL_Links_Model $links_model Reference to the links model. */ public function __construct( &$links_model ) { parent::__construct( $links_model ); // Adds a 'settings' link in the plugins table add_filter( 'plugin_action_links_' . POLYLANG_BASENAME, array( $this, 'plugin_action_links' ) ); add_action( 'in_plugin_update_message-' . POLYLANG_BASENAME, array( $this, 'plugin_update_message' ), 10, 2 ); } /** * Setups filters and action needed on all admin pages and on plugins page * Loads the settings pages or the filters base on the request * * @since 1.2 */ public function init() { parent::init(); // Setup filters for admin pages // Priority 5 to make sure filters are there before customize_register is fired if ( $this->model->get_languages_list() ) { add_action( 'wp_loaded', array( $this, 'add_filters' ), 5 ); } } /** * Adds a 'settings' link for our plugin in the plugins list table. * * @since 0.1 * * @param string[] $links List of links associated to the plugin. * @return string[] Modified list of links. */ public function plugin_action_links( $links ) { array_unshift( $links, '<a href="admin.php?page=mlang">' . __( 'Settings', 'polylang' ) . '</a>' ); return $links; } /** * Adds the upgrade notice in plugins table * * @since 1.1.6 * * @param array $plugin_data Not used * @param object $r Plugin update data * @return void */ public function plugin_update_message( $plugin_data, $r ) { if ( isset( $r->upgrade_notice ) ) { printf( '<p style="margin: 3px 0 0 0; border-top: 1px solid #ddd; padding-top: 3px">%s</p>', esc_html( $r->upgrade_notice ) ); } } /** * Setup filters for admin pages * * @since 1.2 * @since 2.7 instantiate a PLL_Bulk_Translate instance. * @return void */ public function add_filters() { $this->filters_sanitization = new PLL_Filters_Sanitization( $this->get_locale_for_sanitization() ); $this->filters_widgets_options = new PLL_Admin_Filters_Widgets_Options( $this ); // All these are separated just for convenience and maintainability $classes = array( 'Filters', 'Filters_Columns', 'Filters_Post', 'Filters_Term', 'Nav_Menu', 'Classic_Editor', 'Block_Editor' ); // Don't load media filters if option is disabled or if user has no right if ( $this->options['media_support'] && ( $obj = get_post_type_object( 'attachment' ) ) && ( current_user_can( $obj->cap->edit_posts ) || current_user_can( $obj->cap->create_posts ) ) ) { $classes[] = 'Filters_Media'; } foreach ( $classes as $class ) { $obj = strtolower( $class ); /** * Filter the class to instantiate when loading admin filters * * @since 1.5 * * @param string $class class name */ $class = apply_filters( 'pll_' . $obj, 'PLL_Admin_' . $class ); $this->$obj = new $class( $this ); } } /** * Retrieve the locale according to the current language instead of the language * of the admin interface. * * @since 2.0 * * @return string */ public function get_locale_for_sanitization() { $locale = get_locale(); if ( isset( $_POST['post_lang_choice'] ) && $lang = $this->model->get_language( sanitize_key( $_POST['post_lang_choice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification $locale = $lang->locale; } elseif ( isset( $_POST['term_lang_choice'] ) && $lang = $this->model->get_language( sanitize_key( $_POST['term_lang_choice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification $locale = $lang->locale; } elseif ( isset( $_POST['inline_lang_choice'] ) && $lang = $this->model->get_language( sanitize_key( $_POST['inline_lang_choice'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification $locale = $lang->locale; } elseif ( ! empty( $this->curlang ) ) { $locale = $this->curlang->locale; } return $locale; } } PK ��\ �i i admin/admin-notices.phpnu �[��� <?php /** * @package Polylang */ /** * A class to manage admin notices * displayed only to admin, based on 'manage_options' capability * and only on dashboard, plugins and Polylang admin pages * * @since 2.3.9 * @since 2.7 Dismissed notices are stored in an option instead of a user meta */ class PLL_Admin_Notices { /** * Stores the plugin options. * * @var array */ protected $options; /** * Stores custom notices. * * @var string[] */ private static $notices = array(); /** * Constructor * Setup actions * * @since 2.3.9 * * @param object $polylang */ public function __construct( $polylang ) { $this->options = &$polylang->options; add_action( 'admin_init', array( $this, 'hide_notice' ) ); add_action( 'admin_notices', array( $this, 'display_notices' ) ); } /** * Add a custom notice * * @since 2.3.9 * * @param string $name Notice name * @param string $html Content of the notice * @return void */ public static function add_notice( $name, $html ) { self::$notices[ $name ] = $html; } /** * Get custom notices. * * @since 2.3.9 * * @return string[] */ public static function get_notices() { return self::$notices; } /** * Has a notice been dismissed? * * @since 2.3.9 * * @param string $notice Notice name * @return bool */ public static function is_dismissed( $notice ) { $dismissed = get_option( 'pll_dismissed_notices', array() ); // Handle legacy user meta $dismissed_meta = get_user_meta( get_current_user_id(), 'pll_dismissed_notices', true ); if ( is_array( $dismissed_meta ) ) { if ( array_diff( $dismissed_meta, $dismissed ) ) { $dismissed = array_merge( $dismissed, $dismissed_meta ); update_option( 'pll_dismissed_notices', $dismissed ); } if ( ! is_multisite() ) { // Don't delete on multisite to avoid the notices to appear in other sites. delete_user_meta( get_current_user_id(), 'pll_dismissed_notices' ); } } return in_array( $notice, $dismissed ); } /** * Should we display notices on this screen? * * @since 2.3.9 * * @param string $notice The notice name. * @return bool */ protected function can_display_notice( $notice ) { $screen = get_current_screen(); if ( empty( $screen ) ) { return false; } $screen_id = sanitize_title( __( 'Languages', 'polylang' ) ); /** * Filter admin notices which can be displayed * * @since 2.7.0 * * @param bool $display Whether the notice should be displayed or not. * @param string $notice The notice name. */ return apply_filters( 'pll_can_display_notice', in_array( $screen->id, array( 'dashboard', 'plugins', 'toplevel_page_mlang', $screen_id . '_page_mlang_strings', $screen_id . '_page_mlang_settings', ) ), $notice ); } /** * Stores a dismissed notice in database * * @since 2.3.9 * * @param string $notice * @return void */ public static function dismiss( $notice ) { $dismissed = get_option( 'pll_dismissed_notices', array() ); if ( ! in_array( $notice, $dismissed ) ) { $dismissed[] = $notice; update_option( 'pll_dismissed_notices', array_unique( $dismissed ) ); } } /** * Handle a click on the dismiss button * * @since 2.3.9 * * @return void */ public function hide_notice() { if ( isset( $_GET['pll-hide-notice'], $_GET['_pll_notice_nonce'] ) ) { $notice = sanitize_key( $_GET['pll-hide-notice'] ); check_admin_referer( $notice, '_pll_notice_nonce' ); self::dismiss( $notice ); wp_safe_redirect( remove_query_arg( array( 'pll-hide-notice', '_pll_notice_nonce' ), wp_get_referer() ) ); exit; } } /** * Displays notices * * @since 2.3.9 * * @return void */ public function display_notices() { if ( current_user_can( 'manage_options' ) ) { // Core notices if ( defined( 'WOOCOMMERCE_VERSION' ) && ! defined( 'PLLWC_VERSION' ) && $this->can_display_notice( 'pllwc' ) && ! $this->is_dismissed( 'pllwc' ) ) { $this->pllwc_notice(); } if ( ! defined( 'POLYLANG_PRO' ) && $this->can_display_notice( 'review' ) && ! $this->is_dismissed( 'review' ) && ! empty( $this->options['first_activation'] ) && time() > $this->options['first_activation'] + 15 * DAY_IN_SECONDS ) { $this->review_notice(); } // Custom notices foreach ( $this->get_notices() as $notice => $html ) { if ( $this->can_display_notice( $notice ) && ! $this->is_dismissed( $notice ) ) { ?> <div class="pll-notice notice notice-info"> <?php $this->dismiss_button( $notice ); echo wp_kses_post( $html ); ?> </div> <?php } } } } /** * Displays a dismiss button * * @since 2.3.9 * * @param string $name Notice name * @return void */ public function dismiss_button( $name ) { printf( '<a class="notice-dismiss" href="%s"><span class="screen-reader-text">%s</span></a>', esc_url( wp_nonce_url( add_query_arg( 'pll-hide-notice', $name ), $name, '_pll_notice_nonce' ) ), /* translators: accessibility text */ esc_html__( 'Dismiss this notice.', 'polylang' ) ); } /** * Displays a notice if WooCommerce is activated without Polylang for WooCommerce * * @since 2.3.9 * * @return void */ private function pllwc_notice() { ?> <div class="pll-notice notice notice-warning"> <?php $this->dismiss_button( 'pllwc' ); ?> <p> <?php printf( /* translators: %1$s is link start tag, %2$s is link end tag. */ esc_html__( 'We have noticed that you are using Polylang with WooCommerce. To ensure compatibility, we recommend you use %1$sPolylang for WooCommerce%2$s.', 'polylang' ), '<a href="https://polylang.pro/downloads/polylang-for-woocommerce/">', '</a>' ); ?> </p> </div> <?php } /** * Displays a notice asking for a review * * @since 2.3.9 * * @return void */ private function review_notice() { ?> <div class="pll-notice notice notice-info"> <?php $this->dismiss_button( 'review' ); ?> <p> <?php printf( /* translators: %1$s is link start tag, %2$s is link end tag. */ esc_html__( 'We have noticed that you have been using Polylang for some time. We hope you love it, and we would really appreciate it if you would %1$sgive us a 5 stars rating%2$s.', 'polylang' ), '<a href="https://wordpress.org/support/plugin/polylang/reviews/?rate=5#new-post">', '</a>' ); ?> </p> </div> <?php } } PK ��\�V�Dg<