当前位置: 首页>>代码示例>>PHP>>正文


PHP refresh函数代码示例

本文整理汇总了PHP中refresh函数的典型用法代码示例。如果您正苦于以下问题:PHP refresh函数的具体用法?PHP refresh怎么用?PHP refresh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了refresh函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 /**
  * Login page and submission
  */
 public function index()
 {
     // Login form
     $this->load->library('form_builder');
     $form = $this->form_builder->create_form('admin/login');
     $form->add_text('username', '', 'Username', 'admin');
     $form->add_password('password', '', 'Password', 'admin');
     $form->add_submit('Sign In', 'primary', TRUE);
     if (!empty($this->input->post()) && $form->validate()) {
         // passed validation
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $this->load->model('admin_user_model', 'users');
         $user = $this->users->login($username, $password);
         if (empty($user)) {
             // login failed
             set_alert('danger', 'Invalid Login');
             refresh();
         } else {
             // login success
             $this->session->set_userdata('admin_user', $user);
             redirect('admin');
         }
     }
     // display form when no POST data, or validation failed
     $this->mViewData['form'] = $form;
     $this->mBodyClass = 'login-page';
     $this->render('login', 'empty');
 }
开发者ID:joelviseu,项目名称:ci_bootstrap_3,代码行数:32,代码来源:Login.php

示例2: _edit

 public function _edit($team_id, $name, $title, $image_id, $icon_id, $description, $game_id)
 {
     $users = $this->db->select('u.user_id', 'u.username', 'tu.user_id IS NOT NULL AS in_team')->from('nf_users u')->join('nf_teams_users tu', 'tu.user_id = u.user_id AND tu.team_id = ' . $team_id)->join('nf_teams_roles r', 'r.role_id  = tu.role_id')->where('u.deleted', FALSE)->order_by('r.order', 'r.role_id', 'u.username')->get();
     $roles = $this->model('roles')->get_roles();
     $form_team = $this->title($this('edit_team'))->subtitle($title)->load->library('form')->add_rules('teams', array('title' => $title, 'game_id' => $game_id, 'games' => $this->model()->get_games_list(), 'image_id' => $image_id, 'icon_id' => $icon_id, 'description' => $description))->add_submit($this('edit'))->add_back('admin/teams.html')->save();
     $form_users = $this->form->add_rules(array('user_id' => array('type' => 'select', 'values' => array_filter(array_map(function ($a) {
         return !$a['in_team'] ? $a['user_id'] : NULL;
     }, $users)), 'rules' => 'required'), 'role_id' => array('type' => 'select', 'values' => array_map(function ($a) {
         return $a['role_id'];
     }, $roles), 'rules' => 'required')))->save();
     if ($form_team->is_valid($post)) {
         $this->model()->edit_team($team_id, $post['title'], $post['game'], $post['image'], $post['icon'], $post['description']);
         //add_alert('success', $this('edit_team_success_message'));
         redirect_back('admin/teams.html');
     } else {
         if ($form_users->is_valid($post)) {
             $this->db->insert('nf_teams_users', array('team_id' => $team_id, 'user_id' => $post['user_id'], 'role_id' => $post['role_id']));
             refresh();
         }
     }
     $this->load->library('table')->add_columns(array(array('content' => function ($data) {
         return NeoFrag::loader()->user->link($data['user_id'], $data['username']);
     }), array('content' => function ($data) {
         return $data['title'];
     }), array('content' => array(function ($data) use($team_id, $name) {
         return button_delete('admin/teams/players/delete/' . $team_id . '/' . $name . '/' . $data['user_id'] . '.html');
     }), 'size' => TRUE)))->pagination(FALSE)->data($this->db->select('tu.user_id', 'u.username', 'r.title')->from('nf_teams_users tu')->join('nf_users u', 'u.user_id = tu.user_id')->join('nf_teams_roles r', 'r.role_id = tu.role_id')->where('tu.team_id', $team_id)->order_by('r.title', 'u.username')->get())->no_data($this('no_players_on_team'));
     return new Row(new Col(new Panel(array('title' => $this('edit_team'), 'icon' => 'fa-gamepad', 'content' => $form_team->display(), 'size' => 'col-md-12 col-lg-7'))), new Col(new Panel(array('title' => $this('players'), 'icon' => 'fa-users', 'content' => $this->table->display(), 'footer' => $this->load->view('users', array('users' => $users, 'roles' => $roles, 'form_id' => $form_users->id)), 'size' => 'col-md-12 col-lg-5'))));
 }
