idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
4,600
public function ProfileController_AddProfileTabs_Handler ( $ Sender ) { if ( Gdn :: Session ( ) -> IsValid ( ) ) { $ Inbox = T ( 'Inbox' ) ; $ InboxHtml = Sprite ( 'SpInbox' ) . ' ' . $ Inbox ; $ InboxLink = '/messages/all' ; if ( Gdn :: Session ( ) -> UserID != $ Sender -> User -> UserID ) { if ( C ( 'Conversations.Mo...
Add Inbox to profile menu .
4,601
public function ProfileController_BeforeProfileOptions_Handler ( $ Sender , $ Args ) { if ( ! $ Sender -> EditMode && Gdn :: Session ( ) -> IsValid ( ) && Gdn :: Session ( ) -> UserID != $ Sender -> User -> UserID ) $ Sender -> EventArguments [ 'MemberOptions' ] [ ] = array ( 'Text' => Sprite ( 'SpMessage' ) . ' ' . T ...
Add Message option to profile options .
4,602
public function Base_Render_Before ( $ Sender ) { if ( $ Sender -> Menu && Gdn :: Session ( ) -> IsValid ( ) ) { $ Inbox = T ( 'Inbox' ) ; $ CountUnreadConversations = GetValue ( 'CountUnreadConversations' , Gdn :: Session ( ) -> User ) ; if ( is_numeric ( $ CountUnreadConversations ) && $ CountUnreadConversations > 0 ...
Add Inbox to global menu .
4,603
public function Setup ( ) { $ Database = Gdn :: Database ( ) ; $ Config = Gdn :: Factory ( Gdn :: AliasConfig ) ; $ Drop = C ( 'Conversations.Version' ) === FALSE ? TRUE : FALSE ; $ Explicit = TRUE ; $ Validation = new Gdn_Validation ( ) ; include ( PATH_APPLICATIONS . DS . 'conversations' . DS . 'settings' . DS . 'str...
Database & config changes to be done upon enable .
4,604
public function bust ( $ manifest = null ) { if ( null === $ this -> busted ) { $ factory = $ this -> getCacheBusterFactory ( ) ; $ this -> busted = $ factory ( $ this ) ; } if ( null !== $ manifest ) { $ this -> busted -> setDefaultManifest ( $ manifest ) ; } return $ this -> busted ; }
decorate object and optionally set default manifest
4,605
public function getCacheBusterFactory ( ) { if ( null === $ this -> cacheBusterFactory ) { $ this -> cacheBusterFactory = function ( $ helper ) { return new CacheBusterDecorator ( $ helper ) ; } ; } return $ this -> cacheBusterFactory ; }
gets decorated instance factory
4,606
public function check ( ... $ args ) { if ( count ( $ args ) !== count ( $ this -> constraints ) ) { throw new InvalidArgumentException ( 'Argument number mismatch.' ) ; } foreach ( $ args as $ key => $ arg ) { if ( ! $ this -> constraints [ $ key ] -> check ( $ arg , $ args ) ) { throw new InvalidArgumentException ( v...
Check that the parameters are met .
4,607
public function header ( $ key , $ value = null ) { if ( is_null ( $ value ) ) { $ pos = strpos ( $ key , ":" ) ; if ( ! $ pos ) { return $ this ; } $ value = substr ( $ key , $ pos + 1 ) ; $ key = substr ( $ key , 0 , $ pos ) ; } $ this -> headers -> set ( $ key , $ value ) ; return $ this ; }
Sets a response header
4,608
public function cache ( $ time = null , $ e_tag = null ) { if ( $ time instanceof \ DateTime ) { $ time = $ time -> getTimestamp ( ) - time ( ) ; } else if ( null === $ time ) { $ time = 3600 * 24 * 7 ; } else { $ time = ( int ) $ time ; } if ( $ time < 1 ) { return $ this ; } $ this -> header ( 'Cache-Control' , 'publ...
Tell the browser the cache time
4,609
public function serialize ( ) { if ( $ this -> getHandler ( ) instanceof Closure ) { throw new LogicException ( 'Cannot serialize handler.' ) ; } return serialize ( array_combine ( static :: $ keys , array_map ( function ( $ key ) { return call_user_func ( [ $ this , 'get' . ucfirst ( $ key ) ] ) ; } , static :: $ keys...
Serializes the route
4,610
public function unserialize ( $ data ) { $ data = unserialize ( $ data ) ; foreach ( static :: $ keys as $ key ) { $ this -> { $ key } = $ data [ $ key ] ; } }
Unserializes the route
4,611
public function process ( ContainerBuilder $ container ) { $ taggedServices = $ container -> findTaggedServiceIds ( $ this -> tagName ) ; foreach ( $ taggedServices as $ id => $ tags ) { $ definition = $ container -> getDefinition ( $ id ) ; foreach ( $ tags as $ tag ) { $ references = $ this -> getSortedDependencies (...
Find services tagged as consumer and process them
4,612
private function configureConsumer ( Definition $ definition , array $ tag , array $ references ) { if ( isset ( $ tag [ 'method' ] ) ) { if ( isset ( $ tag [ 'bulk' ] ) && $ tag [ 'bulk' ] ) { $ definition -> addMethodCall ( $ tag [ 'method' ] , array ( $ references ) ) ; } else { foreach ( $ references as $ name => $...
Configures a consumer with its dependencies
4,613
private function getSortedDependencies ( ContainerBuilder $ container , array $ options ) { $ ordered = array ( ) ; $ unordered = array ( ) ; $ serviceIds = $ container -> findTaggedServiceIds ( $ options [ 'tag' ] ) ; foreach ( $ serviceIds as $ serviceId => $ tags ) { if ( $ options [ 'instanceof' ] ) { $ class = $ c...
Return all tagged services optionally ordered by order attribute .
4,614
public static function register ( LoggerInterface $ logger = null , ErrorConfig $ cfg = null ) { self :: $ registered = true ; $ class = get_called_class ( ) ; $ handler = new $ class ( $ logger , $ cfg ) ; self :: $ lastRegisteredHandler = & $ handler ; set_error_handler ( [ $ handler , 'handle' ] , $ handler -> getEr...
Registers the error handler
4,615
public function handle ( $ errno , $ errstr , $ errfile , $ errline ) { self :: $ lastReported = new Error ( $ errno , $ errstr , $ errfile , $ errline ) ; $ this -> injectCSS ( ) ; $ type = Alo :: ifnull ( Error :: $ map [ $ errno ] , $ errno ) ; $ label = 'danger' ; switch ( $ errno ) { case E_NOTICE : case E_USER_NO...
The error handler
4,616
protected function handleCLI ( $ type , $ label , $ errno , $ errstr , $ errfile , $ errline ) { $ this -> console -> write ( '<' . $ label . 'b>' . $ type . '</>' ) -> write ( '<' . $ label . '>: [' . $ errno . '] ' . $ errstr . '</>' , true ) -> write ( '<' . $ label . '>Raised in </>' ) -> write ( '<' . $ label . 'u...
Generates console output for errors
4,617
protected function handleHTML ( $ type , $ label , $ errno , $ errstr , $ errfile , $ errline ) { ?> <div class="text-center"> <div class="alo-err alert alert- <?= $ label ?> "> <div> <span class="alo-bold"> <?= $ type ?> : </span> <span>[ ...
Generates HTML output for errors
4,618
protected function log ( $ errcode , $ errstr , $ file = null , $ line = null ) { switch ( $ errcode ) { case E_NOTICE : case E_USER_NOTICE : case E_WARNING : case E_USER_WARNING : case E_CORE_WARNING : case E_DEPRECATED : case E_USER_DEPRECATED : $ method = 'warning' ; break ; default : $ method = 'error' ; } $ msg = ...
Logs an error
4,619
public function GetUserPermissions ( $ UserID , $ LimitToSuffix = '' , $ JunctionTable = FALSE , $ JunctionColumn = FALSE , $ ForeignKey = FALSE , $ ForeignID = FALSE ) { $ PermissionColumns = $ this -> PermissionColumns ( $ JunctionTable , $ JunctionColumn ) ; foreach ( $ PermissionColumns as $ ColumnName => $ Value )...
Get the permissions of a user .
4,620
public function GetAllowedPermissionNamespaces ( ) { $ ApplicationManager = new Gdn_ApplicationManager ( ) ; $ EnabledApplications = $ ApplicationManager -> EnabledApplications ( ) ; $ PluginNamespaces = array ( ) ; foreach ( Gdn :: PluginManager ( ) -> EnabledPlugins ( ) as $ Plugin ) { if ( ! array_key_exists ( 'Regi...
Returns a complete list of all enabled applications & plugins . This list can act as a namespace list for permissions .
4,621
public function GetPermissions ( $ RoleID , $ LimitToSuffix = '' ) { $ Result = array ( ) ; $ GlobalPermissions = $ this -> GetGlobalPermissions ( $ RoleID , $ LimitToSuffix ) ; $ Result [ ] = $ GlobalPermissions ; $ JunctionPermissions = $ this -> GetJunctionPermissions ( array ( 'RoleID' => $ RoleID ) , NULL , $ Limi...
Returns all defined permissions not related to junction tables . Excludes permissions related to applications & plugins that are disabled .
4,622
protected function _MergeDisabledPermissions ( & $ GlobalPermissions ) { $ DisabledPermissions = C ( 'Garden.Permissions.Disabled' ) ; if ( ! $ DisabledPermissions ) return ; $ DisabledIn = array ( ) ; foreach ( $ DisabledPermissions as $ JunctionTable => $ Disabled ) { if ( $ Disabled ) $ DisabledIn [ ] = $ JunctionTa...
Merge junction permissions with global permissions if they are disabled .
4,623
public function PermissionColumns ( $ JunctionTable = FALSE , $ JunctionColumn = FALSE ) { $ Key = "{$JunctionTable}__{$JunctionColumn}" ; if ( ! isset ( $ this -> _PermissionColumns [ $ Key ] ) ) { $ SQL = clone $ this -> SQL ; $ SQL -> Reset ( ) ; $ SQL -> Select ( '*' ) -> From ( 'Permission' ) -> Limit ( 1 ) ; if (...
Get all of the permission columns in the system .
4,624
public function Save ( $ Values , $ SaveGlobal = FALSE ) { if ( array_key_exists ( 'PermissionID' , $ Values ) ) { $ Where = array ( 'PermissionID' => $ Values [ 'PermissionID' ] ) ; unset ( $ Values [ 'PermissionID' ] ) ; $ this -> SQL -> Update ( 'Permission' , $ this -> _Backtick ( $ Values ) , $ Where ) -> Put ( ) ...
Save a permission row .
4,625
public static function SplitPermission ( $ PermissionName ) { $ i = strpos ( $ PermissionName , '.' ) ; $ j = strrpos ( $ PermissionName , '.' ) ; if ( $ i !== FALSE ) { return array ( substr ( $ PermissionName , 0 , $ i ) , substr ( $ PermissionName , $ i + 1 , $ j - $ i - 1 ) , substr ( $ PermissionName , $ j + 1 ) )...
Split a permission name into its constituant parts .
4,626
public function getModule ( $ name ) { if ( ! isset ( $ this -> modules [ $ name ] ) ) { throw new ModuleNotFoundException ( ) ; } return $ this -> modules [ $ name ] ; }
Return connected module
4,627
private function getBannerZoneOr404 ( $ bannerZoneId ) { $ bannerZone = $ this -> bannerZoneManager -> findById ( $ bannerZoneId ) ; if ( null === $ bannerZone ) { throw new NotFoundHttpException ( sprintf ( 'Not found %s banner zone' , $ bannerZoneId ) ) ; } return $ bannerZone ; }
Get banner zone or 404 .
4,628
private function getBannerOr404 ( $ bannerId ) { $ banner = $ this -> bannerManager -> findById ( $ bannerId ) ; if ( null === $ banner ) { throw new NotFoundHttpException ( sprintf ( 'Not found %s banner' , $ bannerId ) ) ; } return $ banner ; }
Get banner or 404 .
4,629
public static function loadFromFiles ( array $ files ) { $ checked_files = [ ] ; $ configs = [ ] ; $ config = [ ] ; foreach ( $ files as $ idx => $ file ) { if ( ! file_exists ( $ file ) || ! is_readable ( $ file ) ) { throw new \ Exception ( __METHOD__ . " Cannot locate configuration file: $file" ) ; } $ configs [ $ i...
Create configuration from a regular php file
4,630
public function setMenuId ( $ menuId ) { $ this -> menuId = empty ( $ menuId ) ? null : ( int ) $ menuId ; if ( null !== $ this -> _menu && $ this -> _menu -> id != $ this -> menuId ) { $ this -> _menu = null ; } return $ this ; }
Set menu - id attribute
4,631
public function getMenuModel ( ) { if ( null === $ this -> _menuModel ) { $ this -> _menuModel = $ this -> getServiceLocator ( ) -> get ( 'Grid\Menu\Model\Menu\Model' ) ; } return $ this -> _menuModel ; }
Get menu - model
4,632
public function getMenu ( ) { if ( null === $ this -> _menu && ! empty ( $ this -> menuId ) ) { $ this -> _menu = $ this -> getMenuModel ( ) -> find ( $ this -> menuId ) ; } return $ this -> _menu ; }
Get inner menu
4,633
public function setMenu ( MenuStructureInterface $ menu ) { $ this -> _menu = $ menu ; $ this -> menuId = $ menu -> getId ( ) ; return $ this ; }
Set inner menu
4,634
public function getURL ( ) { return $ this -> scheme . '://' . $ this -> domain . $ this -> path . ( $ this -> parameters ? '?' . http_build_query ( $ this -> parameters ) : '' ) ; }
Get the URL used for this request
4,635
public static function generateFromEnvironment ( ) { $ method = $ _SERVER [ 'REQUEST_METHOD' ] ; if ( ! empty ( $ _SERVER [ 'CONTENT_TYPE' ] ) ) { list ( $ inputType ) = explodeList ( ';' , $ _SERVER [ 'CONTENT_TYPE' ] , 2 ) ; $ inputType = trim ( $ inputType ) ; } else { $ inputType = 'application/x-www-form-urlencode...
Generate HTTPRequest from environment
4,636
public static function handleCurrentRequest ( ) { try { HTTPRoute :: initialize ( ) ; static :: $ mainRequest = static :: generateFromEnvironment ( ) ; $ response = static :: $ mainRequest -> process ( ) ; } catch ( \ Exception $ e ) { $ response = HTMLHTTPResponse :: generateFromException ( $ e ) ; } $ response -> pro...
Handle the current request as a HTTPRequest one This method ends the script
4,637
public function hasDataKey ( $ path = null , & $ value = null ) { $ v = $ this -> getData ( $ path ) ; if ( ! $ v || ! is_array ( $ v ) ) { return false ; } $ value = key ( $ v ) ; return true ; }
Test if path contains a value and return it as parameter
4,638
public function sendNewAccountEmailMessage ( UserInterface $ user ) { $ template = $ this -> parameters [ 'new_account' ] [ 'template' ] ; $ from = $ this -> parameters [ 'new_account' ] [ 'from' ] ; $ content = $ this -> templating -> render ( $ template , [ 'user' => $ user , ] ) ; $ this -> sendEmailMessage ( $ cont...
Send an email to a user showing the new password .
4,639
protected function resolveValue ( $ value ) { $ value = trim ( $ value ) ; if ( is_null ( $ value ) or $ value == '' ) { return null ; } if ( is_numeric ( $ value ) ) { return $ value + 0 ; } elseif ( $ value === 'true' ) { return true ; } elseif ( $ value === 'false' ) { return false ; } elseif ( preg_match ( '#^\[(.+...
Resolve value type
4,640
public function findByCategory ( $ category ) { return $ this -> createQueryBuilder ( 'p' ) -> join ( 'p.categories' , 'c' ) -> where ( 'p.active = true' ) -> andWhere ( 'c.name = :name' ) -> setParameter ( 'name' , $ category ) -> orderBy ( 'p.datePublished' , 'DESC' ) -> getQuery ( ) -> getResult ( ) ; }
Finds all Posts by the given category
4,641
public function findByTag ( $ tag ) { return $ this -> createQueryBuilder ( 'p' ) -> join ( 'p.tags' , 't' ) -> where ( 'p.active = true' ) -> andWhere ( 't.name = :name' ) -> setParameter ( 'name' , $ tag ) -> orderBy ( 'p.datePublished' , 'DESC' ) -> getQuery ( ) -> getResult ( ) ; }
Finds all Posts by the given tag
4,642
public function findByUnique ( $ criteria ) { if ( ! isset ( $ criteria [ 'slug' ] ) ) { return null ; } return $ this -> _em -> createQueryBuilder ( ) -> select ( 'p' ) -> from ( 'VeonikBlogBundle:AbstractPost' , 'p' ) -> where ( 'p.slug = :slug' ) -> setParameter ( 'slug' , $ criteria [ 'slug' ] ) -> getQuery ( ) -> ...
This special method is used by the UniqueEntity validator
4,643
public function findForHome ( ) { return $ this -> _em -> createQueryBuilder ( ) -> select ( 'p, t, c, co' ) -> from ( $ this -> _entityName , 'p' ) -> leftJoin ( 'p.tags' , 't' ) -> leftJoin ( 'p.categories' , 'c' ) -> leftJoin ( 'p.comments' , 'co' ) -> andWhere ( 'p.active = true' ) -> orderBy ( 'p.datePublished' , ...
Find all posts for the home page
4,644
public function findOneBySlug ( $ slug ) { return $ this -> _em -> createQueryBuilder ( ) -> select ( 'p, t, c, co' ) -> from ( 'VeonikBlogBundle:AbstractPost' , 'p' ) -> leftJoin ( 'p.tags' , 't' ) -> leftJoin ( 'p.categories' , 'c' ) -> leftJoin ( 'p.comments' , 'co' ) -> where ( 'p.slug = :slug' ) -> andWhere ( 'p.a...
Find one post by its slug
4,645
public static function fromResource ( $ resource ) { $ newImage = new self ( ) ; try { $ newImage -> setResource ( $ resource ) ; } catch ( \ Exception $ e ) { throw new ImageException ( $ e -> getMessage ( ) , ImageException :: UnsupportedFormatException , $ e ) ; } return $ newImage ; }
Creates new Image object from image resource
4,646
public function setResource ( $ resource ) { $ this -> resource = $ resource ; $ this -> width = imagesx ( $ resource ) ; $ this -> height = imagesy ( $ resource ) ; }
Sets image resource as new image
4,647
private function open ( $ pathToFile ) { $ this -> pathToFile = $ pathToFile ; if ( ! file_exists ( $ this -> pathToFile ) ) { throw new ImageException ( "File " . ( $ this -> pathToFile ) . " not found." , ImageException :: AccessException ) ; } $ tmpImageSize = getimagesize ( $ this -> pathToFile ) ; $ this -> width ...
Loads image file to RAM
4,648
public function resize ( $ width , $ height ) { $ width = ( int ) $ width ; $ height = ( int ) $ height ; $ tmpImage = imagecreatetruecolor ( $ width , $ height ) ; imagefilledrectangle ( $ tmpImage , 0 , 0 , $ width , $ height , $ this -> backgroundColor ) ; imagecopyresampled ( $ tmpImage , $ this -> resource , 0 , 0...
Changes the image resolution
4,649
public function crop ( array $ rectangle ) { $ croppedImage = @ imagecrop ( $ this -> resource , $ rectangle ) ; if ( $ croppedImage === false ) { $ rectangleAsString = "{" ; foreach ( $ rectangle as $ key => $ value ) { $ rectangleAsString .= "\"{$key}\" => {$value}, " ; } $ rectangleAsString = preg_replace ( "/, $/" ...
Crops image via rectangle
4,650
public function join ( self $ secondImage , $ position = self :: RightBottom ) { if ( $ secondImage -> Width > $ this -> Width || $ secondImage -> Height > $ this -> Height ) { throw new ImageException ( "Cannot insert bigger {$secondImage} into smaller {$this}." , ImageException :: OutOfRangeException ) ; } switch ( $...
Joins images together
4,651
public function show ( ) { switch ( $ this -> type ) { case self :: GIF : header ( "Content-Type: image/gif" ) ; imagegif ( $ this -> resource ) ; break ; case self :: JPG : header ( "Content-Type: image/jpeg" ) ; imagejpeg ( $ this -> resource , null , $ this -> jpgQuality ) ; break ; case self :: PNG : header ( "Cont...
Sends image resource to standard output
4,652
public function save ( $ pathToFile = null , $ type = null , $ jpgQuality = null ) { if ( $ pathToFile === null ) $ pathToFile = $ this -> pathToFile ; if ( $ type === null ) $ type = $ this -> type ; if ( $ jpgQuality === null ) $ jpgQuality = $ this -> jpgQuality ; switch ( $ type ) { case self :: GIF : imagegif ( $ ...
Saves image resource to file
4,653
private function setBackgroundColor ( $ backgroundColor ) { $ this -> backgroundColor = ( int ) $ backgroundColor ; $ tmpImage = imagecreatetruecolor ( $ this -> width , $ this -> height ) ; imagefilledrectangle ( $ tmpImage , 0 , 0 , $ this -> width , $ this -> height , $ this -> backgroundColor ) ; imagecopy ( $ tmpI...
Sets background color
4,654
private function setTransparent ( $ color ) { $ this -> transparentColor = $ color ; imagecolortransparent ( $ this -> resource , ( int ) $ this -> transparentColor ) ; }
Sets transparent color
4,655
private function setJpgQuality ( $ jpgQuality ) { if ( $ jpgQuality < 1 || $ jpgQuality > 100 ) { throw new ImageException ( "Value must be between 1 and 100." , ImageException :: OutOfRangeException ) ; } $ this -> jpgQuality = ( int ) $ jpgQuality ; }
Sets JPG quality
4,656
function setListeners ( array $ listeners ) { if ( $ this -> isInitialize ( ) ) throw new \ Exception ( 'The Listeners can\'t attached after Application Initialized.' ) ; foreach ( $ listeners as $ listener ) $ this -> listeners [ ] = $ listener ; return $ this ; }
Set Application Listeners
4,657
function setServiceManagerConfig ( array $ smConfig ) { if ( $ this -> sm instanceof ServiceLocatorInterface ) throw new \ Exception ( 'Service Config is used on first time instancing, ' . 'Service Manager is configured for now you must use "getServiceManager()"' ) ; $ this -> def_sm_config = Core \ array_merge ( $ thi...
Set Service Manager Configs ! Setup Method
4,658
function config ( ) { if ( ! $ this -> configuration || ! $ this -> configuration instanceof Entity ) $ this -> configuration = new Entity ( ) ; return $ this -> configuration ; }
Get Application Config
4,659
function getServiceManager ( ) { if ( ! $ this -> sm || ! $ this -> sm instanceof ServiceLocatorInterface ) $ this -> sm = new ServiceManager ( new ConfigureService ( $ this -> def_sm_config ) ) ; if ( ! $ this -> sm -> has ( 'ServiceManager' ) ) $ this -> sm -> setService ( 'ServiceManager' , $ this -> sm ) ; if ( ! $...
Get the locator object
4,660
protected function __completeRequest ( MvcEvent $ event ) { $ event -> setTarget ( $ this ) ; $ events = $ this -> getEventManager ( ) ; $ events -> trigger ( MvcEvent :: EVENT_RENDER , $ event ) ; $ events -> trigger ( MvcEvent :: EVENT_FINISH , $ event ) ; }
Complete the request
4,661
public function aroundAuthorize ( \ Magento \ Sales \ Model \ Order \ Payment \ Processor $ subject , \ Closure $ proceed , \ Magento \ Sales \ Api \ Data \ OrderPaymentInterface $ payment , $ isOnline , $ amount ) { $ amountToPay = $ amount ; $ order = $ payment -> getOrder ( ) ; $ quoteId = $ order -> getQuoteId ( ) ...
Decrease authorization amount for partial payments .
4,662
public function aroundCapture ( \ Magento \ Sales \ Model \ Order \ Payment \ Processor $ subject , \ Closure $ proceed , \ Magento \ Sales \ Api \ Data \ OrderPaymentInterface $ payment , \ Magento \ Sales \ Api \ Data \ InvoiceInterface $ invoice = null ) { if ( $ invoice ) { $ order = $ payment -> getOrder ( ) ; $ q...
Decrease captured amount for partial payments .
4,663
public function getAll ( ) { if ( ! $ this -> skipCriteria ) { foreach ( $ this -> getterCriteria as $ criteria ) { $ this -> repository = $ this -> repository -> pushCriteria ( app ( $ criteria ) ) ; } } if ( ! $ this -> skipRelations ) { $ this -> repository = $ this -> repository -> with ( $ this -> relations ) ; } ...
Get all games
4,664
public function paginate ( ) { if ( ! $ this -> skipCriteria ) { foreach ( $ this -> getterCriteria as $ criteria ) { $ this -> repository = $ this -> repository -> pushCriteria ( app ( $ criteria ) ) ; } } if ( ! $ this -> skipRelations ) { $ this -> repository = $ this -> repository -> with ( $ this -> relations ) ; ...
Paginate all entities
4,665
public function renderView ( ) { $ config = $ this -> getAppContextProperty ( "config" ) ; $ globalUser = $ this -> getAppContextProperty ( "globalUser" ) ; $ pages = $ this -> getAppContextProperty ( "pages" ) ; $ page = $ this -> getAppContextProperty ( "page" ) ; $ data = $ this -> getAppContextProperty ( "data" ) ;...
Displays the response as HTML
4,666
public function setView ( $ viewFile , $ isAdmin = false ) { $ config = $ this -> getAppContextProperty ( "config" ) ; $ fullPath = ( ( $ isAdmin ) ? $ this -> getAdminViewPath ( ) : $ this -> getViewPath ( ) ) . ( $ this -> getViewDirectory ( ) ? "{$this->getViewDirectory()}/" : '' ) . "{$viewFile}.view.php" ; if ( is...
Sets the view tasked with presenting the page specific response
4,667
public function getAppContextProperty ( $ name ) { if ( isset ( $ this -> appContext [ $ name ] ) ) { return $ this -> appContext [ $ name ] ; } return null ; }
Returns the requested appContext variable
4,668
public function getOptionDefaults ( ) { $ values = array ( ) ; foreach ( $ this -> options as $ option ) { $ values [ $ option -> getName ( ) ] = $ option -> getDefault ( ) ; } return $ values ; }
Gets an array of default values .
4,669
public function createAction ( Request $ request ) { $ form = $ this -> getForm ( ) ; if ( 'POST' == $ request -> getMethod ( ) ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ this -> getManager ( ) -> create ( $ form -> getData ( ) ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ...
Create repository action
4,670
public function editAction ( Repo $ repo = null ) { if ( ! $ repo ) { return new RedirectResponse ( $ this -> generateUrl ( 'snide_travinizer_dashboard' ) ) ; } $ form = $ this -> getForm ( $ repo ) ; return array ( 'form' => $ form -> createView ( ) , 'repo' => $ repo , 'slug' => $ repo -> getSlug ( ) , 'errors' => ar...
Edit repository action
4,671
public function updateAction ( Repo $ repo ) { $ form = $ this -> getForm ( ) ; $ slug = $ repo -> getSlug ( ) ; $ form -> handleRequest ( $ this -> get ( 'request' ) ) ; $ repo = $ form -> getData ( ) ; if ( $ form -> isValid ( ) ) { $ this -> getManager ( ) -> update ( $ repo ) ; $ this -> get ( 'session' ) -> getFla...
Update application action
4,672
public function deleteAction ( Repo $ repo ) { if ( $ repo ) { $ this -> getManager ( ) -> delete ( $ repo ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'Repository has been deleted successfully' ) ; } else { $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'error' , 'This repository do...
Delete application action
4,673
protected function getForm ( $ repo = null ) { if ( $ repo == null ) { $ repo = $ this -> getManager ( ) -> createNew ( ) ; } return $ this -> createForm ( $ this -> container -> get ( 'snide_travinizer.form.repo_type' ) , $ repo ) ; }
Create repo Form and submit it with repo instance
4,674
public function param ( $ name , $ value = '' ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ n => $ v ) $ this -> param ( $ n , $ v ) ; return $ this ; } foreach ( $ this -> filters as $ filter_file ) { if ( $ this -> files -> exists ( $ filter_file ) != true ) $ this -> error -> make ( 'File %s not found' , $ ...
Registrar parametro do template
4,675
protected function getPresenter ( ) { if ( $ this -> hasPresenter ( ) ) { if ( ! $ this -> presenterInstance ) { $ this -> presenterInstance = new $ this -> presenter ( $ this ) ; } } else { if ( ! $ this -> presenterInstance ) { $ this -> presenterInstance = new Presenter ( $ this ) ; } } return $ this -> presenterIns...
Instanciate a new Presenter for this Model or get the previously cached one .
4,676
public static function htmlToPlainText ( $ html ) { $ html = str_replace ( "\xC2\xA0" , ' ' , html_entity_decode ( $ html ) ) ; $ text = strip_tags ( $ html ) ; $ text = preg_replace ( '/\s+/S' , ' ' , $ text ) ; return $ text ; }
Converts HTML to plain text .
4,677
public function paginate ( AdapterInterface $ adapter , PaginatedCollectionRequestInterface $ paginationInfo = null ) { if ( is_null ( $ paginationInfo ) ) { if ( is_null ( $ this -> paginationInfoProvider ) ) { throw new \ LogicException ( 'A PaginatedCollectionRequestProviderInterface must be injected if you want to ...
Build a Pagerfanta object based on the pagination information .
4,678
public function normalize ( string $ input ) : string { $ output = preg_replace_callback ( self :: $ pattern , function ( $ matches ) { $ int = $ matches [ 'int' ] ; switch ( $ matches [ 'time' ] ) { case 's' : $ t = ( $ int == 1 ) ? ' second ' : ' seconds ' ; break ; case 'm' : $ t = ( $ int == 1 ) ? ' minute ' : ' mi...
Turns any non - strtotime - compatible time string into a compatible one . If the passed input has trailing data it won t be lost since within the callback the input is reassembled . However no leading data is accepted .
4,679
public function hydrate ( array $ data , $ objectOrClass , array $ map = null ) { if ( \ is_object ( $ objectOrClass ) ) { $ object = $ objectOrClass ; $ reflection = $ this -> getReflection ( \ get_class ( $ object ) ) ; } else { $ reflection = $ this -> getReflection ( $ objectOrClass ) ; $ object = $ reflection -> n...
create or update object properties with data
4,680
public function extract ( $ object , array $ map = null ) : array { $ result = [ ] ; $ className = \ get_class ( $ object ) ; $ reflection = $ this -> getReflection ( $ className ) ; if ( ! \ is_array ( $ map ) || ! $ map ) { $ propertyList = $ this -> getReflectionPropertyList ( $ className ) ; $ map = \ array_combine...
extract object properties to data
4,681
private function GenerateOutput ( $ href ) { array_push ( $ this -> Attributes , HtmlAttribute :: Instanciate ( HtmlAttributeConstants :: Href , $ href ) ) ; $ this -> HtmlOutput = '<link rel="stylesheet" type="text/css" {0} />' ; HtmlControlBuildHelper :: Init ( ) -> GenerateAttributes ( $ this ) ; }
Generates a link html tag to include a stylesheet in the DOM
4,682
protected function missingInformation ( ) { foreach ( $ this -> required as $ data => $ value ) { if ( ! isset ( $ this -> settings [ $ data ] ) ) { throw new MissingInformationExpception ( NULL , $ value ) ; } } }
Protected missing information
4,683
protected function loadFromRegistry ( string $ key ) { return array_key_exists ( $ key , $ this -> registry ) ? $ this -> registry [ $ key ] : null ; }
Loads an object instance from registry
4,684
protected function addToRegistry ( $ data , string $ key = null ) { is_null ( $ key ) and $ key = get_class ( $ data ) ; $ this -> registry [ $ key ] = $ data ; }
Adds an object instance to registry
4,685
public function ClearCache ( $ ConfigFile ) { $ FileKey = sprintf ( Gdn_Configuration :: CONFIG_FILE_CACHE_KEY , $ ConfigFile ) ; if ( Gdn :: Cache ( ) -> Type ( ) == Gdn_Cache :: CACHE_TYPE_MEMORY && Gdn :: Cache ( ) -> ActiveEnabled ( ) ) { Gdn :: Cache ( ) -> Remove ( $ FileKey , array ( Gdn_Cache :: FEATURE_NOPREFI...
Clear cache entry for this config file
4,686
public function & Find ( $ Name , $ Create = TRUE ) { $ Array = & $ this -> Data ; if ( $ Name == '' ) return $ Array ; $ Keys = explode ( '.' , $ Name ) ; if ( ! $ this -> Splitting ) { $ FirstKey = GetValue ( 0 , $ Keys ) ; if ( $ FirstKey == $ this -> DefaultGroup ) $ Keys = array ( array_shift ( $ Keys ) , implode ...
Finds the data at a given position and returns a reference to it .
4,687
public function GetSource ( $ Type , $ Identifier ) { $ SourceTag = "{$Type}:{$Identifier}" ; if ( ! array_key_exists ( $ SourceTag , $ this -> Sources ) ) return FALSE ; return $ this -> Sources [ $ SourceTag ] ; }
Get a reference to the internal ConfigurationSource for a given type and ID
4,688
public function Set ( $ Name , $ Value , $ Overwrite = TRUE , $ Save = TRUE ) { if ( ! is_array ( $ this -> Data ) ) $ this -> Data = array ( ) ; if ( ! is_array ( $ Name ) ) { $ Name = array ( $ Name => $ Value ) ; } else { $ Overwrite = $ Value ; } $ Data = $ Name ; foreach ( $ Data as $ Name => $ Value ) { $ Keys = ...
Assigns a setting to the configuration array .
4,689
public function Load ( $ File , $ Name = 'Configuration' , $ Dynamic = FALSE ) { $ ConfigurationSource = Gdn_ConfigurationSource :: FromFile ( $ this , $ File , $ Name ) ; if ( ! $ ConfigurationSource ) return FALSE ; $ UseSplitting = $ this -> Splitting ; $ ConfigurationSource -> Splitting ( $ UseSplitting ) ; if ( ! ...
Loads an array of settings from a file into the object with the specified name ;
4,690
public function LoadString ( $ String , $ Tag , $ Name = 'Configuration' , $ Dynamic = TRUE , $ SaveCallback = NULL , $ CallbackOptions = NULL ) { $ ConfigurationSource = Gdn_ConfigurationSource :: FromString ( $ this , $ String , $ Tag , $ Name ) ; if ( ! $ ConfigurationSource ) return FALSE ; $ UseSplitting = $ this ...
Loads settings from a string into the object with the specified name ;
4,691
protected static function MergeConfig ( & $ Data , & $ Loaded ) { foreach ( $ Loaded as $ Key => $ Value ) { if ( array_key_exists ( $ Key , $ Data ) && is_array ( $ Data [ $ Key ] ) && is_array ( $ Value ) ) { self :: MergeConfig ( $ Data [ $ Key ] , $ Value ) ; } else { $ Data [ $ Key ] = $ Value ; } } }
Merge a newly loaded config into the current active state
4,692
public function OverlayDynamic ( ) { if ( $ this -> Dynamic instanceof Gdn_ConfigurationSource ) self :: MergeConfig ( $ this -> Data , $ this -> Dynamic -> Export ( ) ) ; }
Re - apply the settings from the current dynamic config source
4,693
public function AssignCallback ( $ Callback , $ Options = NULL ) { if ( ! is_callable ( $ Callback ) ) return FALSE ; $ this -> Callback = $ Callback ; $ this -> CallbackOptions = $ Options ; }
Set a save callback
4,694
public static function FromFile ( $ Parent , $ File , $ Name = 'Configuration' ) { $ LoadedFromCache = FALSE ; $ UseCache = FALSE ; if ( $ Parent && $ Parent -> Caching ( ) ) { $ FileKey = sprintf ( Gdn_Configuration :: CONFIG_FILE_CACHE_KEY , $ File ) ; if ( Gdn :: Cache ( ) -> Type ( ) == Gdn_Cache :: CACHE_TYPE_MEMO...
Load config fata from a file
4,695
public static function FromString ( $ Parent , $ String , $ Tag , $ Name = 'Configuration' ) { $ ConfigurationData = self :: ParseString ( $ String , $ Name ) ; if ( $ ConfigurationData === FALSE ) throw new Exception ( 'Could not parse config string.' ) ; return new Gdn_ConfigurationSource ( $ Parent , 'string' , $ Ta...
Load config data from a string
4,696
public function bind ( $ key , $ item ) { if ( is_array ( $ item ) ) { $ this -> classes [ $ key ] = $ item ; } else { $ this -> registry -> set ( $ key , $ item ) ; } }
Binds an existing object or an object definition to a key in the container .
4,697
public function setParameter ( $ key , $ value ) { $ path = explode ( '.' , $ key ) ; $ this -> validateParameter ( $ key , $ value ) ; $ root = array ( ) ; $ r = & $ root ; foreach ( $ path as $ subNode ) { $ r [ $ subNode ] = array ( ) ; $ r = & $ r [ $ subNode ] ; } $ r = $ value ; $ r = & $ root ; if ( $ this -> pa...
Set a parameter in the container on any key
4,698
public function getParameter ( $ parameterName ) { $ value = $ this -> parameters -> resolve ( $ parameterName ) ; if ( $ value instanceof ArrayResolver ) { return $ value -> extract ( ) ; } return $ value ; }
Retrieve the parameter value configured in the container
4,699
protected function insert ( IEvent $ event ) { $ statement = $ this -> connection -> prepare ( 'INSERT INTO ' . $ this -> table . ' VALUES(:endpoint, :method, :reference, :request)' ) ; $ statement -> execute ( [ ':endpoint' => $ event -> getEndpoint ( ) , ':method' => $ event -> getMethod ( ) , ':reference' => $ event...
Insert new event .