/home/desid573/verdenaturopathy.com.au/wp-content/plugins/pagelayer/main
Edit: /home/desid573/verdenaturopathy.com.au/wp-content/plugins/pagelayer/main/live.php (10020B)
check_post();
// Add the shortcodes
// TODO : Make a json file
add_action('wp_head', array($this, 'wp_head'), 999);
// Add the Body Class Filter
//add_filter('body_class', array($this, 'body_class'));
// Add the content handler
add_filter('the_content', array($this, 'the_content'), 999999);
// Build the Shortcodes MD5 for cache
$scmd5 = md5(json_encode($pagelayer->shortcodes).json_encode($pagelayer->groups).json_encode($pagelayer->styles));
// Enqueue our Editor's JS
wp_register_script('pagelayer-editor', admin_url( 'admin-ajax.php?action=pagelayer_givejs' ).'&give=pagelayer-editor.js,widgets.js,'.(defined('PAGELAYER_PREMIUM') ? 'premium.js,' : '').'properties.js,base-64.min.js,slimscroll.js,vanilla-picker.min.js,trumbowyg.js,trumbowyg.fontfamily.js,trumbowyg-pagelayer.js,pen.js,tlite.min.js&pagelayer_nonce=1&scmd5='.$scmd5, array('jquery'), PAGELAYER_VERSION);
wp_enqueue_script('pagelayer-editor');
$css_url = admin_url('admin-ajax.php?action=pagelayer_givecss&pagelayer_nonce=1&');
if(pagelayer_enable_giver()){
$css_url = PAGELAYER_CSS.'/givecss.php?';
}
// Enqueue the Editor's CSS
wp_register_style('pagelayer-editor', $css_url.'give=pagelayer-editor-frontend.css,pen.css'.(defined('PAGELAYER_PREMIUM') ? ',owl.theme.default.min.css,owl.carousel.min.css' : ''), array(), PAGELAYER_VERSION);
wp_enqueue_style('pagelayer-editor');
// Enqueue the DateTime picker CSS
/* wp_register_style('datetime-picker', PAGELAYER_CSS.'/datetime-picker.css', array(), PAGELAYER_VERSION);
wp_enqueue_style('datetime-picker'); */
// Enqueue the media library
if(!did_action('wp_enqueue_media')){
wp_enqueue_media();
}
// Force the Frontend CSS and JS if not already loaded
pagelayer_enqueue_frontend(true);
// Hide Admin Bar
show_admin_bar(false);
remove_action('wp_head', '_admin_bar_bump_cb');
// Load custom widgets
do_action('pagelayer_custom_editor_enqueue');
// Add the footer scripts
add_action('wp_footer', array($this, 'wp_footer'), 1);
}
// Add our body class
function body_class($classes){
return array_merge($classes, array('pagelayer-body'));
}
// Header function to add certain things
function wp_head(){
global $pagelayer, $post, $wp_query;
// Export the post props
$_post = clone $post;
unset($_post->post_content);
// Add template type
if(!empty($pagelayer->template_editor)){
$_post->pagelayer_template_type = get_post_meta($_post->ID, 'pagelayer_template_type', true);
}
$returnURL = ($_post->post_type == 'post' ? admin_url('edit.php') : admin_url('edit.php?post_type='.$_post->post_type) );
// Get CAPTCHA site key
$pagelayer_recaptch_site_key = get_option('pagelayer_google_captcha');
$pro_url = defined('POPULARFX_PRO_URL') ? POPULARFX_PRO_URL : PAGELAYER_PRO_URL;
$pro_txt = defined('POPULARFX_PRO_URL') ? 'PopularFX Pro' : 'Pagelayer Pro';
echo '
';
echo '';
do_action('pagelayer_editor_wp_head');
}
// Footer function to add certain things
function wp_footer(){
global $pagelayer;
if(!empty($pagelayer->data_attr)){
echo '';
}
wp_enqueue_script('heartbeat');
_wp_footer_scripts();
}
// Convert to Pagelayer post
function check_post(){
global $post;
// Is this a Pagelayer post
$data = get_post_meta($post->ID, 'pagelayer-data', true);
if(empty($data)){
// Is it a Gutenburg Post ?
if(!empty($post->post_content)){
// Add our surrounding tag
$post->post_content = '['.PAGELAYER_SC_PREFIX.'_row]
['.PAGELAYER_SC_PREFIX.'_col col=12]
['.PAGELAYER_SC_PREFIX.'_text]
'.$post->post_content.'
[/'.PAGELAYER_SC_PREFIX.'_text]
[/'.PAGELAYER_SC_PREFIX.'_col]
[/'.PAGELAYER_SC_PREFIX.'_row]';
// Regular post, but its empty so we will add our blocks !
}else{
// Add our surrounding tag
$post->post_content = '
';
// Update the post
$new_post = array(
'ID' => $post->ID,
'post_content' => $post->post_content,
);
// Update the post into the database
wp_update_post($new_post);
// Convert to pagelayer accessed post
if(!add_post_meta($post->ID, 'pagelayer-data', time(), true)){
update_post_meta($post->ID, 'pagelayer-data', time());
}
}
}
}
// Add certain things
function the_content($content) {
global $post, $pagelayer;
if(empty($pagelayer->dont_make_editable)){
$content = '
'.$content.'
';
}
// Check if we're inside the main loop in a single post page.
if ( is_single() && in_the_loop() && is_main_query() ) {
return $content;
}
return $content;
}
}