idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
59,200 | public function createBinding ( String $ key , $ queryPart , $ params = [ ] , $ expr = '' , $ with = '' , $ addValue = true ) { if ( ! array_key_exists ( $ key , $ this -> bindings ) ) { return false ; } if ( $ key == 'sql' ) { return $ queryPart ; } if ( $ addValue == true ) { $ this -> bindings [ $ key ] = $ queryPar... | This method bindings together queries created with the query builder . |
59,201 | public function alias ( String $ column , String $ alias ) { $ alias = str_replace ( $ this -> generator -> getDisallowedChars ( ) , '' , $ alias ) ; return $ this -> attachSeparator ( $ column . ' AS ' . $ alias ) ; } | Create and return alias for a column . |
59,202 | public function getTemporaryUser ( $ email ) { $ email = trim ( strtolower ( $ email ) ) ; if ( ! filter_var ( $ email , FILTER_VALIDATE_EMAIL ) ) { return false ; } $ userClass = $ this -> auth -> getUserClass ( ) ; $ user = $ userClass :: where ( 'email' , $ email ) -> first ( ) ; if ( ! $ user ) { return false ; } i... | Gets a temporary user from an email address if one exists . |
59,203 | public function createTemporaryUser ( $ parameters ) { $ email = trim ( strtolower ( array_value ( $ parameters , 'email' ) ) ) ; if ( ! filter_var ( $ email , FILTER_VALIDATE_EMAIL ) ) { throw new AuthException ( 'Invalid email address' ) ; } $ insertArray = array_replace ( $ parameters , [ 'enabled' => false ] ) ; $ ... | Creates a temporary user . Useful for creating invites . |
59,204 | public function upgradeTemporaryUser ( UserInterface $ user , $ values = [ ] ) { if ( ! $ user -> isTemporary ( ) ) { throw new AuthException ( 'Cannot upgrade a non-temporary account' ) ; } $ values = array_replace ( $ values , [ 'created_at' => Utility :: unixToDb ( time ( ) ) , 'enabled' => true , ] ) ; $ user -> gr... | Upgrades the user from temporary to a fully registered account . |
59,205 | public function dispatch ( ) { while ( true ) { if ( $ this -> _break ) { break ; } if ( $ this -> _paused ) { $ this -> _title ( 'Paused, waiting' ) ; $ this -> _log -> debug ( 'Paused, waiting.' ) ; } while ( $ this -> _paused ) { pcntl_signal_dispatch ( ) ; sleep ( $ this -> _interval ) ; } $ this -> _title ( 'Waiti... | Main method to start processing loop and dispatch jobs . |
59,206 | protected function _trapSignals ( ) { $ this -> _log -> debug ( 'Trapping signals.' ) ; $ handler = function ( $ number ) { switch ( $ number ) { case SIGQUIT : $ this -> _log -> debug ( 'Received SIGQUIT, waiting and exiting.' ) ; $ this -> _break = true ; $ this -> _connection -> disconnect ( ) ; exit ( 0 ) ; case SI... | Registers signal handlers and handles signals once received . Controls the current processing loop by setting object properties and using the process manager . |
59,207 | public function getAttribute ( $ attribute ) { return ! empty ( $ this -> attributes [ $ attribute ] ) ? $ this -> attributes [ $ attribute ] : null ; } | Get a specific attribute for this tag . |
59,208 | public function appendContent ( $ content ) { if ( $ this -> isVoid ) { throw new Exception \ RuntimeException ( 'Void elements can\'t contain content.' ) ; } $ this -> content .= $ content ; return $ this ; } | Append content before other content |
59,209 | public function prependContent ( $ content ) { if ( $ this -> isVoid ) { throw new Exception \ RuntimeException ( 'Void elements can\'t contain content.' ) ; } $ this -> content = $ content . $ this -> content ; return $ this ; } | Prepend content before other content |
59,210 | public function addChild ( self $ child ) { if ( $ this -> isVoid ) { throw new Exception \ RuntimeException ( 'Void elements can\'t have child elements.' ) ; } $ this -> children [ ] = $ child ; return $ this ; } | Add child to tag |
59,211 | public function addChildren ( array $ children ) { if ( $ this -> isVoid ) { throw new Exception \ RuntimeException ( 'Void elements can\'t have child elements.' ) ; } foreach ( $ children as $ child ) { $ this -> addChild ( $ child ) ; } return $ this ; } | Add children to tag |
59,212 | protected function renderAttributes ( ) { $ attributes = '' ; foreach ( $ this -> attributes as $ key => $ value ) { $ attributes .= " $key" . ( null !== $ value ? "=\"$value\"" : '' ) ; } return $ attributes ; } | Render tag attributes |
59,213 | public function addEntry ( MenuEntry $ entry ) { if ( $ this -> prepared ) { throw new \ RuntimeException ( 'MenuGroup has been prepared and can\'t receive new entries.' ) ; } $ this -> entries [ ] = $ entry ; return $ this ; } | Adds an entry . |
59,214 | public function prepare ( ) { if ( $ this -> prepared ) { return ; } usort ( $ this -> entries , function ( MenuEntry $ a , MenuEntry $ b ) { if ( $ a -> getPosition ( ) == $ b -> getPosition ( ) ) { return 0 ; } return $ a -> getPosition ( ) > $ b -> getPosition ( ) ? 1 : - 1 ; } ) ; $ this -> prepared = true ; } | Prepares the group for rendering . |
59,215 | private function generarId ( ) { if ( function_exists ( 'random_bytes' ) ) { $ semilla = random_bytes ( 32 ) ; } elseif ( function_exists ( 'mcrypt_create_iv' ) ) { $ semilla = mcrypt_create_iv ( 32 , MCRYPT_DEV_URANDOM ) ; } elseif ( function_exists ( 'openssl_random_pseudo_bytes' ) ) { $ semilla = openssl_random_pseu... | Genera un identificador nuevo usando una semilla aleatoria |
59,216 | public function anunciar ( $ mensaje , $ tipo = 'error' ) { $ this -> requerirInicio ( ) ; $ this -> datos [ '__anuncio' ] [ 'mensaje' ] = $ mensaje ; $ this -> datos [ '__anuncio' ] [ 'tipo' ] = $ tipo ; } | Define anuncio importante para el usuario . |
59,217 | public function obtener ( $ llave , $ valorAlterno = null ) { $ this -> requerirInicio ( ) ; return isset ( $ this -> datos [ $ llave ] ) ? $ this -> datos [ $ llave ] : $ valorAlterno ; } | Obtiene una variable de la sesion . |
59,218 | public function eliminar ( $ llave ) { $ this -> requerirInicio ( ) ; if ( isset ( $ this -> datos [ $ llave ] ) ) { $ valor = $ this -> datos [ $ llave ] ; unset ( $ this -> datos [ $ llave ] ) ; return $ valor ; } else { return null ; } } | Elimina una variable en la sesion . |
59,219 | public function parse ( $ content ) { if ( empty ( $ content ) ) return [ ] ; $ path = $ this -> getCleanPath ( $ content ) ; $ pathParts = [ $ this -> delimiter ] ; if ( mb_strpos ( $ path , $ this -> delimiter ) === false ) { if ( ! $ path ) { return [ $ this -> delimiter ] ; } $ tmpPathParts = [ $ this -> delimiter ... | parse method that fills the collection |
59,220 | public function getMenuIdFor ( int $ itemId ) : int { $ menuId = ( int ) $ this -> database -> query ( "SELECT menu_id FROM {umenu_item} WHERE id = ?" , [ $ itemId ] ) -> fetchField ( ) ; if ( ! $ menuId ) { throw new \ InvalidArgumentException ( sprintf ( "Item %d does not exist" , $ itemId ) ) ; } return $ menuId ; } | Get menu identifier for item |
59,221 | private function get_attrs ( ) { $ this -> attrs = new \ stdClass ; foreach ( $ this -> dom_element -> attributes as $ name => $ node ) { $ this -> attrs -> { strtolower ( $ name ) } = $ node -> nodeValue ; } return $ this ; } | Metodo que permite obtener todos atributos del elementos y convertirlos en un objeto stdClass . |
59,222 | private function get_childs ( ) { $ this -> childs = new \ PHPTools \ PHPHtmlDom \ Core \ PHPHtmlDomList ( $ this -> dom_element -> childNodes ) ; return $ this ; } | Metodo que permite obtener los elementos hijos y convertirlos en un objeto lista PHPHtmlDomList . |
59,223 | private function get_Text ( ) { $ text_formatting = array ( 'b' , 'strong' , 'em' , 'i' , 'small' , 'strong' , 'sub' , 'sup' , 'ins' , 'del' , 'mark' , 'br' , 'hr' ) ; foreach ( $ this -> dom_element -> childNodes as $ node ) { if ( $ node -> nodeType == 3 ) { $ this -> set_text ( trim ( $ node -> textContent ) ) ; $ t... | Metodo que permite obtener el texto que se encuentra dentro del elemento . |
59,224 | private function set_text ( $ text ) { if ( ! ! $ text ) { if ( ! ! $ this -> text ) { if ( ! ! is_array ( $ this -> text ) ) { $ this -> text [ ] = $ text ; } else { $ this -> text = array ( $ this -> text , $ text ) ; } } else { $ this -> text = $ text ; } } return $ this ; } | Metodo que permite definir e texto del elemento . |
59,225 | private function attrs_to_string ( $ attrs ) { $ attrs_string = '' ; foreach ( $ attrs as $ name => $ node ) { $ attrs_string .= sprintf ( ' %s="%s"' , $ name , $ node -> nodeValue ) ; } return $ attrs_string ; } | Este metodo permite concatenar un objeto de atributos en una sola cadena . |
59,226 | protected function makeParametersDDL ( $ separator = " " ) { $ params = [ ] ; foreach ( $ this -> parameters as $ parameter ) { $ params [ ] = $ parameter -> getDDL ( ) ; } return implode ( ',' . $ separator , $ params ) ; } | Make the portion of DDL for describing the parameters . |
59,227 | protected function saveAssignments ( ) { $ assignmentData = [ ] ; foreach ( $ this -> assignments as $ userId => $ assignments ) { foreach ( $ assignments as $ name => $ assignment ) { $ assignmentData [ $ userId ] [ ] = $ assignment -> roleName ; } } DiscHelper :: saveToFile ( $ assignmentData , $ this -> assignmentFi... | Saves assignments data into persistent storage . |
59,228 | protected function load ( ) { $ this -> assignments = [ ] ; $ assignments = DiscHelper :: loadFromFile ( $ this -> assignmentFile ) ; $ assignmentsMtime = @ filemtime ( $ this -> assignmentFile ) ; foreach ( $ assignments as $ userId => $ roles ) { foreach ( $ roles as $ role ) { $ this -> assignments [ $ userId ] [ $ ... | Loads authorization data from persistent storage . |
59,229 | private function create_package_migration ( $ name ) { list ( $ packagename , $ name ) = explode ( '/' , $ name ) ; $ skeleton_packages = \ Skeleton \ Core \ Skeleton :: get_all ( ) ; $ package = null ; foreach ( $ skeleton_packages as $ skeleton_package ) { if ( $ skeleton_package -> name == $ packagename ) { $ packag... | Create package migration |
59,230 | private function create_project_migration ( $ name ) { $ name = preg_replace ( array ( '/\s/' , '/\.[\.]+/' , '/[^\w_\.\-]/' ) , array ( '_' , '.' , '' ) , $ name ) ; $ datetime = date ( 'Ymd_His' ) ; $ filename = $ datetime . '_' . strtolower ( $ name ) . '.php' ; $ classname = 'Migration_' . $ datetime . '_' . ucfirs... | Create project migration |
59,231 | public static function table ( $ table ) { if ( Connect :: getConn ( ) == null ) { return new static ; } self :: $ table = self :: sanitize ( $ table ) ; return new static ; } | Sets the table on to which the various statements are executed . |
59,232 | private static function sanitize ( $ data ) { $ data = trim ( $ data ) ; $ data = stripslashes ( $ data ) ; $ data = htmlspecialchars ( $ data ) ; return $ data ; } | Sanitizes the data input values |
59,233 | public function orWhere ( $ param ) { if ( func_num_args ( ) == 3 ) { $ operator = strtolower ( func_get_arg ( 1 ) ) ; if ( is_numeric ( array_search ( $ operator , $ this -> condition ) ) ) { $ this -> whereby .= ' or ' . self :: sanitize ( func_get_arg ( 0 ) ) . ' ' . $ operator . ' \'' . self :: sanitize ( func_get_... | Adds condition for or in where clause |
59,234 | public function orderBy ( $ column = '' , $ sort = 'desc' ) { $ column = self :: sanitize ( $ column ) ; $ sort = strtoupper ( self :: sanitize ( $ sort ) ) ; if ( ! ( hash_equals ( 'DESC' , $ sort ) || hash_equals ( 'ASC' , $ sort ) ) ) { static :: $ response [ "status" ] = "error" ; static :: $ response [ "response" ... | Set order in which the return results will be return |
59,235 | public function get ( $ limit = 0 , $ offset = 0 ) { if ( static :: $ response [ 'status' ] == "error" ) { return static :: terminate ( static :: $ response ) ; } if ( ! is_numeric ( $ limit ) ) { static :: $ response [ "status" ] = "error" ; static :: $ response [ "response" ] = "Parameter limit should be numeric at f... | Fetch records form database |
59,236 | protected function fetch ( $ sql ) { try { try { $ stm = Connect :: getConn ( ) -> prepare ( $ sql ) ; } catch ( Exception $ e ) { static :: $ response [ "status" ] = "error" ; static :: $ response [ "response" ] = $ e -> getMessage ( ) ; static :: $ response [ 'code' ] = $ e -> getCode ( ) ; return static :: terminate... | Executes a query that returns data |
59,237 | public function all ( ) { $ table = trim ( self :: $ table ) ; if ( ! empty ( $ table ) ) { $ query = "SELECT * FROM {$table}" ; if ( ! empty ( $ this -> groupby ) ) { $ query .= ' GROUP BY ' . $ this -> groupby ; } if ( ! empty ( $ this -> order ) ) { $ query .= $ this -> order ; } return $ this -> fetch ( $ query ) ;... | Fetch all data without limits or offset |
59,238 | public function insert ( $ values ) { try { if ( func_num_args ( ) > 0 && ! is_array ( $ values ) ) { $ this -> values = array_merge ( $ this -> values , self :: sanitizeAV ( func_get_args ( ) ) ) ; } else if ( is_array ( $ values ) ) { $ this -> values = self :: sanitize ( $ values ) ; } else { static :: $ response [ ... | Sets the values to be inserted |
59,239 | public function into ( $ columns ) { $ valuesCount = count ( $ this -> values ) ; $ colStringCount = 0 ; if ( is_string ( $ columns ) ) { try { $ colStringCount = count ( explode ( ',' , $ columns ) ) ; } catch ( Exception $ e ) { static :: $ response [ "status" ] = "error" ; static :: $ response [ "response" ] = "Unre... | Sets the column to which the values will be inserted |
59,240 | protected function doInsert ( ) { if ( static :: $ response [ "status" ] == "error" ) { return static :: terminate ( static :: $ response ) ; } $ columnParam = array_map ( function ( ) { return '?' ; } , $ this -> values ) ; $ sql = 'INSERT INTO ' . self :: $ table . ' (' . $ this -> columns . ') VALUES(' . implode ( '... | Performs the actual database insert |
59,241 | private function isAssocStr ( $ array ) { if ( ! is_array ( $ array ) ) { return false ; } for ( reset ( $ array ) ; is_int ( key ( $ array ) ) ; next ( $ array ) ) { if ( is_null ( key ( $ array ) ) ) return false ; } return true ; } | Function to check if an array is association or sequential |
59,242 | protected function exec ( $ query ) { try { Connect :: getConn ( ) -> exec ( $ query ) ; } catch ( Exception $ e ) { static :: $ response [ "status" ] = "error" ; static :: $ response [ "response" ] = $ e -> getMessage ( ) ; static :: $ response [ "code" ] = $ e -> getCode ( ) ; return static :: terminate ( static :: $... | Executes a query that does not return any results |
59,243 | private static function valTable ( ) { if ( static :: $ table == null || ! is_string ( static :: $ table ) ) { static :: $ response [ "status" ] = "error" ; static :: $ response [ "response" ] = "check the table name provided" ; static :: $ response [ "code" ] = 5000 ; return self :: terminate ( static :: $ response ) ... | Validate that the table name has been provided and is a string |
59,244 | public function drop ( ) { static :: valTable ( ) ; $ sql = "DROP TABLE " . self :: $ table ; try { $ this -> exec ( $ sql ) ; static :: $ response [ "status" ] = "success" ; static :: $ response [ "response" ] = "success" ; return self :: terminate ( static :: $ response ) ; } catch ( Exception $ e ) { static :: $ res... | Function to drop a table |
59,245 | function setDependencies ( \ assegai \ Server $ server , ModuleContainer $ modules ) { $ this -> server = $ server ; $ this -> modules = $ modules ; } | Default module constructor . Loads options into properties . |
59,246 | protected function getOption ( $ option , $ default = false ) { return isset ( $ this -> options [ $ option ] ) ? $ this -> options [ $ option ] : $ default ; } | Just a convenient wrapper to retrieve an option . |
59,247 | public function getValue ( ) { $ val = $ this -> base [ 'value' ] ; if ( is_array ( $ val ) ) { $ posts = array ( ) ; foreach ( $ val as $ p ) { $ posts [ ] = $ this -> postFactory -> create ( $ this -> getPostObject ( $ p ) ) ; } return $ posts ; } elseif ( strlen ( $ val ) ) { return $ this -> postFactory -> create (... | Get a single post object or array of post objects . |
59,248 | private function detectarNucleosCPU ( ) { $ cantidad_cpu = 1 ; if ( is_file ( '/proc/cpuinfo' ) ) { $ cpu_info = file_get_contents ( '/proc/cpuinfo' ) ; preg_match_all ( '/^processor/m' , $ cpu_info , $ matches ) ; $ cantidad_cpu = count ( $ matches [ 0 ] ) ; } else if ( 'WIN' == strtoupper ( substr ( PHP_OS , 0 , 3 ) ... | Devuelve la cantidad de nucleos del CPU |
59,249 | public static function getPath ( $ data , $ path ) { $ path = explode ( '/' , $ path ) ; while ( null !== ( $ part = array_shift ( $ path ) ) ) { if ( ! is_array ( $ data ) || ! isset ( $ data [ $ part ] ) ) { return null ; } $ data = $ data [ $ part ] ; } return $ data ; } | Gets a value from an array using a path syntax to retrieve nested data . |
59,250 | public static function setPath ( & $ data , $ path , $ value ) { $ queue = explode ( '/' , $ path ) ; if ( count ( $ queue ) === 1 ) { $ data [ $ path ] = $ value ; return ; } $ current = & $ data ; while ( null !== ( $ key = array_shift ( $ queue ) ) ) { if ( ! is_array ( $ current ) ) { throw new \ RuntimeException (... | Set a value in a nested array key . Keys will be created as needed to set the value . |
59,251 | public static function uriTemplate ( $ template , array $ variables ) { if ( function_exists ( '\\uri_template' ) ) { return \ uri_template ( $ template , $ variables ) ; } static $ uriTemplate ; if ( ! $ uriTemplate ) { $ uriTemplate = new UriTemplate ( ) ; } return $ uriTemplate -> expand ( $ template , $ variables )... | Expands a URI template |
59,252 | public static function jsonDecode ( $ json , $ assoc = false , $ depth = 512 , $ options = 0 ) { if ( $ json === '' || $ json === null ) { return null ; } static $ jsonErrors = [ JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded' , JSON_ERROR_STATE_MISMATCH => 'JSON_ERROR_STATE_MISMATCH - Underflow o... | Wrapper for JSON decode that implements error detection with helpful error messages . |
59,253 | public static function getDefaultHandler ( ) { $ default = $ future = null ; if ( extension_loaded ( 'curl' ) ) { $ config = [ 'select_timeout' => getenv ( 'GUZZLE_CURL_SELECT_TIMEOUT' ) ? : 1 ] ; if ( $ maxHandles = getenv ( 'GUZZLE_CURL_MAX_HANDLES' ) ) { $ config [ 'max_handles' ] = $ maxHandles ; } if ( function_ex... | Create a default handler to use based on the environment |
59,254 | final public function parseDirectory ( $ rootDirectory , $ relativePath , $ translations = null , $ subParsersFilter = false , $ exclude3rdParty = true ) { if ( ! is_object ( $ translations ) ) { $ translations = new \ Gettext \ Translations ( ) ; } $ dir = ( string ) $ rootDirectory ; if ( $ dir !== '' ) { $ dir = @ r... | Extracts translations from a directory . |
59,255 | final public function parseRunningConcrete5 ( $ translations = null , $ subParsersFilter = false ) { if ( ! is_object ( $ translations ) ) { $ translations = new \ Gettext \ Translations ( ) ; } $ runningVersion = '' ; if ( defined ( '\C5_EXECUTE' ) && defined ( '\APP_VERSION' ) && is_string ( \ APP_VERSION ) ) { $ run... | Extracts translations from a running concrete5 instance . |
59,256 | final protected static function getDirectoryStructure ( $ rootDirectory , $ exclude3rdParty = true ) { $ rootDirectory = rtrim ( str_replace ( DIRECTORY_SEPARATOR , '/' , $ rootDirectory ) , '/' ) ; if ( ! isset ( self :: $ cache [ __FUNCTION__ ] ) ) { self :: $ cache [ __FUNCTION__ ] = array ( ) ; } $ cacheKey = $ roo... | Returns the directory structure underneath a given directory . |
59,257 | final public static function getAllParsers ( ) { $ result = array ( ) ; $ dir = __DIR__ . '/Parser' ; if ( is_dir ( $ dir ) && is_readable ( $ dir ) ) { $ matches = null ; foreach ( scandir ( $ dir ) as $ item ) { if ( ( $ item [ 0 ] !== '.' ) && preg_match ( '/^(.+)\.php$/i' , $ item , $ matches ) ) { $ fqClassName = ... | Retrieves all the available parsers . |
59,258 | public function send ( ) { setcookie ( $ this -> name , $ this -> value , ( int ) $ this -> expire -> format ( 'U' ) , $ this -> path , $ this -> domain , $ this -> secure , $ this -> httpOnly ) ; } | Sends the cookie header |
59,259 | protected static function triggerAopEvent ( $ controller_id , $ action_name , $ request = null , $ response = null ) { $ context = [ 'controller_id' => $ controller_id , 'action_id' => $ action_name , ] ; if ( $ request ) { $ context [ 'request' ] = $ request ; } if ( $ response ) { $ context [ 'response' ] = $ respons... | Trigger AOP Event |
59,260 | public function transform ( $ value ) { if ( $ value ) { $ from = '' ; if ( $ value -> getFrom ( ) ) { $ from = $ value -> getFrom ( ) -> format ( 'Y-m-d' ) ; } $ to = '' ; if ( $ value -> getTo ( ) ) { $ to = $ value -> getTo ( ) -> format ( 'Y-m-d' ) ; } return sprintf ( '%s%s%s' , $ from , $ this -> dateSeparator , ... | Transforms a DateRange into a string . |
59,261 | public function reverseTransform ( $ value ) { $ parts = explode ( $ this -> dateSeparator , $ value ) ; $ from = isset ( $ parts [ 0 ] ) ? $ parts [ 0 ] : null ; $ to = isset ( $ parts [ 1 ] ) ? $ parts [ 1 ] : null ; return new DAteRange ( $ from , $ to ) ; } | Transforms a string into a DateRange . |
59,262 | private function decode ( array $ row ) : ? array { if ( null === ( $ encoded = $ row [ $ this -> name ( ) ] ) ) { return null ; } if ( false === ( $ decoded = unserialize ( $ encoded , [ 'allowed_classes' => false ] ) ) ) { return null ; } if ( ! \ is_array ( $ decoded ) ) { return null ; } return $ decoded ; } | Decode the row value . |
59,263 | public function render ( ) { $ output = $ this -> each ( function ( $ tag ) { return $ tag -> render ( ) ; } ) ; return implode ( '' , $ output -> toArray ( ) ) ; } | Render tag elements |
59,264 | private function getNextItem ( Tag $ item , $ items ) { $ currentItem = $ items [ 0 ] ; while ( $ currentItem !== null and $ currentItem !== $ item ) { $ currentItem = next ( $ items ) ; } $ next = next ( $ items ) ; return $ next !== false ? $ next : null ; } | Get next item from items array |
59,265 | public function remove ( $ tag ) { if ( $ this -> count ( ) == 0 ) { return [ $ this , null ] ; } $ deleted = null ; foreach ( $ this -> items as $ key => $ element ) { if ( $ element === $ tag ) { $ this -> forget ( $ key ) ; $ deleted = $ tag ; break ; } } return [ $ this , $ deleted ] ; } | Remove tag element from collection |
59,266 | protected function findUseStatements ( File $ file ) { if ( array_key_exists ( $ file -> getFilename ( ) , static :: $ useCache ) ) { return static :: $ useCache [ $ file -> getFilename ( ) ] ; } $ tokens = $ file -> getTokens ( ) ; $ usePosition = $ file -> findNext ( T_USE , 0 ) ; $ useStatements = [ ] ; while ( $ us... | Find all use statements . |
59,267 | protected function shouldIgnoreUse ( File $ file , $ stackPtr ) { $ tokens = $ file -> getTokens ( ) ; $ next = $ file -> findNext ( T_WHITESPACE , ( $ stackPtr + 1 ) , null , true ) ; if ( $ tokens [ $ next ] [ 'code' ] === T_OPEN_PARENTHESIS ) { return true ; } if ( $ file -> hasCondition ( $ stackPtr , [ T_CLASS , T... | Check whether or not a USE statement should be ignored . |
59,268 | protected function resolveArrayType ( $ type ) { if ( strrpos ( $ type , '[]' , - 2 ) !== false ) { return substr ( $ type , 0 , strlen ( $ type ) - 2 ) ; } return $ type ; } | Attempt to resolve the type of an array . |
59,269 | protected function extractNamespace ( File $ file ) { $ namespace = '' ; $ tokens = $ file -> getTokens ( ) ; $ prev = $ file -> findNext ( T_NAMESPACE , 0 ) ; for ( $ i = $ prev + 2 ; $ i < count ( $ tokens ) ; $ i ++ ) { if ( ! in_array ( $ tokens [ $ i ] [ 'code' ] , [ T_STRING , T_NS_SEPARATOR ] ) ) { break ; } $ n... | Extract the first namespace found in the file . |
59,270 | public function buildEmbedHtml ( array $ attributes = [ ] , array $ parameters = [ ] ) { $ attributes = array_merge ( $ this -> attributes , $ attributes , [ 'src' => $ this -> buildEmbedUrl ( $ parameters ) , ] ) ; $ attributeStrings = [ '' ] ; foreach ( $ attributes as $ name => $ value ) { $ attributeString = ( stri... | Build the valid HTML code to embed this resource |
59,271 | public static function slugify ( $ title , $ length = 200 ) { $ title = strip_tags ( $ title ) ; $ title = preg_replace ( '|%([a-fA-F0-9][a-fA-F0-9])|' , '---$1---' , $ title ) ; $ title = str_replace ( '%' , '' , $ title ) ; $ title = preg_replace ( '|---([a-fA-F0-9][a-fA-F0-9])---|' , '%$1' , $ title ) ; $ title = se... | Sanitizes title replacing whitespace with dashes . |
59,272 | protected function sendResponseHeadersToClient ( WebRequest $ request , $ code , $ message ) { $ headers = [ "Date" => gmdate ( "D, d M Y H:i:s T" ) , "Connection" => "close" ] ; $ bytes = $ this -> sendToClient ( $ request -> getVersion ( ) . " {$code} {$message}\r\n" ) ; foreach ( $ headers as $ header => $ value ) {... | Sends the response headers through the client socket |
59,273 | protected function sendToClient ( $ line ) { $ bytes = 0 ; $ len = strlen ( $ line ) ; if ( $ len ) { while ( true ) { $ sent = socket_write ( $ this -> client , $ line , $ len ) ; if ( false === $ sent ) { throw new Exceptions \ HttpStatusError ( "Internal server error." , 500 ) ; } $ bytes += $ sent ; if ( $ sent < $... | Sends a string through the client socket |
59,274 | protected function getFile ( WebRequest $ request ) { $ path = realpath ( $ this -> dirRoot . DIRECTORY_SEPARATOR . $ request -> getPath ( ) ) ; if ( false === $ path ) { throw new Exceptions \ HttpStatusError ( "File not found." , 404 ) ; } if ( is_dir ( $ path ) ) { $ path .= DIRECTORY_SEPARATOR . $ this -> index ; }... | Returns the data for the requested file |
59,275 | public function parseComponent ( $ str ) { if ( ! is_string ( $ str ) ) { throw new InvalidUrlException ( 'Unexpected type.' ) ; } if ( strpos ( $ str , ' ' ) !== false ) { throw new InvalidUrlException ( 'Path contains whitespace.' ) ; } $ p = explode ( '/' , $ str ) ; foreach ( $ p as $ i => $ v ) { $ p [ $ i ] = raw... | Parses a path component as it appears in a URL . |
59,276 | public function get ( ) { if ( is_null ( $ this -> url ) ) { return $ this -> path -> get ( ) ; } if ( ! $ this -> url -> host -> isEmpty ( ) ) { return Path :: info ( '/' ) -> resolve ( $ this -> path ) -> get ( ) ; } return $ this -> path -> get ( ) ; } | Returns the decoded path . |
59,277 | public function set ( $ str ) { if ( $ str instanceof Path ) { $ this -> path -> set ( $ str -> get ( ) ) ; } else if ( $ str instanceof UrlPath ) { $ this -> path -> set ( $ str -> get ( ) ) ; } else if ( is_string ( $ str ) ) { $ this -> path -> set ( $ str ) ; } else { throw new \ InvalidArgumentException ( 'Unexpec... | Sets the decoded path . |
59,278 | public function isAbsolute ( ) { if ( ! is_null ( $ this -> url ) && $ this -> path -> isEmpty ( ) ) { return ! $ this -> url -> host -> isEmpty ( ) ; } return $ this -> path -> isAbsolute ( ) ; } | URLs can be relative if scheme and host are omitted . |
59,279 | public function dirname ( ) { if ( ! is_null ( $ this -> url ) && $ this -> path -> isEmpty ( ) && ! $ this -> url -> host -> isEmpty ( ) ) { return '/' ; } return $ this -> path -> dirname ( ) ; } | Return the path excluding the filename . |
59,280 | public function sizeUrl ( $ size ) { if ( ( $ this -> base [ 'return_format' ] === 'array' ) && isset ( $ this -> base [ 'value' ] [ 'sizes' ] [ $ size ] ) ) { return $ this -> base [ 'value' ] [ 'sizes' ] [ $ size ] ; } elseif ( $ this -> base [ 'return_format' ] === 'id' ) { if ( $ src = wp_get_attachment_image_src (... | Get an image URL of a specic size . |
59,281 | public function setOption ( $ key , $ value ) { if ( ! in_array ( $ key , $ this -> availableOptions ) ) { throw new Exception \ InvalidArgumentException ( 'Invalid option for Tooltip' ) ; } if ( is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } if ( ! is_string ( $ value ) ) { throw new Exception \ Inva... | Set a single option to the Tooltip |
59,282 | public static function currentIpAddress ( ) { if ( function_exists ( 'apache_request_headers' ) ) { $ headers = apache_request_headers ( ) ; } else { $ headers = $ _SERVER ; } if ( array_key_exists ( 'X-Forwarded-For' , $ headers ) && filter_var ( $ headers [ 'X-Forwarded-For' ] , FILTER_VALIDATE_IP , FILTER_FLAG_IPV4 ... | Get the ip address from the current request . |
59,283 | public function setLabel ( $ label ) { if ( null !== $ label && ! is_string ( $ label ) ) { throw new Exception ( 'Invalid argument: $label must be a string or null' ) ; } $ this -> _label = $ label ; return $ this ; } | Sets page label |
59,284 | public function setFragment ( $ fragment ) { if ( null !== $ fragment && ! is_string ( $ fragment ) ) { throw new Exception ( 'Invalid argument: $fragment must be a string or null' ) ; } $ this -> _fragment = $ fragment ; return $ this ; } | Sets a fragment identifier |
59,285 | public function setId ( $ id = null ) { if ( null !== $ id && ! is_string ( $ id ) && ! is_numeric ( $ id ) ) { throw new Exception ( 'Invalid argument: $id must be a string, number or null' ) ; } $ this -> _id = null === $ id ? $ id : ( string ) $ id ; return $ this ; } | Sets page id |
59,286 | public function setTitle ( $ title = null ) { if ( null !== $ title && ! is_string ( $ title ) ) { throw new Exception ( 'Invalid argument: $title must be a non-empty string' ) ; } $ this -> _title = $ title ; return $ this ; } | Sets page title |
59,287 | public function setTarget ( $ target = null ) { if ( null !== $ target && ! is_string ( $ target ) ) { throw new Exception ( 'Invalid argument: $target must be a string or null' ) ; } $ this -> _target = $ target ; return $ this ; } | Sets page target |
59,288 | public function setAccesskey ( $ character = null ) { if ( null !== $ character && ( ! is_string ( $ character ) || 1 != strlen ( $ character ) ) ) { throw new Exception ( 'Invalid argument: $character must be a single character or null' ) ; } $ this -> _accesskey = $ character ; return $ this ; } | Sets access key for this page |
59,289 | public function setRel ( $ relations = null ) { $ this -> _rel = array ( ) ; if ( null !== $ relations ) { if ( ! is_array ( $ relations ) ) { throw new Exception ( 'Invalid argument: $relations must be an array' ) ; } foreach ( $ relations as $ name => $ relation ) { if ( is_string ( $ name ) ) { $ this -> _rel [ $ na... | Sets the page s forward links to other pages |
59,290 | public function getRel ( $ relation = null ) { if ( null !== $ relation ) { return isset ( $ this -> _rel [ $ relation ] ) ? $ this -> _rel [ $ relation ] : null ; } return $ this -> _rel ; } | Returns the page s forward links to other pages |
59,291 | public function setRev ( $ relations = null ) { $ this -> _rev = array ( ) ; if ( null !== $ relations ) { if ( ! is_array ( $ relations ) ) { throw new Exception ( 'Invalid argument: $relations must be an array' ) ; } foreach ( $ relations as $ name => $ relation ) { if ( is_string ( $ name ) ) { $ this -> _rev [ $ na... | Sets the page s reverse links to other pages |
59,292 | public function getRev ( $ relation = null ) { if ( null !== $ relation ) { return isset ( $ this -> _rev [ $ relation ] ) ? $ this -> _rev [ $ relation ] : null ; } return $ this -> _rev ; } | Returns the page s reverse links to other pages |
59,293 | public function setCustomHtmlAttrib ( $ name , $ value ) { if ( ! is_string ( $ name ) ) { throw new Exception ( 'Invalid argument: $name must be a string' ) ; } if ( null !== $ value && ! is_string ( $ value ) ) { throw new Exception ( 'Invalid argument: $value must be a string or null' ) ; } if ( null === $ value && ... | Sets a single custom HTML attribute |
59,294 | public function getCustomHtmlAttrib ( $ name ) { if ( ! is_string ( $ name ) ) { throw new Exception ( 'Invalid argument: $name must be a string' ) ; } if ( isset ( $ this -> _customHtmlAttribs [ $ name ] ) ) { return $ this -> _customHtmlAttribs [ $ name ] ; } return null ; } | Returns a single custom HTML attributes by name |
59,295 | public function setCustomHtmlAttribs ( array $ attribs ) { foreach ( $ attribs as $ key => $ value ) { $ this -> setCustomHtmlAttrib ( $ key , $ value ) ; } return $ this ; } | Sets multiple custom HTML attributes at once |
59,296 | public function removeCustomHtmlAttrib ( $ name ) { if ( ! is_string ( $ name ) ) { throw new Exception ( 'Invalid argument: $name must be a string' ) ; } if ( isset ( $ this -> _customHtmlAttribs [ $ name ] ) ) { unset ( $ this -> _customHtmlAttribs [ $ name ] ) ; } } | Removes a custom HTML attribute from the page |
59,297 | public function setOrder ( $ order = null ) { if ( is_string ( $ order ) ) { $ temp = ( int ) $ order ; if ( $ temp < 0 || $ temp > 0 || $ order == '0' ) { $ order = $ temp ; } } if ( null !== $ order && ! is_int ( $ order ) ) { throw new Exception ( 'Invalid argument: $order must be an integer or null, ' . 'or a strin... | Sets page order to use in parent container |
59,298 | public function setResource ( $ resource = null ) { if ( null === $ resource || is_string ( $ resource ) || $ resource instanceof Acl ) { $ this -> _resource = $ resource ; } else { require_once 'Zend/Navigation/Exception.php' ; throw new Exception ( 'Invalid argument: $resource must be null, a string, ' . ' or an inst... | Sets ACL resource assoicated with this page |
59,299 | public function setPrivilege ( $ privilege = null ) { $ this -> _privilege = is_string ( $ privilege ) ? $ privilege : null ; return $ this ; } | Sets ACL privilege associated with this page |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.