Coming Soon !
This website is almost setup. Just a theme has to be chosen from your
'.BRAND_SM.' Admin Panel. You can login with your Email or from your control panel.
';
die();
}
// First step
function sitepad_setup_start($theme_slug){
sitepad_pre_switch_theme($theme_slug);
delete_option('_site_transient_timeout_theme_roots');
delete_option('_site_transient_theme_roots');
delete_option('template_root');
delete_option('stylesheet_root');
delete_option('current_theme');
delete_option('theme_switched');
update_option('sp_setup_selected_theme', $theme_slug);
}
// Final step
function sitepad_setup_final(){
global $sitepad_ai_setup, $sitepad, $softaculous_pro;
if(!empty($softaculous_pro['license']['type']) && empty($sitepad['old_onboarding'])){
$sitepad_ai_setup = true;
// Active required pluigns
sitepad_spro_activate_plugin();
}
$chosen_theme = get_option('sp_setup_selected_theme');
switch_theme($chosen_theme);
}
// Active softaculous required pluigns
function sitepad_spro_activate_plugin(){
if(!function_exists('softaculous_pro_get_option_setup_info')){
include_once(SITEPAD_DIR . '/onboarding.php');
}
// onboarding
$results = array();
$options = softaculous_pro_get_option_setup_info();
$sel_features = $options['features'];
// Dynamic progress calculation for each plugin
$min_progress = 55;
$max_progress = 70;
$current_progress = $min_progress;
if(empty($sel_features)){
$data['download'] = 1;
return $data;
}
$feature_list = spro_get_features_list();
// Count total plugins to be installed
$total_plugins = 0;
foreach ($feature_list as $slug => $features) {
if (in_array($slug, $sel_features)) {
$total_plugins += count($features['plugin']);
}
}
// Avoid division by zero
$progress_step = ($total_plugins > 0) ? floor(($max_progress - $min_progress) / $total_plugins) : 0;
foreach($feature_list as $slug => $features){
if (in_array($slug, $sel_features)) {
foreach($features['plugin'] as $plugin_slug => $plugin_data){
softaculous_pro_set_progress(_('Enabling Feature').' : '.$features['name'], $current_progress, ['success' => true]);
$res = spro_install_required_plugin($plugin_slug, $plugin_data);
$results[] = array(
'plugin_slug' => $plugin_slug,
'status' => $res,
);
$current_progress += $progress_step;
if ($current_progress > $max_progress) {
$current_progress = $max_progress;
}
sleep(1);
}
}
}
foreach ($results as $item) {
if (isset($item['status']['error'])) {
$data['failed_plugin'][$item['plugin_slug']] = $item['status']['error'];
}
}
$data['download'] = 1;
softaculous_pro_set_progress(__('All features have been installed successfully.'), $max_progress, ['success' => true]);
return $data;
}
// Upload Dir
add_filter('upload_dir', 'sitepad_upload_dir', 10, 1);
function sitepad_upload_dir($uploads){
global $sitepad;
//print_r($uploads);
// Handle upload fixes
$uploads['basedir'] = $sitepad['upload_path'];
$uploads['baseurl'] = rtrim($sitepad['upload_url'], '/');
$uploads['url'] = trailingslashit($uploads['baseurl']).trim($uploads['subdir'], '/');
$uploads['path'] = trailingslashit($uploads['basedir']).trim($uploads['subdir'], '/');
//print_r($uploads);die();
return $uploads;
}
add_action('admin_head', 'sitepad_admin_head');
add_action('wp_head', 'sitepad_admin_head');
function sitepad_admin_head(){
?>
'.BRAND_SM.'';
return $text;
}
// Footer
add_filter('admin_footer_text', 'sitepad_admin_footer');
function sitepad_admin_footer($text) {
return '';
}
// Remove Help Tab
add_filter('contextual_help', 'sitepad_remove_help_tabs', 10001, 3);
function sitepad_remove_help_tabs($old_help, $screen_id, $screen){
$screen->remove_help_tabs();
return $old_help;
}
// Disable Emojis
add_action( 'admin_print_styles', 'sitepad_admin_print_styles' );
function sitepad_admin_print_styles() {
global $menu, $submenu;
foreach($menu as $k => $v){
if(in_array($v[2], ['pagelayer'])){
unset($menu[$k]);
}
}
//unset();
}
// Disable Emojis
add_action( 'init', 'disable_wp_emojicons' );
function disable_wp_emojicons() {
// All actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
// Filter to remove TinyMCE emojis
//add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
}
// Months Drop Down in Posts List
add_filter('disable_months_dropdown', 'sitepad_disable_dropdown_months');
function sitepad_disable_dropdown_months(){
return true;
}
// Disable the screen options
add_filter('screen_options_show_screen', 'sitepad_disable_screen_options');
function sitepad_disable_screen_options(){
return false;
}
add_filter('page_row_actions', 'sitepad_edit_link', 1000, 2);
add_filter('post_row_actions', 'sitepad_edit_link', 1000, 2);
// Remove actions not required in Posts Lists
function sitepad_edit_link($actions, $post){
unset($actions['inline hide-if-no-js']);
unset($actions['pagelayer']);
return $actions;
}
// Handle edit link of the post type
add_filter('get_edit_post_link', 'sitepad_edit_post_link', 10, 3);
function sitepad_edit_post_link($link, $postID, $context){
$post = get_post($postID);
if(!pagelayer_supported_type($post->post_type)){
return $link;
}
return pagelayer_livelink($postID);
}
// Remove dashboard widgets
add_action( 'admin_init', 'remove_dashboard_meta' );
function remove_dashboard_meta() {
remove_action( 'welcome_panel', 'wp_welcome_panel' );
}
// Always show all columns, because we remove the default cols otherwise
add_filter('hidden_columns', 'sitepad_hidden_columns', 10001, 3);
function sitepad_hidden_columns($hidden, $screen, $use_defaults){
//r_print($use_defaults);
return array();
}
// Always show all columns advanced options for nav-menus
add_filter('manage_nav-menus_columns', 'sitepad_manage_nav_menus_columns', 10001);
function sitepad_manage_nav_menus_columns($menus){
//r_print($menus);
//return $menus;
return array();
}
// Disable Avatars
add_filter('pre_option_show_avatars', '__return_true', 10001);
// Filter the capabilities
add_filter('map_meta_cap', 'sitepad_map_meta_cap', 10001, 4);
function sitepad_map_meta_cap($caps, $cap, $user_id, $args){
// Actions which are not allowed for SitePad used in current_user_can() wp-includes/capabilities.php
$disallowed_actions = array('delete_themes', 'install_themes', 'edit_themes', 'update_themes');
if(in_array($cap, $disallowed_actions)){
return array('do_not_allow');
}
return $caps;
}
add_action('wp_mail', 'sitepad_wp_mail', 10, 1);
function sitepad_wp_mail($mail){
$mail['subject'] = str_replace('WordPress', BRAND_SM, $mail['subject']);
$mail['subject'] = str_replace('wordpress', strtolower(BRAND_SM), $mail['subject']);
$mail['message'] = str_replace('WordPress', BRAND_SM, $mail['message']);
$mail['message'] = str_replace('wordpress', strtolower(BRAND_SM), $mail['message']);
return $mail;
}
add_action('wp_mail_from', 'sitepad_wp_mail_from', 10, 1);
function sitepad_wp_mail_from($mail_from){
$brand = preg_replace('/\s/is', '_', BRAND_SM);
$mail_from = str_replace('WordPress', $brand, $mail_from);
$mail_from = str_replace('wordpress', strtolower($brand), $mail_from);
return $mail_from;
}
add_action('wp_mail_from_name', 'sitepad_wp_mail_from_name', 10, 1);
function sitepad_wp_mail_from_name($mail_from_name){
$mail_from_name = str_replace('WordPress', BRAND_SM, $mail_from_name);
$mail_from_name = str_replace('wordpress', strtolower(BRAND_SM), $mail_from_name);
return $mail_from_name;
}
// Link to clone a post
function sitepad_clone_post_link( $id = 0, $context = 'display' ) {
if ( ! $post = get_post( $id ) )
return;
$nonce = wp_create_nonce('pagelayer-options');
if ( 'revision' === $post->post_type )
$action = '';
elseif ( 'display' == $context )
$action = '&action=pagelayer_clone_post&_wpnonce='.$nonce;
else
$action = '&action=pagelayer_clone_post&_wpnonce='.$nonce;
$post_type_object = get_post_type_object( $post->post_type );
if ( !$post_type_object )
return;
if ( !current_user_can( 'edit_post', $post->ID ) )
return;
if ( $post_type_object->_edit_link ) {
$link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
} else {
$link = '';
}
return apply_filters( 'sitepad_clone_post_link', $link, $post->ID, $context );
}
//Remove Pagelayer Promo
add_action( 'admin_notices', 'remove_pagelayer_show_promo', 0 );
function remove_pagelayer_show_promo(){
remove_action( 'admin_notices', 'pagelayer_show_promo' );
}
// The publish button handler
add_action('admin_head' , 'sitepad_head_script', 0);
function sitepad_head_script(){
global $l, $sitepad, $softaculous_pro;
$access_old = empty($softaculous_pro['license']['type']) || !empty($sitepad['old_onboarding']);
?>