当前位置: 首页>>代码示例>>PHP>>正文


PHP PMA_CommonFunctions类代码示例

本文整理汇总了PHP中PMA_CommonFunctions的典型用法代码示例。如果您正苦于以下问题:PHP PMA_CommonFunctions类的具体用法?PHP PMA_CommonFunctions怎么用?PHP PMA_CommonFunctions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PMA_CommonFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 /**
  * Returns the singleton PMA_CommonFunctions object
  *
  * @return PMA_CommonFunctions object
  */
 public static function getInstance()
 {
     if (empty(self::$_instance)) {
         self::$_instance = new PMA_CommonFunctions();
     }
     return self::$_instance;
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:12,代码来源:CommonFunctions.class.php

示例2: testExtractValueFromFormattedSizeK

 function testExtractValueFromFormattedSizeK()
 {
     $this->assertEquals(
         262144,
         PMA_CommonFunctions::getInstance()->extractValueFromFormattedSize("256K")
     );
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:7,代码来源:PMA_extractValueFromFormattedSize_test.php

示例3: testConvert_bit_default_value_test

    /**
     * @dataProvider dataProvider
     */
    function testConvert_bit_default_value_test($bit, $val)
    {
        $this->assertEquals(
            $val, PMA_CommonFunctions::getInstance()->convertBitDefaultValue($bit)
        );

    }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:10,代码来源:PMA_convert_bit_default_value_test.php

示例4: getCommonFunctions

 /**
  * Get CommmonFunctions
  * 
  * @return CommonFunctions object
  */
 public function getCommonFunctions()
 {
     if (is_null($this->_common_functions)) {
         $this->_common_functions = PMA_CommonFunctions::getInstance();
     }
     return $this->_common_functions;
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:12,代码来源:User_Schema.class.php

示例5: testNotSupportedDataTypes

 function testNotSupportedDataTypes()
 {
     $no_support_types = array();
     $this->assertEquals(
         $no_support_types, PMA_CommonFunctions::getInstance()->unsupportedDatatypes()
     );
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:7,代码来源:PMA_unsupportedDatatypes_test.php

示例6: PMA_relationsCleanupDatabase

/**
 * Cleanup database related relation stuff
 *
 * @param string $db
 */
function PMA_relationsCleanupDatabase($db)
{
    $common_functions = PMA_CommonFunctions::getInstance();
    $cfgRelation = PMA_getRelationsParam();
    if ($cfgRelation['commwork']) {
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) . ' WHERE db_name  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
    }
    if ($cfgRelation['bookmarkwork']) {
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['bookmark']) . ' WHERE dbase  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
    }
    if ($cfgRelation['displaywork']) {
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_info']) . ' WHERE db_name  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
    }
    if ($cfgRelation['pdfwork']) {
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['pdf_pages']) . ' WHERE db_name  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['table_coords']) . ' WHERE db_name  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
    }
    if ($cfgRelation['designerwork']) {
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['designer_coords']) . ' WHERE db_name  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
    }
    if ($cfgRelation['relwork']) {
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) . ' WHERE master_db  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
        $remove_query = 'DELETE FROM ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) . ' WHERE foreign_db  = \'' . $common_functions->sqlAddSlashes($db) . '\'';
        PMA_queryAsControlUser($remove_query);
    }
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:38,代码来源:relation_cleanup.lib.php

示例7: testBuildActionTitles

    function testBuildActionTitles()
    {
        $titles = array();
        $common = PMA_CommonFunctions::getInstance();

        $titles['Browse']     = $common->getIcon('b_browse.png', __('Browse'));
        $titles['NoBrowse']   = $common->getIcon('bd_browse.png', __('Browse'));
        $titles['Search']     = $common->getIcon('b_select.png', __('Search'));
        $titles['NoSearch']   = $common->getIcon('bd_select.png', __('Search'));
        $titles['Insert']     = $common->getIcon('b_insrow.png', __('Insert'));
        $titles['NoInsert']   = $common->getIcon('bd_insrow.png', __('Insert'));
        $titles['Structure']  = $common->getIcon('b_props.png', __('Structure'));
        $titles['Drop']       = $common->getIcon('b_drop.png', __('Drop'));
        $titles['NoDrop']     = $common->getIcon('bd_drop.png', __('Drop'));
        $titles['Empty']      = $common->getIcon('b_empty.png', __('Empty'));
        $titles['NoEmpty']    = $common->getIcon('bd_empty.png', __('Empty'));
        $titles['Edit']       = $common->getIcon('b_edit.png', __('Edit'));
        $titles['NoEdit']     = $common->getIcon('bd_edit.png', __('Edit'));
        $titles['Export']     = $common->getIcon('b_export.png', __('Export'));
        $titles['NoExport']   = $common->getIcon('bd_export.png', __('Export'));
        $titles['Execute']    = $common->getIcon('b_nextpage.png', __('Execute'));
        $titles['NoExecute']  = $common->getIcon('bd_nextpage.png', __('Execute'));

        $this->assertEquals($titles, $common->buildActionTitles());

    }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:26,代码来源:PMA_buildActionTitles_test.php

