/** * setup site metadata * @param $command */ public function setup_site_meta($command, $args) { #$this->command_log('setup site meta');return; //get current template context $theme_config = $this->get_option('theme_config'); //parse config file for current theme #site meta if ($theme_config->item('site')) { $site = $theme_config->item('site'); HW_NHP_Main_Settings::update_data(array('last_tab' => '1')); //fix current tab //update site info (name & description, phone...) HW__Site::update_site_info($site); //update logo if (!empty($site['logo'])) { //get relative path from current theme directory if (!HW_URL::valid_url($site['logo'])) { $site['logo'] = get_stylesheet_directory_uri() . '/' . $site['logo']; } HW__Site::set_logo($site['logo']); } //set banner if exists if (!empty($site['banner'])) { //get relative path from current theme directory if (!HW_URL::valid_url($site['banner'])) { $site['banner'] = get_stylesheet_directory_uri() . '/' . $site['banner']; } HW__Site::set_banner($site['banner']); } //update user info $user = _hw_global('admin')->load_api('HW_WP_User'); $user->update_user(array('user_email' => $site['email'], 'user_url' => 'http://hoangweb.com', 'description' => $site['footer_text'])); } if ($theme_config->item('configuration')) { } $this->command_log('setup site meta'); }
/** * update site information * @param $info * @param $set_related */ public static function update_site_info($info, $set_related = true) { if (is_string($info)) { $info = array('name' => $info); } //blog name if (isset($info['name'])) { $info['site_name'] = $info['name']; update_option('blogname', $info['name']); } //blogdescription if (isset($info['description'])) { $info['slogan'] = $info['description']; update_option('blogdescription', $info['description']); } //update admin email if (!empty($info['email'])) { $info['email'] = '*****@*****.**'; } update_option('admin_email', $info['email']); //flush permalink update_option('permalink_structure', '/%category%/%postname%.html'); flush_rewrite_rules(); if (!isset($info['wp_head_script'])) { $info['wp_head_script'] = '<script>/*generated by hoangweb engine*/</script>'; } //set relate options & other HW_NHP_Main_Settings::update_data($info); }