idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
8,000
private function renderHiddenInput ( $ responseName , $ responseId ) { $ pattern = '<input type="hidden" %s%s' ; $ closingBracket = $ this -> getInlineClosingBracket ( ) ; $ attributes = $ this -> createAttributesString ( [ 'name' => $ responseName , 'id' => $ responseId , ] ) ; $ response = sprintf ( $ pattern , $ att...
Render hidden input elements for the response
8,001
protected function prepare ( $ match ) { \ ManiaLive \ Utilities \ Logger :: debug ( $ match ) ; $ this -> players = array_fill_keys ( $ match -> players , Services \ PlayerInfo :: PLAYER_STATE_NOT_CONNECTED ) ; $ this -> match = $ match ; $ this -> matchId = $ match -> id ; Label :: EraseAll ( ) ; foreach ( $ match ->...
Prepare the server config to host a match Then wait players connection
8,002
protected function end ( ) { \ ManiaLive \ Utilities \ Logger :: debug ( 'end()' ) ; $ this -> showTansfertLabel ( null , - 50 ) ; foreach ( $ this -> storage -> players as $ player ) { try { $ this -> connection -> sendOpenLink ( ( string ) $ player -> login , '#qjoin=' . $ this -> lobby -> backLink , 1 ) ; } catch ( ...
Free the match for the lobby
8,003
public function makeUnique ( $ id , $ slug ) { $ repo = $ this -> getRepository ( ) ; $ scope = $ this -> getConfig ( 'scope' ) ; foreach ( [ $ repo -> select ( ) -> where ( $ this -> getConfig ( 'slug' ) , $ slug ) , $ repo -> select ( ) -> where ( $ this -> getConfig ( 'slug' ) , 'like' , $ slug . '%' ) ] as $ i => $...
Validate the slug is unique by querying for other slugs . If the slug is not unique append a count to it .
8,004
public function preSave ( Event $ event , Query $ query , $ id , array & $ data ) { $ config = $ this -> allConfig ( ) ; if ( empty ( $ data ) || empty ( $ data [ $ config [ 'field' ] ] ) || ! empty ( $ data [ $ config [ 'slug' ] ] ) ) { return true ; } else if ( $ query -> getType ( ) === Query :: UPDATE && ! $ config...
Before a save occurs generate a unique slug using another field as the base . If no data exists or the base doesn t exist or the slug is already set exit early .
8,005
public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof UserQuery ) { return $ criteria ; } $ query = new UserQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; }
Returns a new UserQuery object .
8,006
public function filterBySalt ( $ salt = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ salt ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ salt ) ) { $ salt = str_replace ( '*' , '%' , $ salt ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsi...
Filter the query on the salt column
8,007
public function filterByFirstname ( $ firstname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ firstname ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ firstname ) ) { $ firstname = str_replace ( '*' , '%' , $ firstname ) ; $ comparison = Criteria :: LIKE...
Filter the query on the firstname column
8,008
public function filterByLastname ( $ lastname = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ lastname ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ lastname ) ) { $ lastname = str_replace ( '*' , '%' , $ lastname ) ; $ comparison = Criteria :: LIKE ; } }...
Filter the query on the lastname column
8,009
public function filterByPhone ( $ phone = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ phone ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ phone ) ) { $ phone = str_replace ( '*' , '%' , $ phone ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> ...
Filter the query on the phone column
8,010
public function filterByMemo ( $ memo = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ memo ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ memo ) ) { $ memo = str_replace ( '*' , '%' , $ memo ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsi...
Filter the query on the memo column
8,011
public function filterByActivated ( $ activated = null , $ comparison = null ) { if ( is_string ( $ activated ) ) { $ activated = in_array ( strtolower ( $ activated ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( UserPeer :: ACTIVATED , $ activated , $ ...
Filter the query on the activated column
8,012
public function filterByLastLogin ( $ lastLogin = null , $ comparison = null ) { if ( is_array ( $ lastLogin ) ) { $ useMinMax = false ; if ( isset ( $ lastLogin [ 'min' ] ) ) { $ this -> addUsingAlias ( UserPeer :: LAST_LOGIN , $ lastLogin [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $...
Filter the query on the last_login column
8,013
private function _set_params ( ) { $ params = \ Request :: route ( 'params' ) ; $ filepath = $ this -> config [ 'abs_path' ] . '/' . \ Request :: route ( 'imagepath' ) ; if ( $ this -> config [ 'enforce_presets' ] && ! in_array ( $ params , $ this -> config [ 'presets' ] ) ) { abort ( 404 ) ; } $ image = new Image ( ) ...
Sets the operations params from the url
8,014
private function _cached_required ( ) { $ image_info = getimagesize ( $ this -> source_file ) ; if ( ( $ this -> url_params [ 'w' ] == $ image_info [ 0 ] ) and ( $ this -> url_params [ 'h' ] == $ image_info [ 1 ] ) ) { $ this -> serve_default = TRUE ; return FALSE ; } return TRUE ; }
Checks that the param dimensions are are lower then current image dimensions
8,015
private function _encoded_filename ( ) { $ ext = strtolower ( pathinfo ( $ this -> source_file , PATHINFO_EXTENSION ) ) ; $ encode = md5 ( $ this -> source_file . http_build_query ( $ this -> url_params ) ) ; $ encoded_name = $ encode . '-' . $ this -> source_modified . '.' . $ ext ; return $ encoded_name ; }
Returns a hash of the filepath and params plus last modified of source to be used as a unique filename
8,016
private function _create_headers ( $ file_data ) { $ last_modified = gmdate ( 'D, d M Y H:i:s' , filemtime ( $ file_data ) ) . ' GMT' ; $ filesystem = new \ Illuminate \ Filesystem \ Filesystem ; $ content_type = $ filesystem -> mimeType ( $ file_data ) ; $ content_length = filesize ( $ file_data ) ; $ expires = gmdate...
Create the image HTTP headers
8,017
private function _modified_headers ( $ last_modified ) { $ modified_since = ( isset ( $ _SERVER [ 'HTTP_IF_MODIFIED_SINCE' ] ) ) ? stripslashes ( $ _SERVER [ 'HTTP_IF_MODIFIED_SINCE' ] ) : FALSE ; if ( ! $ modified_since or $ modified_since != $ last_modified ) return ; header ( 'HTTP/1.1 304 Not Modified' ) ; header (...
Rerurns 304 Not Modified HTTP headers if required and exits
8,018
private function _serve_file ( ) { if ( $ this -> serve_default ) { $ file_data = $ this -> source_file ; } else { $ file_data = $ this -> cached_file ; } $ this -> _output_file ( $ file_data ) ; }
Decide which filesource we are using and serve
8,019
private function _output_file ( $ file_data ) { $ this -> _create_headers ( $ file_data ) ; $ data = file_get_contents ( $ file_data ) ; $ chunk_size = 1024 * 8 ; $ fp = fopen ( 'php://memory' , 'r+b' ) ; fwrite ( $ fp , $ data ) ; rewind ( $ fp ) ; while ( ! feof ( $ fp ) ) { echo fread ( $ fp , $ chunk_size ) ; flush...
Outputs the cached image file and exits
8,020
public function getClient ( ) : ClientInterface { if ( ! isset ( $ this -> client ) ) { $ this -> client = new GuzzleClient ( ) ; } return $ this -> client ; }
Get the Http client .
8,021
public function lookup ( string $ postcode , string $ number ) : array { $ input = [ 'postcode' => $ postcode , 'number' => $ number ] ; $ request = $ this -> request ( $ input ) ; $ response = null ; try { return $ this -> parse ( $ response = $ this -> client -> send ( $ request ) , $ input ) ; } catch ( GuzzleExcept...
Lookup an address by postcode and house number .
8,022
public function remove ( $ key ) { $ file = $ this -> getFile ( $ this -> getKey ( $ key ) ) ; $ file -> delete ( ) ; return $ this ; }
Entfernt die Dateia us dem Cache
8,023
public static function uninstall ( ) { $ results = array ( ) ; $ plugins = Factory :: getPlugins ( 'all' , false , 0 ) ; foreach ( $ plugins as $ plugin ) { $ model = new Plugin ( ) ; $ result = $ model -> uninstall ( $ plugin -> name ) ; $ r = new stdClass ( ) ; $ result [ 'status' ] = 1 ; $ r -> status = $ result [ '...
method to uninstall the component
8,024
protected function renderTools ( ) { $ tools = '' ; if ( $ this -> collapseButton !== false ) { $ tools .= '<a class="collapse-link"><i class="fa fa-chevron-up"></i></a>' ; } if ( $ this -> closeButton !== false ) { $ tools .= '<a class="close-link"><i class="fa fa-times"></i></a>' ; } if ( ! empty ( $ tools ) ) { retu...
Renders the tools
8,025
public static function search ( Userinfo $ userinfo , $ lookup = false ) { $ exsistingUser = null ; if ( $ lookup && $ userinfo -> getJname ( ) !== null ) { $ userPlugin = Factory :: getUser ( $ userinfo -> getJname ( ) ) ; $ exsistingUser = $ userPlugin -> lookupUser ( $ userinfo ) ; } if ( ! $ exsistingUser instanceo...
Finds the first user that match starting with master
8,026
public static function remove ( Userinfo $ userinfo ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> delete ( '#__jfusion_users' ) -> where ( 'userid = ' . $ db -> quote ( $ userinfo -> userid ) ) ; $ db -> setQuery ( $ query ) ; $ db -> execute ( ) ; }
Delete old user data in the lookup table
8,027
public function meta ( ) { $ xml = ( array ) $ this -> xml ; unset ( $ xml [ 'entry' ] ) ; $ xml [ 'link' ] = ( object ) $ xml [ 'link' ] -> { "@attributes" } ; return ( object ) $ xml ; }
Get the meta information of the xml feed
8,028
protected function getXML ( ) { $ key = 'xml_' . md5 ( $ this -> url ) ; if ( $ this -> cache -> has ( $ key ) ) { $ this -> xml = $ this -> cache -> get ( $ key ) ; } else { $ this -> xml = $ this -> fetchXML ( ) ; $ this -> xml = $ this -> changeLinkElements ( $ this -> xml ) ; $ this -> cache -> put ( $ key , $ this...
Get the xml from the server and cache the result
8,029
static function register_assets ( ) { \ wp_enqueue_script ( 'jquery' ) ; \ wp_enqueue_script ( 'jquery-ui' ) ; \ wp_enqueue_script ( 'jquery-ui-datepicker' ) ; \ wp_enqueue_script ( 'jquery-ui-spinner' ) ; \ wp_enqueue_script ( 'jquery-ui-slider' ) ; \ wp_enqueue_script ( 'jquery-ui-resizable' ) ; \ wp_enqueue_script (...
Register Amarkal Scripts and Stylesheets
8,030
function getDefaultUsergroup ( ) { $ usergroups = Groups :: get ( $ this -> getJname ( ) , true ) ; $ groups = array ( ) ; if ( $ usergroups !== null ) { $ list = $ this -> getUsergroupList ( ) ; foreach ( $ list as $ group ) { if ( in_array ( $ group -> id , $ usergroups ) ) { $ groups [ ] = $ group -> name ; } } } re...
Function used to display the default usergroup in the JFusion plugin overview
8,031
function debugConfig ( ) { $ jname = $ this -> getJname ( ) ; $ new_registration = $ this -> allowRegistration ( ) ; if ( $ new_registration ) { $ plugins = Framework :: getSlaves ( ) ; foreach ( $ plugins as $ plugin ) { if ( $ plugin -> name == $ jname ) { Framework :: raise ( LogLevel :: NOTICE , Text :: _ ( 'DISABL...
Function that checks if the plugin has a valid config jerror is used for output
8,032
final public function saveParameters ( $ post , $ wizard = false ) { $ jname = $ this -> getJname ( ) ; $ result = false ; try { if ( ! empty ( $ jname ) ) { $ db = Factory :: getDBO ( ) ; if ( isset ( $ post [ 'source_url' ] ) ) { $ post [ 'source_path' ] = rtrim ( $ post [ 'source_path' ] , '/\\' ) ; $ post [ 'source...
Saves the posted JFusion component variables
8,033
public static function clearInput ( $ input ) { if ( is_array ( $ input ) ) { foreach ( $ input as $ key => $ value ) { if ( ! isset ( $ value ) || $ value === '' ) { unset ( $ input [ $ key ] ) ; } } return $ input ; } return $ input ; }
This will look through the input and remove any unset values .
8,034
public static function apiRoutes ( ) { Route :: group ( [ 'namespace' => 'Kregel\\Warden\\Http\\Controllers' , 'prefix' => config ( 'kregel.warden.route' ) . '/api/v1.0' , 'as' => 'warden::api.' , 'middleware' => config ( 'kregel.warden.auth.middleware_api' ) , ] , function ( $ router ) { Route :: get ( 'media/{model}/...
Define the api routes more dynamically .
8,035
public static function webRoutes ( ) { Route :: group ( [ 'namespace' => 'Kregel\\Warden\\Http\\Controllers' , 'prefix' => config ( 'kregel.warden.route' ) , 'as' => 'warden::' , 'middleware' => config ( 'kregel.warden.auth.middleware' ) , ] , function ( $ router ) { Route :: get ( '/' , function ( ) { return view ( 'w...
Define the web routes more dynamically .
8,036
public static function register ( $ useZepto = false , $ ie8Support = false ) { static :: registerCoreCss ( ) ; static :: registerCoreScripts ( $ useZepto ) ; if ( $ ie8Support ) static :: registerBlockGridIeSupport ( ) ; }
Registers all core css and js scripts for foundation
8,037
public static function registerCoreScripts ( $ useZepto = false , $ minimized = true , $ position = \ CClientScript :: POS_END ) { $ cs = \ Yii :: app ( ) -> getClientScript ( ) ; if ( $ useZepto ) { $ cs -> registerScriptFile ( static :: getAssetsUrl ( ) . '/js/vendor/zepto.js' ) ; } else { $ cs -> registerCoreScript ...
Registers jQuery and Foundation JavaScript .
8,038
public static function isCoreRegistered ( $ minimized = true , $ position = \ CClientScript :: POS_END ) { $ script = $ minimized ? '/js/foundation.min.js' : '/js/foundation/foundation.js' ; return \ Yii :: app ( ) -> getClientScript ( ) -> isScriptFileRegistered ( static :: getAssetsUrl ( ) . $ script , $ position ) ;...
Checks whether the core script has been registered or not
8,039
public static function registerFonts ( $ fonts = array ( ) ) { if ( empty ( $ fonts ) ) return ; foreach ( $ fonts as $ font ) { Icon :: registerIconFontSet ( $ font ) ; } }
Registers foundation fonts
8,040
public static function registerCoreCss ( ) { $ fileName = \ YII_DEBUG ? 'foundation.css' : 'foundation.min.css' ; \ Yii :: app ( ) -> clientScript -> registerCssFile ( static :: getAssetsUrl ( ) . '/css/normalize.css' ) ; \ Yii :: app ( ) -> clientScript -> registerCssFile ( static :: getAssetsUrl ( ) . '/css/' . $ fil...
Registers the Foundation CSS .
8,041
public static function getAssetsUrl ( $ forceCopyAssets = false , $ cdn = false ) { if ( ! isset ( static :: $ assetsUrl ) ) { if ( $ cdn ) { static :: $ assetsUrl = '//cdn.jsdelivr.net/foundation/4.3.1/' ; } else { $ assetsPath = static :: getAssetsPath ( ) ; static :: $ assetsUrl = \ Yii :: app ( ) -> assetManager ->...
Returns the url to the published assets folder .
8,042
public static function registerScriptFile ( $ asset , $ position = \ CClientScript :: POS_END ) { \ Yii :: app ( ) -> clientScript -> registerScriptFile ( static :: getAssetsUrl ( ) . "/{$asset}" , $ position ) ; }
Registers a specific js assets file
8,043
public static function registerBlockGridIeSupport ( $ position = \ CClientScript :: POS_END ) { \ Yii :: app ( ) -> getClientScript ( ) -> registerScript ( __CLASS__ , "(function($){ $(function(){ $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'both'}); $('.block-grid.three-up>li:n...
Registers block - grid support for ie8 if set by its ie8Support attribute .
8,044
public function setMasterVariant ( VariantInterface $ masterVariant ) { $ masterVariant -> setMaster ( true ) ; foreach ( $ this -> variants as $ variant ) { if ( $ variant -> isMaster ( ) && $ variant !== $ masterVariant ) { $ variant -> setMaster ( false ) ; } } if ( ! $ this -> variants -> contains ( $ masterVariant...
Set the master variant
8,045
public function addVariant ( VariantInterface $ variant ) { if ( ! $ this -> hasVariant ( $ variant ) ) { $ variant -> setObject ( $ this ) ; $ this -> variants -> add ( $ variant ) ; } return $ this ; }
Adds a variant
8,046
public function removeVariant ( VariantInterface $ variant ) { if ( $ this -> hasVariant ( $ variant ) ) { $ variant -> setObject ( null ) ; $ this -> variants -> removeElement ( $ variant ) ; } return $ this ; }
Removes a variant
8,047
public function setVariabilityOptions ( Collection $ variabilityOptions ) { foreach ( $ variabilityOptions as $ variabilityOption ) { $ this -> addVariabilityOption ( $ variabilityOption ) ; } return $ this ; }
Sets all variability options
8,048
public function addVariabilityOption ( OptionInterface $ variabilityOption ) { if ( ! $ this -> hasVariabilityOption ( $ variabilityOption ) ) { $ this -> variabilityOptions -> add ( $ variabilityOption ) ; } return $ this ; }
Adds a given variability option
8,049
public function removeVariabilityOption ( OptionInterface $ variabilityOption ) { if ( $ this -> hasVariabilityOption ( $ variabilityOption ) ) { $ this -> variabilityOptions -> removeElement ( $ variabilityOption ) ; } return $ this ; }
Removes a given variability option
8,050
protected function _parseUri ( $ schemeSpecific ) { $ pattern = '~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~' ; $ status = @ preg_match ( $ pattern , $ schemeSpecific , $ matches ) ; if ( $ status === false ) { require_once 'Zend/Uri/Exception.php' ; throw new Zend_Uri_Exception ( 'Internal error: scheme-specific d...
Parse the scheme - specific portion of the URI and place its parts into instance variables .
8,051
public function getUri ( ) { if ( $ this -> valid ( ) === false ) { require_once 'Zend/Uri/Exception.php' ; throw new Zend_Uri_Exception ( 'One or more parts of the URI are invalid' ) ; } $ password = strlen ( $ this -> _password ) > 0 ? ":$this->_password" : '' ; $ auth = strlen ( $ this -> _username ) > 0 ? "$this->_...
Returns a URI based on current values of the instance variables . If any part of the URI does not pass validation then an exception is thrown .
8,052
public function validatePath ( $ path = null ) { if ( $ path === null ) { $ path = $ this -> _path ; } if ( strlen ( $ path ) === 0 ) { return true ; } $ pattern = '/^' . $ this -> _regex [ 'path' ] . '$/' ; $ status = @ preg_match ( $ pattern , $ path ) ; if ( $ status === false ) { require_once 'Zend/Uri/Exception.ph...
Returns true if and only if the path string passes validation . If no path is passed then the path contained in the instance variable is used .
8,053
protected function generateContent ( $ templatePath , $ templateData ) { $ template = $ this -> getTemplate ( $ templatePath ) ; $ content = $ this -> compile ( $ template , $ templateData ) ; return $ content ; }
Generate content with template data is given .
8,054
protected function getTemplate ( $ templatePath ) { $ path = base_path ( 'resources/generator-templates/' . $ templatePath . '.stub' ) ; if ( ! file_exists ( $ path ) ) { $ path = __DIR__ . '/../../templates/' . $ templatePath . '.stub' ; } return $ this -> fileHelper -> get ( $ path ) ; }
Get the template for the generator .
8,055
public function logError ( \ Exception $ e , $ detailLevel = 1 , $ level = 1 ) { if ( $ detailLevel >= 5 ) { return $ this -> log ( "\n" . 'ERROR: ' . \ Psc \ Exception :: getExceptionText ( $ e , 'text' ) ) ; } else { return $ this -> log ( "\n" . 'ERROR: Exception: ' . $ e -> getMessage ( ) , $ level ) ; } }
ab detailLevel > = 5 wird der exceptionTrace mit geloggt
8,056
private function getOnValidate ( \ ReflectionMethod $ method ) { $ valid = $ this -> reader -> getMethodAnnotation ( $ method , Valid :: class ) ; $ class = $ method -> getDeclaringClass ( ) ; $ onMethods = $ this -> findOnMethods ( $ class , $ valid ) ; if ( $ onMethods [ 0 ] && $ onMethods [ 0 ] instanceof \ Reflecti...
Return Validate and OnFailure method
8,057
private function validate ( MethodInvocation $ invocation , \ ReflectionMethod $ onValidate , \ ReflectionMethod $ onFailure = null ) { $ validation = $ onValidate -> invokeArgs ( $ invocation -> getThis ( ) , ( array ) $ invocation -> getArguments ( ) ) ; if ( $ validation instanceof Validation && $ validation -> getM...
Validate with Validate method
8,058
private function getFailure ( MethodInvocation $ invocation , FailureInterface $ failure , \ ReflectionMethod $ onFailure = null ) { if ( $ onFailure ) { return $ onFailure -> invoke ( $ invocation -> getThis ( ) , $ failure ) ; } return $ this -> failureException ( $ invocation , $ failure ) ; }
Return result OnFailure
8,059
private function failureException ( MethodInvocation $ invocation , FailureInterface $ failure ) { $ class = new \ ReflectionClass ( $ invocation -> getThis ( ) ) ; $ className = $ class -> implementsInterface ( WeavedInterface :: class ) ? $ class -> getParentClass ( ) -> name : $ class -> name ; $ errors = json_encod...
Return InvalidArgumentException exception
8,060
public function render ( ElementInterface $ element ) { $ attributes = $ element -> getAttributes ( ) ; $ captcha = $ element -> getCaptcha ( ) ; if ( $ captcha === null || ! $ captcha instanceof CaptchaAdapter ) { throw new Exception \ DomainException ( sprintf ( '%s requires that the element has a "captcha" is an ins...
Render ReCaptcha form elements
8,061
public function redirect ( array $ options = [ ] ) { $ plugin = $ this -> _request -> getParam ( 'plugin' ) ; $ controller = $ this -> _request -> getParam ( 'controller' ) ; $ _options = [ 'apply' => [ ] , 'savenew' => [ 'plugin' => $ plugin , 'controller' => $ controller , 'action' => 'add' ] , 'save' => [ 'plugin' =...
Redirect by request data .
8,062
public function toggleField ( Table $ table , $ id , $ value , $ field = 'status' ) { $ this -> checkIsAjax ( ) ; $ this -> _checkToggleData ( $ id , $ value ) ; $ this -> _controller -> viewBuilder ( ) -> setLayout ( 'ajax' ) -> setTemplate ( 'toggle' ) -> setTemplatePath ( 'Common' ) ; $ entity = $ table -> get ( $ i...
Toggle table field value .
8,063
public function getExtractor ( $ key ) { if ( ! $ this -> hasExtractor ( $ key ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Address extractor with key "%s" does not exist' , $ key ) ) ; } return $ this -> extractors [ $ key ] ; }
Get the extractor for the specified key
8,064
public function validate ( $ addable ) { foreach ( $ addable -> elements as $ element ) { $ classes = class_parents ( $ element ) ; if ( in_array ( "HtmlForm\Elements\Parents\Html" , $ classes ) ) { continue ; } if ( in_array ( "HtmlForm\Abstracts\Addable" , $ classes ) ) { $ moreErrors = $ this -> validate ( $ element...
Runs through the validation required by each form element .
8,065
public static function create ( $ color ) { $ rgb = array ( ) ; if ( is_array ( $ color ) ) { $ color = array_values ( $ color ) ; $ rgb [ 0 ] = $ color [ 0 ] ; $ rgb [ 1 ] = $ color [ 1 ] ; $ rgb [ 2 ] = $ color [ 2 ] ; } elseif ( is_string ( $ color ) && substr ( $ color , 0 , 1 ) == '#' ) { $ color = substr ( $ colo...
parse an color
8,066
public function validationResponse ( \ Psc \ Form \ ValidatorExceptionList $ list , $ format = ServiceResponse :: JSON , MetadataGenerator $ metadataGenerator = NULL ) { if ( $ format === ServiceResponse :: JSON ) { $ body = ( object ) array ( 'errors' => array ( ) ) ; foreach ( $ list -> getExceptions ( ) as $ validat...
Throws an ValidationResponse
8,067
final public function findUser ( Userinfo $ userinfo ) { $ userloopup = $ this -> lookupUser ( $ userinfo ) ; if ( $ userloopup instanceof Userinfo ) { $ user = $ this -> getUser ( $ userloopup ) ; } else { $ user = $ this -> getUser ( $ userinfo ) ; if ( $ user instanceof Userinfo ) { $ this -> updateLookup ( $ user ,...
Gets the userinfo from the JFusion integrated software . it uses the lookup function
8,068
public final function getUserIdentifier ( Userinfo & $ userinfo , $ username_col , $ email_col , $ userid_col , $ lowerEmail = true ) { $ login_identifier = $ this -> params -> get ( 'login_identifier' , 1 ) ; if ( $ this -> getJname ( ) == $ userinfo -> getJname ( ) && $ userinfo -> userid != null ) { $ login_identifi...
Returns the identifier and identifier_type for getUser
8,069
function executeUpdateUsergroup ( Userinfo $ userinfo , Userinfo & $ existinguser ) { $ changed = false ; $ usergroups = $ this -> getCorrectUserGroups ( $ userinfo ) ; if ( ! $ this -> compareUserGroups ( $ existinguser , $ usergroups ) ) { $ this -> updateUsergroup ( $ userinfo , $ existinguser ) ; $ changed = true ;...
Function that determines if the usergroup needs to be updated and executes updateUsergroup if it does
8,070
public function compareUserGroups ( Userinfo $ userinfo , $ usergroups ) { if ( ! is_array ( $ usergroups ) ) { $ usergroups = array ( $ usergroups ) ; } $ correct = false ; $ count = 0 ; if ( count ( $ usergroups ) == count ( $ userinfo -> groups ) ) { foreach ( $ usergroups as $ group ) { if ( in_array ( $ group , $ ...
compare set of usergroup with a user returns true if the usergroups are correct
8,071
function getUserGroupIndex ( Userinfo $ userinfo ) { $ index = 0 ; $ master = Framework :: getMaster ( ) ; if ( $ master ) { $ mastergroups = Groups :: get ( $ master -> name ) ; foreach ( $ mastergroups as $ key => $ mastergroup ) { if ( $ mastergroup ) { if ( count ( $ mastergroup ) == count ( $ userinfo -> groups ) ...
Function That find the correct user group index
8,072
final public function getCorrectUserGroups ( Userinfo $ userinfo ) { $ jname = $ this -> getJname ( ) ; $ group = array ( ) ; $ master = Framework :: getMaster ( ) ; if ( $ master ) { if ( $ master -> name == $ jname ) { $ group = Groups :: get ( $ master -> name , true ) ; } else { $ slavegroups = Groups :: get ( $ jn...
return the correct usergroups for a given user
8,073
final public function lookupUser ( Userinfo $ exsistinginfo ) { $ user = null ; if ( $ exsistinginfo ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> select ( 'b.userid, b.username, b.email' ) -> from ( '#__jfusion_users AS a' ) -> innerJoin ( '#__jfusion_users AS b ON a.id = b.id' ) -> where (...
Returns the userinfo data for JFusion plugin based on the userid
8,074
public function send ( MessageQueueInterface $ messageQueue = null ) { if ( $ messageQueue === null && $ this -> messageQueue === null ) { $ messageQueue = Yii :: $ app -> getMessageQueue ( ) ; } elseif ( $ messageQueue === null ) { $ messageQueue = $ this -> messageQueue ; } return $ messageQueue -> send ( $ this ) ; ...
Sends this message queue message .
8,075
public function getFlash ( $ key ) { return $ this -> started && isset ( $ _SESSION [ $ this -> flashSessionKey ] [ $ key ] ) ? $ _SESSION [ $ this -> flashSessionKey ] [ $ key ] : null ; }
Get data from the current flash messages bag .
8,076
public function setFlash ( $ key , $ value ) { if ( ! $ this -> started ) { return $ this ; } $ _SESSION [ $ this -> nextFlashSessionKey ] [ $ key ] = $ value ; return $ this ; }
Set data to the flash messages bag for the next request .
8,077
public function toNextFlash ( ) { if ( ! $ this -> started ) { return $ this ; } $ _SESSION [ $ this -> flashSessionKey ] = isset ( $ _SESSION [ $ this -> nextFlashSessionKey ] ) ? $ _SESSION [ $ this -> nextFlashSessionKey ] : [ ] ; $ _SESSION [ $ this -> nextFlashSessionKey ] = [ ] ; return $ this ; }
Copy the next flash data to current flash . This should be done in the end of request .
8,078
public function generateCsrfToken ( ) { $ token = hash ( "sha512" , mt_rand ( 0 , mt_getrandmax ( ) ) ) ; $ _SESSION [ $ this -> csrfTokenSessionKey ] = $ token ; return $ token ; }
Generate CSRF token .
8,079
public function validateCsrfToken ( $ token ) { return ( isset ( $ _SESSION [ $ this -> csrfTokenSessionKey ] ) && $ _SESSION [ $ this -> csrfTokenSessionKey ] === $ token ) ; }
Validate with the token stored in session .
8,080
public function RelativeLink ( $ action = null ) { $ remoteObject = $ this -> ContentItem ( ) ; if ( ! is_string ( $ action ) ) { $ action = null ; } if ( $ remoteObject ) { return $ this -> LinkFor ( $ remoteObject , $ action ? $ action : 'view' ) ; } return parent :: RelativeLink ( $ action ) ; }
When linking to this external content page return a URL that ll let you view the external content item directly
8,081
public function ContentItem ( $ what = 'k' ) { if ( $ this -> requestedItem ) { return $ this -> requestedItem ; } if ( ! $ this -> ExternalContentRoot ) { return null ; } $ id = isset ( $ _REQUEST [ 'item' ] ) ? $ _REQUEST [ 'item' ] : null ; if ( ! $ id ) { $ id = $ this -> ExternalContentRoot ; } $ remoteObject = Ex...
Get the external content item
8,082
public function view ( $ request ) { $ object = null ; if ( $ id = $ request -> param ( 'ID' ) ) { $ object = ExternalContent :: getDataObjectFor ( $ id ) ; if ( $ object instanceof ExternalContentSource ) { $ object = $ object -> getRoot ( ) ; } if ( $ object && ( $ object instanceof ExternalContentItem || $ object in...
Display an item .
8,083
public function download ( $ request ) { if ( $ request -> param ( 'ID' ) ) { $ object = ExternalContent :: getDataObjectFor ( $ request -> param ( 'ID' ) ) ; if ( $ object && $ object instanceof ExternalContentItem ) { $ object -> streamContent ( ) ; } } }
Called to download this content item and stream it directly to the browser
8,084
protected static function memoize ( Callable $ f ) { return function ( ... $ args ) use ( $ f ) { static $ cache ; if ( $ cache === null ) $ cache = [ ] ; $ key = serialize ( $ args ) ; if ( array_key_exists ( $ key , $ cache ) ) { return $ cache [ $ key ] ; } else { $ result = call_user_func_array ( $ f , $ args ) ; $...
Memoize a Function
8,085
public function read ( $ name ) { if ( substr ( $ name , 0 , 1 ) == '/' && file_exists ( $ name ) ) { return $ this -> read_file ( $ name ) ; } $ in_namespace = false ; if ( strpos ( $ name , '::' ) !== false ) { $ conf = explode ( '::' , $ name ) ; $ in_namespace = $ conf [ 0 ] ; $ name = $ conf [ 1 ] ; unset ( $ conf...
Read the configuration data Get the configuration data and return them as array
8,086
public function write ( $ file , $ data ) { if ( substr ( $ file , 0 , 1 ) == '/' ) { return $ this -> write_file ( $ file , $ data ) ; } $ this -> write_file ( $ this -> path ( $ file ) , $ data ) ; }
Write the configuration data
8,087
public function delete ( $ file ) { if ( substr ( $ file , 0 , 1 ) == '/' ) { return CCFile :: delete ( $ file ) ; } return CCFile :: delete ( $ this -> path ( $ file ) ) ; }
delete the configuration data
8,088
protected function path ( $ name , $ env = false ) { $ conf = CCPath :: get ( $ name , \ CCDIR_CONFIG , static :: EXT ) ; if ( ! $ env ) { return $ conf ; } $ env_conf = CCPath :: get ( $ name , \ CCDIR_CONFIG . ClanCats :: environment ( ) . '/' , static :: EXT ) ; if ( file_exists ( $ env_conf ) ) { return $ env_conf ...
generates a path for a config name
8,089
public function add ( string $ name , callable $ callback ) : self { if ( $ this -> exists ( $ name ) ) { throw new LogicException ( 'The helper function name "' . $ name . '" is already registered.' ) ; } $ this -> helpers [ $ name ] = $ callback ; return $ this ; }
Add a new template function .
8,090
public function remove ( string $ name ) : self { if ( ! $ this -> exists ( $ name ) ) { throw new LogicException ( 'The template function "' . $ name . '" was not found.' ) ; } unset ( $ this -> helpers [ $ name ] ) ; return $ this ; }
Remove a template function .
8,091
public function isRoleScopePresentOnce ( ExecutionContextInterface $ context ) { $ roleScopesId = array_map ( function ( RoleScope $ roleScope ) { return $ roleScope -> getId ( ) ; } , $ this -> getRoleScopes ( ) -> toArray ( ) ) ; $ countedIds = array_count_values ( $ roleScopesId ) ; foreach ( $ countedIds as $ id =>...
Test that a role scope is associated only once with the permission group
8,092
protected static function macro_og ( $ tags , $ content = null ) { if ( ! is_array ( $ tags ) ) { $ tags = array ( $ tags => $ content ) ; } $ buffer = "" ; foreach ( $ tags as $ key => $ content ) { $ buffer .= '<meta property="og:' . $ key . '" content="' . $ content . '" />' ; } return $ buffer ; }
OG Macro - Generates open grapth tags
8,093
public static function uri ( $ uri , $ name = null ) { if ( strpos ( $ uri , '://' ) === false ) { if ( substr ( $ uri , 0 , 1 ) != '/' ) { $ uri = CCUrl :: to ( static :: holder ( $ name ) -> path . $ uri ) ; } else { $ uri = CCUrl :: to ( substr ( $ uri , 1 ) ) ; } } return $ uri ; }
Get the uri to an asset
8,094
public static function holder ( $ name = null ) { if ( ! isset ( $ name ) ) { $ name = static :: $ _default ; } if ( ! isset ( static :: $ instances [ $ name ] ) ) { static :: $ instances [ $ name ] = new CCAsset_Holder ( ) ; } return static :: $ instances [ $ name ] ; }
Get an asset holder instance .
8,095
public static function code ( $ type , $ name = null ) { $ buffer = "" ; foreach ( static :: holder ( $ name ) -> get ( $ type ) as $ item ) { $ buffer .= call_user_func ( array ( '\\CCAsset' , $ type ) , $ item , $ name ) ; } return $ buffer ; }
Get all assets of a specific type in a holder and run them trough the maching macros .
8,096
public function add ( Task $ task ) : void { $ this -> index ++ ; Util :: put ( $ this -> storage ( ) . $ this -> index . '.queue' , serialize ( $ task ) ) ; $ this -> updateIterator ( ) ; Util :: put ( $ this -> storage ( ) . '_index' , $ this -> index ) ; }
Add new task to queue top
8,097
public function pop ( int $ num ) : Collection { $ ret = new Collection ( ) ; foreach ( $ this -> iterator as $ item ) { if ( ! $ num -- ) return $ ret ; $ ret [ ] = unserialize ( file_get_contents ( $ item ) ) ; unlink ( $ item ) ; } $ this -> updateIterator ( ) ; return $ ret ; }
Get the oldest items from the queue
8,098
public static function getValueSet ( $ colname ) { $ valueSets = RemoteAppPeer :: getValueSets ( ) ; if ( ! isset ( $ valueSets [ $ colname ] ) ) { throw new PropelException ( sprintf ( 'Column "%s" has no ValueSet.' , $ colname ) ) ; } return $ valueSets [ $ colname ] ; }
Gets the list of values for an ENUM column
8,099
public static function getSqlValueForEnum ( $ colname , $ enumVal ) { $ values = RemoteAppPeer :: getValueSet ( $ colname ) ; if ( ! in_array ( $ enumVal , $ values ) ) { throw new PropelException ( sprintf ( 'Value "%s" is not accepted in this enumerated column' , $ colname ) ) ; } return array_search ( $ enumVal , $ ...
Gets the SQL value for the ENUM column value