2020-04-07 13:03:04 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* The upsell Customizer controll.
|
|
|
|
*
|
|
|
|
* @package GeneratePress
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
|
|
exit; // Exit if accessed directly.
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( class_exists( 'WP_Customize_Control' ) && ! class_exists( 'Generate_Customize_Misc_Control' ) ) {
|
|
|
|
/**
|
|
|
|
* Create our in-section upsell controls.
|
|
|
|
* Escape your URL in the Customizer using esc_url().
|
|
|
|
*
|
|
|
|
* @since 0.1
|
|
|
|
*/
|
|
|
|
class Generate_Customize_Misc_Control extends WP_Customize_Control {
|
2020-10-20 15:16:18 +00:00
|
|
|
/**
|
|
|
|
* Set description.
|
|
|
|
*
|
|
|
|
* @var public $description
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public $description = '';
|
2020-10-20 15:16:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set URL.
|
|
|
|
*
|
|
|
|
* @var public $url
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public $url = '';
|
2020-10-20 15:16:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set type.
|
|
|
|
*
|
|
|
|
* @var public $type
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public $type = 'addon';
|
2020-10-20 15:16:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set label.
|
|
|
|
*
|
|
|
|
* @var public $label
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public $label = '';
|
|
|
|
|
2020-10-20 15:16:18 +00:00
|
|
|
/**
|
|
|
|
* Enqueue scripts.
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public function enqueue() {
|
2020-10-20 15:16:18 +00:00
|
|
|
wp_enqueue_style(
|
|
|
|
'generate-customizer-controls-css',
|
|
|
|
trailingslashit( get_template_directory_uri() ) . 'inc/customizer/controls/css/upsell-customizer.css',
|
|
|
|
array(),
|
|
|
|
GENERATE_VERSION
|
|
|
|
);
|
2020-04-07 13:03:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 15:16:18 +00:00
|
|
|
/**
|
|
|
|
* Send variables to json.
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public function to_json() {
|
|
|
|
parent::to_json();
|
|
|
|
$this->json['url'] = esc_url( $this->url );
|
|
|
|
}
|
|
|
|
|
2020-10-20 15:16:18 +00:00
|
|
|
/**
|
|
|
|
* Render content.
|
|
|
|
*/
|
2020-04-07 13:03:04 +00:00
|
|
|
public function content_template() {
|
|
|
|
?>
|
|
|
|
<p class="description" style="margin-top: 5px;">{{{ data.description }}}</p>
|
|
|
|
<span class="get-addon">
|
|
|
|
<a href="{{{ data.url }}}" class="button button-primary" target="_blank">{{ data.label }}</a>
|
|
|
|
</span>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|