當前位置: 首頁>>代碼示例>>PHP>>正文


PHP libraries\Util類代碼示例

本文整理匯總了PHP中PMA\libraries\Util的典型用法代碼示例。如果您正苦於以下問題:PHP Util類的具體用法?PHP Util怎麽用?PHP Util使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Util類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Initialises the class
  *
  * @param string $name     An identifier for the new node
  * @param int    $type     Type of node, may be one of CONTAINER or OBJECT
  * @param bool   $is_group Whether this object has been created
  *                         while grouping nodes
  */
 public function __construct($name, $type = Node::OBJECT, $is_group = false)
 {
     parent::__construct($name, $type, $is_group);
     $this->icon = PMA\libraries\Util::getImage('b_routines.png', __('Function'));
     $this->links = array('text' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=FUNCTION' . '&edit_item=1&token=' . $_SESSION[' PMA_token '], 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=FUNCTION' . '&execute_dialog=1&token=' . $_SESSION[' PMA_token ']);
     $this->classes = 'function';
 }
開發者ID:pjiahao,項目名稱:phpmyadmin,代碼行數:15,代碼來源:NodeFunction.php

示例2: __construct

 /**
  * Initialises the class
  *
  * @param string $name     An identifier for the new node
  * @param int    $type     Type of node, may be one of CONTAINER or OBJECT
  * @param bool   $is_group Whether this object has been created
  *                         while grouping nodes
  */
 public function __construct($name, $type = Node::OBJECT, $is_group = false)
 {
     parent::__construct($name, $type, $is_group);
     $this->icon = PMA\libraries\Util::getImage('b_triggers.png');
     $this->links = array('text' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%3$s&item_name=%1$s&edit_item=1' . '&token=' . $_SESSION[' PMA_token '], 'icon' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&db=%3$s&item_name=%1$s&export_item=1' . '&token=' . $_SESSION[' PMA_token ']);
     $this->classes = 'trigger';
 }
開發者ID:itgsod-philip-skalander,項目名稱:phpmyadmin,代碼行數:15,代碼來源:NodeTrigger.php

示例3: setUp

 /**
  * Prepares environment for the test.
  *
  * @return void
  */
 public function setUp()
 {
     //$_REQUEST
     $_REQUEST['log'] = "index1";
     $_REQUEST['pos'] = 3;
     //$GLOBALS
     $GLOBALS['cfg']['MaxRows'] = 10;
     $GLOBALS['server'] = 1;
     $GLOBALS['cfg']['ServerDefault'] = "server";
     $GLOBALS['cfg']['RememberSorting'] = true;
     $GLOBALS['cfg']['SQP'] = array();
     $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 1000;
     $GLOBALS['cfg']['ShowSQL'] = true;
     $GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
     $GLOBALS['cfg']['LimitChars'] = 100;
     $GLOBALS['table'] = "table";
     $GLOBALS['pmaThemeImage'] = 'image';
     //$_SESSION
     $_SESSION['PMA_Theme'] = Theme::load('./themes/pmahomme');
     $_SESSION['PMA_Theme'] = new Theme();
     Util::cacheSet('profiling_supported', true);
     $binary_log_file_names = array();
     $binary_log_file_names[] = array("Log_name" => "index1", "File_size" => 100);
     $binary_log_file_names[] = array("Log_name" => "index2", "File_size" => 200);
     //Mock DBI
     $dbi = $this->getMockBuilder('PMA\\libraries\\DatabaseInterface')->disableOriginalConstructor()->getMock();
     $dbi->expects($this->once())->method('fetchResult')->will($this->returnValue($binary_log_file_names));
     $container = Container::getDefaultContainer();
     $container->set('dbi', $dbi);
 }
開發者ID:pboutin44,項目名稱:maintest,代碼行數:35,代碼來源:ServerBinlogControllerTest.php

