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


PHP Hook::singleton方法代码示例

本文整理汇总了PHP中Hook::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP Hook::singleton方法的具体用法?PHP Hook::singleton怎么用?PHP Hook::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hook的用法示例。


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

示例1: index

 public function index()
 {
     $this->load->model('crud_auth');
     $this->load->model('admin/admin_menu');
     $this->load->model('user/user_menu');
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $crudAuth = $this->session->userdata('CRUD_AUTH');
     $var = array();
     $conf = array();
     $var['main_menu'] = $this->admin_menu->fetch('account');
     $hook = Hook::singleton();
     $hook->addFunction('SCRUD_EDIT_FORM', 'removeElement');
     $hook->addFunction('SCRUD_EDIT_CONFIRM', 'removeElement');
     $hook->addFunction('SCRUD_BEFORE_VALIDATE', 'removeValidate');
     $hook->addFunction('SCRUD_COMPLETE_UPDATE', 'completeUpdate');
     $hook->addFunction('SCRUD_BEFORE_SAVE', 'removeElementData');
     if (!isset($_GET['xtype'])) {
         $_GET['xtype'] = 'form';
     }
     $_GET['table'] = 'crud_users';
     $_GET['key']['crud_users.id'] = $crudAuth['id'];
     $_SERVER['QUERY_STRING'] = $_SERVER['QUERY_STRING'] . '&key[crud_users.id]=' . $crudAuth['id'];
     if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php')) {
         exit;
     } else {
         require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php';
     }
     $conf['theme_path'] = FCPATH . 'application/views/user/profile/crud';
     $this->load->library('crud', array('table' => $this->input->get('table'), 'conf' => $conf));
     $var['main_content'] = $this->load->view('user/profile/profile', array('content' => $this->crud->process(), 'user_menu' => $this->user_menu->fetch('profile')), true);
     $this->load->model('admin/admin_footer');
     $var['main_footer'] = $this->admin_footer->fetch();
     $this->load->view('layouts/user/default', $var);
 }
开发者ID:Dannyngs,项目名称:chinese_med,代码行数:34,代码来源:editprofile.php

示例2: builder

 public function builder()
 {
     $this->load->model('admin/admin_menu');
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $var = array();
     $_GET['crud_components'] = 'crud_components';
     $var['main_menu'] = $this->admin_menu->fetch('tool');
     $conf = array();
     if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_components.php')) {
         exit;
     } else {
         require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_components.php';
     }
     $hook = Hook::singleton();
     $hook->addFunction('SCRUD_ADD_FORM', 'addTableElement');
     $hook->addFunction('SCRUD_EDIT_FORM', 'addTableElement');
     $hook->addFunction('SCRUD_ADD_CONFIRM', 'addTableElement');
     $hook->addFunction('SCRUD_EDIT_CONFIRM', 'addTableElement');
     $hook->addFunction('SCRUD_VIEW_FORM', 'addTableElement');
     $hook->addFunction('SCRUD_CONFRIM_DELETE_FORM', 'addTableElement');
     $hook->addFunction('SCRUD_BEFORE_UPDATE', 'removeConfig');
     $hook->addFunction('SCRUD_BEFORE_SAVE', 'checkGroup');
     $hook->addFunction('SCRUD_COMPLETE_DELETE', 'completeDelete');
     $conf['theme_path'] = FCPATH . 'application/views/admin/component/templates/builder';
     $this->load->library('crud', array('table' => 'crud_components', 'conf' => $conf));
     $var['main_content'] = $this->load->view('admin/component/builder', array('content' => $this->crud->process()), true);
     $this->load->model('admin/admin_footer');
     $var['main_footer'] = $this->admin_footer->fetch();
     $this->load->view('layouts/admin/scrud/browse', $var);
 }
开发者ID:Dannyngs,项目名称:chinese_med,代码行数:30,代码来源:component.php

