idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
7,600
public static function action ( $ action = '' , $ params = array ( ) , $ retain = false ) { if ( $ action == 'index' ) { $ action = '' ; } if ( CCRequest :: current ( ) && ( $ route = CCRequest :: current ( ) -> route ) ) { $ uri = $ route -> uri ; if ( ! is_null ( $ route -> action ) ) { $ uri = substr ( $ uri , 0 , s...
Get the url to a action of the current route
7,601
public static function active ( $ url ) { $ url = parse_url ( $ url , PHP_URL_PATH ) ; if ( empty ( $ url ) ) { return false ; } if ( $ url [ 0 ] !== '/' ) { $ url = static :: to ( $ url ) ; } if ( $ url === '/' ) { return static :: current ( ) == $ url ; } $ cut = substr ( static :: current ( ) , 0 , strlen ( $ url ) ...
Is the given url active? This function ignores the domain and the parameters if the uri matches the current uri true will be returned .
7,602
public static function getData ( $ plugin , $ key = null ) { $ data = self :: _checkData ( $ plugin ) ; if ( empty ( $ data ) && $ path = self :: getManifestPath ( $ plugin ) ) { if ( FS :: isFile ( $ path ) ) { $ plgData = include $ path ; $ plgData = ( array ) $ plgData ; if ( ! empty ( $ plgData ) ) { self :: $ _dat...
Get plugin manifest data .
7,603
public static function getManifestPath ( $ plugin ) { if ( self :: loaded ( $ plugin ) ) { return FS :: clean ( self :: path ( $ plugin ) . DS . self :: PLUGIN_MANIFEST ) ; } return null ; }
Get absolute plugin manifest file path .
7,604
public static function loadList ( array $ plugins ) { foreach ( $ plugins as $ name ) { if ( self :: loaded ( $ name ) ) { continue ; } if ( $ path = self :: _findPlugin ( $ name ) ) { self :: load ( $ name , self :: _getConfigForLoad ( $ path ) ) ; } } }
Load list plugin .
7,605
public static function manifestEvent ( ) { $ args = func_get_args ( ) ; $ callback = array_shift ( $ args ) ; if ( Arr :: key ( $ callback , self :: $ _eventList ) ) { $ callbacks = self :: $ _eventList [ $ callback ] ; foreach ( $ callbacks as $ method ) { call_user_func_array ( $ method , $ args ) ; } } }
Call plugin manifest callbacks .
7,606
public static function unload ( $ plugin = null ) { if ( self :: loaded ( $ plugin ) ) { $ locales = Configure :: read ( 'App.paths.locales' ) ; foreach ( $ locales as $ key => $ path ) { if ( $ path == self :: getLocalePath ( $ plugin ) ) { unset ( $ locales [ $ key ] ) ; } } Configure :: write ( 'App.paths.locales' ,...
Unload the plugin .
7,607
protected static function _addManifestCallback ( $ plugin ) { $ data = Plugin :: getData ( $ plugin ) ; foreach ( $ data as $ name => $ callback ) { if ( self :: _isCallablePluginData ( $ name , $ plugin , $ callback ) && $ plugin !== 'Core' ) { self :: $ _eventList [ $ name ] [ $ plugin ] = $ callback ; } } }
Registration plugin manifest callbacks .
7,608
protected static function _checkData ( $ plugin ) { return ( Arr :: in ( $ plugin , self :: $ _data ) ) ? self :: $ _data [ $ plugin ] : [ ] ; }
Check plugin data .
7,609
protected static function _findPlugin ( $ name ) { $ output = null ; $ paths = App :: path ( 'Plugin' ) ; $ plugin = Configure :: read ( 'plugins.' . $ name ) ; if ( $ plugin !== null ) { return $ plugin ; } foreach ( $ paths as $ path ) { $ plgPath = $ path . $ name . DS ; if ( FS :: isDir ( $ plgPath ) ) { $ output =...
Find plugin dir in registered paths .
7,610
protected static function _getConfigForLoad ( $ path ) { $ config = [ 'autoload' => true ] ; $ routes = $ path . 'config' . DS . Plugin :: FILE_ROUTES ; $ bootstrap = $ path . 'config' . DS . Plugin :: FILE_BOOTSTRAP ; if ( FS :: isFile ( $ bootstrap ) ) { $ config [ 'bootstrap' ] = true ; } if ( FS :: isFile ( $ route...
Get plugin configuration for load plugin .
7,611
protected static function _getPluginData ( array $ data , $ key = null ) { if ( isset ( $ data [ $ key ] ) ) { $ data = $ data [ $ key ] ; } return new Data ( $ data ) ; }
Get current plugin data .
7,612
protected static function _isCallablePluginData ( $ name , $ plugin , $ callback ) { if ( Arr :: in ( $ name , self :: $ _manifestEvents ) && ! isset ( self :: $ _eventList [ $ name ] [ $ plugin ] ) && is_callable ( $ callback ) ) { return true ; } return false ; }
Check manifest param on callable .
7,613
public static function generate ( $ length ) : string { $ sets = [ 'abcdefghjkmnpqrstuvwxyz' , 'ABCDEFGHJKMNPQRSTUVWXYZ' , '23456789' ] ; $ all = '' ; $ password = '' ; foreach ( $ sets as $ set ) { $ password .= $ set [ array_rand ( str_split ( $ set ) ) ] ; $ all .= $ set ; } $ all = str_split ( $ all ) ; for ( $ i =...
Generates user - friendly random password containing at least one lower case letter one uppercase letter and one digit . The remaining characters in the password are chosen at random from those three sets .
7,614
public function stop ( $ marker ) { if ( array_key_exists ( $ marker , $ this -> timers ) ) { $ this -> timers [ $ marker ] -> stop ( ) ; } }
Stop timer with a specific marker .
7,615
public function build ( ) { foreach ( $ this -> timers as $ marker => $ timer ) { $ this -> markers [ $ marker ] = $ timer -> time ( ) ; } arsort ( $ this -> markers ) ; return $ this -> markers ; }
Return sorted times .
7,616
public function calculateTotal ( ) { $ this -> calculateAdjustmentsTotal ( ) ; $ this -> total = ( $ this -> quantity * $ this -> unitPrice ) + $ this -> adjustmentsTotal ; if ( $ this -> total < 0 ) { $ this -> total = 0 ; } return $ this ; }
Calculates the total for the item
7,617
public function addItem ( PricedItemInterface $ item ) { if ( $ this -> hasItem ( $ item ) ) { return $ this ; } foreach ( $ this -> items as $ existingItem ) { if ( $ item -> equals ( $ existingItem ) ) { $ existingItem -> merge ( $ item , false ) ; $ this -> itemsTotal = null ; $ this -> total = null ; return $ this ...
Add an item
7,618
public function removeItem ( PricedItemInterface $ item ) { if ( $ this -> hasItem ( $ item ) ) { $ item -> setContainer ( null ) ; $ this -> items -> removeElement ( $ item ) ; $ this -> itemsTotal = null ; $ this -> total = null ; } return $ this ; }
Remove a given item
7,619
public function calculateItemsTotal ( ) { $ itemsTotal = 0 ; foreach ( $ this -> items as $ item ) { $ itemsTotal += $ item -> getTotal ( ) ; } $ this -> itemsTotal = $ itemsTotal ; return $ this ; }
Calculate the total price for all the items
7,620
public function calculateTotal ( ) { $ this -> total = $ this -> getItemsTotal ( ) + $ this -> getAdjustmentTotal ( ) ; if ( $ this -> total < 0 ) { $ this -> total = 0 ; } return $ this ; }
Calculate the total amount for the whole container
7,621
public function serve401 ( ) { $ response = new Response ( ) ; $ response -> setStatusCode ( Response :: HTTP_UNAUTHORIZED ) ; return $ this -> render ( 'Errors/401' , [ ] , $ response ) ; }
Affichage page 401
7,622
public function serve404 ( ) { $ response = new Response ( ) ; $ response -> setStatusCode ( Response :: HTTP_NOT_FOUND ) ; return $ this -> render ( 'Errors/404' , [ ] , $ response ) ; }
Affichage page 404
7,623
public function serve503 ( ) { $ response = new Response ( ) ; $ response -> setStatusCode ( Response :: HTTP_SERVICE_UNAVAILABLE ) ; $ response -> headers -> set ( 'Retry-After' , 3600 ) ; return $ this -> render ( 'Errors/503' , [ ] , $ response ) ; }
Affichage page 503
7,624
public function removeTrailingSlash ( ) { $ pathInfo = $ this -> app [ 'request' ] -> getPathInfo ( ) ; $ requestUri = $ this -> app [ 'request' ] -> getRequestUri ( ) ; $ url = str_replace ( $ pathInfo , rtrim ( $ pathInfo , ' /' ) , $ requestUri ) ; return $ this -> redirect ( $ url , Response :: HTTP_MOVED_PERMANENT...
Remove trailing slash and redirect permanent
7,625
public function repair_expression ( $ exp ) { $ commands = explode ( ' ' , $ exp ) ; $ commands = array_filter ( $ commands , function ( $ value ) { return ! is_null ( $ value ) ; } ) ; if ( in_array ( $ commands [ 0 ] , $ this -> bracket_starting_commands ) ) { if ( $ commands [ 0 ] == 'each' ) { $ commands [ 0 ] = 'f...
Repair an expression
7,626
private function compile_phptag ( $ view ) { $ that = $ this ; return preg_replace_callback ( '/\{\%(.*?)\%\}/s' , function ( $ match ) use ( $ that ) { $ expression = trim ( $ match [ 1 ] ) ; $ expression = $ that -> repair_expression ( $ expression ) ; return '<?php ' . $ expression . ' ?>' ; } , $ view ) ; }
Search and replace for shortcuts of the php tag
7,627
private function compile_arrays ( $ view ) { $ tokens = token_get_all ( $ view ) ; $ tags = array ( 0 => '' ) ; $ tag_index = 0 ; $ in_tag = false ; foreach ( $ tokens as $ token ) { if ( is_array ( $ token ) ) { if ( $ token [ 0 ] === T_OPEN_TAG ) { $ in_tag = true ; } if ( $ in_tag && ! in_array ( $ token [ 0 ] , arr...
Search and replace vars with . array access
7,628
protected function performInsert ( Builder $ query ) { $ encryptedFields = static :: getEncryptedFields ( ) ; if ( count ( $ encryptedFields ) && ! $ this -> getEncryptKey ( ) ) { throw new \ RuntimeException ( "No encryption key specified" ) ; } $ originalAttributes = $ this -> attributes ; foreach ( $ encryptedFields...
Perform insert with encryption
7,629
protected function newBaseQueryBuilder ( ) { $ connection = $ this -> getConnection ( ) ; return new DatabaseEncryptionQueryBuilder ( $ connection , $ connection -> getQueryGrammar ( ) , $ connection -> getPostProcessor ( ) ) ; }
Get a new query builder instance for the connection . Use the package s DatabaseEncryptionQueryBuilder .
7,630
public static function installed_ships ( ) { $ ships = static :: $ data -> get ( 'installed' , array ( ) ) ; foreach ( $ ships as $ key => $ ship ) { $ ships [ $ key ] = CCROOT . $ ship ; } return $ ships ; }
return all installed ships
7,631
public static function enter ( $ path ) { if ( ! is_array ( $ path ) ) { $ path = array ( $ path ) ; } foreach ( $ path as $ ship ) { $ ship = CCOrbit_Ship :: create ( $ ship ) ; if ( array_key_exists ( $ ship -> name , static :: $ ships ) ) { throw new CCException ( "CCOrbit::enter - {$ship->name} ship already entered...
Add a ship this loads the ship loader file
7,632
public function setId ( $ givenId ) { if ( ! isset ( $ this -> id ) ) { $ this -> id = $ givenId ; } return $ this -> id ; }
Set id of model .
7,633
public function dump ( ) { $ attributes = array ( ) ; if ( $ this -> id ) { $ attributes [ '$id' ] = $ this -> id ; } foreach ( $ this -> attributes as $ key => $ value ) { $ schema = $ this -> schema ( $ key ) ; if ( ! empty ( $ schema [ 'transient' ] ) ) { continue ; } $ attributes [ $ key ] = $ value ; } return $ at...
Dump attributes raw data .
7,634
public function add ( $ key , $ value ) { if ( ! isset ( $ this -> attributes [ $ key ] ) ) { $ this -> attributes [ $ key ] = array ( ) ; } $ this -> attributes [ $ key ] [ ] = $ value ; return $ this ; }
Add an attributes data .
7,635
public function clear ( $ key = null ) { if ( func_num_args ( ) === 0 ) { $ this -> attributes = array ( ) ; } elseif ( $ key === '$id' ) { throw new Exception ( '[Norm/Model] Restricting clear for $id.' ) ; } else { unset ( $ this -> attributes [ $ key ] ) ; } return $ this ; }
Clear attributes value .
7,636
public function sync ( $ attributes ) { if ( isset ( $ attributes [ '$id' ] ) ) { $ this -> state = static :: STATE_ATTACHED ; $ this -> id = $ attributes [ '$id' ] ; } else { foreach ( $ this -> schema ( ) as $ key => $ field ) { if ( $ field -> has ( 'default' ) ) { $ attributes [ $ key ] = $ field [ 'default' ] ; } ...
Sync the existing attributes with new values . After update or insert this method used to modify the existing attributes .
7,637
public function prepare ( $ key , $ value , $ schema = null ) { if ( $ this -> collection ) { return $ this -> collection -> prepare ( $ key , $ value , $ schema ) ; } else { return $ value ; } }
Prepare model to be sync d .
7,638
public function toArray ( $ fetchType = Model :: FETCH_ALL ) { if ( $ fetchType === Model :: FETCH_RAW ) { return $ this -> attributes ; } $ attributes = array ( ) ; if ( empty ( $ this -> attributes ) ) { $ this -> attributes = array ( ) ; } if ( $ fetchType === Model :: FETCH_ALL or $ fetchType === Model :: FETCH_HID...
Get array structure of model
7,639
public function jsonSerialize ( ) { if ( ! Norm :: options ( 'include' ) ) { return $ this -> toArray ( ) ; } $ destination = array ( ) ; $ source = $ this -> toArray ( ) ; $ schema = $ this -> collection -> schema ( ) ; foreach ( $ source as $ key => $ value ) { if ( isset ( $ schema [ $ key ] ) and isset ( $ value ) ...
Implement the json serializer normalizing the data structures .
7,640
public function previous ( $ key = null ) { if ( is_null ( $ key ) ) { return $ this -> oldAttributes ; } return $ this -> oldAttributes [ $ key ] ; }
Get original attributes
7,641
public function schemaByIndex ( $ index ) { $ schema = array ( ) ; foreach ( $ this -> collection -> schema ( ) as $ value ) { $ schema [ ] = $ value ; } return ( empty ( $ schema [ $ index ] ) ) ? null : $ schema [ $ index ] ; }
Get schema configuration by offset name .
7,642
public function format ( $ field = null , $ format = null ) { $ numArgs = func_num_args ( ) ; if ( $ numArgs === 0 ) { $ formatter = $ this -> collection -> option ( 'format' ) ; if ( is_null ( $ formatter ) ) { $ schema = $ this -> schemaByIndex ( 0 ) ; if ( ! is_null ( $ schema ) ) { return ( isset ( $ this [ $ schem...
Format the model to HTML file . Bind it s attributes to view .
7,643
public function endBodyToolbar ( ) { $ this -> _setBeginning ( false ) ; $ toolbar = trim ( ob_get_clean ( ) ) ; if ( is_string ( $ this -> bodyToolbar ) ) { $ this -> bodyToolbar = [ $ this -> bodyToolbar ] ; } $ this -> bodyToolbar [ ] = [ 'body' => $ toolbar , 'options' => $ this -> _bodyToolbarLastOptions , ] ; $ t...
End Body Toolbar
7,644
private function _getBodyToolbar ( ) { if ( $ this -> bodyToolbar !== null ) { Html :: addCssClass ( $ this -> bodyToolbarOptions , 'widget-body-toolbar' ) ; $ toolbars = is_string ( $ this -> bodyToolbar ) ? [ $ this -> bodyToolbar ] : $ this -> bodyToolbar ; foreach ( $ toolbars as $ toolbar ) { if ( is_array ( $ too...
Get body toolbar
7,645
private function getFromConst ( $ line ) { $ eq_pos = strpos ( $ line , '=' ) ; $ semicolon_pos = strrpos ( $ line , ';' ) ; $ constant_name = trim ( substr ( $ line , 6 , $ eq_pos - 6 ) ) ; $ value = trim ( substr ( $ line , $ eq_pos + 1 , $ semicolon_pos - $ eq_pos - 1 ) ) ; return [ $ constant_name , $ this -> getNa...
Return single option from const DB_XYZ defition line
7,646
public function getOptionNameFromDefinition ( $ constant_name ) { if ( $ this -> strStartsWith ( $ constant_name , "'" ) && $ this -> strEndsWith ( $ constant_name , "'" ) ) { return trim ( trim ( $ constant_name , "'" ) ) ; } else { if ( $ this -> strStartsWith ( $ constant_name , '"' ) && $ this -> strEndsWith ( $ co...
Return config option name from defintiion string
7,647
private function getNativeValueFromDefinition ( $ value ) { if ( $ this -> strStartsWith ( $ value , "'" ) && $ this -> strEndsWith ( $ value , "'" ) ) { $ value = trim ( trim ( $ value , "'" ) ) ; } else { if ( $ this -> strStartsWith ( $ value , '"' ) && $ this -> strEndsWith ( $ value , '"' ) ) { $ value = trim ( tr...
Cast declared value to internal type
7,648
private function strStartsWith ( $ string , $ niddle ) { return mb_strtolower ( substr ( $ string , 0 , mb_strlen ( $ niddle ) ) ) == mb_strtolower ( $ niddle ) ; }
Case insensitive string begins with
7,649
private function strEndsWith ( $ string , $ niddle ) { return mb_substr ( $ string , mb_strlen ( $ string ) - mb_strlen ( $ niddle ) , mb_strlen ( $ niddle ) ) == $ niddle ; }
Case insensitive string ends with
7,650
public static function vCard ( $ name , $ address = '' , $ locality = '' , $ state = '' , $ zip = '' , $ email = '' ) { $ items = array ( ) ; $ items [ ] = \ CHtml :: tag ( 'li' , array ( 'class' => 'fn' ) , $ name ) ; $ items [ ] = \ CHtml :: tag ( 'li' , array ( 'class' => 'street-address' ) , $ address ) ; $ items [...
Renders a handy microformat - friendly list for addresses
7,651
public static function inlineList ( $ items , $ htmlOptions = array ( ) ) { $ listItems = array ( ) ; Html :: addCssClass ( $ htmlOptions , 'inline-list' ) ; foreach ( $ items as $ item ) { $ listItems [ ] = \ CHtml :: tag ( 'li' , $ htmlOptions , $ item ) ; } if ( ! empty ( $ listItems ) ) { return \ CHtml :: tag ( 'u...
Renders and inline list
7,652
public static function label ( $ text , $ htmlOptions = array ( ) ) { ArrayHelper :: addValue ( 'class' , 'label' , $ htmlOptions ) ; return \ CHtml :: tag ( 'span' , $ htmlOptions , $ text ) ; }
Renders a Foundation label
7,653
protected function modelHasBeenSaved ( $ saved , $ type , $ request ) { if ( ! $ saved ) { return response ( ) -> json ( [ 'message' => 'Failed to ' . $ type . ' resource' , 'code' => 422 ] , 422 ) ; } $ status = $ request -> ajax ( ) ? 202 : 200 ; if ( $ request -> ajax ( ) ) { return response ( ) -> json ( [ 'message...
This method handles how submitted quests are handle the main related methods for it are POST and .
7,654
public function validatePut ( $ input , $ model , $ model_name ) { return collect ( $ input ) -> filter ( function ( $ value , $ key ) use ( $ model , $ input ) { if ( ! isset ( $ value ) || $ key === '_token' ) { return false ; } if ( isset ( $ model -> $ key ) ) { if ( $ model -> $ key === $ value ) { return false ; ...
This Checks for any values and the _token for csrf and removes it from any blank values and it also removes the _token from the input . If there is a password within the request it will compare it to the current hash .
7,655
private function resolveOrder ( $ routes , $ order ) { if ( isset ( $ routes [ $ order ] ) ) { return $ this -> resolveOrder ( $ routes , $ order + 1 ) ; } else { return $ order ; } }
recursive function to resolve the order of a array of routes . If the order chosen in routing . yml is already in used find the first next order available .
7,656
static public function normaliseValues ( $ array ) { $ array = self :: arrayize ( $ array ) ; if ( ! $ array ) return $ array ; $ minValue = min ( $ array ) ; $ maxValue = max ( $ array ) ; if ( $ maxValue == $ minValue ) { $ minValue -= 1 ; } foreach ( $ array as $ index => $ value ) { $ array [ $ index ] = ( $ value ...
Normalizuje hodnoty v poli do rozsahu &lt ; 0 - 1&gt ;
7,657
public static function get_by_email ( $ email_address ) { $ mysql = bootstrap :: get_library ( 'mysql' ) ; $ sql = "SELECT * FROM `login_passwords` WHERE `email_address` = '%s';" ; $ login = $ mysql :: select ( 'row' , $ sql , $ email_address ) ; if ( empty ( $ login ) ) { return false ; } return new static ( $ login [...
checks whether the given email address match one on file
7,658
public function is_valid ( $ password , $ check_rehash = true ) { if ( password_verify ( $ password , $ this -> data [ 'hash' ] ) == false ) { return false ; } if ( $ check_rehash && password_needs_rehash ( $ this -> data [ 'hash' ] , PASSWORD_DEFAULT ) ) { $ new_hash = self :: hash_password ( $ password ) ; $ this -> ...
check if the password gives access to the login also re - hashes the password hash if the algorithm is out of date
7,659
public function add ( $ user_id , $ email_address , $ password ) { $ mysql = bootstrap :: get_library ( 'mysql' ) ; $ sql = "INSERT INTO `login_passwords` SET `user_id` = %d, `email_address` = '%s';" ; $ binds = [ $ user_id , $ email_address ] ; $ mysql :: query ( $ sql , $ binds ) ; $ login = new static ( $ mysql :: $...
adds a login
7,660
public function set_new_hash ( $ new_hash ) { $ mysql = bootstrap :: get_library ( 'mysql' ) ; $ sql = "UPDATE `login_passwords` SET `hash` = '%s' WHERE `id` = %d;" ; $ binds = [ $ new_hash , $ this -> data [ 'id' ] ] ; $ mysql :: query ( $ sql , $ binds ) ; $ this -> data [ 'hash' ] = $ new_hash ; }
stores a new hash for the current login
7,661
public static function hash_password ( $ password ) { $ exception = bootstrap :: get_library ( 'exception' ) ; if ( mb_strlen ( $ password ) < self :: MINIMUM_LENGTH ) { throw new $ exception ( 'passwords need a minimum length of ' . self :: MINIMUM_LENGTH ) ; } $ hash = password_hash ( $ password , PASSWORD_DEFAULT ) ...
generates a new hash for the given password we wrap the native method to ensure a successful hash
7,662
public function requirementsAction ( ) { $ sAppPath = $ this -> getParameter ( 'kernel.root_dir' ) ; require_once $ sAppPath . '/SymfonyRequirements.php' ; $ symfonyRequirements = new \ SymfonyRequirements ( ) ; $ symfonyRequirements -> addRequirement ( extension_loaded ( 'mcrypt' ) , "Check if mcrypt ist loaded for RS...
Check System Requirements
7,663
public function installAction ( ) { $ form = $ this -> createForm ( new InstallType ( ) , null , array ( 'action' => $ this -> generateUrl ( 'install_process' ) ) ) ; if ( $ this -> container -> getParameter ( 'database_password' ) !== null ) { return $ this -> redirect ( $ this -> generateUrl ( 'login' ) ) ; } else { ...
Display install form
7,664
public function processInstallAction ( Request $ request ) { $ sAppPath = $ this -> getParameter ( 'kernel.root_dir' ) ; require_once $ sAppPath . '/SymfonyRequirements.php' ; if ( $ this -> container -> getParameter ( 'database_password' ) !== null ) { return $ this -> redirect ( $ this -> generateUrl ( 'login' ) ) ; ...
Process provided informations and perform installation
7,665
public static function getVar ( $ name , $ default = null , $ hash = 'default' , $ type = 'none' , $ mask = 0 ) { $ hash = strtoupper ( $ hash ) ; if ( $ hash === 'METHOD' ) { $ hash = strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) ; } $ type = strtoupper ( $ type ) ; $ sig = $ hash . $ type . $ mask ; switch ( $ hash )...
Fetches and returns a given variable .
7,666
public static function get ( $ hash = 'default' , $ mask = 0 ) { $ hash = strtoupper ( $ hash ) ; if ( $ hash === 'METHOD' ) { $ hash = strtoupper ( $ _SERVER [ 'REQUEST_METHOD' ] ) ; } switch ( $ hash ) { case 'GET' : $ input = $ _GET ; break ; case 'POST' : $ input = $ _POST ; break ; case 'FILES' : $ input = $ _FILE...
Fetches and returns a request array .
7,667
public static function set ( $ array , $ hash = 'default' , $ overwrite = true ) { foreach ( $ array as $ key => $ value ) { self :: setVar ( $ key , $ value , $ hash , $ overwrite ) ; } }
Sets a request variable .
7,668
protected static function _cleanVar ( $ var , $ mask = 0 , $ type = null ) { if ( ! ( $ mask & 1 ) && is_string ( $ var ) ) { $ var = trim ( $ var ) ; } if ( $ mask & 2 ) { $ var = $ var ; } elseif ( $ mask & 4 ) { $ safeHtmlFilter = JFilterInput :: getInstance ( null , null , 1 , 1 ) ; $ var = $ safeHtmlFilter -> clea...
Clean up an input variable .
7,669
public function dpi ( EntityMeta $ entityMeta , DCPackage $ dc ) { $ this -> entityMeta = $ entityMeta ; $ this -> dc = $ dc ; return $ this ; }
EntityMeta der Bild - Klasse
7,670
function modify ( & $ tpl , & $ operatorName , & $ operatorParameters , & $ rootNamespace , & $ currentNamespace , & $ operatorValue , & $ namedParameters ) { switch ( $ operatorName ) { case 'opengraph' : { $ operatorValue = $ this -> generateOpenGraphTags ( $ namedParameters [ 'nodeid' ] ) ; break ; } case 'language_...
Executes the operators
7,671
function generateOpenGraphTags ( $ nodeID ) { $ this -> ogIni = eZINI :: instance ( 'ngopengraph.ini' ) ; $ this -> facebookCompatible = $ this -> ogIni -> variable ( 'General' , 'FacebookCompatible' ) ; $ this -> debug = $ this -> ogIni -> variable ( 'General' , 'Debug' ) == 'enabled' ; $ availableClasses = $ this -> ...
Executes opengraph operator
7,672
function processGenericData ( $ contentNode ) { $ returnArray = array ( ) ; $ siteName = trim ( eZINI :: instance ( ) -> variable ( 'SiteSettings' , 'SiteName' ) ) ; if ( ! empty ( $ siteName ) ) { $ returnArray [ 'og:site_name' ] = $ siteName ; } $ urlAlias = $ contentNode -> urlAlias ( ) ; eZURI :: transformURI ( $ u...
Processes literal Open Graph metadata
7,673
function processObject ( $ contentObject , $ returnArray ) { if ( $ this -> ogIni -> hasVariable ( $ contentObject -> contentClassIdentifier ( ) , 'LiteralMap' ) ) { $ literalValues = $ this -> ogIni -> variable ( $ contentObject -> contentClassIdentifier ( ) , 'LiteralMap' ) ; if ( $ this -> debug ) { eZDebug :: write...
Processes Open Graph metadata from object attributes
7,674
function checkRequirements ( $ returnArray ) { $ arrayKeys = array_keys ( $ returnArray ) ; if ( ! in_array ( 'og:title' , $ arrayKeys ) || ! in_array ( 'og:type' , $ arrayKeys ) || ! in_array ( 'og:image' , $ arrayKeys ) || ! in_array ( 'og:url' , $ arrayKeys ) ) { if ( $ this -> debug ) { eZDebug :: writeError ( $ ar...
Checks if all required Open Graph metadata are present
7,675
public function scanFilesInPath ( $ sourcePath ) { $ filePattern = $ this -> filePattern ; if ( strpos ( $ sourcePath , str_replace ( '*' , null , $ filePattern ) ) ) { $ filePattern = $ this -> coverFishHelper -> getFileNameFromPath ( $ sourcePath ) ; } $ facade = new FinderFacade ( array ( $ sourcePath ) , $ this -> ...
scan all files by given path recursively if one php file will be provided within given path this file will be returned in finder format
7,676
public static function & getAuth ( $ instance ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } if ( ! isset ( $ instances [ $ instance ] ) ) { $ name = static :: getNameFromInstance ( $ instance ) ; static :: pluginAutoLoad ( $ name ) ; $ class = '\JFusion\Plugins\\' . $ name . '\Au...
Gets an Authentication Class for the JFusion Plugin
7,677
public static function & getUser ( $ instance ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } if ( ! isset ( $ instances [ $ instance ] ) ) { $ name = static :: getNameFromInstance ( $ instance ) ; static :: pluginAutoLoad ( $ name ) ; $ class = '\JFusion\Plugins\\' . $ name . '\Us...
Gets an User Class for the JFusion Plugin
7,678
public static function & getPlatform ( $ platform , $ instance ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } $ platform = ucfirst ( strtolower ( $ platform ) ) ; if ( ! isset ( $ instances [ $ platform ] [ $ instance ] ) ) { $ name = static :: getNameFromInstance ( $ instance ) ;...
Gets a Forum Class for the JFusion Plugin
7,679
public static function & getHelper ( $ instance ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } if ( ! isset ( $ instances [ $ instance ] ) ) { $ name = static :: getNameFromInstance ( $ instance ) ; static :: pluginAutoLoad ( $ name ) ; $ class = '\JFusion\Plugins\\' . $ name . '\...
Gets a Helper Class for the JFusion Plugin which is only used internally by the plugin
7,680
public static function & getDatabase ( $ jname ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } if ( ! isset ( $ instances [ $ jname ] ) ) { if ( $ jname == 'joomla_int' ) { $ db = self :: getDBO ( ) ; } else { $ params = static :: getParams ( $ jname ) ; $ host = $ params -> get ( ...
Gets an Database Connection for the JFusion Plugin
7,681
public static function & getParams ( $ jname , $ reset = false ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } try { if ( ! isset ( $ instances [ $ jname ] ) || $ reset ) { $ db = self :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> select ( 'params' ) -> from ( '#__jfusion'...
Gets an Parameter Object for the JFusion Plugin
7,682
public static function getPlugins ( $ criteria = 'both' , $ exclude = false , $ status = 2 ) { static $ instances ; if ( ! isset ( $ instances ) ) { $ instances = array ( ) ; } $ db = self :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> select ( '*' ) -> from ( '#__jfusion' ) ; $ key = $ criteria . '_' . $ exclu...
returns array of plugins depending on the arguments
7,683
public static function getPluginNodeId ( $ jname ) { $ params = static :: getParams ( $ jname ) ; $ source_url = $ params -> get ( 'source_url' ) ; return strtolower ( rtrim ( parse_url ( $ source_url , PHP_URL_HOST ) . parse_url ( $ source_url , PHP_URL_PATH ) , '/' ) ) ; }
Gets the jnode_id for the JFusion Plugin
7,684
public static function & getCookies ( ) { static $ instance ; if ( ! isset ( $ instance ) ) { $ instance = new Cookies ( Config :: get ( ) -> get ( 'apikey' ) ) ; } return $ instance ; }
Gets an JFusion cross domain cookie object
7,685
public static function getDbo ( ) { if ( ! self :: $ database ) { $ host = Config :: get ( ) -> get ( 'database.host' ) ; $ user = Config :: get ( ) -> get ( 'database.user' ) ; $ password = Config :: get ( ) -> get ( 'database.password' ) ; $ database = Config :: get ( ) -> get ( 'database.name' ) ; $ prefix = Config ...
Get a database object .
7,686
public static function getLanguage ( ) { if ( ! self :: $ language ) { $ locale = Config :: get ( ) -> get ( 'language.language' ) ; $ debug = Config :: get ( ) -> get ( 'language.debug' ) ; self :: $ language = Language :: getInstance ( $ locale , $ debug ) ; Text :: setLanguage ( self :: $ language ) ; } return self ...
Get a language object .
7,687
public static function _init ( ) { static :: filter ( 'any' , '[a-zA-Z0-9' . ClanCats :: $ config -> get ( 'router.allowed_special_chars' ) . ']' ) ; static :: filter ( 'num' , '[0-9]' ) ; static :: filter ( 'alpha' , '[a-zA-Z]' ) ; static :: filter ( 'alphanum' , '[a-zA-Z0-9]' ) ; CCRouter :: on ( '#404' , function ( ...
Set up the basic uri filters in our static init and also add a default 404 response
7,688
public static function alias ( $ key , $ to = null ) { if ( is_null ( $ to ) || is_array ( $ to ) ) { if ( array_key_exists ( $ key , static :: $ aliases ) ) { if ( is_array ( $ to ) ) { $ return = static :: $ aliases [ $ key ] ; foreach ( $ to as $ rpl ) { $ return = preg_replace ( "/\[\w+\]/" , $ rpl , $ return , 1 )...
Creates an alias to a route or gets one
7,689
public static function events_matching ( $ event , $ rule ) { if ( ! array_key_exists ( $ event , static :: $ events ) ) { return array ( ) ; } $ callbacks = array ( ) ; foreach ( static :: $ events [ $ event ] as $ route => $ events ) { $ rgx = "~^" . str_replace ( '*' , '(.*)' , $ route ) . "$~" ; if ( preg_match ( $...
Get all events matching a rule
7,690
protected static function prepare ( $ routes ) { if ( ClanCats :: $ config -> get ( 'router.flatten_routes' ) ) { $ routes = static :: flatten ( $ routes ) ; } foreach ( $ routes as $ uri => $ route ) { if ( is_string ( $ route ) ) { if ( substr ( $ route , 0 , 1 ) == '#' ) { $ route = static :: $ privates [ $ route ] ...
Prepare the routes assing them to their containers
7,691
protected static function flatten ( $ routes , $ param_prefix = '' ) { $ flattened = array ( ) ; foreach ( $ routes as $ prefix => $ route ) { if ( is_array ( $ route ) && ! is_callable ( $ route ) ) { $ flattened = array_merge ( static :: flatten ( $ route , $ param_prefix . $ prefix . '/' ) , $ flattened ) ; } else {...
Flatten the routes
7,692
protected static function configure ( $ route , $ raw_route ) { if ( is_null ( $ raw_route ) ) { return false ; } if ( is_string ( $ raw_route ) ) { if ( strpos ( $ raw_route , '?' ) !== false ) { $ route -> params = explode ( ',' , CCStr :: suffix ( $ raw_route , '?' ) ) ; $ raw_route = CCStr :: cut ( $ raw_route , '?...
Check and complete a route
7,693
protected function selectionHandler ( ) { $ userCount = count ( $ this -> choices ) ; if ( $ userCount > static :: MAX_USER_CHOICES ) { $ this -> autocomplete ( ) ; } elseif ( $ userCount > 1 ) { $ this -> selector ( ) ; } elseif ( 1 === $ userCount ) { $ this -> editor ( $ this -> choices [ 0 ] ) ; } }
Handle user selection depending on options and user count in db
7,694
protected function selector ( & $ choices = null ) { $ choices = $ choices ? $ choices : $ this -> choices ; $ choices = $ this -> userEditor -> getChoicesAsEmailUsername ( $ choices ) ; $ question = new ChoiceQuestion ( static :: PLEASE_SELECT_A_USER , $ choices ) ; $ selectedUser = $ this -> ask ( $ question ) ; $ us...
Multiple choices user select
7,695
protected function autocomplete ( ) { $ question = new Question ( static :: PLEASE_SELECT_A_USER ) ; $ question -> setAutocompleterValues ( $ this -> userEditor -> getChoicesAsSeparateEmailUsername ( $ this -> choices ) ) ; $ selectedUser = $ this -> ask ( $ question ) ; if ( '' === $ selectedUser ) { return ; } $ user...
Autocomplete user select
7,696
protected function editor ( User $ user ) { $ oldProps = new UserUpdater ( $ user ) ; $ newProps = $ this -> getNewValues ( $ user ) ; $ ln = <<<EOLSummary-------Username: "{$newProps->getUsername()}"Email: "{$newProps->getEmail()}"Password: "{$newProps->getPassword()}"EOL ; $ this -> logger -> block ( $ ln ) ; $ c...
Show user editor
7,697
protected function sendNotification ( $ to , array $ changedValues ) { $ message = \ Swift_Message :: newInstance ( ) -> setSubject ( 'User details updated' ) -> setFrom ( $ this -> getContainer ( ) -> getParameter ( 'fos_user.resetting.email.from_email' ) ) -> setTo ( $ to ) -> setBody ( $ this -> getContainer ( ) -> ...
Send email notification about changes
7,698
protected function getChoiceBySelection ( $ selection ) { preg_match ( '/^[^(]+\(([^\)]+)\)$/' , $ selection , $ matches ) ; if ( count ( $ matches ) < 2 ) { return ; } $ username = $ matches [ 1 ] ; foreach ( $ this -> choices as $ item ) { if ( $ item -> getUsername ( ) === $ username ) { return $ item ; } } return ;...
Find User by username
7,699
protected function getChoiceByUsernameOrEmail ( $ selection ) { foreach ( $ this -> choices as $ item ) { if ( $ item -> getUsername ( ) === $ selection ) { return $ item ; } if ( $ item -> getEmail ( ) === $ selection ) { return $ item ; } } return ; }
Find User by username or email