示例4: __construct

 /**
  * Initialises the class
  *
  * @param string $name     An identifier for the new node
  * @param int    $type     Type of node, may be one of CONTAINER or OBJECT
  * @param bool   $is_group Whether this object has been created
  *                         while grouping nodes
  */
 public function __construct($name, $type = Node::OBJECT, $is_group = false)
 {
     parent::__construct($name, $type, $is_group);
     $this->icon = PMA\libraries\Util::getImage('b_events.png');
     $this->links = array('text' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&edit_item=1', 'icon' => 'db_events.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&export_item=1');
     $this->classes = 'event';
 }
開發者ID:phpmyadmin,項目名稱:phpmyadmin,代碼行數:15,代碼來源:NodeEvent.php

示例5: factory

 /**
  * Returns the singleton instance of geometric class of the given type.
  *
  * @param string $type type of the geometric object
  *
  * @return GISGeometry the singleton instance of geometric class
  *                          of the given type
  *
  * @access public
  * @static
  */
 public static function factory($type)
 {
     $type_lower = strtolower($type);
     $file = './libraries/gis/GIS' . ucfirst($type_lower) . '.php';
     if (!PMA_isValid($type_lower, PMA\libraries\Util::getGISDatatypes()) || !file_exists($file)) {
         return false;
     }
     if (include_once $file) {
         switch (strtoupper($type)) {
             case 'MULTIPOLYGON':
                 return GISMultipolygon::singleton();
             case 'POLYGON':
                 return GISPolygon::singleton();
             case 'MULTIPOINT':
                 return GISMultipoint::singleton();
             case 'POINT':
                 return GISPoint::singleton();
             case 'MULTILINESTRING':
                 return GISMultilinestring::singleton();
             case 'LINESTRING':
                 return GISLinestring::singleton();
             case 'GEOMETRYCOLLECTION':
                 return GISGeometrycollection::singleton();
             default:
                 return false;
         }
     } else {
         return false;
     }
 }
開發者ID:ryanfmurphy,項目名稱:phpmyadmin,代碼行數:41,代碼來源:GISFactory.php

示例6: __construct

 /**
  * Initialises the class
  *
  * @param string $name     An identifier for the new node
  * @param int    $type     Type of node, may be one of CONTAINER or OBJECT
  * @param bool   $is_group Whether this object has been created
  *                         while grouping nodes
  */
 public function __construct($name, $type = Node::OBJECT, $is_group = false)
 {
     parent::__construct($name, $type, $is_group);
     $this->icon = PMA\libraries\Util::getImage('b_routines.png', __('Procedure'));
     $this->links = array('text' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=PROCEDURE' . '&edit_item=1', 'icon' => 'db_routines.php?server=' . $GLOBALS['server'] . '&db=%2$s&item_name=%1$s&item_type=PROCEDURE' . '&execute_dialog=1');
     $this->classes = 'procedure';
 }
開發者ID:phpmyadmin,項目名稱:phpmyadmin,代碼行數:15,代碼來源:NodeProcedure.php

示例7: getLatestVersion

 /**
  * Returns information with latest version from phpmyadmin.net
  *
  * @return object JSON decoded object with the data
  */
 public function getLatestVersion()
 {
     if (!$GLOBALS['cfg']['VersionCheck']) {
         return null;
     }
     // Get response text from phpmyadmin.net or from the session
     // Update cache every 6 hours
     if (isset($_SESSION['cache']['version_check']) && time() < $_SESSION['cache']['version_check']['timestamp'] + 3600 * 6) {
         $save = false;
         $response = $_SESSION['cache']['version_check']['response'];
     } else {
         $save = true;
         $file = 'https://www.phpmyadmin.net/home_page/version.json';
         $response = Util::httpRequest($file, "GET");
     }
     $response = $response ? $response : '{}';
     /* Parse response */
     $data = json_decode($response);
     /* Basic sanity checking */
     if (!is_object($data) || empty($data->version) || empty($data->releases) || empty($data->date)) {
         return null;
     }
     if ($save) {
         $_SESSION['cache']['version_check'] = array('response' => $response, 'timestamp' => time());
     }
     return $data;
 }
開發者ID:phpmyadmin,項目名稱:phpmyadmin,代碼行數:32,代碼來源:VersionInformation.php

示例8: __construct

 /**
  * Initialises the class
  *
  * @param string $name     An identifier for the new node
  * @param int    $type     Type of node, may be one of CONTAINER or OBJECT
  * @param bool   $is_group Whether this object has been created
  *                         while grouping nodes
  */
 public function __construct($name, $type = Node::OBJECT, $is_group = false)
 {
     parent::__construct($name, $type, $is_group);
     $this->icon = PMA\libraries\Util::getImage('b_props.png', __('View'));
     $this->links = array('text' => 'sql.php?server=' . $GLOBALS['server'] . '&amp;db=%2$s&amp;table=%1$s&amp;pos=0', 'icon' => 'tbl_structure.php?server=' . $GLOBALS['server'] . '&amp;db=%2$s&amp;table=%1$s');
     $this->classes = 'view';
 }
開發者ID:phpmyadmin,項目名稱:phpmyadmin,代碼行數:15,代碼來源:NodeView.php

示例9: getLatestVersion

 /**
  * Returns information with latest version from phpmyadmin.net
  *
  * @return object JSON decoded object with the data
  */
 public function getLatestVersion()
 {
     if (!$GLOBALS['cfg']['VersionCheck']) {
         return null;
     }
     // wait 3s at most for server response, it's enough to get information
     // from a working server
     $connection_timeout = 3;
     $response = '{}';
     // Get response text from phpmyadmin.net or from the session
     // Update cache every 6 hours
     if (isset($_SESSION['cache']['version_check']) && time() < $_SESSION['cache']['version_check']['timestamp'] + 3600 * 6) {
         $save = false;
         $response = $_SESSION['cache']['version_check']['response'];
     } else {
         $save = true;
         $file = 'https://www.phpmyadmin.net/home_page/version.json';
         if (ini_get('allow_url_fopen')) {
             $context = array('http' => array('request_fulluri' => true, 'timeout' => $connection_timeout));
             $context = Util::handleContext($context);
             if (!defined('TESTSUITE')) {
                 session_write_close();
             }
             $response = file_get_contents($file, false, stream_context_create($context));
         } else {
             if (function_exists('curl_init')) {
                 $curl_handle = curl_init($file);
                 if ($curl_handle === false) {
                     return null;
                 }
                 $curl_handle = Util::configureCurl($curl_handle);
                 curl_setopt($curl_handle, CURLOPT_HEADER, false);
                 curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
                 curl_setopt($curl_handle, CURLOPT_TIMEOUT, $connection_timeout);
                 if (!defined('TESTSUITE')) {
                     session_write_close();
                 }
                 $response = curl_exec($curl_handle);
             }
         }
     }
     /* Parse response */
     $data = json_decode($response);
     /* Basic sanity checking */
     if (!is_object($data) || empty($data->version) || empty($data->releases) || empty($data->date)) {
         return null;
     }
     if ($save) {
         if (!isset($_SESSION) && !defined('TESTSUITE')) {
             ini_set('session.use_only_cookies', 'false');
             ini_set('session.use_cookies', 'false');
             ini_set('session.use_trans_sid', 'false');
             ini_set('session.cache_limiter', 'nocache');
             session_start();
         }
         $_SESSION['cache']['version_check'] = array('response' => $response, 'timestamp' => time());
     }
     return $data;
 }
開發者ID:flash1452,項目名稱:phpmyadmin,代碼行數:64,代碼來源:VersionInformation.php

示例10: 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
  */
 public function resolveTypeSize($formatted_size)
 {
     if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)) {
         $value = PMA\libraries\Util::extractValueFromFormattedSize($formatted_size);
     } else {
         $value = $formatted_size;
     }
     return PMA\libraries\Util::formatByteDown($value);
 }
