idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
46,100 | public function checkField ( $ locator ) { $ field = $ this -> findField ( $ locator ) ; if ( null === $ field ) { throw new ElementNotFoundException ( $ this -> getDriver ( ) , 'form field' , 'id|name|label|value' , $ locator ) ; } $ field -> check ( ) ; } | Checks checkbox with specified locator . |
46,101 | public function uncheckField ( $ locator ) { $ field = $ this -> findField ( $ locator ) ; if ( null === $ field ) { throw new ElementNotFoundException ( $ this -> getDriver ( ) , 'form field' , 'id|name|label|value' , $ locator ) ; } $ field -> uncheck ( ) ; } | Unchecks checkbox with specified locator . |
46,102 | public function selectFieldOption ( $ locator , $ value , $ multiple = false ) { $ field = $ this -> findField ( $ locator ) ; if ( null === $ field ) { throw new ElementNotFoundException ( $ this -> getDriver ( ) , 'form field' , 'id|name|label|value' , $ locator ) ; } $ field -> selectOption ( $ value , $ multiple ) ... | Selects option from select field with specified locator . |
46,103 | public function attachFileToField ( $ locator , $ path ) { $ field = $ this -> findField ( $ locator ) ; if ( null === $ field ) { throw new ElementNotFoundException ( $ this -> getDriver ( ) , 'form field' , 'id|name|label|value' , $ locator ) ; } $ field -> attachFile ( $ path ) ; } | Attach file to file field with specified locator . |
46,104 | public function addressNotEquals ( $ page ) { $ expected = $ this -> cleanUrl ( $ page ) ; $ actual = $ this -> getCurrentUrlPath ( ) ; $ this -> assert ( $ actual !== $ expected , sprintf ( 'Current page is "%s", but should not be.' , $ actual ) ) ; } | Checks that current session address is not equals to provided one . |
46,105 | public function addressMatches ( $ regex ) { $ actual = $ this -> getCurrentUrlPath ( ) ; $ message = sprintf ( 'Current page "%s" does not match the regex "%s".' , $ actual , $ regex ) ; $ this -> assert ( ( bool ) preg_match ( $ regex , $ actual ) , $ message ) ; } | Checks that current session address matches regex . |
46,106 | public function cookieEquals ( $ name , $ value ) { $ this -> cookieExists ( $ name ) ; $ actualValue = $ this -> session -> getCookie ( $ name ) ; $ message = sprintf ( 'Cookie "%s" value is "%s", but should be "%s".' , $ name , $ actualValue , $ value ) ; $ this -> assert ( $ actualValue == $ value , $ message ) ; } | Checks that specified cookie exists and its value equals to a given one . |
46,107 | public function cookieExists ( $ name ) { $ message = sprintf ( 'Cookie "%s" is not set, but should be.' , $ name ) ; $ this -> assert ( $ this -> session -> getCookie ( $ name ) !== null , $ message ) ; } | Checks that specified cookie exists . |
46,108 | public function statusCodeEquals ( $ code ) { $ actual = $ this -> session -> getStatusCode ( ) ; $ message = sprintf ( 'Current response status code is %d, but %d expected.' , $ actual , $ code ) ; $ this -> assert ( intval ( $ code ) === intval ( $ actual ) , $ message ) ; } | Checks that current response code equals to provided one . |
46,109 | public function responseHeaderEquals ( $ name , $ value ) { $ actual = $ this -> session -> getResponseHeader ( $ name ) ; $ message = sprintf ( 'Current response header "%s" is "%s", but "%s" expected.' , $ name , $ actual , $ value ) ; $ this -> assert ( $ value === $ actual , $ message ) ; } | Checks that current response header equals value . |
46,110 | public function responseHeaderContains ( $ name , $ value ) { $ actual = $ this -> session -> getResponseHeader ( $ name ) ; $ message = sprintf ( 'The text "%s" was not found anywhere in the "%s" response header.' , $ value , $ name ) ; $ this -> assert ( false !== stripos ( $ actual , $ value ) , $ message ) ; } | Checks that current response header contains value . |
46,111 | public function responseHeaderMatches ( $ name , $ regex ) { $ actual = $ this -> session -> getResponseHeader ( $ name ) ; $ message = sprintf ( 'The pattern "%s" was not found anywhere in the "%s" response header.' , $ regex , $ name ) ; $ this -> assert ( ( bool ) preg_match ( $ regex , $ actual ) , $ message ) ; } | Checks that current response header matches regex . |
46,112 | public function responseHeaderNotMatches ( $ name , $ regex ) { $ actual = $ this -> session -> getResponseHeader ( $ name ) ; $ message = sprintf ( 'The pattern "%s" was found in the text of the "%s" response header, but it should not.' , $ regex , $ name ) ; $ this -> assert ( ! preg_match ( $ regex , $ actual ) , $ ... | Checks that current response header does not match regex . |
46,113 | public function pageTextContains ( $ text ) { $ actual = $ this -> session -> getPage ( ) -> getText ( ) ; $ actual = preg_replace ( '/\s+/u' , ' ' , $ actual ) ; $ regex = '/' . preg_quote ( $ text , '/' ) . '/ui' ; $ message = sprintf ( 'The text "%s" was not found anywhere in the text of the current page.' , $ text ... | Checks that current page contains text . |
46,114 | public function pageTextMatches ( $ regex ) { $ actual = $ this -> session -> getPage ( ) -> getText ( ) ; $ message = sprintf ( 'The pattern %s was not found anywhere in the text of the current page.' , $ regex ) ; $ this -> assertResponseText ( ( bool ) preg_match ( $ regex , $ actual ) , $ message ) ; } | Checks that current page text matches regex . |
46,115 | public function pageTextNotMatches ( $ regex ) { $ actual = $ this -> session -> getPage ( ) -> getText ( ) ; $ message = sprintf ( 'The pattern %s was found in the text of the current page, but it should not.' , $ regex ) ; $ this -> assertResponseText ( ! preg_match ( $ regex , $ actual ) , $ message ) ; } | Checks that current page text does not matches regex . |
46,116 | public function elementsCount ( $ selectorType , $ selector , $ count , ElementInterface $ container = null ) { $ container = $ container ? : $ this -> session -> getPage ( ) ; $ nodes = $ container -> findAll ( $ selectorType , $ selector ) ; $ message = sprintf ( '%d %s found on the page, but should be %d.' , count (... | Checks that there is specified number of specific elements on the page . |
46,117 | public function elementExists ( $ selectorType , $ selector , ElementInterface $ container = null ) { $ container = $ container ? : $ this -> session -> getPage ( ) ; $ node = $ container -> find ( $ selectorType , $ selector ) ; if ( null === $ node ) { if ( is_array ( $ selector ) ) { $ selector = implode ( ' ' , $ s... | Checks that specific element exists on the current page . |
46,118 | public function elementNotExists ( $ selectorType , $ selector , ElementInterface $ container = null ) { $ container = $ container ? : $ this -> session -> getPage ( ) ; $ node = $ container -> find ( $ selectorType , $ selector ) ; $ message = sprintf ( 'An %s appears on this page, but it should not.' , $ this -> getM... | Checks that specific element does not exists on the current page . |
46,119 | public function elementTextNotContains ( $ selectorType , $ selector , $ text ) { $ element = $ this -> elementExists ( $ selectorType , $ selector ) ; $ actual = $ element -> getText ( ) ; $ regex = '/' . preg_quote ( $ text , '/' ) . '/ui' ; $ message = sprintf ( 'The text "%s" appears in the text of the %s, but it s... | Checks that specific element does not contains text . |
46,120 | public function elementContains ( $ selectorType , $ selector , $ html ) { $ element = $ this -> elementExists ( $ selectorType , $ selector ) ; $ actual = $ element -> getHtml ( ) ; $ regex = '/' . preg_quote ( $ html , '/' ) . '/ui' ; $ message = sprintf ( 'The string "%s" was not found in the HTML of the %s.' , $ ht... | Checks that specific element contains HTML . |
46,121 | public function elementAttributeExists ( $ selectorType , $ selector , $ attribute ) { $ element = $ this -> elementExists ( $ selectorType , $ selector ) ; $ message = sprintf ( 'The attribute "%s" was not found in the %s.' , $ attribute , $ this -> getMatchingElementRepresentation ( $ selectorType , $ selector ) ) ; ... | Checks that an attribute exists in an element . |
46,122 | public function elementAttributeContains ( $ selectorType , $ selector , $ attribute , $ text ) { $ element = $ this -> elementAttributeExists ( $ selectorType , $ selector , $ attribute ) ; $ actual = $ element -> getAttribute ( $ attribute ) ; $ regex = '/' . preg_quote ( $ text , '/' ) . '/ui' ; $ message = sprintf ... | Checks that an attribute of a specific elements contains text . |
46,123 | public function fieldExists ( $ field , TraversableElement $ container = null ) { $ container = $ container ? : $ this -> session -> getPage ( ) ; $ node = $ container -> findField ( $ field ) ; if ( null === $ node ) { throw new ElementNotFoundException ( $ this -> session -> getDriver ( ) , 'form field' , 'id|name|la... | Checks that specific field exists on the current page . |
46,124 | public function fieldNotExists ( $ field , TraversableElement $ container = null ) { $ container = $ container ? : $ this -> session -> getPage ( ) ; $ node = $ container -> findField ( $ field ) ; $ this -> assert ( null === $ node , sprintf ( 'A field "%s" appears on this page, but it should not.' , $ field ) ) ; } | Checks that specific field does not exists on the current page . |
46,125 | public function fieldValueEquals ( $ field , $ value , TraversableElement $ container = null ) { $ node = $ this -> fieldExists ( $ field , $ container ) ; $ actual = $ node -> getValue ( ) ; $ regex = '/^' . preg_quote ( $ value , '/' ) . '$/ui' ; $ message = sprintf ( 'The field "%s" value is "%s", but "%s" expected.... | Checks that specific field have provided value . |
46,126 | public function checkboxChecked ( $ field , TraversableElement $ container = null ) { $ node = $ this -> fieldExists ( $ field , $ container ) ; $ this -> assert ( $ node -> isChecked ( ) , sprintf ( 'Checkbox "%s" is not checked, but it should be.' , $ field ) ) ; } | Checks that specific checkbox is checked . |
46,127 | protected function cleanUrl ( $ url ) { $ parts = parse_url ( $ url ) ; $ fragment = empty ( $ parts [ 'fragment' ] ) ? '' : '#' . $ parts [ 'fragment' ] ; $ path = empty ( $ parts [ 'path' ] ) ? '/' : $ parts [ 'path' ] ; return preg_replace ( '/^\/[^\.\/]+\.php\//' , '/' , $ path ) . $ fragment ; } | Trims scriptname from the URL . |
46,128 | private function assertElement ( $ condition , $ message , Element $ element ) { if ( $ condition ) { return ; } throw new ElementHtmlException ( $ message , $ this -> session -> getDriver ( ) , $ element ) ; } | Asserts a condition on an element . |
46,129 | private function assertElementText ( $ condition , $ message , Element $ element ) { if ( $ condition ) { return ; } throw new ElementTextException ( $ message , $ this -> session -> getDriver ( ) , $ element ) ; } | Asserts a condition involving the text of an element . |
46,130 | public function visit ( $ url ) { if ( ! $ this -> isStarted ( ) ) { $ this -> start ( ) ; } $ this -> driver -> visit ( $ url ) ; } | Visit specified URL and automatically start session if not already running . |
46,131 | public function getResponseHeader ( $ name ) { $ headers = $ this -> driver -> getResponseHeaders ( ) ; $ name = strtolower ( $ name ) ; $ headers = array_change_key_case ( $ headers , CASE_LOWER ) ; if ( ! isset ( $ headers [ $ name ] ) ) { return null ; } return is_array ( $ headers [ $ name ] ) ? $ headers [ $ name ... | Returns specific response header . |
46,132 | public function resizeWindow ( $ width , $ height , $ name = null ) { $ this -> driver -> resizeWindow ( $ width , $ height , $ name ) ; } | Set the dimensions of the window . |
46,133 | public function getSelector ( $ name ) { if ( 'named' === $ name ) { @ trigger_error ( 'Using the "named" selector directly from the handler is deprecated as of 1.6 and will be removed in 2.0.' . ' Use the "named_partial" or use the "named" selector through the Element API instead.' , E_USER_DEPRECATED ) ; $ name = 'na... | Returns selector engine with specified name . |
46,134 | public function selectorToXpath ( $ selector , $ locator ) { if ( 'xpath' === $ selector ) { if ( ! is_string ( $ locator ) ) { throw new \ InvalidArgumentException ( 'The xpath selector expects to get a string as locator' ) ; } return $ locator ; } return $ this -> getSelector ( $ selector ) -> translateToXPath ( $ lo... | Translates selector with specified name to XPath . |
46,135 | protected function getSession ( ) { if ( null === $ this -> session ) { throw new \ LogicException ( sprintf ( 'The deprecated method %s cannot be used when passing a driver in the constructor' , __METHOD__ ) ) ; } @ trigger_error ( sprintf ( 'The method %s is deprecated as of Mink 1.7 and will be removed in 2.0. Use g... | Returns exception session . |
46,136 | protected function trimString ( $ string , $ count = 1000 ) { $ string = trim ( $ string ) ; if ( $ count < mb_strlen ( $ string ) ) { return mb_substr ( $ string , 0 , $ count - 3 ) . '...' ; } return $ string ; } | Trims string to specified number of chars . |
46,137 | protected function getResponseInfo ( ) { $ driver = basename ( str_replace ( '\\' , '/' , get_class ( $ this -> driver ) ) ) ; $ info = '+--[ ' ; try { $ info .= 'HTTP/1.1 ' . $ this -> driver -> getStatusCode ( ) . ' | ' ; } catch ( UnsupportedDriverActionException $ e ) { } $ info .= $ this -> driver -> getCurrentUrl... | Returns response information string . |
46,138 | public function registerSession ( $ name , Session $ session ) { $ name = strtolower ( $ name ) ; $ this -> sessions [ $ name ] = $ session ; } | Registers new session . |
46,139 | public function setDefaultSessionName ( $ name ) { $ name = strtolower ( $ name ) ; if ( ! isset ( $ this -> sessions [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Session "%s" is not registered.' , $ name ) ) ; } $ this -> defaultSessionName = $ name ; } | Sets default session name to use . |
46,140 | public function assertSession ( $ session = null ) { if ( ! ( $ session instanceof Session ) ) { $ session = $ this -> getSession ( $ session ) ; } return new WebAssert ( $ session ) ; } | Returns session asserter . |
46,141 | protected function locateSession ( $ name = null ) { $ name = strtolower ( $ name ) ? : $ this -> defaultSessionName ; if ( null === $ name ) { throw new \ InvalidArgumentException ( 'Specify session name to get' ) ; } if ( ! isset ( $ this -> sessions [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( '... | Returns the named or default session without starting it . |
46,142 | public function translateToXPath ( $ locator ) { if ( ! is_string ( $ locator ) ) { throw new \ InvalidArgumentException ( 'The CssSelector expects to get a string as locator' ) ; } if ( class_exists ( 'Symfony\Component\CssSelector\CssSelectorConverter' ) ) { $ converter = new CssSelectorConverter ( ) ; return $ conve... | Translates CSS into XPath . |
46,143 | public function prepend ( $ xpath , $ prefix ) { $ expressions = array ( ) ; if ( preg_match ( self :: UNION_PATTERN , $ prefix ) ) { $ prefix = '(' . $ prefix . ')' ; } foreach ( $ this -> splitUnionParts ( $ xpath ) as $ expression ) { $ expression = trim ( $ expression ) ; $ parenthesis = '' ; if ( preg_match ( '/^[... | Prepends the XPath prefix to the given XPath . |
46,144 | private function splitUnionParts ( $ xpath ) { if ( false === strpos ( $ xpath , '|' ) ) { return array ( $ xpath ) ; } $ xpathLen = strlen ( $ xpath ) ; $ openedBrackets = 0 ; $ startPosition = strspn ( $ xpath , " \t\n\r\0\x0B" ) ; $ unionParts = array ( ) ; for ( $ i = $ startPosition ; $ i <= $ xpathLen ; ++ $ i ) ... | Splits the XPath into parts that are separated by the union operator . |
46,145 | public function hasClass ( $ className ) { if ( $ this -> hasAttribute ( 'class' ) ) { return in_array ( $ className , preg_split ( '/\s+/' , $ this -> getAttribute ( 'class' ) ) ) ; } return false ; } | Checks whether an element has a named CSS class . |
46,146 | public function selectOption ( $ option , $ multiple = false ) { if ( 'select' !== $ this -> getTagName ( ) ) { $ this -> getDriver ( ) -> selectOption ( $ this -> getXpath ( ) , $ option , $ multiple ) ; return ; } $ opt = $ this -> find ( 'named' , array ( 'option' , $ option ) ) ; if ( null === $ opt ) { throw new E... | Selects specified option for select field or specified radio button in the group . |
46,147 | public function dragTo ( ElementInterface $ destination ) { $ this -> getDriver ( ) -> dragTo ( $ this -> getXpath ( ) , $ destination -> getXpath ( ) ) ; } | Drags current node onto other node . |
46,148 | public function keyDown ( $ char , $ modifier = null ) { $ this -> getDriver ( ) -> keyDown ( $ this -> getXpath ( ) , $ char , $ modifier ) ; } | Pressed down specific keyboard key . |
46,149 | public function keyUp ( $ char , $ modifier = null ) { $ this -> getDriver ( ) -> keyUp ( $ this -> getXpath ( ) , $ char , $ modifier ) ; } | Pressed up specific keyboard key . |
46,150 | private function assertUuidV1 ( UuidInterface $ value ) { if ( 1 !== $ value -> getVersion ( ) ) { throw ConversionException :: conversionFailed ( $ value -> toString ( ) , self :: NAME ) ; } } | Using this type only makes sense with Uuid version 1 as this is the only kind of UUID that can be time - ordered . Passing any other UUID into this type is likely a mistake |
46,151 | private function getIptables ( ) { $ result = array ( ) ; $ i = 0 ; foreach ( $ this -> _lines as $ line ) { $ result [ $ i ] [ 'rule' ] = $ line ; $ i ++ ; } return $ result ; } | get iptables information |
46,152 | private function _kernel ( ) { if ( CommonFunctions :: executeProgram ( 'oslevel' , '' , $ ret1 ) && CommonFunctions :: executeProgram ( 'oslevel' , '-s' , $ ret2 ) ) { $ this -> sys -> setKernel ( $ ret1 . ' (' . $ ret2 . ')' ) ; } } | IBM AIX Version |
46,153 | private function readaixdata ( ) { if ( count ( $ this -> _aixdata ) === 0 ) { if ( CommonFunctions :: executeProgram ( 'prtconf' , '' , $ bufr ) ) { $ this -> _aixdata = preg_split ( "/\n/" , $ bufr , - 1 , PREG_SPLIT_NO_EMPTY ) ; } } return $ this -> _aixdata ; } | IBM AIX informations by K . PAZ |
46,154 | protected function grabkey ( $ key ) { if ( CommonFunctions :: executeProgram ( 'sysctl' , $ key , $ s , PSI_DEBUG ) ) { $ s = preg_replace ( '/' . $ key . ': /' , '' , $ s ) ; $ s = preg_replace ( '/' . $ key . ' = /' , '' , $ s ) ; return $ s ; } else { return '' ; } } | get a value from sysctl command |
46,155 | private function _grabioreg ( $ key ) { if ( CommonFunctions :: executeProgram ( 'ioreg' , '-c "' . $ key . '"' , $ s , PSI_DEBUG ) ) { $ s = preg_replace ( "/\s+/" , " " , $ s ) ; $ s = preg_replace ( "/[\|\t ]*\+\-o/" , "\n" , $ s ) ; $ s = preg_replace ( "/[\|\t ]+/" , " " , $ s ) ; $ lines = preg_split ( "/\n/" , $... | get a value from ioreg command |
46,156 | protected function pci ( ) { if ( ! $ arrResults = Parser :: lspci ( false ) ) { $ s = $ this -> _grabioreg ( 'IOPCIDevice' ) ; $ lines = preg_split ( "/\n/" , $ s , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ lines as $ line ) { $ dev = new HWDevice ( ) ; if ( ! preg_match ( '/"IOName" = "([^"]*)"/' , $ line , $ ar_buf ... | get the pci device information out of ioreg |
46,157 | protected function ide ( ) { $ s = $ this -> _grabioreg ( 'IOATABlockStorageDevice' ) ; $ lines = preg_split ( "/\n/" , $ s , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ lines as $ line ) { $ dev = new HWDevice ( ) ; if ( ! preg_match ( '/"Product Name"="([^"]*)"/' , $ line , $ ar_buf ) ) $ ar_buf = preg_split ( "/[\s@]+... | get the ide device information out of ioreg |
46,158 | protected function usb ( ) { $ s = $ this -> _grabioreg ( 'IOUSBDevice' ) ; $ lines = preg_split ( "/\n/" , $ s , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ lines as $ line ) { $ dev = new HWDevice ( ) ; if ( ! preg_match ( '/"USB Product Name" = "([^"]*)"/' , $ line , $ ar_buf ) ) $ ar_buf = preg_split ( "/[\s@]+/" , $... | get the usb device information out of ioreg |
46,159 | protected function scsi ( ) { $ s = $ this -> _grabioreg ( 'IOBlockStorageServices' ) ; $ lines = preg_split ( "/\n/" , $ s , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ lines as $ line ) { $ dev = new HWDevice ( ) ; if ( ! preg_match ( '/"Product Name"="([^"]*)"/' , $ line , $ ar_buf ) ) $ ar_buf = preg_split ( "/[\s@]+... | get the scsi device information out of ioreg |
46,160 | protected function _tb ( ) { $ s = $ this -> _grabioreg ( 'IOThunderboltPort' ) ; $ lines = preg_split ( "/\n/" , $ s , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ lines as $ line ) { $ dev = new HWDevice ( ) ; if ( ! preg_match ( '/"Description" = "([^"]*)"/' , $ line , $ ar_buf ) ) $ ar_buf = preg_split ( "/[\s@]+/" , ... | get the thunderbolt device information out of ioreg |
46,161 | protected function distro ( ) { $ this -> sys -> setDistributionIcon ( 'Darwin.png' ) ; if ( ! CommonFunctions :: executeProgram ( 'system_profiler' , 'SPSoftwareDataType' , $ buffer , PSI_DEBUG ) ) { parent :: distro ( ) ; } else { $ arrBuff = preg_split ( "/\n/" , $ buffer , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ ... | get icon name |
46,162 | private function _buildNetwork ( ) { $ hideDevices = array ( ) ; $ network = $ this -> _xml -> addChild ( 'Network' ) ; if ( defined ( 'PSI_HIDE_NETWORK_INTERFACE' ) ) { if ( is_string ( PSI_HIDE_NETWORK_INTERFACE ) ) { if ( preg_match ( ARRAY_EXP , PSI_HIDE_NETWORK_INTERFACE ) ) { $ hideDevices = eval ( PSI_HIDE_NETWO... | generate the network information |
46,163 | private function _buildMemory ( ) { $ memory = $ this -> _xml -> addChild ( 'Memory' ) ; $ memory -> addAttribute ( 'Free' , $ this -> _sys -> getMemFree ( ) ) ; $ memory -> addAttribute ( 'Used' , $ this -> _sys -> getMemUsed ( ) ) ; $ memory -> addAttribute ( 'Total' , $ this -> _sys -> getMemTotal ( ) ) ; $ memory -... | generate the memory information |
46,164 | private function _fillDevice ( SimpleXMLExtended $ mount , DiskDevice $ dev , $ i ) { $ mount -> addAttribute ( 'MountPointID' , $ i ) ; if ( $ dev -> getFsType ( ) !== "" ) $ mount -> addAttribute ( 'FSType' , $ dev -> getFsType ( ) ) ; $ mount -> addAttribute ( 'Name' , $ dev -> getName ( ) ) ; $ mount -> addAttribut... | fill a xml element with atrributes from a disk device |
46,165 | private function _buildFilesystems ( ) { $ hideMounts = $ hideFstypes = $ hideDisks = $ ignoreFree = $ ignoreUsage = $ ignoreThreshold = array ( ) ; $ i = 1 ; if ( defined ( 'PSI_HIDE_MOUNTS' ) && is_string ( PSI_HIDE_MOUNTS ) ) { if ( preg_match ( ARRAY_EXP , PSI_HIDE_MOUNTS ) ) { $ hideMounts = eval ( PSI_HIDE_MOUNTS... | generate the filesysteminformation |
46,166 | private function _buildPlugins ( ) { $ pluginroot = $ this -> _xml -> addChild ( "Plugins" ) ; if ( ( $ this -> _plugin_request || $ this -> _complete_request ) && count ( $ this -> _plugins ) > 0 ) { $ plugins = array ( ) ; if ( $ this -> _complete_request ) { $ plugins = $ this -> _plugins ; } if ( $ this -> _plugin_... | include xml - trees of the plugins to the main xml |
46,167 | private function _xmlbody ( ) { $ dom = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ root = $ dom -> createElement ( "tns:phpsysinfo" ) ; $ root -> setAttribute ( 'xmlns:tns' , 'http://phpsysinfo.sourceforge.net/' ) ; $ root -> setAttribute ( 'xmlns:xsi' , 'http://www.w3.org/2001/XMLSchema-instance' ) ; $ root -> setAttribu... | build the xml structure where the content can be inserted |
46,168 | private function _checkTemplateLanguage ( ) { if ( ! defined ( "PSI_DEFAULT_TEMPLATE" ) || ( ( $ this -> _template = strtolower ( trim ( PSI_DEFAULT_TEMPLATE ) ) ) == "" ) || ! file_exists ( PSI_APP_ROOT . '/templates/' . $ this -> _template . ".css" ) ) { $ this -> _template = 'phpsysinfo' ; } if ( ! defined ( "PSI_DE... | checking phpsysinfo . ini setting for template if not supportet set phpsysinfo . css as default checking phpsysinfo . ini setting for language if not supported set en as default |
46,169 | private function _getTemplateList ( ) { $ dirlist = CommonFunctions :: gdc ( PSI_APP_ROOT . '/templates/' ) ; sort ( $ dirlist ) ; foreach ( $ dirlist as $ file ) { $ tpl_ext = substr ( $ file , strlen ( $ file ) - 4 ) ; $ tpl_name = substr ( $ file , 0 , strlen ( $ file ) - 4 ) ; if ( $ tpl_ext === ".css" ) { if ( pre... | get all available tamplates and store them in internal array |
46,170 | private function _getLanguageList ( ) { $ dirlist = CommonFunctions :: gdc ( PSI_APP_ROOT . '/language/' ) ; sort ( $ dirlist ) ; foreach ( $ dirlist as $ file ) { $ lang_ext = strtolower ( substr ( $ file , strlen ( $ file ) - 4 ) ) ; $ lang_name = strtolower ( substr ( $ file , 0 , strlen ( $ file ) - 4 ) ) ; if ( $ ... | get all available translations and store them in internal array |
46,171 | private function _addError ( $ strCommand , $ strMessage ) { $ index = count ( $ this -> _arrErrorList ) + 1 ; $ this -> _arrErrorList [ $ index ] [ 'command' ] = $ strCommand ; $ this -> _arrErrorList [ $ index ] [ 'message' ] = $ strMessage ; $ this -> _errors ++ ; } | adds an error to the internal list |
46,172 | public function addWarning ( $ strMessage ) { $ index = count ( $ this -> _arrErrorList ) + 1 ; $ this -> _arrErrorList [ $ index ] [ 'command' ] = "WARN" ; $ this -> _arrErrorList [ $ index ] [ 'message' ] = $ strMessage ; } | adds a waraning to the internal list |
46,173 | public function errorsAsXML ( ) { $ dom = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ root = $ dom -> createElement ( "phpsysinfo" ) ; $ dom -> appendChild ( $ root ) ; $ xml = new SimpleXMLExtended ( simplexml_import_dom ( $ dom ) , 'UTF-8' ) ; $ generation = $ xml -> addChild ( 'Generation' ) ; $ generation -> addAttribu... | converts the internal error and warning list to a XML file |
46,174 | public function errorsAddToXML ( $ encoding ) { $ dom = new DOMDocument ( '1.0' , 'UTF-8' ) ; $ root = $ dom -> createElement ( "Errors" ) ; $ dom -> appendChild ( $ root ) ; $ xml = simplexml_import_dom ( $ dom ) ; $ xmlerr = new SimpleXMLExtended ( $ xml , $ encoding ) ; foreach ( $ this -> _arrErrorList as $ arrLine... | add the errors to an existing xml document |
46,175 | private function _trace ( $ strMessage ) { $ arrTrace = array_reverse ( debug_backtrace ( ) ) ; $ strFunc = '' ; $ strBacktrace = htmlspecialchars ( $ strMessage ) . "\n\n" ; foreach ( $ arrTrace as $ val ) { if ( $ val == $ arrTrace [ count ( $ arrTrace ) - 1 ] ) { break ; } $ strBacktrace .= str_replace ( PSI_APP_ROO... | generate a function backtrace for error diagnostic function is genearally based on code submitted in the php reference page |
46,176 | private function _printVar ( $ var ) { if ( is_string ( $ var ) ) { $ search = array ( "\x00" , "\x0a" , "\x0d" , "\x1a" , "\x09" ) ; $ replace = array ( '\0' , '\n' , '\r' , '\Z' , '\t' ) ; return ( '"' . str_replace ( $ search , $ replace , $ var ) . '"' ) ; } elseif ( is_bool ( $ var ) ) { if ( $ var ) { return ( 't... | convert some special vars into better readable output |
46,177 | public static function removeDupsAndCount ( $ arrDev ) { $ result = array ( ) ; foreach ( $ arrDev as $ dev ) { if ( count ( $ result ) === 0 ) { array_push ( $ result , $ dev ) ; } else { $ found = false ; foreach ( $ result as $ tmp ) { if ( $ dev -> equals ( $ tmp ) ) { $ tmp -> setCount ( $ tmp -> getCount ( ) + 1 ... | remove duplicate Entries and Count |
46,178 | public function getMemPercentApplication ( ) { if ( $ this -> _memApplication !== null ) { if ( ( $ this -> _memApplication > 0 ) && ( $ this -> _memTotal > 0 ) ) { return round ( $ this -> _memApplication / $ this -> _memTotal * 100 ) ; } else { return 0 ; } } else { return null ; } } | return percent of used memory for applications |
46,179 | public function getMemPercentCache ( ) { if ( $ this -> _memCache !== null ) { if ( ( $ this -> _memCache > 0 ) && ( $ this -> _memTotal > 0 ) ) { if ( ( $ this -> _memApplication !== null ) && ( $ this -> _memApplication > 0 ) ) { return round ( ( $ this -> _memCache + $ this -> _memApplication ) / $ this -> _memTotal... | return percent of used memory for cache |
46,180 | public function getMemPercentBuffer ( ) { if ( $ this -> _memBuffer !== null ) { if ( ( $ this -> _memBuffer > 0 ) && ( $ this -> _memTotal > 0 ) ) { if ( ( $ this -> _memCache !== null ) && ( $ this -> _memCache > 0 ) ) { if ( ( $ this -> _memApplication !== null ) && ( $ this -> _memApplication > 0 ) ) { return round... | return percent of used memory for buffer |
46,181 | public function getSwapFree ( ) { if ( count ( $ this -> _swapDevices ) > 0 ) { $ free = 0 ; foreach ( $ this -> _swapDevices as $ dev ) { $ free += $ dev -> getFree ( ) ; } return $ free ; } return null ; } | Returns total free swap space |
46,182 | public function getSwapTotal ( ) { if ( count ( $ this -> _swapDevices ) > 0 ) { $ total = 0 ; foreach ( $ this -> _swapDevices as $ dev ) { $ total += $ dev -> getTotal ( ) ; } return $ total ; } else { return null ; } } | Returns total swap space |
46,183 | public function getSwapUsed ( ) { if ( count ( $ this -> _swapDevices ) > 0 ) { $ used = 0 ; foreach ( $ this -> _swapDevices as $ dev ) { $ used += $ dev -> getUsed ( ) ; } return $ used ; } else { return null ; } } | Returns total used swap space |
46,184 | public function getSwapPercentUsed ( ) { if ( $ this -> getSwapTotal ( ) !== null ) { if ( $ this -> getSwapTotal ( ) > 0 ) { return round ( $ this -> getSwapUsed ( ) / $ this -> getSwapTotal ( ) * 100 ) ; } else { return 0 ; } } else { return null ; } } | return percent of total swap space used |
46,185 | public function addChild ( $ name , $ value = null ) { $ nameUtf8 = $ this -> _toUTF8 ( $ name ) ; if ( $ value == null ) { return new SimpleXMLExtended ( $ this -> _SimpleXmlElement -> addChild ( $ nameUtf8 ) , $ this -> _encoding ) ; } else { $ valueUtf8 = htmlspecialchars ( $ this -> _toUTF8 ( $ value ) , ENT_COMPAT... | insert a child element with or without a value also doing conversation of name and if value is set to utf8 |
46,186 | public function addCData ( $ name , $ cdata ) { $ nameUtf8 = $ this -> _toUTF8 ( $ name ) ; $ node = $ this -> _SimpleXmlElement -> addChild ( $ nameUtf8 ) ; $ domnode = dom_import_simplexml ( $ node ) ; $ no = $ domnode -> ownerDocument ; $ domnode -> appendChild ( $ no -> createCDATASection ( $ cdata ) ) ; return new... | insert a child with cdata section |
46,187 | public function addAttribute ( $ name , $ value ) { $ nameUtf8 = $ this -> _toUTF8 ( $ name ) ; $ valueUtf8 = htmlspecialchars ( $ this -> _toUTF8 ( $ value ) , ENT_COMPAT , "UTF-8" ) ; if ( ( $ valueUtf8 === "" ) && ( version_compare ( "5.2.2" , PHP_VERSION , ">" ) ) ) { $ this -> _SimpleXmlElement -> addAttribute ( $... | add a attribute to a child and convert name and value to utf8 |
46,188 | public function combinexml ( SimpleXMLElement $ new_child ) { $ node1 = dom_import_simplexml ( $ this -> _SimpleXmlElement ) ; $ dom_sxe = dom_import_simplexml ( $ new_child ) ; $ node2 = $ node1 -> ownerDocument -> importNode ( $ dom_sxe , true ) ; $ node1 -> appendChild ( $ node2 ) ; } | append a xml - tree to another xml - tree |
46,189 | private function _toUTF8 ( $ str ) { $ str = trim ( preg_replace ( '/[\x00-\x09\x0b-\x1F]/' , ' ' , $ str ) ) ; if ( $ this -> _encoding != null ) { if ( strcasecmp ( $ this -> _encoding , "UTF-8" ) == 0 ) { return $ str ; } elseif ( strcasecmp ( $ this -> _encoding , "CP437" ) == 0 ) { $ strr = "" ; if ( ( $ strl = st... | convert a string into an UTF - 8 string |
46,190 | public function run ( ) { CommonFunctions :: checkForExtensions ( array ( 'xsl' ) ) ; $ xmlfile = $ this -> getXMLString ( ) ; $ xslfile = "phpsysinfo.xslt" ; $ domxml = new DOMDocument ( ) ; $ domxml -> loadXML ( $ xmlfile ) ; $ domxsl = new DOMDocument ( ) ; $ domxsl -> load ( $ xslfile ) ; $ xsltproc = new XSLTProce... | generate the static page |
46,191 | public static function rolv ( $ similarFileName , $ match = "//" , $ replace = "" ) { $ filename = preg_replace ( $ match , $ replace , $ similarFileName ) ; if ( CommonFunctions :: fileexists ( $ filename ) && CommonFunctions :: rfts ( $ filename , $ buf , 1 , 4096 , false ) && ( ( $ buf = trim ( $ buf ) ) != "" ) ) {... | read a one - line value from a file with a similar name |
46,192 | public static function rfts ( $ strFileName , & $ strRet , $ intLines = 0 , $ intBytes = 4096 , $ booErrorRep = true ) { if ( defined ( 'PSI_LOG' ) && is_string ( PSI_LOG ) && ( strlen ( PSI_LOG ) > 0 ) && ( ( substr ( PSI_LOG , 0 , 1 ) == "-" ) || ( substr ( PSI_LOG , 0 , 1 ) == "+" ) ) ) { $ out = self :: _parse_log_... | read a file and return the content as a string |
46,193 | public static function gdc ( $ strPath , $ booErrorRep = true ) { $ arrDirectoryContent = array ( ) ; $ error = PSI_Error :: singleton ( ) ; if ( is_dir ( $ strPath ) ) { if ( $ handle = opendir ( $ strPath ) ) { while ( ( $ strFile = readdir ( $ handle ) ) !== false ) { if ( $ strFile != "." && $ strFile != ".." ) { $... | reads a directory and return the name of the files and directorys in it |
46,194 | public static function checkForExtensions ( $ arrExt = array ( ) ) { if ( ( strcasecmp ( PSI_SYSTEM_CODEPAGE , "UTF-8" ) == 0 ) || ( strcasecmp ( PSI_SYSTEM_CODEPAGE , "CP437" ) == 0 ) ) $ arrReq = array ( 'simplexml' , 'pcre' , 'xml' , 'dom' ) ; elseif ( PSI_OS == "WINNT" ) $ arrReq = array ( 'simplexml' , 'pcre' , 'x... | Check for needed php extensions |
46,195 | public static function getWMI ( $ wmi , $ strClass , $ strValue = array ( ) ) { $ arrData = array ( ) ; if ( $ wmi ) { $ value = "" ; try { $ objWEBM = $ wmi -> Get ( $ strClass ) ; $ arrProp = $ objWEBM -> Properties_ ; $ arrWEBMCol = $ objWEBM -> Instances_ ( ) ; foreach ( $ arrWEBMCol as $ objItem ) { if ( is_array ... | function for getting a list of values in the specified context optionally filter this list based on the list from third parameter |
46,196 | protected function _ip ( ) { if ( PSI_USE_VHOST === true ) { if ( ( CommonFunctions :: readenv ( 'SERVER_ADDR' , $ result ) || CommonFunctions :: readenv ( 'LOCAL_ADDR' , $ result ) ) && ! strstr ( $ result , '.' ) && strstr ( $ result , ':' ) ) { $ dnsrec = dns_get_record ( $ this -> sys -> getHostname ( ) , DNS_AAAA ... | IP of the Host |
46,197 | public static function lspci ( $ debug = PSI_DEBUG ) { $ arrResults = array ( ) ; if ( CommonFunctions :: executeProgram ( "lspci" , "" , $ strBuf , $ debug ) ) { $ arrLines = preg_split ( "/\n/" , $ strBuf , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ arrLines as $ strLine ) { $ arrParams = preg_split ( '/ /' , trim ( $... | parsing the output of lspci command |
46,198 | private function _pack ( $ script ) { for ( $ i = 0 ; isset ( $ this -> _parsers [ $ i ] ) ; $ i ++ ) { $ script = call_user_func ( array ( & $ this , $ this -> _parsers [ $ i ] ) , $ script ) ; } return $ script ; } | apply all parsing routines |
46,199 | private function _basicCompression ( $ script ) { $ parser = new ParseMaster ( ) ; $ parser -> escapeChar = '\\' ; $ parser -> add ( '/\'[^\'\\n\\r]*\'/' , self :: IGNORE ) ; $ parser -> add ( '/"[^"\\n\\r]*"/' , self :: IGNORE ) ; $ parser -> add ( '/\\/\\/[^\\n\\r]*[\\n\\r]/' , ' ' ) ; $ parser -> add ( '/\\/\\*[^*]*... | zero encoding - just removal of white space and comments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.