idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
55,800
public function getEngine ( ) { if ( ! $ this -> _engine ) { $ table = $ this -> _database -> query ( 'SHOW TABLE STATUS LIKE ?' , $ this -> _name ) ; $ this -> _engine = $ table [ 0 ] [ 'engine' ] ; } return $ this -> _engine ; }
Retrieve table engine
55,801
public function setEngine ( $ engine ) { $ this -> _database -> exec ( 'ALTER TABLE ' . $ this -> _database -> prepareIdentifier ( $ this -> _name ) . ' ENGINE = ' . $ this -> _database -> prepareValue ( $ engine , Column :: TYPE_VARCHAR ) ) ; if ( strcasecmp ( $ this -> getEngine ( ) , $ engine ) != 0 ) { throw new \ ...
Set table engine
55,802
protected function unload ( ) { foreach ( $ this -> ial as $ entry ) { if ( isset ( $ entry [ 'TIMER' ] ) ) { $ this -> removeTimer ( $ entry [ 'TIMER' ] ) ; } } }
Frees the resources associated with this module .
55,803
protected function updateUser ( $ nick , $ ident , $ host ) { $ collator = $ this -> connection -> getCollator ( ) ; $ normNick = $ collator -> normalizeNick ( $ nick ) ; $ key = array_search ( $ normNick , $ this -> nicks ) ; if ( $ key === false ) { $ key = $ this -> sequence ++ ; $ this -> nicks [ $ key ] = $ normNi...
Updates the IAL with new information on some user .
55,804
protected function realRemoveUser ( $ nick ) { $ collator = $ this -> connection -> getCollator ( ) ; $ nick = $ collator -> normalizeNick ( $ nick ) ; $ key = array_search ( $ nick , $ this -> nicks ) ; if ( $ key === false ) { return ; } $ this -> ial [ $ key ] [ 'TIMER' ] = null ; if ( ! isset ( $ this -> nicks [ $ ...
Removes some user from the IAL .
55,805
public function handleNick ( \ Erebot \ Interfaces \ EventHandler $ handler , \ Erebot \ Interfaces \ Event \ Nick $ event ) { $ oldNick = ( string ) $ event -> getSource ( ) ; $ newNick = ( string ) $ event -> getTarget ( ) ; $ collator = $ this -> connection -> getCollator ( ) ; $ normOldNick = $ collator -> normaliz...
Handles a nick change .
55,806
public function handleLeaving ( \ Erebot \ Interfaces \ EventHandler $ handler , \ Erebot \ Interfaces \ Event \ Base \ Generic $ event ) { if ( $ event instanceof \ Erebot \ Interfaces \ Event \ Kick ) { $ nick = ( string ) $ event -> getTarget ( ) ; } else { $ nick = ( string ) $ event -> getSource ( ) ; } $ collator...
Handles some user leaving an IRC channel . This may result from either a QUIT or KICK command .
55,807
public function handleCapabilities ( \ Erebot \ Interfaces \ EventHandler $ handler , \ Erebot \ Event \ ServerCapabilities $ event ) { $ module = $ event -> getModule ( ) ; if ( $ module -> hasExtendedNames ( ) ) { $ this -> sendCommand ( 'PROTOCTL NAMESX' ) ; } if ( $ module -> hasUserHostNames ( ) ) { $ this -> send...
Handles server capabilities .
55,808
public function handleNames ( \ Erebot \ Interfaces \ NumericHandler $ handler , \ Erebot \ Interfaces \ Event \ Numeric $ numeric ) { $ text = $ numeric -> getText ( ) ; $ chan = $ text [ 1 ] ; $ users = new \ Erebot \ TextWrapper ( ltrim ( $ numeric -> getText ( ) -> getTokens ( 2 ) , ':' ) ) ; try { $ caps = $ this ...
Handles a list with the nicknames of all users in a given IRC channel .
55,809
public function handleWho ( \ Erebot \ Interfaces \ NumericHandler $ handler , \ Erebot \ Interfaces \ Event \ Numeric $ numeric ) { $ text = $ numeric -> getText ( ) ; $ this -> updateUser ( $ text [ 4 ] , $ text [ 1 ] , $ text [ 2 ] ) ; }
Handles information about some user .
55,810
public function handleJoin ( \ Erebot \ Interfaces \ EventHandler $ handler , \ Erebot \ Interfaces \ Event \ Join $ event ) { $ user = $ event -> getSource ( ) ; $ nick = $ user -> getNick ( ) ; $ collator = $ this -> connection -> getCollator ( ) ; $ normNick = $ collator -> normalizeNick ( $ nick ) ; $ this -> updat...
Handles some user joining an IRC channel the bot is currently on .
55,811
public function handleChanModeAddition ( \ Erebot \ Interfaces \ EventHandler $ handler , \ Erebot \ Interfaces \ Event \ Base \ ChanModeGiven $ event ) { $ user = $ event -> getTarget ( ) ; $ nick = self :: extractNick ( $ user ) ; $ collator = $ this -> connection -> getCollator ( ) ; $ normNick = $ collator -> norma...
Handles someone receiving a new status on an IRC channel for example when someone is OPped .
55,812
public function startTracking ( $ nick , $ cls = '\\Erebot\\Module\\IrcTracker\\Token' ) { $ identityCls = $ this -> getFactory ( '!Identity' ) ; $ fmt = $ this -> getFormatter ( null ) ; if ( $ nick instanceof \ Erebot \ Interfaces \ Identity ) { $ identity = $ nick ; } else { if ( ! is_string ( $ nick ) ) { throw new...
Returns a tracking token for some user .
55,813
public function getInfo ( $ token , $ info , $ args = array ( ) ) { if ( $ token instanceof \ Erebot \ Module \ IrcTracker \ Token ) { $ methods = array ( self :: INFO_ISON => 'isOn' , self :: INFO_MASK => 'getMask' , self :: INFO_NICK => 'getNick' , self :: INFO_IDENT => 'getIdent' , self :: INFO_HOST => 'getHost' , )...
Returns information about some user given a token associated with that user .
55,814
public function isOn ( $ chan , $ nick = null ) { if ( $ nick === null ) { return isset ( $ this -> chans [ $ chan ] ) ; } $ nick = self :: extractNick ( $ nick ) ; $ collator = $ this -> connection -> getCollator ( ) ; $ nick = $ collator -> normalizeNick ( $ nick ) ; $ key = array_search ( $ nick , $ this -> nicks ) ...
Indicates whether some user is present on a given IRC channel .
55,815
public function getCommonChans ( $ nick ) { $ nick = self :: extractNick ( $ nick ) ; $ collator = $ this -> connection -> getCollator ( ) ; $ nick = $ collator -> normalizeNick ( $ nick ) ; $ key = array_search ( $ nick , $ this -> nicks ) ; if ( $ key === false ) { throw new \ Erebot \ NotFoundException ( 'No such us...
Returns a list of IRC channels the bot and some other user have in common .
55,816
public function userPrivileges ( $ chan , $ nick ) { if ( ! isset ( $ this -> chans [ $ chan ] [ $ nick ] ) ) { throw new \ Erebot \ NotFoundException ( 'No such channel or user' ) ; } return $ this -> chans [ $ chan ] [ $ nick ] ; }
Returns channel status associated with the given user .
55,817
public function onKernelController ( FilterControllerEvent $ event ) { if ( ! is_array ( $ controller = $ event -> getController ( ) ) ) { return ; } $ subRequest = $ event -> getRequest ( ) ; if ( $ event -> getRequestType ( ) == HttpKernelInterface :: MASTER_REQUEST ) { return ; } if ( ! $ configuration = $ subReques...
Listener for the Controller call
55,818
public function onKernelResponse ( FilterResponseEvent $ event ) { $ subRequest = $ event -> getRequest ( ) ; if ( $ event -> getRequestType ( ) == HttpKernelInterface :: MASTER_REQUEST ) { return ; } if ( ! $ configuration = $ subRequest -> attributes -> get ( '_andres_montanez_fragment_cache' , false ) ) { return ; }...
Listener for the Response call
55,819
protected function getKey ( FragmentCache $ configuration , Request $ subRequest , Request $ masterRequest ) { $ event = new KeyGenerationEvent ( $ configuration , $ subRequest , $ masterRequest ) ; $ keyRequest = sha1 ( $ subRequest -> getRequestUri ( ) ) . ':' . sha1 ( $ masterRequest -> getRequestUri ( ) ) ; $ key =...
Calculates the cache Key of the Fragment
55,820
public function setAuthMode ( $ mode ) { if ( ! class_exists ( $ mode ) ) { throw new \ Exception ( sprintf ( "Class %s doesn't exists" , $ mode ) ) ; } $ this -> authMode = $ mode ; $ authClass = is_string ( $ mode ) ? new $ mode ( ) : $ mode ; if ( ! $ authClass instanceof SecurityInterface ) { throw new \ Exception ...
Set Authentication Mode .
55,821
public function setAuthDir ( $ dir ) { if ( ! file_exists ( $ dir ) ) { throw new \ Exception ( 'Auth directory is not exists!' ) ; } if ( ! is_dir ( $ dir ) ) { throw new \ Exception ( 'Auth directory is not exists!' ) ; } if ( $ this -> security && $ this -> security -> getKey ( ) ) { throw new \ Exception ( 'Auth di...
Set Authencation Directory .
55,822
public function breadcrumbsAction ( ) { $ default = 'dashboard' ; $ id = $ this -> getRequest ( ) -> getQuery ( 'id' , $ default ) ; $ pos = strpos ( $ id , '/' ) ; $ id = false !== $ pos ? substr ( $ id , 0 , $ pos ) : $ id ; $ view = $ this -> getServiceLocator ( ) -> get ( 'Zend\View\Renderer\PhpRenderer' ) ; $ navi...
Web service per la restituzione di un breadcrumbs in base ad un id
55,823
public function categoriesAction ( ) { $ main = $ this -> getServiceLocator ( ) -> get ( 'neobazaar.service.main' ) ; $ categories = $ main -> getDocumentEntityRepository ( ) -> getCategoryMultioptionsNoSlug ( $ this -> getServiceLocator ( ) ) ; return new JsonModel ( array ( 'data' => $ categories ) ) ; }
Web service per la restituzione delle categorie
55,824
public function locationsAction ( ) { $ main = $ this -> getServiceLocator ( ) -> get ( 'neobazaar.service.main' ) ; $ locations = $ main -> getGeonamesEntityRepository ( ) -> getLocationMultioptions ( $ this -> getServiceLocator ( ) ) ; return new JsonModel ( array ( 'data' => $ locations ) ) ; }
Web service per la restituzione delle locations
55,825
public function activationEmailResendAction ( ) { $ classifiedService = $ this -> getServiceLocator ( ) -> get ( 'document.service.classified' ) ; try { $ ids = $ classifiedService -> activationEmailResend ( 1 ) ; $ data = array ( 'status' => 'success' , 'message' => implode ( ", " , $ ids ) ) ; } catch ( \ Exception $...
This is needed because of mailserver goes down . Will resend activation email to those classifieds where date_insert = date_edit and state = 2 . Dispatch a classified created event with data
55,826
public function sameValueAs ( ValueObjectInterface $ real ) { if ( false === Util :: classEquals ( $ this , $ real ) ) { return false ; } return $ this -> toNative ( ) === $ real -> toNative ( ) ; }
Tells whether two Real are equal by comparing their values
55,827
public function toInteger ( RoundingMode $ rounding_mode = null ) { if ( null === $ rounding_mode ) { $ rounding_mode = RoundingMode :: HALF_UP ( ) ; } $ value = $ this -> toNative ( ) ; $ integerValue = \ round ( $ value , 0 , $ rounding_mode -> toNative ( ) ) ; $ integer = new Integer ( $ integerValue ) ; return $ in...
Returns the integer part of the Real number as a Integer
55,828
public function toNatural ( RoundingMode $ rounding_mode = null ) { $ integerValue = $ this -> toInteger ( $ rounding_mode ) -> toNative ( ) ; $ naturalValue = \ abs ( $ integerValue ) ; $ natural = new Natural ( $ naturalValue ) ; return $ natural ; }
Returns the absolute integer part of the Real number as a Natural
55,829
public function missingMethod ( $ parameters ) { if ( ! app ( ) -> runningInConsole ( ) ) { $ this -> viewPath -> missingMethod ( $ this -> layout -> layout , $ parameters ) ; } return $ this ; }
If a method is not defined try to find it s view .
55,830
public function setViewLayout ( $ view ) { $ this -> layout = $ this -> viewLayout -> change ( $ view ) ; $ this -> layout -> layout = $ this -> viewPath -> setUp ( $ this -> layout -> layout , null ) ; }
Set a custom layout for a page .
55,831
public function setViewPath ( $ view ) { $ this -> layout -> layout = $ this -> viewPath -> setUp ( $ this -> layout -> layout , $ view ) ; return $ this ; }
Override the automatically resolved view .
55,832
protected function _setFactory ( $ factory ) { if ( $ factory !== null && ! ( $ factory instanceof FactoryInterface ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Argument is not a valid factory instance' ) , null , null , $ factory ) ; } $ this -> factory = $ factory ; }
Sets the factory for this instance .
55,833
public function findWhereIn ( array $ parameters ) { $ q = $ this -> getQuery ( ) ; foreach ( $ parameters as $ name => $ value ) { $ q -> whereIn ( $ name , $ value ) ; } return $ q -> get ( ) ; }
Find where in .
55,834
protected static function getClassFromCollection ( array $ collection ) { $ classes = array_unique ( array_map ( 'get_class' , $ collection ) ) ; if ( count ( $ classes ) > 1 ) { throw new \ Exception ( sprintf ( "Can't manage entities in a container with multiple types, these are %s." , implode ( ", " , $ classes ) ) ...
Check a collection only has one class . Determine this and return it .
55,835
public function addRouteMiddleware ( string $ name ) : void { if ( ! array_key_exists ( $ name , $ this -> getConfigRouteMiddlewares ( ) ) ) { throw new InvalidArgumentException ( 'The middleware [' . $ name . '] does not exists.' ) ; } $ this -> routeMiddlewares [ ] = $ this -> getConfigRouteMiddlewares ( ) [ $ name ]...
Add a route middleware to the list of executed middlewares .
55,836
private function createEnv ( ) : void { if ( file_exists ( base_dir ( '.env' ) ) ) { $ dotEnv = new Dotenv ( ) ; $ dotEnv -> load ( base_dir ( '.env' ) ) ; $ this -> env = $ dotEnv ; } }
Create environment .
55,837
private function createRequest ( Request $ request = null ) : void { if ( ! $ this -> request && is_null ( $ request ) ) { $ request = ServerRequest :: fromGlobals ( ) -> withParsedBody ( json_decode ( file_get_contents ( 'php://input' ) ) ) ; } $ this -> container -> set ( Request :: class , $ request ) ; $ this -> re...
Create the request object .
55,838
private function registerErrorHandler ( ) : void { $ whoops = new Run ( ) ; $ whoops -> pushHandler ( new PrettyPageHandler ( ) ) ; $ whoops -> register ( ) ; $ this -> errorHandler = $ whoops ; }
Register the error handler .
55,839
private function registerProviders ( ) : void { $ this -> providers = array_merge ( $ this -> providers , $ this -> getConfigProviders ( ) ) ; foreach ( $ this -> providers as $ provider ) { $ provider = $ this -> container -> get ( $ provider ) ; $ provider -> boot ( ) ; } }
Registers the providers by booting them .
55,840
private function handleRequest ( array $ middlewares ) : void { $ requestHandler = new RequestHandler ( $ this -> container , $ middlewares ) ; $ this -> response = $ requestHandler -> handle ( $ this -> request ) ; }
Handles the request and triggers middlewares .
55,841
public function prepareResponse ( ) { try { $ this -> setBaseMiddlewares ( ) ; $ this -> handleRequest ( $ this -> middlewares ) ; $ this -> router -> build ( ) ; $ this -> handleRequest ( $ this -> routeMiddlewares ) ; $ this -> response = $ this -> router -> run ( ) ; } catch ( Exception $ exception ) { $ response = ...
Prepare the response object .
55,842
private function getEventDefinition ( string $ serialized ) : array { $ definition = $ this -> getDeserializationDefinition ( $ serialized ) ; if ( ! isset ( $ definition [ 'class' ] , $ definition [ 'payload' ] , $ definition [ 'attributes' ] ) || \ count ( \ array_diff ( \ array_keys ( $ definition ) , [ 'class' , 'p...
Get event definition from serialization .
55,843
private function getDeserializationDefinition ( string $ serialized ) : array { if ( \ trim ( $ serialized ) === '' ) { throw new EventSerializationException ( 'Malformed JSON serialized event: empty string' ) ; } $ definition = \ json_decode ( $ serialized , true , 512 , static :: JSON_DECODE_OPTIONS ) ; if ( $ defini...
Get deserialization definition .
55,844
private static function init ( ) { if ( ! self :: $ defaultLng ) { $ config = Application :: getConfigManager ( ) -> loadForModule ( 'Cmf\Language' ) ; self :: $ defaultLng = strtolower ( $ config -> defaultLanguage ) ; $ currentLng = $ config -> currentLanguage ; self :: $ currentLng = $ currentLng ? strtolower ( $ cu...
Initialization of language manager
55,845
public static function getAuthorizationButton ( $ client_id , $ redirect_url , $ state = '' , $ text = 'connect' , $ color = 'blue' , $ caption = 'white' , $ size = 200 , $ url = 'https://runkeeper.com/apps/authorize' ) { $ link = self :: getAuthorizationLink ( $ client_id , $ redirect_url , $ state ) ; $ text = ( in_a...
Generates a button for establishing a connection with a RunKeeper account .
55,846
public static function getAuthorizationLink ( $ client_id , $ redirect_url , $ state = '' , $ url = 'https://runkeeper.com/apps/authorize' ) { $ data = array ( 'client_id' => $ client_id , 'response_type' => 'code' , 'redirect_uri' => $ redirect_url , 'state' => $ state , ) ; return ( string ) \ Guzzle \ Http \ Url :: ...
Generates a link for establishing a connection with a RunKeeper account .
55,847
protected function getSession ( Request $ request ) : Session \ Session { $ session = $ request -> getAttribute ( SessionHandler :: SESSION_ATTRIBUTE ) ; if ( ! $ session instanceof Session \ Session ) { throw new \ Exception ( 'Session not available in request at: ' . SessionHandler :: SESSION_ATTRIBUTE ) ; } return $...
Get session from request
55,848
public function load ( array $ files = array ( ) ) { $ loader = new YamlLoader ( new FileLocator , new YamlParser ) ; foreach ( $ files as $ file ) { $ configValues = $ loader -> load ( $ file ) ; $ configValues = $ this -> loadImports ( $ loader , $ file , $ configValues ) ; $ this -> params = array_replace_recursive ...
Load config files
55,849
public function get ( $ key ) { if ( $ this -> has ( $ key ) ) { return $ this -> params [ $ key ] ; } throw new \ InvalidArgumentException ( sprintf ( "Config key %s doest not exist" , $ key ) ) ; }
Get a config value for a key
55,850
final protected function CreateInUrl ( ) { $ args = $ this -> EditParams ( ) ; $ args [ 'parent' ] = $ this -> item -> GetID ( ) ; return BackendRouter :: ModuleUrl ( new ModuleForm ( ) , $ args ) ; }
The url for creating content in the current item
55,851
final protected function CanEdit ( ) { $ form = $ this -> module -> ContentForm ( ) ; return BackendModule :: Guard ( ) -> Allow ( BackendAction :: Edit ( ) , $ this -> content ) && BackendModule :: Guard ( ) -> Allow ( BackendAction :: Read ( ) , $ form ) ; }
True if the the content can be edited
55,852
final protected function CanCreateIn ( ) { return $ this -> AllowChildren ( ) && BackendModule :: Guard ( ) -> Allow ( BackendAction :: Create ( ) , $ this -> content ) ; }
True if the content can be created in
55,853
final protected function CanCreateAfter ( ) { $ parentItem = $ this -> tree -> ParentOf ( $ this -> item ) ; if ( $ parentItem ) { $ parent = $ this -> tree -> ContentByItem ( $ parentItem ) ; return BackendModule :: Guard ( ) -> Allow ( BackendAction :: Create ( ) , $ parent ) ; } return $ this -> GrantCreateInRoot ( ...
True if there can be content created after
55,854
public function __isset ( $ name ) { return isset ( $ this -> children [ $ name ] ) && ! is_null ( $ this -> children [ $ name ] -> getValue ( ) ) ; }
Check if child set
55,855
public function overwrite ( $ container ) { $ originalValue = $ this -> getValue ( ) ; $ newValue = $ container -> getValue ( ) ; if ( is_null ( $ newValue ) ) { $ resultValue = $ originalValue ; } elseif ( is_array ( $ newValue ) && is_array ( $ originalValue ) ) { $ resultValue = array_replace_recursive ( $ originalV...
Overwrite Container s data
55,856
function input ( array $ formats , $ output = 'array' ) { if ( in_array ( 'post' , $ formats ) ) { $ post = $ this -> context -> web -> requestPostData ( ) ; if ( ! empty ( $ post ) ) { if ( $ output == 'array' ) { return $ post ; } } } if ( in_array ( 'json' , $ formats ) ) { $ input = $ this -> context -> web -> requ...
Given a set of acceptable formats the system tries to retrieve the data format specified and return it in the specified output format . If there is no input the method will return null .
55,857
public function match ( $ url ) { $ url = trim ( $ url , '/' ) ; $ path = preg_replace_callback ( '#:([\w]+)#' , [ $ this , 'paramMatch' ] , $ this -> path ) ; $ regex = "#^$path$#i" ; if ( ! preg_match ( $ regex , $ url , $ matches ) ) { return false ; } array_shift ( $ matches ) ; return $ matches ; }
Test if the current route matches the URL
55,858
public function execute ( $ matches ) { if ( is_string ( $ this -> callable ) ) { $ params = explode ( '#' , $ this -> callable ) ; if ( count ( $ params ) == 2 ) { $ controllerPrefix = $ params [ 0 ] ; $ controllerPrefix = str_replace ( ':' , '\\' , $ controllerPrefix ) ; $ controller = $ controllerPrefix . "Controlle...
Execute the callable of route
55,859
public function getUrl ( $ params ) { $ path = $ this -> path ; foreach ( $ params as $ k => $ v ) { $ path = str_replace ( ":$k" , $ v , $ path ) ; } return $ path ; }
Generate the URL with the parameters
55,860
public function actionAudit ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ model -> setPublished ( ) ; Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , Yii :: t ( 'article' , 'Update success.' ) ) ; return $ this -> redirect ( Url :: previous ( 'actions-redirect' ) ) ; }
Audit an existing Comment model . If Audit is successful the browser will be redirected to the index page .
55,861
public function resolveGuard ( $ name ) { $ config = Config :: get ( 'auth.guards.' . $ name ) ; if ( is_null ( $ config ) ) throw new AccountException ( "Auth guard [" . $ name . "] is not defined in the configuration" ) ; $ uses = $ config [ 'uses' ] ; $ auth = $ this -> resolveAuth ( $ config [ 'auth' ] ? : $ this -...
Resolve the implemented Account Guard
55,862
public function resolveAuth ( $ auth ) { $ config = Config :: get ( 'auth.auths.' . $ auth ) ; $ uses = $ config [ 'uses' ] ; switch ( $ uses ) { case 'database' : { $ auth = new DatabaseAuth ( $ config [ 'table' ] ) ; break ; } case 'eloquent' : { $ auth = new EloquentAuth ( $ config [ 'usrModel' ] , $ config [ 'grpMo...
Resolve the implemented Account Auth
55,863
public function viaRequest ( $ name , callable $ callback ) { $ this -> guards [ $ name ] = new RequestGuard ( $ callback , Request :: i ( ) ) ; }
Register a callback based guard
55,864
protected function editFieldhandlerMethod ( ) { if ( in_array ( $ this -> method , array ( 'validate' , 'sanitize' , 'format' ) ) ) { return $ this ; } throw new InvalidArgumentException ( get_class ( $ this ) . ' passed in invalid Fieldhandler method ' . $ this -> method . ' in FieldhandlerUsageTrait::editFieldhandler...
Edit Method for Fieldhandler Method
55,865
protected function editFieldhandlerAttribute ( $ attribute ) { $ field_name = 'field_' . $ attribute ; $ this -> $ field_name = null ; if ( isset ( $ this -> field [ $ attribute ] ) ) { $ this -> $ field_name = $ this -> field [ $ attribute ] ; return $ this ; } if ( $ attribute === 'value' ) { $ this -> $ field_name =...
Edit Fieldhandler Attribute
55,866
protected function executeConstraint ( array $ options = array ( ) ) { try { $ method = $ this -> method ; return $ this -> fieldhandler -> $ method ( $ this -> field_name , $ this -> field_value , ucfirst ( strtolower ( $ this -> field_type ) ) , $ options ) ; } catch ( Exception $ e ) { throw new RuntimeException ( '...
Execute Fieldhandler Method
55,867
public function initializeObject ( ) { $ querySettings = $ this -> objectManager -> get ( Typo3QuerySettings :: class ) ; $ querySettings -> setIgnoreEnableFields ( false ) ; $ querySettings -> setRespectStoragePage ( false ) ; $ this -> setDefaultQuerySettings ( $ querySettings ) ; }
The life cycle method .
55,868
public function findByUid ( $ uid , array $ querySettings = [ 'respectSysLanguage' => false ] ) { if ( $ uid && $ uid > 0 ) { $ query = $ this -> createquery ( ) ; $ query = $ this -> applyQuerySettings ( $ query , $ querySettings ) ; $ query -> matching ( $ query -> equals ( 'uid' , $ uid ) ) ; $ result = $ query -> e...
Finds objects by UID overrides the default one .
55,869
public function findByUids ( $ uids , array $ querySettings = [ 'respectSysLanguage' => false ] ) { if ( is_string ( $ uids ) ) { $ uids = GeneralUtility :: intExplode ( ',' , $ uids , true ) ; } if ( ! empty ( $ uids ) ) { $ query = $ this -> createquery ( ) ; $ query = $ this -> applyQuerySettings ( $ query , $ query...
Finds objects by multiple UIDs .
55,870
public function getRawObjectByUid ( int $ uid , int $ languageUid = 0 , array $ querySettings = [ 'respectSysLanguage' => false ] ) { if ( $ uid && $ uid > 0 ) { $ query = $ this -> createquery ( ) ; $ settings = $ query -> getQuerySettings ( ) ; $ settings -> setLanguageUid ( $ languageUid ) ; $ query = $ this -> appl...
Gets a raw object by UID .
55,871
public function getRawModelByUid ( int $ uid , int $ languageUid = 0 , array $ querySettings = [ 'respectSysLanguage' => false ] ) { return $ this -> getRawObjectByUid ( $ uid , $ languageUid , $ querySettings ) ; }
Gets a raw model by UID alias for getRawObjectByUid .
55,872
public function findByPid ( int $ pid , int $ limit = 0 , array $ querySettings = [ 'respectSysLanguage' => true ] ) { if ( $ pid && $ pid > 0 ) { $ query = $ this -> createquery ( ) ; $ query = $ this -> applyQuerySettings ( $ query , $ querySettings ) ; $ query -> matching ( $ query -> equals ( 'pid' , $ pid ) ) ; if...
Finds objects by PID .
55,873
public function findByPids ( $ pids , int $ limit = 0 , array $ querySettings = [ 'respectSysLanguage' => true ] ) { if ( is_string ( $ pids ) ) { $ pids = GeneralUtility :: intExplode ( ',' , $ pids , true ) ; } if ( ! empty ( $ pids ) ) { $ query = $ this -> createquery ( ) ; $ query = $ this -> applyQuerySettings ( ...
Finds objects by multiple PIDs .
55,874
protected function applyQuerySettings ( $ query , array $ settings ) { if ( ! empty ( $ settings ) ) { $ respectStoragePage = $ settings [ 'respectStoragePage' ] ; if ( is_bool ( $ respectStoragePage ) ) { $ query -> getQuerySettings ( ) -> setRespectStoragePage ( $ respectStoragePage ) ; } $ respectSysLanguage = $ set...
Applies settings on a query .
55,875
protected function getOrderingsByField ( string $ field , array $ values , string $ order = QueryInterface :: ORDER_DESCENDING ) : array { $ orderings = [ ] ; if ( ! empty ( $ values ) ) { foreach ( $ values as $ value ) { $ orderings [ "$field={$value}" ] = $ order ; } } return $ orderings ; }
Gets the orderings by a field .
55,876
public function serialize ( $ object ) { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( 'Argument must be an object' ) ; } $ reflectedObject = new \ ReflectionObject ( $ object ) ; $ reflectedProperties = $ reflectedObject -> getProperties ( ) ; $ array = array ( ) ; foreach ( $ reflectedPrope...
Convert an object to a mongoable array
55,877
private function getValue ( $ object , \ ReflectionProperty $ property ) { $ value = null ; if ( $ property -> isPublic ( ) ) { $ value = $ property -> getValue ( $ object ) ; } else { $ accessorName = $ this -> formatter -> getPhpAccessor ( $ property -> getName ( ) , false ) ; $ reflectedObject = new \ ReflectionObje...
Return a value for an object property
55,878
private function setValue ( $ object , \ ReflectionProperty $ property , $ value ) { if ( $ property -> isPublic ( ) ) { $ property -> setValue ( $ object , $ value ) ; } else { $ mutatorName = $ this -> formatter -> getPhpMutator ( $ property -> getName ( ) , false ) ; $ reflectedObject = new \ ReflectionObject ( $ ob...
Define a value for an object property
55,879
public function get ( $ idOrDocument , $ type = Document :: DOCUMENT_TYPE_CLASSIFIED ) { $ neobazaarService = $ this -> getServiceLocator ( ) -> get ( 'neobazaar.service.main' ) ; $ classifiedService = $ this -> getServiceLocator ( ) -> get ( 'document.service.classified' ) ; $ documentRepository = $ neobazaarService -...
Fetch the correct model depending on user auth
55,880
public function afterSave ( ) { Yii :: app ( ) -> cache -> delete ( $ this -> theme . '_settings_tweets' ) ; Yii :: app ( ) -> cache -> delete ( $ this -> theme . '_settings_facebook_data' ) ; Yii :: app ( ) -> cache -> delete ( $ this -> theme . '_settings_g+_activities' ) ; return parent :: afterSave ( ) ; }
AfterSave Event Clears the local cache
55,881
public function getTweets ( $ postData = NULL ) { header ( "Content-Type: application/json" ) ; if ( $ this -> twitterHandle == NULL || $ this -> twitterTweetsToFetch == 0 ) return false ; try { $ connection = new TwitterOAuth ( Cii :: getConfig ( 'ha_twitter_key' , NULL , NULL ) , Cii :: getConfig ( 'ha_twitter_secret...
getTweets callback method
55,882
public function getGooglePlusPosts ( $ postData = NULL ) { $ key = Cii :: getConfig ( 'google_plus_public_server_key' ) ; if ( $ key == NULL || $ this -> googlePlusUserId == NULL ) return false ; $ result = Yii :: app ( ) -> cache -> get ( $ this -> theme . '_settings_g+_activities' ) ; if ( $ result == false ) { $ cli...
getGooglePlusPosts callback method Retrieves recent activities from Google +
55,883
protected function generateLink ( $ route , $ params = null ) { if ( $ route instanceof Closure ) { $ route = $ this -> stringify ( $ route ) ; } if ( \ Route :: has ( $ route ) ) { if ( empty ( $ params ) ) { return route ( $ this -> routify ( $ route ) ) ; } else { return route ( $ this -> routify ( $ route ) , $ thi...
This will generate a url relating to the given route whether that is from a raw url or if it is a route . It will also grab the params for the values .
55,884
private function run ( $ callback ) { $ injects = [ ] ; $ reflectionFunction = new \ ReflectionFunction ( $ callback ) ; foreach ( $ reflectionFunction -> getParameters ( ) as $ parameter ) { if ( $ class = $ parameter -> getClass ( ) ) { $ injects [ ] = app ( $ class -> name ) ; } } return call_user_func_array ( $ cal...
This is a dependancy injection function which allows the config function to have new classes without needing them to have a need for actually newing up the new objects .
55,885
function makeRequest ( $ method , $ url , $ apiRequest = null , $ queryString = null ) { $ urlEndPoint = $ this -> config -> getEndpoint ( ) . '/' . $ url ; $ this -> climate -> out ( $ this -> config -> getLoggerPrefix ( ) . 'URL: ' . $ urlEndPoint ) ; $ data = [ 'headers' => [ 'Authorization' => 'Bearer ' . $ this ->...
Make a request to the API using Guzzle
55,886
public function setConfigPath ( $ path ) { if ( file_exists ( $ path ) ) { $ this -> configPath = $ path ; } else { throw new Exception ( 'Configuration file could not be found at ' . htmlspecialchars ( $ path , ENT_QUOTES , 'UTF-8' ) ) ; } }
Sets the path to the configuration file
55,887
protected function _mergeConfig ( $ current , $ successor ) { if ( is_array ( $ current ) and is_array ( $ successor ) ) { foreach ( $ successor as $ key => $ value ) { if ( isset ( $ current [ $ key ] ) and is_array ( $ value ) and is_array ( $ current [ $ key ] ) ) { $ current [ $ key ] = $ this -> _mergeConfig ( $ c...
Merge config hashes recursivly
55,888
public function merge ( EntityMetadata $ metadata ) { $ this -> setType ( $ metadata -> type ) ; $ this -> setAbstract ( $ metadata -> isAbstract ( ) ) ; $ this -> setPolymorphic ( $ metadata -> isPolymorphic ( ) ) ; $ this -> extends = $ metadata -> extends ; $ this -> mergeAttributes ( $ metadata -> getAttributes ( )...
Merges an EntityMetadata instance with this instance . For use with entity class extension .
55,889
public function setType ( $ type ) { if ( ! is_string ( $ type ) || empty ( $ type ) ) { throw MetadataException :: invalidEntityType ( ) ; } $ this -> type = $ type ; return $ this ; }
Sets the entity type .
55,890
private function mergeAttributes ( array $ toAdd ) { $ this -> attributes = array_merge ( $ this -> attributes , $ toAdd ) ; ksort ( $ this -> attributes ) ; return $ this ; }
Merges attributes with this instance s attributes .
55,891
private function mergeRelationships ( array $ toAdd ) { $ this -> relationships = array_merge ( $ this -> relationships , $ toAdd ) ; ksort ( $ this -> relationships ) ; return $ this ; }
Merges relationships with this instance s relationships .
55,892
public function addAttribute ( AttributeMetadata $ attribute ) { if ( isset ( $ this -> relationships [ $ attribute -> getKey ( ) ] ) ) { throw MetadataException :: fieldKeyInUse ( 'attribute' , 'relationship' , $ attribute -> getKey ( ) , $ this -> type ) ; } $ this -> attributes [ $ attribute -> getKey ( ) ] = $ attr...
Adds an attribute field to this entity .
55,893
public function backup ( array $ data , $ model ) { $ directory = gplcart_file_private_module ( 'backup' ) ; if ( ! file_exists ( $ directory ) && ! mkdir ( $ directory , 0775 , true ) ) { return false ; } $ data [ 'type' ] = 'module' ; $ data [ 'name' ] = $ this -> translation -> text ( 'Module @name' , array ( '@name...
Creates a module backup
55,894
public static function flush ( ) { $ html = true ; foreach ( headers_list ( ) as $ header ) { if ( stripos ( $ header , 'content-type:' ) === 0 ) { if ( stripos ( $ header , 'application/javascript' ) !== false || stripos ( $ header , 'text/javascript' ) !== false ) { $ html = false ; } elseif ( stripos ( $ header , 't...
flush the messages to browser by adding to HTML page
55,895
public function execute ( InputInterface $ input , OutputInterface $ output ) { $ this -> output = $ output ; try { $ this -> doExecute ( $ input , $ output ) ; } catch ( \ Exception $ e ) { $ this -> writeException ( $ e ) ; } }
Execute command and type
55,896
protected function write ( $ message , array $ record = array ( ) ) { $ record = array_merge ( $ this -> defautlRecord , $ record ) ; $ record [ 'msg' ] = $ message ; $ this -> output -> writeln ( $ this -> formatter -> format ( $ record ) ) ; }
Write a message with extra record params
55,897
protected function writeException ( \ Exception $ exception , array $ record = array ( ) ) { $ record = array_merge ( $ this -> defautlRecord , $ record ) ; $ this -> output -> writeln ( $ this -> formatter -> formatException ( $ exception , $ record ) ) ; }
Write an exception with extra record params
55,898
public function boot ( Application $ app , ConfigContract & $ appConfig ) { $ appConfig -> set ( 'database.connections.' . $ this -> connection , $ this -> options ) ; $ appConfig -> set ( 'database.default' , $ this -> connection ) ; $ app -> useDatabasePath ( $ this -> path ) ; }
Run setup component .
55,899
public function addContent ( $ content ) { if ( $ content instanceof Page ) { $ this -> addPage ( $ content ) ; } else { if ( $ content ) { $ this -> addChild ( $ content ) ; } else { throw new Exception ( "Unknown content type." ) ; } } }
Add content to site .