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/herald/core/admin
File: demo-importer.php
<?php
[0] Fix | Delete
[1] Fix | Delete
require_once get_parent_theme_file_path( '/inc/merlin/vendor/autoload.php' );
[2] Fix | Delete
require_once get_parent_theme_file_path( '/inc/merlin/class-merlin.php' );
[3] Fix | Delete
[4] Fix | Delete
/**
[5] Fix | Delete
* Merlin WP configuration file.
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
if ( ! class_exists( 'Merlin' ) ) {
[9] Fix | Delete
return;
[10] Fix | Delete
}
[11] Fix | Delete
[12] Fix | Delete
$strings = array(
[13] Fix | Delete
'admin-menu' => esc_html__( 'Herald Setup Wizard', 'herald' ),
[14] Fix | Delete
'title%s%s%s%s' => esc_html__( '%s%s Themes &lsaquo; Theme Setup: %s%s', 'herald' ),
[15] Fix | Delete
'return-to-dashboard' => esc_html__( 'Return to the dashboard', 'herald' ),
[16] Fix | Delete
'ignore' => esc_html__( 'Disable this wizard', 'herald' ),
[17] Fix | Delete
[18] Fix | Delete
'btn-skip' => esc_html__( 'Skip', 'herald' ),
[19] Fix | Delete
'btn-next' => esc_html__( 'Next', 'herald' ),
[20] Fix | Delete
'btn-start' => esc_html__( 'Start', 'herald' ),
[21] Fix | Delete
'btn-no' => esc_html__( 'Cancel', 'herald' ),
[22] Fix | Delete
'btn-plugins-install' => esc_html__( 'Install', 'herald' ),
[23] Fix | Delete
[24] Fix | Delete
'btn-child-install' => esc_html__( 'Install', 'herald' ),
[25] Fix | Delete
'btn-content-install' => esc_html__( 'Install', 'herald' ),
[26] Fix | Delete
'btn-import' => esc_html__( 'Import', 'herald' ),
[27] Fix | Delete
'btn-license-activate' => esc_html__( 'Activate', 'herald' ),
[28] Fix | Delete
'btn-license-skip' => esc_html__( 'Later', 'herald' ),
[29] Fix | Delete
[30] Fix | Delete
'welcome-header%s' => esc_html__( 'Welcome to %s', 'herald' ),
[31] Fix | Delete
'welcome-header-success%s' => esc_html__( 'Hi. Welcome back', 'herald' ),
[32] Fix | Delete
'welcome%s' => esc_html__( 'This wizard will set up your theme, install plugins, and import content. It is optional & should take only a few minutes.', 'herald' ),
[33] Fix | Delete
'welcome-success%s' => esc_html__( 'You may have already run this theme setup wizard. If you would like to proceed anyway, click on the "Start" button below.', 'herald' ),
[34] Fix | Delete
[35] Fix | Delete
'license-header%s' => esc_html__( 'Activate %s', 'herald' ),
[36] Fix | Delete
'license-header-success%s' => esc_html__( '%s is Activated', 'herald' ),
[37] Fix | Delete
'license%s' => esc_html__( 'Enter your license key to enable remote updates and theme support.', 'herald' ),
[38] Fix | Delete
'license-label' => esc_html__( 'License key', 'herald' ),
[39] Fix | Delete
'license-success%s' => esc_html__( 'The theme is already registered, so you can go to the next step!', 'herald' ),
[40] Fix | Delete
'license-json-success%s' => esc_html__( 'Your theme is activated! Remote updates and theme support are enabled.', 'herald' ),
[41] Fix | Delete
'license-tooltip' => esc_html__( 'Need help?', 'herald' ),
[42] Fix | Delete
[43] Fix | Delete
'child-header' => esc_html__( 'Install Child Theme', 'herald' ),
[44] Fix | Delete
'child-header-success' => esc_html__( 'You\'re good to go!', 'herald' ),
[45] Fix | Delete
'child' => esc_html__( 'Let\'s build & activate a child theme so you may easily make theme changes.', 'herald' ),
[46] Fix | Delete
'child-success%s' => esc_html__( 'Your child theme has already been installed and is now activated, if it wasn\'t already.', 'herald' ),
[47] Fix | Delete
'child-action-link' => esc_html__( 'Learn about child themes', 'herald' ),
[48] Fix | Delete
'child-json-success%s' => esc_html__( 'Awesome. Your child theme has already been installed and is now activated.', 'herald' ),
[49] Fix | Delete
'child-json-already%s' => esc_html__( 'Awesome. Your child theme has been created and is now activated.', 'herald' ),
[50] Fix | Delete
[51] Fix | Delete
'plugins-header' => esc_html__( 'Install Plugins', 'herald' ),
[52] Fix | Delete
'plugins-header-success' => esc_html__( 'You\'re up to speed!', 'herald' ),
[53] Fix | Delete
'plugins' => esc_html__( 'Let\'s install some essential WordPress plugins to get your site up to speed.', 'herald' ),
[54] Fix | Delete
'plugins-success%s' => esc_html__( 'The required WordPress plugins are all installed and up to date. Press "Next" to continue the setup wizard.', 'herald' ),
[55] Fix | Delete
'plugins-action-link' => esc_html__( 'Plugins', 'herald' ),
[56] Fix | Delete
[57] Fix | Delete
'import-header' => esc_html__( 'Import Content', 'herald' ),
[58] Fix | Delete
'import' => esc_html__( 'Let\'s import content to your website, to help you get familiar with the theme.', 'herald' ),
[59] Fix | Delete
'import-action-link' => esc_html__( 'Details', 'herald' ),
[60] Fix | Delete
[61] Fix | Delete
'ready-header' => esc_html__( 'All done. Have fun!', 'herald' ),
[62] Fix | Delete
'ready%s' => esc_html__( 'Your theme has been all set up. Enjoy your new theme by %s.', 'herald' ),
[63] Fix | Delete
'ready-action-link' => esc_html__( 'Extras', 'herald' ),
[64] Fix | Delete
'ready-big-button' => esc_html__( 'View your website', 'herald' ),
[65] Fix | Delete
[66] Fix | Delete
'ready-link-3' => '',
[67] Fix | Delete
'ready-link-2' => wp_kses( sprintf( '<a href="%1$s" target="_blank">%2$s</a>', 'https://mekshq.com/documentation/herald/', esc_html__( 'Theme Documentation', 'herald' ) ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ),
[68] Fix | Delete
);
[69] Fix | Delete
[70] Fix | Delete
if(herald_is_redux_active()){
[71] Fix | Delete
$strings['ready-link-1'] = wp_kses( sprintf( '<a href="'.admin_url( 'admin.php?page=herald_options' ).'" target="_blank">%s</a>', esc_html__( 'Start Customizing', 'herald' ) ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) );
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
/**
[75] Fix | Delete
* Set directory locations, text strings, and other settings for Merlin WP.
[76] Fix | Delete
*
[77] Fix | Delete
* @since 1.0
[78] Fix | Delete
*/
[79] Fix | Delete
$herald_wizard = new Merlin(
[80] Fix | Delete
[81] Fix | Delete
// Configure Merlin with custom settings.
[82] Fix | Delete
$config = array(
[83] Fix | Delete
'directory' => 'inc/merlin', // Location / directory where Merlin WP is placed in your theme.
[84] Fix | Delete
'merlin_url' => 'herald-importer', // The wp-admin page slug where Merlin WP loads.
[85] Fix | Delete
'parent_slug' => 'themes.php', // The wp-admin parent page slug for the admin menu item.
[86] Fix | Delete
'capability' => 'manage_options', // The capability required for this menu to be displayed to the user.
[87] Fix | Delete
'child_action_btn_url' => 'https://codex.wordpress.org/child_themes', // URL for the 'child-action-link'.
[88] Fix | Delete
'dev_mode' => false, // Enable development mode for testing.
[89] Fix | Delete
'license_step' => false, // EDD license activation step.
[90] Fix | Delete
'license_required' => false, // Require the license activation step.
[91] Fix | Delete
'license_help_url' => '', // URL for the 'license-tooltip'.
[92] Fix | Delete
'edd_remote_api_url' => '', // EDD_Theme_Updater_Admin remote_api_url.
[93] Fix | Delete
'edd_item_name' => '', // EDD_Theme_Updater_Admin item_name.
[94] Fix | Delete
'edd_theme_slug' => '', // EDD_Theme_Updater_Admin item_slug.
[95] Fix | Delete
'ready_big_button_url' => get_home_url(), // Link for the big button on the ready step.
[96] Fix | Delete
),
[97] Fix | Delete
[98] Fix | Delete
// Text strings.
[99] Fix | Delete
$strings
[100] Fix | Delete
[101] Fix | Delete
);
[102] Fix | Delete
[103] Fix | Delete
[104] Fix | Delete
/**
[105] Fix | Delete
* Prepare files to import
[106] Fix | Delete
*
[107] Fix | Delete
* @since 1.0
[108] Fix | Delete
*/
[109] Fix | Delete
add_filter( 'merlin_import_files', 'herald_demo_import_files' );
[110] Fix | Delete
[111] Fix | Delete
if(!function_exists('herald_demo_import_files')):
[112] Fix | Delete
function herald_demo_import_files() {
[113] Fix | Delete
return array(
[114] Fix | Delete
array(
[115] Fix | Delete
'import_file_name' => 'Herald default',
[116] Fix | Delete
'local_import_file' => get_parent_theme_file_path( '/inc/demos/01_default/content.xml' ),
[117] Fix | Delete
'local_import_widget_file' => get_parent_theme_file_path( '/inc/demos/01_default/widgets.json' ),
[118] Fix | Delete
'local_import_redux' => array(
[119] Fix | Delete
array(
[120] Fix | Delete
'file_path' => get_parent_theme_file_path( '/inc/demos/01_default/options.json' ),
[121] Fix | Delete
'option_name' => 'herald_settings',
[122] Fix | Delete
)
[123] Fix | Delete
),
[124] Fix | Delete
'import_preview_image_url' => get_parent_theme_file_uri( '/screenshot.png' ),
[125] Fix | Delete
'import_notice' => '',
[126] Fix | Delete
'preview_url' => 'https://demo.mekshq.com/herald/',
[127] Fix | Delete
),
[128] Fix | Delete
array(
[129] Fix | Delete
'import_file_name' => 'Herald essence',
[130] Fix | Delete
'local_import_file' => get_parent_theme_file_path( '/inc/demos/02_essence/content.xml' ),
[131] Fix | Delete
'local_import_widget_file' => get_parent_theme_file_path( '/inc/demos/02_essence/widgets.json' ),
[132] Fix | Delete
'local_import_redux' => array(
[133] Fix | Delete
array(
[134] Fix | Delete
'file_path' => get_parent_theme_file_path( '/inc/demos/02_essence/options.json' ),
[135] Fix | Delete
'option_name' => 'herald_settings',
[136] Fix | Delete
)
[137] Fix | Delete
),
[138] Fix | Delete
'import_preview_image_url' => get_parent_theme_file_uri( '/screenshot.png' ),
[139] Fix | Delete
'import_notice' => '',
[140] Fix | Delete
'preview_url' => 'https://demo.mekshq.com/herald/',
[141] Fix | Delete
),
[142] Fix | Delete
array(
[143] Fix | Delete
'import_file_name' => 'Herald fashion',
[144] Fix | Delete
'local_import_file' => get_parent_theme_file_path( '/inc/demos/03_fashion/content.xml' ),
[145] Fix | Delete
'local_import_widget_file' => get_parent_theme_file_path( '/inc/demos/03_fashion/widgets.json' ),
[146] Fix | Delete
'local_import_redux' => array(
[147] Fix | Delete
array(
[148] Fix | Delete
'file_path' => get_parent_theme_file_path( '/inc/demos/03_fashion/options.json' ),
[149] Fix | Delete
'option_name' => 'herald_settings',
[150] Fix | Delete
)
[151] Fix | Delete
),
[152] Fix | Delete
'import_preview_image_url' => get_parent_theme_file_uri( '/screenshot.png' ),
[153] Fix | Delete
'import_notice' => '',
[154] Fix | Delete
'preview_url' => 'https://demo.mekshq.com/herald/',
[155] Fix | Delete
),
[156] Fix | Delete
array(
[157] Fix | Delete
'import_file_name' => 'Herald sports',
[158] Fix | Delete
'local_import_file' => get_parent_theme_file_path( '/inc/demos/04_sports/content.xml' ),
[159] Fix | Delete
'local_import_widget_file' => get_parent_theme_file_path( '/inc/demos/04_sports/widgets.json' ),
[160] Fix | Delete
'local_import_redux' => array(
[161] Fix | Delete
array(
[162] Fix | Delete
'file_path' => get_parent_theme_file_path( '/inc/demos/04_sports/options.json' ),
[163] Fix | Delete
'option_name' => 'herald_settings',
[164] Fix | Delete
)
[165] Fix | Delete
),
[166] Fix | Delete
'import_preview_image_url' => get_parent_theme_file_uri( '/screenshot.png' ),
[167] Fix | Delete
'import_notice' => '',
[168] Fix | Delete
'preview_url' => 'https://demo.mekshq.com/herald/',
[169] Fix | Delete
),
[170] Fix | Delete
array(
[171] Fix | Delete
'import_file_name' => 'Herald tech',
[172] Fix | Delete
'local_import_file' => get_parent_theme_file_path( '/inc/demos/05_tech/content.xml' ),
[173] Fix | Delete
'local_import_widget_file' => get_parent_theme_file_path( '/inc/demos/05_tech/widgets.json' ),
[174] Fix | Delete
'local_import_redux' => array(
[175] Fix | Delete
array(
[176] Fix | Delete
'file_path' => get_parent_theme_file_path( '/inc/demos/05_tech/options.json' ),
[177] Fix | Delete
'option_name' => 'herald_settings',
[178] Fix | Delete
)
[179] Fix | Delete
),
[180] Fix | Delete
'import_preview_image_url' => get_parent_theme_file_uri( '/screenshot.png' ),
[181] Fix | Delete
'import_notice' => '',
[182] Fix | Delete
'preview_url' => 'https://demo.mekshq.com/herald/',
[183] Fix | Delete
),
[184] Fix | Delete
array(
[185] Fix | Delete
'import_file_name' => 'Herald blog',
[186] Fix | Delete
'local_import_file' => get_parent_theme_file_path( '/inc/demos/06_blog/content.xml' ),
[187] Fix | Delete
'local_import_widget_file' => get_parent_theme_file_path( '/inc/demos/06_blog/widgets.json' ),
[188] Fix | Delete
'local_import_redux' => array(
[189] Fix | Delete
array(
[190] Fix | Delete
'file_path' => get_parent_theme_file_path( '/inc/demos/06_blog/options.json' ),
[191] Fix | Delete
'option_name' => 'herald_settings',
[192] Fix | Delete
)
[193] Fix | Delete
),
[194] Fix | Delete
'import_preview_image_url' => get_parent_theme_file_uri( '/screenshot.png' ),
[195] Fix | Delete
'import_notice' => '',
[196] Fix | Delete
'preview_url' => 'https://demo.mekshq.com/herald/',
[197] Fix | Delete
),
[198] Fix | Delete
[199] Fix | Delete
);
[200] Fix | Delete
}
[201] Fix | Delete
endif;
[202] Fix | Delete
[203] Fix | Delete
/**
[204] Fix | Delete
* Execute custom code after the whole import has finished.
[205] Fix | Delete
*
[206] Fix | Delete
* @since 1.0
[207] Fix | Delete
*/
[208] Fix | Delete
add_action( 'merlin_after_all_import', 'herald_merlin_after_import_setup' );
[209] Fix | Delete
[210] Fix | Delete
if( !function_exists('herald_merlin_after_import_setup') ):
[211] Fix | Delete
function herald_merlin_after_import_setup( ) {
[212] Fix | Delete
[213] Fix | Delete
/* Set Menus */
[214] Fix | Delete
[215] Fix | Delete
$menus = array();
[216] Fix | Delete
[217] Fix | Delete
$main_menu = get_term_by( 'name', 'Herald Main', 'nav_menu' );
[218] Fix | Delete
if ( isset( $main_menu->term_id ) ) {
[219] Fix | Delete
$menus['herald_main_menu'] = $main_menu->term_id;
[220] Fix | Delete
}
[221] Fix | Delete
[222] Fix | Delete
$social_menu = get_term_by( 'name', 'Herald Social', 'nav_menu' );
[223] Fix | Delete
if ( isset( $social_menu->term_id ) ) {
[224] Fix | Delete
$menus['herald_social_menu'] = $social_menu->term_id;
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
$secondary_menu = get_term_by( 'name', 'Herald Secondary 1', 'nav_menu' );
[228] Fix | Delete
if ( isset( $secondary_menu->term_id ) ) {
[229] Fix | Delete
$menus['herald_secondary_menu_1'] = $secondary_menu->term_id;
[230] Fix | Delete
}
[231] Fix | Delete
[232] Fix | Delete
if ( !empty( $menus ) ) {
[233] Fix | Delete
set_theme_mod( 'nav_menu_locations', $menus );
[234] Fix | Delete
}
[235] Fix | Delete
[236] Fix | Delete
/* Set Home Page */
[237] Fix | Delete
[238] Fix | Delete
$home_page_title = 'Herald Home';
[239] Fix | Delete
[240] Fix | Delete
$page = get_page_by_title( $home_page_title );
[241] Fix | Delete
[242] Fix | Delete
if ( isset( $page->ID ) ) {
[243] Fix | Delete
update_option( 'page_on_front', $page->ID );
[244] Fix | Delete
update_option( 'show_on_front', 'page' );
[245] Fix | Delete
}
[246] Fix | Delete
[247] Fix | Delete
/* Import contact form */
[248] Fix | Delete
herald_import_contact_form();
[249] Fix | Delete
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
endif;
[253] Fix | Delete
[254] Fix | Delete
/**
[255] Fix | Delete
* Insert WPForms contact form
[256] Fix | Delete
*
[257] Fix | Delete
* @return void
[258] Fix | Delete
* @since 1.3.4
[259] Fix | Delete
*/
[260] Fix | Delete
[261] Fix | Delete
if ( !function_exists( 'herald_import_contact_form' ) ):
[262] Fix | Delete
function herald_import_contact_form( ) {
[263] Fix | Delete
[264] Fix | Delete
if ( !function_exists( 'WP_Filesystem' ) || !WP_Filesystem() ) {
[265] Fix | Delete
return false;
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
global $wp_filesystem;
[269] Fix | Delete
$forms = json_decode( $wp_filesystem->get_contents( get_parent_theme_file_path( '/inc/demos/01_default/wpforms.json' ) ), true );
[270] Fix | Delete
[271] Fix | Delete
if ( ! empty( $forms ) ) {
[272] Fix | Delete
[273] Fix | Delete
foreach ( $forms as $form ) {
[274] Fix | Delete
[275] Fix | Delete
$title = ! empty( $form['settings']['form_title'] ) ? $form['settings']['form_title'] : '';
[276] Fix | Delete
$desc = ! empty( $form['settings']['form_desc'] ) ? $form['settings']['form_desc'] : '';
[277] Fix | Delete
$new_id = wp_insert_post( array(
[278] Fix | Delete
'post_title' => $title,
[279] Fix | Delete
'post_status' => 'publish',
[280] Fix | Delete
'post_type' => 'wpforms',
[281] Fix | Delete
'post_excerpt' => $desc,
[282] Fix | Delete
) );
[283] Fix | Delete
if ( $new_id ) {
[284] Fix | Delete
$form['id'] = $new_id;
[285] Fix | Delete
wp_update_post(
[286] Fix | Delete
array(
[287] Fix | Delete
'ID' => $new_id,
[288] Fix | Delete
'post_content' => wp_slash( wp_json_encode( $form ) ),
[289] Fix | Delete
)
[290] Fix | Delete
);
[291] Fix | Delete
}
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
}
[296] Fix | Delete
endif;
[297] Fix | Delete
[298] Fix | Delete
/**
[299] Fix | Delete
* Unset the default widgets
[300] Fix | Delete
*
[301] Fix | Delete
* @return array
[302] Fix | Delete
* @since 1.0
[303] Fix | Delete
*/
[304] Fix | Delete
[305] Fix | Delete
add_action('merlin_widget_importer_before_widgets_import', 'herald_remove_widgets_before_import');
[306] Fix | Delete
[307] Fix | Delete
if(!function_exists('herald_remove_widgets_before_import')):
[308] Fix | Delete
function herald_remove_widgets_before_import() {
[309] Fix | Delete
delete_option( 'sidebars_widgets' );
[310] Fix | Delete
}
[311] Fix | Delete
endif;
[312] Fix | Delete
[313] Fix | Delete
/**
[314] Fix | Delete
* Unset the child theme generator step in merlin welcome panel
[315] Fix | Delete
*
[316] Fix | Delete
* @param $steps
[317] Fix | Delete
* @return mixed
[318] Fix | Delete
* @since 1.0
[319] Fix | Delete
*/
[320] Fix | Delete
[321] Fix | Delete
add_filter('herald_merlin_steps', 'herald_remove_child_theme_generator_from_merlin');
[322] Fix | Delete
[323] Fix | Delete
if(!function_exists('herald_remove_child_theme_generator_from_merlin')):
[324] Fix | Delete
function herald_remove_child_theme_generator_from_merlin($steps){
[325] Fix | Delete
unset($steps['child']);
[326] Fix | Delete
return $steps;
[327] Fix | Delete
}
[328] Fix | Delete
endif;
[329] Fix | Delete
[330] Fix | Delete
[331] Fix | Delete
/**
[332] Fix | Delete
* Stop initial redirect after theme is activated
[333] Fix | Delete
*
[334] Fix | Delete
* @since 1.0
[335] Fix | Delete
*/
[336] Fix | Delete
[337] Fix | Delete
remove_action( 'after_switch_theme', array( $herald_wizard, 'switch_theme' ) );
[338] Fix | Delete
?>
[339] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function