__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace CarouselSlider\Modules\ImageCarousel;

use CarouselSlider\Supports\Validate;
use WP_Post;

/**
 * Item class
 */
class Item {

	/**
	 * The WP_Post object.
	 *
	 * @var WP_Post
	 */
	protected $post;

	/**
	 * Class constructor
	 *
	 * @param WP_Post $post The WP_Post object.
	 */
	public function __construct( WP_Post $post ) {
		$this->post = $post;
	}

	/**
	 * Get post id
	 *
	 * @return int
	 */
	public function get_id(): int {
		return $this->get_post()->ID;
	}

	/**
	 * Get title
	 *
	 * @return string
	 */
	public function get_title(): string {
		return $this->get_post()->post_title;
	}

	/**
	 * Get title
	 *
	 * @return string
	 */
	public function get_caption(): string {
		return $this->get_post()->post_excerpt;
	}

	/**
	 * Get image alt text
	 *
	 * @return string
	 */
	public function get_alt_text(): string {
		$image_alt = get_post_meta( $this->get_post()->ID, '_wp_attachment_image_alt', true );

		return trim( wp_strip_all_tags( $image_alt ) );
	}

	/**
	 * Get link url
	 *
	 * @return string
	 */
	public function get_link_url(): string {
		$image_link_url = get_post_meta( $this->post->ID, '_carousel_slider_link_url', true );

		return Validate::url( $image_link_url ) ? $image_link_url : '';
	}

	/**
	 * Get link start html
	 *
	 * @param string $context The context.
	 * @param string $target The target.
	 *
	 * @return string
	 */
	public function get_link_html_start( string $context, string $target = '_blank' ): string {
		if ( 'lightbox' === $context ) {
			$full_img = $this->get_image_src( 'full' );

			return '<a class="magnific-popup" href="' . esc_url( $full_img[0] ) . '" data-width="' . esc_attr( $full_img[1] ) . '" data-height="' . esc_attr( $full_img[2] ) . '">';
		}

		$link_url = $this->get_link_url();
		if ( 'link' === $context && $link_url ) {
			return '<a href="' . esc_url( $link_url ) . '" target="' . esc_attr( $target ) . '">';
		}

		return '';
	}

	/**
	 * Get link end html
	 *
	 * @param string $context The context.
	 *
	 * @return string
	 */
	public function get_link_html_end( string $context ): string {
		if ( in_array( $context, [ 'lightbox', 'link' ], true ) ) {
			return '</a>';
		}

		return '';
	}

	/**
	 * Get image
	 *
	 * @param string|int[] $size Registered image size name, or an array of width and height.
	 *
	 * @return string
	 */
	public function get_image( $size = 'medium_large' ): string {
		return wp_get_attachment_image( $this->get_id(), $size, false, [ 'alt' => $this->get_alt_text() ] );
	}

	/**
	 * Get image src
	 *
	 * @param string|int[] $size Registered image size name, or an array of width and height.
	 *
	 * @return array
	 */
	public function get_image_src( $size = 'medium_large' ): array {
		return wp_get_attachment_image_src( $this->get_id(), $size );
	}

	/**
	 * Get post object
	 *
	 * @return WP_Post
	 */
	public function get_post(): WP_Post {
		return $this->post;
	}
}

Filemanager

Name Type Size Permission Actions
Admin.php File 8.62 KB 0775
ExternalImageItem.php File 2.17 KB 0775
Item.php File 2.84 KB 0775
Module.php File 2.38 KB 0775
Setting.php File 2.31 KB 0775
Template.php File 1.58 KB 0775
TemplateUrl.php File 1.76 KB 0775
UrlView.php File 1.54 KB 0775
View.php File 1.46 KB 0775
Filemanager