public static function set_session_and_get_exception_page_url(Exception $e)
 {
     if (DEBUG) {
         echo DEBUG_DELIM_OPEN;
         echo '__METHOD__: ' . __METHOD__ . "\n";
         echo '__LINE__: ' . __LINE__ . "\n";
         echo DEBUG_DELIM_CLOSE;
     }
     $_SESSION['exception'] = $e;
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     if (DEBUG) {
         echo DEBUG_DELIM_OPEN;
         echo '__METHOD__: ' . __METHOD__ . "\n";
         echo '__LINE__: ' . __LINE__ . "\n";
         echo DEBUG_DELIM_CLOSE;
     }
     $phcm = $cmf->get_config_manager('plug-ins', 'public-html');
     if (DEBUG) {
         echo DEBUG_DELIM_OPEN;
         echo '__METHOD__: ' . __METHOD__ . "\n";
         echo '__LINE__: ' . __LINE__ . "\n";
         echo DEBUG_DELIM_CLOSE;
     }
     $exception_page_class_name = $phcm->get_exception_page_class_name();
     $exception_page_url = PublicHTML_URLHelper::get_oo_page_url($exception_page_class_name);
     if (DEBUG) {
         echo DEBUG_DELIM_OPEN;
         echo '__METHOD__: ' . __METHOD__ . "\n";
         echo '__LINE__: ' . __LINE__ . "\n";
         echo DEBUG_DELIM_CLOSE;
     }
     return $exception_page_url;
 }
 public static function get_feed_parser()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'feed-aggregator');
     $class = $config_manager->get_feed_parser();
     return new $class();
 }
 public static function get_instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new HaddockProjectOrganisation_ConfigManagerFactory();
     }
     return self::$instance;
 }
 public static function get_thumbnails_medium_height()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'video-library');
     $size = $config_manager->get_thumbnails_medium_height();
     return $size;
 }
 public static function get_item_page_url()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'feed-aggregator');
     $item_page_class_name = $config_manager->get_item_page_class_name();
     return self::get_oo_page_url($item_page_class_name);
 }
 public function run_post_session_header_commands()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('haddock', 'public-html');
     if (!$config_manager->is_meta_page_about_haddock_cms_shown()) {
         throw new PublicHTML_PageNotFoundException($_SERVER['REQUEST_URI']);
     }
 }
 public static function set_session_and_get_exception_page_url(Exception $e)
 {
     $_SESSION['exception'] = $e;
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $phcm = $cmf->get_config_manager('haddock', 'public-html');
     $exception_page_class_name = $phcm->get_exception_page_class_name();
     $exception_page_url = PublicHTML_URLHelper::get_oo_page_url($exception_page_class_name);
     return $exception_page_url;
 }
 /**
  * Looks for an exception saved in a session and prints
  * it off if it is found.
  *
  * If the config files for this project have been set
  * up to print the stack trace of an exception, that is printed
  * as well.
  */
 public static function render_exception_div_from_session()
 {
     if (isset($_SESSION['exception'])) {
         $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
         $phcm = $cmf->get_config_manager('haddock', 'public-html');
         $exception_div = new HTMLTags_ExceptionDiv($_SESSION['exception'], $phcm->are_exception_trace_lists_printed());
         echo $exception_div->get_as_string();
     } else {
         echo "<p class=\"error\">No exception set!</p>\n";
     }
 }
 public static function get_page_builder()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'video-library');
     $page_builder_class_name = $config_manager->get_page_builder_class_name();
     /* Can't believe this works...
      */
     $page_builder_class_name = trim($page_builder_class_name);
     $instance = new $page_builder_class_name();
     return $instance;
 }
 public function get_page_class_reflection_object_name_for_page($page_name, $type)
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'mailing-list');
     switch ($page_name) {
         case 'sign-up':
             switch ($type) {
                 case 'html':
                     return $config_manager->get_sign_up_html_page_class_name();
                 case 'redirect-script':
                     return $config_manager->get_sign_up_redirect_script_class_name();
             }
     }
     throw new Exception('Unknown page / type combination!');
 }
 public function content()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'admin');
     $widget_classes = $config_manager->get_start_page_widget_classes();
     $div = new HTMLTags_Div();
     $div->set_attribute_str('id', 'StartPageWidgetContainer');
     foreach ($widget_classes as $key => $value) {
         $widget_class_str = trim($value);
         $instance = new $widget_class_str();
         $content = $instance->get_widget_div();
         $div->append($content);
     }
     echo $div->get_as_string();
 }
 public function get_body_div_header()
 {
     /*
      * Create the HTML tags objects.
      */
     $div_header = new HTMLTags_Div();
     $div_header->set_attribute_str('id', 'header');
     /* 
      * Project Logo IMG,
      * for filename look in config, 
      * default should be some haddock fish
      */
     $image_div = new HTMLTags_Div();
     $image_div->set_attribute_str('id', 'logo_image');
     $logo_img = new HTMLTags_IMG();
     $logo_src_url = new HTMLTags_URL();
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     /*
      * The admin module has been moved to the plug-ins directory.
      *
      * RFI 2009-10-08
      */
     #$config_manager = $cmf->get_config_manager('haddock', 'admin');
     $config_manager = $cmf->get_config_manager('plug-ins', 'admin');
     $logo_config_filename = $config_manager->get_logo_image_filename();
     $logo_src_url->set_file($logo_config_filename);
     $logo_img->set_src($logo_src_url);
     $image_div->append($logo_img);
     $div_header->append($image_div);
     /* 
      * There are two headers: 
      * Project Title Link (H1)
      * and Page Title (H2)
      */
     $h1_title = new HTMLTags_Heading(1);
     $h1_title->append_str_to_content($this->get_body_div_header_project_heading_content());
     $div_header->append_tag_to_content($h1_title);
     $h2_title = new HTMLTags_Heading(2);
     $h2_title->append_str_to_content($this->get_body_div_header_heading_content());
     $div_header->append_tag_to_content($h2_title);
     $div_header->append($this->get_log_in_state_div());
     $div_header->append($this->get_admin_header_navigation_link_div());
     return $div_header;
 }
 /**
  * Makes the title for the error page.
  * 
  * This title can be set in the project-specific or instance-specific
  * config file for this module.
  * 
  * If it is not set in the config file, the name of the project is
  * fetched from the HPO config manager and a title is generated.
  */
 public function get_error_page_title()
 {
     $ept = '';
     $eptcvn = 'error-page/title';
     if ($this->has_config_value($eptcvn)) {
         $ept .= $this->get_config_value($eptcvn);
     } else {
         /*
          * Find the name of the project, if it's been set.
          */
         $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
         $hpo_cm = $cmf->get_config_manager('haddock', 'haddock-project-organisation');
         #			if ($hpo_cm->has_nested_config_variable_str('project name')) {
         #				$ept .= $hpo_cm->get_nested_config_variable_str('project name');
         #			}
         $ept .= $hpo_cm->get_project_name();
         #$ept .= $this->get_nested_config_variable_str('page-elements titles separator');
         $ept .= $this->get_page_elements_titles_separator();
         #$ept .= $this->get_nested_config_variable_str('pages error title ending');
         $ept .= $this->get_page_elements_title_ending();
     }
     return $ept;
 }
