idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
12,200 | protected function processModules ( $ config ) { if ( $ this -> _anonModule ) { $ this -> manager -> addModule ( $ this -> _anonModule ) ; unset ( $ this -> _anonModule ) ; } $ this -> manager -> setup ( $ config ) ; $ this -> doctype = $ this -> manager -> doctype ; foreach ( $ this -> manager -> modules as $ module )... | Extract out the information from the manager |
12,201 | public function registerModule ( $ module , $ overload = false ) { if ( is_string ( $ module ) ) { $ original_module = $ module ; $ ok = false ; foreach ( $ this -> prefixes as $ prefix ) { $ module = $ prefix . $ original_module ; if ( class_exists ( $ module ) ) { $ ok = true ; break ; } } if ( ! $ ok ) { $ module = ... | Registers a module to the recognized module list useful for overloading pre - existing modules . |
12,202 | public function getElement ( $ name , $ trusted = null ) { if ( ! isset ( $ this -> elementLookup [ $ name ] ) ) { return false ; } $ def = false ; if ( $ trusted === null ) { $ trusted = $ this -> trusted ; } foreach ( $ this -> elementLookup [ $ name ] as $ module_name ) { $ module = $ this -> modules [ $ module_name... | Retrieves a single merged element definition |
12,203 | public function get ( $ name ) { if ( $ this -> has ( $ name ) ) { return $ this -> data [ $ name ] ; } if ( $ this -> parent ) { return $ this -> parent -> get ( $ name ) ; } throw new HTMLPurifier_Exception ( "Key '$name' not found" ) ; } | Recursively retrieves the value for a key |
12,204 | public function reset ( $ name = null ) { if ( $ name == null ) { $ this -> data = array ( ) ; } else { unset ( $ this -> data [ $ name ] ) ; } } | Resets a value to the value of it s parent usually the default . If no value is specified the entire plist is reset . |
12,205 | public function toString ( ) { $ authority = null ; if ( ! is_null ( $ this -> host ) ) { $ authority = '' ; if ( ! is_null ( $ this -> userinfo ) ) { $ authority .= $ this -> userinfo . '@' ; } $ authority .= $ this -> host ; if ( ! is_null ( $ this -> port ) ) { $ authority .= ':' . $ this -> port ; } } $ result = ''... | Convert URI back to string |
12,206 | public function getSigFigs ( $ n ) { $ n = ltrim ( $ n , '0+-' ) ; $ dp = strpos ( $ n , '.' ) ; if ( $ dp === false ) { $ sigfigs = strlen ( rtrim ( $ n , '0' ) ) ; } else { $ sigfigs = strlen ( ltrim ( $ n , '0.' ) ) ; if ( $ dp !== 0 ) { $ sigfigs -- ; } } return $ sigfigs ; } | Returns the number of significant figures in a string number . |
12,207 | private function round ( $ n , $ sigfigs ) { $ new_log = ( int ) floor ( log ( abs ( $ n ) , 10 ) ) ; $ rp = $ sigfigs - $ new_log - 1 ; $ neg = $ n < 0 ? '-' : '' ; if ( $ this -> bcmath ) { if ( $ rp >= 0 ) { $ n = bcadd ( $ n , $ neg . '0.' . str_repeat ( '0' , $ rp ) . '5' , $ rp + 1 ) ; $ n = bcdiv ( $ n , '1' , $... | Rounds a number according to the number of sigfigs it should have using arbitrary precision when available . |
12,208 | public function validate ( $ string , $ config , $ context ) { $ string = trim ( $ string ) ; $ is_important = false ; if ( strlen ( $ string ) >= 9 && substr ( $ string , - 9 ) === 'important' ) { $ temp = rtrim ( substr ( $ string , 0 , - 9 ) ) ; if ( strlen ( $ temp ) >= 1 && substr ( $ temp , - 1 ) === '!' ) { $ st... | Intercepts and removes !important if necessary |
12,209 | public function decorate ( & $ cache ) { $ decorator = $ this -> copy ( ) ; $ decorator -> cache = & $ cache ; $ decorator -> type = $ cache -> type ; return $ decorator ; } | Lazy decorator function |
12,210 | public function populate ( $ fixes ) { foreach ( $ fixes as $ name => $ fix ) { list ( $ type , $ params ) = $ this -> getFixType ( $ name ) ; switch ( $ type ) { case 'attr_transform_pre' : case 'attr_transform_post' : $ attr = $ params [ 'attr' ] ; if ( isset ( $ params [ 'element' ] ) ) { $ element = $ params [ 'ele... | Populates the module with transforms and other special - case code based on a list of fixes passed to it |
12,211 | public function getFixType ( $ name ) { $ property = $ attr = null ; if ( strpos ( $ name , '#' ) !== false ) { list ( $ name , $ property ) = explode ( '#' , $ name ) ; } if ( strpos ( $ name , '@' ) !== false ) { list ( $ name , $ attr ) = explode ( '@' , $ name ) ; } $ params = array ( ) ; if ( $ name !== '' ) { $ p... | Parses a fix name and determines what kind of fix it is as well as other information defined by the fix |
12,212 | private function _splitText ( $ data , & $ result ) { $ raw_paragraphs = explode ( "\n\n" , $ data ) ; $ paragraphs = array ( ) ; $ needs_start = false ; $ needs_end = false ; $ c = count ( $ raw_paragraphs ) ; if ( $ c == 1 ) { $ result [ ] = new HTMLPurifier_Token_Text ( $ data ) ; return ; } for ( $ i = 0 ; $ i < $ ... | Splits up a text in paragraph tokens and appends them to the result stream that will replace the original |
12,213 | protected function transformAttrToAssoc ( $ node_map ) { if ( $ node_map -> length === 0 ) { return array ( ) ; } $ array = array ( ) ; foreach ( $ node_map as $ attr ) { $ array [ $ attr -> name ] = $ attr -> value ; } return $ array ; } | Converts a DOMNamedNodeMap of DOMAttr objects into an assoc array . |
12,214 | protected function wrapHTML ( $ html , $ config , $ context ) { $ def = $ config -> getDefinition ( 'HTML' ) ; $ ret = '' ; if ( ! empty ( $ def -> doctype -> dtdPublic ) || ! empty ( $ def -> doctype -> dtdSystem ) ) { $ ret .= '<!DOCTYPE html ' ; if ( ! empty ( $ def -> doctype -> dtdPublic ) ) { $ ret .= 'PUBLIC "' ... | Wraps an HTML fragment in the necessary HTML |
12,215 | private function insertBefore ( $ token ) { $ splice = $ this -> zipper -> splice ( $ this -> token , 0 , array ( $ token ) ) ; return $ splice [ 1 ] ; } | Inserts a token before the current token . Cursor now points to this token . You must reprocess after this . |
12,216 | private function _collapseStack ( $ stack ) { $ result = array ( ) ; $ is_folder = false ; for ( $ i = 0 ; isset ( $ stack [ $ i ] ) ; $ i ++ ) { $ is_folder = false ; if ( $ stack [ $ i ] == '' && $ i && isset ( $ stack [ $ i + 1 ] ) ) { continue ; } if ( $ stack [ $ i ] == '..' ) { if ( ! empty ( $ result ) ) { $ seg... | Resolve dots and double - dots in a path stack |
12,217 | public function unique ( callable $ comparator = null ) { if ( ! $ comparator ) { $ this -> source = array_values ( array_unique ( $ this -> source ) ) ; } return $ this ; } | Remove duplicates . |
12,218 | public function last ( ) { $ lastIndex = ( count ( $ this -> source ) - 1 ) ; if ( isset ( $ this -> source [ $ lastIndex ] ) ) { return $ this -> source [ $ lastIndex ] ; } return null ; } | Return the last item . |
12,219 | public static function error ( $ fieldKey , $ template = null ) { if ( ! session_id ( ) ) { session_start ( ) ; } if ( isset ( $ _SESSION [ static :: SESSION_DATA_KEY ] ) ) { if ( count ( $ _SESSION [ static :: SESSION_DATA_KEY ] ) > 0 ) { self :: $ errors = $ _SESSION [ static :: SESSION_DATA_KEY ] ; unset ( $ _SESSIO... | Get error message of a field |
12,220 | public function goBackWithErrors ( ) { if ( ! session_id ( ) ) { session_start ( ) ; } $ _SESSION [ static :: SESSION_DATA_KEY ] = self :: $ errors ; header ( 'Location: ' . $ _SERVER [ 'HTTP_REFERER' ] ) ; exit ; } | save errors in session and go back to form |
12,221 | public function extractCustomMessage ( $ theRule ) { if ( $ this -> findChar ( '--' , $ theRule ) ) { $ theRule = explode ( '--' , $ theRule ) ; return end ( $ theRule ) ; } return null ; } | Returns error message passed with a rule |
12,222 | private function validateAgainstExpression ( $ field , $ value , $ rule , $ message = null ) { if ( preg_match ( $ this -> expressions [ $ rule ] , $ value ) ) { return true ; } if ( ! $ message ) { $ message = $ this -> error_messages [ $ rule ] ; } static :: $ errors [ $ field ] = $ message ; return false ; } | Validate a rule against a custom registered expression |
12,223 | private function validateByRule ( $ field , $ value , $ rule , $ message = null ) { $ ruleClassName = $ this -> ruleToClassName ( $ this -> getRuleName ( $ rule ) ) ; if ( ! class_exists ( $ ruleClassName ) ) { return false ; } $ ruleObject = new $ ruleClassName ( ) ; if ( $ this -> isLengthRule ( $ rule ) ) { $ ruleOb... | Validate a Rule against built - in rules |
12,224 | public function getPanel ( ) { $ lang_code = $ this -> translator -> getActiveLanguageAndPlural ( ) -> getLanguage ( ) -> getIso639_1 ( ) ; ob_start ( ) ; require __DIR__ . '/Templates/panel.phtml' ; return ob_get_clean ( ) ; } | Returns the code for the panel itself |
12,225 | public static function hasSessionValue ( string $ name , bool $ ignoreCase = false ) : bool { self :: ensureSession ( ) ; $ session = $ _SESSION ?? array ( ) ; return ArrayUtils :: doesArrayHaveValueForKey ( $ session , $ name , $ ignoreCase ) ; } | Checks if the session contains a value for the specified name . |
12,226 | public static function getSessionValue ( string $ name , $ default = null , bool $ ignoreCase = false ) { self :: ensureSession ( ) ; $ session = $ _SESSION ?? array ( ) ; return ArrayUtils :: getArrayValueForKeyOrDefault ( $ session , $ name , $ default , $ ignoreCase ) ; } | Get the value from the current session for the specified name . Return a default value if the value could not be found . |
12,227 | protected function initializeProductSuperAttribute ( array $ attr ) { $ productId = $ attr [ MemberNames :: PRODUCT_ID ] ; $ attributeId = $ attr [ MemberNames :: ATTRIBUTE_ID ] ; if ( $ entity = $ this -> loadProductSuperAttribute ( $ productId , $ attributeId ) ) { return $ this -> mergeEntity ( $ entity , $ attr ) ;... | Initialize the product super attribute with the passed attributes and returns an instance . |
12,228 | protected function initializeProductSuperAttributeLabel ( array $ attr ) { $ storeId = $ attr [ MemberNames :: STORE_ID ] ; $ productSuperAttributeId = $ attr [ MemberNames :: PRODUCT_SUPER_ATTRIBUTE_ID ] ; if ( $ entity = $ this -> loadProductSuperAttributeLabel ( $ productSuperAttributeId , $ storeId ) ) { return $ t... | Initialize the product super attribute label with the passed attributes and returns an instance . |
12,229 | public function getRelativeUriForPath ( $ path ) { if ( ! isset ( $ path [ 0 ] ) || '/' !== $ path [ 0 ] ) { return $ path ; } if ( $ path === $ basePath = $ this -> getPathInfo ( ) ) { return '' ; } $ sourceDirs = explode ( '/' , isset ( $ basePath [ 0 ] ) && '/' === $ basePath [ 0 ] ? substr ( $ basePath , 1 ) : $ ba... | Returns the path as relative reference from the current Request path . |
12,230 | public function ifNotExists ( string $ sql ) : string { $ sql = $ this -> c :: mbTrim ( $ sql ) ; if ( ! preg_match ( '/^CREATE\s+TABLE\b/ui' , $ sql ) ) { return $ sql ; } if ( ! preg_match ( '/^CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\b/ui' , $ sql ) ) { $ sql = preg_replace ( '/^CREATE\s+TABLE\b/ui' , 'CREATE TABLE IF NOT... | MySQL IF NOT EXISTS check . |
12,231 | public function engineCompat ( string $ sql ) : string { $ sql = $ this -> c :: mbTrim ( $ sql ) ; if ( ! preg_match ( '/^CREATE\s+TABLE\b/ui' , $ sql ) ) { return $ sql ; } $ sql = preg_replace ( '/\bENGINE\=[%a-z0-9_\-]*/ui' , '' , $ sql ) ; if ( ! preg_match ( '/\bFULLTEXT\s+KEY\b/ui' , $ sql ) || version_compare ( ... | MySQL storage engine compat . |
12,232 | private function buildJsRouting ( bool $ isbaseapp = false ) { Output :: displayAsSuccess ( "Hey, I will build the JS Routing file" , "none" ) ; $ rt = new JsRouting ( $ isbaseapp ) ; $ rt -> build ( ) ; if ( in_array ( "--noexit" , $ this -> options [ "options" ] ) ) { Output :: displayAsEndSuccess ( "Build the JS Rou... | Build the JS Routing file |
12,233 | private function _corsConfig ( array $ env ) { if ( ! isset ( $ env [ 'auth.cors_config' ] ) ) { $ cors_config = array ( 'origin' => $ env [ 'HTTP_ORIGIN' ] , 'methods' => 'GET, POST, PUT, DELETE, OPTIONS' , 'allowCredentials' => true , 'maxAge' => 86400 , 'allowHeaders' => 'X-Requested-With' ) ; if ( isset ( $ env [ '... | Setup CORS headers if needed |
12,234 | private function _denyAccess ( ) { if ( isset ( $ env [ 'auth.JSONerrors' ] ) && $ env [ 'auth.JSONerrors' ] == true ) { throw new Exception ( 'Resource ' . $ this -> app -> request -> getResourceUri ( ) . ' using ' . $ this -> app -> request -> getMethod ( ) . ' method is forbidden' , 403 ) ; } else { throw new Except... | Deny access to the current request |
12,235 | protected function getNestedValue ( $ root , $ path ) { $ node = & $ root ; $ segments = explode ( $ this -> separator , $ path ) ; $ last = count ( $ segments ) - 1 ; for ( $ i = 0 ; $ i <= $ last ; ++ $ i ) { $ node = @ $ this -> getNode ( $ node , $ segments [ $ i ] ) ; if ( $ node === null ) { return null ; } if ( ... | Search inside an hierarchy by a nested key . |
12,236 | protected function rootInstance ( $ root ) { if ( is_object ( $ root ) ) { return $ root ; } if ( ! is_string ( $ root ) ) { throw new InvalidArgumentException ( 'If you pass a path to type() it has to be array, object or a class not ' . gettype ( $ root ) ) ; } if ( ! class_exists ( $ root ) ) { throw new InvalidArgum... | Return an object not a class . |
12,237 | protected function getFromCache ( $ rootObject , $ path ) { $ cacheId = $ this -> cacheId ( $ rootObject , $ path ) ; return isset ( $ this -> typeCache [ $ cacheId ] ) ? $ this -> typeCache [ $ cacheId ] : null ; } | Get a type from cache . |
12,238 | protected function putIntoCache ( $ rootObject , $ path , $ type ) { $ cacheId = $ this -> cacheId ( $ rootObject , $ path ) ; $ this -> typeCache [ $ cacheId ] = $ type ; return $ type ; } | Put a type into cache and return it . |
12,239 | public function read ( $ id ) { $ this -> _cleanExpired ( ) ; $ id = preg_replace ( '/^([a-f0-9]{8}).*/' , '$1' , $ id ) ; return $ this -> findById ( $ id ) -> first ( ) ; } | get token by id |
12,240 | public function newToken ( array $ content = [ ] , $ expire = null ) { $ entity = $ this -> newEntity ( [ 'id' => $ this -> uniqId ( ) , 'content' => $ content , 'expire' => is_null ( $ expire ) ? Chronos :: parse ( '+1 day' ) : Chronos :: parse ( $ expire ) , ] ) ; $ this -> save ( $ entity ) ; return $ entity -> id ;... | create token with option |
12,241 | protected function uniqId ( ) { $ exists = true ; while ( $ exists ) { $ key = $ this -> generateKey ( ) ; $ exists = $ this -> find ( ) -> where ( [ 'id' => $ key ] ) -> first ( ) ; } return $ key ; } | generate uniq token id |
12,242 | public function insertAt ( $ index , $ item ) { if ( $ item instanceof $ this -> _type ) parent :: insertAt ( $ index , $ item ) ; else throw new Exception ( \ Yii :: t ( 'yii' , 'CTypedList<{type}> can only hold objects of {type} class.' , array ( '{type}' => $ this -> _type ) ) ) ; } | Inserts an item at the specified position . This method overrides the parent implementation by checking the item to be inserted is of certain type . |
12,243 | public static function addSchema ( SchemaId $ schemaId , SchemaDescriptor $ schema ) { $ curie = $ schemaId -> getCurie ( ) ; $ curieMajor = $ schemaId -> getCurieWithMajorRev ( ) ; self :: $ schemas [ $ schemaId -> toString ( ) ] = $ schema ; if ( isset ( self :: $ schemasByCurie [ $ curie ] ) ) { $ tmpSchema = self :... | Adds a schema . An exception will be thrown when attempting to load the same id multi times . |
12,244 | public static function getSchemasByNamespaces ( array $ namespaces ) { $ schemas = [ ] ; foreach ( self :: $ schemasByCurie as $ schema ) { if ( in_array ( $ schema -> getId ( ) -> getNamespace ( ) , $ namespaces ) ) { $ schemas [ ] = $ schema ; } } return $ schemas ; } | Returns an array of schemas by namespaces . |
12,245 | public static function getPreviousSchema ( SchemaId $ schemaId ) { $ id = $ schemaId -> toString ( ) ; if ( isset ( self :: $ schemas [ $ id ] ) ) { $ ids = array_keys ( self :: $ schemas ) ; sort ( $ ids ) ; if ( 0 < $ key = array_search ( $ id , $ ids ) ) { -- $ key ; } if ( $ ids [ $ key ] !== $ id ) { $ prev = self... | Returns the previous version of schema by id . |
12,246 | public static function getAllSchemaVersions ( SchemaId $ schemaId ) { $ schemaIds = preg_grep ( sprintf ( '/(%s):([0-9]+)-([0-9]+)-([0-9]+)/' , $ schemaId -> getCurie ( ) ) , array_keys ( self :: $ schemas ) ) ; if ( $ schemaIds === false || count ( $ schemaIds ) === 0 ) { return false ; } $ schemas = [ ] ; foreach ( $... | Returns all schemas with the same curie . |
12,247 | public static function hasOtherSchemaMajorRev ( SchemaId $ schemaId ) { if ( isset ( self :: $ schemasByCurieMajor [ $ schemaId -> getCurieWithMajorRev ( ) ] ) ) { if ( preg_match_all ( sprintf ( '/(%s:v[0-9]+)/' , $ schemaId -> getCurie ( ) ) , implode ( ' ' , array_keys ( self :: $ schemasByCurieMajor ) ) , $ matches... | Checks if schema has additional major version . |
12,248 | public static function getOtherSchemaMajorRev ( SchemaId $ schemaId ) { if ( isset ( self :: $ schemasByCurieMajor [ $ schemaId -> getCurieWithMajorRev ( ) ] ) ) { if ( preg_match_all ( sprintf ( '/(%s:v[0-9]+)/' , $ schemaId -> getCurie ( ) ) , implode ( ' ' , array_keys ( self :: $ schemasByCurieMajor ) ) , $ matches... | Returns list of all schemas with major version . |
12,249 | public static function addEnum ( EnumId $ enumId , EnumDescriptor $ enum ) { self :: $ enums [ $ enumId -> toString ( ) ] = $ enum ; ksort ( self :: $ enums ) ; } | Adds an enum . |
12,250 | public static function getEnumById ( $ enumId , $ ignoreNotFound = false ) { if ( $ enumId instanceof EnumId ) { $ enumId = $ enumId -> toString ( ) ; } if ( isset ( self :: $ enums [ $ enumId ] ) ) { return self :: $ enums [ $ enumId ] ; } if ( ! $ ignoreNotFound ) { throw new \ RuntimeException ( sprintf ( 'Enum with... | Returns an enum by its id . |
12,251 | public function peekToEnd ( ) { return substr ( $ this -> string , $ this -> scanOffset , strlen ( $ this -> string ) - $ this -> scanOffset ) ; } | Peek to the end of the string . |
12,252 | public function scanToEnd ( ) { $ scanned = substr ( $ this -> string , $ this -> scanOffset , strlen ( $ this -> string ) - $ this -> scanOffset ) ; $ this -> scanOffset = strlen ( $ this -> string ) ; return $ scanned ; } | Scan to the end of the string . |
12,253 | public function install ( $ source ) { $ pattern = chr ( 1 ) . '^' . preg_quote ( JPATH_ROOT ) . '/' . chr ( 1 ) ; $ this -> extensions [ basename ( $ source ) ] = preg_replace ( $ pattern , '' , $ source ) ; $ xmlDirectory = $ source . '/entities' ; $ strategy = new RecursiveDirectoryStrategy ( $ xmlDirectory ) ; $ th... | Installs an extension |
12,254 | public function finish ( ) { $ this -> resolveRelations ( ) ; $ this -> writeXmlFiles ( ) ; $ this -> createTables ( ) ; $ this -> import ( ) ; $ this -> writeExtensionIni ( ) ; } | Finishes the installation |
12,255 | private function resolveRelations ( ) { foreach ( $ this -> entityDefinitions as $ definition ) { $ this -> resolveBelongsTo ( $ definition ) ; $ this -> resolveHasOneOrMany ( $ definition ) ; $ this -> resolveHasManyThrough ( $ definition ) ; } } | Resolve all counter - relations |
12,256 | private function writeXmlFiles ( ) { foreach ( $ this -> entityDefinitions as $ key => $ definition ) { $ definition -> writeXml ( $ this -> dataDirectory . "/entities/{$definition->name}.xml" ) ; } } | Store XML files in a central place |
12,257 | private function importInitialData ( $ entityName , $ csvDirectory ) { $ tableName = $ this -> entityDefinitions [ $ entityName ] -> storage [ 'table' ] ; $ dataFile = $ csvDirectory . '/' . $ tableName . '.csv' ; if ( ! file_exists ( $ dataFile ) ) { return ; } $ entityClass = $ this -> entityDefinitions [ $ entityNam... | Import data if present |
12,258 | public function detectRules ( AppliesToResource $ resource , $ relationDepth = 1 ) { $ type = $ this -> typeProvider -> xType ( $ resource ) ; return $ this -> ruleConverter -> toRule ( $ type , $ relationDepth ) ; } | Convert a resource into a laravel rule array . |
12,259 | public function pager ( ) { $ prev = ( $ this -> _current > 1 ) ? $ this -> url ( $ this -> _current - 1 ) : false ; $ next = ( $ this -> _current < $ this -> _max ) ? $ this -> url ( $ this -> _current + 1 ) : false ; return compact ( 'prev' , 'next' ) ; } | Returns prev and next urls as associated array . |
12,260 | public function addToList ( \ BFW \ Install \ ModuleInstall $ module ) : self { $ moduleName = $ module -> getName ( ) ; $ this -> listToInstall [ $ moduleName ] = $ module ; return $ this ; } | Add a new module to the list to install |
12,261 | protected function installAllModules ( ) { $ this -> displayMsgNLInCli ( 'Read all modules to run install script...' ) ; $ tree = \ BFW \ Install \ Application :: getInstance ( ) -> getModuleList ( ) -> getLoadTree ( ) ; foreach ( $ tree as $ firstLine ) { foreach ( $ firstLine as $ secondLine ) { foreach ( $ secondLin... | Install all modules in the order of the dependency tree . |
12,262 | private function getIdIdentification ( string $ identification ) : int { $ result = $ this -> connection -> select ( 'id' ) -> from ( $ this -> tableTranslateIdent ) -> where ( [ 'ident' => $ identification ] ) -> fetchSingle ( ) ; if ( ! $ result ) { $ result = $ this -> connection -> insert ( $ this -> tableTranslate... | Get id identification . |
12,263 | public static function forward ( $ methods , $ object ) { foreach ( ( array ) $ methods as $ method ) { static :: extend ( $ method , static :: buildForward ( $ method , $ object ) ) ; } } | Forward methods to another object . |
12,264 | public static function label ( string $ text , string $ icon = null , array $ iconArguments = null ) { $ content = "" ; if ( isset ( $ icon ) ) { $ iconString = ( string ) Fa :: createIcon ( $ icon , $ iconArguments ) ; $ content .= $ iconString . " " ; } $ content .= $ text ; return Html :: el ( ) -> setHtml ( $ conte... | Returns element for form label with Font Awesome icon . |
12,265 | final public static function detectAppType ( string $ appname ) : string { $ apptype = 'none' ; $ appsp = AppTools :: registerApps ( ) ; $ appbs = AppTools :: registerBaseApps ( ) ; foreach ( $ appsp as $ one => $ val ) { if ( $ one == $ appname ) { return ( 'simple' ) ; } } foreach ( $ appbs as $ one => $ val ) { if (... | Detect the app type |
12,266 | final public static function getEditionInfo ( ) : \ stdClass { $ file = JL :: open ( FEnv :: get ( "framework.config.core.config.file" ) ) ; JL :: close ( FEnv :: get ( "framework.config.core.config.file" ) ) ; self :: $ edition = $ file ; return ( $ file ) ; } | Get edition info linked with Framework Core |
12,267 | final public static function detectFirstInstallation ( ) : int { $ file = JL :: open ( FEnv :: get ( "framework.config.core.config.file" ) ) ; if ( ! isset ( $ file -> installation ) || ( $ file -> installation == null ) ) { if ( file_exists ( FEnv :: get ( "framework.root" ) . 'public/setup/setup.php' ) ) { header ( '... | Detect if it is a first install |
12,268 | public static function manage ( HttpListener $ request , array $ routes , string $ baseurl = "" ) { $ controller = null ; $ baseSimilar = 0 ; $ path = $ request -> server -> get ( 'REQUEST_URI' ) ; if ( $ path == "" ) { $ path = "/" ; } foreach ( $ routes as $ route ) { if ( $ route [ 'visibility' ] === "disabled" ) { ... | Detect url matches |
12,269 | public function getVisibleUsers ( $ page ) { $ roleSuperAdmin = 'ROLE_SUPER_ADMIN' ; if ( $ this -> securityContext -> isGranted ( $ roleSuperAdmin ) ) { $ entities = $ this -> userManager -> findPaginateUsers ( $ page ) ; } else { $ entities = $ this -> userManager -> findPaginateUsersExcludingRole ( $ roleSuperAdmin ... | Recupere la liste d utilisateurs visible pour l utilisateur courant . Le SUPER_ADMIN peut voir tout le monde L ADMIN peut voir ADMIN et USER |
12,270 | public function countVisibleUsers ( ) { $ roleSuperAdmin = 'ROLE_SUPER_ADMIN' ; if ( $ this -> securityContext -> isGranted ( $ roleSuperAdmin ) ) { $ count = $ this -> userManager -> countUsers ( ) ; } else { $ count = $ this -> userManager -> countUsersExcludingRole ( $ roleSuperAdmin ) ; } return $ count ; } | Retourne le nombre d utilisateurs visible pour l utilisateur courant . Le SUPER_ADMIN peut voir tout le monde L ADMIN peut voir ADMIN et USER |
12,271 | public function getPagination ( ) { $ limit = $ this -> userManager -> getUsersLimit ( ) ; $ count = $ this -> countVisibleUsers ( ) ; $ pages = $ count / $ limit ; $ remainder = $ count % $ limit ; if ( $ remainder === 0 ) { return $ pages ; } else { return floor ( $ pages ) + 1 ; } } | Retourne le nombre de pages presente dans la liste |
12,272 | public function camelize ( $ prefix = '-' ) { Eden_String_Argument :: i ( ) -> test ( 1 , 'string' ) ; $ this -> data = str_replace ( $ prefix , ' ' , $ this -> data ) ; $ this -> data = str_replace ( ' ' , '' , ucwords ( $ this -> data ) ) ; $ this -> data = strtolower ( substr ( $ this -> data , 0 , 1 ) ) . substr ( ... | Camelizes a string |
12,273 | public function dasherize ( ) { $ this -> data = preg_replace ( "/[^a-zA-Z0-9_\-\s]/i" , '' , $ this -> data ) ; $ this -> data = str_replace ( ' ' , '-' , trim ( $ this -> data ) ) ; $ this -> data = preg_replace ( "/-+/i" , '-' , $ this -> data ) ; $ this -> data = strtolower ( $ this -> data ) ; return $ this ; } | Transforms a string with caps and space to a lower case dash string |
12,274 | public function titlize ( $ prefix = '-' ) { Eden_String_Argument :: i ( ) -> test ( 1 , 'string' ) ; $ this -> data = ucwords ( str_replace ( $ prefix , ' ' , $ this -> data ) ) ; return $ this ; } | Titlizes a string |
12,275 | public function uncamelize ( $ prefix = '-' ) { Eden_String_Argument :: i ( ) -> test ( 1 , 'string' ) ; $ this -> data = strtolower ( preg_replace ( "/([A-Z])/" , $ prefix . "$1" , $ this -> data ) ) ; return $ this ; } | Uncamelizes a string |
12,276 | public function summarize ( $ words ) { Eden_String_Argument :: i ( ) -> test ( 1 , 'int' ) ; $ this -> data = explode ( ' ' , strip_tags ( $ this -> data ) , $ words ) ; array_pop ( $ this -> data ) ; $ this -> data = implode ( ' ' , $ this -> data ) ; return $ this ; } | Summarizes a text |
12,277 | protected function setInstance ( string $ name , $ object ) : bool { if ( ! isset ( self :: $ instances [ $ name ] ) ) { self :: $ instances [ $ name ] = $ object ; return ( true ) ; } throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Cannot redeclare instance name $name as new instance" , "solution" => "... | Set a new instance in instance mapping |
12,278 | public function buildMessage ( Request $ request , Response $ response , Throwable $ err = null ) : string { $ base = 'Error occurred while dispatching request' ; if ( $ err === null ) { return $ base ; } return sprintf ( '%s:%s%s' , $ base , PHP_EOL , $ err ) ; } | Builds a message to be logged based on the error handler params |
12,279 | public function addWriteStream ( $ stream , callable $ listener ) { $ this -> emit ( 'addWriteStream' , [ $ stream , $ listener ] ) ; $ this -> loop -> addWriteStream ( $ stream , function ( $ stream ) use ( $ listener ) { $ this -> emit ( 'writeStreamTick' , [ $ stream , $ listener ] ) ; $ listener ( $ stream , $ this... | Register a listener to be notified when a stream is ready to write . |
12,280 | public function canModify ( FileNodeInterface $ file ) { return ( $ file -> exists ( ) && $ file instanceof FormatAwareInterface && $ file -> getFormat ( ) !== null && $ this -> parserFactory -> getParser ( $ file -> getFormat ( ) ) !== null ) ; } | Can this file be modified by this modifier |
12,281 | protected function multiLevelTrans ( array $ message , array $ texts ) : string { $ text = $ texts ; foreach ( $ message as $ part ) { $ text = Arrays :: get ( $ text , $ part , "" ) ; if ( $ text === "" ) { break ; } } return $ text ; } | Translate multi - level message |
12,282 | public function translate ( $ message , ... $ parameters ) : string { $ count = $ parameters [ 0 ] ?? 0 ; $ params = $ parameters [ 1 ] ?? [ ] ; list ( $ domain , $ m ) = $ this -> extractDomainAndMessage ( $ message ) ; $ texts = Arrays :: get ( $ this -> loader -> getTexts ( ) , $ domain , [ ] ) ; $ parts = explode (... | Translate the string |
12,283 | public static function getOldModel ( Eloquent $ model ) { $ class = get_class ( $ model ) ; $ oldModel = $ class :: find ( $ model -> id ) ; if ( empty ( $ oldModel ) ) : throw new NoOldModelException ( "Could not find model with class {$class} and id {$model->id}" ) ; endif ; return $ oldModel ; } | For updating get the old model |
12,284 | public static function getDatas ( Logable $ model , Logable $ oldModel ) { $ diff = self :: getLogDifference ( $ model , $ oldModel ) ; $ datas = array ( ) ; foreach ( $ diff as $ key ) : $ datas [ ] = array ( 'key' => $ key , 'new' => $ model -> { $ key } , 'old' => $ oldModel -> { $ key } , ) ; endforeach ; return $ ... | Get the data needed to save an update post |
12,285 | public static function getLogDifference ( Eloquent $ model , Eloquent $ oldModel ) { $ attributes = $ model -> attributesToArray ( ) ; $ modelAttributes = $ oldModel -> attributesToArray ( ) ; $ diff = array ( ) ; foreach ( $ attributes as $ key => $ value ) : $ other = $ modelAttributes [ $ key ] ; if ( $ value !== $ ... | Determine the difference between this model and another |
12,286 | public function getDefinition ( $ pluginId ) : PluginDefinitionInterface { return $ this -> hasDefinition ( $ pluginId ) ? $ this -> set [ $ pluginId ] : NULL ; } | Gets a particular plugin definition from this set . |
12,287 | public function applyMutator ( PluginDefinitionMutatorInterface $ mutator ) { $ this -> set = $ mutator -> mutate ( ... array_values ( $ this -> set ) ) ; } | Applies a mutator object to the current set of definitions . |
12,288 | public function getFilteredSet ( PluginDefinitionFilterInterface ... $ filters ) : PluginDefinitionSet { $ set = $ this -> set ; foreach ( $ filters as $ filter ) { $ set = array_filter ( $ set , [ $ filter , 'filter' ] ) ; } $ new_set = new PluginDefinitionSet ( ... array_values ( $ set ) ) ; return $ new_set ; } | Filters the set of definitions and returns a new set . |
12,289 | public function setFormats ( $ formats ) { $ this -> formats = Type :: forceAndReturn ( $ formats , ArrayAccess :: class ) ; $ this -> formatCache = [ ] ; return $ this ; } | Set all the format definitions . |
12,290 | protected function getFormatKey ( $ name , $ verbosity = self :: SHORT ) { if ( $ name == self :: UNIT || $ name == self :: MONEY ) { return "{$this->formatsPrefix}$name" ; } return "{$this->formatsPrefix}$name.$verbosity" ; } | Build a format key to get it from config array . |
12,291 | protected function getSymbolKey ( $ name , $ value , $ verbosity = self :: SHORT ) { if ( $ name == self :: DECIMAL_MARK || $ name == self :: THOUSANDS_SEPARATOR ) { return "{$this->formatsPrefix}number.$name" ; } return "{$this->formatsPrefix}$name.$verbosity.$value" ; } | Build a symbol key to get it from config array . |
12,292 | protected function getDateFormat ( $ type , $ verbosity , DateTime $ date ) { $ numWeekDay = ( int ) $ date -> format ( 'w' ) ; $ numWeekDay = $ numWeekDay == 0 ? 7 : $ numWeekDay ; $ numMonth = $ date -> format ( 'n' ) ; $ cacheKey = "$numWeekDay|$numMonth" ; if ( isset ( $ this -> dateFormatCache [ $ type ] [ $ verbo... | The date formats has to be parsed before passing them to DateTime . So this method does the parsing and caching . |
12,293 | protected function replaceDatePlaceHolders ( DateTime $ date , $ format ) { $ numWeekDay = ( int ) $ date -> format ( 'w' ) ; $ numWeekDay = $ numWeekDay == 0 ? 7 : $ numWeekDay ; $ numMonth = $ date -> format ( 'n' ) ; $ weekDay3 = $ this -> getSymbol ( self :: WEEKDAY , "$numWeekDay" , self :: LONG ) ; $ weekDay = $ ... | Parses the weekdays and months inside date or datetime formats . |
12,294 | public function current ( ) { $ iterator = $ this -> getInnerIterator ( ) ; return call_user_func ( $ this -> callable , $ iterator -> current ( ) , $ iterator -> key ( ) , $ iterator ) ; } | Get the value of the current element |
12,295 | public static function webassets ( array $ params ) : string { return ( FEnv :: get ( "host.web.components.apps" ) . strtolower ( FEnv :: get ( "framework.env" ) ) . "/" . ( ( isset ( $ params [ 'app' ] ) && $ params [ 'app' ] != "" ) ? "min" . "." : strtolower ( FEnv :: get ( "app.call" ) ) ) . "/" . $ params [ 'path'... | Get an asset file |
12,296 | final public static function sinfo ( array $ params ) : string { return ( \ iumioFramework \ Core \ Base \ Server \ GlobalServer :: getServerInfo ( $ params [ 'name' ] ) ) ; } | Get system infos |
12,297 | final public static function css ( array $ params ) { return ( "<link href='" . FEnv :: get ( "host.web.components.apps" ) . strtolower ( FEnv :: get ( "framework.env" ) ) . "/" . strtolower ( FEnv :: get ( "app.call" ) ) . "/" . ( ( isset ( $ params [ 'path' ] ) ) ? $ params [ 'path' ] . "." : "" ) . "css' rel='styles... | Get css file |
12,298 | final public static function js ( array $ params ) { return ( "<script type='text/javascript' src='" . FEnv :: get ( "host.web.components.apps" ) . strtolower ( FEnv :: get ( "framework.env" ) ) . "/" . strtolower ( FEnv :: get ( "app.call" ) ) . "/" . ( ( isset ( $ params [ 'path' ] ) ) ? $ params [ 'path' ] . "." : "... | Get js file |
12,299 | final public static function cssmanager ( array $ params ) { return ( "<link href='" . FEnv :: get ( "host.web.components" ) . "libs/iumio-manager/css/" . ( ( isset ( $ params [ 'name' ] ) ) ? $ params [ 'name' ] . "." . ( ( isset ( $ params [ 'min' ] ) && $ params [ 'min' ] == "yes" ) ? "min" . "." : "" ) : "" ) . "cs... | Get css manager file |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.