403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/AIWEBSTATION/wp-content/plugins/wpbot-pro/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/AIWEBSTATION/wp-content/plugins/wpbot-pro/includes/class-common-function.php
<?php
/**
 * Common functions class
 */
class Qcld_WPBot_Common_Functions {

	/**
	 * Remove stopwords from search query
	 *
	 * @param string $query The search query.
	 * @param array  $stopwords Array of stopwords to remove.
	 * @return string Query with stopwords removed
	 */
	public static function qcpd_remove_wa_stopwords( $query, $stopwords ) {
		return preg_replace( '/\b(' . implode( '|', $stopwords ) . ')\b/', '', $query );
	}

	/**
	 * Get relevant page links based on search query
	 *
	 * @param string $search_query The search query.
	 * @return array Array of relevant page links
	 */
	public static function qcpd_relevant_pagelink( $search_query ) {
		
		$stopwords = explode( ',', get_option( 'qlcd_wp_chatbot_stop_words' ) );

		$final_query_words_without_stop_words = self::qcpd_remove_wa_stopwords( strtolower( $search_query ), $stopwords );

		$clean_words_without_punctuation_marks = preg_replace( '/[\p{P}]/u', '', $final_query_words_without_stop_words );

		$q = trim( $clean_words_without_punctuation_marks );

		$links = array();
		$qcld_ai_exclude =  get_option( 'qcld_ai_exclude_by_post_id' );
		$post_type_array = get_option( 'qcld_openai_relevant_post' );
		
		$the_query = new WP_Query(
			array(
				'post_status'    => 'publish',
				'posts_per_page' => 5,
				's'              => esc_attr( $q ),
				'post_type'      => $post_type_array,
				//'post__not_in' =>  array(1,99)
			)
		);
		
		if ( $the_query->have_posts() ) {
			while ( $the_query->have_posts() ) {
				$the_query->the_post();
				$url  = esc_url( get_permalink() );
				$link = '<a href=' . $url . ' >' . get_the_title() . '</a>';
			
				array_push( $links, $link );
			}
			wp_reset_postdata();
		}
		$links = array_unique( $links );
		return $links;
	}
	public static function qcpd_relevant_product( $search_query ) {	
		
		$stopwords = explode( ',', get_option( 'qlcd_wp_chatbot_stop_words' ) );
		$final_query_words_without_stop_words = self::qcpd_remove_wa_stopwords( strtolower( $search_query ), $stopwords );
		$clean_words_without_punctuation_marks = preg_replace( '/[\p{P}]/u', '', $final_query_words_without_stop_words );
		$q = trim( $clean_words_without_punctuation_marks );
		$product_categories = get_terms( 'product_cat' );
		$query_arg = array(
			'post_type'      => 'product',
			'post_status'    => 'publish',
			'posts_per_page' => 5,
			's'              => esc_attr( $search_query ),
		);
		
		if ( get_option( 'wp_chatbot_exclude_stock_out_product' ) == 1 ) {
			$query_arg['meta_query']        = array(
				'key'     => '_stock',
				'type'    => 'numeric',
				'value'   => 1,
				'compare' => '>',
			);
		}
		$resultss      = new WP_Query( $query_arg );
		$results       = $resultss->posts;
		$newresults    = array();
		foreach ( $results as $result ) {
			if ( qcld_wp_chatbot_product_controlling( $result->ID ) == true ) {
				$newresults[] = $result;
			}
		}
		$results = $newresults;
	
		$html = '<div class="wp-chatbot-products-area-aisugession">';
		$_pf = null;
		if ( class_exists( 'WC_Product_Factory' ) ) {
			$_pf  = new WC_Product_Factory();
		}
		//repeating the products
		if ( count( $results ) > 0 ) {
			$html .= '<ul class="wp-chatbot-products aisugession-products">';
			foreach ( $results as $result ) :
				$imagesize        = ( get_option( 'wpbot_search_image_size' ) != '' ? get_option( 'wpbot_search_image_size' ) : 'thumbnail' );
				$featured_img_url = get_the_post_thumbnail_url( $result->ID, $imagesize );
				$product          = $_pf->get_product( $result->ID );
					if ( qcld_wp_chatbot_product_controlling( $result->ID ) == true ) {
						$html .= '<li class="wp-chatbot-product">';
						$html .= '<a target="_blank" href="' . get_permalink( $result->ID ) . '"  wp-chatbot-pid= "' . $result->ID . '" title="' . esc_attr( $product->get_title() ) . '"><div class="wp-chatbot-product">
							<div class="wp-chatbot-product-table">
								<div class="wp-chatbot-product-table-cell">
									<h3 class="wp-chatbot-product-title">' . esc_html( $product->get_title() ) . '</h3>
									<i class="fa fa-cart-plus" aria-hidden="true"></i>
								</div>
							</div>
						</div></a>';
						$html .= '</li>';
					}
	// get_the_post_thumbnail( $result->ID, 'shop_catalog' ) 
	// <div class="price">' . esc_html( $product->get_price() ) . '</div>
			endforeach;
			wp_reset_postdata();
			$html .= '</ul>';
		}
		$html .= '</div>';
		return $html;
	}
}


Youez - 2016 - github.com/yon3zu
LinuXploit