Beispiel #1
0
 public function process()
 {
     $res = $this->request->server;
     $res['phpversion'] = phpversion();
     $res['zend_version'] = zend_version();
     $res['sapi'] = php_sapi_name();
     $res['handlers'] = Hm_Handler_Modules::dump();
     $res['output'] = Hm_Output_Modules::dump();
     $this->out('server_info', $res);
 }
Beispiel #2
0
 public function tearDown()
 {
     Hm_Output_Modules::del('test', 'blah');
 }
Beispiel #3
0
/**
 * Write the hm3.rc file to disk
 *
 * @param $settings array site settings list
 * @param $filters array combined list of filters from all modules
 * 
 * @return void
 */
function write_config_file($settings, $filters)
{
    Hm_Handler_Modules::try_queued_modules();
    Hm_Handler_Modules::process_all_page_queue();
    Hm_Output_Modules::try_queued_modules();
    Hm_Output_Modules::process_all_page_queue();
    $settings['handler_modules'] = Hm_Handler_Modules::dump();
    $settings['output_modules'] = Hm_Output_Modules::dump();
    $settings['input_filters'] = $filters;
    file_put_contents('hm3.rc', serialize($settings));
    printf("hm3.rc file written\n");
}
Beispiel #4
0
/**
 * Add an input or output module to all possible pages
 * @param string $type either output or handler
 * @param string $mod name of the module to add
 * @param bool $logged_in true if the module should only fire when logged in
 * @param string $source the module set containing the module code
 * @param string $marker the module name used to determine where to insert
 * @param string $placement "before" or "after" the $marker module name
 * @return void
 */
function add_module_to_all_pages($type, $mod, $logged_in, $source, $marker, $placement)
{
    if ($type == 'output') {
        Hm_Output_Modules::queue_module_for_all_pages($mod, $logged_in, $marker, $placement, $source);
    } elseif ($type == 'handler') {
        Hm_Handler_Modules::queue_module_for_all_pages($mod, $logged_in, $marker, $placement, $source);
    }
}
Beispiel #5
0
 /**
  * Load all module sets and include required modules.php files
  * @param string $page page id
  * @return void
  */
 public function load_module_sets($page)
 {
     $this->load_modules('Hm_Handler_Modules', $this->handlers, $page);
     $this->load_modules('Hm_Output_Modules', $this->outputs, $page);
     $active_mods = array_unique(array_merge($this->get_active_mods(Hm_Output_Modules::get_for_page($page)), $this->get_active_mods(Hm_Handler_Modules::get_for_page($page))));
     if (!count($active_mods)) {
         Hm_Functions::cease('No module assignments found');
     }
     $mods = explode(',', $this->site_config->get('modules', ''));
     $this->load_module_set_files($mods, $active_mods);
 }
Beispiel #6
0
 /**
  * @preserveGlobalState disabled
  * @runInSeparateProcess
  */
 public function test_add_module_to_all_pages()
 {
     add_handler('test', 'test_mod', false);
     add_output('test', 'test_mod', false);
     add_module_to_all_pages('output', 'all_pages', false, 'test', false, false);
     add_module_to_all_pages('handler', 'all_pages', false, 'test', false, false);
     Hm_Output_Modules::process_all_page_queue();
     Hm_Handler_Modules::process_all_page_queue();
     $mods = Hm_Output_Modules::dump();
     foreach ($mods as $name => $vals) {
         if (!preg_match("/^ajax_/", $name)) {
             $this->assertTrue(array_key_exists('all_pages', $vals));
         }
     }
     $mods = Hm_Handler_Modules::dump();
     foreach ($mods as $name => $vals) {
         if (!preg_match("/^ajax_/", $name)) {
             $this->assertTrue(array_key_exists('all_pages', $vals));
         }
     }
 }