示例3: index

 public function index()
 {
     $userData = $this->session->userdata('CRUD_AUTH');
     if ($userData['group']['group_name'] == "Administrators") {
         $this->load->model('admin/admin_menu');
     } else {
         $this->load->model('admin/home_menu');
     }
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $_GET['table'] = 'crud_users';
     $var = array();
     if ($userData['group']['group_name'] == "Administrators") {
         $var['main_menu'] = $this->admin_menu->fetch('user');
     } else {
         $var['main_menu'] = $this->home_menu->fetch('user');
     }
     if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php')) {
         exit;
     }
     $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php'));
     $conf = unserialize($content);
     $hook = Hook::singleton();
     $hook->add_function('SCRUD_ADD_FORM', 'addPasswordConfirmElement');
     $hook->add_function('SCRUD_EDIT_FORM', 'addPasswordConfirmElement');
     $hook->add_function('SCRUD_BEFORE_VALIDATE', 'passwordConfirmValidate');
     $hook->add_function('SCRUD_VALIDATE', 'comparePassAndConfirmPass');
     $hook->add_function('SCRUD_VALIDATE', 'checkUser');
     $hook->add_function('SCRUD_BEFORE_SAVE', 'encryptPassword');
     $conf['theme_path'] = FCPATH . 'application/views/admin/user/templates';
     $this->load->library('crud', array('table' => 'crud_users', 'conf' => $conf));
     $var['main_content'] = $this->load->view('admin/user/user', array('content' => $this->crud->process()), true);
     $this->load->view('layouts/admin/user/default', $var);
 }
开发者ID:kvirella,项目名称:magrocket-backend,代码行数:33,代码来源:user.php

示例4: index

 public function index()
 {
     $this->load->model('admin/admin_menu');
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $_GET['table'] = 'crud_languages';
     $var = array();
     $conf = array();
     $var['main_menu'] = $this->admin_menu->fetch('tool');
     if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $_GET['table'] . '.php')) {
         exit;
     } else {
         require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $_GET['table'] . '.php';
     }
     $hook = Hook::singleton();
     $hook->addFunction('SCRUD_EDIT_FORM', 'edit_form');
     $hook->addFunction('SCRUD_VALIDATE', 'validate_language_code');
     $hook->addFunction('SCRUD_BEFORE_UPDATE', 'before_update');
     $hook->addFunction('SCRUD_COMPLETE_SAVE', 'complete_save');
     $hook->addFunction('SCRUD_COMPLETE_DELETE', 'complete_delete');
     $conf['theme_path'] = FCPATH . 'application/views/admin/language/templates';
     $this->load->library('crud', array('table' => $_GET['table'], 'conf' => $conf));
     $var['main_content'] = $this->load->view('admin/language/index', array('content' => $this->crud->process()), true);
     $this->load->model('admin/admin_footer');
     $var['main_footer'] = $this->admin_footer->fetch();
     $this->load->view('layouts/admin/user/default', $var);
 }
开发者ID:Dannyngs,项目名称:chinese_med,代码行数:26,代码来源:language.php

示例5: index

 public function index()
 {
     $this->load->model('admin/admin_menu');
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $_GET['table'] = 'crud_users';
     $var = array();
     $conf = array();
     $var['main_menu'] = $this->admin_menu->fetch('user');
     if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php')) {
         exit;
     } else {
         require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/crud_users.php';
     }
     $hook = Hook::singleton();
     $hook->addFunction('SCRUD_ADD_FORM', 'addPasswordConfirmElement');
     $hook->addFunction('SCRUD_EDIT_FORM', 'addPasswordConfirmElement');
     $hook->addFunction('SCRUD_BEFORE_VALIDATE', 'passwordConfirmValidate');
     $hook->addFunction('SCRUD_VALIDATE', 'comparePassAndConfirmPass');
     $hook->addFunction('SCRUD_VALIDATE', 'checkUser');
     $hook->addFunction('SCRUD_BEFORE_SAVE', 'encryptPassword');
     $conf['theme_path'] = FCPATH . 'application/views/admin/user/templates';
     $this->load->library('crud', array('table' => 'crud_users', 'conf' => $conf));
     $var['main_content'] = $this->load->view('admin/user/user', array('content' => $this->crud->process()), true);
     $this->load->model('admin/admin_footer');
     $var['main_footer'] = $this->admin_footer->fetch();
     $this->load->view('layouts/admin/user/default', $var);
 }
开发者ID:Dannyngs,项目名称:chinese_med,代码行数:27,代码来源:user.php

