/**
  * Constructor
  *
  * @access	public
  * @return	null
  */
 function Code_pack()
 {
     parent::Module_builder('code_pack');
     /** -------------------------------------
     		/**  Module Installed and Up to Date?
     		/** -------------------------------------*/
     if ($this->database_version() == FALSE or $this->version_compare($this->database_version(), '<', CODE_PACK_VERSION)) {
         $this->disabled = TRUE;
         trigger_error(ee()->lang->line('code_pack_module_disabled'), E_USER_NOTICE);
     }
 }
 /**
  * Contructor
  *
  * @access	public
  * @return	null
  */
 function Code_pack_updater()
 {
     parent::Module_builder_code_pack('code_pack');
     /** --------------------------------------------
         /**  Module Actions
         /** --------------------------------------------*/
     $this->actions = array();
     /** --------------------------------------------
         /**  Extension Hooks
         /** --------------------------------------------*/
     $this->default_settings = array();
     $default = array('class' => $this->class_name . '_extension', 'settings' => '', 'priority' => 10, 'version' => CODE_PACK_VERSION, 'enabled' => 'y');
     $this->hooks = array();
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	bool		Enable calling of methods based on URI string
  * @return	string
  */
 function __construct($switch = TRUE)
 {
     parent::Module_builder_code_pack('code_pack');
     if ((bool) $switch === FALSE) {
         return;
     }
     // Install or Uninstall Request
     /** --------------------------------------------
         /**  Automatically Loaded Class Vars
         /** --------------------------------------------*/
     //$this->base = BASE.'&C=modules&M=code_pack';
     /** --------------------------------------------
         /**  Automatically Loaded Class Vars
         /** --------------------------------------------*/
     $this->theme_path = PATH_THEMES . (APP_VER >= 2.0 ? 'third_party/' : '') . 'code_pack/';
     $this->theme_url = rtrim(ee()->config->item('theme_folder_url'), '/') . '/' . (APP_VER >= 2.0 ? 'third_party/' : '') . 'code_pack/';
     /** --------------------------------------------
         /**	Set EE1 nav
         /** --------------------------------------------*/
     $menu = array('module_home' => array('name' => 'home', 'link' => $this->base, 'title' => ee()->lang->line('code_packs')), 'module_documentation' => array('name' => 'documentation', 'link' => CODE_PACK_DOCS_URL, 'title' => ee()->lang->line('documentation') . (APP_VER < 2.0 ? ' (' . CODE_PACK_VERSION . ')' : '')));
     $this->cached_vars['lang_module_version'] = ee()->lang->line('code_pack_module_version');
     $this->cached_vars['module_version'] = CODE_PACK_VERSION;
     $this->cached_vars['module_menu_highlight'] = 'module_home';
     $this->cached_vars['module_menu'] = $menu;
     /** --------------------------------------------
         /**  Sites
         /** --------------------------------------------*/
     $this->cached_vars['sites'] = array();
     foreach ($this->data->get_sites() as $site_id => $site_label) {
         $this->cached_vars['sites'][$site_id] = $site_label;
     }
     /** -------------------------------------
     		/**  Module Installed and What Version?
     		/** -------------------------------------*/
     if ($this->database_version() == FALSE) {
         return;
     } elseif ($this->version_compare($this->database_version(), '<', CODE_PACK_VERSION)) {
         if (APP_VER < 2.0) {
             if ($this->code_pack_module_update() === FALSE) {
                 return;
             }
         } else {
             // For EE 2.x, we need to redirect the request to Update Routine
             $_GET['method'] = 'code_pack_module_update';
         }
     }
     /** -------------------------------------
     		/**  Request and View Builder
     		/** -------------------------------------*/
     if (APP_VER < 2.0 and $switch !== FALSE) {
         if (ee()->input->get('method') === FALSE) {
             $this->index();
         } elseif (!method_exists($this, ee()->input->get('method'))) {
             $this->add_crumb(ee()->lang->line('invalid_request'));
             $this->cached_vars['error_message'] = ee()->lang->line('invalid_request');
             return $this->ee_cp_view('error_page.html');
         } else {
             $this->{ee()->input->get('method')}();
         }
     }
 }