| Linux server27.hostingraja.org 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64 Path : /home/udaipurk/public_html/websites/rishh/XStore Theme/xstore/framework/panel/classes/ |
| Current File : //home/udaipurk/public_html/websites/rishh/XStore Theme/xstore/framework/panel/classes/youtube.php |
<?php if ( ! defined( 'ABSPATH' ) ) exit( 'No direct script access allowed' );
/**
* Etheme Admin Panel YouTube.
*
* Add admin panel dashboard pages to admin menu.
* Output dashboard pages.
*
* @since 7.0.0
* @version 1.0.1
*/
class YouTube{
// ! Main construct
function __construct(){
$_POST['et_YouTube'] = $this->et_get_YouTube();
}
/**
* Get YouTube videos
*
* @version 1.0.1
* @since 6.3.6
*/
public function et_get_YouTube() {
$videos = get_transient( 'etheme_YouTube_info' );
if ( ! $videos || empty( $videos ) || isset($_GET['et_clear_YouTube_transient']) ) {
$videos = array();
// Get data from youtube API
$api_response = wp_remote_get( 'https://8theme.com/youtube-api/');
// Get response code
$code = wp_remote_retrieve_response_code( $api_response );
if ( $code == 200 ) {
$api_response = wp_remote_retrieve_body( $api_response );
$api_response = json_decode( $api_response, true );
if ( $api_response['status'] == 'success'){
$videos = json_decode($api_response['data'], true);
}
set_transient( 'etheme_YouTube_info', $videos, 24 * HOUR_IN_SECONDS );
} else {
$videos = array();
}
}
return $videos;
}
public function et_documentation_beacon(){
$_POST['value'] = $_POST['value'] == 'false' ? false : true;
$value = ( $_POST['value'] ) ? 'on' : 'off';
update_option( 'et_documentation_beacon', $value, 'no');
die();
}
}