idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
53,400
public function add ( LayoutBoxConfiguratorInterface $ configurator ) { $ type = $ configurator -> getType ( ) ; if ( $ this -> has ( $ type ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Layout box configurator "%s" already exists.' , $ type ) ) ; } $ this -> items [ $ configurator -> getType ( ) ] = $ config...
Adds new configurator to collection
53,401
public static function isAssociativeArray ( array $ aArray ) { foreach ( array_keys ( $ aArray ) as $ key ) { if ( ! is_int ( $ key ) ) { return true ; } } return false ; }
Returns TRUE iff the specified array is associative . If the specified array is empty then return FALSE .
53,402
public static function getCurrentTimeWithCS ( $ sFormat ) { $ aMicrotime = explode ( ' ' , microtime ( ) ) ; $ sFilledFormat = sprintf ( $ sFormat , $ aMicrotime [ 0 ] * 1000000 ) ; $ sDate = date ( $ sFilledFormat , $ aMicrotime [ 1 ] ) ; return $ sDate ; }
Returns current time with hundredths of a second .
53,403
public static function generateMongoId ( $ iTimestamp = 0 , $ bBase32 = true ) { static $ inc = 0 ; if ( $ inc === 0 ) { $ inc = ( int ) substr ( microtime ( ) , 2 , 6 ) ; } $ bin = sprintf ( '%s%s%s%s' , pack ( 'N' , $ iTimestamp ? : time ( ) ) , substr ( md5 ( gethostname ( ) ) , 0 , 3 ) , pack ( 'n' , posix_getpid (...
Generates a globally unique id generator using Mongo Object ID algorithm .
53,404
public function asNtext1line ( $ value , $ maxlen = null ) { if ( $ value === null ) { return $ this -> nullDisplay ; } $ suffix = '' ; if ( ( false !== ( $ n = strpos ( $ value , "\n" ) ) ) || ( false !== ( $ n = strpos ( $ value , "\r" ) ) ) ) { if ( ( $ n > 0 ) && ( substr ( $ value , $ n - 1 , 1 ) == "\r" ) ) { $ n...
Formats the value as an HTML - encoded plain text . If the value contains \ n or \ r the first line will be returned only .
53,405
public function overlaps ( TimezonedDateTimeRange $ otherRange ) : bool { return $ this -> contains ( $ otherRange -> start ) || $ this -> contains ( $ otherRange -> end ) || $ this -> encompasses ( $ otherRange ) || $ otherRange -> encompasses ( $ this ) ; }
Returns whether the supplied timezoned date time range overlaps this date time range .
53,406
public function init ( Application $ application ) { $ application -> addService ( 'staticController' , new StaticControllerService ( ) ) ; $ application -> any ( ':all' , $ application -> getService ( 'staticController' ) ) ; }
init the module .
53,407
public function _builded ( $ tag , $ handle , $ src ) { $ handles = apply_filters ( 'inc2734_wp_page_speed_optimization_builded_scripts' , [ ] ) ; if ( ! in_array ( $ handle , $ handles ) ) { return $ tag ; } return sprintf ( '<script> document.addEventListener("DOMContentLoaded", function(event) { var s=document....
Re - build script tag only in_footer param is true
53,408
public function _set_preload_stylesheet ( $ tag , $ handle , $ src ) { $ handles = apply_filters ( 'inc2734_wp_page_speed_optimization_output_head_styles' , [ ] ) ; if ( in_array ( $ handle , $ handles ) && 0 === strpos ( $ src , site_url ( ) ) ) { $ sitepath = site_url ( '' , 'relative' ) ; $ abspath = untrailingslash...
Set rel = preload for stylesheet
53,409
public function _optimize_jquery_loading ( ) { $ optimize_loading = apply_filters ( 'inc2734_wp_page_speed_optimization_optimize_jquery_loading' , false ) ; if ( ! $ optimize_loading ) { return ; } if ( is_admin ( ) || in_array ( $ GLOBALS [ 'pagenow' ] , [ 'wp-login.php' , 'wp-register.php' ] ) ) { return ; } global $...
Optimize jQuery loading
53,410
static public function find ( $ id ) { $ model = new static ; $ result = $ model -> execute ( 'SELECT * FROM ' . $ model -> table . ' WHERE ' . $ model -> key . ' = ?' , [ $ id ] ) ; if ( is_array ( $ result ) ) { $ result = current ( $ result ) ; } return $ result ; }
Find record by pk
53,411
static public function findByQuery ( $ sqlQuery , array $ params , $ fetchMode = \ PDO :: FETCH_OBJ ) { $ model = new static ; if ( $ model -> table ) { $ sqlQuery = str_replace ( ':table' , $ model -> table , $ sqlQuery ) ; } $ result = $ model -> execute ( $ sqlQuery ) ; return $ result ; }
Find by query
53,412
protected function getNodes ( $ class , $ id ) { $ records = [ ] ; $ records [ 'nodes' ] = [ ] ; $ models = $ this -> getNodeModels ( $ class , $ id ) ; foreach ( $ models as $ model ) { $ records [ 'nodes' ] [ ] = $ this -> getNodeValues ( $ model ) ; } return $ records ; }
get nestable nodes
53,413
protected function storeNode ( $ class , $ path = null , $ id = null ) { DB :: beginTransaction ( ) ; try { $ datas = $ this -> request -> parent != 0 || $ this -> request -> related != 0 ? $ this -> getDefineDatas ( $ class ) : $ this -> request -> all ( ) ; $ this -> model = $ class :: create ( $ datas ) ; $ this -> ...
store nestable node
53,414
protected function moveModel ( $ model ) { $ this -> model = $ model ; DB :: beginTransaction ( ) ; try { if ( $ this -> request -> position === 'firstChild' || $ this -> request -> position === 'lastChild' ) { $ this -> model -> fill ( $ this -> getDefineDatas ( $ this -> model ) ) -> save ( ) ; } $ this -> model -> s...
move nestable node
53,415
private function getNodeModels ( $ class , $ relation_id ) { if ( $ this -> request -> id === '0' ) { return is_null ( $ relation_id ) ? $ class :: all ( ) -> toHierarchy ( ) : $ class :: where ( 'parent_id' , $ relation_id ) -> get ( ) -> toHierarchy ( ) ; } return $ class :: findOrFail ( $ this -> request -> id ) -> ...
get node models
53,416
private function getNodeValues ( $ model ) { $ attribute = "{$this->name}_uc_first" ; return [ 'id' => $ model -> id , 'parent' => $ model -> parent_id , 'name' => $ model -> $ attribute , 'level' => $ model -> depth , 'type' => $ model -> isLeaf ( ) ? 'file' : 'folder' ] ; }
get node values for return data
53,417
protected function getDefineDatas ( $ class ) { $ class = is_string ( $ class ) ? $ class : get_class ( $ class ) ; $ id = $ this -> request -> has ( 'parent' ) && $ this -> request -> parent != 0 ? $ this -> request -> parent : $ this -> request -> related ; $ parent = $ class :: findOrFail ( $ id ) ; $ datas = $ this...
get the define datas
53,418
public static function duplicateEntity ( DuplicateEntity $ event ) { if ( $ event -> getWithoutKeys ( ) ) { $ entity = $ event -> getEntity ( ) ; if ( isset ( $ GLOBALS [ 'TL_DCA' ] [ $ entity -> entityTableName ( ) ] [ 'fields' ] ) ) { $ entityAccessor = $ GLOBALS [ 'container' ] [ 'doctrine.orm.entityAccessor' ] ; $ ...
Clean timestamp able entries from duplicated entities .
53,419
private function setDataForSubEntitiy ( $ propertyKey , $ value ) { $ subKey = strtolower ( strstr ( $ propertyKey , '_' , true ) ) ; $ getterMethodName = 'get' . ucfirst ( $ subKey ) ; if ( ! empty ( $ subKey ) && method_exists ( $ this , $ getterMethodName ) ) { $ subObject = $ this -> $ getterMethodName ( ) ; if ( $...
Process sub entity to set data recursively
53,420
protected function getPropertyValue ( $ propertyName ) { $ desiredKey = $ this -> trimPrefixKey ( $ propertyName ) ; $ getter = 'get' . ucfirst ( $ this -> getPropertyName ( $ desiredKey ) ) ; if ( method_exists ( $ this , $ getter ) ) { return $ this -> $ getter ( ) ; } $ subKey = strtolower ( strstr ( $ desiredKey , ...
Get method name for getter
53,421
public function getDataForCache ( ) { $ reflectionClass = new \ ReflectionObject ( $ this ) ; $ array = array ( ) ; $ excludes = array_flip ( $ this -> excludedPropertiesForCache ) ; $ excludes [ 'excludedPropertiesForCache' ] = true ; foreach ( $ reflectionClass -> getProperties ( ) as $ property ) { $ propertyName = ...
Get data from entity for cache set
53,422
protected function processPropertyForCache ( $ propertyName ) { $ value = $ this -> $ propertyName ; if ( $ value instanceof CacheableInterface ) { $ value = $ value -> getDataForCache ( ) ; } elseif ( is_object ( $ value ) ) { $ value = null ; } return $ value ; }
Process a property to get data for caching flow
53,423
protected function deleteAll ( ) { $ elements = $ this -> Request -> getRequiredParameter ( 'elements' ) ; $ interval = 1000 ; $ elementSlugs = StringUtils :: smartExplode ( $ elements ) ; $ elements = array ( ) ; foreach ( $ elementSlugs as $ eSlug ) $ elements [ ] = $ this -> ElementService -> getBySlug ( $ eSlug ) ;...
Deletes all nodes for specified elements .
53,424
public function setInitialValue ( $ initialValue ) { if ( ! is_int ( $ initialValue ) || ( $ initialValue <= 0 ) ) { throw SchemaException :: invalidSequenceInitialValue ( $ this -> getName ( ) ) ; } $ this -> initialValue = $ initialValue ; }
Sets the initial value .
53,425
public function setIncrementSize ( $ incrementSize ) { if ( ! is_int ( $ incrementSize ) || ( $ incrementSize <= 0 ) ) { throw SchemaException :: invalidSequenceIncrementSize ( $ this -> getName ( ) ) ; } $ this -> incrementSize = $ incrementSize ; }
Sets the increment size .
53,426
public function addItem ( Model $ item ) : Collection { call_user_func ( [ $ this , $ this -> setterName ( ) ] , $ item ) ; return $ this ; }
Add item to collection
53,427
public function removeItem ( Model $ item ) : Collection { if ( $ this -> has ( $ item -> getId ( ) ) ) { unset ( $ this -> items [ $ item -> getId ( ) ] ) ; } return $ this ; }
Remove an item from collection
53,428
public function toArray ( ) : array { $ items = is_array ( $ this -> items ) ? $ this -> items : [ ] ; foreach ( $ items as $ itemIndex => $ item ) { if ( is_object ( $ item ) && is_callable ( [ $ item , 'toArray' ] ) ) { try { $ items [ $ itemIndex ] = $ item -> toArray ( ) ; } catch ( \ Exception $ e ) { throw $ e ; ...
Get items in collection
53,429
public function call ( Request $ request , Response $ response ) : Response { return call_user_func ( $ this -> callable , $ request , $ response , $ this -> slugs ) ; }
Call the callback function of the route
53,430
public function getFullUri ( ) { $ queryString = '' ; $ params = array ( ) ; if ( $ this -> hasQuery ( ) ) { $ params [ ] = $ this -> getQueryParam ( ) ; } if ( $ this -> hasOrderBy ( ) ) { $ params [ ] = $ this -> getOrderByParam ( ) ; } if ( $ this -> hasSummarizeBy ( ) ) { $ params [ ] = 'summarize-by=' . $ this -> ...
Get full constructed URI .
53,431
public function getInstance ( string $ class , string $ selector = Injector :: DEFAULT_SELECTOR ) { if ( array_search ( $ class , $ this -> instance_stack , true ) ) throw new DIException ( "Cyclic dependencies in creating $class: " . WF :: str ( $ this -> instance_stack ) ) ; array_push ( $ this -> instance_stack , $ ...
Get an instance of the object
53,432
public function hasInstance ( string $ class , string $ selector = Injector :: DEFAULT_SELECTOR ) { return isset ( $ this -> objects [ $ class ] [ $ selector ] ) ; }
Check if an instance for the class is available .
53,433
public function registerFactory ( string $ produced_class , Factory $ factory ) { $ this -> factories [ $ produced_class ] = $ factory ; return $ this ; }
Register a factory for a class name
53,434
public function setInstance ( string $ class , $ instance , string $ selector = Injector :: DEFAULT_SELECTOR ) { if ( ! is_a ( $ instance , $ class ) ) throw new DIException ( "Instance should be a subclass of $class" ) ; if ( ! isset ( $ this -> objects [ $ class ] ) ) $ this -> objects [ $ class ] = [ ] ; $ this -> o...
Set a specific instance of class
53,435
public function clearInstance ( string $ class , string $ selector = Injector :: DEFAULT_SELECTOR ) { if ( ! isset ( $ this -> objects [ $ class ] ) ) return ; unset ( $ this -> objects [ $ class ] [ $ selector ] ) ; }
Remove an instance from the repository
53,436
public function validate ( $ value ) { return is_bool ( $ value ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: NON_BOOL ] ) ; }
Tells if a given value is a valid bool .
53,437
public function end ( ) { if ( ! extension_loaded ( 'xhprof' ) ) { throw new Exception ( "XHProf extension is not loaded." , 1 ) ; } if ( $ this -> started ) { $ this -> data = xhprof_disable ( ) ; require_once ( sprintf ( '%s/xhprof_lib/utils/xhprof_runs.php' , $ this -> dir ) ) ; $ xhprof_runs = new XHProfRuns_Defaul...
Triggers the end of the run
53,438
public function getReport ( $ id = null ) { if ( $ id === null ) { $ id = $ this -> id ; } return array ( 'runId' => $ id , 'report' => sprintf ( '%s?run=%s&source=%s' , $ this -> host , $ id , $ this -> namespace ) ) ; }
Gets the current report .
53,439
public function getReports ( ) { $ reports = array ( ) ; $ dir = ini_get ( "xhprof.output_dir" ) ; if ( is_dir ( $ dir ) ) { $ finder = new Finder ( ) ; $ finder -> files ( ) -> name ( '*.' . $ this -> namespace ) -> notName ( $ this -> id . '.' . $ this -> namespace ) -> in ( $ dir ) -> sort ( function ( SplFileInfo $...
Gets the last reports .
53,440
private function funcCondition ( $ name , $ arg = null ) { $ this -> getExpr ( ) -> addCondition ( new ConditionFunc ( $ name , $ this , $ arg !== null ? $ this -> getExpr ( ) -> value ( $ arg ) : null ) ) ; return $ this -> getExpr ( ) ; }
Add a function call to the current expression .
53,441
public function prime ( $ primer = true ) { if ( ! is_bool ( $ primer ) && ! is_callable ( $ primer ) ) { throw new \ InvalidArgumentException ( '$primer is not a boolean or callable' ) ; } if ( $ primer === false ) { unset ( $ this -> getExpr ( ) -> qb -> primers [ $ this -> getExpression ( ) ] ) ; return $ this ; } $...
Use a primer to eagerly load all references in this path segment .
53,442
public function refillAction ( $ plugin , $ field , Request $ request ) { if ( ! ( $ refiller = $ this -> get ( 'anime_db.plugin.refiller' ) -> getPlugin ( $ plugin ) ) ) { throw $ this -> createNotFoundException ( 'Plugin \'' . $ plugin . '\' is not found' ) ; } $ item = $ this -> createForm ( 'entity_item' , new Item...
Refill item .
53,443
public function searchAction ( $ plugin , $ field , Request $ request ) { if ( ! ( $ refiller = $ this -> get ( 'anime_db.plugin.refiller' ) -> getPlugin ( $ plugin ) ) ) { throw $ this -> createNotFoundException ( 'Plugin \'' . $ plugin . '\' is not found' ) ; } $ item = $ this -> createForm ( 'entity_item' , new Item...
Search for refill .
53,444
protected function logException ( \ Exception $ e , $ action = null , $ level = LogLevel :: ERROR ) { $ message = $ action ? sprintf ( '%s failed: %s' , $ action , $ e -> getMessage ( ) ) : sprintf ( '%s: %s' , get_class ( $ e ) , $ e -> getMessage ( ) ) ; $ this -> getLogger ( ) -> log ( $ level , $ message , [ 'backt...
Log exception .
53,445
public function defaults ( $ defaults ) { $ this -> defaults = $ defaults ; foreach ( $ defaults as $ k => $ v ) { if ( property_exists ( $ this , $ k ) ) { $ this -> { $ k } = $ v ; } } }
Sets the default values for this PatrolObject
53,446
public function mergeValues ( $ object ) { $ values = $ object -> __toArray ( ) ; foreach ( $ values as $ k => $ v ) { $ this -> values [ $ k ] = $ v ; } if ( $ object -> id ) $ this -> id = $ object -> id ; $ this -> dirty_values = [ ] ; }
Merges values from another PatrolObject
53,447
public function isChildOf ( $ child , $ parent ) { $ childMeta = $ this -> getMetadataForType ( $ child ) ; if ( false === $ childMeta -> isChildEntity ( ) ) { return false ; } return $ childMeta -> getParentEntityType ( ) === $ parent ; }
Determines if a type is direct child of another type .
53,448
public function isDescendantOf ( $ child , $ parent ) { $ childMeta = $ this -> getMetadataForType ( $ child ) ; if ( false === $ childMeta -> isChildEntity ( ) ) { return false ; } if ( $ childMeta -> getParentEntityType ( ) === $ parent ) { return true ; } return $ this -> isDescendantOf ( $ childMeta -> getParentEnt...
Determines if a type is a descendant of another type .
53,449
private function mergeMetadata ( EntityMetadata & $ metadata = null , EntityMetadata $ toAdd ) { if ( null === $ metadata ) { $ metadata = clone $ toAdd ; } else { $ metadata -> merge ( $ toAdd ) ; } }
Merges two sets of EntityMetadata . Is used for applying inheritance information .
53,450
private function formatEntityType ( $ type ) { $ delim = EntityMetadata :: NAMESPACE_DELIM ; if ( false === stristr ( $ type , $ delim ) ) { return $ this -> inflector -> studlify ( $ type ) ; } $ parts = explode ( $ delim , $ type ) ; foreach ( $ parts as & $ part ) { $ part = $ this -> inflector -> studlify ( $ part ...
Formats the entity type .
53,451
private function getFromMemory ( $ type ) { if ( isset ( $ this -> loaded [ $ type ] ) ) { return $ this -> loaded [ $ type ] ; } return null ; }
Gets a Metadata instance for a type from memory .
53,452
private function getFromCache ( $ type ) { if ( false === $ this -> hasCache ( ) ) { return null ; } return $ this -> cache -> loadMetadataFromCache ( $ type ) ; }
Retrieves a Metadata instance for a type from cache .
53,453
private function set_up_environment ( ) { if ( $ this -> it_has ( 'environment' ) ) { $ this -> environment = $ this -> options [ 'environment' ] ; } else { $ this -> environment = defined ( 'WP_DEBUG' ) && WP_DEBUG ? 'development' : 'production' ; } }
Setup the environment based on options given .
53,454
private function set_up_version_numbers ( ) { if ( $ this -> it_has ( 'js_version' ) ) { $ this -> js_version = $ this -> options [ 'js_version' ] ; } if ( $ this -> it_has ( 'css_version' ) ) { $ this -> css_version = $ this -> options [ 'css_version' ] ; } if ( $ this -> it_has ( 'jquery_version' ) ) { $ this -> jque...
Setup JS and CSS version numbers based on options given .
53,455
private function it_has ( $ option_name ) { return array_key_exists ( $ option_name , $ this -> options ) && ! empty ( $ this -> options [ $ option_name ] ) ; }
Check whether a given option exists in the options array .
53,456
public function load ( ) { $ this -> load_comments = $ this -> it_has ( 'load_coments' , $ this -> options ) ? $ this -> options [ 'load_comments' ] : false ; $ this -> enqueue_assets ( ) ; }
Enqueues the theme assets .
53,457
public function setup_assets ( ) { $ suffix = $ this -> get_assets_suffix ( ) ; if ( ! is_admin ( ) ) { if ( ! empty ( $ this -> jquery_uri ) ) { $ this -> update_jquery ( ) ; } $ remove_emoji_exists = array_key_exists ( 'remove_emoji' , $ this -> options ) ; if ( ! $ remove_emoji_exists || ( $ remove_emoji_exists && $...
Enqueues JS and CSS assets based on options passed .
53,458
private function update_jquery ( ) { wp_deregister_script ( 'jquery' ) ; if ( apply_filters ( self :: HOOK_PREFIX . 'include_jquery' , false ) ) { wp_register_script ( 'jquery' , $ this -> jquery_uri , false , $ this -> jquery_version , false ) ; wp_enqueue_script ( 'jquery' ) ; } }
Enqueues theme - bundled jQuery instead of default one in WordPress .
53,459
public function decorateService ( $ service ) { try { foreach ( $ this -> rules as $ rule ) { if ( $ rule [ 0 ] ( $ service ) ) { $ rule [ 1 ] ( $ service ) ; } } } catch ( \ Exception $ e ) { throw new LogicException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Apply decorating rules to a service object if matches
53,460
public function setDecorate ( $ ruleName , $ interfaceOrClosure , $ decorateCallable ) { if ( ! is_callable ( $ interfaceOrClosure ) ) { $ interfaceOrClosure = function ( $ service ) use ( $ interfaceOrClosure ) { return $ service instanceof $ interfaceOrClosure ; } ; } if ( ! is_callable ( $ decorateCallable ) ) { $ m...
Set up docorating rules
53,461
public function render ( $ view , $ values = array ( ) ) { $ folder = $ this -> app -> config ( 'templates.path' ) ; $ view = $ folder . $ view . '.php' ; if ( ! file_exists ( $ view ) ) { throw new \ Exception ( 'Template not found: ' . $ view , 404 ) ; } extract ( $ values ) ; ob_start ( ) ; include $ view ; $ html =...
Renders a template with optional data
53,462
public function register ( ) { $ this -> create ( 'mail' , function ( ) { $ c = new Configuration ( ) ; $ config = $ c -> from ( 'mail' ) ; $ mail = new Mailer ( $ config -> get ( 'host' ) , $ config -> get ( 'port' ) , $ config -> get ( 'smtp_auth' ) , $ config -> get ( 'encryption' ) ) ; return $ mail -> setAuthentic...
Registers the Mailer Service Provider .
53,463
public function setCurrentLanguage ( $ language ) { if ( ! $ this -> isAvailable ( $ language ) ) { return false ; } $ this -> session -> put ( 'language' , $ language ) ; $ this -> setLanguage ( $ language ) ; return true ; }
Set the current language
53,464
public function setLanguage ( $ language ) { if ( $ language == $ this -> currentLanguage ) { return ; } if ( ! $ this -> isLoaded ( $ language ) ) { $ this -> loadLanguage ( $ language ) ; } switch ( $ language ) { case 'fr' : setlocale ( LC_ALL , 'fr_FR.utf8' , 'fr_FR.UTF-8' , 'fr_FR@euro' , 'fr_FR' , 'french' ) ; br...
Set the language to use
53,465
public function languages ( $ key = null , $ subkey = null ) { if ( $ key === null ) { return $ this -> languagesIso ; } if ( is_int ( $ key ) ) { if ( is_null ( $ subkey ) ) { return $ this -> languagesId [ $ key ] ; } return $ this -> languagesId [ $ key ] [ $ subkey ] ; } if ( is_null ( $ subkey ) ) { return $ this ...
Retrieve languages .
53,466
public function translate ( $ string , $ context = 'default' , $ language = 'default' ) { if ( $ this -> isDefault ( $ language ) ) { $ language = $ this -> currentLanguage ; } else { $ this -> setLanguage ( $ language ) ; } if ( array_key_exists ( $ context , $ this -> strings [ $ language ] ) && array_key_exists ( $ ...
Retreive a string to translate
53,467
public function getContext ( ) { if ( $ this -> pageContext ) { return $ this -> pageContext ; } $ current = \ Route :: getCurrentRoute ( ) ; if ( ! $ current ) { return 'default' ; } if ( $ current -> getName ( ) ) { return $ this -> pageContext = $ current -> getName ( ) ; } $ action = $ current -> getAction ( ) ; if...
Get the page s context
53,468
public function getAttachUrl ( $ params = [ ] , $ cookieBased = null ) { $ this -> generateToken ( $ cookieBased ) ; $ data = [ 'command' => 'attach' , 'broker' => $ this -> broker , 'token' => $ this -> token , 'checksum' => hash ( 'sha256' , 'attach' . $ this -> token . $ this -> secret ) ] + $ _GET ; return $ this -...
Get URL to attach session at SSO server .
53,469
protected function request ( $ method , $ command , $ data = null ) { if ( ! $ this -> isAttached ( ) ) { throw new NotAttachedException ( 'No token' ) ; } $ url = $ this -> getRequestUrl ( $ command , ! $ data || $ method === 'POST' ? [ ] : $ data ) ; $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRA...
Execute on SSO server .
53,470
public function login ( $ username = null , $ password = null ) { if ( ! isset ( $ username ) && isset ( $ _POST [ 'username' ] ) ) { $ username = $ _POST [ 'username' ] ; } if ( ! isset ( $ password ) && isset ( $ _POST [ 'password' ] ) ) { $ password = $ _POST [ 'password' ] ; } $ result = $ this -> request ( 'POST' ...
Log the client in at the SSO server .
53,471
public function get ( ) { $ class = null ; if ( $ this -> state ) { for ( $ i = 5 ; $ i > 0 ; $ i -- ) { $ exceptionQueue [ ] = sprintf ( "State%s" , substr ( $ this -> state , 0 , $ i ) ) ; } while ( ! $ class and $ _class = array_shift ( $ exceptionQueue ) ) { $ file = __DIR__ . "/Exception/States/{$_class}.php" ; if...
Get the actual exception
53,472
public function execute ( $ request ) { $ logger = $ GLOBALS [ 'logger' ] ; try { parent :: execute ( $ request ) ; } catch ( AuthenticationException $ ex ) { $ logger -> error ( 'Unauthorized attempt to access resource, being redirected to home page' , array ( $ ex -> getMessage ( ) ) ) ; $ this -> _handleUnauthentica...
Checks for secure routing currently security is handled at a base route level
53,473
protected function _handleUnauthenticatedAccess ( ) { header ( "HTTP/1.0 401 Unauthorized" ) ; $ renderer = new TwigRenderer ( ) ; $ output = $ renderer -> render ( 'unauth.tmpl' , array ( ) ) ; $ result = array ( "code" => "401" , "message" => $ output ) ; echo parent :: encodeData ( $ result ) ; exit ; }
Handle Unauthenticated access .
53,474
public function domain ( $ domain = null ) { if ( null !== $ domain ) { if ( false === is_string ( $ domain ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ domain ) ) , E_USER_ERROR ) ; } if ( false === Router :: routeExists ( $ this -...
Set the domain
53,475
public function syn ( ) { if ( ! isset ( $ this -> options [ "host" ] ) || empty ( $ this -> options [ "host" ] ) ) { $ this -> options [ "host" ] = $ this -> default_host ; } if ( ! isset ( $ this -> options [ "port" ] ) || empty ( $ this -> options [ "port" ] ) ) { $ this -> options [ "port" ] = $ this -> default_por...
Connects the AbstractTransport object and performs initial actions on the remote server .
53,476
public function listCommand ( int $ sysLanguageUid , int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' ) { $ this -> beforeCommand ( ) ; $ table = new ConsoleTable ( ) ; $ table -> setHeaders ( [ 'UID' , 'Title' , 'Page ID' , 'Status' ] ) ; foreach ( $ this -> getPageUids ( $ pid , $ recursion , $ exclude ) ...
Lists page language overlays .
53,477
public function initializeCommand ( int $ sysLanguageUid , int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' , bool $ verbose = false ) { $ this -> beforeCommand ( ) ; foreach ( $ this -> getPageUids ( $ pid , $ recursion , $ exclude ) as $ pageUid ) { $ languageOverlay = LanguageOverlay :: where ( [ [ 'pid'...
Initializes page language overlays .
53,478
public function hideCommand ( int $ sysLanguageUid , int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' , bool $ verbose = false ) { $ this -> beforeCommand ( ) ; foreach ( $ this -> getPageUids ( $ pid , $ recursion , $ exclude ) as $ pageUid ) { $ languageOverlay = LanguageOverlay :: where ( [ [ 'pid' , '='...
Hides page language overlays .
53,479
protected function getPageUids ( int $ pid = 1 , int $ recursion = 99 , string $ exclude = '' ) { $ exclude = $ exclude === '-' ? '' : $ exclude ; $ exclude = GeneralUtility :: intExplode ( ',' , $ exclude , true ) ; $ pagesTreeList = $ this -> queryGenerator -> getTreeList ( $ pid , $ recursion , 0 , 1 ) ; $ pageUids ...
Gets page UIDs .
53,480
public function process ( ContainerBuilder $ container ) { $ registryDefinition = $ container -> getDefinition ( 'spray_serializer.serializer_registry' ) ; $ tagged = $ container -> findTaggedServiceIds ( 'spray_serializer' ) ; foreach ( $ tagged as $ id => $ tags ) { foreach ( $ tags as $ attr ) { $ registryDefinition...
Find services tagged with spray_serializer and attach them to the serializer registry .
53,481
public function getToken ( $ tokenId ) { if ( $ this -> storage -> hasToken ( $ tokenId ) ) { return $ this -> storage -> getToken ( $ tokenId ) ; } $ token = new CsrfToken ( $ tokenId , $ this -> generateValue ( ( int ) $ this -> tokenLength ) ) ; $ this -> storage -> setToken ( $ tokenId , $ token ) ; return $ token ...
returns a CSRF token for the given token id
53,482
public function refreshToken ( $ tokenId ) { $ this -> storage -> removeToken ( $ tokenId ) ; $ token = new CsrfToken ( $ tokenId , $ this -> generateValue ( ( int ) $ this -> tokenLength ) ) ; $ this -> storage -> setToken ( $ tokenId , $ token ) ; return $ token ; }
generates a new token for the given id a new token will be generated independent of whether a token value previously existed or not useful to enforce once - only tokens
53,483
public function isTokenValid ( CsrfToken $ token ) { $ tokenId = $ token -> getId ( ) ; if ( ! $ this -> storage -> hasToken ( $ tokenId ) ) { return FALSE ; } return hash_equals ( $ this -> storage -> getToken ( $ tokenId ) -> getValue ( ) , $ token -> getValue ( ) ) ; }
check whether the given CSRF token is valid returns TRUE if the token is valid FALSE otherwise
53,484
public static function getSessionCookieForExportUser ( $ user , $ pass ) { global $ wgServerHTTP , $ wgScriptPath , $ wgODBTechnicalUser ; $ user = urlencode ( $ user ) ; $ pass = urlencode ( $ pass ) ; $ apiPath = "/api.php?action=login&format=json&lgname=$user&lgpassword=$pass" ; $ response = Http :: post ( $ wgServe...
Requests a session cookie for a user .
53,485
public function addClassListeners ( $ instance ) { if ( ! $ this -> driver ) { throw Exception :: noDriver ( ) ; } foreach ( $ this -> driver -> getListenersForClass ( $ instance ) as $ listener ) { $ this -> addListener ( $ listener [ 'event' ] , array ( $ instance , $ listener [ 'method' ] ) ) ; } }
Automatically maps event listeners associated with a class using the driver provided to this instance and registers them .
53,486
public function addListeners ( $ event , $ listeners ) { foreach ( $ listeners as $ listener ) { $ this -> addListener ( $ event , $ listener ) ; } }
Adds a set of listeners .
53,487
public function getListeners ( $ event ) { if ( ! isset ( $ this -> listeners [ $ event ] ) || ! is_array ( $ this -> listeners [ $ event ] ) ) { return array ( ) ; } return $ this -> listeners [ $ event ] ; }
Retrieves all listeners for an event .
53,488
public function dispatch ( $ event , Event $ eventObject ) { if ( ! isset ( $ this -> listeners [ $ event ] ) ) { return ; } foreach ( $ this -> listeners [ $ event ] as $ listener ) { call_user_func_array ( $ listener , array ( $ eventObject ) ) ; if ( $ eventObject -> propagationHalted ( ) ) { break ; } } }
Dispatches an event to all listeners .
53,489
protected final function BuiltInTemplateFile ( ) { $ class = new \ ReflectionClass ( $ this ) ; $ classFile = Str :: Replace ( '\\' , '/' , $ class -> getFileName ( ) ) ; $ templatePath = Str :: Replace ( '/Modules/' , '/Templates/' , $ classFile ) ; return Path :: AddExtension ( $ templatePath , 'phtml' , true ) ; }
Returns the template file that comes with the bundle module
53,490
public function up ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] , $ this -> _currentPosition [ 1 ] - $ count , ) ; return $ this ; }
Move up current position
53,491
public function down ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] , $ this -> _currentPosition [ 1 ] + $ count , ) ; return $ this ; }
Move down current position
53,492
public function left ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] - $ count , $ this -> _currentPosition [ 1 ] , ) ; return $ this ; }
Move left current position
53,493
public function right ( $ count = 0 ) { $ this -> _currentPosition = array ( $ this -> _currentPosition [ 0 ] + $ count , $ this -> _currentPosition [ 1 ] , ) ; return $ this ; }
Move right current position
53,494
public function move ( $ dx , $ dy ) { if ( $ dx < 0 ) { $ this -> left ( abs ( $ dx ) ) ; } else { $ this -> right ( abs ( $ dx ) ) ; } if ( $ dy < 0 ) { $ this -> up ( abs ( $ dy ) ) ; } else { $ this -> down ( abs ( $ dy ) ) ; } return $ this ; }
Move current position
53,495
public function setAncor ( $ position = null ) { if ( is_null ( $ position ) === true ) { $ position = $ this -> _currentPosition ; } $ this -> _ancorPosition = $ position ; return $ this ; }
Set ancor position
53,496
public function getEscapeSequencesByPath ( $ dx = null , $ dy = null ) { if ( is_null ( $ dx ) === true ) { $ dx = $ this -> _currentPosition [ 0 ] - $ this -> _ancorPosition [ 0 ] ; } if ( is_null ( $ dy ) === true ) { $ dy = $ this -> _currentPosition [ 1 ] - $ this -> _ancorPosition [ 1 ] ; } return self :: getMovin...
Get escape sequences by path
53,497
public static function getMovingEscapeSequences ( $ dx , $ dy ) { $ escapeSequences = '' ; if ( $ dy < 0 ) { $ escapeSequences .= self :: getUpEscapeSequence ( abs ( $ dy ) ) ; } else if ( $ dy > 0 ) { $ escapeSequences .= self :: getDownEscapeSequence ( abs ( $ dy ) ) ; } if ( $ dx < 0 ) { $ escapeSequences .= self ::...
Get moving escape sequences
53,498
protected function retryJob ( $ id ) { $ failed = $ this -> laravel [ 'queue.failer' ] -> find ( $ id ) ; if ( ! is_null ( $ failed ) ) { $ failed = ( object ) $ failed ; $ failed -> payload = $ this -> resetAttempts ( $ failed -> payload ) ; $ this -> laravel [ 'queue' ] -> connection ( $ failed -> connection ) -> pus...
Retry the queue job with the given ID .
53,499
protected function resetAttempts ( $ payload ) { $ payload = json_decode ( $ payload , true ) ; if ( isset ( $ payload [ 'attempts' ] ) ) { $ payload [ 'attempts' ] = 1 ; } return json_encode ( $ payload ) ; }
Reset the payload attempts .