开发者ID:nsystem1,项目名称:neofrag-cms,代码行数:29,代码来源:admin.php

示例3: index

 /**
  * Login page and submission
  */
 public function index()
 {
     $this->load->library('form_builder');
     $form = $this->form_builder->create_form();
     if ($form->validate()) {
         // passed validation
         $identity = $this->input->post('username');
         $password = $this->input->post('password');
         $remember = $this->input->post('remember') == 'on';
         if ($this->ion_auth->login($identity, $password, $remember)) {
             // login succeed
             $messages = $this->ion_auth->messages();
             $this->system_message->set_success($messages);
             redirect('admin');
         } else {
             // login failed
             $errors = $this->ion_auth->errors();
             $this->system_message->set_error($errors);
             refresh();
         }
     }
     // display form when no POST data, or validation failed
     $this->mViewData['body_class'] = 'login-page';
     $this->mViewData['form'] = $form;
     $this->mBodyClass = 'login-page';
     $this->render('login', 'empty');
 }
开发者ID:ppatons,项目名称:ci_bootstrap_3,代码行数:30,代码来源:Login.php

示例4: index

 /**
  * Login page and submission
  */
 public function index()
 {
     $this->load->library('form_builder');
     $form = $this->form_builder->create_form();
     if ($form->validate()) {
         // passed validation
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $this->load->model('admin_user_model', 'users');
         $user = $this->users->login($username, $password);
         if (empty($user)) {
             // login failed
             $this->system_message->set_error('Invalid Login');
             refresh();
         } else {
             // login success
             $this->session->set_userdata('admin_user', $user);
             redirect('admin');
         }
     }
     // display form when no POST data, or validation failed
     $this->mViewData['body_class'] = 'login-page';
     $this->mViewData['form'] = $form;
     $this->mBodyClass = 'login-page';
     $this->render('login', 'empty');
 }
开发者ID:httvncoder,项目名称:ci_bootstrap_3,代码行数:29,代码来源:Login.php

示例5: DB_copy

function DB_copy($table, $fields, $values, $tablefrom, $id, $value, $return_page = '')
{
    global $_DB;
    $_DB->dbCopy($table, $fields, $values, $tablefrom, $id, $value);
    if (!empty($return_page)) {
        print refresh("{$return_page}");
    }
}
开发者ID:BackupTheBerlios,项目名称:sitebe-svn,代码行数:8,代码来源:lib-db.php

