idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
12,300 | final public static function mercurefile ( ) { $ env = FrameworkEnvironment :: getFileEnv ( FEnv :: get ( "framework.env" ) ) ; if ( strpos ( $ _SERVER [ 'REQUEST_URI' ] , $ env ) == false ) { $ env = "" ; } else { $ env = "/" . $ env ; } $ url = $ env ; $ base = ( isset ( $ _SERVER [ 'SCRIPT_NAME' ] ) && $ _SERVER [ '... | Get js routing file |
12,301 | final public static function jsmanager ( array $ params ) { return ( "<script type='text/javascript' src='" . FEnv :: get ( "host.web.components" ) . "libs/iumio-manager/js/" . ( ( isset ( $ params [ 'name' ] ) ) ? $ params [ 'name' ] . "." . ( ( isset ( $ params [ 'min' ] ) && $ params [ 'min' ] == "yes" ) ? "min" . "... | Get js manager file |
12,302 | final public static function cssiumio ( array $ params ) { return ( "<link href='" . FEnv :: get ( "host.web.components" ) . "libs/iumio-framework/css/" . ( ( isset ( $ params [ 'name' ] ) ) ? $ params [ 'name' ] . "." . ( ( isset ( $ params [ 'min' ] ) && $ params [ 'min' ] == "yes" ) ? "min" . "." : "" ) : "" ) . "cs... | Get css iumio lib file |
12,303 | final public static function fontawesomescss ( array $ params ) { return ( "<link href='" . FEnv :: get ( "host.web.components" ) . "libs/font-awesome/scss/." . ( ( isset ( $ params [ 'name' ] ) ) ? $ params [ 'name' ] . "." . ( ( isset ( $ params [ 'min' ] ) && $ params [ 'min' ] == "yes" ) ? "min" . "." : "" ) : "" )... | Get font awesome scss lib |
12,304 | final public static function jsiumio ( array $ params ) { return ( "<script type='text/javascript' src='" . FEnv :: get ( "host.web.components" ) . "libs/iumio-framework/js/" . ( ( isset ( $ params [ 'name' ] ) ) ? $ params [ 'name' ] . "." . ( ( isset ( $ params [ 'min' ] ) && $ params [ 'min' ] == "yes" ) ? "min" . "... | Get js iumio lib file |
12,305 | final public static function route ( array $ params ) { if ( ! FEnv :: isset ( "framework.smarty.called" ) ) { FEnv :: set ( "framework.smarty.called" , 1 ) ; } $ im = new \ iumioFramework \ Core \ Masters \ MasterCore ( ) ; if ( ! isset ( $ params [ 'name' ] ) ) { throw new \ Exception ( "The parameter [name] is missi... | Get route url |
12,306 | final public static function translate ( array $ params , string $ content = null ) { if ( ! FEnv :: isset ( "framework.smarty.called" ) ) { FEnv :: set ( "framework.smarty.called" , 1 ) ; } if ( isset ( $ content ) ) { $ locale = Locale :: getInstance ( ) ; return ( $ locale -> trans ( $ content , $ params [ 'lang' ] ... | Translate a element |
12,307 | public function hasFilter ( string $ field ) : bool { foreach ( $ this -> filters as $ filter ) { if ( $ filter -> hasFilter ( $ field ) ) { return true ; } } return false ; } | Tell if this filter contains a filter on the given field . |
12,308 | protected function setAdditionalProps ( ) { if ( isset ( $ this -> App -> Wp ) ) { $ this -> Wp = & $ this -> App -> Wp ; } } | Additional props . |
12,309 | protected function untilToLifetime ( $ until ) { if ( ! $ until instanceof DateTime ) { return self :: CACHE_LIFETIME ; } return $ until -> getTimestamp ( ) - ( new DateTime ( ) ) -> getTimestamp ( ) ; } | Calculates the lifetime out of a DateTime value . |
12,310 | public function setIp ( $ attribute ) { $ this -> owner -> updateAttributes ( array_fill_keys ( ( array ) $ attribute , $ this -> getValue ( null ) ) ) ; } | Sets an IP address to the attribute . |
12,311 | public function handle ( $ request , Closure $ next , $ guard = null ) { $ loggedUser = Auth :: guard ( $ guard ) -> user ( ) ; if ( ! $ loggedUser || ! $ loggedUser -> isSquantoDeveloper ( ) ) { return redirect ( '/' ) ; } return $ next ( $ request ) ; } | Restrict access for developers only . |
12,312 | protected function extractSingleItemData ( array $ data ) { if ( $ this -> singleResponseKey && ! array_key_exists ( $ this -> singleResponseKey , $ data ) ) { throw new Exception ( 'Invalid response, missing field ' . $ this -> singleResponseKey ) ; } return ( $ this -> singleResponseKey ) ? $ data [ $ this -> singleR... | Takes the raw JSON response and extracts the item data |
12,313 | protected function extractListItemData ( array $ data ) { if ( $ this -> listResponseKey && ! array_key_exists ( $ this -> listResponseKey , $ data ) ) { throw new Exception ( 'Invalid response, missing field ' . $ this -> listResponseKey ) ; } return ( $ this -> listResponseKey ) ? $ data [ $ this -> listResponseKey ]... | Takes the raw JSON response and extracts the array of items |
12,314 | public static function init ( ... $ arguments ) { assert ( ! isset ( self :: $ instance [ static :: class ] ) , sprintf ( 'Class "%s" already initialized.' , get_class ( ) ) ) ; static :: __static ( ) ; $ parameters = self :: determineParameters ( $ arguments ) ; return new static ( ... $ parameters ) ; } | Used to initialize a Singleton if needed . |
12,315 | public static function addDependency ( $ dependency ) { if ( ! isset ( self :: $ instance [ get_class ( $ dependency ) ] ) ) { self :: $ instance [ get_class ( $ dependency ) ] = $ dependency ; } } | Manually add an instance to the DependencyManager . |
12,316 | private static function determineParameters ( $ arguments ) { $ constructor = ( new \ ReflectionClass ( static :: class ) ) -> getConstructor ( ) ; $ parameters = [ ] ; if ( ! is_null ( $ constructor ) ) { foreach ( $ constructor -> getParameters ( ) as $ parameter ) { $ parameterClass = $ parameter -> getClass ( ) ; i... | Determine the parameters to be used for initializing this Dependency . A parameter can be one of the following |
12,317 | private static function loadDependency ( $ parameterClass ) { if ( ! isset ( self :: $ instance [ $ parameterClass ] ) ) { $ parameterDependency = $ parameterClass ; self :: $ loading [ $ parameterClass ] = true ; self :: $ instance [ $ parameterClass ] = $ parameterDependency :: init ( ) ; } return self :: $ instance ... | Load a dependency from a class name . It is loaded when it is not initialized yet . |
12,318 | public function where ( $ key , $ value ) { $ filter = $ this -> createFilter ( $ key , $ value ) ; return new static ( array_filter ( $ this -> source , $ filter ) ) ; } | Filter the attachments by role contentType type . |
12,319 | protected function createFilter ( $ key , $ value ) { if ( $ key == 'role' ) { return function ( Attachment $ attachment ) use ( $ value ) { return $ attachment -> getRole ( ) == $ value ; } ; } if ( $ key == 'mimetype' || $ key == 'type' ) { return function ( Attachment $ attachment ) use ( $ value ) { return $ attach... | Create a filter Closure to realize the where method . |
12,320 | public function embed ( string $ assetPath ) : string { return $ this -> fileLoader -> loadFile ( Asset :: createFromAssetPath ( $ assetPath ) , FileLoader :: MODE_UNTOUCHED ) ; } | Returns the file content of the asset untouched |
12,321 | public function getUrl ( string $ assetPath ) : string { return $ this -> assetUrl -> generateUrl ( Asset :: createFromAssetPath ( $ assetPath ) ) ; } | Gets the asset URL for the given asset path |
12,322 | public function getShortcodeCallback ( $ tag ) { return isset ( $ this -> shortcodes [ $ tag ] ) ? $ this -> shortcodes [ $ tag ] : null ; } | Get a shortcode callback . |
12,323 | public function addFilter ( $ filterName , $ filterCall , $ prio , $ numVars ) { $ this -> filters [ ] = $ this -> add ( $ filterName , $ filterCall , $ prio , $ numVars ) ; return $ this ; } | Wordpress mock on add_filter func . |
12,324 | public function addAction ( $ filterName , $ filterCall , $ prio , $ numVars ) { $ this -> actions [ ] = $ this -> add ( $ filterName , $ filterCall , $ prio , $ numVars ) ; return $ this ; } | Wordpress mock on add_action func . |
12,325 | public function addThemeSupport ( $ feature , $ arguments ) { $ data = new stdClass ( ) ; $ data -> feature = $ feature ; $ data -> arguments = $ arguments ; $ this -> themeSupport [ ] = $ data ; return $ this ; } | Wordpress mock on add_theme_support func . |
12,326 | public function show ( ) { $ id = ( int ) $ this -> request -> param ( 'ID' ) ; if ( $ id ) { $ since = $ this -> request -> getVar ( 'since' ) ; if ( ! $ since ) { $ since = $ id - 1 ; } else { } $ posts = $ this -> microBlogService -> getStatusUpdates ( null , array ( 'ID' => 'ASC' ) , $ since , false , false , array... | Show a particular post |
12,327 | public function rss ( ) { $ entries = $ this -> microBlogService -> globalFeed ( ) ; $ feed = new RSSFeed ( $ entries , $ this -> Link ( 'rss' ) , 'Global updates' ) ; $ feed -> outputToBrowser ( ) ; } | Output RSS feed |
12,328 | protected function tagsFromRequest ( ) { $ tags = $ this -> owner -> getRequest ( ) -> getVar ( 'tags' ) ? $ this -> owner -> getRequest ( ) -> getVar ( 'tags' ) : '' ; if ( strlen ( $ tags ) ) { $ tags = explode ( ',' , $ tags ) ; } else { $ tags = array ( ) ; } return $ tags ; } | Get tags submitted in this request |
12,329 | public function getTargetFilter ( ) { $ target = $ this -> getRequest ( ) -> getVar ( 'target' ) ; if ( $ target ) { list ( $ targetType , $ targetId ) = explode ( ',' , $ target ) ; $ targetId = ( int ) $ targetId ; if ( class_exists ( $ targetType ) && $ targetId > 0 ) { return "$targetType,$targetId" ; } } } | What was the target of this post? |
12,330 | public function flatlist ( ) { $ replies = ( bool ) $ this -> owner -> getRequest ( ) -> getVar ( 'replies' ) ; $ since = $ this -> owner -> getRequest ( ) -> getVar ( 'since' ) ; $ before = ( int ) $ this -> owner -> getRequest ( ) -> getVar ( 'before' ) ; if ( ! $ before ) { $ before = false ; } $ filter = array ( ) ... | Retrieve a flat list of posts regardless of specific hierarchy |
12,331 | public function Timeline ( ) { $ since = $ this -> owner -> getRequest ( ) -> getVar ( 'since' ) ; $ offset = ( int ) $ this -> owner -> getRequest ( ) -> getVar ( 'before' ) ; $ mentions = ( int ) $ this -> getRequest ( ) -> getVar ( 'mentions' ) ; $ showHidden = ( int ) $ this -> getRequest ( ) -> getVar ( 'hidden' )... | Return the rendered HTML that represents all the posts that the current user has access to view |
12,332 | public function user ( ) { $ user = ( int ) $ this -> request -> param ( 'ID' ) ; $ since = $ this -> owner -> getRequest ( ) -> getVar ( 'since' ) ; $ offset = ( int ) $ this -> owner -> getRequest ( ) -> getVar ( 'before' ) ; if ( ! $ offset ) { $ offset = false ; } $ filter = array ( 'OwnerID' => $ user ) ; $ tags =... | View a particular user s feed |
12,333 | public function total ( array $ args = [ ] ) : int { $ default_args = [ 'taxonomy_filters' => [ ] , 'taxonomies_include' => [ ] , 'taxonomies_exclude' => [ ] , 'filters' => [ 'get' => 'all' , 'hide_empty' => false , 'orderby' => 'name' , ] , 'no_cache' => false , ] ; $ args = array_merge ( $ default_args , $ args ) ; $... | Total terms . |
12,334 | public static function name ( ) { $ class = get_called_class ( ) ; if ( ! isset ( self :: $ names [ $ class ] ) ) { self :: $ names [ $ class ] = self :: generateName ( $ class ) ; } return self :: $ names [ $ class ] ; } | Get class event name |
12,335 | public static function generateName ( $ class ) { $ name = ClassUtils :: classToName ( $ class , '.' , '_' ) ; if ( substr ( $ name , - 1 * strlen ( self :: IGNORED_SUFFIX ) ) === self :: IGNORED_SUFFIX ) { $ name = substr ( $ name , 0 , - 1 * strlen ( self :: IGNORED_SUFFIX ) ) ; $ name = rtrim ( $ name , '._' ) ; } r... | Generate event name based on class |
12,336 | protected function getManualConfig ( Model $ model ) { if ( ! method_exists ( $ model , 'xTypeConfig' ) ) { return [ ] ; } $ config = $ model -> xTypeConfig ( ) ; $ parsed = [ ] ; $ foreignKeys = [ ] ; foreach ( $ config as $ key => $ rule ) { if ( $ rule != 'relation' ) { $ parsed [ $ key ] = $ rule ; continue ; } $ r... | Return the manually setted config of Model or an empty array |
12,337 | protected function getConfigFromReflector ( Model $ model ) { $ config = [ ] ; foreach ( $ this -> reflector -> keys ( $ model ) as $ key ) { $ config [ $ key ] = $ this -> reflector -> typeString ( $ model , $ key ) ; } return $ config ; } | Load the automatically detected rules |
12,338 | protected function instanceAndClass ( $ model ) { if ( ! is_subclass_of ( $ model , Model :: class ) ) { throw new UnsupportedParameterException ( 'ModelTypeFactory only supports Eloquent models not ' . Type :: of ( $ model ) ) ; } return is_object ( $ model ) ? [ $ model , get_class ( $ model ) ] : [ new $ model ( ) ,... | Return an instance of a model and a classname |
12,339 | public static function toArray ( $ object , $ properties = [ ] , $ recursive = TRUE ) { if ( is_array ( $ object ) ) { if ( $ recursive ) { foreach ( $ object as $ key => $ value ) { if ( is_array ( $ value ) || is_object ( $ value ) ) { $ object [ $ key ] = static :: toArray ( $ value , $ properties , TRUE ) ; } } } r... | Converts an object or an array of objects into an array . |
12,340 | public static function getValue ( $ array , $ key , $ default = NULL ) { if ( $ key instanceof \ Closure ) { return $ key ( $ array , $ default ) ; } if ( is_array ( $ key ) ) { $ lastKey = array_pop ( $ key ) ; foreach ( $ key as $ keyPart ) { $ array = static :: getValue ( $ array , $ keyPart ) ; } $ key = $ lastKey ... | Retrieves the value of an array element or object property with the given key or property name . If the key does not exist in the array or object the default value will be returned instead . |
12,341 | public static function remove ( & $ array , $ key , $ default = NULL ) { if ( is_array ( $ array ) && ( isset ( $ array [ $ key ] ) || array_key_exists ( $ key , $ array ) ) ) { $ value = $ array [ $ key ] ; unset ( $ array [ $ key ] ) ; return $ value ; } return $ default ; } | Removes an item from an array and returns the value . If the key does not exist in the array the default value will be returned instead . |
12,342 | public static function htmlEncode ( $ data , $ valuesOnly = TRUE , $ charset = NULL ) { if ( $ charset === NULL ) { $ charset = 'UTF-8' ; } $ d = [ ] ; foreach ( $ data as $ key => $ value ) { if ( ! $ valuesOnly && is_string ( $ key ) ) { $ key = htmlspecialchars ( $ key , ENT_QUOTES | ENT_SUBSTITUTE , $ charset ) ; }... | Encodes special characters in an array of strings into HTML entities . Only array values will be encoded by default . If a value is an array this method will also encode it recursively . Only string values will be encoded . |
12,343 | private function putSpace ( string $ str , int $ max ) : string { $ i = 0 ; $ len = strlen ( $ str ) ; $ max -= $ len ; $ space = "" ; while ( $ i <= $ max ) { $ space .= " " ; $ i ++ ; } return ( $ space ) ; } | Calc how many space can be contain a string to align them |
12,344 | protected function autoAssignAttributes ( ) { if ( $ this -> _attributesAssigner ) { call_user_func ( $ this -> _attributesAssigner , $ this ) ; return ; } $ attributes = isset ( $ this -> defaultAttributes ) ? $ this -> defaultAttributes : [ ] ; $ this -> fillAttributes ( $ attributes , false ) ; } | Get attributes from provider or an empty array . |
12,345 | public static function button ( $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { throw new \ InvalidArgumentException ( "Arguments is not a Array" . print_r ( $ params , true ) ) ; } $ o = "<button type='submit'" ; $ o .= ( isset ( $ params [ 'id' ] ) ) ? " id='{$params['id']}'" : '' ; $ o .= ( isset ( $ param... | This method returns a button element given the params for settings |
12,346 | public static function submit ( $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { throw new \ InvalidArgumentException ( "Arguments is not a Array" . print_r ( $ params , true ) ) ; } $ o = '<input type="submit"' ; $ o .= ( isset ( $ params [ 'id' ] ) ) ? " id='{$params['id']}'" : '' ; $ o .= ( isset ( $ params... | This method returns a submit button element given the params for settings |
12,347 | public static function hidden ( $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { throw new \ InvalidArgumentException ( "Arguments is not a Array" . print_r ( $ params , true ) ) ; } $ o = '<input type="hidden"' ; $ o .= ( isset ( $ params [ 'id' ] ) ) ? " id='{$params['id']}'" : '' ; $ o .= ( isset ( $ params... | This method returns a hidden input elements given its params |
12,348 | public static function table ( $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { throw new \ InvalidArgumentException ( "Arguments is not a Array" . print_r ( $ params , true ) ) ; } $ o = "<table " ; $ o .= ( isset ( $ params [ 'class' ] ) ) ? " class='{$params['class']}'" : '' ; $ o .= ">" ; $ o .= "<thead>" ... | This method returns a table element given the params for settings |
12,349 | public function translateAction ( $ packageKey = '' , $ fromLang = '' , $ toLang = '' ) { $ this -> view -> assign ( 'packageKey' , $ packageKey ) ; $ this -> view -> assign ( 'languages' , explode ( ',' , $ this -> settings [ 'availableLanguages' ] ) ) ; $ this -> view -> assign ( 'fromLang' , $ fromLang ) ; $ this ->... | Renders the form to translate a specific Xliff file from language A to language B |
12,350 | protected function getXliffDataAsArray ( $ packageKey , $ sourceName , \ TYPO3 \ Flow \ I18n \ Locale $ locale ) { $ sourcePath = \ TYPO3 \ Flow \ Utility \ Files :: concatenatePaths ( array ( 'resource://' . $ packageKey , 'Private/Translations' ) ) ; list ( $ sourcePath , $ foundLocale ) = $ this -> localizationServi... | Reads a particular Xliff file and returns it s translation units as array entries |
12,351 | public function saveTranslationsAction ( $ packageKey , $ fromLang , $ toLang , array $ translationUnits ) { $ originalMatrix = $ this -> generateTranslationMatrix ( $ packageKey , $ fromLang , $ toLang ) ; $ matrixToSave = array ( ) ; foreach ( $ translationUnits as $ translationUnit => $ value ) { if ( isset ( $ valu... | Saves the translations from the translation form |
12,352 | protected function backupXliffFile ( $ packageKey , $ language ) { if ( is_file ( $ this -> getFilePath ( $ packageKey , $ language ) ) ) { copy ( $ this -> getFilePath ( $ packageKey , $ language ) , $ this -> getFilePath ( $ packageKey , $ language ) . '_backup_' . time ( ) ) ; } } | Creates a backup file of the existing Xliff file before it gets overwritten by the new data later on . |
12,353 | protected function getAvailablePackages ( ) { $ allPackages = $ this -> packageManager -> getActivePackages ( ) ; $ packages = array ( ) ; $ packagesToExclude = \ TYPO3 \ Flow \ Utility \ Arrays :: trimExplode ( ',' , $ this -> settings [ 'packagesToExclude' ] ) ; foreach ( $ allPackages as $ package ) { if ( ! in_arra... | Returns an array of packages that are available for translation . |
12,354 | public static function setDefaultTimezone ( $ timezone = self :: DEFAULT_TIMEZONE , $ force = false ) { $ dateTimezone = ini_get ( 'date.timezone' ) ; if ( empty ( $ dateTimezone ) || $ force ) { date_default_timezone_set ( $ timezone ) ; } } | Set default timezone |
12,355 | public static function findPhakefileParts ( $ folder ) { $ result = array ( ) ; $ dir = new DirectoryIterator ( $ folder ) ; $ regex = new RegexIterator ( $ dir , '/\.php$/' ) ; foreach ( $ regex as $ item ) { $ result [ ] = $ item -> getRealpath ( ) ; } return $ result ; } | Find Phakefile parts |
12,356 | public function tableListAction ( ) { $ this -> getConsoleRequest ( ) ; $ status = [ - 1 => 'None' , 0 => 'Outdated' , 1 => 'Ok' ] ; $ bm = new BuilderManager ( $ this -> getNameManager ( ) ) ; $ body = '' ; while ( $ bm -> nextTable ( ) ) { $ body .= $ bm -> getTableName ( ) . "\n" ; $ body .= "\tDataTable :" . $ ... | List tables and stauts of class files |
12,357 | public function buildAction ( ) { $ request = $ this -> getConsoleRequest ( ) ; $ types = [ 'datatable' => [ 'DataTable' ] , 'abstract' => [ 'EntityAbstract' ] , 'entity' => [ 'Entity' ] , 'ALL' => [ 'DataTable' , 'EntityAbstract' , 'Entity' ] ] ; $ class = $ request -> getParam ( 'class' ) ; $ table = $ request -> get... | Generate the classes |
12,358 | public function authenticate ( ) { $ request = ServerRequest :: fromGlobals ( ) ; try { return $ this -> resourceServer -> validateAuthenticatedRequest ( $ request ) ; } catch ( OAuthServerException $ exception ) { $ message = $ exception -> getMessage ( ) ; if ( $ hint = $ exception -> getHint ( ) ) { $ message .= ' (... | Preform oauth resource authenticate |
12,359 | protected function convertResponse ( ResponseInterface $ response ) { $ this -> response -> setContent ( $ response -> getBody ( ) ) ; $ this -> response -> setStatusCode ( $ response -> getStatusCode ( ) ) ; foreach ( $ response -> getHeaders ( ) as $ name => $ values ) { $ this -> response -> setHeader ( $ name , imp... | Convert Psr7 Response to Phalcon s response |
12,360 | public static final function get ( $ url , array $ Params = [ ] , array $ Headers = [ ] , $ flags = 0b0000 ) { $ Curl = curl_init ( ) ; if ( preg_match ( '/^(.*):([0-9]+)$/' , $ url , $ Macth ) > 0 ) { curl_setopt ( $ Curl , CURLOPT_PORT , $ Macth [ 2 ] ) ; $ url = $ Macth [ 1 ] ; } if ( count ( $ Params ) > 0 ) { $ ur... | Send get request and return result . |
12,361 | public function anyCategoryValues ( $ values , $ attribute = null ) { $ model = new $ this -> owner -> modelClass ( ) ; $ categoryClass = $ model -> getRelation ( $ model -> categoryRelation ) -> modelClass ; $ this -> owner -> innerJoinWith ( $ model -> categoryRelation , false ) -> andWhere ( [ $ categoryClass :: tab... | Gets entities by any categories . |
12,362 | public function allCategoryValues ( $ values , $ attribute = null ) { $ model = new $ this -> owner -> modelClass ( ) ; return $ this -> anyCategoryValues ( $ values , $ attribute ) -> andHaving ( new Expression ( 'COUNT(*) = ' . count ( $ model -> filterCategoryValues ( $ values ) ) ) ) ; } | Gets entities by all categories . |
12,363 | public function relatedByCategoryValues ( $ values , $ attribute = null ) { return $ this -> anyCategoryValues ( $ values , $ attribute ) -> addOrderBy ( new Expression ( 'COUNT(*) DESC' ) ) ; } | Gets entities related by categories . |
12,364 | public function actionPull ( ) { $ collection = \ App :: $ domain -> vendor -> info -> all ( ) ; Output :: pipe ( 'Git pull packages' ) ; foreach ( $ collection as $ entity ) { Output :: line ( $ entity -> package ) ; try { $ result = \ App :: $ domain -> vendor -> git -> pull ( $ entity ) ; if ( $ result ) { Output ::... | Git pull for all packages |
12,365 | public function actionPush ( ) { $ collection = \ App :: $ domain -> vendor -> info -> all ( ) ; Output :: pipe ( 'Git push packages' ) ; foreach ( $ collection as $ entity ) { Output :: line ( $ entity -> package ) ; try { Output :: line ( ) ; \ App :: $ domain -> vendor -> git -> push ( $ entity ) ; Output :: line ( ... | Git push for all packages |
12,366 | public function proc ( $ wizardItems ) { foreach ( $ this -> plugins as $ plugin ) { $ wizardItems [ $ this -> getWizardKey ( $ plugin ) ] = [ 'icon' => $ this -> getExtRelPath ( ) . $ this -> iconFile , 'title' => $ this -> translate ( 'title' , $ plugin ) , 'description' => $ this -> translate ( 'description' , $ plu... | Add the icon to the wizard items array . |
12,367 | private function getLL ( ) { if ( $ this -> ll === null ) { $ this -> ll = $ GLOBALS [ 'LANG' ] -> includeLLFile ( $ this -> getExtPath ( ) . 'Resources/Private/Language/' . $ this -> langFile , false ) ; } return $ this -> ll ; } | Load the the plugin language file and return its contents . |
12,368 | protected function generateId ( $ signalName , UrlContract $ url ) { $ signalPart = preg_replace ( '/[^a-zA-Z0-9_]/u' , '_' , $ signalName ) ; $ urlPart = preg_replace ( '/[^a-zA-Z0-9_]/u' , '_' , ( string ) $ url ) ; return "$signalPart--$urlPart" ; } | Generate unique id for this receiver . |
12,369 | public static function outputAsSuccess ( string $ message , string $ exit = "yes" ) { $ colors = self :: getManagerColorInstance ( ) ; echo "\n\n" . $ colors -> getColoredString ( $ message , "green" , "transparent" ) ; if ( $ exit == "yes" ) { exit ( ) ; } } | display Success Message |
12,370 | public static function outputAsNormal ( string $ message , string $ exit = "yes" ) { $ colors = self :: getManagerColorInstance ( ) ; echo "\n\n" . $ colors -> getColoredString ( $ message , "green" , "transparent" , false ) ; if ( $ exit == "yes" ) { exit ( ) ; } } | display As Normal Message |
12,371 | public function check ( ) { $ report = HealthReport :: buildStatusUp ( ) ; if ( ! empty ( $ this -> checks ) ) { foreach ( $ this -> checks as $ check ) { $ report = $ check -> check ( $ report ) ; if ( $ report -> isDown ( ) ) { return $ report ; } } } return $ report ; } | Checks all registered HealthCheckers and stops on the first encounter of a failing test . |
12,372 | protected function buildConditions ( array $ filters ) { $ conditions = $ this -> engine -> newQuery ( ) ; foreach ( $ filters as $ key => $ value ) { $ conditions = $ this -> buildCondition ( $ conditions , $ key , $ value ) ; } return $ conditions ; } | Build the Condition out of the filters |
12,373 | protected function buildCondition ( ConditionGroupContract $ group , $ key , $ value ) { if ( is_array ( $ value ) ) { return $ group -> where ( $ key , 'in' , $ value ) ; } if ( is_numeric ( $ value ) ) { return $ group -> where ( $ key , '=' , $ value ) ; } if ( Type :: isStringLike ( $ value ) ) { return $ group -> ... | Add a single condition add it to the group and return the new group . |
12,374 | protected function getResultFromEngine ( $ filters , $ sorting , $ queryKeys ) { return $ this -> engine -> search ( $ this -> buildConditions ( $ filters ) , $ sorting , $ queryKeys ) ; } | Get result from Search Engine |
12,375 | protected function checkDependencies ( Container $ app ) { $ dependencies = [ 'twig' => 'TwigServiceProvider' , 'session' => 'SessionServiceProvider' , 'translator' => 'TranslationServiceProvider' , 'validator' => 'ValidatorServiceProvider' , 'form.factory' => 'FormServiceProvider' , 'security.token_storage' => 'Securi... | Checks if all required Service Providers are enabled . |
12,376 | protected function checkOptions ( Container $ app ) { $ requiredOptions = [ 'object_manager' , 'user_class' , 'firewall_name' ] ; foreach ( $ requiredOptions as $ option ) { if ( empty ( $ app [ 'silex_user.options' ] [ $ option ] ) ) { throw new LogicException ( sprintf ( 'The "%s" option must be set' , $ option ) ) ;... | Checks if options are set correctly . |
12,377 | protected function getOption ( Container $ app , $ name ) { if ( isset ( $ app [ 'silex_user.options' ] [ $ name ] ) ) { return $ app [ 'silex_user.options' ] [ $ name ] ; } else { return self :: $ defaultOptions [ $ name ] ; } } | Gets an option or its default value if it is not set . |
12,378 | public function check ( Users $ user , string $ sessionId , string $ userIp , int $ pageId ) : Users { $ currentTime = time ( ) ; $ pageId = ( int ) $ pageId ; $ sql = "SELECT user.*, session.* FROM Baka\Auth\Models\Sessions session, Baka\Auth\Models\Users user WHERE session.id = :session_... | Checks for a given user session tidies session table and updates user sessions at each page refresh |
12,379 | public function clean ( string $ sessionId , $ daemon = false ) : bool { if ( ! $ daemon ) { try { $ queue = $ this -> getDI ( ) -> getQueue ( ) ; $ queue -> putInTube ( getenv ( 'SESSION_QUEUE' ) , $ sessionId ) ; } catch ( Throwable $ e ) { $ this -> di -> getLog ( ) -> error ( $ e -> getMessage ( ) ) ; return false ... | Removes expired sessions and auto - login keys from the database |
12,380 | public function end ( Users $ user ) : bool { $ this -> find ( 'users_id = ' . $ user -> getId ( ) ) -> delete ( ) ; SessionKeys :: find ( 'users_id = ' . $ user -> getId ( ) ) -> delete ( ) ; return true ; } | Terminates the specified session It will delete the entry in the sessions table for this session remove the corresponding auto - login key and reset the cookies |
12,381 | public static function browser ( ) { foreach ( self :: $ _browsers as $ key => $ value ) { if ( preg_match ( $ key , self :: http_user_agent ( ) ) ) { self :: $ _arguments [ 'browser' ] = $ value ; self :: $ _is [ 'browser' ] = TRUE ; self :: mobile ( ) ; break ; } } $ return = "" ; $ return .= self :: $ _arguments [ '... | Checking browsers names |
12,382 | public static function robot ( ) { foreach ( self :: $ _robots as $ key => $ value ) { if ( preg_match ( "|" . preg_quote ( $ key ) . "|i" , self :: $ agent ) ) { self :: $ _is [ 'robot' ] = TRUE ; self :: $ _arguments [ 'robot' ] = $ value ; break ; } } } | Checking robots names |
12,383 | public static function mobile ( ) { foreach ( self :: $ _mobiles as $ key => $ value ) { if ( FALSE !== ( strpos ( mb_strtolower ( self :: http_user_agent ( ) ) , $ key ) ) ) { self :: $ _is [ 'mobile' ] = TRUE ; return self :: $ _arguments [ 'mobile' ] = $ value ; } } } | Checking mobiles names |
12,384 | public static function version ( ) { foreach ( self :: $ _browsers as $ key => $ value ) { if ( preg_match ( $ key , self :: http_user_agent ( ) , $ math ) ) { self :: $ _arguments [ 'version' ] = $ math [ 2 ] ; self :: mobile ( ) ; break ; } } $ return = "" ; $ return .= self :: $ _arguments [ 'version' ] ; $ return .... | Get version as string |
12,385 | private function tokenizeSQL ( $ sql ) : array { $ token = '\\(|\\)|\[|\]|[\']|"|\140|<>|<=|>=|:=|[*\/<>,+=-]' ; $ terminal = $ token . '|;| |\\n' ; $ result = [ ] ; $ string = $ sql ; $ string = ltrim ( $ string ) ; $ string = rtrim ( $ string , ';' ) . ';' ; $ string = preg_replace ( "/[\n\r]/s" , ' ' , $ string ) ; ... | A naive SQL string tokenizer . |
12,386 | protected function isSequence ( $ value ) { if ( ! Helper :: isSequential ( $ value ) ) { return false ; } if ( $ value === [ ] ) { return true ; } $ i = 0 ; $ lastItemType = null ; foreach ( $ value as $ key => $ item ) { if ( $ key !== $ i ) { return false ; } $ itemType = Type :: of ( $ item ) ; if ( $ i !== 0 && $ ... | Return true if the passed value is a sequence ( array or class which have strict numeric keys and every item type is the same . |
12,387 | protected function findModel ( $ id ) { $ user = Page :: findOne ( $ id ) ; if ( $ user === null ) { throw new NotFoundHttpException ( Yii :: t ( 'app' , 'The requested page does not exist' ) ) ; } return $ user ; } | Finds the Page model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
12,388 | public static function timezoneString ( ) { if ( $ timezone = get_option ( 'timezone_string' ) ) { return $ timezone ; } if ( ! $ utc_offset = get_option ( 'gmt_offset' , 0 ) ) { return 'UTC' ; } $ utc_offset *= 3600 ; if ( $ timezone = timezone_name_from_abbr ( '' , $ utc_offset , 0 ) ) { return $ timezone ; } $ is_ds... | Returns the timezone string for a site even if it s set to a UTC offset |
12,389 | public function create ( $ request , $ match ) { $ extra = array ( 'user' => $ request -> user , 'model' => new CMS_Content ( ) ) ; $ form = new CMS_Form_ContentCreate ( $ request -> REQUEST , $ extra ) ; $ extra [ 'model' ] = $ form -> save ( ) ; $ form = new CMS_Form_ContentUpdate ( array_merge ( $ request -> REQUEST... | Creates new content |
12,390 | public function get ( $ request , $ match ) { if ( array_key_exists ( 'id' , $ match ) ) { $ content = Pluf_Shortcuts_GetObjectOr404 ( 'CMS_Content' , $ match [ 'id' ] ) ; } else { $ content = CMS_Shortcuts_GetNamedContentOr404 ( $ match [ 'name' ] ) ; } return $ content ; } | Gets content meta information |
12,391 | public function update ( $ request , $ match ) { $ content = Pluf_Shortcuts_GetObjectOr404 ( 'CMS_Content' , $ match [ 'modelId' ] ) ; if ( ! CMS_Precondition :: isAuthor ( $ request ) ) { throw new Pluf_Exception_PermissionDenied ( 'You are not an author' ) ; } if ( ! CMS_Precondition :: isEditor ( $ request ) && $ re... | Updates meta information of content |
12,392 | public function delete ( $ request , $ match ) { $ content = Pluf_Shortcuts_GetObjectOr404 ( 'CMS_Content' , $ match [ 'modelId' ] ) ; if ( ! CMS_Precondition :: isAuthor ( $ request ) ) { throw new Pluf_Exception_PermissionDenied ( 'You are not an author' ) ; } if ( ! CMS_Precondition :: isEditor ( $ request ) && $ re... | Deletes a content |
12,393 | public function download ( $ request , $ match ) { if ( array_key_exists ( 'modelId' , $ match ) ) { $ content = Pluf_Shortcuts_GetObjectOr404 ( 'CMS_Content' , $ match [ 'modelId' ] ) ; } else { $ content = CMS_Shortcuts_GetNamedContentOr404 ( $ match [ 'name' ] ) ; } $ content -> downloads += 1 ; $ content -> update ... | Download a content |
12,394 | public function findTermTaxonomies ( $ request , $ match ) { $ content = Pluf_Shortcuts_GetObjectOr404 ( 'CMS_Content' , $ match [ 'parentId' ] ) ; $ tt = new CMS_TermTaxonomy ( ) ; Pluf :: loadFunction ( 'Pluf_Shortcuts_GetAssociationTableName' ) ; $ assoc = $ tt -> _con -> pfx . Pluf_Shortcuts_GetAssociationTableName... | Finds term - taxonomies related to a content |
12,395 | public static function extractNamespaces ( ClassLoader $ classLoader ) { $ namespaces = [ ] ; foreach ( $ classLoader -> getPrefixes ( ) as $ namespace => $ directories ) { $ namespaces [ $ namespace ] = $ directories [ 0 ] ; } foreach ( $ classLoader -> getPrefixesPsr4 ( ) as $ namespace => $ directories ) { $ namespa... | Extracts a list of namespaces and directories from the class loader . |
12,396 | public static function structMessage ( array $ meaning ) : string { $ str = "" ; if ( empty ( $ meaning ) ) { return "" ; } foreach ( $ meaning as $ one ) { $ str .= " " . $ one . "\n\n" ; } $ str = "Did you mean one of these ? :\n\n" . $ str ; return ( $ str ) ; } | Struct message with Did you mean message |
12,397 | public function get ( ) : string { $ array = ( new ToArrayConverter ( $ this -> jory , $ this -> minified ) ) -> get ( ) ; if ( empty ( $ array ) ) { $ array = new \ stdClass ( ) ; } else { $ this -> fixEmptyRelationArrays ( $ array ) ; } return json_encode ( $ array ) ; } | Get the Json string based on given Jory object . |
12,398 | protected function processLogs ( $ logs ) { $ redis = $ this -> getConnection ( ) -> getClient ( ) ; foreach ( $ logs as $ log ) { $ item = array ( "level" => $ log [ 1 ] , "category" => $ log [ 2 ] , "time" => $ log [ 3 ] , "message" => $ log [ 0 ] , ) ; $ json = Json :: encode ( $ item ) ; if ( $ this -> useChannel )... | Stores or broadcasts log messages via redis . |
12,399 | public function hasField ( string $ field ) : bool { if ( $ this -> fields === null ) { return false ; } return in_array ( $ field , $ this -> fields ) ; } | Tell if this Jory contains a selected field . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.