<?php

/**
 * The header of the body.
 *
 * @copyright Clear Line Web Design, 2006-11-17
 */
#$pdf = HaddockProjectOrganisation_ProjectDirectoryFinder::get_instance();
#$project_directory = $pdf->get_project_directory_for_this_project();
#
#$config_file = $project_directory->get_config_file();
/*
 * Find the module config manager.
 */
$cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
$config_manager = $cmf->get_config_manager('haddock', 'haddock-project-organisation');
/*
 * Create the HTML tags objects.
 */
$div_header = new HTMLTags_Div();
$div_header->set_attribute_str('id', 'header');
$h1_title = new HTMLTags_Heading(1);
#$home_link = new HTMLTags_A($config_file->get_project_title());
#$element_names = array('project', 'name');
#
#if ($config_manager->has_nested_config_variable($element_names)) {
#	$home_link = new HTMLTags_A($config_manager->get_nested_config_variable($element_names));
#
#	$home_link->set_href(new HTMLTags_URl('/'));
#
#	$h1_title->append_tag_to_content($home_link);
 public function get_head_meta_author()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('haddock', 'haddock-project-organisation');
     return $config_manager->get_copyright_holder();
 }
 protected function get_project_title()
 {
     /*
      * Find the module config manager.
      */
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('haddock', 'haddock-project-organisation');
     return $config_manager->get_project_name();
 }
 private function get_search_results_duration()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'video-library');
     return $config_manager->get_search_results_duration();
 }
    public static function add_feed_to_retrieval_queue($id)
    {
        $dbh = DB::m();
        $id = mysql_real_escape_string($id);
        $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
        $config_manager = $cmf->get_config_manager('plug-ins', 'feed-aggregator');
        $frequency_minutes = mysql_real_escape_string($config_manager->get_default_feed_retrieval_frequency_in_minutes());
        $stmt = <<<SQL
INSERT
INTO
    hpi_feed_aggregator_retrieval_queue
SET
    feed_id = '{$id}',
    frequency_minutes = '{$frequency_minutes}',
    last_retrieved = NULL,
    status = 'skip'

SQL;
        // print_r($stmt);exit;
        $result = mysql_query($stmt, $dbh);
        $id = mysql_insert_id($dbh);
        return $id;
    }
 private function get_admin_config_file()
 {
     /*
      * Was written to use the old style config files,
      * but should be able to transparently replace it 
      * with the new style config manager
      */
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     return $cmf->get_config_manager('plug-ins', 'user-login');
 }
 public static function get_config_manager($section, $module)
 {
     $config_manager_factory = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $config_manager_factory->get_config_manager($section, $module);
     return $config_manager;
 }
 public static function get_search_page_class_name()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'video-library');
     return $config_manager->get_search_page_class_name();
 }
 public static function is_node_selected($node, $page_class_str)
 {
     //print_r($node);print_r($page_class_str);
     //print_r($_GET);
     //print_r($_SERVER['SCRIPT_NAME']);exit;
     //print_r($node);print_r($page_class_str);exit;
     /**
      * This is a best guess attempt at whether this node is the same 
      * as the page we're currently on. Based on various guesses about
      * plug-ins and normal practices, it  seems to work so far...
      */
     /*
      *Home Page, if it's the Default page and the href is '/'
      */
     if ($node['url_href'] == '/') {
         $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
         $pm = $cmf->get_config_manager('haddock', 'public-html');
         if ('/' . $page_class_str == $pm->get_default_url()) {
             return TRUE;
         }
     }
     $clean_url_str = str_replace('/', '', $node['url_href']);
     if (preg_match('/' . $clean_url_str . '/i', $page_class_str, $matches)) {
         return TRUE;
     }
     /**
      * Site Texts plug in. 
      * At the mo, ['site-texts'] & ['language']
      * get info and the .htaccess rule which translates 
      * them from /en/home.html or /fr/home.html
      * is only set in one certain proj-spec,
      * but I wanna move it up so I included this code here
      */
     if (isset($_GET['site-texts'])) {
         if (isset($_GET['language']) && isset($_GET['page'])) {
             if ('/' . $_GET['language'] . '/' . $_GET['page'] . '.html' == $node['url_href']) {
                 return TRUE;
             }
             if ($node['url_href'] == '/' && $_GET['page'] == 'home') {
                 return TRUE;
             }
         }
     }
     /*
      *DB Page, if the url starts with '/db-pages/'
      */
     if (substr($node['url_href'], 0, 10) == '/db-pages/') {
         try {
             //print_r(
             //strtolower($_GET['page']) . '.html'
             //.
             //substr($node['url_href'], 11)
             //);
             $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
             $config_manager = $cmf->get_config_manager('plug-ins', 'db-pages');
             if ($page_class_str == $config_manager->get_html_page_class_name()) {
                 if (strtolower($_GET['page']) . '.html' == substr($node['url_href'], 10)) {
                     return TRUE;
                 }
             }
         } catch (Exception $e) {
         }
     }
     return FALSE;
 }
 public static function get_config_manager()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     return $cmf->get_config_manager('plug-ins', 'user-login');
 }
 public function get_page_class_reflection_object_name()
 {
     $cmf = HaddockProjectOrganisation_ConfigManagerFactory::get_instance();
     $config_manager = $cmf->get_config_manager('plug-ins', 'db-pages');
     return $config_manager->get_html_page_class_name();
 }