idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
59,800
public static function FindObjectByIntValue ( $ idValue , $ propName , $ listOfObjects ) { $ match = false ; foreach ( $ listOfObjects as $ obj ) { if ( intval ( $ obj -> $ propName ( ) ) === $ idValue ) { $ match = $ obj ; break ; } } return $ match ; }
Find an object in a list filtering by the id value of given property name of each object .
59,801
public static function FindObjectByStringValue ( $ filter , $ propName , $ listOfObjects , $ key = null ) { $ match = false ; if ( $ key === null ) { foreach ( $ listOfObjects as $ obj ) { if ( $ obj -> $ propName ( ) === $ filter ) { $ match = $ obj ; break ; } } } else { foreach ( $ listOfObjects as $ obj ) { if ( $ ...
Find an object in a list filtering by the string value of one property name of each object .
59,802
public static function generateEllipsisAndTooltipMarkupFor ( $ textToTruncate , $ charLimit , $ placement ) { $ truncatedData = null ; if ( strlen ( $ textToTruncate ) > intval ( $ charLimit ) ) { $ truncatedData = array ( 'source' => $ textToTruncate , 'truncated' => substr ( $ textToTruncate , 0 , $ charLimit - 3 ) ....
Returns the truncated text based on the passed parameters at present the method generates the HTML markup as well which is needed for the tooltip to work properly .
59,803
public function loadConfig ( $ file ) { $ config = include $ file ; $ this -> path = $ config [ 'path' ] ; $ this -> compiled = $ config [ 'compiled' ] ; $ this -> forceCompile = $ config [ 'forceCompile' ] ; $ this -> skipCommentTags = $ config [ 'skipCommentTags' ] ; $ this -> source_filename_extension = $ config [ '...
load config array into View from file
59,804
public static function jumpstart ( Event $ event ) { $ info = static :: questionnaire ( $ event ) ; $ files = new \ AppendIterator ( ) ; $ files -> append ( new RegexIterator ( new RecursiveDirectoryIterator ( '.' ) , static :: $ filePattern , RegexIterator :: GET_MATCH ) ) ; $ files -> append ( new RegexIterator ( new...
Publish th plugin to the WordPress plugin repository
59,805
public static function mergeConfig ( Event $ event , array $ info ) { $ io = $ event -> getIO ( ) ; $ options = array ( "name" => $ info [ 'package' ] , "description" => $ info [ 'description' ] , "license" => $ info [ 'license' ] , "keywords" => array ( ) , "type" => "wordpress-plugin" , "authors" => array ( array ( "...
Merge the current config with the updated data
59,806
public static function updateFiles ( Event $ event , $ files , array $ info ) { $ io = $ event -> getIO ( ) ; if ( $ io -> askConfirmation ( 'Jumpstart will now update your files with the provided information. Okay? [yes]:' . "\t" ) ) { foreach ( $ files as $ file ) { $ file = array_pop ( $ file ) ; $ io -> write ( "\t...
Update the boilerplate files with the additional information
59,807
public static function questionnaire ( Event $ event ) { $ io = $ event -> getIO ( ) ; $ io -> write ( array ( PHP_EOL . PHP_EOL , 'Welcome to the Jumpstart Plugin generator' , PHP_EOL . PHP_EOL . PHP_EOL , 'This command will guide you through creating your basic plugin setup.' ) ) ; static :: $ package = $ io -> askAn...
Collect information about the plugin
59,808
public function append ( $ newvalue ) : void { $ index = count ( ( array ) $ this ) ; $ this -> offsetSet ( $ index , $ newvalue ) ; }
Append any item to the form .
59,809
protected function afterCreation ( $ object , array $ definition ) { if ( isset ( $ definition [ 'methods' ] ) ) { $ this -> executeMethodBatch ( $ definition [ 'methods' ] , $ object ) ; } if ( ! isset ( $ definition [ 'skip' ] ) || ! $ definition [ 'skip' ] ) { $ this -> executeCommonBatch ( $ object ) ; } }
Things to do after an object created .
59,810
protected function executeCommonBatch ( $ object ) { $ commons = $ this -> getCommonMethods ( ) ; foreach ( $ commons as $ pair ) { $ tester = $ pair [ 0 ] ; $ runner = $ pair [ 1 ] ; if ( $ tester ( $ object , $ this ) ) { $ this -> executeMethod ( $ runner , $ object ) ; } } }
Execute common methods for all objects
59,811
protected function indentArray ( array $ elements ) { return self :: INDENTATION . \ str_replace ( PHP_EOL , PHP_EOL . self :: INDENTATION , \ implode ( PHP_EOL , $ elements ) ) ; }
Indent all elements in the supplied array . The array must contain either strings or objects that can be casted to strings .
59,812
private function parse ( $ uri ) { $ parts = parse_url ( $ uri ) ; if ( $ parts === false ) throw new \ InvalidArgumentException ( "The source URI `{$uri}` appears to be malformed" ) ; if ( ( $ parts [ 'scheme' ] ?? null ) === 'mailto' ) { if ( isset ( $ parts [ 'host' ] ) || isset ( $ parts [ 'user' ] ) || isset ( $ p...
Parse a URI into its component parts and set the properties
59,813
public static function encodePath ( $ path ) { $ path = preg_replace_callback ( '/(?:[^' . self :: CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/u' , __CLASS__ . '::urlEncodeChar' , $ path ) ; if ( empty ( $ path ) ) return null ; if ( $ path [ 0 ] !== '/' ) return $ path ; return '/' . ltrim ( $ path , '/' )...
Encode the path
59,814
private function encodeQuery ( $ query , $ arg_separator = '&' ) { if ( ! empty ( $ query ) && strpos ( $ query , '?' ) === 0 ) $ query = substr ( $ query , 1 ) ; $ parts = explode ( $ arg_separator , $ query ) ; foreach ( $ parts as $ index => $ part ) { list ( $ key , $ value ) = $ this -> splitQueryValue ( $ part ) ...
Encode a query string to ensure it is propertly encoded .
59,815
private function encodeFragment ( $ fragment ) { if ( ! empty ( $ fragment ) && $ fragment [ 0 ] === '#' ) $ fragment = '%23' . substr ( $ fragment , 1 ) ; return $ this -> encodeQueryOrFragment ( $ fragment ) ; }
Encodes a fragment value to ensure it is properly encoded .
59,816
public function validateAttribute ( $ model , $ attribute ) { if ( $ this -> targetClass !== null && $ model -> $ attribute instanceof $ this -> targetClass && ! empty ( $ model -> $ attribute -> isNewRecord ) ) { return ; } if ( $ model -> isRelationPopulated ( $ attribute ) ) { return ; } parent :: validateAttribute ...
Consider attribute value successfully validated if it is an instance of the given targetClass and this instance was just created
59,817
public static function Atio13 ( $ ri , $ di , $ utc1 , $ utc2 , $ dut1 , $ elong , $ phi , $ hm , $ xp , $ yp , $ phpa , $ tc , $ rh , $ wl , & $ aob , & $ zob , & $ hob , & $ dob , & $ rob ) { $ j ; $ astrom = new iauASTROM ( ) ; $ j = IAU :: Apio13 ( $ utc1 , $ utc2 , $ dut1 , $ elong , $ phi , $ hm , $ xp , $ yp , $...
- - - - - - - - - - i a u A t i o 1 3 - - - - - - - - - -
59,818
public static function kernelAlias ( ) { if ( config ( 'alias.enable' ) ) { foreach ( array_get ( self :: $ aliases , 'kernel' ) as $ key => $ value ) { exception_if ( ( ! class_exists ( $ value ) && in_array ( $ key , self :: $ components ) ) , AliasedClassNotFoundException :: class , $ value , 'kernel' ) ; self :: se...
Set aliases for kernel classes .
59,819
public static function appAlias ( ) { if ( config ( 'alias.enable' ) ) { foreach ( array_except ( self :: $ aliases , 'kernel' ) as $ array => $ aliases ) { foreach ( $ aliases as $ key => $ value ) { exception_if ( ! class_exists ( $ value ) , AliasedClassNotFoundException :: class , $ value , $ array ) ; self :: set ...
Set aliases for app classes .
59,820
public static function update ( $ key , $ class ) { $ indexes = dot ( $ key ) ; self :: $ aliases [ $ indexes [ 0 ] ] = array_add ( self :: $ aliases [ $ indexes [ 0 ] ] , $ indexes [ 1 ] , $ class ) ; self :: $ aliases [ 'kernel' ] = config ( 'alias.kernel' ) ; Aliases :: set ( config ( 'alias.enable' ) , self :: $ al...
Update Aliases in alias file .
59,821
public static function clear ( $ key ) { self :: $ aliases [ $ key ] = [ ] ; self :: $ aliases [ 'kernel' ] = config ( 'alias.kernel' ) ; Aliases :: set ( config ( 'alias.enable' ) , self :: $ aliases ) ; }
Clear alias array .
59,822
public function readDirectory ( $ directory , $ recursive = true ) { if ( is_dir ( $ directory ) === false ) { return false ; } try { $ resource = opendir ( $ directory ) ; $ contents = array ( ) ; while ( false !== ( $ item = readdir ( $ resource ) ) ) { if ( in_array ( $ item , array ( '.' , '..' ) ) || substr ( $ it...
Reading the directory recursive
59,823
protected static function getFacadeClass ( ) { $ base = App :: make ( 'database.base' ) ; $ tables = Config :: get ( 'database.tables' ) ; return new LoginDispatcher ( $ base , $ tables ) ; }
get the login dispatcher facade
59,824
public function handleJoinCommand ( CommandEvent $ event , EventQueueInterface $ queue ) { $ params = $ event -> getCustomParams ( ) ; if ( ! $ params ) { $ this -> handleJoinHelp ( $ event , $ queue ) ; } else { $ channels = $ params [ 0 ] ; $ keys = isset ( $ params [ 1 ] ) ? $ params [ 1 ] : null ; $ queue -> ircJoi...
Handles a command to join a specified channel .
59,825
public function handlePartCommand ( CommandEvent $ event , EventQueueInterface $ queue ) { $ params = $ event -> getCustomParams ( ) ; if ( ! $ params ) { $ this -> handlePartHelp ( $ event , $ queue ) ; } else { $ channels = $ params [ 0 ] ; $ queue -> ircPart ( $ channels ) ; } }
Handles a command to part a specified channel .
59,826
public function index ( ) { $ packages = Packages :: all ( ) ; $ final_packages = [ ] ; foreach ( $ packages as $ package ) { $ sets = Setts :: get ( $ package ) ; if ( $ sets ) { $ final_packages [ $ package ] = Setts :: view ( $ package ) ; } } return view ( 'laralum_settings::index' , [ 'packages' => $ final_package...
Display all the modules settings .
59,827
public function update ( Request $ request ) { $ this -> authorize ( 'update' , Settings :: class ) ; $ this -> validate ( $ request , [ 'appname' => 'required' , 'description' => 'required' , 'keywords' => 'required' , 'author' => 'required' , ] ) ; Settings :: first ( ) -> update ( [ 'appname' => $ request -> appname...
Update the general settings .
59,828
protected function buildMessage ( EmailEntity $ email ) { $ attachments = json_decode ( $ email -> getAttachments ( ) , true ) ? : [ ] ; $ attachments = array_map ( function ( $ attachment ) { if ( isset ( $ attachment [ 'content' ] ) ) { $ attachment [ 'data' ] = base64_decode ( Arr :: remove ( $ attachment , 'content...
Build Mailgun compatible message array from email entity
59,829
public function render ( Framework $ framework , MenuEntry $ menuEntry ) { if ( ! $ menuEntry -> hasChildren ( ) ) { return '' ; } $ templatesManager = $ framework -> getInstance ( '\\Zepi\\Web\\General\\Manager\\TemplatesManager' ) ; $ htmlString = '' ; $ emptyChilds = array ( ) ; foreach ( $ menuEntry -> getChildren ...
Renders a overview page for the given MenuEntry object
59,830
public function run ( ) { try { $ this -> command -> execute ( $ this -> console , $ this -> parser -> getArguments ( ) ) ; } catch ( \ Exception $ e ) { $ this -> writeException ( $ e ) ; if ( $ this -> exitOnException ) { exit ( $ e -> getCode ( ) ? : 1 ) ; } throw $ e ; } }
Parses input arguments and executes the Command
59,831
public function setContainer ( $ key , Placeholder \ HtmlClassContainer $ container ) { $ this -> registry -> setContainer ( $ key , $ container ) ; return $ this ; }
Set the container for an item in the registry .
59,832
public static function markup ( $ cost , $ total , $ round = false ) { if ( $ cost <= 0 ) { return ( float ) 0 ; } $ quotient = self :: div ( $ total , $ cost ) ; $ difference = self :: sub ( $ quotient , 1 ) ; $ product = self :: mul ( $ difference , 100 , $ round ) ; $ markup = $ round ? self :: round ( $ product ) :...
Works out markup .
59,833
public static function margin ( $ cost , $ charge_out , $ round = false ) { if ( $ cost == $ charge_out ) { return ( float ) 0 ; } $ cost = self :: mul ( $ cost , - 1 ) ; $ numerator = self :: add ( $ cost , $ charge_out ) ; $ denominator = max ( abs ( $ cost ) , abs ( $ charge_out ) ) ; $ result = self :: div ( $ nume...
Works out margin .
59,834
public static function trim ( $ n ) { $ float = floatval ( $ n ) ; $ decimalPlaces = 0 ; while ( $ float != round ( $ float , $ decimalPlaces ) ) { $ decimalPlaces ++ ; } $ decimalPlaces = ( $ decimalPlaces < 2 ) ? 2 : $ decimalPlaces ; return number_format ( $ float , $ decimalPlaces , "." , "" ) ; }
Trims redundant trailing zeros
59,835
public function match ( string $ subject , $ flags = 0 , $ offset = 0 ) : int { $ this -> clean ( ) ; return preg_match ( $ this -> pattern , $ subject , $ this -> last_match , $ flags , $ offset ) ; }
Perform a regular expression match
59,836
public function replace ( $ replacement , $ subject , int $ limit = - 1 ) { $ this -> clean ( ) ; return preg_replace ( $ this -> pattern , $ replacement , $ subject , $ limit , $ this -> last_count ) ; }
Perform a regular expression search and replace
59,837
public function replaceCallback ( callable $ callback , $ subject , $ limit = - 1 , & $ count = null ) { $ this -> clean ( ) ; return preg_replace_callback ( $ this -> pattern , $ callback , $ subject , $ limit , $ count ) ; }
Perform a regular expression search and replace using a callback
59,838
public function each ( string $ subject , \ Closure $ closure , $ offset = 0 ) { if ( $ this -> matchAll ( $ subject , PREG_SET_ORDER , $ offset ) ) { foreach ( $ this -> getLastMatch ( ) as $ item ) { $ closure ( $ item ) ; } } }
Perform a global regular expression match and call function for everyone
59,839
public function getFileList ( $ config ) { if ( strpos ( $ config , ',' ) ) { return array_filter ( explode ( ',' , $ config ) ) ; } if ( ! $ this -> isAbsolutePath ( $ config ) ) { $ config = getcwd ( ) . '/' . $ config ; } if ( ! file_exists ( $ config ) ) { throw new InvalidArgumentException ( sprintf ( 'Configurati...
Get a list of files in order .
59,840
public static function create ( $ request , array $ config = array ( ) ) { $ request = self :: getRequest ( $ request , isset ( $ config [ 'resolver' ] ) ? $ config [ 'resolver' ] : null ) ; if ( ! empty ( $ config [ 'adapter' ] [ 'class' ] ) ) { if ( ( $ info = self :: executeAdapter ( $ config [ 'adapter' ] [ 'class'...
Gets the info from an url
59,841
private static function executeAdapter ( $ adapter , Request $ request , array $ config = null ) { if ( ! in_array ( 'Embed\\Adapters\\AdapterInterface' , class_implements ( $ adapter ) ) ) { throw new \ InvalidArgumentException ( "The class '$adapter' must implements 'Embed\\Adapters\\AdapterInterface'" ) ; } if ( cal...
Execute an adapter
59,842
private static function getRequest ( $ request , array $ config = null ) { if ( is_string ( $ request ) ) { return new Request ( $ request , isset ( $ config [ 'class' ] ) ? $ config [ 'class' ] : null , isset ( $ config [ 'config' ] ) ? $ config [ 'config' ] : [ ] ) ; } if ( ! ( $ request instanceof Request ) ) { thro...
Init a request
59,843
public function getWebPathForResource ( Resource $ resource ) { $ relPath = Path :: makeRelative ( $ resource -> getRepositoryPath ( ) , $ this -> basePath ) ; return '/' . trim ( $ this -> mapping -> getWebPath ( ) . '/' . $ relPath , '/' ) ; }
Returns the install path of a resource in the target location .
59,844
public static function buildUrl ( $ parts ) { $ url = '' ; if ( isset ( $ parts [ 'scheme' ] ) ) { $ url .= $ parts [ 'scheme' ] . '://' ; } if ( isset ( $ parts [ 'user' ] ) ) { if ( isset ( $ parts [ 'pass' ] ) ) { $ url .= $ parts [ 'user' ] . ':' . $ parts [ 'pass' ] . '@' ; } else { $ url .= $ parts [ 'user' ] . '...
Build url from parts opposite of parse_url
59,845
public static function convertUtfUrl ( $ url ) { $ parts = ( array ) parse_url ( $ url ) ; if ( isset ( $ parts [ 'host' ] ) ) { if ( function_exists ( 'idn_to_ascii' ) ) { $ parts [ 'host' ] = idn_to_ascii ( $ parts [ 'host' ] ) ; } } if ( isset ( $ parts [ 'path' ] ) ) { $ parts [ 'path' ] = implode ( '/' , array_map...
Convert utf parts of urls
59,846
public function factory ( $ documentClass , DocumentIdentity $ identity = null ) { if ( ! isset ( $ this -> prototypes [ $ documentClass ] ) ) { $ document = new $ documentClass ( ) ; $ event = new DocumentEvent ( $ document ) ; $ this -> dispatcher -> dispatch ( IndexerEvents :: CREATE_DOCUMENT , $ event ) ; $ this ->...
Document factory .
59,847
public function beforePrepare ( Event $ event ) { $ operation = $ event [ 'command' ] -> getOperation ( ) ; $ client = $ event [ 'command' ] -> getClient ( ) ; if ( $ operation -> hasParam ( 'collection' ) === false ) return ; if ( is_null ( $ client -> getCollectionName ( ) ) ) return ; $ operation -> getParam ( 'coll...
Inject the correct collection name for entity queries .
59,848
public function GetConfigurationFilePath ( $ fileName ) { return "APP_ROOT_DIR" . \ Puzzlout \ Framework \ Enums \ ApplicationFolderName :: AppsFolderName . \ Puzzlout \ Framework \ Helpers \ CommonHelper :: GetAppName ( ) . '/Config/' . $ fileName ; }
Builds the filePath to the configuration file .
59,849
public function ReturnFileContents ( $ nodeName ) { if ( file_exists ( $ this -> filePath ) ) { $ xml = new \ DOMDocument ; $ xml -> load ( $ this -> filePath ) ; return $ xml -> getElementsByTagName ( $ nodeName ) ; } return false ; }
Gets the content of a DOMDocument for a node name .
59,850
public function is_login ( $ table_name ) { $ user_info = $ this -> get_login_user_info ( $ table_name ) ; if ( $ user_info === false ) { return false ; } return true ; }
Check User Logging Status .
59,851
public function get_login_user_info ( $ table_name ) { $ user_info = $ this -> exdb -> session ( ) -> get ( 'user_info' ) ; if ( is_array ( @ $ user_info [ $ table_name ] ) ) { return $ user_info [ $ table_name ] ; } return false ; }
Get Login User Info .
59,852
public function preProcessMessage ( MessageInterface $ message ) { foreach ( $ this -> getProcessorStore ( ) -> getProcessors ( ) as $ processor ) { $ message = $ processor -> preProcessMessage ( $ message ) ; } return $ message ; }
PreProcess the message .
59,853
public function suck ( ) { if ( $ this -> endpoint instanceof PageableTallantoMethodInterface ) { $ this -> endpoint -> setPageNumber ( 1 ) -> setPageSize ( $ this -> maxPageSize ) ; } else { throw new \ Exception ( 'Tallanto pump works only with PageableTallantoMethodInterface endpoints.' ) ; } $ totalResult = [ ] ; d...
Retrieves all items from the server for this endpoint .
59,854
public function save ( AggregateRoot $ aggregate ) { $ uncommitted = $ aggregate -> getChanges ( ) ; $ committedStream = $ this -> eventStore -> commit ( $ uncommitted ) ; if ( ! is_null ( $ this -> eventBus ) ) { $ this -> eventBus -> publish ( $ committedStream ) ; } if ( ! is_null ( $ this -> snapshotStore ) && $ th...
To store the updates made to an Aggregate we only need to commit the latest recorded events to the EventStore .
59,855
public function loadSnapshot ( Identity $ id ) { if ( is_null ( $ this -> snapshotStore ) ) { throw new \ Exception ( 'Unable to get snapshot; No store attached' ) ; } return $ this -> snapshotStore -> get ( $ id ) ; }
Load a aggregate snapshot from the storage
59,856
public function saveSnapshot ( AggregateRoot $ aggregate ) { if ( is_null ( $ this -> snapshotStore ) ) { throw new \ Exception ( 'Unable to create snapshot; No store attached' ) ; } if ( $ aggregate -> hasChanges ( ) ) { $ aggregate = $ aggregate :: reconstituteFrom ( new CommittedEvents ( $ aggregate -> getIdentity (...
Save the aggregate state as single snapshot instead of multiple history events
59,857
public function indexAction ( Request $ request ) { $ id = $ request -> get ( 'id' ) ; $ version = $ request -> get ( 'version' ) ; $ mode = $ request -> get ( 'mode' , 'edit' ) ; $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ elementtype = $ elementtypeService -> findElementty...
Return an Element Type Data Tree .
59,858
public function addInstance ( $ key , $ object = null ) { if ( \ is_object ( $ key ) ) { $ this -> storage -> instance ( \ get_class ( $ key ) , $ key ) ; } elseif ( \ is_object ( $ object ) ) { $ this -> storage -> instance ( $ key , $ object ) ; } else { throw new ContainerException ( 'An object instance must be pass...
Add a specific object instance to the container .
59,859
public function has ( $ key ) { return $ this -> storage -> hasObject ( $ key ) || $ this -> storage -> hasFactory ( $ key ) ; }
Check if a given key exists within this container either as an object or a factory .
59,860
public function get ( $ key ) { if ( ! \ is_string ( $ key ) || empty ( $ key ) ) { throw new ContainerException ( "$key must be a string" ) ; } if ( $ this -> storage -> hasStored ( $ key ) ) { return $ this -> storage -> getStored ( $ key ) ; } if ( $ this -> storage -> hasObject ( $ key ) ) { $ this -> storage -> st...
Retrieves an object for a given key .
59,861
private function addToStack ( $ value ) { $ keys = \ array_keys ( $ this -> stack ) ; $ this -> stack [ \ end ( $ keys ) ] [ ] = $ value ; }
Adds a value the resolutions stack .
59,862
private function resolveFromContainer ( string $ className ) { if ( $ this -> has ( $ className ) ) { $ this -> addToStack ( $ this -> get ( $ className ) ) ; return true ; } return false ; }
Searches for a class name in the container and adds to resolutions if found .
59,863
public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ config = $ serviceLocator -> get ( 'config' ) [ 'mongoObjectMapper' ] ; $ client = self :: constructMongoClient ( @ $ config [ 'uri' ] , @ $ config [ 'options' ] ) ; $ mapperClass = 'MongoObject\Mapper' ; if ( isset ( $ config [ 'mapperClass...
Create service - return new Mapper object
59,864
private static function constructMongoClient ( $ uri , $ options ) { if ( isset ( $ uri ) ) { if ( isset ( $ options ) ) { return new MongoClient ( $ uri , $ options ) ; } return new MongoClient ( $ uri ) ; } return new MongoClient ( ) ; }
Construct MongoClient object
59,865
public function load ( Repo $ repo ) { $ project = $ this -> client -> createProject ( $ this -> composerLoader -> getFile ( $ repo ) ) ; $ repo -> setDependencies ( $ project -> getDependencies ( ) ) ; return $ repo ; }
Load dependencies info
59,866
public function loadTranslationFileContent ( $ namespace , $ specificLocale ) { $ path = $ this -> buildPathFromNamespace ( $ namespace ) ; if ( $ path === false ) { return false ; } $ globalLocale = substr ( $ specificLocale , 0 , strpos ( $ specificLocale , '_' ) ) ; if ( $ globalLocale == '' ) { return false ; } $ s...
Returns the content of the translation file if a translation file was found . Otherwise returns false .
59,867
protected function buildPathFromNamespace ( $ namespace ) { $ namespace = Framework :: prepareNamespace ( $ namespace ) ; $ moduleManager = $ this -> framework -> getModuleManager ( ) ; $ module = $ moduleManager -> getModule ( $ namespace ) ; if ( $ module === false ) { return false ; } return $ module -> getDirectory...
Returns the directory for the given module namespace
59,868
public static function getOdDoTableData ( $ table , $ col = "name" , $ id , $ timestamp = null , $ id2 = "id2" , $ od = "od" , $ do = "do" ) { DB :: connect ( ) ; return DB :: $ connection -> getOdDoTableData ( $ table , $ col , $ id , $ timestamp , $ id2 , $ od , $ do ) ; }
Funkcia vracia tabulkovu hodnotu akcie
59,869
public static function insert ( $ table , $ data = array ( ) , $ config = array ( ) ) { DB :: connect ( ) ; return DB :: $ connection -> insert ( $ table , $ data , $ config ) ; }
Funkcia vlozi data do tab skontroluje ci struktura je spravna snazi sa ju modifikovat
59,870
public function add ( EntityInterface $ user ) { if ( ! is_a ( $ user , self :: ACCESS_ENTITY_TYPE ) ) { throw new Exception ( 'The given entity (' . get_class ( $ user ) . ') is not compatible with this data source (' . self :: class . '.' ) ; } if ( $ this -> accessControlManager -> hasAccessEntityForName ( self :: A...
Adds the given user to the access entities
59,871
public function update ( EntityInterface $ user ) { if ( ! is_a ( $ user , self :: ACCESS_ENTITY_TYPE ) ) { throw new Exception ( 'The given entity (' . get_class ( $ user ) . ') is not compatible with this data source (' . self :: class . '.' ) ; } if ( ! $ this -> accessControlManager -> hasAccessEntityForUuid ( self...
Updates the given user
59,872
public function delete ( EntityInterface $ user ) { if ( ! is_a ( $ user , self :: ACCESS_ENTITY_TYPE ) ) { throw new Exception ( 'The given entity (' . get_class ( $ user ) . ') is not compatible with this data source (' . self :: class . '.' ) ; } if ( ! $ this -> accessControlManager -> hasAccessEntityForUuid ( self...
Deletes the user with the given uuid
59,873
public function hasUserForUuid ( $ uuid ) { if ( $ this -> accessControlManager -> hasAccessEntityForUuid ( self :: ACCESS_ENTITY_TYPE , $ uuid ) ) { return true ; } return false ; }
Returns true if the given uuid exists as access entity
59,874
public function hasUserForUsername ( $ username ) { if ( $ this -> accessControlManager -> hasAccessEntityForName ( self :: ACCESS_ENTITY_TYPE , $ username ) ) { return true ; } return false ; }
Returns true if the given username exists as access entity
59,875
public function getUserForUsername ( $ username ) { if ( ! $ this -> accessControlManager -> hasAccessEntityForName ( self :: ACCESS_ENTITY_TYPE , $ username ) ) { return false ; } $ accessEntity = $ this -> accessControlManager -> getAccessEntityForName ( self :: ACCESS_ENTITY_TYPE , $ username ) ; if ( $ accessEntity...
Returns the user object for the given username
59,876
public static function createFromDateInterval ( \ DateInterval $ interval ) { if ( $ interval instanceof DateInterval ) return $ interval ; $ ret = new DateInterval ( $ interval -> format ( 'P%yY%mM%dDT%hH%iM%sS' ) ) ; $ ret -> invert = $ interval -> invert ; return $ ret ; }
Create a DateInterval from an PHP Dateinterval
59,877
protected function convertToDateTime ( $ time ) { if ( $ time instanceof DateTime ) { return clone $ time ; } else if ( $ time instanceof \ DateTime ) { return new DateTime ( $ time -> format ( \ DateTime :: ISO8601 ) ) ; } else if ( is_numeric ( $ time ) ) { return new DateTime ( '@' . $ time ) ; } return new DateTime...
Convert to date - time
59,878
public function setDisplayIcon ( $ displayIcon ) { if ( empty ( $ displayIcon ) ) { $ displayIcon = array ( ) ; } else if ( $ displayIcon instanceof Traversable ) { $ displayIcon = ArrayUtils :: iteratorToArray ( $ displayIcon ) ; } else if ( ! is_array ( $ displayIcon ) ) { $ displayIcon = ( array ) $ displayIcon ; } ...
Set display icon
59,879
public function setDisplayName ( $ displayName ) { if ( empty ( $ displayName ) ) { $ displayName = array ( ) ; } else if ( $ displayName instanceof Traversable ) { $ displayName = ArrayUtils :: iteratorToArray ( $ displayName ) ; } else if ( ! is_array ( $ displayName ) ) { $ displayName = ( array ) $ displayName ; } ...
Set display name
59,880
public function setDisplayDescription ( $ displayDescription ) { if ( empty ( $ displayDescription ) ) { $ displayDescription = array ( ) ; } else if ( $ displayDescription instanceof Traversable ) { $ displayDescription = ArrayUtils :: iteratorToArray ( $ displayDescription ) ; } else if ( ! is_array ( $ displayDescri...
Set display description
59,881
public function getDisplayedIcon ( $ maxSize = self :: DEFAULT_ICON_SIZE ) { if ( empty ( $ this -> displayIcon ) ) { return null ; } $ foundSize = 0 ; $ foundIcon = null ; foreach ( $ this -> displayIcon as $ size => $ icon ) { if ( $ size >= $ foundSize && $ size <= $ maxSize ) { $ foundSize = $ size ; $ foundIcon = ...
Get displayed icon
59,882
public function getDisplayedName ( $ locale = self :: FALLBACK_LOCALE ) { if ( ! empty ( $ this -> displayName [ $ locale ] ) ) { return $ this -> displayName [ $ locale ] ; } $ language = Locale :: getPrimaryLanguage ( $ locale ) ; if ( ! empty ( $ this -> displayName [ $ language ] ) ) { return $ this -> displayName ...
Get displayed name
59,883
public function getDisplayedDescription ( $ locale = self :: FALLBACK_LOCALE ) { if ( ! empty ( $ this -> displayDescription [ $ locale ] ) ) { return $ this -> displayDescription [ $ locale ] ; } $ language = Locale :: getPrimaryLanguage ( $ locale ) ; if ( ! empty ( $ this -> displayDescription [ $ language ] ) ) { r...
Get displayed description
59,884
public function getDisplayedAuthors ( $ locale = self :: FALLBACK_LOCALE ) { $ result = array ( ) ; $ mapper = $ this -> getMapper ( ) ; foreach ( $ this -> authors as $ author ) { if ( $ mapper && ! empty ( $ author [ 'email' ] ) && ( $ user = $ mapper -> getUserByEmail ( $ author [ 'email' ] ) ) ) { $ insert = array ...
Get displayed authors
59,885
public function getLicenseUris ( ) { $ result = array ( ) ; $ mapper = $ this -> getMapper ( ) ; $ licenseUrlPatterns = array ( '/^cc-(by-sa|by-nd|by-nc|by-nc-sa|by-nc-nd)-(\d+\.\d+)$/i' => function ( $ matches ) { return 'http://creativecommons.org/licenses/' . strtolower ( $ matches [ 1 ] ) . '/' . $ matches [ 2 ] ; ...
Get license uris
59,886
public function hasResource ( $ resource ) { if ( ! isset ( $ this -> resourcesCached [ $ resource ] ) ) { if ( isset ( $ this -> resources [ $ resource ] ) ) { $ this -> resourcesCached [ $ resource ] = $ this -> resources [ $ resource ] ; } else { $ found = false ; foreach ( $ this -> resources as $ resourceName ) { ...
Checking if this service handles given resource .
59,887
protected function getDefaultCommands ( ) { $ commands = parent :: getDefaultCommands ( ) ; foreach ( $ commands as $ command ) { if ( 'list' === $ command -> getName ( ) ) { if ( method_exists ( $ commands , 'setHidden' ) ) { $ command -> setHidden ( true ) ; } elseif ( method_exists ( $ command , 'setPrivate' ) ) { $...
Override the default commands to hide the list command by default .
59,888
private function camelize ( Dispatcher $ dispatcher , $ actionName ) { $ dispatcher -> setActionName ( lcfirst ( Text :: camelize ( $ actionName ) ) ) ; return $ this ; }
Camelize action name
59,889
public function addBadgePercentage ( $ percentage , $ toolTipLabel = null , $ url = null ) { $ percentage = min ( 100 , max ( 0 , floor ( $ percentage ) ) ) ; $ color = AVH :: getPercentageColor ( $ percentage ) ; return $ this -> addBadge ( $ percentage . '%' , $ color , $ toolTipLabel , $ url ) ; }
Automatic percentage display
59,890
public function addBadges ( array $ badges ) { foreach ( $ badges as $ badge ) { if ( ! is_array ( $ badge ) ) { throw new \ Osf \ Exception \ ArchException ( 'Bad badges value' ) ; } call_user_func_array ( [ $ this , 'addBadge' ] , $ badge ) ; } return $ this ; }
Add further badges
59,891
protected function getBadgeHtml ( $ label , $ colorOrStatus = null , $ toolTipLabel = null , $ url = null ) { $ element = 'span' ; if ( $ colorOrStatus === null ) { $ color = 'black' ; } else if ( in_array ( $ colorOrStatus , AVH :: STATUS_LIST ) ) { Checkers :: checkStatus ( $ colorOrStatus , 'default' ) ; $ color = A...
Build HTML code of a badge
59,892
protected function getBadgesHtml ( array $ badges = null ) { if ( $ badges === null ) { $ badges = $ this -> badges ; } $ html = '' ; foreach ( $ badges as $ badge ) { $ html .= $ this -> getBadgeHtml ( $ badge [ 0 ] , $ badge [ 1 ] , $ badge [ 2 ] , $ badge [ 3 ] ) ; } return $ html ; }
Build HTML code of badges
59,893
public function filter ( $ value ) { $ params = ( array ) $ this -> options [ 'callback_params' ] ; array_unshift ( $ params , $ value ) ; return call_user_func_array ( $ this -> options [ 'callback' ] , $ params ) ; }
Calls the filter per callback
59,894
public function getTab ( ) { $ this -> processMessage ( ) ; if ( $ this -> countAll === 0 && $ this -> hideEmpty ) { return ; } return '<span title="FileMailer"><svg><path style="fill:#' . ( $ this -> countNew > 0 ? 'E90D0D' : '348AD2' ) . '" d="m 0.9 4.5 6.6 7 c 0 0 0 0 0 0 0.2 0.1 0.3 0.2 0.4 0.2 0.1 0 0.3 -0 0.4 -0....
Returns HTML code for Tracy bar icon .
59,895
public function getPanel ( ) { if ( $ this -> countAll === 0 && $ this -> hideEmpty ) { return ; } $ this -> processMessage ( ) ; $ latte = new \ Latte \ Engine ; $ latte -> setTempDirectory ( $ this -> fileMailer -> getTempDirectory ( ) ) ; return $ latte -> renderToString ( __DIR__ . '/MailPanel.latte' , [ 'messages'...
Returns HTML code of panel .
59,896
private function processMessage ( ) { if ( $ this -> processed ) { return ; } $ this -> processed = TRUE ; $ files = glob ( $ this -> fileMailer -> getTempDirectory ( ) . DIRECTORY_SEPARATOR . '*.' . FileMailer :: FILE_EXTENSION ) ; foreach ( $ files as $ path ) { $ cacheKey = basename ( $ path ) ; if ( $ this -> remov...
Process all messages .
59,897
private function removeExpired ( $ path ) { if ( $ this -> autoremove ) { $ now = new DateTime ; $ file_date = new DateTime ( '@' . filemtime ( $ path ) ) ; $ file_date -> setTimezone ( $ now -> getTimezone ( ) ) ; $ remove_date = $ now -> modify ( $ this -> autoremove ) ; if ( $ file_date < $ remove_date ) { unlink ( ...
Auto removes email file when expired .
59,898
public function handleDownload ( $ filename , $ filehash ) { $ message = $ this -> cache -> load ( $ filename ) ; $ file = $ message -> attachments [ $ filehash ] ; header ( "Content-Type: $file->type; charset='UTF-8'" ) ; header ( "Content-Transfer-Encoding: base64" ) ; header ( "Content-Disposition: attachment; filen...
Download attachment from file .
59,899
protected function getConnectedUserMediaPerimeter ( $ siteId ) { $ user = $ this -> get ( 'security.token_storage' ) -> getToken ( ) -> getUser ( ) ; if ( $ user -> hasRole ( ContributionRoleInterface :: PLATFORM_ADMIN ) || $ user -> hasRole ( ContributionRoleInterface :: DEVELOPER ) ) { return null ; } $ userGroups = ...
Return folder ids included in the allowed perimeter to the user for media contribution