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.../plugins/themify-.../classes
File: class-themify-builder-page.php
<?php
[0] Fix | Delete
[1] Fix | Delete
defined( 'ABSPATH' ) || exit;
[2] Fix | Delete
[3] Fix | Delete
class Themify_Builder_Builder_Page {
[4] Fix | Delete
[5] Fix | Delete
static function init() {
[6] Fix | Delete
if (current_user_can( 'publish_pages' ) ) {
[7] Fix | Delete
add_action( 'admin_bar_menu', [ __CLASS__, 'admin_bar_menu' ], 999 );
[8] Fix | Delete
if ( is_admin() ) {
[9] Fix | Delete
add_action( 'admin_menu', [ __CLASS__, 'admin_menu' ] );
[10] Fix | Delete
add_action( 'admin_init', [ __CLASS__, 'loader_script' ] );
[11] Fix | Delete
add_action( 'wp_ajax_tb_builder_page_dropdown', [ __CLASS__, 'ajax_dropdown' ] );
[12] Fix | Delete
add_action( 'wp_ajax_tb_builder_page_publish', [ __CLASS__, 'wp_ajax_tb_builder_page_publish' ] );
[13] Fix | Delete
} else {
[14] Fix | Delete
add_action( 'wp_footer', [ __CLASS__, 'loader_script' ] );
[15] Fix | Delete
}
[16] Fix | Delete
}
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
static function admin_menu() {
[20] Fix | Delete
add_submenu_page( 'edit.php?post_type=page', __( 'Add Builder Page', 'themify' ), __( 'Add Builder Page', 'themify' ), 'publish_pages', '#tb_builder_page', null );
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
static function admin_bar_menu( $admin_bar ) {
[24] Fix | Delete
$args = array(
[25] Fix | Delete
'parent' => 'new-page',
[26] Fix | Delete
'id' => 'tb_builder_page',
[27] Fix | Delete
'title' => __( ' Builder Page', 'themify' ), /* space before the title is for the tf_loader element */
[28] Fix | Delete
'href' => '#tb_builder_page',
[29] Fix | Delete
'meta' => false
[30] Fix | Delete
);
[31] Fix | Delete
$admin_bar->add_node( $args );
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
static function ajax_dropdown() {
[35] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[36] Fix | Delete
wp_dropdown_pages( [
[37] Fix | Delete
'post_type' => 'page',
[38] Fix | Delete
'name' => 'parent',
[39] Fix | Delete
'class'=>'tf_scrollbar',
[40] Fix | Delete
'show_option_none' => __( '(no parent)', 'themify' ),
[41] Fix | Delete
'sort_column' => 'menu_order, post_title',
[42] Fix | Delete
] );
[43] Fix | Delete
die;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Publish a new page and import a chosen Builder layout
[48] Fix | Delete
*
[49] Fix | Delete
* @hooked to wp_ajax_tb_builder_page_publish
[50] Fix | Delete
*/
[51] Fix | Delete
static function wp_ajax_tb_builder_page_publish() {
[52] Fix | Delete
check_ajax_referer( 'tf_nonce', 'nonce' );
[53] Fix | Delete
if ( ! current_user_can( 'publish_pages' ) ) {
[54] Fix | Delete
die;
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
$title = isset( $_POST['post_title'] ) ? sanitize_text_field( $_POST['post_title'] ) : '';
[58] Fix | Delete
$layout = isset( $_POST['layout'] ) ? json_decode(stripslashes_deep($_POST['layout']),true) : '';
[59] Fix | Delete
$parent = isset( $_POST['parent'] ) ? (int) $_POST['parent'] : 0;
[60] Fix | Delete
$new_page = wp_insert_post( [
[61] Fix | Delete
'post_type' => 'page',
[62] Fix | Delete
'post_status' => 'publish',
[63] Fix | Delete
'post_title' => $title,
[64] Fix | Delete
'post_parent' => $parent
[65] Fix | Delete
] );
[66] Fix | Delete
if ( is_wp_error( $new_page ) ) {
[67] Fix | Delete
wp_send_json_error( $new_page );
[68] Fix | Delete
}
[69] Fix | Delete
if ( isset( $_POST['slug'] ) ) {
[70] Fix | Delete
$get_posts = new WP_Query();
[71] Fix | Delete
$template= $get_posts->query( [
[72] Fix | Delete
'post_type' => Themify_Builder_Layouts::LAYOUT_SLUG,
[73] Fix | Delete
'posts_per_page' => 1,
[74] Fix | Delete
'no_found_rows'=>true,
[75] Fix | Delete
'ignore_sticky_posts'=>true,
[76] Fix | Delete
'name' => sanitize_text_field( $_POST['slug'] ),
[77] Fix | Delete
'orderby'=>'none',
[78] Fix | Delete
'cache_results'=>false,
[79] Fix | Delete
'update_post_meta_cache'=>false,
[80] Fix | Delete
'update_post_term_cache'=>false
[81] Fix | Delete
] );
[82] Fix | Delete
if ( isset( $template[0]->ID ) ) {
[83] Fix | Delete
$builder_data =ThemifyBuilder_Data_Manager::get_data( $template[0]->ID ); // get builder data from original post
[84] Fix | Delete
Themify_Builder_Model::removeElementIds( $builder_data );
[85] Fix | Delete
ThemifyBuilder_Data_Manager::save_data( $builder_data, $new_page );
[86] Fix | Delete
}
[87] Fix | Delete
} elseif ( ! empty( $layout ) ) {
[88] Fix | Delete
ThemifyBuilder_Data_Manager::save_data( $layout['builder_data'], $new_page );
[89] Fix | Delete
if(!empty($layout['used_gs'])){
[90] Fix | Delete
Themify_Global_Styles::builder_import($layout['used_gs'],true);
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
if ( themify_is_themify_theme() ) {
[94] Fix | Delete
update_post_meta( $new_page, 'page_layout', 'full_width' );
[95] Fix | Delete
update_post_meta( $new_page, 'hide_page_title', 'yes' );
[96] Fix | Delete
}
[97] Fix | Delete
wp_send_json_success( themify_https_esc( get_permalink( $new_page ) ) . '#builder_active' );
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
/**
[101] Fix | Delete
* Adds necessary script & style for loading the modal box
[102] Fix | Delete
*
[103] Fix | Delete
* @return void
[104] Fix | Delete
*/
[105] Fix | Delete
static function loader_script() {
[106] Fix | Delete
if(!Themify_Builder_Model::is_front_builder_activate()){
[107] Fix | Delete
$data = [
[108] Fix | Delete
'nonce' => wp_create_nonce( 'tf_nonce' ),
[109] Fix | Delete
'layouts' => Themify_Builder_Model::get_layouts(),
[110] Fix | Delete
'add_layout_link' => admin_url( 'post-new.php?post_type='.Themify_Builder_Layouts::LAYOUT_SLUG ),
[111] Fix | Delete
'manage_layout_link' => admin_url( 'edit.php?post_type='.Themify_Builder_Layouts::LAYOUT_SLUG ),
[112] Fix | Delete
'i18n'=>array(
[113] Fix | Delete
'layout_error' => __( 'There was an error in loading layout, please try again later, or you can download this file: ({FILE}) and then import manually (https://themify.me/docs/builder#import-export).', 'themify' ),
[114] Fix | Delete
'preview'=>__( 'Preview', 'themify' ),
[115] Fix | Delete
'cancel'=>__( 'Cancel', 'themify' ),
[116] Fix | Delete
'title'=> __( 'Add title', 'themify' ),
[117] Fix | Delete
'all'=>__( 'All', 'themify' ),
[118] Fix | Delete
'publish'=> __( 'Publish', 'themify' ),
[119] Fix | Delete
'search'=> __( 'Search', 'themify' ),
[120] Fix | Delete
'blank'=> __( 'Blank', 'themify' ),
[121] Fix | Delete
'predesigned' => __( 'Pre-designed', 'themify' ),
[122] Fix | Delete
'saved' => __( 'Saved', 'themify' ),
[123] Fix | Delete
'add_layout' => __( 'Add New', 'themify' ),
[124] Fix | Delete
'manage_layout' => __( 'Manage Layouts', 'themify' ),
[125] Fix | Delete
)
[126] Fix | Delete
];
[127] Fix | Delete
[128] Fix | Delete
themify_enque_script( 'themify-builder-page-loader', THEMIFY_BUILDER_URI . '/js/editor/themify-builder-page-loader.js');
[129] Fix | Delete
wp_localize_script( 'themify-builder-page-loader', 'tbBuilderPage', $data );
[130] Fix | Delete
}
[131] Fix | Delete
}
[132] Fix | Delete
}
[133] Fix | Delete
Themify_Builder_Builder_Page::init();
[134] Fix | Delete
[135] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function