開發者ID:Stony-Brook-University,項目名稱:doitsbu,代碼行數:17,代碼來源:Pbxt.php

示例11: 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' . PMA_URL_getCommon() . '&hideNavItem=true' . '&itemType=' . urlencode($this->getItemType()) . '&itemName=' . urlencode($item) . '&dbName=' . urlencode($db) . '"' . ' class="hideNavItem ajax">' . PMA\libraries\Util::getImage('lightbulb_off.png', __('Hide')) . '</a></span>';
     }
     return $ret;
 }
開發者ID:itgsod-philip-skalander,項目名稱:phpmyadmin,代碼行數:16,代碼來源:NodeDatabaseChild.php

示例12: 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;
 }
開發者ID:phpmyadmin,項目名稱:phpmyadmin,代碼行數:17,代碼來源:NodeDatabaseChild.php

示例13: __construct

 /**
  * Initialises the class
  *
  * @param string $name An identifier for the new node
  */
 public function __construct($name)
 {
     parent::__construct($name, Node::CONTAINER);
     if ($GLOBALS['is_create_db_priv'] && $GLOBALS['cfg']['ShowCreateDb'] !== false) {
         $new = NodeFactory::getInstance('Node', _pgettext('Create new database', 'New'));
         $new->isNew = true;
         $new->icon = PMA\libraries\Util::getImage('b_newdb.png', '');
         $new->links = array('text' => 'server_databases.php?server=' . $GLOBALS['server'], 'icon' => 'server_databases.php?server=' . $GLOBALS['server']);
         $new->classes = 'new_database italics';
         $this->addChild($new);
     }
 }
開發者ID:phpmyadmin,項目名稱:phpmyadmin,代碼行數:17,代碼來源:NodeDatabaseContainer.php

示例14: Footer

 /**
  * This function must be named "Footer" to work with the TCPDF library
  *
  * @return void
  */
 public function Footer()
 {
     // Check if footer for this page already exists
     if (!isset($this->footerset[$this->page])) {
         $this->SetY(-15);
         $this->SetFont(PMA_PDF_FONT, '', 14);
         $this->Cell(0, 6, __('Page number:') . ' ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 'T', 0, 'C');
         $this->Cell(0, 6, Util::localisedDate(), 0, 1, 'R');
         $this->SetY(20);
         // set footerset
         $this->footerset[$this->page] = 1;
     }
 }
開發者ID:iShareLife,項目名稱:phpmyadmin,代碼行數:18,代碼來源:PDF.php

示例15: __construct

 /**
  * Initialises the class
  */
 public function __construct()
 {
     parent::__construct(__('Triggers'), Node::CONTAINER);
     $this->icon = PMA\libraries\Util::getImage('b_triggers.png');
     $this->links = array('text' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&amp;db=%2$s&amp;table=%1$s&amp;token=' . $_SESSION[' PMA_token '], 'icon' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&amp;db=%2$s&amp;table=%1$s&amp;token=' . $_SESSION[' PMA_token ']);
     $this->real_name = 'triggers';
     $new = NodeFactory::getInstance('Node', _pgettext('Create new trigger', 'New'));
     $new->isNew = true;
     $new->icon = PMA\libraries\Util::getImage('b_trigger_add.png', '');
     $new->links = array('text' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&amp;db=%3$s&amp;token=' . $_SESSION[' PMA_token '] . '&amp;add_item=1', 'icon' => 'db_triggers.php?server=' . $GLOBALS['server'] . '&amp;db=%3$s&amp;token=' . $_SESSION[' PMA_token '] . '&amp;add_item=1');
     $new->classes = 'new_trigger italics';
     $this->addChild($new);
 }
開發者ID:itgsod-philip-skalander,項目名稱:phpmyadmin,代碼行數:16,代碼來源:NodeTriggerContainer.php


注:本文中的PMA\libraries\Util類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。