updated plugin GP Premium version 1.11.2

This commit is contained in:
2020-08-13 14:53:39 +00:00
committed by Gitium
parent 3f0f8d3ac9
commit 885bbdd113
151 changed files with 11329 additions and 6954 deletions

View File

@ -1,8 +1,17 @@
<?php
/**
* This file contains helper functions for Elements.
*
* @package GP Premium
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // No direct access, please.
}
/**
* Helper functions.
*/
class GeneratePress_Elements_Helper {
/**
* Instance.
@ -21,7 +30,7 @@ class GeneratePress_Elements_Helper {
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self;
self::$instance = new self();
}
return self::$instance;
@ -32,6 +41,7 @@ class GeneratePress_Elements_Helper {
*
* @since 1.7
*
* @param string $option Option to check.
* @return bool
*/
public static function does_option_exist( $option ) {
@ -96,6 +106,9 @@ class GeneratePress_Elements_Helper {
return false;
}
/**
* Check whether we should execute PHP or not.
*/
public static function should_execute_php() {
$php = true;
@ -105,4 +118,30 @@ class GeneratePress_Elements_Helper {
return apply_filters( 'generate_hooks_execute_php', $php );
}
/**
* Build our HTML generated by the blocks.
*
* @since 1.11.0
*
* @param int $id The ID to check.
* @return string
*/
public static function build_content( $id ) {
if ( ! function_exists( 'do_blocks' ) ) {
return;
}
$block_element = get_post( $id );
if ( ! $block_element || 'gp_elements' !== $block_element->post_type ) {
return '';
}
if ( 'publish' !== $block_element->post_status || ! empty( $block_element->post_password ) ) {
return '';
}
return apply_filters( 'generate_do_block_element_content', do_blocks( $block_element->post_content ) );
}
}