idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
14,200
private function createSignatureHash ( Signature $ signature ) { $ length = $ this -> getSignatureLength ( ) ; return pack ( 'H*' , sprintf ( '%s%s' , str_pad ( $ this -> adapter -> decHex ( $ signature -> getR ( ) ) , $ length , '0' , STR_PAD_LEFT ) , str_pad ( $ this -> adapter -> decHex ( $ signature -> getS ( ) ) ,...
Creates a binary signature with R and S coordinates
14,201
private function extractSignature ( $ value ) { $ length = $ this -> getSignatureLength ( ) ; $ value = unpack ( 'H*' , $ value ) [ 1 ] ; return new Signature ( $ this -> adapter -> hexDec ( substr ( $ value , 0 , $ length ) ) , $ this -> adapter -> hexDec ( substr ( $ value , $ length ) ) ) ; }
Extracts R and S values from given data
14,202
private function getKeyContent ( Key $ key , $ header ) { $ match = null ; preg_match ( '/^[\-]{5}BEGIN ' . $ header . '[\-]{5}(.*)[\-]{5}END ' . $ header . '[\-]{5}$/' , str_replace ( [ PHP_EOL , "\n" , "\r" ] , '' , $ key -> getContent ( ) ) , $ match ) ; if ( isset ( $ match [ 1 ] ) ) { return $ match [ 1 ] ; } thro...
Extracts the base 64 value from the PEM certificate
14,203
public function sourceUrl ( $ media ) { return new \ Twig_Markup ( $ this -> pool -> getProvider ( $ media -> getProvider ( ) ) -> getUrl ( $ media ) , 'utf8' ) ; }
Gets the source url of a media item
14,204
public function getSearchResults ( ) { $ term = $ this -> getRequest ( ) -> get ( 'search' , null ) ; if ( ! $ term ) { return [ ] ; } $ host = $ this -> getRequest ( ) -> getHost ( ) ; $ locale = $ this -> getRequest ( ) -> attributes -> get ( 'content' ) -> getLocale ( ) ; return $ this -> contentManager -> getReposi...
Get the search results
14,205
public function index ( ) { Session :: forget ( 'install-module' ) ; $ result = [ ] ; foreach ( $ this -> extensions as $ ext ) { if ( extension_loaded ( $ ext ) ) { $ result [ $ ext ] = 'true' ; } else { $ result [ $ ext ] = false ; } } return view ( 'avored-install::install.extension' ) -> with ( 'result' , $ result ...
Display all needed PHP Extension for the AvoRed E commerce App
14,206
public function build ( ContainerBuilder $ container ) { parent :: build ( $ container ) ; $ container -> addCompilerPass ( new ConfigurationCompilerPass ( ) ) ; $ container -> addCompilerPass ( new VendorCompilerPass ( ) ) ; }
Registers the compiler passes
14,207
public function flattenRoles ( $ data ) { $ result = array ( ) ; foreach ( $ data as $ key => $ value ) { if ( substr ( $ key , 0 , 4 ) === 'ROLE' ) { $ result [ $ key ] = $ key ; } if ( is_array ( $ value ) ) { $ tmpresult = $ this -> flattenRoles ( $ value ) ; if ( count ( $ tmpresult ) > 0 ) { $ result = array_merge...
Flatten roles .
14,208
private function addBlocksSection ( ArrayNodeDefinition $ node ) { $ node -> children ( ) -> arrayNode ( 'blocks' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> arrayNode ( 'subscribe' ) -> addDefaultsIfNotSet ( ) -> children ( ) -> scalarNode ( 'view' ) -> defaultValue ( 'OpiferMailingListBundle:Block:subscribe.html....
Add Block specific configuration .
14,209
public function createAction ( Request $ request ) { $ mailingList = new MailingList ( ) ; $ form = $ this -> createForm ( MailingListType :: class , $ mailingList , [ 'action' => $ this -> generateUrl ( 'opifer_mailing_list_mailing_list_create' ) , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitt...
Add new Mailing List .
14,210
public function editAction ( Request $ request , $ id ) { $ mailingList = $ this -> getDoctrine ( ) -> getRepository ( 'OpiferMailingListBundle:MailingList' ) -> find ( $ id ) ; $ form = $ this -> createForm ( MailingListType :: class , $ mailingList ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitte...
Edit Mailing List .
14,211
public function deleteAction ( $ id ) { $ mailingList = $ this -> getDoctrine ( ) -> getRepository ( 'OpiferMailingListBundle:MailingList' ) -> find ( $ id ) ; if ( ! empty ( $ mailingList ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ mailingList ) ; $ em -> flush ( ) ; } return $ this -...
Delete Mailing List .
14,212
public function idsAction ( $ ids ) { $ items = $ this -> get ( 'opifer.content.content_manager' ) -> getRepository ( ) -> findOrderedByIds ( $ ids ) ; $ stringHelper = $ this -> container -> get ( 'opifer.content.string_helper' ) ; $ contents = $ this -> get ( 'jms_serializer' ) -> serialize ( $ items , 'json' , Seria...
Get a content items by a list of ids .
14,213
public function viewAction ( Request $ request , $ id , $ structure = 'tree' ) { $ response = new JsonResponse ( ) ; $ contentRepository = $ this -> get ( 'opifer.content.content_manager' ) -> getRepository ( ) ; $ content = $ contentRepository -> findOneByIdOrSlug ( $ id , true ) ; if ( $ content -> getSlug ( ) === '4...
Get a single content item .
14,214
public function deleteAction ( $ id ) { $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; $ content = $ manager -> getRepository ( ) -> find ( $ id ) ; $ hashedSlug = $ content -> getSlug ( ) . '-' . sha1 ( date ( 'Y-m-d H:i:s' ) ) ; $ content -> setSlug ( $ hashedSlug ) ; $ manager -> save ( $ content )...
Delete content .
14,215
public function setCurrentTime ( $ currentTime ) { $ this -> items [ 'iat' ] = ( int ) $ currentTime ; $ this -> items [ 'nbf' ] = ( int ) $ currentTime ; $ this -> items [ 'exp' ] = ( int ) $ currentTime ; }
Configures the time that iat nbf and exp should be based on
14,216
public function get ( $ name ) { return isset ( $ this -> items [ $ name ] ) ? $ this -> items [ $ name ] : null ; }
Returns the requested item
14,217
public function createAction ( Request $ request ) { $ this -> denyAccessUnlessGranted ( 'ROLE_ADMIN' ) ; $ locale = new Locale ( ) ; $ form = $ this -> createForm ( new LocaleType ( ) , $ locale ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> get...
Create a locale
14,218
public function editAction ( Request $ request , $ id = null ) { $ this -> denyAccessUnlessGranted ( 'ROLE_ADMIN' ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; if ( is_numeric ( $ id ) ) { $ locale = $ em -> getRepository ( Locale :: class ) -> find ( $ id ) ; } else { $ locale = $ em -> getRepository ( Loca...
Edit a Locale
14,219
public function getOrdered ( ) { if ( ! $ this -> sort ) { return $ this -> content ; } $ unordered = [ ] ; foreach ( $ this -> content as $ content ) { $ unordered [ $ content -> getId ( ) ] = $ content ; } $ ordered = [ ] ; $ sort = json_decode ( $ this -> sort , true ) ; $ order = $ sort [ 'order' ] ; foreach ( $ or...
Get content items ordered by the sort property
14,220
public function prepend ( ContainerBuilder $ container ) { $ configs = $ container -> getExtensionConfig ( $ this -> getAlias ( ) ) ; $ config = $ this -> processConfiguration ( new Configuration ( ) , $ configs ) ; $ container -> setAlias ( 'opifer.content.content_manager' , $ config [ 'content_manager' ] ) ; $ contai...
Prepend our config before other bundles so we can preset their config with our parameters .
14,221
public function transform ( $ value ) { if ( null === $ value || ! ( $ value instanceof Collection ) ) { return '' ; } $ string = '' ; foreach ( $ value as $ item ) { $ string .= $ item -> getId ( ) ; if ( $ value -> last ( ) != $ item ) { $ string .= ',' ; } } return $ string ; }
Transforms an ArrayCollection Object to a single Object .
14,222
public function shouldSkipClass ( ClassMetadata $ metadata , Context $ context ) { $ obj = null ; foreach ( $ context -> getVisitingSet ( ) as $ item ) { $ obj = $ item ; } if ( $ obj && $ obj instanceof Block && $ obj -> getParent ( ) && $ obj -> getParent ( ) -> getTemplate ( ) && $ obj -> getContent ( ) && $ obj -> ...
Skip blocks of a content item that are children of a template block and do not match the content id . The reason for this is that template blocks could have children from different content items
14,223
public function add ( Prototype $ prototype ) { if ( $ this -> has ( $ prototype -> getKey ( ) ) ) { throw new \ Exception ( sprintf ( 'A prototype with the key %s already exists' , $ prototype -> getKey ( ) ) ) ; } $ this -> collection [ ] = $ prototype ; }
Adds a prototype to the collection and increments the count .
14,224
public function has ( $ key ) { foreach ( $ this -> collection as $ prototype ) { if ( $ key == $ prototype -> getKey ( ) ) { return true ; } } return false ; }
Check if the collection has a prototype with the given key .
14,225
public function getAttribute ( $ name ) { foreach ( $ this -> attributes as $ attribute ) { if ( $ attribute -> getName ( ) == $ name ) { return $ attribute ; } } return false ; }
Get an attribute by its name
14,226
public function findLastUpdated ( $ limit = 5 ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> orderBy ( 'c.updatedAt' , 'DESC' ) -> where ( 'c.layout = :layout' ) -> setParameter ( ':layout' , false ) -> setMaxResults ( $ limit ) -> getQuery ( ) ; return $ query -> getResult ( ) ; }
Find the last updated content items .
14,227
public function findLastCreated ( $ limit = 5 ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> orderBy ( 'c.createdAt' , 'DESC' ) -> setMaxResults ( $ limit ) -> getQuery ( ) ; return $ query -> getResult ( ) ; }
Find the last created content items .
14,228
public function findIndexable ( ) { return $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.indexable = :indexable' ) -> Andwhere ( 'c.active = :active' ) -> Andwhere ( 'c.layout = :layout' ) -> setParameters ( [ 'active' => true , 'layout' => false , 'indexable' => true ] ) -> orderBy ( 'c.slug' , 'ASC' ) -> getQuer...
Find all active and addressable content items .
14,229
protected function summary ( $ signal , $ time_start , $ time_end , $ query_exec_time , $ exec_queries ) { $ this -> newLine ( ) ; $ this -> text ( sprintf ( '<info>%s</info> query process (%s s)' , $ signal , number_format ( $ query_exec_time , 4 ) ) ) ; $ this -> newLine ( ) ; $ this -> text ( sprintf ( '<comment>%s<...
Display in the console all the migration processes
14,230
public function reverseTransform ( $ value ) { if ( $ value instanceof Collection ) { return $ value ; } $ collection = new ArrayCollection ( ) ; if ( null !== $ value ) { $ collection -> add ( $ value ) ; } return $ collection ; }
Transforms a single Object to an ArrayCollection
14,231
protected function configure ( ) { parent :: configure ( ) ; $ this -> addOption ( 'host' , NULL , InputOption :: VALUE_OPTIONAL , 'The host address to serve the application on.' , 'localhost' ) -> addOption ( 'docroot' , NULL , InputOption :: VALUE_OPTIONAL , 'Specify an explicit document root.' , FALSE ) -> addOption...
Command configuration method . Configure all the arguments and options .
14,232
public function sitemapAction ( ) { $ contents = $ this -> get ( 'opifer.content.content_manager' ) -> getRepository ( ) -> findIndexable ( ) ; $ event = new SitemapEvent ( ) ; foreach ( $ contents as $ content ) { $ event -> addUrl ( $ this -> generateUrl ( '_content' , [ 'slug' => $ content -> getSlug ( ) ] , UrlGene...
Renders the sitemap .
14,233
public function getChildren ( ) { $ children = new ArrayCollection ( ) ; if ( $ this -> reference ) { $ children -> add ( $ this -> reference ) ; } return $ children ; }
Overrides the CompositeBlock s getChildren method to pass the reference as this block s children
14,234
public function getUrl ( MediaInterface $ media ) { $ metadata = $ media -> getMetaData ( ) ; return sprintf ( '%s?v=%s' , self :: WATCH_URL , $ metadata [ 'id' ] ) ; }
Get the full url to the original video .
14,235
protected function configure ( ) { $ this -> setName ( $ this -> name ) -> setDescription ( $ this -> description ) -> setAliases ( $ this -> aliases ) -> addOption ( 'env' , null , InputOption :: VALUE_REQUIRED , 'Set the environment variable file' , sprintf ( '%s/%s' , getcwd ( ) , '.craftsman' ) ) ; }
Configure default attributes
14,236
protected function initialize ( InputInterface $ input , OutputInterface $ output ) { try { $ this -> input = $ input ; $ this -> output = $ output ; $ this -> style = new SymfonyStyle ( $ input , $ output ) ; $ file = new \ SplFileInfo ( $ this -> getOption ( 'env' ) ) ; $ this -> env = new Dotenv ( $ file -> getPathI...
Initialize the objects
14,237
public function createValuedQueryBuilder ( $ entityAlias ) { return $ this -> createQueryBuilder ( $ entityAlias ) -> select ( $ entityAlias , 'vs' , 'v' , 'a' , 'p' , 's' ) -> leftJoin ( $ entityAlias . '.valueSet' , 'vs' ) -> leftJoin ( 'vs.schema' , 's' ) -> leftJoin ( 'vs.values' , 'v' ) -> leftJoin ( 's.attributes...
Used by Elastica to transform results to model .
14,238
public function getContentFromRequest ( Request $ request ) { $ qb = $ this -> createValuedQueryBuilder ( 'c' ) ; if ( $ request -> get ( 'q' ) ) { $ qb -> leftJoin ( 'c.template' , 't' ) ; $ qb -> andWhere ( 'c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query' ) ; $ qb -> set...
Get a querybuilder by request .
14,239
public function findOneById ( $ id ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> where ( 'c.id = :id' ) -> setParameter ( 'id' , $ id ) -> getQuery ( ) ; return $ query -> useResultCache ( true , self :: CACHE_TTL ) -> getSingleResult ( ) ; }
Find one by ID .
14,240
public function findOneBySlug ( $ slug ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.slug = :slug' ) -> setParameter ( 'slug' , $ slug ) -> andWhere ( 'c.publishAt < :now OR c.publishAt IS NULL' ) -> andWhere ( 'c.active = :active' ) -> andWhere ( 'c.layout = :layout' ) -> setParameter ( 'now' , new ...
Find one by slug .
14,241
public function findOneByIdOrSlug ( $ idOrSlug , $ allow404 = false ) { if ( is_numeric ( $ idOrSlug ) ) { $ content = $ this -> find ( $ idOrSlug ) ; } else { $ content = $ this -> findOneBySlug ( $ idOrSlug ) ; } if ( ! $ content && $ allow404 == true ) { $ content = $ this -> findOneBySlug ( '404' ) ; } return $ con...
Finds a content item by its id or slug .
14,242
public function findActiveBySlug ( $ slug , $ host ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> leftJoin ( 'c.site' , 'os' ) -> leftJoin ( 'os.domains' , 'd' ) -> where ( 'c.slug = :slug' ) -> andWhere ( 'c.active = :active' ) -> andWhere ( 'c.layout = :layout' ) -> andWhere ( 'c.publishAt < :now OR c.pu...
Find one by slug with active status .
14,243
public function findActiveByAlias ( $ alias , $ host ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> leftJoin ( 'c.site' , 'os' ) -> leftJoin ( 'os.domains' , 'd' ) -> where ( 'c.alias = :alias' ) -> andWhere ( 'c.active = :active' ) -> andWhere ( 'c.layout = :layout' ) -> andWhere ( '(c.publishAt < :now OR...
Find one by alias with active status .
14,244
public function findByIds ( $ ids ) { if ( ! is_array ( $ ids ) ) { $ ids = explode ( ',' , $ ids ) ; } if ( ! $ ids ) { return [ ] ; } return $ this -> createValuedQueryBuilder ( 'c' ) -> andWhere ( 'c.id IN (:ids)' ) -> setParameter ( 'ids' , $ ids ) -> andWhere ( 'c.deletedAt IS NULL' ) -> andWhere ( 'c.active = :ac...
Find content items by multiple ids .
14,245
private function sortByArray ( $ items , array $ order ) { $ unordered = [ ] ; foreach ( $ items as $ content ) { $ unordered [ $ content -> getId ( ) ] = $ content ; } $ ordered = [ ] ; foreach ( $ order as $ id ) { if ( isset ( $ unordered [ $ id ] ) ) { $ ordered [ ] = $ unordered [ $ id ] ; } } return $ ordered ; }
Sort the items by an array of ids .
14,246
public function findByLevels ( $ levels = 1 , $ ids = array ( ) ) { $ query = $ this -> createQueryBuilder ( 'c' ) ; if ( $ levels > 0 ) { $ selects = [ 'c' ] ; for ( $ i = 1 ; $ i <= $ levels ; ++ $ i ) { $ selects [ ] = 'c' . $ i ; } $ query -> select ( $ selects ) ; for ( $ i = 1 ; $ i <= $ levels ; ++ $ i ) { $ pre...
Joins and selects the toplevel content items and its children recursively .
14,247
public function sortSearchResults ( $ results , $ term ) { $ sortedResults = [ ] ; if ( ! empty ( $ results ) ) { foreach ( $ results as $ result ) { if ( stripos ( $ result -> getTitle ( ) , $ term ) !== false ) { array_unshift ( $ sortedResults , $ result ) ; } else { $ sortedResults [ ] = $ result ; } } } return $ s...
Sort search results by giving priority to founded by title .
14,248
public function setState ( $ newState ) { if ( $ newState === $ this -> state ) { return ; } switch ( $ newState ) { case self :: STATE_RUNNING : $ this -> startedAt = new \ DateTime ( ) ; break ; case self :: STATE_FINISHED : case self :: STATE_FAILED : case self :: STATE_TERMINATED : $ this -> endedAt = new \ DateTim...
Set state .
14,249
public function getNextRunDate ( $ currentTime = 'now' , $ nth = 0 , $ allowCurrentDate = false ) { return $ this -> getCronExpression ( ) -> getNextRunDate ( $ currentTime , $ nth , $ allowCurrentDate ) ; }
Get a next run date relative to the current date or a specific date .
14,250
public function getPreviousRunDate ( $ currentTime = 'now' , $ nth = 0 , $ allowCurrentDate = false ) { return $ this -> getCronExpression ( ) -> getPreviousRunDate ( $ currentTime , $ nth , $ allowCurrentDate ) ; }
Get a previous run date relative to the current date or a specific date .
14,251
public function getMultipleRunDates ( $ total , $ currentTime = 'now' , $ invert = false , $ allowCurrentDate = false ) { return $ this -> getCronExpression ( ) -> getMultipleRunDates ( $ total , $ currentTime , $ invert , $ allowCurrentDate ) ; }
Get multiple run dates starting at the current date or a specific date .
14,252
public function getValue ( ) { $ options = parent :: getValue ( ) ; if ( count ( $ options ) ) { if ( empty ( $ options [ 0 ] ) ) { $ collection = $ options -> getValues ( ) ; return $ collection [ 0 ] -> getName ( ) ; } return $ options [ 0 ] -> getName ( ) ; } return '' ; }
Get the selected value
14,253
public function editAction ( Request $ request , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ user = $ em -> getRepository ( 'OpiferCmsBundle:User' ) -> find ( $ id ) ; $ form = $ this -> createForm ( UserFormType :: class , $ user ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ...
Edit a user .
14,254
public function profileAction ( Request $ request ) { $ user = $ this -> getUser ( ) ; $ form = $ this -> createForm ( ProfileType :: class , $ user ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { if ( $ user -> isTwoFactorEnabled ( ) == false ) { $ user -> setGoogleAuthenticatorSecret ( null...
Edit the current users profile .
14,255
public function activateGoogleAuthAction ( Request $ request ) { $ user = $ this -> getUser ( ) ; $ secret = $ this -> container -> get ( "scheb_two_factor.security.google_authenticator" ) -> generateSecret ( ) ; $ user -> setGoogleAuthenticatorSecret ( $ secret ) ; $ qrUrl = $ this -> container -> get ( "scheb_two_fac...
Activate Google Authenticator
14,256
public function getService ( $ block ) { $ blockType = ( $ block instanceof BlockInterface ) ? $ block -> getBlockType ( ) : $ block ; if ( ! isset ( $ this -> services [ $ blockType ] ) ) { throw new \ Exception ( sprintf ( "No BlockService available by the alias %s, available: %s" , $ blockType , implode ( ', ' , arr...
Returns the block service
14,257
public function find ( $ id , $ draft = false ) { if ( $ draft ) { $ this -> setDraftVersionFilter ( ! $ draft ) ; } $ block = $ this -> getRepository ( ) -> find ( $ id ) ; if ( $ draft ) { if ( null !== $ revision = $ this -> revisionManager -> getDraftRevision ( $ block ) ) { $ this -> revisionManager -> revert ( $ ...
Find a Block in the repository with optional specified version .
14,258
public function findById ( $ id , $ draft = true ) { if ( $ draft ) { $ this -> setDraftVersionFilter ( ! $ draft ) ; } $ blocks = $ this -> getRepository ( ) -> findById ( $ id ) ; if ( $ draft ) { foreach ( $ blocks as $ block ) { if ( null !== $ revision = $ this -> revisionManager -> getDraftRevision ( $ block ) ) ...
Find a Block in the repository in optional draft
14,259
public function findDescendants ( $ parent , $ draft = true ) { $ this -> setDraftVersionFilter ( ! $ draft ) ; $ iterator = new \ RecursiveIteratorIterator ( new RecursiveBlockIterator ( [ $ parent ] ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ blocks = [ ] ; foreach ( $ iterator as $ descendant ) { $ blocks [ ...
Finds the block and all its children recursively
14,260
public function publish ( $ blocks ) { if ( $ blocks instanceof PersistentCollection ) { $ blocks = $ blocks -> getValues ( ) ; } if ( ! $ blocks || ( is_array ( $ blocks ) && ! count ( $ blocks ) ) ) { return ; } if ( ! is_array ( $ blocks ) ) { $ blocks = [ $ blocks ] ; } $ this -> disableRevisionListener ( ) ; $ del...
Publishes a block
14,261
public function duplicate ( $ blocks , $ owner = null ) { if ( $ blocks instanceof BlockInterface ) { $ blocks = array ( $ blocks ) ; } $ iterator = new \ RecursiveIteratorIterator ( new RecursiveBlockIterator ( $ blocks ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ originalIdMap = array ( ) ; $ originalParentMap...
Clones blocks and persists to database
14,262
public function setDraftVersionFilter ( $ enabled = true ) { if ( $ this -> em -> getFilters ( ) -> isEnabled ( 'draft' ) && ! $ enabled ) { $ this -> em -> getFilters ( ) -> disable ( 'draft' ) ; } else if ( ! $ this -> em -> getFilters ( ) -> isEnabled ( 'draft' ) && $ enabled ) { $ this -> em -> getFilters ( ) -> en...
Kills the DraftVersionFilter
14,263
public function disableRevisionListener ( ) { foreach ( $ this -> em -> getEventManager ( ) -> getListeners ( ) as $ event => $ listeners ) { foreach ( $ listeners as $ hash => $ listener ) { if ( $ listener instanceof RevisionListener ) { $ this -> revisionListener = $ listener ; break 2 ; } } } if ( $ this -> revisio...
Removes the RevisionListener from the EventManager
14,264
public function getSiblings ( BlockInterface $ block , $ version = false ) { $ owner = $ block -> getOwner ( ) ; $ family = $ this -> findByOwner ( $ owner , $ version ) ; $ siblings = array ( ) ; foreach ( $ family as $ member ) { if ( $ member -> getParent ( ) && $ member -> getParent ( ) -> getId ( ) == $ block -> g...
Gets the Block nodes siblings at a version .
14,265
public function match ( $ pathinfo ) { $ urlMatcher = new UrlMatcher ( $ this -> routeCollection , $ this -> getContext ( ) ) ; $ result = $ urlMatcher -> match ( $ pathinfo ) ; return $ result ; }
Matches anything .
14,266
public function postLoad ( LifeCycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; if ( $ entity instanceof ValueSetInterface && $ entity -> getValues ( ) !== null ) { $ this -> eavManager -> replaceEmptyValues ( $ entity ) ; } }
Create empty values for non - persisted values .
14,267
public function postPersist ( LifeCycleEventArgs $ args ) { $ entity = $ args -> getEntity ( ) ; $ entityManager = $ args -> getEntityManager ( ) ; if ( $ entity instanceof ValueInterface && $ entity -> isEmpty ( ) ) { $ entityManager -> remove ( $ entity ) ; } }
Remove empty values after persisting to avoid null Value values in the database .
14,268
public function findByRequest ( Request $ request ) { $ qb = $ this -> createQueryBuilder ( 's' ) ; if ( $ request -> get ( 'attribute' ) ) { $ qb -> join ( 's.allowedInAttributes' , 'a' ) -> andWhere ( 'a.id = :attributeId' ) -> setParameter ( 'attributeId' , $ request -> get ( 'attribute' ) ) ; } return $ qb -> getQu...
Find schemas by request
14,269
public function addValue ( ValueProviderInterface $ value , $ alias ) { if ( false === $ value -> isEnabled ( ) ) { return ; } $ this -> values [ $ alias ] = $ value ; }
Adds all the values tagged with opifer . media . value to the value pool
14,270
public function getValueByEntity ( $ entity ) { if ( is_object ( $ entity ) ) { $ entity = get_class ( $ entity ) ; } foreach ( $ this -> getValues ( ) as $ provider ) { if ( $ entity === $ provider -> getEntity ( ) ) { return $ provider ; } } return false ; }
Get a valueprovider by it s entity class
14,271
public function registerAssetFiles ( $ view ) { if ( is_array ( self :: $ _assets ) ) { $ this -> css = array_values ( array_intersect_key ( self :: $ _css , self :: $ _assets ) ) ; $ this -> js = array_values ( array_intersect_key ( self :: $ _js , self :: $ _assets ) ) ; } array_unshift ( $ this -> css , self :: $ _c...
Registers the CSS and JS files with the given view .
14,272
public function getDefaultDomain ( ) { if ( $ this -> defaultDomain ) { return $ this -> defaultDomain ; } elseif ( $ first = $ this -> getDomains ( ) -> first ( ) ) { return $ first -> getDomain ( ) ; } else { return null ; } }
Get defaultDomain .
14,273
public function request ( $ name , array $ arguments , array $ options = null , $ inputHeaders = null ) { $ soapRequest = $ this -> interpreter -> request ( $ name , $ arguments , $ options , $ inputHeaders ) ; if ( $ soapRequest -> getSoapVersion ( ) == '1' ) { $ this -> builder -> isSOAP11 ( ) ; } else { $ this -> bu...
Embed SOAP messages in PSR - 7 HTTP Requests
14,274
public function response ( ResponseInterface $ response , $ name , array & $ outputHeaders = null ) { return $ this -> interpreter -> response ( $ response -> getBody ( ) -> __toString ( ) , $ name , $ outputHeaders ) ; }
Retrieve SOAP messages from PSR - 7 HTTP responses and interpret messages to PHP values .
14,275
public function create ( $ name , $ value ) { if ( ! empty ( $ this -> callbacks [ $ name ] ) ) { return call_user_func ( $ this -> callbacks [ $ name ] , $ name , $ value ) ; } return $ this -> createBasic ( $ name , $ value ) ; }
Create a new claim
14,276
public function clipboardBlockAction ( $ id ) { $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; $ clipboardService = $ this -> get ( 'opifer.content.clipboard_block' ) ; $ response = new JsonResponse ; try { $ block = $ manager -> find ( $ id , true ) ; $ clipboardService -> addToClipboard ( $ block ) ; ...
Copies a reference of a block to the clipboard
14,277
public function publishSharedAction ( Request $ request ) { $ this -> getDoctrine ( ) -> getManager ( ) -> getFilters ( ) -> disable ( 'draft' ) ; $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; $ response = new JsonResponse ; $ id = ( int ) $ request -> request -> get ( 'id' ) ; try { $ block = $ manage...
Publishes a shared block and it s members
14,278
public function discardBlockAction ( Request $ request ) { $ this -> getDoctrine ( ) -> getManager ( ) -> getFilters ( ) -> disable ( 'draft' ) ; $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; $ response = new JsonResponse ; $ id = ( int ) $ request -> request -> get ( 'id' ) ; try { $ manager -> discar...
Discards all changes to block and it s members
14,279
public function findPendingSynchronisation ( ) { return $ this -> createQueryBuilder ( 's' ) -> innerjoin ( 's.mailingList' , 'm' ) -> andWhere ( 's.status = :pending OR s.status = :failed' ) -> setParameters ( [ 'pending' => Subscription :: STATUS_PENDING , 'failed' => Subscription :: STATUS_FAILED , ] ) -> getQuery (...
Finds all subscriptions pending synchronisation .
14,280
public function findPendingSynchronisationList ( MailingList $ mailingList ) { return $ this -> createQueryBuilder ( 's' ) -> innerjoin ( 's.mailingList' , 'm' ) -> where ( 's.mailingList = :mailingList' ) -> andWhere ( 's.status = :pending OR s.status = :failed' ) -> setParameters ( [ 'mailingList' => $ mailingList , ...
Finds all subscriptions pending synchronisation for a specific mailinglist .
14,281
public function getOptionByName ( $ name ) { foreach ( $ this -> options as $ option ) { if ( $ option -> getName ( ) == $ name ) { return $ option ; } } return false ; }
Get an option by its name .
14,282
public function addAllowedSchema ( SchemaInterface $ schema ) { $ exists = false ; foreach ( $ this -> allowedSchemas as $ allowedSchema ) { if ( $ allowedSchema -> getId ( ) == $ schema -> getId ( ) ) { $ exists = true ; } } if ( ! $ exists ) { $ this -> allowedSchemas [ ] = $ schema ; } return $ this ; }
Add allowed schema .
14,283
protected function mapClassParameters ( array $ classes , ContainerBuilder $ container ) { foreach ( $ classes as $ model => $ serviceClasses ) { foreach ( $ serviceClasses as $ service => $ class ) { $ container -> setParameter ( sprintf ( 'opifer_cms.%s_%s' , $ model , $ service ) , $ class ) ; } } }
Remap class parameters .
14,284
public function createFormView ( FormInterface $ form ) { $ post = $ this -> eavManager -> initializeEntity ( $ form -> getSchema ( ) ) ; $ form = $ this -> formFactory -> create ( PostType :: class , $ post , [ 'form_id' => $ form -> getId ( ) ] ) ; return $ form -> createView ( ) ; }
Builds a Symfony form from the passed Form entity and returns the related FormView so we can use our Form as a standard Symfony form in our templates .
14,285
public function viewAction ( $ id ) { $ manager = $ this -> get ( 'opifer.content.block_manager' ) ; $ block = $ manager -> getRepository ( ) -> find ( $ id ) ; if ( ! $ block ) { throw $ this -> createNotFoundException ( ) ; } $ response = new Response ( ) ; $ environment = $ this -> get ( 'opifer.content.block_enviro...
Renders a single block
14,286
public function sharedAction ( ) { $ blocks = $ this -> get ( 'opifer.content.block_manager' ) -> getRepository ( ) -> findBy ( [ 'shared' => true ] ) ; return $ this -> render ( $ this -> getParameter ( 'opifer_content.block_shared_view' ) , [ 'blocks' => $ blocks , ] ) ; }
Block shared view .
14,287
protected function setChildren ( Block $ block ) { if ( method_exists ( $ block , 'setChildren' ) ) { $ children = $ this -> environment -> getBlockChildren ( $ block ) ; $ block -> setChildren ( $ children ) ; } }
Maps the block children from the environment to the block
14,288
public function indexAction ( ) { $ contentTypes = $ this -> get ( 'opifer.content.content_type_manager' ) -> getRepository ( ) -> findAll ( ) ; return $ this -> render ( $ this -> getParameter ( 'opifer_content.content_type_index_view' ) , [ 'content_types' => $ contentTypes , ] ) ; }
ContentType index view .
14,289
public function createAction ( Request $ request ) { $ contentTypeManager = $ this -> get ( 'opifer.content.content_type_manager' ) ; $ contentType = $ contentTypeManager -> create ( ) ; $ form = $ this -> createForm ( ContentTypeType :: class , $ contentType ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> i...
Create a ContentType .
14,290
public function contentAction ( Request $ request ) { return $ this -> render ( 'OpiferCmsBundle:CKEditor:content.html.twig' , [ 'funcNum' => $ request -> get ( 'CKEditorFuncNum' ) , 'CKEditor' => $ request -> get ( 'CKEditor' ) , 'type' => $ request -> get ( 'type' ) , ] ) ; }
Content browser for CKEditor .
14,291
public function mediaAction ( Request $ request ) { $ providers = $ this -> get ( 'opifer.media.provider.pool' ) -> getProviders ( ) ; return $ this -> render ( 'OpiferCmsBundle:CKEditor:media.html.twig' , [ 'providers' => $ providers , 'funcNum' => $ request -> get ( 'CKEditorFuncNum' ) , 'CKEditor' => $ request -> ge...
Image browser for CKEditor .
14,292
protected function isLocked ( Cron $ cron ) { $ hourAgo = new \ DateTime ( '-65 minutes' ) ; if ( $ cron -> getState ( ) === Cron :: STATE_RUNNING && $ cron -> getStartedAt ( ) > $ hourAgo ) { return true ; } return false ; }
Checks if the cronjob is currently locked .
14,293
private function startCron ( Cron $ cron ) { if ( $ this -> isLocked ( $ cron ) ) { return ; } $ this -> output -> writeln ( sprintf ( 'Started %s.' , $ cron ) ) ; $ this -> changeState ( $ cron , Cron :: STATE_RUNNING ) ; $ pb = $ this -> getCommandProcessBuilder ( ) ; $ parts = explode ( ' ' , $ cron -> getCommand ( ...
Start a cron .
14,294
private function changeState ( Cron $ cron , $ state , $ lastError = null ) { $ cron -> setState ( $ state ) ; $ cron -> setLastError ( $ lastError ) ; $ em = $ this -> getEntityManager ( ) ; $ em -> persist ( $ cron ) ; $ em -> flush ( $ cron ) ; }
Change the state of the cron .
14,295
private function getCommandProcessBuilder ( ) { $ pb = new ProcessBuilder ( ) ; if ( ! defined ( 'PHP_WINDOWS_VERSION_MAJOR' ) ) { $ pb -> add ( 'exec' ) ; } $ pb -> add ( 'php' ) -> add ( $ this -> getContainer ( ) -> getParameter ( 'kernel.root_dir' ) . '/console' ) -> add ( '--env=' . $ this -> env ) ; return $ pb ;...
Get the process builder .
14,296
public function findByIds ( $ ids ) { if ( ! is_array ( $ ids ) ) { $ ids = explode ( ',' , trim ( $ ids ) ) ; } return $ this -> createQueryBuilder ( 'o' ) -> where ( 'o.id IN (:ids)' ) -> setParameters ( [ 'ids' => $ ids , ] ) -> getQuery ( ) -> getResult ( ) ; }
Find all options by an array or comma - separated list of ids .
14,297
protected function initOptions ( ) { $ view = Yii :: $ app -> view ; $ opts = [ 'confirmButtonText' => Yii :: t ( 'sweetsubmit' , 'Ok' ) , 'cancelButtonText' => Yii :: t ( 'sweetsubmit' , 'Cancel' ) , ] ; $ opts = Json :: encode ( $ opts ) ; $ view -> registerJs ( "yii.sweetSubmitOptions = $opts;" , View :: POS_END ) ;...
Init plugin optins .
14,298
public function error404Action ( Request $ request ) { $ host = $ request -> getHost ( ) ; $ slugParts = explode ( '/' , $ request -> getPathInfo ( ) ) ; $ locale = $ this -> getDoctrine ( ) -> getRepository ( Locale :: class ) -> findOneByLocale ( $ slugParts [ 1 ] ) ; $ contentRepository = $ this -> getDoctrine ( ) -...
404 error page .
14,299
protected function transform ( Expression $ expression ) { $ constraint = $ expression -> getConstraint ( ) ; $ getter = 'get' . ucfirst ( $ expression -> getSelector ( ) ) ; return Expr :: method ( $ getter , new $ constraint ( $ expression -> getValue ( ) ) ) ; }
Transform the expression to Webmozarts Expression .