示例8: PMA_RTE_handleExport

/**
 * This function is called from one of the other functions in this file
 * and it completes the handling of the export functionality.
 *
 * @param string  $item_name    The name of the item that we are exporting
 * @param string  $export_data  The SQL query to create the requested item
 */
function PMA_RTE_handleExport($item_name, $export_data)
{
    global $db;
    $item_name = htmlspecialchars(PMA_CommonFunctions::getInstance()->backquote($_GET['item_name']));
    if ($export_data !== false) {
        $export_data = '<textarea cols="40" rows="15" style="width: 100%;">' . htmlspecialchars(trim($export_data)) . '</textarea>';
        $title = sprintf(PMA_RTE_getWord('export'), $item_name);
        if ($GLOBALS['is_ajax_request'] == true) {
            $response = PMA_Response::getInstance();
            $response->addJSON('message', $export_data);
            $response->addJSON('title', $title);
            exit;
        } else {
            echo "<fieldset>\n" . "<legend>{$title}</legend>\n" . $export_data . "</fieldset>\n";
        }
    } else {
        $_db = htmlspecialchars(PMA_CommonFunctions::getInstance()->backquote($db));
        $response = __('Error in Processing Request') . ' : ' . sprintf(PMA_RTE_getWord('not_found'), $item_name, $_db);
        $response = PMA_message::error($response);
        if ($GLOBALS['is_ajax_request'] == true) {
            $response = PMA_Response::getInstance();
            $response->isSuccess(false);
            $response->addJSON('message', $response);
            exit;
        } else {
            $response->display();
        }
    }
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:36,代码来源:rte_export.lib.php

示例9: PMA_getNewTransformationDataSql

/**
 * Get SQL query for store new transformation details of a VIEW
 *
 * @param mysqli_result $pma_tranformation_data Result set of SQL execution
 * @param array         $column_map             Details of VIEW columns
 * @param string        $view_name              Name of the VIEW
 * @param string        $db                     Database name of the VIEW
 *
 * @return string $new_transformations_sql SQL query for new tranformations
 */
function PMA_getNewTransformationDataSql($pma_tranformation_data, $column_map, $view_name, $db)
{
    $common_functions = PMA_CommonFunctions::getInstance();
    $cfgRelation = PMA_getRelationsParam();
    // Need to store new transformation details for VIEW
    $new_transformations_sql = 'INSERT INTO ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) . ' (`db_name`, `table_name`, `column_name`, `comment`, ' . '`mimetype`, `transformation`, `transformation_options`)' . ' VALUES ';
    $column_count = 0;
    $add_comma = false;
    while ($data_row = PMA_DBI_fetch_assoc($pma_tranformation_data)) {
        foreach ($column_map as $column) {
            if ($data_row['table_name'] == $column['table_name'] && $data_row['column_name'] == $column['refering_column']) {
                $new_transformations_sql .= $add_comma ? ', ' : '';
                $new_transformations_sql .= '(' . '\'' . $db . '\', ' . '\'' . $view_name . '\', ' . '\'';
                $new_transformations_sql .= isset($column['real_column']) ? $column['real_column'] : $column['refering_column'];
                $new_transformations_sql .= '\', ' . '\'' . $data_row['comment'] . '\', ' . '\'' . $data_row['mimetype'] . '\', ' . '\'' . $data_row['transformation'] . '\', ' . '\'' . $common_functions->sqlAddSlashes($data_row['transformation_options']) . '\')';
                $add_comma = true;
                $column_count++;
                break;
            }
        }
        if ($column_count == count($column_map)) {
            break;
        }
    }
    return $column_count > 0 ? $new_transformations_sql : '';
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:36,代码来源:tbl_views.lib.php

示例10: PMA_printGitRevision

/**
* Prints details about the current Git commit revision
*
* @return void
*/
function PMA_printGitRevision()
{
    $common_functions = PMA_CommonFunctions::getInstance();
    if (!$GLOBALS['PMA_Config']->get('PMA_VERSION_GIT')) {
        $response = PMA_Response::getInstance();
        $response->isSuccess(false);
        return;
    }
    // load revision data from repo
    $GLOBALS['PMA_Config']->checkGitRevision();
    // if using a remote commit fast-forwarded, link to Github
    $commit_hash = substr($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH'), 0, 7);
    $commit_hash = '<strong title="' . htmlspecialchars($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_MESSAGE')) . '">' . $commit_hash . '</strong>';
    if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTECOMMIT')) {
        $commit_hash = '<a href="' . PMA_linkURL('https://github.com/phpmyadmin/phpmyadmin/commit/' . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITHASH')) . '" target="_blank">' . $commit_hash . '</a>';
    }
    $branch = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH');
    if ($GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_ISREMOTEBRANCH')) {
        $branch = '<a href="' . PMA_linkURL('https://github.com/phpmyadmin/phpmyadmin/tree/' . $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_BRANCH')) . '" target="_blank">' . $branch . '</a>';
    }
    if ($branch !== false) {
        $branch = sprintf(__('%1$s from %2$s branch'), $commit_hash, $branch);
    } else {
        $branch = $commit_hash . ' (' . __('no branch') . ')';
    }
    $committer = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_COMMITTER');
    $author = $GLOBALS['PMA_Config']->get('PMA_VERSION_GIT_AUTHOR');
    PMA_printListItem(__('Git revision') . ': ' . $branch . ',<br /> ' . sprintf(__('committed on %1$s by %2$s'), $common_functions->localisedDate(strtotime($committer['date'])), '<a href="' . PMA_linkURL('mailto:' . $committer['email']) . '">' . htmlspecialchars($committer['name']) . '</a>') . ($author != $committer ? ', <br />' . sprintf(__('authored on %1$s by %2$s'), $common_functions->localisedDate(strtotime($author['date'])), '<a href="' . PMA_linkURL('mailto:' . $author['email']) . '">' . htmlspecialchars($author['name']) . '</a>') : ''), 'li_pma_version_git', null, null, null);
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:34,代码来源:display_git_revision.lib.php

示例11: testMaximumUploadSize

    /**
     * @dataProvider dataProvider
     * @return void
     */
    function testMaximumUploadSize($size, $unit, $res)
    {
        $this->assertEquals(
            "(" . __('Max: '). $res . $unit .")",
            PMA_CommonFunctions::getInstance()->getFormattedMaximumUploadSize($size)
        );

    }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:12,代码来源:PMA_getFormattedMaximumUploadSize_test.php

示例12: resolveTypeSize

 /**
  * returns the pbxt engine specific handling for
  * PMA_ENGINE_DETAILS_TYPE_SIZE variables.
  *
  * @param string $formatted_size the size expression (for example 8MB)
  *
  * @return string the formatted value and its unit
  */
 function resolveTypeSize($formatted_size)
 {
     $common_functions = PMA_CommonFunctions::getInstance();
     if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)) {
         $value = $common_functions->extractValueFromFormattedSize($formatted_size);
     } else {
         $value = $formatted_size;
     }
     return $common_functions->formatByteDown($value);
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:18,代码来源:pbxt.lib.php

示例13: testGetCheckboxCheckedOnclick

    function testGetCheckboxCheckedOnclick()
    {
        $name = "test_display_html_checkbox";
        $label = "text_label_for_checkbox";

        $this->assertEquals(
            PMA_CommonFunctions::getInstance()->getCheckbox($name, $label, true, true),
            '<input type="checkbox" name="' . $name . '" id="' . $name . '" checked="checked" class="autosubmit" /><label for="' . $name . '">' . $label . '</label>'
        );
    }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:10,代码来源:PMA_getCheckbox_test.php

示例14: testExpandEscape

 /**
  * Test case for expanding strings with escaping
  *
  * @param string $in  string to evaluate
  * @param string $out expected output
  *
  * @return void
  *
  * @dataProvider provider
  */
 public function testExpandEscape($in, $out)
 {
     $out = str_replace('PMA_VERSION', PMA_VERSION, $out);
     $this->assertEquals(
         htmlspecialchars($out),
         PMA_CommonFunctions::getInstance()->expandUserString(
             $in, 'htmlspecialchars'
         )
     );
 }
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:20,代码来源:PMA_expandUserString_test.php

示例15: PMA_jsFormat

/**
 * Format a string so it can be a string inside JavaScript code inside an
 * eventhandler (onclick, onchange, on..., ).
 * This function is used to displays a javascript confirmation box for
 * "DROP/DELETE/ALTER" queries.
 *
 * @param string  $a_string       the string to format
 * @param boolean $add_backquotes whether to add backquotes to the string or not
 *
 * @return string   the formatted string
 *
 * @access  public
 */
function PMA_jsFormat($a_string = '', $add_backquotes = true)
{
    if (is_string($a_string)) {
        $a_string = htmlspecialchars($a_string);
        $a_string = PMA_escapeJsString($a_string);
        // Needed for inline javascript to prevent some browsers
        // treating it as a anchor
        $a_string = str_replace('#', '\\#', $a_string);
    }
    return $add_backquotes ? PMA_CommonFunctions::getInstance()->backquote($a_string) : $a_string;
}
开发者ID:rajatsinghal,项目名称:phpmyadmin,代码行数:24,代码来源:js_escape.lib.php


注:本文中的PMA_CommonFunctions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。