idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
234,300
public function getAvailableLangs ( ) : array { $ langs = [ 'en' ] ; $ scan = Directory :: scan ( root . '/I18n/' . env_name . '/' , GLOB_ONLYDIR , true ) ; foreach ( $ scan as $ row ) { $ langs [ ] = trim ( $ row , '/' ) ; } return $ langs ; }
Get available languages in the filesystem
234,301
public function getLocaleText ( $ input , ? string $ lang = null , ? string $ default = null ) : ? string { if ( $ lang === null ) { $ lang = App :: $ Request -> getLanguage ( ) ; } if ( Any :: isStr ( $ input ) ) { $ input = Serialize :: decode ( $ input ) ; } if ( Any :: isArray ( $ input ) && array_key_exists ( $ la...
Get locale data from input array or serialized string
234,302
public function getDate ( $ format = null ) { $ format = empty ( $ format ) ? $ this -> format : $ format ; return strftime ( $ format , $ this -> ts ) ; }
Retorna data no formato especificado
234,303
public function unlock ( ) { $ this -> count -- ; if ( $ this -> count < 0 ) { $ this -> count = 0 ; return false ; } if ( 0 === $ this -> count ) { $ this -> entityManager -> flush ( ) ; return true ; } return false ; }
Call this at the end of a persistence function .
234,304
public static function getCurrent ( $ navigation , $ current ) { self :: iterateItems ( $ navigation ) ; foreach ( self :: $ navItem as $ item ) { if ( $ item === $ current ) { self :: getCurrentItem ( intval ( floor ( self :: $ navItem -> getDepth ( ) / 2 ) ) ) ; } } ksort ( self :: $ currentItems ) ; return self :: $...
Creates the current menu items which are selected from the navigation item hierarchy
234,305
protected static function getCurrentItem ( $ depth ) { self :: $ currentItems [ $ depth ] = iterator_to_array ( self :: $ navItem -> getSubIterator ( ( ( $ depth * 2 ) + 1 ) ) ) ; unset ( self :: $ currentItems [ $ depth ] [ 'children' ] ) ; if ( $ depth >= 1 ) { self :: getCurrentItem ( ( $ depth - 1 ) ) ; } }
Gets the current level items from the menu array
234,306
final protected function parseSimpleXML ( \ SimpleXMLElement $ element ) { $ elements = [ ] ; foreach ( $ element -> attributes ( ) as $ attribute => $ value ) { $ elements [ $ attribute ] = $ value instanceof \ SimpleXMLElement ? $ this -> parseSimpleXML ( $ value ) : $ value ; } foreach ( $ element -> children ( ) as...
Parse xml to array .
234,307
private function getTypedValue ( string $ value ) { if ( \ in_array ( $ value , self :: $ boolValues , true ) ) { return \ in_array ( $ value , self :: $ truthlyValues , true ) ; } if ( \ is_numeric ( $ value ) ) { return $ this -> getNumericValue ( $ value ) ; } return $ value ; }
Transforms string to type .
234,308
private function getNumericValue ( string $ value ) { if ( \ strpos ( $ value , '.' ) !== false ) { return ( float ) $ value ; } return ( int ) $ value ; }
Get numeric value from string .
234,309
public function cakephpPlugins ( $ opts = [ 'format' => 'table' , 'fields' => '' ] ) { $ result = $ this -> taskCakephpPlugins ( ) -> run ( ) ; if ( ! $ result -> wasSuccessful ( ) ) { $ this -> exitError ( "Failed to run the command" ) ; } return new PropertyList ( $ result -> getData ( ) [ 'data' ] ) ; }
List CakePHP loaded plugins
234,310
final public function check ( array $ options ) { foreach ( $ options as $ property => $ value ) { if ( ( is_array ( $ value ) && ! in_array ( $ this -> $ property , $ value ) ) || ( ! is_array ( $ value ) && $ this -> $ property !== $ value ) ) return false ; } return true ; }
Checks if properties exist and their values are as required
234,311
private function getPostsPermissions ( ) { return [ [ 'name' => 'Posts - List all posts' , 'description' => 'Allow to list all posts.' , 'slug' => PostsPolicy :: PERMISSION_LIST , ] , [ 'name' => 'Posts - View a post' , 'description' => 'Allow to display a post.' , 'slug' => PostsPolicy :: PERMISSION_SHOW , ] , [ 'name...
Get the Posts permissions .
234,312
private function getCategoriesPermissions ( ) { return [ [ 'name' => 'Categories - List all categories' , 'description' => 'Allow to list all categories.' , 'slug' => CategoriesPolicy :: PERMISSION_LIST , ] , [ 'name' => 'Categories - View a category' , 'description' => 'Allow to display a category.' , 'slug' => Catego...
Get the Categories permissions .
234,313
private function getTagsPermissions ( ) { return [ [ 'name' => 'Tags - List all tags' , 'description' => 'Allow to list all tags.' , 'slug' => TagsPolicy :: PERMISSION_LIST , ] , [ 'name' => 'Tags - View a tag' , 'description' => 'Allow to display a tag.' , 'slug' => TagsPolicy :: PERMISSION_SHOW , ] , [ 'name' => 'Tag...
Get the Tags permissions .
234,314
private function getFilters ( ) { $ filters = new Collection ; foreach ( $ this -> getCachedPermissionGroups ( ) as $ group ) { $ filters -> push ( [ 'name' => $ group -> name , 'params' => [ $ group -> hashed_id ] , ] ) ; } if ( Permission :: where ( 'group_id' , 0 ) -> count ( ) ) { $ filters -> push ( [ 'name' => tr...
Get the groups filters data .
234,315
public function render ( array $ options = [ ] ) : string { $ this -> resolveOptions ( $ options ) ; if ( false === $ this -> validate ( ) ) { return false ; } $ this -> splitCellsContent ( ) ; $ this -> calculateSizes ( ) ; $ this -> tableWidth = $ this -> calculateTableWidth ( ) ; $ table = $ this -> options [ 'has_h...
Renders the table as plain text .
234,316
public function validate ( ) : bool { $ numberOfColumns = null ; $ this -> errors = [ ] ; if ( 0 >= count ( $ this -> data ) ) { $ message = 'There are no rows in the table' ; $ this -> errors [ ] = $ message ; return false ; } foreach ( $ this -> data as $ row ) { $ found = count ( $ row ) ; if ( null === $ numberOfCo...
Validates the given array to check all the rows have the same number of columns .
234,317
private function splitCellsContent ( ) { foreach ( $ this -> data as $ rowPosition => $ rowContent ) { foreach ( $ rowContent as $ columnName => $ cellContent ) { $ cellContent = $ this -> reduceSpaces ( $ cellContent ) ; if ( false === isset ( $ this -> options [ 'columns' ] [ $ columnName ] [ 'max_width' ] ) ) { $ th...
Splits the content of each cell into multiple lines according to the set max column width .
234,318
private function calculateSizes ( ) { foreach ( $ this -> data as $ rowPosition => $ rowContent ) { foreach ( $ rowContent as $ columnName => $ cellContent ) { if ( false === isset ( $ this -> rowsHeights [ $ rowPosition ] ) ) { $ this -> rowsHeights [ $ rowPosition ] = count ( $ cellContent ) ; } if ( isset ( $ this -...
Calculates the width of each column of the table .
234,319
private function calculateTableWidth ( ) : int { $ tableWidth = 0 ; foreach ( $ this -> columnsWidths as $ width ) { $ tableWidth += $ width ; } $ tableWidth += 1 ; $ tableWidth += ( $ this -> options [ 'cells_padding' ] [ 1 ] + $ this -> options [ 'cells_padding' ] [ 3 ] ) * count ( $ this -> columnsWidths ) ; $ table...
Calculates the total width of the table .
234,320
private function drawDivider ( string $ prefix = 'sep_' ) : string { $ divider = '' ; foreach ( $ this -> columnsWidths as $ width ) { $ times = $ width + $ this -> options [ 'cells_padding' ] [ 1 ] + $ this -> options [ 'cells_padding' ] [ 3 ] ; $ divider .= $ this -> options [ $ prefix . 'x' ] . $ this -> repeatChar ...
Draws the horizontal divider .
234,321
private function resolveCellsPaddings ( ) : array { $ return = [ 0 , 0 , 0 , 0 ] ; if ( false === isset ( $ this -> options [ 'cells_padding' ] ) ) { return $ return ; } $ resolver = new OptionsResolver ( ) ; $ resolver -> setDefined ( 0 ) ; $ resolver -> setDefined ( 1 ) ; $ resolver -> setDefined ( 2 ) ; $ resolver -...
Set the padding of the cells .
234,322
public function sendMessage ( $ level , $ message ) { $ this -> db -> insert ( $ this -> tableName , [ 'level' => $ level , 'message' => $ message , 'date_create' => $ _SERVER [ 'REQUEST_TIME' ] ] ) ; }
Send log message into DB
234,323
public function count ( array $ constraints = [ ] , QueryBuilder $ qb = null ) { $ qb = ! is_null ( $ qb ) ? $ qb : $ this -> createQueryBuilder ( 'e' ) ; if ( count ( $ constraints ) ) $ qb = $ this -> _by ( $ qb , $ constraints ) ; return $ this -> arrange ( $ this -> _count ( $ qb ) , Repository :: RESULT_SHAPE_SCAL...
Return number of entities
234,324
protected function _paginate ( QueryBuilder $ qb , int $ offset , int $ limit ) { return $ qb -> setFirstResult ( $ offset ) -> setMaxResults ( $ limit ) ; }
Improve QueryBuilder with basic paginate request
234,325
public static function init ( Container $ container = null ) { if ( empty ( self :: $ _instance ) ) { if ( version_compare ( PHP_VERSION , '5.6.0' , '<' ) ) { throw new \ ErrorException ( 'NONSUPPORT_PHP_VERSION' ) ; } if ( is_null ( $ container ) ) { $ container = Container :: instance ( ) ; } self :: $ _instance = ne...
Initialize the server object .
234,326
public function registerRouter ( $ router , ... $ params ) { $ this -> _router -> add ( $ router , ... $ params ) ; if ( defined ( 'FOCUS_DEBUG' ) && FOCUS_DEBUG ) { $ this -> getLogger ( ) -> debug ( 'add new router: ' . ( is_string ( $ router ) ? $ router : get_class ( $ router ) ) ) ; } }
register router .
234,327
public function registerAutoloader ( $ baseDir , $ baseNs ) { $ baseNs = $ baseNs [ strlen ( $ baseNs ) - 1 ] == '\\' ? $ baseNs : "{$baseNs}\\" ; $ baseDir = rtrim ( $ baseDir , '/' ) ; spl_autoload_register ( function ( $ class ) use ( $ baseDir , $ baseNs ) { if ( strncmp ( $ baseNs , $ class , strlen ( $ baseNs ) )...
register class autoloader .
234,328
public function load ( $ key ) { $ data = $ this -> adapter -> getItem ( $ key , $ success ) ; if ( $ success && $ this -> automaticSerialization ) { $ data = unserialize ( $ data ) ; if ( $ data === false ) { $ this -> remove ( $ key ) ; } } return $ data ; }
Get an item
234,329
public static function isValid ( $ token ) { $ expiration = Config :: get ( 'security.anti_csrf.expiration' , 18000 ) ; $ computed = microtime ( true ) - ( double ) Text :: unlock ( $ token , self :: getKey ( ) ) ; return $ computed <= $ expiration ; }
Check Validity of Token
234,330
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
234,331
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 .
234,332
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 .
234,333
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 .
234,334
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 .
234,335
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 .
234,336
public function init ( Application $ application ) { $ application -> addService ( 'staticController' , new StaticControllerService ( ) ) ; $ application -> any ( ':all' , $ application -> getService ( 'staticController' ) ) ; }
init the module .
234,337
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
234,338
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
234,339
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
234,340
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
234,341
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
234,342
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
234,343
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
234,344
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
234,345
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
234,346
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
234,347
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
234,348
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 .
234,349
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
234,350
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
234,351
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
234,352
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
234,353
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 .
234,354
public function setInitialValue ( $ initialValue ) { if ( ! is_int ( $ initialValue ) || ( $ initialValue <= 0 ) ) { throw SchemaException :: invalidSequenceInitialValue ( $ this -> getName ( ) ) ; } $ this -> initialValue = $ initialValue ; }
Sets the initial value .
234,355
public function setIncrementSize ( $ incrementSize ) { if ( ! is_int ( $ incrementSize ) || ( $ incrementSize <= 0 ) ) { throw SchemaException :: invalidSequenceIncrementSize ( $ this -> getName ( ) ) ; } $ this -> incrementSize = $ incrementSize ; }
Sets the increment size .
234,356
public function addItem ( Model $ item ) : Collection { call_user_func ( [ $ this , $ this -> setterName ( ) ] , $ item ) ; return $ this ; }
Add item to collection
234,357
public function removeItem ( Model $ item ) : Collection { if ( $ this -> has ( $ item -> getId ( ) ) ) { unset ( $ this -> items [ $ item -> getId ( ) ] ) ; } return $ this ; }
Remove an item from collection
234,358
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
234,359
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
234,360
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 .
234,361
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
234,362
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 .
234,363
public function registerFactory ( string $ produced_class , Factory $ factory ) { $ this -> factories [ $ produced_class ] = $ factory ; return $ this ; }
Register a factory for a class name
234,364
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
234,365
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
234,366
public function validate ( $ value ) { return is_bool ( $ value ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: NON_BOOL ] ) ; }
Tells if a given value is a valid bool .
234,367
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
234,368
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 .
234,369
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 .
234,370
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 .
234,371
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 .
234,372
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 .
234,373
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 .
234,374
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 .
234,375
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
234,376
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
234,377
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 .
234,378
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 .
234,379
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 .
234,380
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 .
234,381
private function getFromMemory ( $ type ) { if ( isset ( $ this -> loaded [ $ type ] ) ) { return $ this -> loaded [ $ type ] ; } return null ; }
Gets a Metadata instance for a type from memory .
234,382
private function getFromCache ( $ type ) { if ( false === $ this -> hasCache ( ) ) { return null ; } return $ this -> cache -> loadMetadataFromCache ( $ type ) ; }
Retrieves a Metadata instance for a type from cache .
234,383
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 .
234,384
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 .
234,385
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 .
234,386
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 .
234,387
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 .
234,388
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 .
234,389
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
234,390
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
234,391
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
234,392
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 .
234,393
public function setCurrentLanguage ( $ language ) { if ( ! $ this -> isAvailable ( $ language ) ) { return false ; } $ this -> session -> put ( 'language' , $ language ) ; $ this -> setLanguage ( $ language ) ; return true ; }
Set the current language
234,394
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
234,395
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 .
234,396
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
234,397
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
234,398
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 .
234,399
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 .