示例6: index

 public function index($theme)
 {
     $this->css('admin')->js('admin');
     $form_header = $this->load->library('form')->add_rules(array('header' => array('label' => 'Image de fond', 'value' => $this->config->{'dungeon_header'}, 'type' => 'file', 'upload' => 'themes/dungeon/headers', 'info' => ' d\'image (max. ' . file_upload_max_size() / 1024 / 1024 . ' Mo)', 'check' => function ($filename, $ext) {
         if (!in_array($ext, array('gif', 'jpeg', 'jpg', 'png'))) {
             return 'Veuiller choisir un fichier d\'image';
         }
     }, 'description' => 'Laisser vide pour utiliser l\'image par défaut du thème.'), 'repeat' => array('label' => 'Répéter l\'image', 'value' => $this->config->dungeon_header_repeat, 'values' => array('no-repeat' => 'Non', 'repeat-x' => 'Horizontalement', 'repeat-y' => 'Verticalement', 'repeat' => 'Les deux'), 'type' => 'radio', 'rules' => 'required'), 'positionX' => array('label' => 'Position', 'value' => explode(' ', $this->config->dungeon_header_position)[0], 'values' => array('left' => 'Gauche', 'center' => 'Centré', 'right' => 'Droite'), 'type' => 'radio', 'rules' => 'required'), 'positionY' => array('value' => explode(' ', $this->config->dungeon_header_position)[1], 'values' => array('top' => 'Haut', 'center' => 'Milieu', 'bottom' => 'Bas'), 'type' => 'radio', 'rules' => 'required'), 'fixed' => array('checked' => array('on' => $this->config->dungeon_header_attachment == 'fixed'), 'values' => array('on' => 'Image fixe'), 'type' => 'checkbox'), 'color' => array('label' => 'Couleur de fond', 'value' => $this->config->dungeon_header_color, 'type' => 'colorpicker', 'rules' => 'required'), 'logo' => array('label' => 'Logo du site', 'value' => $this->config->dungeon_logo, 'type' => 'file', 'upload' => 'themes/dungeon/logos', 'info' => ' d\'image (max. ' . file_upload_max_size() / 1024 / 1024 . ' Mo)', 'check' => function ($filename, $ext) {
         if (!in_array($ext, array('gif', 'jpeg', 'jpg', 'png'))) {
             return 'Veuiller choisir un fichier d\'image';
         }
     }, 'description' => 'Le logo sera affiché dans le widget type "header", en remplacement du titre et slogan.')))->add_submit('Enregistrer')->save();
     $form_background = $this->form->add_rules(array('background' => array('label' => 'Image de fond', 'value' => $this->config->dungeon_background, 'type' => 'file', 'upload' => 'themes/dungeon/backgrounds', 'info' => ' d\'image (max. ' . file_upload_max_size() / 1024 / 1024 . ' Mo)', 'check' => function ($filename, $ext) {
         if (!in_array($ext, array('gif', 'jpeg', 'jpg', 'png'))) {
             return 'Veuiller choisir un fichier d\'image';
         }
     }, 'description' => 'Laisser vide pour utiliser l\'image par défaut du thème.'), 'repeat' => array('label' => 'Répéter l\'image', 'value' => $this->config->dungeon_background_repeat, 'values' => array('no-repeat' => 'Non', 'repeat-x' => 'Horizontalement', 'repeat-y' => 'Verticalement', 'repeat' => 'Les deux'), 'type' => 'radio', 'rules' => 'required'), 'positionX' => array('label' => 'Position', 'value' => explode(' ', $this->config->dungeon_background_position)[0], 'values' => array('left' => 'Gauche', 'center' => 'Centré', 'right' => 'Droite'), 'type' => 'radio', 'rules' => 'required'), 'positionY' => array('value' => explode(' ', $this->config->dungeon_background_position)[1], 'values' => array('top' => 'Haut', 'center' => 'Milieu', 'bottom' => 'Bas'), 'type' => 'radio', 'rules' => 'required'), 'fixed' => array('checked' => array('on' => $this->config->dungeon_background_attachment == 'fixed'), 'values' => array('on' => 'Image fixe'), 'type' => 'checkbox'), 'color' => array('label' => 'Couleur de fond', 'value' => $this->config->dungeon_background_color, 'type' => 'colorpicker', 'rules' => 'required')))->add_submit('Enregistrer')->save();
     $form_settings = $this->form->add_rules(array('theme_color' => array('label' => 'Couleur du thème', 'value' => $this->config->dungeon_theme_color, 'type' => 'colorpicker', 'description' => 'Couleur générale du thème', 'rules' => 'required'), 'font_color' => array('label' => 'Couleur du texte', 'value' => $this->config->dungeon_font_color, 'type' => 'colorpicker', 'description' => 'Couleur appliquée au texte principal du thème', 'rules' => 'required'), 'font_size' => array('label' => 'Taille du texte', 'value' => $this->config->dungeon_font_size, 'values' => array('10px' => '10 px', '11px' => '11 px', '12px' => '12 px', '13px' => '13 px', '14px' => '14 px', '15px' => '15 px', '16px' => '16 px'), 'type' => 'select', 'rules' => 'required'), 'navbar' => array('checked' => array('on' => $this->config->dungeon_navbar_display), 'values' => array('on' => 'Rendre toujours visible la barre du haut'), 'type' => 'checkbox')))->add_submit('Enregistrer')->save();
     $form_socials = $this->form->add_rules(array('facebook' => array('label' => 'Facebook', 'icon' => 'fa-facebook', 'value' => $this->config->dungeon_social_facebook, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'twitter' => array('label' => 'Twitter', 'icon' => 'fa-twitter', 'value' => $this->config->dungeon_social_twitter, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'google' => array('label' => 'Google+', 'icon' => 'fa-google-plus', 'value' => $this->config->dungeon_social_google, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'steam' => array('label' => 'Page Steam', 'icon' => 'fa-steam', 'value' => $this->config->dungeon_social_steam, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'twitch' => array('label' => 'Twitch', 'icon' => 'fa-twitch', 'value' => $this->config->dungeon_social_twitch, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'dribble' => array('label' => 'Dribbble', 'icon' => 'fa-dribbble', 'value' => $this->config->dungeon_social_dribble, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'behance' => array('label' => 'Behance', 'icon' => 'fa-behance', 'value' => $this->config->dungeon_social_behance, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'deviantart' => array('label' => 'DeviantArt', 'icon' => 'fa-deviantart', 'value' => $this->config->dungeon_social_deviantart, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'flickr' => array('label' => 'Flickr', 'icon' => 'fa-flickr', 'value' => $this->config->dungeon_social_flickr, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'github' => array('label' => 'Github', 'icon' => 'fa-github', 'value' => $this->config->dungeon_social_github, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'instagram' => array('label' => 'Instagram', 'icon' => 'fa-instagram', 'value' => $this->config->dungeon_social_instagram, 'type' => 'text', 'description' => 'Indiquez l\'url complet'), 'youtube' => array('label' => 'Youtube', 'icon' => 'fa-youtube', 'value' => $this->config->dungeon_social_youtube, 'type' => 'text', 'description' => 'Indiquez l\'url complet')))->add_submit('Enregistrer')->save();
     if ($form_header->is_valid($post)) {
         if ($post['header']) {
             $this->config('dungeon_header', $post['header'], 'int');
         } else {
             $this->db->where('name', 'dungeon_header')->delete('nf_settings');
         }
         if ($post['logo']) {
             $this->config('dungeon_logo', $post['logo'], 'int');
         } else {
             $this->db->where('name', 'dungeon_logo')->delete('nf_settings');
         }
         $this->config('dungeon_header_repeat', $post['repeat'])->config('dungeon_header_attachment', in_array('on', $post['fixed']) ? 'fixed' : 'scroll')->config('dungeon_header_position', $post['positionX'] . ' ' . $post['positionY'])->config('dungeon_header_color', $post['color'])->config('dungeon_logo', $post['logo'], 'int');
         refresh();
     } else {
         if ($form_background->is_valid($post)) {
             if ($post['background']) {
                 $this->config('dungeon_background', $post['background'], 'int');
             } else {
                 $this->db->where('name', 'dungeon_background')->delete('nf_settings');
             }
             $this->config('dungeon_background_repeat', $post['repeat'])->config('dungeon_background_attachment', in_array('on', $post['fixed']) ? 'fixed' : 'scroll')->config('dungeon_background_position', $post['positionX'] . ' ' . $post['positionY'])->config('dungeon_background_color', $post['color']);
             refresh();
         } else {
             if ($form_settings->is_valid($post)) {
                 $this->config('dungeon_theme_color', $post['theme_color'])->config('dungeon_font_color', $post['font_color'])->config('dungeon_font_size', $post['font_size'])->config('dungeon_display', $post['display'])->config('dungeon_navbar_display', in_array('on', $post['navbar']), 'bool');
                 refresh();
             } else {
                 if ($form_socials->is_valid($post)) {
                     $this->config('dungeon_social_facebook', $post['facebook'])->config('dungeon_social_twitter', $post['twitter'])->config('dungeon_social_google', $post['google'])->config('dungeon_social_steam', $post['steam'])->config('dungeon_social_twitch', $post['twitch'])->config('dungeon_social_dribble', $post['dribble'])->config('dungeon_social_behance', $post['behance'])->config('dungeon_social_deviantart', $post['deviantart'])->config('dungeon_social_flickr', $post['flickr'])->config('dungeon_social_github', $post['github'])->config('dungeon_social_instagram', $post['instagram'])->config('dungeon_social_youtube', $post['youtube']);
                     refresh();
                 }
             }
         }
     }
     return new Row(new Col(new Panel(array('content' => $this->load->view('admin/menu', array('theme_name' => $theme->get_name())), 'body' => FALSE)), 'col-md-3'), new Col(new Panel(array('title' => 'Dashboard', 'icon' => 'fa-dashboard', 'content' => $this->load->view('admin/index', array('theme' => $theme, 'form_header' => $form_header->display(), 'form_background' => $form_background->display(), 'form_settings' => $form_settings->display(), 'form_socials' => $form_socials->display())))), 'col-md-9'));
 }
开发者ID:agreements,项目名称:neofrag-theme-dungeon,代码行数:55,代码来源:admin.php

示例7: actionUpdate

 public function actionUpdate($id)
 {
     $this->view->title = __('update content type') . "#" . $id;
     $model = Field::find($id);
     $model->scenario = 'all';
     if ($this->populate($_POST, $model) && $model->validate()) {
         $model->save();
         flash('success', __('update sucessful'));
         refresh();
     }
     echo $this->render('form', array('model' => $model, 'name' => 'content', 'widget' => $this->widget));
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:12,代码来源:SiteController.php

示例8: refresh

function refresh($parent)
{
    $result2 = dbquery("SELECT forum_id FROM " . DB_FORUMS . " WHERE forum_parent='" . $parent . "' ORDER BY forum_order");
    $k = 1;
    $list = "";
    while ($data2 = dbarray($result2)) {
        $result3 = dbquery("UPDATE " . DB_FORUMS . " SET forum_order='" . $k . "' WHERE forum_id='" . $data2['forum_id'] . "'");
        $k++;
        $list .= refresh($data2['forum_id']);
    }
    return $list;
}
开发者ID:MichaelFichtner,项目名称:RadioLaFamilia,代码行数:12,代码来源:forums.php

示例9: actionUpdate

 public function actionUpdate($id)
 {
     $this->view->title = __('update user') . "#" . $id;
     $model = \app\modules\auth\models\User::find($id);
     $model->scenario = 'update';
     if ($this->populate($_POST, $model) && $model->validate()) {
         $model->save();
         flash('success', __('update password sucessful'));
         refresh();
     }
     echo $this->render('form', array('model' => $model, 'name' => 'user_update'));
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:12,代码来源:UserController.php

示例10: actionUpdate

 public function actionUpdate($id)
 {
     $this->view->title = __('update config') . "#" . $id;
     $model = Config::find($id);
     $model->scenario = 'all';
     if ($this->populate($_POST, $model) && $model->validate()) {
         $model->save();
         flash('success', __('update config sucessful'));
         refresh();
     }
     echo $this->render('form', array('model' => $model, 'name' => 'user_update'));
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:12,代码来源:ConfigController.php

示例11: actionUpdate

 public function actionUpdate($id)
 {
     $this->view->title = __('update group');
     $model = \app\modules\auth\models\Group::find($id);
     $model->scenario = 'update';
     if ($this->populate($_POST, $model) && $model->validate()) {
         $model->save();
         flash('success', __('update group sucessful'));
         refresh();
     }
     echo $this->render('form', array('model' => $model, 'name' => 'group_create'));
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:12,代码来源:GroupController.php

示例12: addLine

/**
 * Post a message and get changes since last request
 *
 * @param string $msg Message to post
 *
 * @return array|false
 */
function addLine(string $msg)
{
    global $filename;
    $file = fopen($filename, 'a');
    $date = date('Y-m-d h:i:s');
    $msg = strip_tags(stripslashes($msg));
    $remote = $_SERVER['REMOTE_ADDR'];
    // generate unique-ish color for IP
    $color = colorifyIp($remote);
    fwrite($file, '<span style="color:#' . $color . '">' . $date . '</span> ' . htmlspecialchars($msg) . '<br />' . "\r\n");
    fclose($file);
    return refresh(0);
}
开发者ID:AJenbo,项目名称:Sajax,代码行数:20,代码来源:example_wall.php

示例13: index

 public function index($theme)
 {
     $this->css('admin')->js('admin')->load->library('form')->add_rules(array('background' => array('label' => $this('background'), 'value' => $this->config->{'default_background'}, 'type' => 'file', 'upload' => 'themes/default/backgrounds', 'info' => i18n('file_picture', file_upload_max_size() / 1024 / 1024), 'check' => function ($filename, $ext) {
         if (!in_array($ext, array('gif', 'jpeg', 'jpg', 'png'))) {
             return i18n('select_image_file');
         }
     }), 'repeat' => array('label' => $this('background_repeat'), 'value' => $this->config->{'default_background_repeat'}, 'values' => array('no-repeat' => $this('no'), 'repeat-x' => $this('horizontally'), 'repeat-y' => $this('vertically'), 'repeat' => $this('both')), 'type' => 'radio', 'rules' => 'required'), 'positionX' => array('label' => $this('position'), 'value' => explode(' ', $this->config->{'default_background_position'})[0], 'values' => array('left' => $this('left'), 'center' => $this('center'), 'right' => $this('right')), 'type' => 'radio', 'rules' => 'required'), 'positionY' => array('value' => explode(' ', $this->config->{'default_background_position'})[1], 'values' => array('top' => $this('top'), 'center' => $this('middle'), 'bottom' => $this('bottom')), 'type' => 'radio', 'rules' => 'required'), 'fixed' => array('value' => $this->config->{'default_background_attachment'}, 'values' => array('on' => $this('background_fixed')), 'type' => 'checkbox'), 'color' => array('label' => $this('background_color'), 'value' => $this->config->{'default_background_color'}, 'type' => 'colorpicker', 'rules' => 'required')))->add_submit($this('save'));
     if ($this->form->is_valid($post)) {
         if ($post['background']) {
             $this->config('default_background', $post['background'], 'int');
         } else {
             $this->db->where('name', 'default_background')->delete('nf_settings');
         }
         $this->config('default_background_repeat', $post['repeat'])->config('default_background_attachment', in_array('on', $post['fixed']) ? 'fixed' : 'scroll')->config('default_background_position', $post['positionX'] . ' ' . $post['positionY'])->config('default_background_color', $post['color']);
         refresh();
     }
     return new Row(new Col(new Panel(array('content' => $this->load->view('admin/menu', array('theme_name' => $theme->name)), 'body' => FALSE)), 'col-md-4 col-lg-3'), new Col(new Panel(array('title' => $this('dashboard'), 'icon' => 'fa-cog', 'content' => $this->load->view('admin/index', array('theme' => $theme, 'form_background' => $this->form->display())))), 'col-md-8 col-lg-9'));
 }
开发者ID:agreements,项目名称:neofrag-cms,代码行数:18,代码来源:admin.php

示例14: init

 public function init($model, $order_field = 'pos')
 {
     $this->CI->load->model($model, 'm');
     $ids = $this->CI->input->post($this->mPostName);
     // save to database
     if (!empty($ids)) {
         for ($i = 0; $i < count($ids); $i++) {
             $updated = $this->CI->m->update($ids[$i], array($order_field => $i + 1));
         }
         // refresh page (interrupt other logic)
         $this->CI->system_message->set_success('Successfully updated sort order.');
         refresh();
     }
     // return all records in sorted order
     $this->CI->db->order_by($order_field, 'ASC');
     $items = $this->CI->m->get_all();
     $this->mItems = $items;
     return $this;
 }
开发者ID:ppatons,项目名称:ci_bootstrap_3,代码行数:19,代码来源:Sortable.php

示例15: terminologyParser

function terminologyParser(&$parser, &$text)
{
    global $wgRequest, $wgTemplateName, $wgTermField, $wgDefinitionField;
    $templatename = $wgTemplateName ? $wgTemplateName : "Lexicon";
    $termfield = $wgTermField ? $wgTermField : "term";
    $definitionfield = $wgDefinitionField ? $wgDefinitionField : "definition";
    $action = $wgRequest->getVal('action', 'view');
    if ($action == "edit" || $action == "ajax" || isset($_POST['wpPreview'])) {
        return false;
    }
    $cache_state = get_cache_state();
    $dbr = wfGetDB(DB_SLAVE);
    if ($cache_state == 'reload') {
        full_refresh();
    }
    $res = $dbr->select(array('Lexicon_cache'), array('id', 'term', 'def', 'url', 'dirty'), array(), __METHOD__);
    #array('ORDER BY' => 'LENGTH(TRIM(term))');
    $changed = false;
    $doc = new DOMDocument();
    @$doc->loadHTML('<meta http-equiv="content-type" content="charset=utf-8"/>' . $text);
    while ($row = $dbr->fetchObject($res)) {
        if ($row->id == '0') {
            continue;
        }
        if ($row->dirty) {
            if (!refresh(&$row)) {
                continue;
            }
        }
        $term = $row->term;
        $definition = $row->def;
        $url = $row->url;
        if (terminologyParseThisNode($doc, $doc->documentElement, $term, $definition, $url)) {
            $changed = true;
        }
    }
    if ($changed) {
        $text = $doc->saveHTML();
    }
    return true;
}
开发者ID:mediawiki-extensions,项目名称:mediawikilexicon,代码行数:41,代码来源:Lexicon.php


注:本文中的refresh函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。