403Webshell
Server IP : 185.143.234.238  /  Your IP : 185.215.232.195
Web Server : nginx/1.22.1
System : Linux server2065 6.1.0-35-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.137-1 (2025-05-07) x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/bcandle/wp-content/plugins/jet-engine/includes/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/bcandle/wp-content/plugins/jet-engine/includes/classes/datetime.php
<?php
/**
 * Datetime management class
 */

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
	die;
}

/**
 * Define Datetime management class
 */
class Jet_Engine_Datetime {

	/**
	 * Check if wp_date used instead fo date to process data
	 * 
	 * @return [type] [description]
	 */
	public function use_wp_date() {
		return apply_filters( 'jet-engine/datetime/use-wp-date', false );
	}

	/**
	 * Return human-readable localized date from timestamp
	 * 
	 * @param  [type] $format [description]
	 * @param  [type] $time   [description]
	 * @return [type]         [description]
	 */
	public function date( $format = null, $time = null ) {
		if ( $this->use_wp_date() ) {
			return wp_date( $format, $time );
		} else {
			return date_i18n( $format, $time );
		}
	}

	/**
	 * Convert string to time according timezone settings
	 * 
	 * @param  [type] $timestring [description]
	 * @return [type]             [description]
	 */
	public function to_time( $timestring ) {
		if ( $this->use_wp_date() ) {

			if ( empty( $timestring ) ) {
				return $timestring;
			}

			$date = new DateTime( $timestring, wp_timezone() );
			return $date->format( 'U' );
		} else {
			return strtotime( $timestring );
		}
	}

	/**
	 * Convert meta value date to timestamp according timezone settings
	 * 
	 * @param  [type] $timestamp [description]
	 * @param  [type] $raw_time  [description]
	 * @return [type]            [description]
	 */
	public function meta_to_time( $timestamp, $raw_time ) {
		return $this->to_time( $raw_time );
	}

	/**
	 * Convert meta value date to formatted date according timezone settings
	 * 
	 * @param  [type] $timestamp [description]
	 * @param  [type] $raw_time  [description]
	 * @return [type]            [description]
	 */
	public function meta_to_date( $formatted_date, $timestamp, $format ) {
		return $this->date( $format, $timestamp );
	}

	/**
	 * Convert meta fileds timestamp dates on save or get field values
	 * @return [type] [description]
	 */
	public function convert_meta_fields_dates() {
		
		add_filter( 'cx_post_meta/strtotime', array( $this, 'meta_to_time' ), 10, 2 );
		add_filter( 'cx_post_meta/date', array( $this, 'meta_to_date' ), 10, 3 );

		add_filter( 'cx_term_meta/strtotime', array( $this, 'meta_to_time' ), 10, 2 );
		add_filter( 'cx_term_meta/date', array( $this, 'meta_to_date' ), 10, 3 );

		add_filter( 'cx_user_meta/strtotime', array( $this, 'meta_to_time' ), 10, 2 );
		add_filter( 'cx_user_meta/date', array( $this, 'meta_to_date' ), 10, 3 );

		add_filter( 'jet-engine/custom-content-types/strtotime', array( $this, 'meta_to_time' ), 10, 2 );
		add_filter( 'jet-engine/custom-content-types/date', array( $this, 'meta_to_date' ), 10, 3 );

		add_filter( 'jet-engine/options-pages/strtotime', array( $this, 'meta_to_time' ), 10, 2 );
		add_filter( 'jet-engine/options-pages/date', array( $this, 'meta_to_date' ), 10, 3 );

	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit