initial
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
class Welcome_Messages_Beaver_Builder
|
||||
{
|
||||
private $key;
|
||||
private $settings;
|
||||
private $template;
|
||||
public function process($settings, $key)
|
||||
{
|
||||
if (!isset($settings['page_id_beaver'])) return;
|
||||
|
||||
$this->key = $key;
|
||||
$this->settings = $settings;
|
||||
$this->template = $settings['page_id_beaver'];
|
||||
add_action('in_admin_header', array($this, 'welcome_panel'));
|
||||
add_action('admin_enqueue_scripts', 'FLBuilder::register_layout_styles_scripts');
|
||||
}
|
||||
|
||||
public function template()
|
||||
{
|
||||
echo do_shortcode('[fl_builder_insert_layout id="' . esc_attr($this->template) . '"]');
|
||||
}
|
||||
|
||||
public function welcome_panel()
|
||||
{
|
||||
?>
|
||||
<div id="welcome-panel<?php echo $this->key ?>" data-welcome_key="<?php echo $this->key ?>" class="wlcms-welcome-panel" style="display:none">
|
||||
<?php
|
||||
if (isset($this->settings['dismissible'])) :
|
||||
?><a class="welcome-panel-close" href="#" aria-label="Dismiss the welcome panel">Dismiss</a>
|
||||
<?php endif ?>
|
||||
<div class="welcome-panel-content welcome-panel-content<?php echo $this->key ?>">
|
||||
<?php if (isset($this->settings['page_id_beaver']) && isset($this->settings['show_title'])) : ?>
|
||||
<h2>
|
||||
<?php echo get_the_title($this->settings['page_id_beaver']) ?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
<?php $this->template(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$welcome = sprintf(";jQuery('#welcome-panel%1\$d').insertBefore('#dashboard-widgets-wrap');jQuery('#welcome-panel%1\$d').show();", $this->key);
|
||||
wlcms_add_js($welcome);
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
class Welcome_Messages_Elementor
|
||||
{
|
||||
private $key;
|
||||
private $settings;
|
||||
public function process($settings, $key)
|
||||
{
|
||||
if (!isset($settings['page_id_elementor'])) return;
|
||||
if ($settings['page_id_elementor'] == "") return;
|
||||
|
||||
$this->key = $key;
|
||||
$this->settings = $settings;
|
||||
add_action('in_admin_header', array($this, 'welcome_panel'));
|
||||
}
|
||||
|
||||
public function welcome_panel()
|
||||
{
|
||||
$has_dismissable = isset($this->settings['dismissible']);
|
||||
$is_show_title = isset($this->settings['page_id_elementor']) && isset($this->settings['show_title']);
|
||||
?>
|
||||
<div id="welcome-panel<?php echo $this->key ?>" data-welcome_key="<?php echo $this->key ?>" class="wlcms-welcome-panel" style="display:none">
|
||||
<?php
|
||||
if ($has_dismissable) :
|
||||
?><a class="welcome-panel-close" href="#" aria-label="Dismiss the welcome panel">Dismiss</a>
|
||||
<?php endif ?>
|
||||
<div class="welcome-panel-content welcome-panel-content<?php echo $this->key ?>">
|
||||
<?php if ($has_dismissable || $is_show_title) : ?>
|
||||
<?php if ($is_show_title) : ?>
|
||||
<h2>
|
||||
<?php echo get_the_title($this->settings['page_id_elementor']) ?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php $this->template(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$welcome = sprintf(";jQuery('#welcome-panel%1\$d').insertBefore('#dashboard-widgets-wrap');jQuery('#welcome-panel%1\$d').show();", $this->key);
|
||||
wlcms_add_js($welcome);
|
||||
}
|
||||
|
||||
public function template()
|
||||
{
|
||||
if (!$this->settings['page_id_elementor']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$elementor = @Elementor\Plugin::instance();
|
||||
|
||||
$elementor->frontend->register_styles();
|
||||
$elementor->frontend->enqueue_styles();
|
||||
|
||||
$elementor->frontend->register_scripts();
|
||||
$elementor->frontend->enqueue_scripts();
|
||||
|
||||
echo $elementor->frontend->get_builder_content((int) $this->settings['page_id_elementor'], true);
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
class Welcome_Messages_Html
|
||||
{
|
||||
private $key;
|
||||
private $settings;
|
||||
public function process($settings, $key)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->settings = $settings;
|
||||
|
||||
if (isset($this->settings['is_fullwidth']) && $this->settings['is_fullwidth'] == 1) {
|
||||
add_action('in_admin_header', array($this, 'welcome_panel'));
|
||||
return;
|
||||
}
|
||||
|
||||
wp_add_dashboard_widget(
|
||||
'custom_vum_widget' . $key,
|
||||
isset($this->settings['title']) ? $this->settings['title'] : ' ',
|
||||
array($this, 'welcome_description'),
|
||||
null,
|
||||
array('desc' => $this->template())
|
||||
);
|
||||
}
|
||||
|
||||
public function welcome_description($post, $callback_args)
|
||||
{
|
||||
echo $callback_args['args']['desc'];
|
||||
}
|
||||
|
||||
public function welcome_panel()
|
||||
{ ?>
|
||||
<div id="welcome-panel<?php echo $this->key ?>" data-welcome_key="<?php echo $this->key ?>" class="wlcms-welcome-panel">
|
||||
<?php
|
||||
if (isset($this->settings['dismissible'])) :
|
||||
?><a class="welcome-panel-close" href="#" aria-label="Dismiss the welcome panel">Dismiss</a>
|
||||
<?php endif ?>
|
||||
<div class="welcome-panel-content welcome-panel-content<?php echo $this->key ?>" style="padding-bottom:20px">
|
||||
<?php if (isset($this->settings['title'])) : ?>
|
||||
<h2><?php echo esc_html($this->settings['title']) ?></h2>
|
||||
<?php endif; ?>
|
||||
<div class="wlcms-welcome-content">
|
||||
<?php echo $this->template(); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$welcome = sprintf(";jQuery('#welcome-panel%1\$d').insertBefore('#dashboard-widgets-wrap');jQuery('#welcome-panel%1\$d').show();", $this->key);
|
||||
wlcms_add_js($welcome);
|
||||
}
|
||||
|
||||
public function template()
|
||||
{
|
||||
return isset($this->settings['description']) ? wpautop(wp_kses_post($this->settings['description'])) : '';
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
class Welcome_Messages_Page
|
||||
{
|
||||
private $key;
|
||||
private $settings;
|
||||
private $template;
|
||||
private $pages = [];
|
||||
public function init($pages = [])
|
||||
{
|
||||
if (!count($pages)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->pages = $pages;
|
||||
|
||||
add_action('wp', array($this, 'wp'));
|
||||
}
|
||||
public function wp()
|
||||
{
|
||||
$this->hide_admin_menu_bar();
|
||||
}
|
||||
|
||||
private function hide_admin_menu_bar()
|
||||
{
|
||||
if (!isset($_GET['wlcms-welcome-dashboard'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter('show_admin_bar', '__return_false');
|
||||
}
|
||||
|
||||
public function process($settings, $key)
|
||||
{
|
||||
if (!isset($settings['page_id_page'])) return;
|
||||
|
||||
$this->key = $key;
|
||||
$this->settings = $settings;
|
||||
$this->template = $settings['page_id_page'];
|
||||
|
||||
add_action('in_admin_header', array($this, 'welcome_panel'));
|
||||
}
|
||||
|
||||
|
||||
public function template()
|
||||
{
|
||||
if (!$this->template || ($this->template && $this->template == '')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$url = get_permalink($this->template);
|
||||
$url = add_query_arg('wlcms-welcome-dashboard', 'true', $url);
|
||||
$url = esc_url($url);
|
||||
|
||||
echo "<iframe class=\"responsive-iframe\" onLoad=\"wlcms_iframe_height(this)\" frameborder=\"0\" scrolling=\"no\" width=\"100%\" src=\"{$url}\"></iframe>";
|
||||
}
|
||||
|
||||
public function welcome_panel()
|
||||
{
|
||||
?>
|
||||
<div id="welcome-panel<?php echo $this->key ?>" data-welcome_key="<?php echo $this->key ?>" class="wlcms-welcome-panel" style="display:none">
|
||||
<?php
|
||||
if (isset($this->settings['dismissible'])) :
|
||||
?><a class="welcome-panel-close" href="#" aria-label="Dismiss the welcome panel">Dismiss</a>
|
||||
<?php endif ?>
|
||||
<div class="welcome-panel-content welcome-panel-content<?php echo $this->key ?>">
|
||||
<?php if (isset($this->settings['page_id_page']) && isset($this->settings['show_title'])) : ?>
|
||||
<h2>
|
||||
<?php echo get_the_title($this->settings['page_id_page']) ?>
|
||||
</h2>
|
||||
<?php endif; ?>
|
||||
<?php $this->template(); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$welcome = sprintf(";jQuery('#welcome-panel%1\$d').insertBefore('#dashboard-widgets-wrap');jQuery('#welcome-panel%1\$d').show();", $this->key);
|
||||
wlcms_add_js($welcome);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user