/** * Constructor * * @access public * @param bool Enable calling of methods based on URI string * @return string */ public function __construct($switch = TRUE) { //$this->theme = 'flow_ui'; parent::Module_builder_favorites('favorites'); if ((bool) $switch === FALSE) { return; } // Install or Uninstall Request ee()->load->helper(array('text', 'form', 'url', 'security', 'string')); // -------------------------------------------- // Module Menu Items // -------------------------------------------- $menu = array('module_home' => array('link' => $this->base, 'title' => ee()->lang->line('homepage')), 'module_members' => array('link' => $this->base . "&method=members", 'title' => ee()->lang->line('members')), 'module_entries' => array('link' => $this->base . "&method=entries", 'title' => ee()->lang->line('entries')), 'module_preferences' => array('link' => $this->base . "&method=preferences", 'title' => ee()->lang->line('preferences')), 'module_documentation' => array('link' => FAVORITES_DOCS_URL, 'title' => ee()->lang->line('online_documentation') . (APP_VER < 2.0 ? ' (' . FAVORITES_VERSION . ')' : ''))); //$this->cached_vars['module_menu_highlight'] = 'module_home'; $this->cached_vars['lang_module_version'] = ee()->lang->line('favorites_module_version'); $this->cached_vars['module_version'] = FAVORITES_VERSION; $this->cached_vars['module_menu'] = $menu; //needed for header.html file views $this->cached_vars['js_magic_checkboxes'] = $this->js_magic_checkboxes(); // ------------------------------------- // Module Installed and What Version? // ------------------------------------- if ($this->database_version() == FALSE) { return; } elseif ($this->version_compare($this->database_version(), '<', FAVORITES_VERSION)) { if (APP_VER < 2.0) { if ($this->favorites_module_update() === FALSE) { return; } } else { // For EE 2.x, we need to redirect the request to Update Routine $_GET['method'] = 'favorites_module_update'; } } //saves a few function calls $this->clean_site_id = ee()->db->escape_str(ee()->config->item('site_id')); // ------------------------------------- // Request and View Builder // ------------------------------------- if (APP_VER < 2.0 && $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')}(); } } }
/** * Constructor * * @access public * @return null */ public function __construct() { parent::Module_builder_favorites('favorites'); ee()->load->helper(array('text', 'form', 'url', 'security', 'string')); // ------------------------------------- // Module Installed and Up to Date? // ------------------------------------- if ($this->database_version() == FALSE or $this->version_compare($this->database_version(), '<', FAVORITES_VERSION)) { $this->disabled = TRUE; trigger_error(ee()->lang->line('favorites_module_disabled'), E_USER_NOTICE); } //saves a few function calls $this->clean_site_id = ee()->db->escape_str(ee()->config->item('site_id')); }
/** * Constructor * * @access public * @return null */ public function __construct() { parent::Module_builder_favorites('favorites'); // -------------------------------------------- // Module Actions // -------------------------------------------- $this->module_actions = array(); // -------------------------------------------- // Extension Hooks // -------------------------------------------- $this->default_settings = array(); $default = array('class' => $this->extension_name, 'settings' => '', 'priority' => 10, 'version' => FAVORITES_VERSION, 'enabled' => 'y'); $is2 = !(APP_VER < 2.0); $this->hooks = array(array_merge($default, array('method' => 'modify_sql', 'hook' => $is2 ? 'channel_module_alter_order' : 'weblog_module_alter_order', 'priority' => 7)), array_merge($default, array('method' => 'add_favorite', 'hook' => $is2 ? 'entry_submission_end' : 'submit_new_entry_end', 'priority' => 7)), array_merge($default, array('method' => 'delete_members', 'hook' => 'cp_members_member_delete_end', 'priority' => 7)), array_merge($default, array('method' => 'delete_entry', 'hook' => 'delete_entries_loop', 'priority' => 7)), array_merge($default, array('method' => 'parse_favorites_date', 'hook' => $is2 ? 'channel_entries_tagdata' : 'weblog_entries_tagdata'))); //saves a few function calls $this->clean_site_id = ee()->db->escape_str(ee()->config->item('site_id')); }