idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
228,700
public function getHeaders ( ) { $ h = array ( ) ; if ( ! empty ( $ this -> timeout ) ) $ h [ 'Refresh' ] = $ this -> timeout . '; url=' . $ this -> url ; else $ h [ 'Location' ] = ( string ) $ this -> url ; return $ h ; }
Return the redirection headers
228,701
public function getHelp ( \ Erebot \ Interfaces \ Event \ Base \ TextMessage $ event , \ Erebot \ Interfaces \ TextWrapper $ words ) { if ( $ event instanceof \ Erebot \ Interfaces \ Event \ Base \ PrivateMessage ) { $ target = $ event -> getSource ( ) ; $ chan = null ; } else { $ target = $ chan = $ event -> getChan (...
Provides help about this module .
228,702
public function getAvailableLists ( ) { if ( self :: $ cache !== null ) { return array_keys ( self :: $ cache ) ; } $ lists = array ( ) ; foreach ( self :: $ paths as $ path ) { $ files = scandir ( $ path ) ; foreach ( $ files as $ file ) { if ( substr ( $ file , - 7 ) == '.sqlite' ) { $ name = strtolower ( substr ( $ ...
Returns the names of available lists .
228,703
protected static function filterLists ( $ lists , $ policy ) { $ res = array ( ) ; foreach ( $ lists as $ name => $ path ) { if ( ( bool ) preg_match ( $ policy , $ name ) ) { $ res [ $ name ] = $ path ; } } return $ res ; }
Given a mapping of wordlists names with their path and a policy returns the same mapping with only those entries whose name matches the policy .
228,704
public static function registerPath ( $ path ) { $ path = realpath ( $ path ) ; if ( ! in_array ( $ path , self :: $ paths ) ) { self :: $ paths [ ] = $ path ; self :: $ cache = null ; } }
Registers a new path containing wordlists .
228,705
public function getList ( $ list ) { if ( isset ( self :: $ refs [ $ list ] ) ) { self :: $ refs [ $ list ] [ 'counter' ] ++ ; return \ Erebot \ Module \ Wordlists \ Proxy ( self :: $ refs [ $ list ] [ 'instance' ] ) ; } $ lists = $ this -> getAvailableLists ( ) ; if ( ! in_array ( $ list , $ lists ) ) { throw new \ Er...
Returns a list of words .
228,706
public function releaseList ( \ Erebot \ Module \ Wordlists \ Wordlist $ list ) { $ nameType = \ Erebot \ Module \ Wordlists \ Wordlist :: METADATA_NAME ; $ name = $ list -> getMetadata ( $ nameType ) ; if ( ! isset ( self :: $ refs [ $ name ] ) ) { throw new \ Erebot \ NotFoundException ( 'No such list' ) ; } if ( -- ...
Releases a wordlist .
228,707
public function handle ( $ file ) { if ( ! $ mime = $ this -> getMimeForEmit ( $ file -> getExtension ( ) ) ) { return $ file ; } if ( ! $ file_loc = $ file -> getLocation ( ) ) { return $ file ; } $ file -> setMime ( $ mime ) ; $ file -> setFound ( ) ; $ fp = fopen ( $ file_loc , 'r' ) ; $ file -> setResource ( $ fp )...
handles a file with proper extension such as gif js etc .
228,708
public function addMimeType ( $ mimetype ) { $ mimetypes = $ this -> getMimeType ( true ) ; if ( is_string ( $ mimetype ) ) { $ mimetype = explode ( ',' , $ mimetype ) ; } elseif ( ! is_array ( $ mimetype ) ) { throw new Zend_Validate_Exception ( "Invalid options to validator provided" ) ; } if ( isset ( $ mimetype [ '...
Adds the mimetypes
228,709
static function titleCase ( $ string , $ delimiter = '' ) { return implode ( $ delimiter , array_map ( 'ucfirst' , self :: getWords ( $ string , true ) ) ) ; }
Converts a given string to title case
228,710
static function getWords ( $ string , $ lowercase = false ) { $ string = self :: clean ( $ string , ' ' ) ; $ string = preg_replace ( '/(.)([A-Z])([a-z])/' , '$1 $2$3' , $ string ) ; $ string = preg_replace ( '/([a-z])([A-Z])/' , '$1 $2' , $ string ) ; $ string = preg_replace ( '/([0-9])([^0-9])/' , '$1 $2' , $ string ...
Returns array of the words in a string
228,711
static function plural ( $ string ) { $ plural = array ( array ( '/(quiz)$/i' , "$1zes" ) , array ( '/^(ox)$/i' , "$1en" ) , array ( '/([m|l])ouse$/i' , "$1ice" ) , array ( '/(matr|vert|ind)ix|ex$/i' , "$1ices" ) , array ( '/(x|ch|ss|sh)$/i' , "$1es" ) , array ( '/([^aeiouy]|qu)y$/i' , "$1ies" ) , array ( '/([^aeiouy]|...
Returns the plural version of the given word . If the plural version is the same then this method will simply add an s to the end of the word .
228,712
public function handle ( $ file ) { foreach ( $ this -> view_extensions as $ ext => $ handler ) { if ( $ file -> exists ( $ ext ) ) { $ file = $ file -> withExtension ( $ ext ) ; $ file -> setMime ( $ handler [ 1 ] ) ; $ file -> setFound ( ) ; $ handle = $ handler [ 0 ] ; if ( ! is_callable ( $ handle ) ) { $ handle = ...
handles text type file such as html php text and md .
228,713
protected function dummy ( ) { $ this -> evaluatePhp ( null ) ; $ this -> markToHtml ( null ) ; $ this -> textToPre ( null ) ; }
dummy method to call private methods which are judged as unused methods .
228,714
public function size ( ) : int { if ( $ this -> bufSize == null ) { $ this -> bufSize = strlen ( $ this -> buf ) ; } return $ this -> bufSize ; }
Returns the current size of the buffer .
228,715
public function getInlineSvg ( $ filename , $ params = [ ] ) { $ fullPath = $ this -> assetDir . $ filename ; if ( ! file_exists ( $ fullPath ) ) { throw new \ Exception ( sprintf ( 'Cannot find svg file: "%s"' , $ fullPath ) ) ; } $ svgString = file_get_contents ( $ fullPath ) ; $ hasAttr = array_key_exists ( 'attr' ,...
Get an inline svg .
228,716
public function routeRequest ( \ Slab \ Components \ SystemInterface $ system ) { $ this -> determineSelectedRoute ( ) ; if ( ! empty ( $ this -> selectedRoute ) ) { return $ this -> selectedRoute ; } if ( ! empty ( $ this -> routeNameMap [ '404' ] ) ) { return $ this -> routeNameMap [ '404' ] ; } return null ; }
Route the request
228,717
private function validateRequestURI ( & $ requestURI ) { if ( $ requestURI != '/' && substr ( $ requestURI , - 1 ) == '/' ) { $ url = rtrim ( $ requestURI , '/' ) ; if ( php_sapi_name ( ) === 'cli' ) { exit ( "Please ensure the URL you typed in does not have a trailing backslash.\n" ) ; } header ( "Location: " . $ url ...
Make sure the request URI fits how we want it to
228,718
private function getPathInfo ( ) { $ requestURI = ! empty ( $ _SERVER [ 'REQUEST_URI' ] ) ? $ _SERVER [ 'REQUEST_URI' ] : '' ; $ this -> validateRequestURI ( $ requestURI ) ; if ( empty ( $ requestURI ) ) { return ; } $ request = $ requestURI ; $ this -> fullRequest = $ this -> currentRequest = $ request ; $ this -> ad...
Gets the path info and parses out the segment structure
228,719
private function checkForTrailingSlashRedirect ( ) { if ( ! empty ( $ this -> segments ) && empty ( $ this -> segments [ count ( $ this -> segments ) - 1 ] ) ) { array_pop ( $ this -> segments ) ; $ newUrl = $ this -> baseHREF . '/' . implode ( '/' , $ this -> segments ) ; header ( "Location: " . $ newUrl ) ; exit ( ) ...
Checks for a trailing slash or something in the url
228,720
public function getRoutingTable ( ) { if ( $ this -> enableCache && ! empty ( $ this -> cacheInterface ) ) { return $ this -> fetchRoutingTableFromCache ( ) ; } return $ this -> fetchRoutingTable ( ) ; }
Get the routing table from cache or otherwise
228,721
private function fetchRoutingTable ( ) { $ this -> routes = $ this -> loadRoutingTable ( ) ; if ( ! empty ( $ this -> routes ) ) { $ this -> traverseRouteListAndBuildMap ( ) ; } return $ this -> routes ; }
Fetch the routing table without caching
228,722
private function fetchRoutingTableFromCache ( ) { $ this -> routes = $ this -> cacheInterface -> get ( 'Routing_Table' ) ; if ( empty ( $ this -> routes ) ) { $ this -> routes = $ this -> loadRoutingTable ( ) ; } if ( ! empty ( $ this -> routes ) ) { $ this -> traverseRouteListAndBuildMap ( ) ; } return $ this -> route...
Fetch the routing table using the default cache provider
228,723
private function traverseRouteListAndBuildMap ( $ currentNode = null ) { if ( empty ( $ currentNode ) ) { $ this -> traverseRouteListAndBuildMap ( $ this -> routes ) ; return ; } if ( is_array ( $ currentNode ) ) { foreach ( $ currentNode as $ node ) { $ this -> traverseRouteListAndBuildMap ( $ node ) ; } return ; } if...
Traverses the list of routes and builds a name - > route map reference list
228,724
public function loadRoutingTable ( ) { if ( empty ( $ this -> routeFiles ) || ! is_array ( $ this -> routeFiles ) ) { if ( ! empty ( $ this -> log ) ) { $ this -> log -> error ( "Missing configuration option routeFiles, or route file list in improper format." ) ; } return false ; } $ routeTable = array ( ) ; foreach ( ...
Load routing table from files
228,725
private function loadRouteFile ( & $ routeTable , $ fileName ) { libxml_use_internal_errors ( true ) ; $ xml = simplexml_load_file ( $ fileName ) ; if ( empty ( $ xml ) ) { $ errorMessage = "Failed to parse XML route file: " . $ fileName . "" ; foreach ( libxml_get_errors ( ) as $ error ) { $ errorMessage .= "\n" . $ e...
Load an XML route file from a fully qualified path name
228,726
public function determineSelectedRoute ( ) { if ( empty ( $ this -> routes ) ) { $ this -> getRoutingTable ( ) ; } if ( empty ( $ this -> segments ) ) { $ this -> segments = array ( '/' ) ; } $ currentLevel = & $ this -> routes ; $ index = 0 ; $ isRoot = true ; foreach ( $ this -> segments as $ segment ) { $ segmentIsI...
Determine the actually selected route from URL params
228,727
public function getRouteByName ( $ routeName ) { if ( ! empty ( $ this -> routeNameMap [ $ routeName ] ) ) { return $ this -> routeNameMap [ $ routeName ] ; } return null ; }
Gets a route by name
228,728
public static function createFromArray ( $ array , $ unparsed = [ ] ) { $ nyaaMeta = new NyaaMeta ( ) ; foreach ( $ array as $ key => $ value ) { $ nyaaMeta -> set ( $ key , $ value ) ; } $ nyaaMeta -> setUnparsed ( $ unparsed ) ; return $ nyaaMeta ; }
Creates a new NyaaMeta instance from array
228,729
public static function solveIndicator ( $ data ) { $ normData = strtolower ( trim ( $ data ) ) ; foreach ( self :: $ indicators as $ key => $ tests ) { foreach ( $ tests as $ test ) { if ( $ test [ 0 ] == '/' && preg_match ( $ test , $ normData ) ) { return [ $ key , $ normData ] ; } elseif ( $ normData === $ test ) { ...
Solves what type of data an indicator is
228,730
public function get ( $ meta ) { return isset ( $ this -> parsed [ $ meta ] ) ? $ this -> parsed [ $ meta ] : null ; }
Gets the meta value by name null returned if not found
228,731
public function addRule ( $ pattern , $ replacement = null ) { if ( is_object ( $ pattern ) && method_exists ( $ pattern , 'toArray' ) ) $ pattern = $ pattern -> toArray ( ) ; if ( is_object ( $ replacement ) && method_exists ( $ replacement , 'toArray' ) ) $ replacement = $ replacement -> toArray ( ) ; if ( ! ( is_arr...
Add a rule to the set of rules in this BBCode instance
228,732
public function apply ( $ txt ) { if ( ! is_string ( $ txt ) ) throw new \ RuntimeException ( "Argument should be a string" ) ; foreach ( $ this -> rules as $ pattern => $ replacement ) { if ( is_callable ( $ replacement ) ) $ txt = preg_replace_callback ( $ pattern , $ replacement , $ txt ) ; else $ txt = preg_replace...
Apply all the configured rules to the provided text and return the result
228,733
protected function renderPage ( $ page , $ options = array ( ) ) { $ this -> render ( __DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $ page . '.php' , $ options ) ; }
Render a selected view .
228,734
protected function flatReference ( array $ reference ) { reset ( $ reference ) ; foreach ( $ reference as $ key => $ value ) { if ( is_object ( $ value ) ) { $ reference [ $ key ] = get_class ( $ value ) ; } elseif ( is_array ( $ value ) ) { $ reference [ $ key ] = $ this -> flatReference ( $ value ) ; } } ksort ( $ re...
flat the reference array to make it easy for serialize
228,735
protected function setContent ( $ content ) { $ this -> content = ( string ) $ content ; if ( empty ( $ this -> content ) ) { throw new \ Exception ( 'Header content is empty !' ) ; } return $ this ; }
Set header content
228,736
protected function setHttpCode ( $ httpCode = null ) { if ( $ httpCode !== null ) { $ this -> httpCode = ( int ) $ httpCode ; if ( ! HttpCode :: exists ( $ this -> httpCode ) ) { throw new \ DomainException ( 'Http Code does not exist! (code: ' . $ this -> httpCode . ')' ) ; } } return $ this ; }
Set http code for the header
228,737
protected function determineInputFiles ( ) { if ( empty ( $ this -> route -> getParameters ( ) -> files ) ) { $ this -> setNotReady ( "No input files found." , null , 404 ) ; return ; } if ( is_array ( $ this -> route -> getParameters ( ) -> files ) ) { foreach ( $ this -> route -> getParameters ( ) -> files as $ file ...
Determine input files from the route parameters
228,738
private function addFileObject ( $ file ) { $ file = $ this -> getActualFilename ( $ file ) ; try { $ this -> concatenator -> addObject ( $ file , [ ] ) ; } catch ( \ Exception $ e ) { $ this -> system -> log ( ) -> error ( "Failed to add concatenator object: " . $ file ) ; } }
Add a file object
228,739
public function cmdGetAddress ( ) { $ result = $ this -> getListAddress ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableAddress ( $ result ) ; $ this -> output ( ) ; }
Callback for address - get command
228,740
public function cmdUpdateAddress ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ...
Callback for address - update command
228,741
protected function addAddress ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> address -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } }
Add a new address
228,742
protected function updateAddress ( $ address_id ) { if ( ! $ this -> isError ( ) && ! $ this -> address -> update ( $ address_id , $ this -> getSubmitted ( ) ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } }
Updates an address
228,743
protected function submitAddAddress ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedJson ( 'data' ) ; $ this -> validateComponent ( 'address' ) ; $ this -> addAddress ( ) ; }
Add a new address at once
228,744
protected function wizardAddAddress ( ) { $ types = $ this -> address -> getTypes ( ) ; $ this -> validateMenu ( 'type' , $ this -> text ( 'Address type' ) , 'address' , array_combine ( $ types , $ types ) , 'shipping' ) ; $ this -> validatePrompt ( 'user_id' , $ this -> text ( 'User ID' ) , 'address' ) ; $ this -> val...
Add a new address step by step
228,745
public function remove ( $ key ) { return ( $ this -> memcache ) ? $ this -> memcache -> remove ( $ this -> prefix . '_' . $ key ) : false ; }
Remove Memcache key
228,746
protected function checkRootNode ( ) { $ id = ( int ) Application :: getRequest ( ) -> get ( 'id' ) ; $ repository = $ this -> getEntityManager ( ) -> getRepository ( $ this -> entityName ) ; if ( $ node = $ repository -> find ( $ id ) ) { return $ node -> getLevel ( ) > 1 ; } return false ; }
If node not root then method return true
228,747
static function array2Parameters ( $ params , $ stringdelim ) { $ s = "" ; foreach ( $ params as $ p ) { if ( is_int ( $ p ) ) $ s .= "$p, " ; else $ s .= $ stringdelim . $ p . $ stringdelim . ", " ; } if ( $ s ) $ s = substr ( $ s , 0 , - 2 ) ; return $ s ; }
Convert an array to a commas separated string of parameters
228,748
static function is_associative_array ( $ a , $ ifEmptyAssociativeArray = false ) { if ( ! is_array ( $ a ) ) return false ; if ( count ( $ a ) == 0 ) return $ ifEmptyAssociativeArray ; $ keys = array_keys ( $ a ) ; foreach ( $ keys as $ k ) if ( ! is_int ( $ k ) ) return true ; return max ( $ keys ) + 1 != count ( $ a ...
Test if a given array is associative or has only numeric keys
228,749
static function matchAll ( $ pattern , $ buffer , $ vars , & $ matches ) { $ tmp = array ( ) ; if ( preg_match_all ( $ pattern , $ buffer , $ tmp , PREG_SET_ORDER ) === FALSE ) return false ; else { for ( $ m = 0 ; $ m < count ( $ tmp ) ; $ m ++ ) { $ res = array ( ) ; for ( $ v = 0 ; $ v < count ( $ vars ) ; $ v ++ ) ...
Convenient function to extract data from a string through a regular expression .
228,750
static function string2associativeArray ( $ str , $ sep , $ sepval , $ valIfEmpty = NULL ) { $ str = explode ( $ sep , $ str ) ; $ ret = array ( ) ; foreach ( $ str as $ s ) { $ s = explode ( $ sepval , $ s ) ; if ( count ( $ s ) == 2 ) $ ret [ $ s [ 0 ] ] = ( $ s [ 1 ] != '' ) ? $ s [ 1 ] : $ valIfEmpty ; } return $ r...
Decode a string to an associative array
228,751
static function explodeAssociativeArray ( $ str , $ sep = ';' , $ sepval = '=' , $ valIfEmpty = NULL ) { return self :: string2associativeArray ( $ str , $ sep , $ sepval , $ valIfEmpty ) ; }
Synonymous for string2associativeArray with default values for separators
228,752
private function getPoolsSection ( ) { $ builder = new TreeBuilder ( ) ; $ node = $ builder -> root ( 'pools' ) ; $ node -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'helper' ) -> isRequired ( ) -> addDefaultsIfNotSet ( ) -> children ( ) -> variableNode ( 'templates' ) -> defaultValue ( [ '_form.html' => '...
Returns the pools configuration definition .
228,753
public function getTree ( ObjectCollection $ objectCollection , int $ left = 0 , int $ right = NULL ) : array { $ items = [ ] ; foreach ( $ objectCollection as $ item ) { $ items [ ] = $ item ; } $ tree = $ this -> generateTree ( $ items , $ left , $ right ) ; return $ tree ; }
Metoda pro transformaci nested tree do multilevel pole
228,754
public function getFlatCollection ( array $ tree ) : ObjectCollection { $ data = [ ] ; array_walk_recursive ( $ tree , function ( $ item ) use ( & $ data ) { if ( $ item !== NULL ) { $ data [ ] = $ item ; } } ) ; return new ObjectCollection ( $ data ) ; }
Metoda pro transformaci multilevel pole do flat ObjectCollection
228,755
public function date ( string $ format = Date :: DISPLAY_FORMAT ) : DateFieldBuilder { return new DateFieldBuilder ( $ this -> field -> type ( new DateType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a Date instance .
228,756
public function dateTime ( string $ format = DateTime :: DISPLAY_FORMAT ) : DateTimeFieldBuilder { return new DateTimeFieldBuilder ( $ this -> field -> type ( new DateTimeType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a DateTime instance .
228,757
public function time ( string $ format = TimeOfDay :: DEFAULT_FORMAT ) : TimeOfDayFieldBuilder { return new TimeOfDayFieldBuilder ( $ this -> field -> type ( new TimeOfDayType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a TimeOfDay instance .
228,758
public function dateTimeWithTimezone ( string $ format = TimezonedDateTime :: DISPLAY_FORMAT ) : TimezonedDateTimeFieldBuilder { return new TimezonedDateTimeFieldBuilder ( $ this -> field -> type ( new TimezonedDateTimeType ( $ format ) ) ) ; }
Validates the input with the supplied format and converts the input to a TimezonedDateTime instance .
228,759
public function dateRange ( string $ format = Date :: DISPLAY_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new DateRangeType ( $ format ) ) ; }
Validates the input as a date range and converts it to an instance of DateRange .
228,760
public function dateTimeRange ( string $ format = DateTime :: DISPLAY_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new DateTimeRangeType ( $ format ) ) ; }
Validates the input with the supplied format and converts the input to a DateTimeRange instance .
228,761
public function timeRange ( string $ format = TimeOfDay :: DEFAULT_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new TimeRangeType ( $ format ) ) ; }
Validates the input with the supplied format and converts the input to a TimeRange instance .
228,762
public function dateTimeWithTimezoneRange ( string $ format = TimezonedDateTime :: DISPLAY_FORMAT ) : FieldBuilderBase { return $ this -> field -> type ( new TimezonedDateTimeRangeType ( $ format ) ) ; }
Validates the input with the supplied format and converts the input to a TimezonedDateTimeRange instance .
228,763
public function multipleFrom ( array $ valueLabelMap ) : ArrayOfFieldBuilder { return $ this -> arrayOf ( Field :: element ( ) -> string ( ) -> oneOf ( $ valueLabelMap ) -> required ( ) ) -> containsNoDuplicates ( ) ; }
Validates the input as an an array only containing elements which are in the supplied value map
228,764
public function nsPush ( ) { $ nsName = self :: DELIMITER . ( self :: $ _pushID ++ ) ; $ this -> _data [ $ nsName ] = array ( ) ; $ this -> _current = & $ this -> _data [ $ nsName ] ; $ this -> _names [ ] = & $ this -> _current ; $ this -> _pushedData [ ] = $ nsName ; }
Pushes namespace .
228,765
public function nsPop ( ) { array_pop ( $ this -> _names ) ; $ this -> _current = & $ this -> _names [ sizeof ( $ this -> _names ) - 1 ] ; unset ( $ this -> _data [ array_pop ( $ this -> _pushedData ) ] ) ; }
Pops namespace .
228,766
private function _shiftTmp ( $ path ) { if ( $ path ) { $ names = explode ( self :: DELIMITER , $ path ) ; foreach ( $ names as $ name ) { if ( ! is_array ( $ this -> _tmp ) ) { $ this -> _tmp = array ( ) ; } if ( ! isset ( $ this -> _tmp [ $ name ] ) ) { $ this -> _tmp [ $ name ] = null ; } $ this -> _tmp = & $ this -...
It shifts .
228,767
public function joinOnMatch ( $ nickname , UserEventInterface $ event , EventQueueInterface $ queue ) { if ( $ nickname == $ event -> getConnection ( ) -> getNickname ( ) && ( $ index = array_search ( $ event -> getSource ( ) , $ this -> channels ) ) !== false ) { $ queue -> ircJoin ( $ this -> channels [ $ index ] , $...
Joins a channel if nickname and channel matches the own nickname and a channel in channels configuration respectively .
228,768
public function onPartChannels ( UserEventInterface $ event , EventQueueInterface $ queue ) { $ this -> joinOnMatch ( $ event -> getNick ( ) , $ event , $ queue ) ; }
Listen for part channel events .
228,769
public function onKickChannels ( UserEventInterface $ event , EventQueueInterface $ queue ) { $ this -> joinOnMatch ( $ event -> getParams ( ) [ 'user' ] , $ event , $ queue ) ; }
Listen for kick channel events .
228,770
public function query ( $ queryString , $ suggestedClass = NULL ) { if ( ! empty ( $ this -> log ) ) { $ this -> log -> debug ( "Performing SQL: " . $ queryString . '...' , 'DATABASE' ) ; } $ result = $ this -> mysqli -> query ( $ queryString ) ; if ( ! empty ( $ this -> mysqli -> error ) ) { throw new \ Slab \ Databas...
Perform a standard query
228,771
public function buildInsertQuery ( $ table , $ data ) { $ sql = "INSERT INTO " . $ this -> quoteSpecialName ( $ table ) . " " ; if ( ! empty ( $ data [ 'ON DUPLICATE' ] ) ) { $ onDuplicate = $ data [ 'ON DUPLICATE' ] ; unset ( $ data [ 'ON DUPLICATE' ] ) ; } $ keys = $ values = '' ; foreach ( $ data as $ key => $ value...
Perform an insert query
228,772
protected function quoteSpecialName ( $ name ) { if ( $ name [ 0 ] == '`' && $ name [ mb_strlen ( $ name ) - 1 ] == '`' ) return $ name ; $ name = '`' . $ name . '`' ; $ name = str_replace ( '.' , '`.`' , $ name ) ; return $ name ; }
MySQL style special naming backticks quotes
228,773
public function buildUpdateQuery ( $ table , $ data , $ where , $ limit ) { $ sql = "UPDATE " . $ this -> quoteSpecialName ( $ table ) . " SET " ; $ values = '' ; foreach ( $ data as $ key => $ value ) { if ( ! empty ( $ values ) ) $ values .= ', ' ; $ values .= $ this -> quoteSpecialName ( $ key ) . ' = ' . $ this -> ...
Update a table
228,774
public function wheel ( $ table , $ column , $ value , $ separator = '_' , $ maxTries = 10 ) { $ tempValue = $ value ; for ( $ i = 2 ; $ i <= $ maxTries ; ++ $ i ) { $ result = $ this -> query ( "select count(*) as cnt from " . $ this -> quoteSpecialName ( $ table ) . " where " . $ this -> quoteSpecialName ( $ column )...
Wheel a string value in the database
228,775
private function CreateSettings ( ) { $ this -> settings = new Settings ( ) ; $ this -> settings -> SetLogLifetime ( 90 ) ; $ this -> settings -> SetChangeRequestLifetime ( 30 ) ; $ this -> settings -> SetSmtpSecurity ( ( string ) Enums \ SmtpSecurity :: None ( ) ) ; $ admin = $ this -> FirstAdmin ( ) ; if ( $ admin ) ...
Creates the settings initally
228,776
private function FirstAdmin ( ) { $ sql = Access :: SqlBuilder ( ) ; $ tblUser = User :: Schema ( ) -> Table ( ) ; $ where = $ sql -> Equals ( $ tblUser -> Field ( 'IsAdmin' ) , $ sql -> Value ( true ) ) ; $ orderBy = $ sql -> OrderList ( $ sql -> OrderAsc ( $ tblUser -> Field ( 'ID' ) ) ) ; return User :: Schema ( ) -...
Gets the first user that is an admin
228,777
public static function onChange ( PathInterface $ cache , Loader $ load = null ) : self { $ self = new self ( $ cache , $ load ) ; $ self -> debug = true ; return $ self ; }
The cached container will be recompiled if the definition file has changed since the last compilation
228,778
public function boot ( ) { session_start ( ) ; $ this -> registerWhoops ( ) ; $ route = ( empty ( $ _REQUEST [ '_' ] ) ? '/' : htmlspecialchars ( $ _REQUEST [ '_' ] ) ) ; require_once ( PATH . '/app/routes.php' ) ; return Route :: execute ( $ route ) ; }
Boot Sectorr application .
228,779
protected function registerWhoops ( ) { $ whoops = new \ Whoops \ Run ; $ whoops -> pushHandler ( new \ Whoops \ Handler \ PrettyPageHandler ) ; $ whoops -> register ( ) ; }
Register Whoops error handler .
228,780
protected function childbearing ( \ DOMNode $ node ) { if ( $ node -> hasChildNodes ( ) ) { foreach ( $ node -> childNodes as $ child ) { if ( $ child -> nodeType === XML_ELEMENT_NODE ) { return true ; } } } return false ; }
Checks if a specified node has children .
228,781
protected function minify ( $ html ) { $ html = str_replace ( '<?xml encoding="UTF-8">' , '' , $ html ) ; $ html = trim ( preg_replace ( '/\s+/' , ' ' , $ html ) ) ; $ html = str_replace ( '> <' , '><' , $ html ) ; return str_replace ( array ( ' />' , '/>' ) , '>' , $ html ) ; }
Minifies the specified HTML .
228,782
protected function remove ( \ DOMNodeList $ elements ) { $ encoded = array ( 'textarea' , 'code' ) ; foreach ( $ elements as $ element ) { if ( $ this -> childbearing ( $ element ) ) { continue ; } $ output = ( string ) $ element -> nodeValue ; if ( in_array ( $ element -> nodeName , $ encoded ) ) { $ output = htmlenti...
Removes the content of single elements .
228,783
protected function restore ( $ html ) { foreach ( $ this -> data as $ index => $ item ) { $ key = ( string ) '$' . $ index . '$' ; $ html = str_replace ( $ key , $ item , $ html ) ; } return ( string ) $ html ; }
Restores the data into the minified HTML .
228,784
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ rootDir = $ this -> getRootDir ( ) ; $ stagingName = $ input -> getOption ( 'staging-name' ) ; $ stagingPath = $ this -> getCapistranoDir ( ) . '/deploy/' ; $ staging = sprintf ( '%s%s.rb' , $ stagingPath , $ stagingName ) ; $ output -...
Deploys application .
228,785
public function actionIndex ( ) { $ cards = $ this -> loadDashboardCards ( ) ; $ cardData = array ( ) ; foreach ( $ cards -> value as $ id => $ url ) { $ metadata = $ this -> loadCardDetailsModel ( $ id ) ; $ cardData [ $ id ] = $ metadata -> value ; } return array ( 'cards' => $ cards -> value , 'cardData' => $ cardDa...
Retrieves all the dashboard cards for the current user
228,786
public function actionIndexPost ( ) { $ cards = $ this -> loadDashboardCards ( ) ; $ id = Cii :: get ( $ _POST , 'id' , false ) ; $ url = Cii :: get ( $ _POST , 'url' , false ) ; $ data = Cii :: get ( $ _POST , 'details' , false ) ; if ( $ id === false || $ url === false || $ data == false ) throw new CHttpException ( ...
Installs a new card to the dashboard cards and adds the appropriate settings to the database
228,787
public function actionIndexDelete ( $ id = NULL ) { $ cards = $ this -> loadDashboardCards ( ) ; $ value = $ cards -> value ; if ( array_key_exists ( $ id , $ value ) ) unset ( $ value [ $ id ] ) ; $ cards -> value = CJSON :: encode ( $ value ) ; if ( $ cards -> save ( ) ) { $ newCard = $ this -> loadCardDetailsModel (...
Deletes a card from the dashboard
228,788
private function loadDashboardCards ( ) { $ model = UserMetadata :: model ( ) -> getPrototype ( 'UserMetadata' , array ( 'user_id' => $ this -> user -> id , 'key' => 'dashboard_cards' ) , array ( 'value' => '{}' ) ) ; $ model -> value = CJSON :: decode ( $ model -> value ) ; return $ model ; }
Loads all the dashboard cards in order for this particular user
228,789
private function loadCardDetailsModel ( $ id = NULL ) { if ( $ id == NULL ) throw new CHttpException ( 400 , Yii :: t ( 'Api.card' , 'Missing card ID' ) ) ; $ model = UserMetadata :: model ( ) -> getPrototype ( 'UserMetadata' , array ( 'user_id' => $ this -> user -> id , 'key' => $ id . '_card_settings' ) , array ( 'va...
Returns a UserMetadata Object for a given card containing the properties and settings for that card .
228,790
final public function setView ( View $ view ) { $ this -> view = $ view ; $ this -> publicAssetsPath = ROOT . 'public' . DIRECTORY_SEPARATOR . '.assets' . DIRECTORY_SEPARATOR ; return $ this ; }
Sets the view to render
228,791
protected function module ( $ check = null ) { $ module = Util :: camelToHyphen ( $ this -> view -> getModule ( ) ) ; return $ check ? ( $ check == $ module ) : $ module ; }
Fetches the current module
228,792
protected function controller ( $ check = null ) { $ controller = Util :: camelToHyphen ( $ this -> view -> getController ( ) -> getClassName ( ) ) ; return $ check ? ( $ check == $ controller ) : $ controller ; }
Fetches the current controller
228,793
protected function params ( $ check = null ) { $ params = $ this -> view -> getParams ( ) ; if ( $ check ) { if ( is_array ( $ check ) ) { $ inter = array_intersect ( $ check , $ params ) ; return ( count ( $ inter ) === count ( $ check ) ) ; } else { return in_array ( $ check , $ params ) ; } } return $ params ; }
Fetches the parameters set to the current action
228,794
final public function loadLayout ( $ layoutName , array $ variables = array ( ) , $ fromTheme = false ) { $ dsLayout = $ this -> getLayoutPath ( $ layoutName , $ fromTheme ) ; if ( ! $ dsLayout ) return '' ; foreach ( $ variables as $ var => $ value ) { $ $ var = $ value ; } include $ dsLayout ; }
Loads a layout
228,795
private function getLayoutPath ( $ layout = null , $ fromTheme = false ) { $ layout = ( $ layout === null ) ? $ this -> view -> getController ( ) -> getLayout ( ) : $ layout ; if ( ! $ layout ) return false ; if ( ! $ fromTheme && is_readable ( MODULES . $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . 'View' . ...
Fetches the layout path
228,796
final public function render ( $ content = null ) { if ( $ content === null ) { foreach ( $ this -> view -> getVariables ( ) as $ var => $ val ) { $ $ var = $ val ; } $ viewFile = $ this -> view -> getViewFile ( ) ; if ( ! is_readable ( MODULES . $ viewFile [ 0 ] . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . '...
Renders the action content to the browser
228,797
private function updateAssets ( $ file ) { $ modulesAssets = MODULES . $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR ; $ themeAssets = THEMES . engineGet ( 'config' , 'defaults' , 'theme' ) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR ; i...
updates the cached asset files
228,798
private function getFile ( $ file , $ fromTheme ) { $ this -> updateAssets ( $ file ) ; if ( ! $ fromTheme && is_readable ( $ this -> publicAssetsPath . $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . $ file ) ) { return $ this -> parseFile ( $ this -> view -> getModule ( ) . DIRECTORY_SEPARATOR . $ file ) ; } ...
Fetches the path to file
228,799
final protected function loadCss ( $ css , $ fromTheme = false , $ once = false ) { if ( $ once && ! $ this -> canLoadAsset ( $ css , 'css' ) ) return null ; return '<link rel="stylesheet" type="text/css" href="' . $ this -> getFile ( $ css . '.css' , $ fromTheme ) . '" />' . "\n" ; }
Loads a style sheet file