Example #1
0
 /**
  * load content selected by URI, and save output to default content area
  */
 function load_controller($controller = null, $controller_dir = null, $format = null, $params = null)
 {
     //determine required controller and load class
     if ($controller != null) {
         $controller_file = $controller_dir . FRAME_EXTENSION;
         //load required controller
         require_once $controller_file;
         //define class name for required controller
         $class = ucfirst($controller) . CONTROLLER_CLASS_NAME;
         //check class exists and instantiate object
         if (class_exists($class)) {
             $controller_object = new $class();
         } else {
             //trigger debug error - for testing at the moment...
             return trigger_error("Debug: Controller Class not found - <b>" . $controller . "</b>");
         }
         //check content format and params for controller
         if ($format != null && $params != null) {
             $content = $controller_object->get_content($format, $params);
             if (!empty($content)) {
                 //get chosen theme
                 View::selected_theme();
                 self::draw_theme($content);
             } else {
                 return trigger_error('No content found - ');
             }
         }
     } else {
         $content = "<h3>Welcome to the 402 framework</h3>";
         View::selected_theme();
         self::draw_theme($content);
     }
 }
Example #2
0
 /**
  * load content selected by URI, and save output to default content area
  */
 function load_controller($controller = null, $controller_dir = null, $format = null, $params = null, $admin = null)
 {
     //determine required controller and load class
     if ($controller != null) {
         $controller_file = $controller_dir . FRAME_EXTENSION;
         //load required controller
         require_once $controller_file;
         //define class name for required controller
         $controller_class = ucfirst($controller) . CONTROLLER_CLASS_NAME;
         //check controller class exists and instantiate object
         if (class_exists($controller_class)) {
             $controller_object = new $controller_class();
         } else {
             //trigger debug error - for testing at the moment...
             return trigger_error("Debug: Controller Class not found - <b>" . $controller . "</b>");
         }
         //check content format and params for controller
         if ($format != null && $params != null && $controller != null) {
             //get content for specified route
             $content = $controller_object->get_content_field($controller, $format, $params);
             //get content title for specified route
             $format_name = "name";
             $content_title = $controller_object->get_content_field($controller, $format_name, $params);
             //add title meta to content meta array
             self::$content_meta['title'] = $content_title;
             //get content desc for specified route
             $format_desc = "desc";
             $content_desc = $controller_object->get_content_field($controller, $format_desc, $params);
             //add desc meta to content meta array
             self::$content_meta['description'] = $content_desc;
             //build and draw view for framework with selected plugin and theme (if applicable)
             if (!empty($content)) {
                 //get meta for content
                 self::load_meta($controller, $params);
                 //get chosen theme
                 View::selected_theme();
                 //get default view for user select route - eg: content/image using $format
                 $format_view = VIEW_DIR . $format . FRAME_EXTENSION;
                 //load required view
                 require_once $format_view;
                 //define class name for required viewer
                 $viewer_class = ucfirst($format) . VIEWER_CLASS_NAME;
                 //check viewer class exists and instantiate object
                 if (class_exists($viewer_class)) {
                     $viewer_object = new $viewer_class();
                     //viewer attributes array for use with viewer content html output
                     $viewer_attributes = array("id" => $params["id"], "class" => $format);
                     //format attributes array for the $format itself - eg: title, desc
                     $format_attributes = array("title" => $content_title, "desc" => $content_desc);
                     //get formatted content with required viewer plugin (image/text etc)
                     $viewer_content = $viewer_object->get_viewer_content($content, $viewer_attributes, $format_attributes);
                 } else {
                     //trigger debug error - for testing at the moment...
                     return trigger_error("Debug: Controller Class not found - <b>" . $controller . "</b>");
                 }
                 //check available plugins for format
                 $plugin_controller = CONTROLLER_DIR . 'plugin' . FRAME_EXTENSION;
                 //load required plugin file
                 require_once $plugin_controller;
                 //define controller plugin class
                 $plugin_class = 'Plugin' . CONTROLLER_CLASS_NAME;
                 //check plugin class and instantiate object
                 if (class_exists($plugin_class)) {
                     $plugin_object = new $plugin_class();
                     $plugin_check = $plugin_object->get_plugins($controller, $format);
                     self::load_plugins($plugin_check);
                 } else {
                     //trigger debug error - for testing at the moment...
                     return trigger_error("Debug: Controller Class not found - <b>" . $controller . "</b>");
                 }
                 //draw theme for plugin, metadata, and content
                 self::draw_theme($viewer_content, self::$content_meta, self::$plugins);
             } else {
                 //get chosen theme
                 View::selected_theme();
                 $content = 'No content found.';
                 self::$content_meta = null;
                 self::$plugins = null;
                 self::draw_theme($content, self::$content_meta, self::$plugins);
             }
         }
     } else {
         View::selected_theme();
         //temporary handler for home page...
         $content = "<h3>Welcome to the 402 framework</h3>";
         self::$content_meta = null;
         self::$plugins = null;
         self::draw_theme($content, self::$content_meta, self::$plugins);
     }
 }
