本文整理汇总了PHP中PMA\libraries\URL类的典型用法代码示例。如果您正苦于以下问题:PHP URL类的具体用法?PHP URL怎么用?PHP URL使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了URL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _includeFiles
/**
* Returns HTML code to include javascript file.
*
* @param array $files The list of js file to include
*
* @return string HTML code for javascript inclusion.
*/
private function _includeFiles($files)
{
$first_dynamic_scripts = "";
$dynamic_scripts = "";
$scripts = array();
$separator = URL::getArgSeparator();
foreach ($files as $value) {
if (mb_strpos($value['filename'], "?") !== false) {
$file_name = $value['filename'] . $separator . Header::getVersionParameter();
if ($value['before_statics'] === true) {
$first_dynamic_scripts .= "<script data-cfasync='false' type='text/javascript' " . "src='js/" . $file_name . "'></script>";
} else {
$dynamic_scripts .= "<script data-cfasync='false' " . "type='text/javascript' src='js/" . $file_name . "'></script>";
}
continue;
}
$include = true;
if ($include) {
$scripts[] = "scripts%5B%5D=" . $value['filename'];
}
}
$separator = URL::getArgSeparator();
$static_scripts = '';
// Using chunks of 20 files to avoid too long URLs
$script_chunks = array_chunk($scripts, 20);
foreach ($script_chunks as $script_chunk) {
$url = 'js/get_scripts.js.php?' . implode($separator, $script_chunk) . $separator . Header::getVersionParameter();
$static_scripts .= sprintf('<script data-cfasync="false" type="text/javascript" src="%s">' . '</script>', htmlspecialchars($url));
}
return $first_dynamic_scripts . $static_scripts . $dynamic_scripts;
}
示例2: testGetHtmlForControlButtons
/**
* Tests getHtmlForControlButtons() method
*
* @return void
* @test
*/
public function testGetHtmlForControlButtons()
{
$parent = NodeFactory::getInstance('NodeDatabase', 'parent');
$parent->addChild($this->object);
$this->object->expects($this->once())->method('getItemType')->will($this->returnValue('itemType'));
$html = $this->object->getHtmlForControlButtons();
$this->assertStringStartsWith('<span class="navItemControls">', $html);
$this->assertStringEndsWith('</span>', $html);
$this->assertContains('<a href="navigation.php' . URL::getCommon() . '&hideNavItem=true&itemType=itemType&itemName=child' . '&dbName=parent" class="hideNavItem ajax">', $html);
}
示例3: PMA_getHtmlForFilter
/**
* Returns the html for the list filter
*
* @param ServerStatusData $ServerStatusData Server status data
*
* @return string
*/
function PMA_getHtmlForFilter($ServerStatusData)
{
$filterAlert = '';
if (!empty($_REQUEST['filterAlert'])) {
$filterAlert = ' checked="checked"';
}
$filterText = '';
if (!empty($_REQUEST['filterText'])) {
$filterText = htmlspecialchars($_REQUEST['filterText']);
}
$dontFormat = '';
if (!empty($_REQUEST['dontFormat'])) {
$dontFormat = ' checked="checked"';
}
$retval = '';
$retval .= '<fieldset id="tableFilter">';
$retval .= '<legend>' . __('Filters') . '</legend>';
$retval .= '<form action="server_status_variables.php' . URL::getCommon() . '">';
$retval .= '<input type="submit" value="' . __('Refresh') . '" />';
$retval .= '<div class="formelement">';
$retval .= '<label for="filterText">' . __('Containing the word:') . '</label>';
$retval .= '<input name="filterText" type="text" id="filterText" ' . 'value="' . $filterText . '" />';
$retval .= '</div>';
$retval .= '<div class="formelement">';
$retval .= '<input' . $filterAlert . ' type="checkbox" ' . 'name="filterAlert" id="filterAlert" />';
$retval .= '<label for="filterAlert">';
$retval .= __('Show only alert values');
$retval .= '</label>';
$retval .= '</div>';
$retval .= '<div class="formelement">';
$retval .= '<select id="filterCategory" name="filterCategory">';
$retval .= '<option value="">' . __('Filter by category…') . '</option>';
foreach ($ServerStatusData->sections as $section_id => $section_name) {
if (isset($ServerStatusData->sectionUsed[$section_id])) {
if (!empty($_REQUEST['filterCategory']) && $_REQUEST['filterCategory'] == $section_id) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$retval .= '<option' . $selected . ' value="' . $section_id . '">';
$retval .= htmlspecialchars($section_name) . '</option>';
}
}
$retval .= '</select>';
$retval .= '</div>';
$retval .= '<div class="formelement">';
$retval .= '<input' . $dontFormat . ' type="checkbox" ' . 'name="dontFormat" id="dontFormat" />';
$retval .= '<label for="dontFormat">';
$retval .= __('Show unformatted values');
$retval .= '</label>';
$retval .= '</div>';
$retval .= '</form>';
$retval .= '</fieldset>';
return $retval;
}
示例4: getHtmlForControlButtons
/**
* Returns HTML for control buttons displayed infront of a node
*
* @return String HTML for control buttons
*/
public function getHtmlForControlButtons()
{
$ret = '';
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['navwork']) {
$db = $this->realParent()->real_name;
$item = $this->real_name;
$ret = '<span class="navItemControls">' . '<a href="navigation.php' . URL::getCommon() . '&hideNavItem=true' . '&itemType=' . urlencode($this->getItemType()) . '&itemName=' . urlencode($item) . '&dbName=' . urlencode($db) . '"' . ' class="hideNavItem ajax">' . PMA\libraries\Util::getImage('hide.png', __('Hide')) . '</a></span>';
}
return $ret;
}
示例5: PMA_getHtmlForDisplayIndexes
/**
* Get HTML for display indexes
*
* @return string $html_output
*/
function PMA_getHtmlForDisplayIndexes()
{
$html_output = '<div id="index_div" class="ajax" >';
$html_output .= PMA\libraries\Index::getHtmlForIndexes($GLOBALS['table'], $GLOBALS['db']);
$html_output .= '<fieldset class="tblFooters print_ignore" style="text-align: ' . 'left;"><form action="tbl_indexes.php" method="post">';
$html_output .= URL::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
$html_output .= sprintf(__('Create an index on %s columns'), '<input type="number" name="added_fields" value="1" ' . 'min="1" required="required" />');
$html_output .= '<input type="hidden" name="create_index" value="1" />' . '<input class="add_index ajax"' . ' type="submit" value="' . __('Go') . '" />';
$html_output .= '</form>' . '</fieldset>' . '</div>';
return $html_output;
}
示例6: getHtmlForControlButtons
/**
* Returns HTML for control buttons displayed infront of a node
*
* @return String HTML for control buttons
*/
public function getHtmlForControlButtons()
{
$ret = '';
$cfgRelation = PMA_getRelationsParam();
if ($cfgRelation['navwork']) {
$db = $this->realParent()->real_name;
$item = $this->real_name;
$params = array('hideNavItem' => true, 'itemType' => $this->getItemType(), 'itemName' => $item, 'dbName' => $db);
$ret = '<span class="navItemControls">' . '<a href="navigation.php' . URL::getCommon($params) . '"' . ' class="hideNavItem ajax">' . PMA\libraries\Util::getImage('hide.png', __('Hide')) . '</a></span>';
}
return $ret;
}
示例7: testPMAGetHtmlForCreateTable
/**
* Test for PMA_getHtmlForCreateTable
*
* @return void
*/
public function testPMAGetHtmlForCreateTable()
{
$db = "pma_db";
//Call the test function
$html = PMA_getHtmlForCreateTable($db);
//getImage
$this->assertContains(PMA\libraries\Util::getImage('b_table_add.png'), $html);
//__('Create table')
$this->assertContains(__('Create table'), $html);
//URL::getHiddenInputs
$this->assertContains(URL::getHiddenInputs($db), $html);
//label
$this->assertContains(__('Name'), $html);
$this->assertContains(__('Number of columns'), $html);
//button
$this->assertContains(__('Go'), $html);
}
示例8: PMA_getHtmlForRelationalFieldSelection
/**
* Function to get html for relational field selection
*
* @param string $db current database
* @param string $table current table
* @param string $field field
* @param array $foreignData foreign column data
* @param string $fieldkey field key
* @param string $current_value current columns's value
*
* @return string
*/
function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData, $fieldkey, $current_value)
{
$gotopage = PMA_getHtmlForGotoPage($foreignData);
$showall = PMA_getHtmlForShowAll($foreignData);
$output = '<form class="ajax" ' . 'id="browse_foreign_form" name="browse_foreign_from" ' . 'action="browse_foreigners.php" method="post">' . '<fieldset>' . URL::getHiddenInputs($db, $table) . '<input type="hidden" name="field" value="' . htmlspecialchars($field) . '" />' . '<input type="hidden" name="fieldkey" value="' . (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
if (isset($_REQUEST['rownumber'])) {
$output .= '<input type="hidden" name="rownumber" value="' . htmlspecialchars($_REQUEST['rownumber']) . '" />';
}
$filter_value = isset($_REQUEST['foreign_filter']) ? htmlspecialchars($_REQUEST['foreign_filter']) : '';
$output .= '<span class="formelement">' . '<label for="input_foreign_filter">' . __('Search:') . '</label>' . '<input type="text" name="foreign_filter" ' . 'id="input_foreign_filter" ' . 'value="' . $filter_value . '" data-old="' . $filter_value . '" ' . '/>' . '<input type="submit" name="submit_foreign_filter" value="' . __('Go') . '" />' . '</span>' . '<span class="formelement">' . $gotopage . '</span>' . '<span class="formelement">' . $showall . '</span>' . '</fieldset>' . '</form>';
$output .= '<table width="100%" id="browse_foreign_table">';
if (!is_array($foreignData['disp_row'])) {
$output .= '</tbody>' . '</table>';
return $output;
}
$header = '<tr>
<th>' . __('Keyname') . '</th>
<th>' . __('Description') . '</th>
<td width="20%"></td>
<th>' . __('Description') . '</th>
<th>' . __('Keyname') . '</th>
</tr>';
$output .= '<thead>' . $header . '</thead>' . "\n" . '<tfoot>' . $header . '</tfoot>' . "\n" . '<tbody>' . "\n";
$descriptions = array();
$keys = array();
foreach ($foreignData['disp_row'] as $relrow) {
if ($foreignData['foreign_display'] != false) {
$descriptions[] = $relrow[$foreignData['foreign_display']];
} else {
$descriptions[] = '';
}
$keys[] = $relrow[$foreignData['foreign_field']];
}
asort($keys);
$horizontal_count = 0;
$odd_row = true;
$indexByDescription = 0;
foreach ($keys as $indexByKeyname => $value) {
list($html, $horizontal_count, $odd_row, $indexByDescription) = PMA_getHtmlForOneKey($horizontal_count, $header, $odd_row, $keys, $indexByKeyname, $descriptions, $indexByDescription, $current_value);
$output .= $html;
}
$output .= '</tbody>' . '</table>';
return $output;
}
示例9: testGetHtmlForUserGroupsTableWithUserGroups
/**
* Tests PMA_getHtmlForUserGroupsTable() function when there are user groups
*
* @return void
*/
public function testGetHtmlForUserGroupsTableWithUserGroups()
{
$expectedQuery = "SELECT * FROM `pmadb`.`usergroups`" . " ORDER BY `usergroup` ASC";
$dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
$dbi->expects($this->once())->method('tryQuery')->with($expectedQuery)->will($this->returnValue(true));
$dbi->expects($this->once())->method('numRows')->withAnyParameters()->will($this->returnValue(1));
$dbi->expects($this->at(2))->method('fetchAssoc')->withAnyParameters()->will($this->returnValue(array('usergroup' => 'usergroup', 'tab' => 'server_sql', 'allowed' => 'Y')));
$dbi->expects($this->at(3))->method('fetchAssoc')->withAnyParameters()->will($this->returnValue(false));
$dbi->expects($this->once())->method('freeResult');
$GLOBALS['dbi'] = $dbi;
$html = PMA_getHtmlForUserGroupsTable();
$this->assertContains('<td>usergroup</td>', $html);
$url_tag = '<a class="" href="server_user_groups.php' . URL::getCommon(array('viewUsers' => 1, 'userGroup' => htmlspecialchars('usergroup')));
$this->assertContains($url_tag, $html);
$url_tag = '<a class="" href="server_user_groups.php' . URL::getCommon(array('editUserGroup' => 1, 'userGroup' => htmlspecialchars('usergroup')));
$this->assertContains($url_tag, $html);
$url_tag = '<a class="deleteUserGroup ajax" href="server_user_groups.php' . URL::getCommon(array('deleteUserGroup' => 1, 'userGroup' => htmlspecialchars('usergroup')));
$this->assertContains($url_tag, $html);
}
示例10: testPMAGetHtmlForChangePassword
/**
* Test for PMA_getHtmlForChangePassword
*
* @return void
*/
public function testPMAGetHtmlForChangePassword()
{
$username = "pma_username";
$hostname = "pma_hostname";
//Call the test function
$html = PMA_getHtmlForChangePassword('change_pw', $username, $hostname);
//PMA_PHP_SELF
$this->assertContains($GLOBALS['PMA_PHP_SELF'], $html);
//URL::getHiddenInputs
$this->assertContains(URL::getHiddenInputs(), $html);
//$username & $hostname
$this->assertContains(htmlspecialchars($username), $html);
$this->assertContains(htmlspecialchars($hostname), $html);
//labels
$this->assertContains(__('Change password'), $html);
$this->assertContains(__('No Password'), $html);
$this->assertContains(__('Password:'), $html);
$this->assertContains(__('Password:'), $html);
}
示例11: PMA_getLanguageSelectorHtml
/**
* Returns HTML code for the language selector
*
* @param boolean $use_fieldset whether to use fieldset for selection
* @param boolean $show_doc whether to show documentation links
*
* @return string
*
* @access public
*/
function PMA_getLanguageSelectorHtml($use_fieldset = false, $show_doc = true)
{
$retval = '';
$available_languages = LanguageManager::getInstance()->sortedLanguages();
// Display language selection only if there
// is more than one language to choose from
if (count($available_languages) > 1) {
$retval .= '<form method="get" action="index.php" class="disableAjax">';
$_form_params = array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
$retval .= URL::getHiddenInputs($_form_params);
// For non-English, display "Language" with emphasis because it's
// not a proper word in the current language; we show it to help
// people recognize the dialog
$language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
if ($show_doc) {
$language_title .= PMA\libraries\Util::showDocu('faq', 'faq7-2');
}
if ($use_fieldset) {
$retval .= '<fieldset><legend lang="en" dir="ltr">' . $language_title . '</legend>';
} else {
$retval .= '<bdo lang="en" dir="ltr"><label for="sel-lang">' . $language_title . ': </label></bdo>';
}
$retval .= '<select name="lang" class="autosubmit" lang="en"' . ' dir="ltr" id="sel-lang">';
foreach ($available_languages as $language) {
//Is current one active?
if ($language->isActive()) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
$retval .= '<option value="' . $language->getCode() . '"' . $selected . '>';
$retval .= $language->getName();
$retval .= '</option>';
}
$retval .= '</select>';
if ($use_fieldset) {
$retval .= '</fieldset>';
}
$retval .= '</form>';
}
return $retval;
}
示例12: PMA_displayFormTop
/**
* Displays top part of the form
*
* @param string $action default: $_SERVER['REQUEST_URI']
* @param string $method 'post' or 'get'
* @param array $hidden_fields array of form hidden fields (key: field name)
*
* @return string
*/
function PMA_displayFormTop($action = null, $method = 'post', $hidden_fields = null)
{
static $has_check_page_refresh = false;
if ($action === null) {
$action = $_SERVER['REQUEST_URI'];
}
if ($method != 'post') {
$method = 'get';
}
$htmlOutput = '<form method="' . $method . '" action="' . htmlspecialchars($action) . '" class="config-form disableAjax">';
$htmlOutput .= '<input type="hidden" name="tab_hash" value="" />';
// we do validation on page refresh when browser remembers field values,
// add a field with known value which will be used for checks
if (!$has_check_page_refresh) {
$has_check_page_refresh = true;
$htmlOutput .= '<input type="hidden" name="check_page_refresh" ' . ' id="check_page_refresh" value="" />' . "\n";
}
$htmlOutput .= URL::getHiddenInputs('', '', 0, 'server') . "\n";
$htmlOutput .= URL::getHiddenFields((array) $hidden_fields);
return $htmlOutput;
}
示例13: PMA_getHtmlForChangePassword
/**
* Get HTML for the Change password dialog
*
* @param string $mode where is the function being called?
* values : 'change_pw' or 'edit_other'
* @param string $username username
* @param string $hostname hostname
*
* @return string html snippet
*/
function PMA_getHtmlForChangePassword($mode, $username, $hostname)
{
/**
* autocomplete feature of IE kills the "onchange" event handler and it
* must be replaced by the "onpropertychange" one in this case
*/
$chg_evt_handler = 'onchange';
$is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';
$html = '<form method="post" id="change_password_form" ' . 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" ' . 'name="chgPassword" ' . 'class="' . ($is_privileges ? 'submenu-item' : '') . '">';
$html .= URL::getHiddenInputs();
if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
$html .= '<input type="hidden" name="username" ' . 'value="' . htmlspecialchars($username) . '" />' . '<input type="hidden" name="hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />';
}
$html .= '<fieldset id="fieldset_change_password">' . '<legend' . ($is_privileges ? ' data-submenu-label="' . __('Change password') . '"' : '') . '>' . __('Change password') . '</legend>' . '<table class="data noclick">' . '<tr class="odd">' . '<td colspan="2">' . '<input type="radio" name="nopass" value="1" id="nopass_1" ' . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; ' . 'this.checked = true" />' . '<label for="nopass_1">' . __('No Password') . '</label>' . '</td>' . '</tr>' . '<tr class="even vmiddle">' . '<td>' . '<input type="radio" name="nopass" value="0" id="nopass_0" ' . 'onclick="document.getElementById(\'text_pma_pw\').focus();" ' . 'checked="checked" />' . '<label for="nopass_0">' . __('Password:') . ' </label>' . '</td>' . '<td>' . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . ' ' . __('Re-type:') . ' ' . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '</td>' . '</tr>';
$serverType = PMA\libraries\Util::getServerType();
$orig_auth_plugin = PMA_getCurrentAuthenticationPlugin('change', $username, $hostname);
$is_superuser = $GLOBALS['dbi']->isSuperuser();
if ($serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50507 || $serverType == 'MariaDB' && PMA_MYSQL_INT_VERSION >= 50200) {
// Provide this option only for 5.7.6+
// OR for privileged users in 5.5.7+
if ($serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50706 || $is_superuser && $mode == 'edit_other') {
$auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown($orig_auth_plugin, 'change_pw', 'new');
$html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td><td>';
$html .= $auth_plugin_dropdown;
$html .= '</td></tr>' . '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
$html .= '<div ' . ($orig_auth_plugin != 'sha256_password' ? 'style="display:none"' : '') . ' id="ssl_reqd_warning_cp">' . Message::notice(__('This method requires using an \'<i>SSL connection</i>\' ' . 'or an \'<i>unencrypted connection that encrypts the ' . 'password using RSA</i>\'; while connecting to the server.') . PMA\libraries\Util::showMySQLDocu('sha256-authentication-plugin'))->getDisplay() . '</div>';
} else {
$html .= '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
}
} else {
$auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown($orig_auth_plugin, 'change_pw', 'old');
$html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td><td>';
$html .= $auth_plugin_dropdown . '</td></tr>' . '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
}
$html .= '</fieldset>' . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . '<input type="hidden" name="change_pw" value="1" />' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
return $html;
}
示例14: PMA_getHtmlForSubMenusOnUsersPage
/**
* Get HTML for secondary level menu tabs on 'Users' page
*
* @param string $selfUrl Url of the file
*
* @return string HTML for secondary level menu tabs on 'Users' page
*/
function PMA_getHtmlForSubMenusOnUsersPage($selfUrl)
{
$url_params = URL::getCommon();
$items = array(array('name' => __('User accounts overview'), 'url' => 'server_privileges.php', 'specific_params' => '&viewing_mode=server'));
if ($GLOBALS['is_superuser']) {
$items[] = array('name' => __('User groups'), 'url' => 'server_user_groups.php', 'specific_params' => '');
}
$retval = '<ul id="topmenu2">';
foreach ($items as $item) {
$class = '';
if ($item['url'] === $selfUrl) {
$class = ' class="tabactive"';
}
$retval .= '<li>';
$retval .= '<a' . $class;
$retval .= ' href="' . $item['url'] . $url_params . $item['specific_params'] . '">';
$retval .= $item['name'];
$retval .= '</a>';
$retval .= '</li>';
}
$retval .= '</ul>';
$retval .= '<div class="clearfloat"></div>';
return $retval;
}
示例15: testGetItemUnhideDialog
/**
* Tests getItemUnhideDialog() method.
*
* @return void
* @test
*/
public function testGetItemUnhideDialog()
{
$expectedQuery = "SELECT `item_name`, `item_type`" . " FROM `pmadb`.`navigationhiding`" . " WHERE `username`='user' AND `db_name`='db' AND `table_name`=''";
$dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
$dbi->expects($this->once())->method('tryQuery')->with($expectedQuery)->will($this->returnValue(true));
$dbi->expects($this->at(1))->method('fetchArray')->will($this->returnValue(array('item_name' => 'tableName', 'item_type' => 'table')));
$dbi->expects($this->at(2))->method('fetchArray')->will($this->returnValue(array('item_name' => 'viewName', 'item_type' => 'view')));
$dbi->expects($this->at(3))->method('fetchArray')->will($this->returnValue(false));
$dbi->expects($this->once())->method('freeResult');
$GLOBALS['dbi'] = $dbi;
$html = $this->object->getItemUnhideDialog('db');
$this->assertContains('<td>tableName</td>', $html);
$this->assertContains('<a href="navigation.php' . URL::getCommon() . '&unhideNavItem=true&itemType=table&itemName=tableName&dbName=db"' . ' class="unhideNavItem ajax">', $html);
}