/** * Insert the theme structure, CSS and success_message to the Database * * @param $theme_type * * @return bool|WP_Error */ public function insert_theme_to_db($theme_type) { $title = $this->theme_name; $structure = $this->theme_structure; $css = $this->theme_css; $date = date('Y-m-d'); $success_message = isset($this->theme_success_message) ? $this->theme_success_message : null; // melange success messages $reg_success = $this->melange_reg_success; $reset_success = $this->melange_reset_success; $edit_profile_success = $this->melange_edit_profile_success; $handler_structure = $this->password_reset_handler_structure; switch ($theme_type) { case 'login': $insert = PROFILEPRESS_sql::sql_insert_login_builder($title, $structure, $css, $date); break; case 'registration': $insert = PROFILEPRESS_sql::sql_insert_registration_builder($title, $structure, $css, $success_message, $date); break; case 'password-reset': $handler_structure = $this->password_reset_handler_structure; if (empty($handler_structure)) { $handler_structure = <<<FORM <div class="pp-reset-password-form"> \t<h3>Enter your new password below.</h3> \t<label for="password1">New password<span class="req">*</span></label> \t[enter-password id="password1" required autocomplete="off"] \t<label for="password2">Re-enter new password<span class="req">*</span></label> \t[re-enter-password id="password2" required autocomplete="off"] \t[password-reset-submit class="pp-reset-button pp-reset-button-block" value="Save"] </div> FORM; } $insert = PROFILEPRESS_sql::sql_insert_password_reset_builder($title, $structure, $handler_structure, $css, $success_message, $date); break; case 'edit-user-profile': $insert = PROFILEPRESS_sql::sql_insert_edit_profile_builder($title, $structure, $css, $success_message, $date); break; case 'front-end-profile': $insert = PROFILEPRESS_sql::sql_insert_user_profile_builder($title, $structure, $css, $date); break; case 'melange': $insert = PROFILEPRESS_sql::sql_insert_melange_builder($title, $structure, $css, $reg_success, $edit_profile_success, $reset_success, $date); break; } if (isset($insert) && !$insert) { return new WP_Error('install_failed', __('<strong>Error:</strong> Theme installation failed. Please try again.', 'profilepress')); } return true; }