Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/plugin-c...
File: wp-views.php
<?php
[0] Fix | Delete
[1] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[2] Fix | Delete
exit; // Exit if accessed directly
[3] Fix | Delete
}
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Plugin compatibility for Toolset Views
[7] Fix | Delete
*
[8] Fix | Delete
* @since 3.20
[9] Fix | Delete
*
[10] Fix | Delete
* @link https://toolset.com
[11] Fix | Delete
*/
[12] Fix | Delete
class ET_Builder_Plugin_Compat_ToolsetViews extends ET_Builder_Plugin_Compat_Base {
[13] Fix | Delete
[14] Fix | Delete
/**
[15] Fix | Delete
* Constructor
[16] Fix | Delete
*/
[17] Fix | Delete
public function __construct() {
[18] Fix | Delete
$this->plugin_id = 'wp-views/wp-views.php';
[19] Fix | Delete
$this->init_hooks();
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Hook methods to WordPress
[24] Fix | Delete
*
[25] Fix | Delete
* Latest plugin version: 2.7.1
[26] Fix | Delete
*
[27] Fix | Delete
* @return void
[28] Fix | Delete
*/
[29] Fix | Delete
public function init_hooks() {
[30] Fix | Delete
// Bail if there's no version found
[31] Fix | Delete
if ( ! $this->get_plugin_version() ) {
[32] Fix | Delete
return;
[33] Fix | Delete
}
[34] Fix | Delete
[35] Fix | Delete
add_filter( 'et_builder_post_types', array( $this, 'add_post_type' ) );
[36] Fix | Delete
add_filter( 'et_builder_third_party_post_types', array( $this, 'add_post_type' ) );
[37] Fix | Delete
add_filter( 'et_builder_third_party_unqueriable_post_types', array( $this, 'add_post_type' ) );
[38] Fix | Delete
[39] Fix | Delete
$enabled = array(
[40] Fix | Delete
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
[41] Fix | Delete
'vb' => et_()->array_get( $_GET, 'et_fb' ),
[42] Fix | Delete
'bfb' => et_()->array_get( $_GET, 'et_bfb' ),
[43] Fix | Delete
// phpcs:enable
[44] Fix | Delete
);
[45] Fix | Delete
[46] Fix | Delete
if ( $enabled['vb'] && ! $enabled['bfb'] ) {
[47] Fix | Delete
// Fields and Views custom TinyMCE button doesn't work in VB and also generate an error.
[48] Fix | Delete
add_action( 'toolset_editor_add_form_buttons', '__return_false' );
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
// I know what you're thinking .... can't check for 'edit_post' because too early
[52] Fix | Delete
// and don't have a post ID yet but will do inside the filter.
[53] Fix | Delete
if ( $enabled['vb'] && $enabled['bfb'] && current_user_can( 'edit_posts' ) ) {
[54] Fix | Delete
// Content templates not using Divi break the BFB, disable them.
[55] Fix | Delete
add_filter( 'get_post_metadata', array( $this, 'disable_views' ), 10, 4 );
[56] Fix | Delete
}
[57] Fix | Delete
[58] Fix | Delete
add_filter( 'et_builder_render_layout', array( $this, 'transform_shortcodes' ), 4 );
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* Add `view-template` post type.
[63] Fix | Delete
*
[64] Fix | Delete
* @param array $types
[65] Fix | Delete
* @return array
[66] Fix | Delete
*/
[67] Fix | Delete
public function add_post_type( $types ) {
[68] Fix | Delete
return array_merge( $types, array( 'view-template' ) );
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Disable Views for a post.
[73] Fix | Delete
*
[74] Fix | Delete
* @param null|array|string $value The value get_metadata() should return - a single metadata value,
[75] Fix | Delete
* or an array of values.
[76] Fix | Delete
* @param int $object_id Object ID.
[77] Fix | Delete
* @param string $meta_key Meta key.
[78] Fix | Delete
* @param bool $single Whether to return only the first value of the specified $meta_key.
[79] Fix | Delete
*
[80] Fix | Delete
* @access public.
[81] Fix | Delete
* @return void
[82] Fix | Delete
*/
[83] Fix | Delete
public function disable_views( $value, $object_id, $meta_key, $single ) {
[84] Fix | Delete
if ( '_views_template' === $meta_key && current_user_can( 'edit_post', $object_id ) ) {
[85] Fix | Delete
return false;
[86] Fix | Delete
}
[87] Fix | Delete
return $value;
[88] Fix | Delete
}
[89] Fix | Delete
[90] Fix | Delete
/**
[91] Fix | Delete
* Transform {!{ ... }!} shortcodes to [] ones.
[92] Fix | Delete
*
[93] Fix | Delete
* @since 4.0.10
[94] Fix | Delete
*
[95] Fix | Delete
* @param string $content
[96] Fix | Delete
*
[97] Fix | Delete
* @return string
[98] Fix | Delete
*/
[99] Fix | Delete
public function transform_shortcodes( $content ) {
[100] Fix | Delete
/**
[101] Fix | Delete
* @see WPV_Frontend_Render_Filters::pre_process_shortcodes()
[102] Fix | Delete
*
[103] Fix | Delete
* @param string $content
[104] Fix | Delete
*/
[105] Fix | Delete
$content = apply_filters( 'wpv-pre-process-shortcodes', $content );
[106] Fix | Delete
[107] Fix | Delete
/**
[108] Fix | Delete
* @see Toolset_Shortcode_Transformer::replace_shortcode_placeholders_with_brackets()
[109] Fix | Delete
*
[110] Fix | Delete
* @param string $content
[111] Fix | Delete
*/
[112] Fix | Delete
$content = apply_filters( 'toolset_transform_shortcode_format', $content );
[113] Fix | Delete
[114] Fix | Delete
return $content;
[115] Fix | Delete
}
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
new ET_Builder_Plugin_Compat_ToolsetViews();
[119] Fix | Delete
[120] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function