/** * Assembles a URL path defined by this route * * @param array $data An array of variable and value pairs used as parameters * @param bool $reset * @param bool $encode * @return string Route path with user submitted parameters */ public function assemble($data = array(), $reset = false, $encode = false) { $frontController = IfwPsn_Vendor_Zend_Controller_Front::getInstance(); if (!array_key_exists('mod', $data) && !$reset && array_key_exists('mod', $this->_current) && $this->_current['mod'] != $frontController->getDefaultModule()) { $data = array_merge(array('mod' => $this->_current['mod']), $data); } if (!array_key_exists('controller', $data) && !$reset && array_key_exists('controller', $this->_current) && $this->_current['controller'] != $frontController->getDefaultControllerName()) { $data = array_merge(array('controller' => $this->_current['controller']), $data); } if (!array_key_exists('action', $data) && !$reset && array_key_exists('action', $this->_current) && $this->_current['action'] != $frontController->getDefaultAction()) { $data = array_merge(array('action' => $this->_current['action']), $data); } if (!empty($data)) { $querydata = array(); if (isset($data['page'])) { $url = IfwPsn_Wp_Proxy_Admin::getOptionsBaseUrl(); $querydata['page'] = $data['page']; unset($data['page']); } elseif (isset($data['adminpage'])) { $url = IfwPsn_Wp_Proxy_Admin::getAdminPageBaseUrl(); $querydata['page'] = $data['adminpage']; unset($data['adminpage']); } elseif (isset($data['editpage'])) { $url = 'edit.php'; if (isset($data['posttype'])) { $querydata['post_type'] = $data['posttype']; unset($data['posttype']); } $querydata['page'] = $data['editpage']; unset($data['editpage']); } if (isset($data['module'])) { $querydata['mod'] = $data['module']; unset($data['module']); } if (isset($data['action'])) { $querydata[$this->_pm->getConfig()->getActionKey()] = $data['action']; unset($data['action']); } $querydata = array_merge($querydata, $data); $url .= '?' . http_build_query($querydata, '', '&'); } return $url; }