idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
3,700
public function getTableSchemas ( $ database = 'base' ) { $ driver = $ this -> getDatabase ( $ database ) -> getDriver ( ) ; $ connection = $ this -> establishConnection ( $ database , Database :: TARGET_SLAVE ) ; $ names = $ driver -> getTableNames ( $ connection ) ; $ schemas = [ ] ; foreach ( $ names as $ name ) { $...
get table schema instances
3,701
public function getTx ( ) { if ( $ this -> _tx && $ this -> _tx -> isValid ( ) ) return $ this -> _tx ; return $ this -> _tx = new Transaction ( ) ; }
get transaction instance
3,702
public function getMonthSummary ( $ parentObject , $ options = [ ] ) { $ limit = isset ( $ options [ 'limit_months' ] ) ? $ options [ 'limit_months' ] : 5 ; $ query = $ this -> getBaseStatsQuery ( $ parentObject ) ; $ query -> select ( [ 'DATE_FORMAT(log_date, \'%Y-%m\') as month' , 'SUM(`hours`) as sum' ] ) ; $ query ...
Get month summary .
3,703
public function getTopContributors ( $ parentObject , $ options = [ ] ) { $ individualType = Yii :: $ app -> collectors [ 'types' ] -> getOne ( 'Individual' ) -> object ; $ individualModelClass = $ individualType -> primaryModel ; $ individualModelAlias = $ individualModelClass :: modelAlias ( ) ; $ taxonomyType = Yii ...
Get top contributors .
3,704
public function getTotalHours ( $ parentObject ) { $ query = $ this -> getBaseStatsQuery ( $ parentObject ) ; $ query -> select ( [ 'SUM(`hours`)' ] ) ; return $ query -> scalar ( ) ; }
Get total hours .
3,705
public function getBaseStatsQuery ( $ parentObject ) { $ baseQuery = $ parentObject -> queryChildObjects ( $ this -> primaryModel ) ; $ query = new Query ( ) ; $ query -> from ( [ '(' . $ baseQuery -> createCommand ( ) -> rawSql . ') innerQuery' ] ) ; return $ query ; }
Get base stats query .
3,706
public function getCachingDependency ( $ parentObject ) { $ baseQuery = $ this -> getBaseStatsQuery ( $ parentObject ) ; $ baseQuery -> select ( [ 'innerQuery.modified' ] ) ; $ baseQuery -> addOrderBy ( [ 'innerQuery.modified' => SORT_DESC ] ) ; $ baseQuery -> limit ( 1 ) ; $ cacheSql = $ baseQuery -> createCommand ( )...
Get caching dependency .
3,707
public function getTypeProperty ( $ name ) { $ return = [ ] ; $ types = $ this -> getTypes ( ) ; foreach ( $ types as $ type ) { $ return [ ] = $ type -> { $ name } ; } return $ return ; }
Get property of a type by name
3,708
protected function generateTypesNames ( ) { $ localAdapter = new LocalAdapter ( $ this -> getTypesDirectory ( ) ) ; $ files = $ localAdapter -> listContents ( '/' , true ) ; $ names = [ ] ; foreach ( $ files as $ file ) { if ( $ file [ 'type' ] == 'file' ) { $ name = $ file [ 'path' ] ; $ name = $ this -> generateTypeN...
Generate array of type names
3,709
protected function generateTypeNameFromPath ( $ path ) { $ name = str_replace ( $ this -> getTypesDirectory ( ) , '' , $ path ) ; $ name = str_replace ( '.php' , '' , $ name ) ; $ name = trim ( $ name , '\/' ) ; return str_replace ( [ '/' , '\\' ] , '\\' , $ name ) ; }
Generate the type name from file path
3,710
protected function checkValidTypeName ( $ name ) { if ( in_array ( $ name , [ 'Abstract' , 'AbstractType' , 'Generic' ] ) ) { return false ; } if ( strpos ( $ name , '\AbstractType' ) !== false || strpos ( $ name , '/AbstractType' ) !== false ) { return false ; } if ( strpos ( $ name , 'Trait' ) !== false ) { return fa...
Check if givven name is valid type name
3,711
public function getNewType ( $ type = null ) { $ className = $ this -> getTypeClass ( $ type ) ; $ object = new $ className ( ) ; $ object -> setManager ( $ this ) ; return $ object ; }
Get new type object
3,712
public function doWork ( ) { $ this -> cliHelper -> writeTimeLine ( 'Setting up signal handlers...' ) ; declare ( ticks = 1 ) ; pcntl_signal ( SIGTERM , array ( $ this , 'shutdownProcesses' ) ) ; pcntl_signal ( SIGINT , array ( $ this , 'shutdownProcesses' ) ) ; pcntl_signal ( SIG_IGN , array ( $ this , 'shutdownProces...
Starting and monitoring the tasks
3,713
public function shutdownProcesses ( ) { foreach ( $ this -> processes as $ pid => $ process ) { unset ( $ this -> processes [ $ pid ] ) ; posix_kill ( $ pid , SIGUSR1 ) ; } exit ; }
Shutdown the processes when the process manager should killed
3,714
public function startProcess ( Task $ task ) { $ pid = pcntl_fork ( ) ; $ this -> startFork ( $ pid , $ this -> onStart , $ task ) ; }
Starts a new process of the given task
3,715
public function restartProcess ( Process $ oldProcess ) { unset ( $ this -> processes [ $ oldProcess -> getPid ( ) ] ) ; posix_kill ( $ oldProcess -> getPid ( ) , SIGUSR1 ) ; $ pid = pcntl_fork ( ) ; $ this -> startFork ( $ pid , $ this -> onRestart , $ oldProcess -> getTask ( ) , $ oldProcess ) ; }
Restarts a process if the runtime is reached
3,716
public function startCrashedProcess ( ) { $ oldPid = pcntl_waitpid ( - 1 , $ status , WNOHANG ) ; if ( $ oldPid === - 1 || ! isset ( $ this -> processes [ $ oldPid ] ) ) { return ; } $ oldProcess = $ this -> processes [ $ oldPid ] ; unset ( $ this -> processes [ $ oldPid ] ) ; $ pid = pcntl_fork ( ) ; $ this -> startFo...
Starts a crashed process again
3,717
protected function startFork ( $ pid , $ callback , Task $ task , Process $ oldProcess = null ) { if ( $ pid === - 1 ) { $ this -> cliHelper -> writeTimeLine ( 'Could not fork!' ) ; exit ; } elseif ( $ pid ) { $ newProcess = new Process ( $ task , $ pid ) ; $ this -> processes [ $ pid ] = $ newProcess ; if ( $ callback...
Starts the work of the fork
3,718
public static function getJsMarker ( $ pFooter = false ) { return ( $ pFooter ) ? '/' . static :: VIEW_MARKER . self :: JS_MARKER . self :: JS_MARKER_FOOTER . '/' : '/' . static :: VIEW_MARKER . self :: JS_MARKER . self :: JS_MARKER_HEADER . '/' ; }
Return the HTML JS Marker tag .
3,719
private function _processHtmlCssMarker ( & $ pBuffer ) { $ this -> _css = array_unique ( $ this -> _css ) ; $ skinPath = $ this -> _getSkinRelativePath ( ) ; $ cssTags = array ( ) ; foreach ( $ this -> _css as $ css ) { if ( ! filter_var ( $ css , FILTER_VALIDATE_URL , FILTER_FLAG_PATH_REQUIRED ) and strpos ( $ css , '...
Replace the AGL CSS Marker in the buffer .
3,720
private function _processHtmlJsMarker ( & $ pBuffer , $ pId ) { $ this -> _js [ $ pId ] = array_unique ( $ this -> _js [ $ pId ] ) ; $ skinPath = $ this -> _getSkinRelativePath ( ) ; $ jsTags = array ( ) ; foreach ( $ this -> _js [ $ pId ] as $ js ) { if ( ! filter_var ( $ js , FILTER_VALIDATE_URL , FILTER_FLAG_PATH_RE...
Replace the AGL JS Marker in the buffer .
3,721
private function _processHtmlTitleMarker ( & $ pBuffer ) { $ title = ( $ this -> _titlePrefix and $ this -> _title ) ? $ this -> _titlePrefix . $ this -> _titleSeparator . $ this -> _title : $ this -> _titlePrefix . $ this -> _title ; $ pBuffer = str_replace ( self :: getTitleMarker ( ) , $ title , $ pBuffer ) ; if ( !...
Replace the AGL Title Marker in the buffer .
3,722
private function _processHtmlMetaMarker ( & $ pBuffer ) { $ pBuffer = str_replace ( self :: getMetaMarker ( ) , implode ( "\n" , $ this -> _meta ) . "\n" , $ pBuffer ) ; return $ this ; }
Replace the AGL Meta Marker in the buffer .
3,723
protected function _prepareRender ( $ pBuffer ) { $ hasMarkers = preg_match_all ( '#(/' . static :: VIEW_MARKER . '([A-Z0-9_]+)(::([a-z]+))?/)#' , $ pBuffer , $ matches ) ; if ( $ hasMarkers !== false ) { foreach ( $ matches [ 2 ] as $ i => $ marker ) { $ method = '_process' . StringData :: toCamelCase ( $ marker ) . '...
Replace the AGL Markers in the buffer before rendering it .
3,724
public function addJs ( $ pFile , $ pFooter = false ) { if ( ! $ pFooter ) { $ this -> _js [ self :: JS_MARKER_HEADER ] [ ] = $ pFile ; } else { $ this -> _js [ self :: JS_MARKER_FOOTER ] [ ] = $ pFile ; } return $ this ; }
Add JS to page .
3,725
public function setDescription ( $ pDescription ) { $ this -> addMeta ( 'description' , array ( 'name' => 'description' , 'content' => $ pDescription ) ) ; $ this -> addMeta ( 'itemprop.description' , array ( 'itemprop' => 'description' , 'content' => $ pDescription ) ) ; $ this -> addMeta ( 'og:description' , array ( ...
Set the META Description tags .
3,726
public function addMeta ( $ pId , array $ pAttributes ) { $ meta = array ( ) ; foreach ( $ pAttributes as $ attribute => $ value ) { $ meta [ ] = $ attribute . '="' . $ value . '"' ; } $ this -> _meta [ $ pId ] = '<meta ' . implode ( ' ' , $ meta ) . '>' ; return $ this ; }
Add a META tag .
3,727
public static function hasAnyMatch ( $ needle , $ patterns , $ delimiter = '/' ) { foreach ( $ patterns as $ pattern ) { if ( preg_match ( $ delimiter . $ pattern . $ delimiter , $ needle ) ) { return true ; } } return false ; }
Return if anyone in the given patterns matches the needle .
3,728
public function resolve ( Exception $ exception ) { if ( $ abettor = $ this -> getAbettor ( $ exception ) ) { return new $ abettor ; } return $ this -> handler ; }
Resolve the appropriate Exception Handler
3,729
public static function moduleUserIdentity ( ) { if ( empty ( static :: $ _moduleUserIdentity ) ) { $ module = Yii :: $ app -> getModule ( static :: parameter ( 'userModuleUniqueId' ) ) ; if ( ! empty ( $ module ) && $ module instanceof UniModule ) { $ result = $ module -> getDataModel ( static :: parameter ( 'userManag...
Find Users module module from system loaded modules
3,730
public static function enabled ( $ enabled = null ) { if ( null === $ enabled ) { return self :: $ enabled ; } return self :: $ enabled = ( bool ) $ enabled ; }
Gets or sets whether profiling is globally enabled
3,731
public static function run ( $ num_runs , $ display = true , callable $ callable = null ) { self :: swapCallable ( $ display , $ callable , true ) ; $ results = [ ] ; if ( self :: $ enabled ) { $ profiler = new Profiler ( ) ; $ run_times = [ ] ; $ memory = memory_get_usage ( ) ; for ( $ i = 0 ; $ i < $ num_runs ; $ i +...
Profiles one or more calls to a function
3,732
public function reset ( ) { foreach ( $ this -> start as $ id ) { $ this -> stop ( $ id , false ) ; } return true ; }
Resets the profiling state
3,733
public function isStarted ( $ id = self :: DEFAULT_ID ) { $ id = ( ! $ id ) ? self :: DEFAULT_ID : ( string ) $ id ; return isset ( $ this -> start [ $ id ] ) ; }
Returns whether profiling has been started for the given id
3,734
protected function makeKeyString ( $ key ) : string { $ stringValue = ( string ) $ key ; $ length = strlen ( $ stringValue ) ; if ( $ length == 0 ) { throw new \ Exception ( "Key values must be string values of at least 1 character. Empty strings cannot be used as indices in Binn format object containers." ) ; } if ( $...
Object containers have string keys . The string key is composed of two parts . The key has a 1 - byte integer size and a variable length string value with no null - terminator .
3,735
public function capabilitiesAction ( ) { $ routes = $ this -> router -> getRouteCollection ( ) ; $ exposed = [ ] ; foreach ( $ routes as $ name => $ route ) { if ( ! $ route -> hasDefault ( RouteKeys :: DEFINITION ) ) { continue ; } if ( ! in_array ( 'OPTIONS' , $ route -> getMethods ( ) , true ) ) { continue ; } $ def...
Return all the resources routes
3,736
public static function Gmst82 ( $ dj1 , $ dj2 ) { $ A = 24110.54841 - DAYSEC / 2.0 ; $ B = 8640184.812866 ; $ C = 0.093104 ; $ D = - 6.2e-6 ; $ d1 ; $ d2 ; $ t ; $ f ; $ gmst ; if ( $ dj1 < $ dj2 ) { $ d1 = $ dj1 ; $ d2 = $ dj2 ; } else { $ d1 = $ dj2 ; $ d2 = $ dj1 ; } $ t = ( $ d1 + ( $ d2 - DJ00 ) ) / DJC ; $ f = DA...
- - - - - - - - - - i a u G m s t 8 2 - - - - - - - - - -
3,737
public static function fromString ( string $ string ) : self { try { $ data = Uri \ parse ( trim ( $ string ) ) ; } catch ( \ Exception $ e ) { throw new InvalidArgumentException ; } return new self ( $ data [ 'scheme' ] ? new Scheme ( $ data [ 'scheme' ] ) : new NullScheme , new Authority ( new UserInformation ( $ dat...
Build a url out of the given string
3,738
public function label ( ) { $ list = self :: listStatus ( ) ; return isset ( $ list [ $ this -> status ] ) ? $ list [ $ this -> status ] : $ this -> status ; }
Returns label of actual status
3,739
private function _validateKey ( $ key ) : string { if ( ! \ is_scalar ( $ key ) && ! \ is_object ( $ key ) && ! \ method_exists ( $ key , "__toString" ) ) { throw InvalidKeyException :: invalidKey ( ) ; } return ( string ) $ key ; }
Validates the given key and casts it to a string if possible .
3,740
protected function getFlashMessengerHelper ( ) { if ( $ this -> flashMessengerHelper ) { return $ this -> flashMessengerHelper ; } if ( method_exists ( $ this -> view , 'plugin' ) ) { $ this -> flashMessengerHelper = $ this -> view -> plugin ( 'flashmessenger' ) ; } if ( ! $ this -> flashMessengerHelper instanceof Flas...
Retrieve the flashMessenger helper
3,741
public function load ( $ str , Collection $ collection ) { $ this -> str = $ str ; $ this -> collection = $ collection ; return $ this ; }
Loads string and collection object
3,742
public function search ( ) { preg_match_all ( '/\[[^\]]*\]/' , $ this -> str , $ this -> matches ) ; if ( ! empty ( $ this -> matches ) ) { $ this -> matches = $ this -> matches [ 0 ] ; $ this -> format ( ) ; } return $ this ; }
Searchs the string for possible matches
3,743
public function searchAndReplace ( ) { $ this -> search ( ) ; $ this -> replacement = new Replacement ( $ this -> formatted , $ this -> str ) ; $ this -> replacement -> replace ( ) ; return $ this -> replacement -> getStr ( ) ; }
Perform a search and replace matches
3,744
public function processValues ( $ name , $ arr ) { foreach ( $ arr as $ key => $ value ) { if ( strstr ( $ value , '=' ) !== false ) { $ values = explode ( '=' , $ value ) ; $ val = str_replace ( [ '\'' , '"' ] , '' , $ values [ 1 ] ) ; $ this -> formatted [ $ name ] [ 'params' ] [ trim ( $ values [ 0 ] ) ] = $ val ; }...
Processes a mask values
3,745
public static function loadLoader ( $ directory ) { $ content = scandir ( $ directory ) ; foreach ( $ content as $ file ) { if ( $ file == "." || $ file == ".." || $ file == __FILE__ ) { continue ; } else { if ( preg_match ( "~_loader.php$~" , $ file ) ) { require_once $ directory . "/" . $ file ; } } } }
Loads loader from desired directory .
3,746
public static function loadPHPfiles ( $ directory , $ skipped = [ ] ) { $ content = scandir ( $ directory ) ; foreach ( $ content as $ file ) { $ defaults = [ "." , ".." ] ; if ( in_array ( $ file , $ defaults ) || in_array ( $ file , $ skipped ) ) { continue ; } else { if ( preg_match ( "~php$~" , $ file ) ) { require...
Loads PHP files from desired directory .
3,747
public static function loadPHPfolders ( $ directory , $ skipped = [ ] ) { $ loading = new \ Lib \ Loading ( ) ; $ loading -> loadPHPfiles ( $ directory , $ skipped ) ; $ content = scandir ( $ directory ) ; foreach ( $ content as $ folder ) { $ defaults = [ "." , ".." ] ; if ( in_array ( $ folder , $ defaults ) || in_ar...
Loads PHP files from desired directory and its subfolders .
3,748
public function build ( Email $ email ) : Email { foreach ( $ this -> parts as $ part ) { $ resolver = $ this -> registry -> getResolverForPart ( $ part ) ; $ resolver -> addPart ( $ email , $ part ) ; } $ this -> parts = [ ] ; return $ email ; }
Build email from parts .
3,749
public function getController ( ) { $ router = new Router ( $ this ) ; $ router -> setCurrentRoute ( ) ; $ controllerObject = $ this -> GetControllerObject ( $ router ) ; $ this -> controller = $ controllerObject ; return $ controllerObject ; }
Retrieve the Controller instance that matches the Route instance .
3,750
private function GetControllerObject ( \ Puzzlout \ Framework \ Core \ Router $ router ) { $ controllerName = $ this -> BuildControllerName ( $ router -> currentRoute ( ) ) ; $ FrameworkControllers = "\Puzzlout\Framework\Generated\FrameworkControllers" ; $ ApplicationControllers = "\Applications\\" . "APP_NAME" . "\Gen...
Builds the controller object from a route object .
3,751
public function FindControllerClassName ( $ controllerName , $ FrameworkControllers , $ ApplicationControllers , \ Puzzlout \ Framework \ Core \ Router $ router ) { $ FrameworkControllers = $ FrameworkControllers :: GetList ( ) ; $ ApplicationControllers = $ ApplicationControllers :: GetList ( ) ; $ controllerClass = "...
Find the controller class name to instanciate .
3,752
protected function InstanciateController ( $ controllerClass , Route $ route ) { try { return new $ controllerClass ( $ this , $ route -> module ( ) , $ route -> action ( ) ) ; } catch ( \ Exception $ exc ) { $ this -> error -> LogError ( $ exc ) ; throw new \ Exception ( "Controller not loaded" , Enums \ ErrorCodes \ ...
Instanciate a controller from a name .
3,753
protected function convertToFullQualifyClassName ( $ name ) { if ( Str :: contains ( $ name , '/' ) ) { $ name = str_replace ( '/' , '\\' , $ name ) ; } if ( Str :: startsWith ( $ name , '\\' ) ) { $ name = substr ( $ name , 1 ) ; } else { $ name = $ this -> getDefaultNamespace ( ) . '\\' . $ name ; } return $ this -> ...
Parse the name and format according to the default namespace .
3,754
protected function filterFullQualifyClassName ( $ fqcn , callable $ callback ) { $ parts = explode ( '\\' , $ fqcn ) ; foreach ( $ parts as & $ part ) { $ part = call_user_func ( $ callback , $ part ) ; } return implode ( '\\' , $ parts ) ; }
Filter FQCN .
3,755
protected function splitFullQualifyClassName ( $ fqcn ) { $ parts = explode ( '\\' , $ fqcn ) ; $ classname = array_pop ( $ parts ) ; return [ implode ( '\\' , $ parts ) , $ classname ] ; }
Split FQCN to namespace & classname .
3,756
protected function getRelativePath ( $ fqcn ) { if ( strpos ( $ fqcn , $ this -> getRootNamespace ( ) . '\\' ) === 0 ) { $ relative = substr ( $ fqcn , strlen ( $ this -> getRootNamespace ( ) ) + 1 ) ; } else { $ relative = $ fqcn ; } return str_replace ( '\\' , '/' , $ relative ) ; }
Get relative path for FQCN .
3,757
public function write ( $ value ) : void { if ( $ value !== $ this -> value ) { $ this -> emit ( GPIO :: BEFORE_VALUE_CHANGE_EVENT , [ $ this ] ) ; $ value = boolval ( $ value ) ? 1 : 0 ; fwrite ( $ this -> fileHandler , "$value" , 1 ) ; $ this -> value = $ value ; $ this -> emit ( GPIO :: AFTER_VALUE_CHANGE_EVENT , [ ...
Write the given value on GPO
3,758
public function toggleState ( ) { if ( $ this -> isSet ( ) ) { $ this -> write ( $ this -> getLow ( ) ) ; } else { $ this -> write ( $ this -> getHigh ( ) ) ; } }
Invert the GPO state
3,759
public function pushAll ( ) { foreach ( array_chunk ( $ this -> buffer , self :: KINESIS_MAX_PUT_RECORDS_COUNT ) as $ chunk ) { try { $ this -> putRecords ( $ chunk ) ; } catch ( \ Exception $ e ) { $ this -> processError ( $ e , $ chunk ) ; } } $ this -> buffer = [ ] ; }
Pushes all messages from the buffer to the stream .
3,760
public static function make ( $ collection , callable $ formatNode = null , $ pk = 'id' , $ fk = 'parent_id' , $ childrenAttr = 'children' , $ levelLabel = 'level' ) { $ nested = [ ] ; $ onLevels = [ ] ; foreach ( $ collection as $ item ) { $ itemNode = $ item ; $ onLevels [ $ item [ $ levelLabel ] ] [ $ item [ $ pk ] ...
Make nested data collection .
3,761
public function disableEmoji ( ) { remove_action ( 'admin_print_styles' , 'print_emoji_styles' ) ; remove_action ( 'wp_head' , 'print_emoji_detection_script' , 7 ) ; remove_action ( 'admin_print_scripts' , 'print_emoji_detection_script' ) ; remove_action ( 'wp_print_styles' , 'print_emoji_styles' ) ; remove_filter ( 'w...
Disables emoji from WordPress
3,762
public static function createFromString ( $ uri ) { if ( ! is_string ( $ uri ) && ! method_exists ( $ uri , '__toString' ) ) { throw new InvalidArgumentException ( 'Uri must be a string' ) ; } return self :: createFromParse ( parse_url ( $ uri ) ) ; }
Create URI from string
3,763
public static function createFromParse ( array $ parts ) { $ uri = new static ( ) ; if ( isset ( $ parts [ 'schema' ] ) ) { $ uri -> scheme = UriFilter :: scheme ( $ parts [ 'schema' ] ) ; } if ( isset ( $ parts [ 'host' ] ) ) { $ uri -> host = UriFilter :: host ( $ parts [ 'host' ] ) ; } if ( isset ( $ parts [ 'port' ...
Create URI from a hash of parse_url components .
3,764
public function findWithPermission ( $ permission ) { return array_filter ( $ this -> findAll ( ) , function ( $ user ) use ( $ permission ) { return $ user -> has ( $ permission ) ; } ) ; }
Find users with permission
3,765
public function findWithoutPermission ( $ permission ) { return array_filter ( $ this -> findAll ( ) , function ( $ user ) use ( $ permission ) { return $ user -> hasnt ( $ permission ) ; } ) ; }
Find users without permission
3,766
public function findNotInRole ( RoleInterface $ role ) { return array_filter ( $ this -> findAll ( ) , function ( $ user ) use ( $ role ) { return $ user -> not ( $ role -> key ) ; } ) ; }
Find users not in role
3,767
public function setUrl ( $ params ) { $ this -> urlInputData = $ params ; $ this -> inputData = $ this -> Merge ( $ this -> inputData , $ this -> urlInputData ) ; $ this -> urlInputDataSet = true ; return $ this ; }
this method sets the URL parameter request data
3,768
public function getUrl ( $ name ) { if ( $ name === null ) { return $ this -> urlInputData ; } elseif ( $ this -> KeyExists ( $ name , $ this -> urlInputData ) ) { return $ this -> urlInputData [ $ name ] ; } else { return false ; } }
this method gets the URL parameter request data
3,769
public function get ( $ name ) { if ( $ name === null ) { return $ this -> inputData ; } elseif ( $ this -> KeyExists ( $ name , $ this -> inputData ) ) { return htmlentities ( $ this -> inputData [ $ name ] , ENT_QUOTES ) ; } else { return null ; } }
This method gets all the InputData
3,770
public static function Atoc13 ( $ type , $ ob1 , $ ob2 , $ utc1 , $ utc2 , $ dut1 , $ elong , $ phi , $ hm , $ xp , $ yp , $ phpa , $ tc , $ rh , $ wl , & $ rc , & $ dc ) { $ j ; $ astrom = new iauASTROM ( ) ; $ eo ; $ ri ; $ di ; $ j = IAU :: Apco13 ( $ utc1 , $ utc2 , $ dut1 , $ elong , $ phi , $ hm , $ xp , $ yp , $...
- - - - - - - - - - i a u A t o c 1 3 - - - - - - - - - -
3,771
public function connect ( $ host , $ user , $ password , $ database , $ newLink = false ) { if ( ! $ this -> pdo ) { try { $ this -> pdo = $ this -> getAdapter ( ) -> connect ( $ host , $ user , $ password , $ database , $ newLink ) ; $ this -> setDatabase ( $ database ) ; } catch ( Exception $ e ) { $ e -> log ( ) ; }...
Connects to SQL server
3,772
public function disconnect ( ) { if ( $ this -> pdo ) { try { $ this -> getAdapter ( ) -> disconnect ( ) ; } catch ( Exception $ e ) { $ e -> log ( ) ; } } }
Disconnects from server
3,773
public static function parsePath ( $ path ) { $ path = str_replace ( self :: getPrefix ( ) , '' , $ path ) ; if ( strpos ( $ path , '?' ) !== false ) { $ query = substr ( $ path , strpos ( $ path , '?' ) ) ; $ path = substr ( $ path , 0 , ( strlen ( $ path ) - strlen ( $ query ) ) ) ; $ query = str_replace ( '?' , '' ,...
general utility functions
3,774
public function stream_set_option ( $ option , $ arg1 , $ arg2 ) { switch ( $ option ) { case STREAM_OPTION_BLOCKING : case STREAM_OPTION_READ_TIMEOUT : default : return false ; break ; case STREAM_OPTION_WRITE_BUFFER : switch ( $ arg1 ) { case STREAM_BUFFER_NONE : case STREAM_BUFFER_FULL : break ; } $ this -> setBuffe...
StreamWrapper functions from here on out
3,775
public function iconAction ( Request $ request , $ icon ) { $ params = $ request -> query -> all ( ) ; $ iconBuilder = $ this -> get ( 'phlexible_element.icon_builder' ) ; $ cacheFilename = $ iconBuilder -> getAssetPath ( $ icon , $ params ) ; return new BinaryFileResponse ( $ cacheFilename , 200 , array ( 'Content-Typ...
Delivers an icon .
3,776
public function clear ( ) { $ this -> controller = null ; $ this -> action = null ; $ this -> filters = array ( ) ; $ this -> filter_names = array ( ) ; $ this -> position = 0 ; $ this -> has_action_filter = false ; }
clear all data .
3,777
public function build ( ) { $ filters = $ this -> controller -> getFilters ( ) ; for ( $ i = 0 ; $ i < count ( $ filters ) ; $ i ++ ) { $ this -> loadFilter ( $ filters [ $ i ] , $ i !== count ( $ filters ) - 1 ) ; } if ( ! $ this -> has_action_filter ) { $ this -> addFilter ( 'Action' ) ; } else { $ action = null ; $ ...
build filter chain .
3,778
public function loadFilter ( $ file , $ is_global = false ) { $ defines = $ this -> yaml -> load ( $ file ) ; $ filters = isset ( $ defines [ '*' ] ) && $ defines [ '*' ] ? $ defines [ '*' ] : [ ] ; $ key = $ this -> controller -> getFilterKey ( ) ; $ filters = array_merge ( $ filters , isset ( $ defines [ $ key ] ) &&...
load filter .
3,779
public function addFilter ( $ name , $ attributes = array ( ) ) { $ names = explode ( ':' , $ name ) ; $ filter = array_shift ( $ names ) ; $ method = array_shift ( $ names ) ; $ alias = array_shift ( $ names ) ; if ( ! $ alias ) $ alias = $ filter ; if ( ! is_array ( $ attributes ) ) $ attributes = [ ] ; if ( $ method...
Add filter .
3,780
public function getCurrentFilter ( ) { $ alias = $ this -> filter_names [ $ this -> position ] ; $ define = $ this -> filters [ $ alias ] ; $ filter = $ this -> getFilterByName ( $ define [ 'name' ] , $ define [ 'attributes' ] ) ; return $ filter ; }
Get current filter instance .
3,781
public function getFilterByName ( $ name , $ attributes = [ ] ) { $ filter = null ; $ name = str_replace ( '\\' , DS , ucfirst ( $ name ) ) . 'Filter.php' ; $ file = $ this -> loader -> findFirst ( $ this -> application -> config ( 'directory.filter' ) . DS . $ name ) ; if ( $ file ) { $ class = $ file -> getClassName ...
Get filter by name .
3,782
public function connect ( $ host , $ port = null , $ timeout = 30 , $ options = array ( ) ) { static $ streamok ; if ( is_null ( $ streamok ) ) { $ streamok = function_exists ( 'stream_socket_client' ) ; } $ this -> setError ( '' ) ; if ( $ this -> connected ( ) ) { $ this -> setError ( 'Already connected to a server' ...
Connect to an SMTP server .
3,783
public static function toNamedArray ( array $ data , array $ names ) { $ tmp = [ ] ; if ( count ( $ data ) !== count ( $ names ) ) { throw new \ RuntimeException ( "data and names lengths do not match" ) ; } $ i = 0 ; foreach ( $ names as $ name ) { if ( ! isset ( $ data [ $ i ] ) ) { throw new \ RuntimeException ( "da...
Return an array with string keys generated from the input array with numerical keys
3,784
public function replace ( $ key , $ var = null , $ ttl = 0 ) { if ( ! $ this -> exists ( $ key ) ) { return false ; } return $ this -> store ( $ key , $ var , $ ttl ) ; }
Replaces a variable in the cache only if it already exists .
3,785
public function exists ( $ key ) { if ( ! function_exists ( 'apc_exists' ) ) { $ success = false ; $ this -> fetch ( $ key , $ success ) ; return $ success ; } return \ apc_exists ( $ key ) ; }
Checks if APC key exists
3,786
protected function buildParserStack ( ) { $ parsers = array_reverse ( $ this -> parsers ) ; return array_reduce ( $ parsers , $ this -> prepareParser ( ) , $ this ) ; }
Build the nested stack of closures that executes the parsers in the correct order .
3,787
public function replace ( $ tags ) { foreach ( $ tags as $ tag ) { if ( ! $ tag instanceof Tag ) { throw InvalidTagException :: build ( [ ] , [ 'invalidTag' => $ tag ] ) ; } } parent :: replace ( $ tags ) ; }
Add data to set
3,788
protected function handleShutdowns ( ) { declare ( ticks = 1 ) ; $ self = $ this ; $ cleanup = function ( $ signal = null ) use ( $ self ) { if ( $ signal === SIGTERM ) { fprintf ( STDERR , 'Received SIGTERM...' ) ; } else if ( $ signal === SIGINT ) { fprintf ( STDERR , 'Received SIGINT...' ) ; } else if ( $ signal ===...
Handle shutdown events and clean up lock files .
3,789
public function emailSuperAdministratorNotifications ( $ event ) { if ( ! config ( 'lasallecmsapi.auth_frontend_registration_successful_send_admins_email' ) ) { } $ event -> data [ 'id' ] [ 'listTitle' ] = $ this -> findListById ( $ event -> data [ 'id' ] [ 'listID' ] ) ; $ subject = config ( 'lasallecmsfrontend.site_n...
Send the super administrators an email letting them know that a post was sent to a LaSalleCRM list . Called by a LaSalleCMSAPI listener .
3,790
public function isSubdomainExists ( $ subdomain , $ excludeId = null ) { return $ this -> isExists ( empty ( $ excludeId ) ? array ( 'subdomain' => $ subdomain , ) : array ( 'subdomain' => $ subdomain , new Predicate \ Operator ( 'id' , Predicate \ Operator :: OP_NE , $ excludeId ) , ) ) ; }
Is subdomain already exists
3,791
public function addMenuEntry ( $ location , MenuEntry $ menuEntry , $ priority = 50 ) { if ( ! isset ( $ this -> menuEntries [ $ location ] ) ) { $ this -> menuEntries [ $ location ] = array ( ) ; } if ( ! isset ( $ this -> menuEntries [ $ location ] [ $ priority ] ) ) { $ this -> menuEntries [ $ location ] [ $ priorit...
Adds the given menu entry to the menu manager .
3,792
public function sortMenuEntries ( $ a , $ b ) { if ( $ a -> getName ( ) > $ b -> getName ( ) ) { return 1 ; } else if ( $ a -> getName ( ) < $ b -> getName ( ) ) { return - 1 ; } else { return 0 ; } }
Sorts two menu entries
3,793
public function getMenuEntries ( $ location = null ) { $ runtimeManager = $ this -> framework -> getRuntimeManager ( ) ; $ runtimeManager -> executeEvent ( '\\Zepi\\Web\\General\\Event\\MenuManager\\RegisterAdditionalMenuEntries' ) ; if ( $ location === null ) { return $ this -> menuEntries ; } if ( ! isset ( $ this ->...
Returns all menu entries
3,794
public function getMenuEntryForKey ( $ key ) { foreach ( $ this -> menuEntries as $ location => $ priorities ) { foreach ( $ priorities as $ priority => $ menuEntries ) { $ result = $ this -> searchMenuEntryForKey ( $ menuEntries , $ key ) ; if ( $ result !== false ) { return $ result ; } } } return false ; }
Returns the MenuEntry object for the given key or false if the key not is registred
3,795
public function searchMenuEntryForKey ( $ menuEntries , $ key ) { foreach ( $ menuEntries as $ menuEntry ) { if ( $ menuEntry -> getKey ( ) === $ key ) { return $ menuEntry ; } if ( $ menuEntry -> hasChildren ( ) ) { $ result = $ this -> searchMenuEntryForKey ( $ menuEntry -> getChildren ( ) , $ key ) ; if ( $ result !...
Searches the given key in the array of menu entries .
3,796
public function activateCorrectMenuEntry ( ) { $ runtimeManager = $ this -> framework -> getRuntimeManager ( ) ; $ runtimeManager -> executeEvent ( '\\Zepi\\Web\\General\\Event\\MenuManager\\RegisterAdditionalMenuEntries' ) ; if ( $ this -> activeMenuEntry == null ) { $ menuEntry = $ this -> searchCorrectMenuEntry ( ) ...
Activates the correct menu entry based on the event which is active .
3,797
public function getBreadcrumbEntries ( MenuEntry $ entry = null ) { $ this -> activateCorrectMenuEntry ( ) ; if ( $ entry === null ) { $ entry = $ this -> activeMenuEntry ; if ( $ entry == null ) { return array ( ) ; } } $ entries = array_reverse ( $ this -> processBreadcrumbEntries ( $ entry ) , false ) ; if ( $ this ...
Returns an array with all breadcrumb entries
3,798
protected function processBreadcrumbEntries ( MenuEntry $ entry ) { $ entries = array ( $ entry ) ; if ( $ entry -> hasParent ( ) ) { $ parentEntries = $ this -> processBreadcrumbEntries ( $ entry -> getParent ( ) ) ; foreach ( $ parentEntries as $ parentEntry ) { $ entries [ ] = $ parentEntry ; } } return $ entries ; ...
Loops trough the navigation tree for the given menu entry and gets all entries for the breadcrumb navigation
3,799
protected function searchCorrectMenuEntry ( ) { foreach ( $ this -> menuEntries as $ location => $ priorities ) { foreach ( $ priorities as $ priority => $ menuEntries ) { $ menuEntry = $ this -> searchCorrectMenuEntryInArray ( $ menuEntries ) ; if ( $ menuEntry !== false ) { return $ menuEntry ; } } } return false ; }
Searches the correct menu entry based on the requested route .