| Server IP : 216.250.13.251 / Your IP : 216.73.216.237 Web Server : nginx/1.24.0 System : Linux gunay 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : root ( 0) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/gunay/wp-content/themes/rttheme19/rt-framework/admin/functions/ |
Upload File : |
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* RT Custom Controls
* @return $type
*/
function rt_custom_controls( $wp_customize ){
/**
* Custom Media Control Class
*/
class RT_Customize_Media_Control extends WP_Customize_Control {
public $type = 'rt_media';
public $statuses;
public function enqueue() {
wp_enqueue_media();
}
/**
* Constructor.
*
* If $args['settings'] is not defined, use the $id as the setting ID.
*
* @since 10/16/2012
* @uses WP_Customize_Control::__construct()
* @param WP_Customize_Manager $manager
* @param string $id
* @param array $args
* @return void
*/
public function __construct( $manager, $id, $args = array() ) {
$this->statuses = array( '' => esc_html__( 'Default','rt_theme' ) );
parent::__construct( $manager, $id, $args );
}
/**
* Constructor.
*
* @since 3.4.0
* @uses WP_Customize_Image_Control::__construct()
*
* @param WP_Customize_Manager $manager
*/
public function render_content() {
$field_value = esc_html( $this->value() );
$id = $this->id;
?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif;
if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post($this->description); ?></span>
<?php endif; ?>
<div class="form_element upload">
<input id="<?php echo esc_attr($id); ?>" autocomplete="off" type="text" <?php $this->link(); ?> class="upload_field">
<button data-inputid="<?php echo esc_attr($id) ?>" class="button icon-upload rttheme_upload_button" type="button"><?php echo esc_html__('Upload','rt_theme'); ?></button>
</div>
<?php
//the file extention
$ext = pathinfo($field_value, PATHINFO_EXTENSION);
//is the file an image?
if( $ext == "jpg" || $ext == "jpeg" || $ext == "png" || $ext == "gif" ){
$ext_image = true;
}else{
$ext_image = false;
}
echo true == ( $field_value && $ext_image ) ? '<div data-holderid="'.esc_attr($id).'" class="uploaded_file visible">' : '<div data-holderid="'.esc_attr($id).'" class="uploaded_file ">';
if($field_value){
echo '<img class="loadit" src="'.esc_url($field_value).'" data-image="'.esc_attr($id).'" >';
}else{
echo '<img class="loadit" src="'.RT_THEMEADMINURI.'/images/blank.png" data-image="'.esc_attr($id).'">';
}
echo '<span class="icon-cancel delete_single" title="'.esc_html__("remove image",'rt_theme').'" data-inputid="'.esc_attr($id).'"></span>';
echo '</div>';
?>
</label>
<?php
}
}
/**
* Custom Color Control with RGBA Supporrt
*/
class RT_Color_Control extends WP_Customize_Control {
public $type = 'rt_color';
public $default = '';
/**
* Constructor.
* @param WP_Customize_Manager $manager
*/
public function render_content() { ?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif;
if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post($this->description); ?></span>
<?php endif; ?>
<div class="customize-control-content">
<div class="wp-picker-container">
<a class="rt-color-control-result wp-color-result" tabindex="0" style="background-color: <?php echo esc_attr($this->value()); ?>" title="<?php echo esc_html__("Select Color",'rt_theme'); ?>" data-current="<?php echo esc_html__("Current Color",'rt_theme'); ?>"></a>
<span class="wp-picker-input-wrap">
<input type="text" value="<?php echo esc_attr($this->value()); ?>" <?php $this->link(); ?> class="wp-color-picker" data-default-color="<?php echo esc_attr($this->default); ?>" style="display:none;">
<input class="button button-small wp-picker-default rt-color-control-default" type="button" value="Default" style="display:none;">
</span>
<div class="rt-color-control" data-elemenet-id="<?php echo esc_attr($this->id); ?>"></div>
</div>
</div>
</label>
<?php }
}
/**
* Custom Select Control with input_attrs and optgroup support & customizations for rt_fonts
*/
class RT_Select_Control extends WP_Customize_Control {
public $type = 'rt_select';
public $default = '';
/**
* Construct
*/
public function __construct( $manager, $id, $args ) {
parent::__construct( $manager, $id, $args );
// prapare atts for google font subsets
if( isset($this->input_attrs["class"]) && $this->input_attrs["class"] == "rt_fonts" ){
$data_subset_id = get_theme_mod( $this->input_attrs["data-subset-id"] );
$data_variant_id = get_theme_mod( $this->input_attrs["data-variant-id"] );
$this->input_attrs["data-selected-subsets"] = ! empty($data_subset_id) ? implode(",", $data_subset_id ) : "";
$this->input_attrs["data-selected-variant"] = ! empty($data_subset_id) ? $data_variant_id : "";
}
}
/**
* Render content
*/
public function render_content() {
?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif;
if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
<?php endif; ?>
<select <?php $this->link(); ?> <?php $this->input_attrs(); ?>>
<?php
if ( isset( $this->choices ) && is_array( $this->choices ) ){
foreach ( $this->choices as $value => $label ){
switch ( $value ) {
case strpos($value, "obt_start") > 0 :
echo '<optgroup label="' . $label . '"">';
break;
case strpos($value, "obt_end") > 0 :
echo '</optgroup>';
break;
case strpos( $value, "\"kind\":") > 0 :
$this->create_font_option( $value, $label );
break;
default:
echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_attr( $label ) . '</option>';
break;
}
}
}
?>
</select>
</label>
<?php
}
/**
* createa an option for font lists
*/
public function create_font_option( $value, $label ) {
$font_data = json_decode( $value );
echo '<option value="' . $font_data->kind . '||'. $font_data->family .'" data-subsets="'. implode(',', $font_data->subsets ) .'" data-variants="'. implode(',', $font_data->variants ) .'" >' . esc_attr($label) . '</option>';
}
}
/**
* Custom Content
*/
class RT_Content_Control extends WP_Customize_Control {
public $type = 'rt_contents';
public $default = '';
/**
* Render content
*/
public function render_content() {
?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif; ?>
<section class="rt_contnet_control">
<?php
if ( ! empty( $this->description ) ) : ?>
<?php echo wp_kses_post( $this->description ); ?>
<?php endif;?>
</section>
</label>
<?php
}
}
/**
* Custom Checkbox
*/
class RT_Checkbox_Control extends WP_Customize_Control {
public $type = 'rt_checkbox';
public $default = '';
/**
* Render content
*/
public function render_content() {
?>
<label>
<input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); $this->input_attrs(); ?> />
<?php echo esc_html( $this->label ); ?>
<?php if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
<?php endif; ?>
</label>
<?php
}
}
/**
* Custom Seperator
*/
class RT_Seperator_Control extends WP_Customize_Control {
public $type = 'rt_seperator';
public $default = '';
/**
* Render content
*/
public function render_content() {
?>
<label>
<hr class="rt_seperator" />
<?php if ( ! empty( $this->label ) ) : ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php endif;
if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post($this->description); ?></span>
<?php endif; ?>
</label>
<?php
}
}
/**
* Custom SubSection Heading
*/
class RT_SubSection_Heading extends WP_Customize_Control {
public $type = 'rt_subsection_heading';
public $default = '';
/**
* Render content
*/
public function render_content() {
?>
<label>
<?php if ( ! empty( $this->label ) ) : ?>
<h3 class="rt-customizer-subsection-title"><span class="dashicons-arrow-down-alt2"></span><?php echo esc_html( $this->label ); ?></h3>
<?php endif;
if ( ! empty( $this->description ) ) : ?>
<span class="description customize-control-description"><?php echo wp_kses_post($this->description); ?></span>
<?php endif; ?>
</label>
<?php
}
}
}
add_action( 'customize_register', 'rt_custom_controls' );