Example #3
0
 /**
  * load content selected by URI, and save output to default content area
  */
 function load_controller($controller = null, $controller_dir = null, $format = null, $group = null, $params = null)
 {
     //determine required controller and load class
     if ($controller != null) {
         $controller_file = $controller_dir . FRAME_EXTENSION;
         //require taxonomy controller class
         $taxonomy_file = CONTROLLER_DIR . 'taxonomy' . FRAME_EXTENSION;
         //load required controller
         require_once $controller_file;
         //load required taxonomy controller
         require_once $taxonomy_file;
         //define class name for required controller
         $controller_class = ucfirst($controller) . CONTROLLER_CLASS_NAME;
         //define class name for taxonomy controller
         $taxonomy_class = ucfirst('taxonomy') . CONTROLLER_CLASS_NAME;
         //check controller class exists and instantiate object
         if (class_exists($controller_class)) {
             $controller_object = new $controller_class();
         } else {
             //trigger debug error - for testing at the moment...
             return trigger_error("Debug: Controller Class not found - <b>" . $controller . "</b>");
         }
         //check taxonomy controller class exists and instantiate object
         if (class_exists($taxonomy_class)) {
             $taxonomy_object = new $taxonomy_class();
         } else {
             //trigger debug error - for testing at the moment...
             return trigger_error("Debug: Taxonomy Class not found</b>");
         }
     } else {
         View::selected_theme();
         //temporary handler for home page...
         $content = "<h3>Welcome to the 402 framework</h3>";
         self::$content_meta = null;
         self::$plugins = null;
         self::draw_theme($content, self::$content_meta, self::$plugins);
     }
     //check content format, group, and params for controller - group content returned eg: image gallery
     if ($controller != null && $format != null && $group != null && $params != null) {
         //get content for specified route
         $content = $controller_object->get_content_group($controller, $format, $group, $params);
         //get taxonomy title and description for metadata
         $taxonomy_meta = $taxonomy_object->get_taxonomy_row($params);
         $taxonomy_title = $taxonomy_meta['taxa_name'];
         $taxonomy_desc = $taxonomy_meta['taxa_description'];
         //add taxonomy title and description meta to content meta array
         self::$content_meta['title'] = $taxonomy_title;
         self::$content_meta['description'] = $taxonomy_desc;
         //build and draw view for framework with theme (if applicable)
         if (!empty($content)) {
             //get chosen theme
             View::selected_theme();
             //get default view for user select route - eg: content/image/gallery using $group
             $group_view = VIEW_DIR . $group . FRAME_EXTENSION;
             //load required view
             require_once $group_view;
             //define class name for required group viewer
             $group_class = ucfirst($group) . VIEWER_CLASS_NAME;
             //check group class exists and instantiate object
             if (class_exists($group_class)) {
                 $group_object = new $group_class();
                 //group attributes array for use with group content html output
                 $group_attributes = array("id" => $params["id"], "class" => $group);
                 //taxonomy attributes array eg: title, desc
                 $taxonomy_attributes = array("title" => $taxonomy_title, "desc" => $taxonomy_desc);
                 //get formatted content with required viewer plugin (image/text etc)
                 $group_content = $group_object->get_group_content($content, $group_attributes, $taxonomy_attributes);
             } else {
                 //trigger debug error - for testing at the moment...
                 return trigger_error("Debug: Viewer Class not found - <b>" . $group . "</b>");
             }
             //check available plugins
             $plugin_controller = CONTROLLER_DIR . 'plugin' . FRAME_EXTENSION;
             //load required plugin file
             require_once $plugin_controller;
             //define controller plugin class
             $plugin_class = 'Plugin' . CONTROLLER_CLASS_NAME;
             //check plugin class and instantiate object
             if (class_exists($plugin_class)) {
                 $plugin_object = new $plugin_class();
                 $plugin_check = $plugin_object->get_group_plugins($group);
                 self::load_plugins($plugin_check);
             } else {
                 //trigger debug error - for testing at the moment...
                 return trigger_error("Debug: Plugin Class not found - <b>" . $controller . ', ' . $format . "</b>");
             }
             //draw theme for plugin, metadata, and content
             self::draw_theme($group_content, self::$content_meta, self::$plugins);
         } else {
             //get chosen theme
             View::selected_theme();
             $content = 'No content found.';
             self::$content_meta = null;
             self::$plugins = null;
             self::draw_theme($content, self::$content_meta, self::$plugins);
         }
     } else {
         if ($controller != null && $format != null && $params != null) {
             //get content for specified route
             $content = $controller_object->get_content_field($controller, $format, $params);
             //get content title for specified route
             $format_name = "name";
             $content_title = $controller_object->get_content_field($controller, $format_name, $params);
             //add title meta to content meta array
             self::$content_meta['title'] = $content_title;
             //get content desc for specified route
             $format_desc = "desc";
             $content_desc = $controller_object->get_content_field($controller, $format_desc, $params);
             //add desc meta to content meta array
             self::$content_meta['description'] = $content_desc;
             //build and draw view for framework with selected plugin and theme (if applicable)
             if (!empty($content)) {
                 //get meta for content
                 self::load_meta($controller, $format, $params);
                 //get chosen theme
                 View::selected_theme();
                 //get default view for user select route - eg: content/image using $format
                 $format_view = VIEW_DIR . $format . FRAME_EXTENSION;
                 //load required view
                 require_once $format_view;
                 //define class name for required viewer
                 $viewer_class = ucfirst($format) . VIEWER_CLASS_NAME;
                 //check viewer class exists and instantiate object
                 if (class_exists($viewer_class)) {
                     $viewer_object = new $viewer_class();
                     //viewer attributes array for use with viewer content html output
                     $viewer_attributes = array("id" => $params["id"], "class" => $format);
                     //format attributes array for the $format itself - eg: title, desc
                     $format_attributes = array("title" => $content_title . ' - ' . $content_desc, "desc" => $content_desc);
                     //get formatted content with required viewer plugin (image/text etc)
                     $viewer_content = $viewer_object->get_viewer_content($content, $viewer_attributes, $format_attributes);
                 } else {
                     //trigger debug error - for testing at the moment...
                     return trigger_error("Debug: Viewer Class not found - <b>" . $format . "</b>");
                 }
                 //check available plugins
                 $plugin_controller = CONTROLLER_DIR . 'plugin' . FRAME_EXTENSION;
                 //load required plugin file
                 require_once $plugin_controller;
                 //define controller plugin class
                 $plugin_class = 'Plugin' . CONTROLLER_CLASS_NAME;
                 //check plugin class and instantiate object
                 if (class_exists($plugin_class)) {
                     $plugin_object = new $plugin_class();
                     $plugin_check = $plugin_object->get_plugins($controller, $format);
                     self::load_plugins($plugin_check);
                 } else {
                     //trigger debug error - for testing at the moment...
                     return trigger_error("Debug: Plugin Class not found - <b>" . $controller . ', ' . $format . "</b>");
                 }
                 //draw theme for plugin, metadata, and content
                 self::draw_theme($viewer_content, self::$content_meta, self::$plugins);
             } else {
                 //get chosen theme
                 View::selected_theme();
                 $content = 'No content found.';
                 self::$content_meta = null;
                 self::$plugins = null;
                 self::draw_theme($content, self::$content_meta, self::$plugins);
             }
         } else {
             if ($controller != null && $params != null) {
                 $controller_content = $controller_object->get_controller_content($controller, $params);
                 //check for associated metadata where id is not set as taxa - eg: contentid, user id etc...
                 if ($controller == "content") {
                     $meta_results = $controller_object->get_content_row($controller, $params);
                     $meta_title = $meta_results['contentname'];
                     $meta_desc = $meta_results['contentdesc'];
                 } else {
                     if ($controller == "taxonomy") {
                         //get taxonomy title and description for metadata
                         $meta_results = $taxonomy_object->get_taxonomy_row($params);
                         $meta_title = $meta_results['taxa_name'];
                         $meta_desc = $meta_results['taxa_description'];
                     }
                 }
                 //add title and description meta to content meta array
                 self::$content_meta['title'] = $meta_title;
                 self::$content_meta['description'] = $meta_desc;
                 //build and draw view for framework with theme (if applicable)
                 if (!empty($controller_content)) {
                     //get chosen theme
                     View::selected_theme();
                     //get default controller content view for user select route - eg: content&id=6, taxonomy&id=3...
                     $controller_content_view = VIEW_DIR . $controller . FRAME_EXTENSION;
                     //load required view
                     require_once $controller_content_view;
                     //define class name for required group viewer
                     $controller_content_class = ucfirst($controller) . VIEWER_CLASS_NAME;
                     //check controller content class exists and instantiate object
                     if (class_exists($controller_content_class)) {
                         $controller_content_object = new $controller_content_class();
                         //controller attributes array for use with controller content html output
                         $controller_content_attributes = array("id" => $params["id"], "class" => $controller . '_all');
                         //taxonomy attributes array eg: title, desc
                         $meta_attributes = array("title" => $meta_title, "desc" => $meta_desc);
                         //get formatted content with required viewer plugin (content/taxonomy etc)
                         $controller_content2 = $controller_content_object->get_controller_content($controller_content, $controller_content_attributes, $meta_attributes);
                     } else {
                         //trigger debug error - for testing at the moment...
                         return trigger_error("Debug: Viewer Class not found - <b>" . $group . "</b>");
                     }
                     //check available plugins
                     $plugin_controller = CONTROLLER_DIR . 'plugin' . FRAME_EXTENSION;
                     //load required plugin file
                     require_once $plugin_controller;
                     //define controller plugin class
                     $plugin_class = 'Plugin' . CONTROLLER_CLASS_NAME;
                     //check plugin class and instantiate object
                     if (class_exists($plugin_class)) {
                         $plugin_object = new $plugin_class();
                         $plugin_check = $plugin_object->get_controller_plugins($controller);
                         self::load_plugins($plugin_check);
                     } else {
                         //trigger debug error - for testing at the moment...
                         return trigger_error("Debug: Plugin Class not found - <b>" . $controller . "</b>");
                     }
                     //draw theme for plugin, metadata, and content
                     self::draw_theme($controller_content2, self::$content_meta, self::$plugins);
                 } else {
                     //get chosen theme
                     View::selected_theme();
                     $content = 'No content found.';
                     self::$content_meta = null;
                     self::$plugins = null;
                     self::draw_theme($content, self::$content_meta, self::$plugins);
                 }
             } else {
                 if ($controller != null) {
                     //get chosen theme
                     View::selected_theme();
                     $content = '<p>Please view <a href="?node=content/text&id=6">Site Content</a> for further details</p>';
                     self::$content_meta = null;
                     self::$plugins = null;
                     self::draw_theme($content, self::$content_meta, self::$plugins);
                 }
             }
         }
     }
 }