/** * List TinyURLs * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_list($handler_id, array $args, array &$data) { // Get the topic link and relocate accordingly $data['url'] = net_nemein_redirector_viewer::topic_links_to($data); $qb = net_nemein_redirector_tinyurl_dba::new_query_builder(); $qb->add_constraint('node', '=', $this->_topic->guid); $this->_tinyurls = $qb->execute(); // Initialize the datamanager instance $this->_datamanager = new midcom_helper_datamanager2_datamanager($this->load_schemadb()); // Set the request data $this->_populate_request_data($handler_id); }
/** * Process the redirect request * * @param mixed $handler_id The ID of the handler. * @param Array $args The argument list. * @param Array &$data The local request data. */ public function _handler_redirect($handler_id, array $args, array &$data) { $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX); if (is_null($this->_config->get('redirection_type')) || $this->_topic->can_do('net.nemein.redirector:noredirect') && !$this->_config->get('admin_redirection')) { // No type set, redirect to config return new midcom_response_relocate("{$prefix}config/"); } // Get the topic link and relocate accordingly $data['url'] = net_nemein_redirector_viewer::topic_links_to($data); // Metatag redirection if ($this->_config->get('redirection_metatag')) { $data['redirection_url'] = $data['url']; $data['redirection_speed'] = $this->_config->get('redirection_metatag_speed'); midcom::get('head')->add_meta_head(array('http-equiv' => 'refresh', 'content' => "{$data['redirection_speed']};url={$data['url']}")); } else { return new midcom_response_relocate($data['url'], $this->_config->get('redirection_code')); } }