示例6: browse

 public function browse()
 {
     $userData = $this->session->userdata('CRUD_AUTH');
     if ($userData['group']['group_name'] == "Administrators") {
         $this->load->model('admin/admin_menu');
     } else {
         $this->load->model('admin/home_menu');
     }
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $var = array();
     if ($userData['group']['group_name'] == "Administrators") {
         $var['main_menu'] = $this->admin_menu->fetch('browse');
     } else {
         $var['main_menu'] = $this->home_menu->fetch('browse');
     }
     if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php')) {
         exit;
     }
     $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $this->input->get('table') . '.php'));
     $conf = unserialize($content);
     $hook = Hook::singleton();
     $hook->add_function('SCRUD_INIT', 'f_scrud_init');
     $this->load->library('crud', array('table' => $this->input->get('table'), 'conf' => $conf));
     $var['main_content'] = $this->load->view('admin/scrud/browse', array('content' => $this->crud->process(), 'conf' => $conf), true);
     $this->load->view('layouts/admin/scrud/browse', $var);
 }
开发者ID:kvirella,项目名称:magrocket-backend,代码行数:26,代码来源:scrud.php

示例7: __construct

 public function __construct()
 {
     parent::__construct();
     $this->authenticate();
     $hook = Hook::singleton();
     $hook->set('SCRUD_INIT');
     $hook->set('SCRUD_BEFORE_VALIDATE');
     $hook->set('SCRUD_VALIDATE');
     $hook->set('SCRUD_ADD_FORM');
     $hook->set('SCRUD_EDIT_FORM');
     $hook->set('SCRUD_ADD_CONFIRM');
     $hook->set('SCRUD_EDIT_CONFIRM');
     $hook->set('SCRUD_BEFORE_SAVE');
     $hook->set('SCRUD_BEFORE_INSERT');
     $hook->set('SCRUD_BEFORE_UPDATE');
     $hook->set('SCRUD_COMPLETE_INSERT');
     $hook->set('SCRUD_COMPLETE_UPDATE');
     $hook->set('SCRUD_COMPLETE_SAVE');
 }
开发者ID:kvirella,项目名称:magrocket-backend,代码行数:19,代码来源:MY_Controller.php

示例8: exportcsv

 public function exportcsv()
 {
     $this->load->add_package_path(APPPATH . 'third_party/scrud/');
     $hook = Hook::singleton();
     $comId = $this->input->get('com_id');
     $conf = array();
     if (!empty($comId)) {
         $this->db->select('*');
         $this->db->from('crud_components');
         $this->db->where('id', $comId);
         $query = $this->db->get();
         $com = $query->row_array();
         $table = $com['component_table'];
         $_GET['table'] = $com['component_name'];
         if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . sha1('com_' . $comId) . '/' . $com['component_table'] . '.php')) {
             exit;
         }
         $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . sha1('com_' . $comId) . '/' . $com['component_table'] . '.php'));
         $conf = unserialize($content);
     } else {
         $table = $this->input->get('table');
         if (!file_exists(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $table . '.php')) {
             exit;
         }
         switch ($table) {
             case 'crud_users':
             case 'crud_groups':
                 require __DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $table . '.php';
                 break;
             default:
                 $content = str_replace("<?php exit; ?>\n", "", file_get_contents(__DATABASE_CONFIG_PATH__ . '/' . $this->db->database . '/' . $table . '.php'));
                 $conf = unserialize($content);
                 break;
         }
     }
     $hook->addFunction('SCRUD_INIT', 'f_global_access');
     $this->load->library('crud', array('table' => $table, 'conf' => $conf));
     echo $this->crud->process();
 }
开发者ID:Dannyngs,项目名称:kim_hung_aquarium,代码行数:39,代码来源:scrud.php

示例9: validate

 private function validate()
 {
     $hook = Hook::singleton();
     foreach ($this->validate as $k => $v) {
         if (isset($v['rule'])) {
             $this->_validate($k, $v);
         } else {
             foreach ($v as $k1 => $v1) {
                 $this->_validate($k, $v1);
             }
         }
     }
     if ($hook->isExisted('SCRUD_VALIDATE')) {
         $this->errors = $hook->filter('SCRUD_VALIDATE', $this->errors);
     }
     return count($this->errors) > 0 ? false : true;
 }
开发者ID:Dannyngs,项目名称:chinese_med,代码行数:17,代码来源:crud.php


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