403Webshell
Server IP : 52.25.153.185  /  Your IP : 216.73.217.131
Web Server : Apache
System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /bitnami/wordpress/wp-content/plugins/testify/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bitnami/wordpress/wp-content/plugins/testify/includes//Testify.php
<?php

class TESTIFY_Testify extends DiviExtension {

	/**
	 * The gettext domain for the extension's translations.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public $gettext_domain = 'testify-testify';

	/**
	 * The extension's WP Plugin name.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public $name = 'testify';

	/**
	 * The extension's version
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	public $version = AGS_TESTIFY_VER;

	/**
	 * TESTIFY_Testify constructor.
	 *
	 * @param string $name
	 * @param array  $args
	 */
	public function __construct( $name = 'testify', $args = array() ) {
		$this->plugin_dir     = plugin_dir_path( __FILE__ );
		$this->plugin_dir_url = plugin_dir_url( $this->plugin_dir );

		parent::__construct( $name, $args );

		//	Fires Ajax action for logged-in users.
		add_action( 'wp_ajax_testify_carousel_testimonials_list', array(
			$this,
			'testify_carousel_testimonials_list_handler',
			)
		);
		add_action( 'wp_enqueue_scripts', array( $this, 'dstc_enqueue_scripts' ) );
		add_filter( 'et_fb_get_asset_definitions', array( $this, 'get_asset_definitions' ), 12 );
	}

	/**
	 * Enqueues non-minified, hot reloaded javascript bundles.
	 *
	 * @since 3.1
	 */
	protected function _enqueue_debug_bundles() {
		// Frontend Bundle
		$site_url       = wp_parse_url( get_site_url() );
		$hot_bundle_url = 'http://localhost:3000/static/scripts/frontend-bundle.js';

		wp_enqueue_script( "{$this->name}-frontend-bundle", $hot_bundle_url, $this->_bundle_dependencies['frontend'], $this->version, true );

		if ( et_core_is_fb_enabled() ) {
			// Builder Bundle
			$hot_bundle_url = 'http://localhost:3000/static/js/builder-bundle.js';

			wp_enqueue_script( "{$this->name}-builder-bundle", $hot_bundle_url, $this->_bundle_dependencies['builder'], $this->version, true );
		}
	}

	public function dstc_enqueue_scripts() {
		wp_enqueue_script( 'testify_carousel-swiper-js', $this->plugin_dir_url . 'includes/scripts/swiper.min.js', true );
		$variables = array(
			'ajaxurl' => admin_url( 'admin-ajax.php' ),
			'nonce'   => wp_create_nonce( 'testify_carousel_nonce' )
		);
		wp_localize_script( 'testify_carousel-swiper-js', 'testify_carousel', $variables );
	}

	public function testify_carousel_testimonials_list_handler() {
		if ( ! check_ajax_referer( 'testify_carousel_nonce', 'nonce', false ) ) {
			wp_send_json_error( 'Invalid security token sent.' );
		}
		$testimonials = $this::testify_get_testimonials_list( $_POST );
		wp_send_json( compact( 'testimonials' ) );
	}

