idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
49,400
private function buildArray ( array $ fieldProperties = [ ] ) { $ baseProperties = [ ] ; if ( $ this -> type !== self :: TYPE_OBJECT ) { $ baseProperties [ 'type' ] = $ this -> type ; } else { $ baseProperties [ 'properties' ] = [ ] ; } if ( ! $ this -> indexed ) { $ baseProperties [ 'index' ] = 'no' ; } elseif ( $ thi...
Helper function to append custom field properties to generic properties array
49,401
public function resetAdminRights ( $ users ) { foreach ( $ this -> makeTraversable ( $ users ) as $ user ) { $ this -> doResetAdminRights ( $ user ) ; } }
Resets rights for users .
49,402
private function doResetAdminRights ( User $ user ) { $ acl = $ this -> ACLProvider -> get ( $ user ) ; $ databoxes = $ this -> appbox -> get_databoxes ( ) ; $ acl -> give_access_to_sbas ( array_map ( function ( \ databox $ databox ) { return $ databox -> get_sbas_id ( ) ; } , $ databoxes ) ) ; foreach ( $ databoxes as...
Resets rights for a user .
49,403
private function doResetAdminRightsOnDatabox ( \ ACL $ acl , \ databox $ databox ) { $ collections = $ databox -> get_collections ( ) ; $ acl -> update_rights_to_sbas ( $ databox -> get_sbas_id ( ) , [ \ ACL :: BAS_MANAGE => true , \ ACL :: BAS_MODIFY_STRUCT => true , \ ACL :: BAS_MODIF_TH => true , \ ACL :: BAS_CHUPUB...
Resets admin rights on a databox .
49,404
private function doResetRightsOnCollection ( \ ACL $ acl , \ collection $ collection ) { $ baseId = $ collection -> get_base_id ( ) ; $ acl -> set_limits ( $ baseId , false ) ; $ acl -> remove_quotas_on_base ( $ baseId ) ; $ acl -> set_masks_on_base ( $ baseId , '0' , '0' , '0' , '0' ) ; $ acl -> update_rights_to_base ...
Resets admin rights on a collection .
49,405
public function getUserSetting ( User $ user , $ name , $ default = null ) { if ( false === $ user -> getSettings ( ) -> containsKey ( $ name ) ) { $ this -> loadusersSettings ( ) ; return array_key_exists ( $ name , $ this -> usersSettings ) ? $ this -> usersSettings [ $ name ] : $ default ; } return $ user -> getSett...
Return a user setting given a user .
49,406
public function getUserNotificationSetting ( User $ user , $ name , $ default = true ) { if ( false === $ user -> getNotificationSettings ( ) -> containsKey ( $ name ) ) { return $ default ; } return $ user -> getNotificationSettings ( ) -> get ( $ name ) -> getValue ( ) ; }
Return a user notification setting given a user .
49,407
public function getApplicationSetting ( $ props , $ default = null ) { return $ this -> conf -> get ( array_merge ( [ 'registry' ] , is_array ( $ props ) ? $ props : [ $ props ] ) , $ default ) ; }
Returns application setting value .
49,408
private function loadUsersSettings ( ) { if ( null !== $ this -> usersSettings ) { return ; } $ this -> usersSettings = array_replace ( self :: $ defaultUserSettings , array_intersect_key ( $ this -> conf -> get ( [ 'user-settings' ] , [ ] ) , self :: $ defaultUserSettings ) ) ; }
Merge default user settings and configuration customisation .
49,409
public function last_model_is ( $ login = null ) { $ this -> last_model = $ login instanceof User ? $ login -> getId ( ) : $ login ; return $ this ; }
Restrict user with the provided last model
49,410
public function get_total ( ) { if ( $ this -> total ) { return $ this -> total ; } $ conn = $ this -> app -> getApplicationBox ( ) -> get_connection ( ) ; $ sql_count = 'SELECT COUNT(DISTINCT Users.id) as total ' . $ this -> generate_sql_constraints ( ) ; $ stmt = $ conn -> prepare ( $ sql_count ) ; $ stmt -> execute ...
Get total of fetched users
49,411
public function on_bases_where_i_am ( ACL $ ACL , Array $ rights ) { $ this -> bases_restrictions = true ; $ collections = array_keys ( $ ACL -> get_granted_base ( $ rights ) ) ; if ( count ( $ this -> base_ids ) > 0 ) { $ this -> base_ids = array_intersect ( $ this -> base_ids , $ collections ) ; } else { $ this -> ba...
Restrict users on collection with provided rights
49,412
public function on_sbas_where_i_am ( ACL $ ACL , Array $ rights ) { $ this -> sbas_restrictions = true ; $ databoxes = array_keys ( $ ACL -> get_granted_sbas ( $ rights ) ) ; if ( count ( $ this -> sbas_ids ) > 0 ) $ this -> sbas_ids = array_intersect ( $ this -> sbas_ids , $ databoxes ) ; else $ this -> sbas_ids = $ d...
Restrict users on database with provided rights
49,413
public function limit ( $ offset_start , $ results_quantity ) { $ this -> offset_start = ( int ) $ offset_start ; $ this -> results_quantity = ( int ) $ results_quantity ; return $ this ; }
Restrict to provided limits
49,414
public function like ( $ like_field , $ like_value ) { $ this -> like_field [ trim ( $ like_field ) ] = trim ( $ like_value ) ; $ this -> total = $ this -> page = $ this -> total_page = null ; return $ this ; }
Restrict on provided field with provided value
49,415
public function like_match ( $ like_match ) { switch ( $ like_match ) { case self :: LIKE_MATCH_AND : case self :: LIKE_MATCH_OR : $ this -> like_match = $ like_match ; break ; default : break ; } $ this -> total = $ this -> page = $ this -> total_page = null ; return $ this ; }
Restrict on match
49,416
public function on_base_ids ( array $ base_ids = null ) { if ( ! $ base_ids ) { return $ this ; } $ this -> bases_restrictions = true ; $ this -> include_phantoms ( false ) ; if ( count ( $ this -> base_ids ) > 0 ) { $ this -> base_ids = array_intersect ( $ this -> base_ids , $ base_ids ) ; } else { $ this -> base_ids ...
Restrict on collections
49,417
public function on_sbas_ids ( Array $ sbas_ids = null ) { if ( ! $ sbas_ids ) { return $ this ; } $ this -> sbas_restrictions = true ; $ this -> include_phantoms ( false ) ; if ( count ( $ this -> sbas_ids ) > 0 ) { $ this -> sbas_ids = array_intersect ( $ this -> sbas_ids , $ sbas_ids ) ; } else { $ this -> sbas_ids =...
Restrict on databoxes
49,418
public function haveActivities ( array $ req_activities ) { $ activities = new ArrayCollection ( ) ; foreach ( $ req_activities as $ activity ) { if ( $ activity = trim ( $ activity ) === '' ) { continue ; } if ( $ activities -> contains ( $ activity ) ) { continue ; } $ activities -> add ( $ activity ) ; } if ( ! $ ac...
Restrict users with provided activities
49,419
public function havePositions ( array $ req_positions ) { $ positions = new ArrayCollection ( ) ; foreach ( $ req_positions as $ position ) { if ( $ position = trim ( $ position ) === '' ) { continue ; } if ( $ positions -> contains ( $ position ) ) { continue ; } $ positions -> add ( $ position ) ; } if ( ! $ position...
Restrict users with provided jobs
49,420
public function inCountries ( array $ req_countries ) { $ countries = new ArrayCollection ( ) ; foreach ( $ req_countries as $ country ) { if ( $ country = trim ( $ country ) === '' ) { continue ; } if ( $ countries -> contains ( $ country ) ) { continue ; } $ countries -> add ( $ country ) ; } if ( ! $ countries -> is...
Restrict users by countries
49,421
public function inCompanies ( array $ req_companies ) { $ companies = new ArrayCollection ( ) ; foreach ( $ req_companies as $ company ) { if ( $ company = trim ( $ company ) === '' ) { continue ; } if ( $ companies -> contains ( $ company ) ) { continue ; } $ companies -> add ( $ company ) ; } if ( ! $ companies -> is...
Restrict users by companies
49,422
public function haveTemplate ( array $ req_templates ) { $ templates = new ArrayCollection ( ) ; foreach ( $ req_templates as $ template ) { if ( $ template = trim ( $ template ) === '' ) { continue ; } if ( $ templates -> contains ( $ template ) ) { continue ; } $ templates -> add ( $ template ) ; } if ( ! $ templates...
Restrict users with given templates
49,423
public function getRelatedCountries ( ) { $ conn = $ this -> app -> getApplicationBox ( ) -> get_connection ( ) ; $ sql = 'SELECT DISTINCT Users.country ' . $ this -> generate_sql_constraints ( ) . ' ORDER BY Users.country' ; $ stmt = $ conn -> prepare ( $ sql ) ; $ stmt -> execute ( $ this -> sql_params ) ; $ rs = $ s...
Get user countries
49,424
public function getRelatedCompanies ( ) { $ conn = $ this -> app -> getApplicationBox ( ) -> get_connection ( ) ; $ sql = 'SELECT DISTINCT Users.company ' . $ this -> generate_sql_constraints ( ) . ' ORDER BY Users.company' ; $ stmt = $ conn -> prepare ( $ sql ) ; $ stmt -> execute ( $ this -> sql_params ) ; $ rs = $ s...
Get users companies
49,425
public static function getInstance ( Application $ app , $ sbasid , $ sbas_coll , $ dmin , $ dmax ) { $ cache_id = 'feed_' . md5 ( $ sbasid . '_' . $ sbas_coll . '_' . $ dmin . '_' . $ dmax ) ; try { $ result = $ app -> getApplicationBox ( ) -> get_data_from_cache ( $ cache_id ) ; $ result -> setApplication ( $ app ) ;...
Returns l objet stockee dans le cache si i l existe sinon instancie un nouveau objet dashboard_feed
49,426
public function findAdmins ( ) { $ qb = $ this -> createQueryBuilder ( 'u' ) ; $ qb -> where ( $ qb -> expr ( ) -> eq ( 'u.admin' , $ qb -> expr ( ) -> literal ( true ) ) ) -> andWhere ( $ qb -> expr ( ) -> isNull ( 'u.templateOwner' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'u.deleted' , $ qb -> expr ( ) -> literal (...
Finds admins .
49,427
private function getGrpSettings ( $ file , $ tmaskgrp ) { $ matched = false ; foreach ( $ tmaskgrp as $ maskgrp ) { $ preg_maskgrp = "/" . $ maskgrp [ "mask" ] . "/" ; if ( preg_match ( $ preg_maskgrp , $ file ) ) { $ matched = $ maskgrp ; } if ( $ matched ) { break ; } } return $ matched ; }
Return the story settings
49,428
protected function getLazaretSession ( Application $ app ) { $ lazaretSession = new LazaretSession ( ) ; $ app [ 'orm.em' ] -> persist ( $ lazaretSession ) ; $ app [ 'orm.em' ] -> flush ( ) ; return $ lazaretSession ; }
Return a LazaretSession
49,429
protected function parseStatusBit ( $ sxcaption ) { if ( ! $ sxcaption instanceof \ SimpleXMLElement ) { return null ; } if ( '' !== $ inStatus = ( string ) $ sxcaption -> status ) { return $ inStatus ; } return null ; }
Parse a Phrasea XML to find status tag
49,430
public function process ( LazaretSession $ session , File $ file , $ callable = null , $ forceBehavior = null , $ nosubdef = false ) { $ visa = $ this -> getVisa ( $ file ) ; $ file -> getUUID ( true , false ) ; if ( ( $ visa -> isValid ( ) || $ forceBehavior === self :: FORCE_RECORD ) && $ forceBehavior !== self :: FO...
Add a file to Phraseanet after having checked it
49,431
public function getVisa ( File $ file ) { $ visa = new Visa ( ) ; if ( ! $ this -> isEnabled ( ) ) { return $ visa ; } foreach ( $ this -> checkers as $ checker ) { if ( $ checker -> isApplicable ( $ file ) ) { $ visa -> addResponse ( $ checker -> check ( $ this -> app [ 'orm.em' ] , $ file ) ) ; } } return $ visa ; }
Check a File package object against the Checkers and returns a Visa
49,432
public function registerChecker ( CheckerInterface $ checker ) { if ( ! $ this -> hasChecker ( $ checker ) ) { $ this -> checkers [ ] = $ checker ; } return $ this ; }
Registers a checker
49,433
public function unregisterChecker ( CheckerInterface $ checker ) { if ( false === $ this -> hasChecker ( $ checker ) ) { throw new \ LogicException ( 'Trying to unregister unregistered checker' ) ; } foreach ( $ this -> checkers as $ key => $ registeredChecker ) { if ( $ checker === $ registeredChecker ) { unset ( $ th...
Unregister a checker
49,434
public function getCheckerFromFQCN ( $ checkerName ) { $ checkerName = trim ( $ checkerName , '\\' ) ; if ( ! class_exists ( $ checkerName ) ) { throw new \ RuntimeException ( 'Checker FQCN does not exists' ) ; } foreach ( $ this -> checkers as $ checker ) { if ( $ checker instanceof $ checkerName ) { return $ checker ...
Get checker instance from its class name .
49,435
protected function createRecord ( File $ file , $ nosubdef = false ) { $ element = \ record_adapter :: createFromFile ( $ file , $ this -> app ) ; $ date = new \ DateTime ( ) ; $ file -> addAttribute ( new MetadataAttr ( new Metadata ( new TfArchivedate ( ) , new MonoValue ( $ date -> format ( 'Y/m/d H:i:s' ) ) ) ) ) ;...
Adds a record to Phraseanet
49,436
protected function createLazaret ( File $ file , Visa $ visa , LazaretSession $ session , $ forced ) { $ date = new \ DateTime ( ) ; $ file -> addAttribute ( new MetadataAttr ( new Metadata ( new TfQuarantine ( ) , new MonoValue ( $ date -> format ( 'Y/m/d H:i:s' ) ) ) ) ) ; $ lazaretFilesystemService = $ this -> app [...
Send a package file to lazaret
49,437
protected function addMediaAttributes ( File $ file ) { $ metadataCollection = $ this -> app [ 'phraseanet.metadata-reader' ] -> read ( $ file -> getMedia ( ) ) ; array_walk ( $ metadataCollection , function ( Metadata $ metadata ) use ( $ file ) { $ file -> addAttribute ( new MetadataAttr ( $ metadata ) ) ; } ) ; retu...
Add technical Metadata attribute to a package file by reference to add it to Phraseanet
49,438
public function create ( PropertyAccess $ conf ) { $ type = $ conf -> get ( [ 'main' , 'session' , 'type' ] , 'file' ) ; $ options = $ conf -> get ( [ 'main' , 'session' , 'options' ] , [ ] ) ; $ serverOpts = [ 'expiretime' => $ conf -> get ( [ 'main' , 'session' , 'ttl' ] , 86400 ) , 'prefix' => $ conf -> get ( [ 'mai...
Creates a SessionHandlerInterface given a conf .
49,439
public function setHost ( $ host ) { $ this -> host = trim ( strtolower ( $ host ) ) ; if ( '' === $ this -> host ) { $ this -> merge ( ) ; return ; } if ( ! isset ( $ this -> cache [ 'hosts-configuration' ] ) ) { $ this -> merge ( ) ; return ; } foreach ( $ this -> cache [ 'hosts-configuration' ] as $ hostConf ) { if ...
Sets the host name to switch on .
49,440
public function getManager ( $ throwException = false ) { $ data = $ this -> query ( $ throwException ) ; return [ 'configuration' => $ this -> status -> getStatus ( ) , 'actual' => isset ( $ data [ 'manager' ] ) ? TaskManagerStatus :: STATUS_STARTED : TaskManagerStatus :: STATUS_STOPPED , 'process-id' => isset ( $ dat...
Returns live informations about the task manager .
49,441
public function getTask ( liveTask $ task , $ throwException = false ) { $ data = $ this -> query ( $ throwException ) ; return $ this -> formatTask ( $ task , $ data ) ; }
Returns live informations about the given task .
49,442
public function getTasks ( $ tasks , $ throwException = false ) { $ data = $ this -> query ( $ throwException ) ; $ ret = [ ] ; foreach ( $ tasks as $ task ) { $ ret [ $ task -> getId ( ) ] = $ this -> formatTask ( $ task , $ data ) ; } return $ ret ; }
Returns live informations about some tasks .
49,443
public static function getFileAttribute ( Application $ app , $ name , $ serialized ) { switch ( $ name ) { case AttributeInterface :: NAME_METADATA : return Metadata :: loadFromString ( $ app , $ serialized ) ; case AttributeInterface :: NAME_STORY : return Story :: loadFromString ( $ app , $ serialized ) ; case Attri...
Build a file package Attribute
49,444
public function writeMediaSourceFile ( \ databox $ databox , $ source , $ filename ) { $ realPath = $ this -> generateDataboxDocumentBasePath ( $ databox ) . $ filename ; $ this -> filesystem -> copy ( $ source , $ realPath , true ) ; $ this -> filesystem -> chmod ( $ realPath , 0760 ) ; return $ realPath ; }
Write Media source file with given filename
49,445
private function getExtensionFromSpec ( SpecificationInterface $ spec ) { switch ( $ spec -> getType ( ) ) { case SpecificationInterface :: TYPE_IMAGE : return $ this -> getExtensionFromImageCodec ( $ spec -> getImageCodec ( ) ) ; case SpecificationInterface :: TYPE_ANIMATION : return 'gif' ; case SpecificationInterfac...
Get the extension from MediaAlchemyst specs
49,446
public function isPublisher ( User $ user ) { if ( $ this -> publisher ) { if ( $ this -> publisher -> getUser ( ) -> getId ( ) === $ user -> getId ( ) ) { return true ; } } return false ; }
Returns a boolean indicating whether the given User is the publisher of the entry .
49,447
public function getItem ( $ id ) { foreach ( $ this -> items as $ item ) { if ( $ item -> getId ( ) == $ id ) { return ( $ item ) ; } } return null ; }
Returns the item from a given id .
49,448
public function convert ( $ string , $ target ) { $ ok_methods = [ self :: CONVERT_TO_LC , self :: CONVERT_TO_ND , self :: CONVERT_TO_LCND ] ; if ( ! in_array ( $ target , $ ok_methods ) ) { throw new Exception_InvalidArgument ( sprintf ( 'Invalid argument 2 "%s", valid values are [%s].' , $ target , implode ( '|' , $ ...
Converts a string
49,449
public function toUTF8 ( $ string ) { static $ macchars = "\x81\x82\x83\x84\x86\x87\x88\x89\x8A\x8B\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9D\x9E\x9F\xBC\xBD\xBE" ; if ( mb_convert_encoding ( mb_convert_encoding ( $ string , 'UTF-32' , 'UTF-8' ) , 'UTF-8' , 'UTF-32' ) == $ string ) { $ mac = mb_co...
Guess the charset of a string and returns the UTF - 8 version
49,450
public function parseDate ( $ date ) { $ date = str_replace ( [ '-' , ':' , '/' , '.' ] , ' ' , $ date ) ; $ date_yyyy = $ date_mm = $ date_dd = $ date_hh = $ date_ii = $ date_ss = 0 ; switch ( sscanf ( $ date , '%d %d %d %d %d %d' , $ date_yyyy , $ date_mm , $ date_dd , $ date_hh , $ date_ii , $ date_ss ) ) { case 1 :...
Parse a string and try to return the date normalized
49,451
public function get ( User $ user ) { if ( null !== $ acl = $ this -> fetchFromCache ( $ user ) ) { return $ acl ; } return $ this -> fetch ( $ user ) ; }
Gets ACL for user .
49,452
private function fetchFromCache ( User $ user ) { return $ this -> hasCache ( $ user ) ? self :: $ cache [ $ user -> getId ( ) ] : null ; }
Fetchs ACL from cache for users .
49,453
private function fetch ( User $ user ) { return self :: $ cache [ $ user -> getId ( ) ] = new \ ACL ( $ user , $ this -> app ) ; }
Saves user s ACL in cache and returns it .
49,454
public function getParticipant ( User $ user ) { foreach ( $ this -> getParticipants ( ) as $ participant ) { if ( $ participant -> getUser ( ) -> getId ( ) == $ user -> getId ( ) ) { return $ participant ; } } throw new NotFoundHttpException ( 'Participant not found' . $ user -> getEmail ( ) ) ; }
Get a participant
49,455
public function setup ( $ target ) { $ installer = tempnam ( sys_get_temp_dir ( ) , 'install' ) ; $ handle = fopen ( $ installer , 'w+' ) ; $ request = $ this -> guzzle -> get ( 'https://getcomposer.org/installer' , null , $ handle ) ; try { $ response = $ request -> send ( ) ; fclose ( $ handle ) ; } catch ( GuzzleExc...
Downloads composer installer and setups it to the given target .
49,456
public static function merge ( TextNode $ a , TextNode $ b ) { return new self ( sprintf ( '%s%s' , $ a -> getValue ( ) , $ b -> getValue ( ) ) ) ; }
Merge two text nodes by concatenating their content .
49,457
public function isRecordInPublicFeed ( $ sbas_id , $ record_id ) { $ dql = 'SELECT COUNT(i) FROM Phraseanet:FeedItem i JOIN i.entry e JOIN e.feed f WHERE i.sbasId = :sbas_id AND i.recordId = :record_id AND f.public = true' ; $ query = $ this -> _...
Checks if a record is published in a public feed .
49,458
public function sqlBuilder ( $ domain ) { switch ( $ domain ) { case 'connexion' : return new module_report_sqlconnexion ( $ this -> app , $ this ) ; break ; case 'download' : return new module_report_sqldownload ( $ this -> app , $ this ) ; break ; case 'question' : return new module_report_sqlquestion ( $ this -> app...
Retourne un objet qui genere la requete selon le type de report
49,459
private function setCor ( ) { return [ 'user' => $ this -> app -> trans ( 'report:: utilisateur' ) , 'coll_id' => $ this -> app -> trans ( 'report:: collections' ) , 'connexion' => $ this -> app -> trans ( 'report:: Connexion' ) , 'comment' => $ this -> app -> trans ( 'report:: commentaire' ) , 'search' => $ this -> ap...
etablis les correspondance entre gettext et le nom des columns du report
49,460
private function setDay ( ) { return [ 1 => $ this -> app -> trans ( 'phraseanet::jours:: lundi' ) , 2 => $ this -> app -> trans ( 'phraseanet::jours:: mardi' ) , 3 => $ this -> app -> trans ( 'phraseanet::jours:: mercredi' ) , 4 => $ this -> app -> trans ( 'phraseanet::jours:: jeudi' ) , 5 => $ this -> app -> trans ( ...
etablis les correspondance entre gettext et le nom des jours du report
49,461
private function setMonth ( ) { return [ $ this -> app -> trans ( 'janvier' ) , $ this -> app -> trans ( 'fevrier' ) , $ this -> app -> trans ( 'mars' ) , $ this -> app -> trans ( 'avril' ) , $ this -> app -> trans ( 'mai' ) , $ this -> app -> trans ( 'juin' ) , $ this -> app -> trans ( 'juillet' ) , $ this -> app -> t...
etablis les correspondance entre gettext et le nom des mois du report
49,462
protected function calculatePages ( ) { if ( $ this -> nb_record && $ this -> total > $ this -> nb_record ) { $ this -> previous_page = $ this -> nb_page - 1 ; if ( $ this -> previous_page == 0 ) $ this -> previous_page = false ; $ test = ( $ this -> total / $ this -> nb_record ) ; if ( $ this -> nb_page == intval ( ce...
effectue le mechanism de pagination
49,463
public function buildReport ( $ tab = false , $ groupby = false , $ on = false ) { if ( sizeof ( $ this -> report ) > 0 ) { return $ this -> report ; } $ databox = $ this -> app -> findDataboxById ( $ this -> sbas_id ) ; $ conn = $ databox -> get_connection ( ) ; $ this -> buildReq ( $ groupby , $ on ) ; try { try { $ ...
Build the final formated array which contains all the result we construct the html code from this array
49,464
public function createForm ( PropertyAccess $ conf = null ) { $ form = $ this -> factory -> create ( new MainConfigurationFormType ( $ this -> translator , $ this -> languages ) ) ; $ currentConf = $ conf ? ( $ conf -> get ( 'registry' ) ? : [ ] ) : [ ] ; $ data = array_replace_recursive ( $ this -> getDefaultData ( $ ...
Creates a setup form . Set data if a configuration is given .
49,465
public function getRegistryData ( FormInterface $ form = null , PropertyAccess $ conf = null ) { $ data = [ ] ; if ( null !== $ form ) { if ( ! $ form -> isSubmitted ( ) ) { throw new RuntimeException ( 'Form must have been submitted' ) ; } $ newData = $ form -> getData ( ) ; $ data = $ this -> filterNullValues ( $ new...
Gets the registry data given a submitted form . Default configuration is returned if no form provided .
49,466
public function render ( array $ data , ContextInterface $ context ) { $ data = $ this -> applyButtonClasses ( $ data ) ; return parent :: render ( $ data , $ context ) ; }
Renders a button .
49,467
public function numbers ( array $ options = [ ] ) { $ class = 'pagination' ; $ options += [ 'class' => $ class , 'after' => '</ul>' , 'size' => null , ] ; $ options [ 'class' ] = implode ( ' ' , ( array ) $ options [ 'class' ] ) ; if ( ! empty ( $ options [ 'size' ] ) ) { $ options [ 'class' ] .= " {$class}-{$options['...
Returns a set of numbers for the paged result set .
49,468
public function applyButtonClasses ( array $ data ) { if ( $ this -> hasAnyClass ( $ this -> buttonClasses , $ data ) ) { $ data = $ this -> injectClasses ( [ 'btn' ] , $ data ) ; } else { $ data = $ this -> injectClasses ( [ 'btn' , 'btn-default' ] , $ data ) ; } return $ this -> renameClasses ( $ this -> buttonClassA...
Contains the logic for applying style classes for buttons .
49,469
public function renameClasses ( array $ classMap , array $ options ) { $ options += [ 'class' => [ ] ] ; $ options [ 'class' ] = $ this -> _toClassArray ( $ options [ 'class' ] ) ; $ classes = [ ] ; foreach ( $ options [ 'class' ] as $ name ) { $ classes [ ] = array_key_exists ( $ name , $ classMap ) ? $ classMap [ $ n...
Renames any CSS classes found in the options .
49,470
public function create ( $ model = null , array $ options = [ ] ) { if ( isset ( $ options [ 'horizontal' ] ) ) { if ( $ options [ 'horizontal' ] === true ) { $ options [ 'horizontal' ] = 'horizontal' ; } $ options [ 'align' ] = $ options [ 'horizontal' ] ; unset ( $ options [ 'horizontal' ] ) ; trigger_error ( 'The `h...
Returns an HTML FORM element .
49,471
public function submit ( $ caption = null , array $ options = [ ] ) { $ options = $ this -> applyButtonClasses ( $ options ) ; return parent :: submit ( $ caption , $ options ) ; }
Creates a submit button element .
49,472
public function staticControl ( $ fieldName , array $ options = [ ] ) { $ options += [ 'escape' => true , 'required' => false , 'secure' => true , 'hiddenField' => true ] ; $ secure = $ options [ 'secure' ] ; $ hiddenField = $ options [ 'hiddenField' ] ; unset ( $ options [ 'secure' ] , $ options [ 'hiddenField' ] ) ; ...
Used to place plain text next to label within a form .
49,473
protected function _detectFormAlignment ( $ options ) { foreach ( [ 'horizontal' , 'inline' ] as $ align ) { if ( $ this -> checkClasses ( 'form-' . $ align , $ options ) ) { return $ align ; } } return $ this -> getConfig ( 'align' ) ; }
Detects the form alignment when possible .
49,474
protected function _withInputGroup ( array $ data , ContextInterface $ context ) { $ data += [ 'prepend' => null , 'append' => null , ] ; if ( ! isset ( $ data [ 'type' ] ) || $ data [ 'type' ] !== 'hidden' ) { $ data = $ this -> injectClasses ( 'form-control' , $ data ) ; } $ prepend = $ data [ 'prepend' ] ; $ append ...
Render a widget with input group wrapper if requried .
49,475
protected function _addon ( $ addon , $ data ) { if ( is_string ( $ addon ) ) { $ class = 'input-group-' . ( $ this -> _isButton ( $ addon ) ? 'btn' : 'addon' ) ; $ addon = $ this -> _templates -> format ( 'inputGroupAddon' , [ 'class' => $ class , 'content' => $ addon , 'templateVars' => $ data [ 'templateVars' ] , ] ...
Get addon HTML .
49,476
public function parseAddressList ( $ address = null , $ default_domain = null , $ nest_groups = null , $ validate = null , $ limit = null ) { if ( ! isset ( $ this ) || ! isset ( $ this -> mailRFC822 ) ) { $ obj = new Mail_RFC822 ( $ address , $ default_domain , $ nest_groups , $ validate , $ limit ) ; return $ obj -> ...
Starts the whole process . The address must either be set here or when creating the object . One or the other .
49,477
protected function _splitAddresses ( $ address ) { if ( ! empty ( $ this -> limit ) && count ( $ this -> addresses ) == $ this -> limit ) { return '' ; } if ( $ this -> _isGroup ( $ address ) && ! isset ( $ this -> error ) ) { $ split_char = ';' ; $ is_group = true ; } elseif ( ! isset ( $ this -> error ) ) { $ split_c...
Splits an address into separate addresses .
49,478
protected function _isGroup ( $ address ) { $ parts = explode ( ',' , $ address ) ; $ string = $ this -> _splitCheck ( $ parts , ',' ) ; if ( count ( $ parts = explode ( ':' , $ string ) ) > 1 ) { $ string2 = $ this -> _splitCheck ( $ parts , ':' ) ; return ( $ string2 !== $ string ) ; } else { return false ; } }
Checks for a group at the start of the string .
49,479
protected function _splitCheck ( $ parts , $ char ) { $ string = $ parts [ 0 ] ; for ( $ i = 0 ; $ i < count ( $ parts ) ; $ i ++ ) { if ( $ this -> _hasUnclosedQuotes ( $ string ) || $ this -> _hasUnclosedBrackets ( $ string , '<>' ) || $ this -> _hasUnclosedBrackets ( $ string , '[]' ) || $ this -> _hasUnclosedBracke...
A common function that will check an exploded string .
49,480
protected function _hasUnclosedQuotes ( $ string ) { $ string = trim ( $ string ) ; $ iMax = strlen ( $ string ) ; $ in_quote = false ; $ i = $ slashes = 0 ; for ( ; $ i < $ iMax ; ++ $ i ) { switch ( $ string [ $ i ] ) { case '\\' : ++ $ slashes ; break ; case '"' : if ( $ slashes % 2 == 0 ) { $ in_quote = ! $ in_quot...
Checks if a string has unclosed quotes or not .
49,481
protected function _validateAddress ( $ address ) { $ is_group = false ; $ addresses = array ( ) ; if ( $ address [ 'group' ] ) { $ is_group = true ; $ parts = explode ( ':' , $ address [ 'address' ] ) ; $ groupname = $ this -> _splitCheck ( $ parts , ':' ) ; $ structure = array ( ) ; if ( ! $ this -> _validatePhrase (...
Function to begin checking the address .
49,482
protected function _validatePhrase ( $ phrase ) { $ parts = preg_split ( '/[ \\x09]+/' , $ phrase , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ phrase_parts = array ( ) ; while ( count ( $ parts ) > 0 ) { $ phrase_parts [ ] = $ this -> _splitCheck ( $ parts , ' ' ) ; for ( $ i = 0 ; $ i < $ this -> index + 1 ; $ i ++ ) array_shift...
Function to validate a phrase .
49,483
protected function _validateDomain ( $ domain ) { $ subdomains = explode ( '.' , $ domain ) ; while ( count ( $ subdomains ) > 0 ) { $ sub_domains [ ] = $ this -> _splitCheck ( $ subdomains , '.' ) ; for ( $ i = 0 ; $ i < $ this -> index + 1 ; $ i ++ ) array_shift ( $ subdomains ) ; } foreach ( $ sub_domains as $ sub_d...
Function to validate a domain though this is not quite what you expect of a strict internet domain .
49,484
protected function _validateAddrSpec ( $ addr_spec ) { $ addr_spec = trim ( $ addr_spec ) ; if ( strpos ( $ addr_spec , '@' ) !== false ) { $ parts = explode ( '@' , $ addr_spec ) ; $ local_part = $ this -> _splitCheck ( $ parts , '@' ) ; $ domain = substr ( $ addr_spec , strlen ( $ local_part . '@' ) ) ; } else { $ lo...
Function to validate an addr - spec .
49,485
function _getMx ( $ host ) { $ mx = array ( ) ; if ( $ this -> withNetDns ) { $ res = $ this -> _loadNetDns ( ) ; if ( is_a ( $ res , 'PEAR_Error' ) ) { return $ res ; } $ response = $ this -> resolver -> query ( $ host , 'MX' ) ; if ( ! $ response ) { return false ; } foreach ( $ response -> answer as $ rr ) { if ( $ ...
Recieve mx rexords for a spciefied host
49,486
function _raiseError ( $ id , $ info = array ( ) ) { $ code = $ this -> errorCode [ $ id ] [ 'code' ] ; $ msg = $ this -> errorCode [ $ id ] [ 'msg' ] ; if ( ! empty ( $ info ) ) { $ search = array ( ) ; $ replace = array ( ) ; foreach ( $ info as $ key => $ value ) { array_push ( $ search , '{' . strtoupper ( $ key ) ...
raise standardized error
49,487
protected function compile ( $ config , $ prefix = '' ) { $ code = '' ; foreach ( $ config as $ key => $ value ) { if ( is_array ( $ value ) ) { $ code .= $ this -> compile ( $ value , $ prefix . $ key . $ this -> sectionSeparator ) ; } else { $ fullName = $ prefix . $ key ; if ( ! preg_match ( '/^[a-zA-Z_\x7f-\xff][a-...
Recursively compile an associative array to PHP code .
49,488
public function get ( $ args , $ assoc_args ) { list ( $ key ) = $ args ; $ func = Utils \ get_flag_value ( $ assoc_args , 'network' ) ? 'get_site_transient' : 'get_transient' ; $ value = $ func ( $ key ) ; if ( false === $ value ) { WP_CLI :: warning ( 'Transient with key "' . $ key . '" is not set.' ) ; exit ; } WP_C...
Gets a transient value .
49,489
public function set ( $ args , $ assoc_args ) { list ( $ key , $ value ) = $ args ; $ expiration = Utils \ get_flag_value ( $ args , 2 , 0 ) ; $ func = Utils \ get_flag_value ( $ assoc_args , 'network' ) ? 'set_site_transient' : 'set_transient' ; if ( $ func ( $ key , $ value , $ expiration ) ) { WP_CLI :: success ( 'T...
Sets a transient value .
49,490
public function delete ( $ args , $ assoc_args ) { $ key = ( ! empty ( $ args ) ) ? $ args [ 0 ] : null ; $ all = Utils \ get_flag_value ( $ assoc_args , 'all' ) ; $ expired = Utils \ get_flag_value ( $ assoc_args , 'expired' ) ; $ network = Utils \ get_flag_value ( $ assoc_args , 'network' ) ; if ( true === $ all ) { ...
Deletes a transient value .
49,491
private function get_transient_expiration ( $ name , $ is_site_transient = false , $ human_readable = false ) { if ( $ is_site_transient ) { if ( is_multisite ( ) ) { $ expiration = ( int ) get_site_option ( '_site_transient_timeout_' . $ name ) ; } else { $ expiration = ( int ) get_option ( '_site_transient_timeout_' ...
Retrieves the expiration time .
49,492
private function delete_expired ( $ network ) { global $ wpdb ; $ count = 0 ; if ( ! $ network ) { $ count += $ wpdb -> query ( $ wpdb -> prepare ( "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b WHERE a.option_name LIKE %s AND a.option_name NOT LIKE %s AND b.option_name = CONCAT( '_transient_ti...
Deletes all expired transients .
49,493
private function delete_all ( $ network ) { global $ wpdb ; $ count = 0 ; if ( ! $ network ) { $ deleted = $ wpdb -> query ( $ wpdb -> prepare ( "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b WHERE a.option_name LIKE %s AND a.option_name NOT LIKE %s AND b.option_name = CONCAT( '_transient_timeo...
Deletes all transients .
49,494
public function add ( $ args , $ assoc_args ) { list ( $ key , $ value , $ group , $ expiration ) = $ args ; if ( ! wp_cache_add ( $ key , $ value , $ group , $ expiration ) ) { WP_CLI :: error ( "Could not add object '$key' in group '$group'. Does it already exist?" ) ; } WP_CLI :: success ( "Added object '$key' in gr...
Adds a value to the object cache .
49,495
public function decr ( $ args , $ assoc_args ) { list ( $ key , $ offset , $ group ) = $ args ; $ value = wp_cache_decr ( $ key , $ offset , $ group ) ; if ( false === $ value ) { WP_CLI :: error ( 'The value was not decremented.' ) ; } WP_CLI :: print_value ( $ value , $ assoc_args ) ; }
Decrements a value in the object cache .
49,496
public function delete ( $ args , $ assoc_args ) { list ( $ key , $ group ) = $ args ; $ result = wp_cache_delete ( $ key , $ group ) ; if ( false === $ result ) { WP_CLI :: error ( 'The object was not deleted.' ) ; } WP_CLI :: success ( 'Object deleted.' ) ; }
Removes a value from the object cache .
49,497
public function flush ( $ args , $ assoc_args ) { $ value = wp_cache_flush ( ) ; if ( false === $ value ) { WP_CLI :: error ( 'The object cache could not be flushed.' ) ; } WP_CLI :: success ( 'The cache was flushed.' ) ; }
Flushes the object cache .
49,498
public function get ( $ args , $ assoc_args ) { list ( $ key , $ group ) = $ args ; $ value = wp_cache_get ( $ key , $ group ) ; if ( false === $ value ) { WP_CLI :: error ( "Object with key '$key' and group '$group' not found." ) ; } WP_CLI :: print_value ( $ value , $ assoc_args ) ; }
Gets a value from the object cache .
49,499
public function incr ( $ args , $ assoc_args ) { list ( $ key , $ offset , $ group ) = $ args ; $ value = wp_cache_incr ( $ key , $ offset , $ group ) ; if ( false === $ value ) { WP_CLI :: error ( 'The value was not incremented.' ) ; } WP_CLI :: print_value ( $ value , $ assoc_args ) ; }
Increments a value in the object cache .