) ? $url . '&' . http_build_query( $query_args ) : $url; return $this->format_query_string_concatenation( $url ); } protected function get_wp_link_page_url_for_normal_page_load( $url ) { wp_parse_str( htmlspecialchars_decode( Utils::_unstable_get_super_global_value( $_SERVER, 'QUERY_STRING' ) ), $query_params ); $e_filters = ''; foreach ( $query_params as $param_key => $param_value ) { if ( false !== strpos( $param_key, 'e-filter' ) ) { $e_filters .= '&' . $param_key . '=' . $param_value; } } return $this->format_query_string_concatenation( $url . $e_filters ); } public function current_url_contains_taxonomy_filter() { return false !== strpos( Utils::_unstable_get_super_global_value( $_SERVER, 'QUERY_STRING' ), 'e-filter-' ); } public function referer_contains_taxonomy_filter() { return false !== strpos( Utils::_unstable_get_super_global_value( $_SERVER, 'HTTP_REFERER' ), 'e-filter-' ); } protected function format_query_string_concatenation( $input ) { if ( false === strpos( $input, '?' ) ) { // If "?" doesn't exist in the input URL, replace the first "&" with "?" $input = preg_replace( '/&/', '?', $input, 1 ); } return $input; } public function get_posts_nav_link( $page_limit = null ) { if ( ! $page_limit ) { $page_limit = $this->query->max_num_pages; } $return = []; $paged = $this->get_current_page(); $link_template = '%s'; $disabled_template = '%s'; if ( $paged > 1 ) { $next_page = intval( $paged ) - 1; if ( $next_page < 1 ) { $next_page = 1; } $return['prev'] = sprintf( $link_template, 'prev', $this->get_wp_link_page( $next_page ), $this->get_settings_for_display( 'pagination_prev_label' ) ); } else { $return['prev'] = sprintf( $disabled_template, 'prev', $this->get_settings_for_display( 'pagination_prev_label' ) ); } $next_page = intval( $paged ) + 1; if ( $next_page <= $page_limit ) { $return['next'] = sprintf( $link_template, 'next', $this->get_wp_link_page( $next_page ), $this->get_settings_for_display( 'pagination_next_label' ) ); } else { $return['next'] = sprintf( $disabled_template, 'next', $this->get_settings_for_display( 'pagination_next_label' ) ); } return $return; } protected function register_controls() { $this->start_controls_section( 'section_layout', [ 'label' => esc_html__( 'Layout', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->end_controls_section(); } protected function get_pagination_type_options() { return [ '' => esc_html__( 'None', 'elementor-pro' ), 'numbers' => esc_html__( 'Numbers', 'elementor-pro' ), 'prev_next' => esc_html__( 'Previous/Next', 'elementor-pro' ), 'numbers_and_prev_next' => esc_html__( 'Numbers', 'elementor-pro' ) . ' + ' . esc_html__( 'Previous/Next', 'elementor-pro' ), self::LOAD_MORE_ON_CLICK => esc_html__( 'Load on Click', 'elementor-pro' ), self::LOAD_MORE_INFINITE_SCROLL => esc_html__( 'Infinite Scroll', 'elementor-pro' ), ]; } public function render_plain_content() {} /** * @param string $url * @param int $i * @param int $post_id * @return string */ private function get_wp_link_page_url_for_custom_page_option( $url, $i, $post_id ) { $base_raw_url = $this->is_rest_request() ? $this->get_base_url_for_rest_request( $post_id, $url ) : $this->get_base_url(); $pagination_key = 'e-page-' . $this->get_id(); if ( 'yes' === $this->get_settings_for_display( 'pagination_individual_handle' ) ) { $base_raw_url .= $this->get_pagination_query_vars_for_others_individually_paginated_widgets( $pagination_key ); } return $this->format_query_string_concatenation( $base_raw_url . '&' . $pagination_key . '=' . $i ); } private function get_pagination_query_vars_for_others_individually_paginated_widgets( string $pagination_key ): string { wp_parse_str( htmlspecialchars_decode( Utils::_unstable_get_super_global_value( $_SERVER, 'QUERY_STRING' ) ), $query_params ); $e_page = ''; foreach ( $query_params as $param_key => $param_value ) { if ( false !== strpos( $param_key, 'e-page' ) && $pagination_key !== $param_key ) { $e_page .= '&' . $param_key . '=' . $param_value; } } return $e_page; } /** * @return string */ private function get_wp_pagination_query_var() { if ( '' === get_option( 'permalink_structure' ) && $this->is_posts_page( $this->is_allow_to_use_custom_page_option() ) ) { return 'paged'; } return 'page'; } }