	static function testify_get_testimonials_list( $post ) {

		$options = array(
			'post_type'      => 'testify-testimonial',
			'posts_per_page' => isset( $post['testimonials_count'] ) ? (int) $post['testimonials_count'] : 3,
			'paged'          => 1,
			'post_status'    => 'publish',
		);

		if ( isset( $post['sort_by'] ) ) {

			$sortDir = isset( $post['sort_dir'] ) && $post['sort_dir'] == 'ASC' ? 'ASC' : 'DESC';

			switch ( $post['sort_by'] ) {
				case 'rand':
					$options = array_merge(
						$options,
						array(
							'orderby' => 'rand',
						)
					);
					break;
				default:
					$options = array_merge(
						$options,
						array(
							'orderby' => 'date',
							'order'   => $sortDir,
						)
					);

			}
		}

		if ( isset( $post['testimonial_view_type'] ) ) {
			switch ( sanitize_text_field( $post['testimonial_view_type'] ) ) {
				case 'recent_testimonials':
					$options = array_merge(
						$options,
						array(
							'orderby' => 'date',
							'order'   => 'DESC',
						)
					);
					break;
				case 'testimonials_category':
					if ( isset( $post['testimonials_category'] ) ) {
						$testimonials_category = explode( ',', sanitize_text_field( $post['testimonials_category'] ) );
						if ( ! in_array( 'all', $testimonials_category ) ) {
							$category = array();
							foreach ( $testimonials_category as $cat ) {
								if ( get_term_by( 'id', $cat, 'testify-cat' ) ) {
									$category[] = get_term_by( 'id', $cat, 'testify-cat' )->slug;
								}
							}
							if ( ! empty ( $category ) ) {
								$option = array(
									'tax_query' => array(
										array(
											'taxonomy' => 'testify-cat',
											'field'    => 'slug',
											'terms'    => $category,
											'operator' => 'in'
										)
									),
								);
							}

							$options = array_merge( $options, $option );
						}
					}
					break;
				default:
			}
		}

		$testimonials_posts = new WP_Query( $options );
		$testimonials_posts = $testimonials_posts->posts;
		$testimonials       = array();

		foreach ( $testimonials_posts as $key => $testimonial ) {
			$image = get_the_post_thumbnail_url( $testimonial->ID );

			$testimonials[ $key ]['title']                   = $testimonial->post_title;
			$testimonials[ $key ]['content']                 = $testimonial->post_content;
			$testimonials[ $key ]['id']                      = $testimonial->ID;
			$testimonials[ $key ]['testimonial_author']      = get_post_meta( $testimonial->ID, 'testimonial-author', true );
			$testimonials[ $key ]['testimonial_author_link'] = get_post_meta( $testimonial->ID, 'testimonial-author-link', true );
			$testimonials[ $key ]['position']                = get_post_meta( $testimonial->ID, 'testimonial-author-position', true );
			$testimonials[ $key ]['testimonial_rating_html'] = self::get_rating_html( get_post_meta( $testimonial->ID, 'testimonial-rating', true ) );
			$testimonials[ $key ]['image_html']              = ! empty( $image ) ? sprintf( '<img class="dstc-testify-featured-image" src="%1$s" alt="%2$s"/>', esc_url ( $image ), esc_html__( 'Testimonial Author Image', 'testify-testify' ) ) : '';
		}

		return $testimonials;
	}

	/**
	 * Generates Rating HTML from number
	 *
	 * Contains code copied from and/or based on WooCommerce
	 * See the license.txt file in the root directory for more information and licenses
	 *
	 */

	static function get_rating_html( $rating ) {
		$html = '';
		if ( $rating > 0 ) {
			/* translators: %s: rating */
			$label = sprintf( __( 'Rated %s out of 5', 'testify-testify' ), $rating );
			$html  = '<div class="star-rating" role="img" aria-label="' . esc_attr( $label ) . '">';
			$html  .= '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%">';

			/* translators: %s: rating */
			$html .= sprintf( esc_html__( 'Rated %s out of 5', 'testify-testify' ), '<strong class="rating">' . esc_html( $rating ) . '</strong>' );


			$html .= '</span></div>';
		}

		return $html;
	}

	// Divi\includes\builder\functions.php
	static function get_asset_definitions( $defs ) {

		if ( class_exists( 'Testify_Carousel_Child' ) ) {

			$shortcodes = '';
			foreach ( Testify_Carousel_Child::$TYPES as $type => $label ) {
				$shortcodes .= '[testify_carousel_child item="' . $type . '" item_title="' . $label . '" /]';
			}

			return $defs . sprintf(
					'; window.TestifyCarouselBackend=%s;',
					et_fb_remove_site_url_protocol(
						wp_json_encode(
							array(
								// Divi\includes\builder\functions.php
								'defaultContent' => et_fb_process_shortcode( $shortcodes ),
							),
							ET_BUILDER_JSON_ENCODE_OPTIONS
						)
					)
				);
		}

		return $defs;

	}

}

new TESTIFY_Testify;

Youez - 2016 - github.com/yon3zu
LinuXploit