idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
42,800
protected static function triggerApplication ( self $ e ) : void { if ( class_exists ( '\Osf\Application\OsfApplication' ) ) { if ( \ Osf \ Application \ OsfApplication :: isDevelopment ( ) ) { \ Osf \ Exception \ Error :: displayException ( $ e ) ; } else { if ( \ Osf \ Application \ OsfApplication :: isStaging ( ) ) { $ err = sprintf ( __ ( "%s. Details in log file." ) , $ e -> getMessage ( ) ) ; echo \ Osf \ Container \ OsfContainer :: getViewHelper ( ) -> alert ( __ ( "Error detected" ) , $ err ) -> statusWarning ( ) ; } } } }
Transmit error to the application context
42,801
public function addTick ( TickInterface $ tick ) { $ tick -> setManager ( $ this ) ; $ this -> ticks [ $ tick -> getName ( ) ] = [ 'tick' => $ tick , 'time' => 0 , ] ; return $ this ; }
Add tick to loop .
42,802
public function removeTick ( $ name ) { if ( isset ( $ this -> ticks [ $ name ] ) ) { $ this -> ticks [ $ name ] -> setManager ( null ) ; unset ( $ this -> ticks [ $ name ] ) ; } }
Remove tick by name from loop .
42,803
public function start ( ) { if ( $ this -> isStart ) { return ; } $ this -> startAt = time ( ) ; $ this -> stopAt = null ; $ this -> isStart = true ; if ( extension_loaded ( 'xdebug' ) ) { xdebug_disable ( ) ; } foreach ( $ this -> onStart as $ callable ) { call_user_func_array ( $ callable , [ ] ) ; } while ( $ this -> isStart ) { $ this -> tick ( ) ; } $ this -> stopAt = time ( ) ; foreach ( $ this -> onStop as $ callable ) { call_user_func_array ( $ callable , [ ] ) ; } if ( extension_loaded ( 'xdebug' ) ) { xdebug_enable ( ) ; } }
Start loop .
42,804
protected function tick ( ) { $ time = microtime ( true ) ; foreach ( $ this -> ticks as $ name => $ value ) { $ tick = $ value [ 'tick' ] ; $ interval = $ tick -> getInterval ( ) >= $ this -> interval ? $ tick -> getInterval ( ) : $ this -> interval ; $ diff = ( $ time - $ value [ 'time' ] ) * 1000 ; if ( $ diff >= $ interval ) { try { $ tick -> tick ( ) ; } catch ( \ Exception $ e ) { $ this -> catchTickException ( $ tick , $ e ) ; } $ this -> ticks [ $ name ] [ 'time' ] = $ time ; } } usleep ( $ this -> interval * 1e3 ) ; }
Loop tick .
42,805
public function emailResetLink ( CanResetPasswordContract $ user , $ token , Closure $ callback = null ) { $ view = $ this -> emailView ; return $ this -> mailer -> send ( $ view , compact ( 'token' , 'user' ) , function ( $ m ) use ( $ user , $ token , $ callback ) { $ m -> to ( $ user -> getEmailForPasswordReset ( ) ) ; if ( ! is_null ( $ callback ) ) { call_user_func ( $ callback , $ m , $ user , $ token ) ; } } ) ; }
Send the password reset link via e - mail .
42,806
public function initialize ( ) { $ contentTypes = $ this -> contentTypeRepository -> findAllNotDeletedInLastVersion ( ) ; foreach ( $ contentTypes as $ contentType ) { $ this -> schemaGenerator -> createMapping ( $ contentType ) ; } }
Initialize content type schema
42,807
public function toOutput ( $ structure , $ assoc = true ) { switch ( $ structure ) { case 'string' : $ output = $ this -> toString ( ) ; break ; case 'array' : default : $ output = $ this -> toArray ( $ assoc ) ; break ; } return $ output ; }
Get the public representation of the object
42,808
public function toJson ( $ options = 0 , $ structure , $ assoc = true ) { return json_encode ( $ this -> toOutput ( $ structure , $ assoc ) , $ options ) ; }
Get the JSON representation of the object
42,809
protected function doLoad ( $ itemMetaData ) { $ query = $ this -> newQueryInstance ( $ itemMetaData ) ; $ databaseMapping = $ this -> ormDriver -> loadDatabaseMapping ( $ itemMetaData ) ; $ query -> mapDatabase ( $ databaseMapping , $ itemMetaData -> getItemClass ( ) , $ itemMetaData -> getHitPositions ( ) ) ; return $ query ; }
Loads Query for itemMetaData
42,810
public function sendSubscribeToNewsletterMessage ( Actor $ user ) { $ templateName = 'CoreBundle:Email:subscription.email.html.twig' ; $ context = array ( 'user' => $ user ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ user -> getEmail ( ) ) ; }
Send an email to a user to confirm the subscription
42,811
public function sendContactMessage ( array $ params ) { $ templateName = 'CoreBundle:Email:base.email.html.twig' ; $ context = array ( 'params' => $ params ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ params [ 'email' ] ) ; $ this -> sendMessage ( $ templateName , $ context , $ params [ 'email' ] , $ this -> twigGlobal -> getParameter ( 'admin_email' ) ) ; }
Send an email to a user and admin
42,812
public function sendNotificationEmail ( $ mail , $ from = null ) { $ templateName = 'CoreBundle:Email:notification.email.html.twig' ; $ context = array ( 'mail' => $ mail ) ; if ( is_null ( $ from ) ) { $ this -> sendMessage ( $ templateName , $ context , $ mail -> getSender ( ) , $ mail -> getRecipient ( ) , $ mail -> getAttachment ( ) ) ; } else { $ this -> sendMessage ( $ templateName , $ context , $ from , $ mail -> getRecipient ( ) , $ mail -> getAttachment ( ) ) ; } }
Send an email from notification
42,813
public function sendAdvertPurchaseConfirmationMessage ( Invoice $ invoice , $ amount ) { $ templateName = 'PaymentBundle:Email:advert.confirmation.html.twig' ; $ advert = $ invoice -> getTransaction ( ) -> getItems ( ) -> first ( ) -> getAdvert ( ) ; if ( $ invoice -> getTransaction ( ) -> getActor ( ) instanceof Actor ) { $ user = $ invoice -> getTransaction ( ) -> getActor ( ) ; } elseif ( $ invoice -> getTransaction ( ) -> getOptic ( ) instanceof Optic ) { $ user = $ invoice -> getTransaction ( ) -> getOptic ( ) ; } $ toEmail = $ user -> getEmail ( ) ; $ token = null ; $ context = array ( 'order_number' => $ invoice -> getTransaction ( ) -> getTransactionKey ( ) , 'advert' => $ advert , 'user' => $ user , 'token' => $ token ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ toEmail ) ; }
Send plan purchase confirmation
42,814
public function sendPurchaseConfirmationMessage ( Invoice $ invoice , $ amount ) { $ templateName = 'PaymentBundle:Email:sale.confirmation.html.twig' ; $ toEmail = $ invoice -> getTransaction ( ) -> getActor ( ) -> getEmail ( ) ; $ orderUrl = $ this -> router -> generate ( 'payment_checkout_showinvoice' , array ( 'number' => $ invoice -> getInvoiceNumber ( ) ) , UrlGeneratorInterface :: ABSOLUTE_URL ) ; $ context = array ( 'order_number' => $ invoice -> getTransaction ( ) -> getTransactionKey ( ) , 'amount' => $ amount , 'payment_type' => $ invoice -> getTransaction ( ) -> getPaymentMethod ( ) -> getName ( ) , 'order_url' => $ orderUrl , ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ toEmail ) ; $ templateName = 'PaymentBundle:Email:sale.confirmation.actor.html.twig' ; $ productItems = $ invoice -> getTransaction ( ) -> getItems ( ) ; $ actor = $ productItems -> first ( ) -> getProduct ( ) -> getActor ( ) ; if ( $ actor instanceof Actor ) { $ toEmail = $ actor -> getEmail ( ) ; $ token = null ; if ( $ actor -> getBankAccountNumber ( ) == '' ) { $ token = sha1 ( uniqid ( ) ) ; $ date = new \ DateTime ( ) ; $ actor -> setBankAccountToken ( $ token ) ; $ actor -> setBankAccountTime ( $ date -> getTimestamp ( ) ) ; $ this -> manager -> persist ( $ actor ) ; $ this -> manager -> flush ( ) ; } $ context = array ( 'order_number' => $ invoice -> getTransaction ( ) -> getTransactionKey ( ) , 'products' => $ productItems , 'token' => $ token , 'actor' => $ actor ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ toEmail ) ; } }
Send invest confirmation
42,815
public function sendTrackingCodeEmailMessage ( Transaction $ transaction ) { $ templateName = 'PaymentBundle:Email:trackingCode.html.twig' ; $ toEmail = $ transaction -> getActor ( ) -> getEmail ( ) ; $ context = array ( 'order_number' => $ transaction -> getTransactionKey ( ) , 'tracking_code' => $ transaction -> getDelivery ( ) -> getTrackingCode ( ) , 'carrier_name' => 'Transporte' ) ; $ this -> sendMessage ( $ templateName , $ context , $ this -> twigGlobal -> getParameter ( 'admin_email' ) , $ toEmail ) ; }
Send the tracking code
42,816
public function log ( \ Monolog \ Logger $ logger ) { $ reflection = new \ ReflectionClass ( $ this ) ; $ logger -> error ( $ this -> getMessage ( ) , [ 'type' => $ reflection -> getShortName ( ) , 'code' => $ this -> getCode ( ) , 'line' => $ this -> getLine ( ) , 'file' => $ this -> getFile ( ) , 'trace' => $ this -> getTrace ( ) , 'context' => $ this -> getContext ( ) ] ) ; }
Guarda un log del error
42,817
public function getMessageByCode ( & $ code , array $ data = null ) { $ map = & static :: getErrorMap ( ) ; if ( ! \ array_key_exists ( $ code , $ map ) ) { $ code = static :: UNKNOWN ; } if ( \ is_array ( $ data ) && count ( $ data ) > 0 ) { return \ vsprintf ( $ map [ $ code ] , $ data ) ; } return $ map [ $ code ] ; }
Convert error code to human readable text .
42,818
public function getParentDsId ( $ dsId ) { if ( ! array_key_exists ( $ dsId , $ this -> parentMap ) ) { throw new InvalidArgumentException ( 'Unknown ds_id ' , $ dsId ) ; } return $ this -> parentMap [ $ dsId ] ; }
Get parent node by node id .
42,819
public function getParentNode ( $ dsId ) { $ parentDsId = $ this -> getParentDsId ( $ dsId ) ; if ( null === $ parentDsId ) { return null ; } return $ this -> dsIdMap [ $ parentDsId ] ; }
Get parent node by node ds_id .
42,820
public function getChildrenDsIds ( $ dsId , $ level = 1 ) { $ childrenDsIds = ( array_key_exists ( $ dsId , $ this -> childrenMap ) ) ? $ this -> childrenMap [ $ dsId ] : [ ] ; if ( ( $ level > 1 ) && count ( $ childrenDsIds ) ) { $ subChildDsIds = [ $ childrenDsIds ] ; foreach ( $ childrenDsIds as $ childDsId ) { $ subChildDsIds [ ] = $ this -> getChildrenDsIds ( $ childDsId , $ level - 1 ) ; } $ childrenDsIds = call_user_func_array ( 'array_merge' , $ subChildDsIds ) ; } return $ childrenDsIds ; }
Get ds_id of children .
42,821
public function getChildNodes ( $ dsId , $ level = 1 ) { $ children = [ ] ; $ childrenDsIds = $ this -> getChildrenDsIds ( $ dsId , $ level ) ; foreach ( $ childrenDsIds as $ childDsId ) { $ children [ ] = $ this -> getNode ( $ childDsId ) ; } return $ children ; }
Get children nodes .
42,822
public function hasChildNodes ( $ dsId = null ) { if ( ! $ dsId ) { $ dsId = $ this -> rootDsId ; } $ childrenDsIds = $ this -> getChildrenDsIds ( $ dsId ) ; $ hasChildren = count ( $ childrenDsIds ) > 0 ; return $ hasChildren ; }
Has node children?
42,823
public function getDsIdsByFieldType ( $ fieldType ) { $ result = [ ] ; foreach ( $ this -> dsIdMap as $ dsId => $ node ) { if ( $ fieldType === $ node -> getType ( ) ) { $ result [ ] = $ dsId ; } } return $ result ; }
Get the ds_ids of all fields in this structure tree of a specific type .
42,824
public function getNamesByFieldType ( $ fieldType ) { $ result = [ ] ; foreach ( $ this -> dsIdMap as $ node ) { if ( $ fieldType === $ node -> getType ( ) ) { $ result [ ] = $ node -> getName ( ) ; } } return $ result ; }
Get the working titles of all fields in this structure tree of a specific type .
42,825
public function indexAction ( ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ paymentServiceProviders = $ em -> getRepository ( 'EcommerceBundle:PaymentServiceProvider' ) -> findAll ( ) ; return array ( 'paymentServiceProviders' => $ paymentServiceProviders , ) ; }
Lists all PaymentServiceProvider entities .
42,826
public function newAction ( Request $ request ) { $ paymentServiceProvider = new PaymentServiceProvider ( ) ; $ form = $ this -> createForm ( 'EcommerceBundle\Form\PaymentServiceProviderType' , $ paymentServiceProvider ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ paymentServiceProvider ) ; $ em -> persist ( $ paymentServiceProvider -> getPaymentMethod ( ) ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'ecommerce_paymentserviceprovider_show' , array ( 'id' => $ paymentServiceProvider -> getId ( ) ) ) ; } return array ( 'paymentServiceProvider' => $ paymentServiceProvider , 'form' => $ form -> createView ( ) , ) ; }
Creates a new PaymentServiceProvider entity .
42,827
public function showAction ( PaymentServiceProvider $ paymentServiceProvider ) { $ deleteForm = $ this -> createDeleteForm ( $ paymentServiceProvider ) ; return array ( 'entity' => $ paymentServiceProvider , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Finds and displays a PaymentServiceProvider entity .
42,828
public function editAction ( Request $ request , PaymentServiceProvider $ paymentServiceProvider ) { $ deleteForm = $ this -> createDeleteForm ( $ paymentServiceProvider ) ; $ editForm = $ this -> createForm ( 'EcommerceBundle\Form\PaymentServiceProviderType' , $ paymentServiceProvider ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isSubmitted ( ) && $ editForm -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ paymentServiceProvider ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'ecommerce_paymentserviceprovider_edit' , array ( 'id' => $ paymentServiceProvider -> getId ( ) ) ) ; } return array ( 'entity' => $ paymentServiceProvider , 'edit_form' => $ editForm -> createView ( ) , 'delete_form' => $ deleteForm -> createView ( ) , ) ; }
Displays a form to edit an existing PaymentServiceProvider entity .
42,829
public function deleteAction ( Request $ request , PaymentServiceProvider $ paymentServiceProvider ) { $ form = $ this -> createDeleteForm ( $ paymentServiceProvider ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ paymentServiceProvider ) ; $ em -> flush ( ) ; } return $ this -> redirectToRoute ( 'ecommerce_paymentserviceprovider_index' ) ; }
Deletes a PaymentServiceProvider entity .
42,830
private function createDeleteForm ( PaymentServiceProvider $ paymentServiceProvider ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'ecommerce_paymentserviceprovider_delete' , array ( 'id' => $ paymentServiceProvider -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; }
Creates a form to delete a PaymentServiceProvider entity .
42,831
public function parse ( string $ template , array $ values , ? Enviroment $ enviroment = null ) : string { $ parser = ParserFactory :: factory ( $ enviroment ) ; return $ parser -> parse ( $ template , $ values ) ; }
Parsea una plantilla
42,832
public function dump ( $ value , ? Enviroment $ enviroment = null ) : string { $ format = FormatFactory :: factory ( $ value ) ; return $ this -> format ( $ format , $ enviroment ) ; }
Devuelve la representacion de una variable
42,833
public function getBBCodes ( $ setId = 1 ) { $ set = $ this -> getSet ( $ setId ) ; $ bbcodes = $ set -> getCodes ( ) ; return $ bbcodes ; }
get a list of grouped BBCodes
42,834
public function pdo ( ) { if ( ! empty ( $ this -> pdo ) ) { return $ this -> pdo ; } $ dns = "{$this->driver}:" ; if ( ! empty ( $ this -> database ) ) { $ dns .= "dbname={$this->database};" ; } if ( ! empty ( $ this -> hostname ) ) { $ dns .= "host={$this->hostname};" ; } if ( ! empty ( $ this -> port ) ) { $ dns .= "port={$this->port};" ; } $ this -> pdo = new \ PDO ( $ dns , $ this -> username , $ this -> password ) ; return $ this -> pdo ; }
get raw pdo
42,835
public function getLastInsertID ( ) { if ( count ( $ this -> rows ) > 0 ) { $ end = end ( $ this -> rows ) ; if ( $ end -> toRow ( ) && $ end -> toRow ( ) -> getPrimary ( ) ) { return ( int ) $ end -> toRow ( ) -> getPrimary ( ) ; } else if ( $ end -> toRow ( ) === NULL ) { return NULL ; } else { throw new RepositoryException ( "Table \"" . self :: TABLE . "\" does not have a primary key." ) ; } } else { return NULL ; } }
Return last insert ID
42,836
public function get ( $ key ) { if ( isset ( $ this -> rows [ ( int ) $ key ] ) ) { return $ this -> rows [ ( int ) $ key ] ; } else { $ item = $ this -> buildSql ( ) -> get ( ( int ) $ key ) ; if ( $ item ) { return $ this -> createEntity ( $ item ) ; } else { return NULL ; } } }
Find item by primary key
42,837
public function limit ( $ limit , $ offset = NULL ) { if ( $ this -> selection ) $ this -> selection -> limit ( $ limit , $ offset ) ; else throw new RepositoryException ( "Before using the function limit(...) call read(...)." ) ; return $ this ; }
Sets limit clause more calls rewrite old values .
42,838
public function fetchPairs ( $ key , $ value = NULL ) { $ return = array ( ) ; foreach ( $ this as $ row ) { $ return [ $ row -> $ key ] = $ value ? $ row -> $ value : $ row -> $ key ; } return $ return ; }
Returns all rows as associative array .
42,839
public function fetchAll ( ) { if ( $ this -> selection ) { foreach ( $ this -> selection as $ entity ) { $ this -> createEntity ( $ entity ) ; } } return $ this -> rows ; }
Returns all rows
42,840
protected function hasNonSaveEntity ( ) { foreach ( $ this -> rows as $ row ) { if ( $ row -> toRow ( ) === NULL ) { return TRUE ; } else { $ reflection = $ row -> getColumns ( ) ; $ record = array ( ) ; foreach ( $ reflection as $ property ) { $ name = $ property [ 'name' ] ; if ( $ row -> toRow ( ) -> $ name != $ row -> $ name ) { return TRUE ; } } } } return FALSE ; }
Zjisti zda - li repozitar obsahuje nejake entity k ulozeni
42,841
public function read ( Paginator $ paginator = NULL ) { if ( $ this -> hasNonSaveEntity ( ) === FALSE ) { $ this -> rows = array ( ) ; } $ this -> selection = $ this -> buildSql ( $ paginator ) ; return $ this ; }
Create new Selection
42,842
public function push ( Entity $ entity ) { $ entity -> setEntityManager ( $ this -> entityManager ) ; if ( $ entity -> toRow ( ) ) { $ this -> rows [ $ entity -> getPrimary ( ) ] = $ entity ; } else { $ this -> rows [ ] = $ entity ; } }
Push entity to array
42,843
private function updateActiveRow ( Entity $ entity ) { $ reflection = $ entity -> getColumns ( ) ; $ record = array ( ) ; foreach ( $ reflection as $ property ) { $ name = $ property [ 'name' ] ; if ( $ entity -> toRow ( ) -> $ name != $ entity -> $ name ) { $ record [ $ name ] = $ entity -> $ name ; } } if ( count ( $ record ) > 0 ) { $ entity -> toRow ( ) -> update ( $ record ) ; } $ this -> addLoop ( $ entity ) ; }
Update ActiveRow in current Entity
42,844
private function checkLoop ( Entity $ entity ) { foreach ( $ this -> protectLoop as $ loop ) { if ( EntityReflexion :: getTable ( $ loop ) == EntityReflexion :: getTable ( $ entity ) && $ entity -> getPrimary ( ) == $ loop -> getPrimary ( ) ) { return true ; } } return false ; }
Check loop protection
42,845
public static function toString ( $ type ) { if ( ! isset ( self :: $ strings [ $ type ] ) ) { return $ type ; } return self :: $ strings [ $ type ] ; }
Convert PHP error code to string .
42,846
public function handle ( $ type , $ message , $ file , $ line ) { if ( self :: $ catch & $ type > 0 ) { self :: $ error = $ message ; return ; } switch ( $ type ) { case E_USER_NOTICE : case E_USER_DEPRECATED : case E_USER_WARNING : case E_USER_ERROR : $ backtrace = debug_backtrace ( ) ; if ( isset ( $ backtrace [ 2 ] [ 'file' ] ) ) { $ file = $ backtrace [ 2 ] [ 'file' ] ; } if ( isset ( $ backtrace [ 2 ] [ 'line' ] ) ) { $ line = $ backtrace [ 2 ] [ 'line' ] ; } break ; } switch ( $ type ) { case E_USER_ERROR : case E_ERROR : case E_RECOVERABLE_ERROR : throw new ErrorException ( $ message , 0 , $ type , $ file , $ line ) ; default : $ this -> logger -> log ( $ this -> map [ $ type ] , self :: $ strings [ $ type ] . ': ' . $ message , array ( 'file' => $ file , 'line' => $ line , 'code' => $ type ) ) ; } }
Handle error .
42,847
public static function detect ( $ callable , $ mask = - 1 ) { $ error = null ; set_error_handler ( function ( $ type , $ message , $ file , $ line ) use ( $ error ) { $ error = new ErrorException ( $ message , 0 , $ type , $ file , $ line ) ; } , $ mask ) ; $ callable ( ) ; restore_error_handler ( ) ; return $ error ; }
Detect one or more PHP error messages and return the last one .
42,848
protected function registerAssets ( ) { do_action ( "before_theme_register_assets" ) ; $ assets = $ this -> getConfig ( "assets" ) ; add_action ( "wp_enqueue_scripts" , function ( ) use ( $ assets ) { foreach ( $ assets as $ id => $ asset ) : $ file = strpos ( $ asset [ "file" ] , "//" ) === false ? get_template_directory_uri ( ) . "/public/" . $ asset [ "file" ] : $ asset [ "file" ] ; if ( $ asset [ "type" ] == "js" ) : wp_enqueue_script ( $ id , $ file , $ asset [ "dependencies" ] , $ asset [ "version" ] , $ asset [ "footer" ] ) ; elseif ( $ asset [ "type" ] == "css" ) : wp_enqueue_style ( $ id , $ file , $ asset [ "dependencies" ] , $ asset [ "version" ] , "all" ) ; endif ; endforeach ; } ) ; do_action ( "after_theme_register_assets" ) ; }
Register css and js from config
42,849
public function inform ( $ cmd , $ params = [ ] ) { switch ( $ cmd ) { case 'label' : if ( ! empty ( $ this -> params [ 'label' ] ) ) { $ label = $ this -> params [ 'label' ] ; $ tcCat = TranslationsBuilder :: getBaseTransCategory ( $ this ) ; $ tc = "{$tcCat}/module" ; if ( ! empty ( Yii :: $ app -> i18n -> translations [ "{$tcCat}*" ] ) ) { $ label = Yii :: t ( $ tc , $ this -> params [ 'label' ] ) ; } return $ label ; } else { try { $ ms = Yii :: $ app -> i18n -> getMessageSource ( static :: $ tc ) ; } catch ( InvalidConfigException $ ex ) { $ ms = false ; } return ( $ ms ? Yii :: t ( static :: $ tc , 'Module' ) : 'Module' ) . ' ' . $ this -> uniqueId ; } break ; case 'sitetree-params-action' : if ( ! empty ( $ this -> params [ 'sitetree-params-action' ] ) ) return $ this -> params [ 'sitetree-params-action' ] ; break ; } return null ; }
Get some module info
42,850
public function getData ( ) { if ( ! $ this -> data && $ this -> getLocation ( ) ) { $ this -> data = file_get_contents ( $ this -> getLocation ( ) ) ; } return $ this -> data ; }
Returns the image s data
42,851
final public function delete ( $ code ) { if ( array_key_exists ( $ code , $ this -> rpc_errors ) ) { unset ( $ this -> rpc_errors [ $ code ] ) ; $ this -> logger -> debug ( "Deleted error $code" ) ; return true ; } else { $ this -> logger -> warning ( "Cannot delete error $code: entry not found" ) ; return false ; } }
Delete an error
42,852
protected function getLoginUrl ( string $ redirect_url = '' ) { if ( empty ( $ redirect_url ) ) { $ redirect_url = $ this -> getClientUrl ( ) ; } return $ this -> getServerUrl ( ) . self :: LOGIN_PATH . '?redirect_url=' . $ redirect_url ; }
Get the url of login
42,853
public function login ( string $ redirect_url = '' ) { if ( null === $ guid = $ this -> getGuidFromQuery ( ) ) { header ( 'Location: ' . $ this -> getLoginUrl ( $ redirect_url ) ) ; exit ( ) ; } else { return $ this -> verify ( $ guid ) ; } }
Login and return the username
42,854
public function configureFactory ( SystemEvent $ event ) { $ systemConfig = $ this -> getConfig ( ) ; $ initialConfig = $ systemConfig -> getInitialConfig ( ) ; if ( isset ( $ initialConfig [ 'cache' ] ) ) { $ cacheConfig = ( array ) $ initialConfig [ 'cache' ] ; CacheFactory :: setConfig ( $ cacheConfig ) ; } }
Configures the cache factory .
42,855
public function configureNamespace ( SystemEvent $ event ) { $ systemConfig = $ this -> getConfig ( ) ; $ cache = $ this -> getCache ( ) ; if ( $ cache -> get ( 'hash' ) !== $ systemConfig -> getInitialConfigHash ( ) ) { $ cache -> clearNamespace ( ) ; $ cache -> set ( 'hash' , $ systemConfig -> getInitialConfigHash ( ) ) ; } }
Configures the namespace registered in the cache for system .
42,856
public function findBySelector ( $ selector , $ media = '' , $ rootId = null ) { $ rootId = ( ( int ) $ rootId ) ? : null ; $ rule = $ this -> getMapper ( ) -> findBySelector ( $ selector , $ media , $ rootId ) ; if ( empty ( $ rule ) ) { $ rule = $ this -> getMapper ( ) -> create ( array ( 'media' => $ media , 'selector' => $ selector , 'rootParagraphId' => $ rootId , ) ) ; } return $ rule ; }
Get rule by selector & media
42,857
public function indexAction ( $ postid ) { $ post = $ this -> getPost ( $ postid ) ; $ entities = $ post -> getComments ( ) -> toArray ( ) ; usort ( $ entities , function ( Comment $ a , Comment $ b ) { return $ a -> getDateCreated ( ) < $ b -> getDateCreated ( ) ; } ) ; return array ( 'post' => $ post , 'entities' => $ entities , ) ; }
Lists all of a post s comments .
42,858
public function newAction ( $ postid ) { $ post = $ this -> getPost ( $ postid ) ; $ entity = new Comment ( ) ; $ form = $ this -> createForm ( new CommentType ( ) , $ entity ) ; return array ( 'entity' => $ entity , 'post' => $ post , 'form' => $ form -> createView ( ) , ) ; }
Displays a form to create a new Comment entity .
42,859
public function createAction ( Request $ request , $ postid ) { $ post = $ this -> getPost ( $ postid ) ; $ entity = new Comment ( ) ; $ entity -> setPost ( $ post ) ; $ entity -> setAuthor ( $ this -> getCurrentAuthor ( ) ) ; $ form = $ this -> createForm ( new CommentType ( ) , $ entity ) ; $ form -> bind ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> persist ( $ entity ) ; $ em -> flush ( ) ; $ this -> getSession ( ) -> getFlashBag ( ) -> set ( 'success' , 'The comment has been created successfully.' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'page_or_post' , array ( 'slug' => $ post -> getSlug ( ) ) ) ) ; } return array ( 'entity' => $ entity , 'post' => $ post , 'form' => $ form -> createView ( ) , ) ; }
Creates a new Comment entity .
42,860
public function Index ( $ Page = '' ) { $ this -> AddJsFile ( 'search.js' ) ; $ this -> Title ( T ( 'Search' ) ) ; SaveToConfig ( 'Garden.Format.EmbedSize' , '160x90' , FALSE ) ; Gdn_Theme :: Section ( 'SearchResults' ) ; list ( $ Offset , $ Limit ) = OffsetLimit ( $ Page , C ( 'Garden.Search.PerPage' , 20 ) ) ; $ this -> SetData ( '_Limit' , $ Limit ) ; $ Search = $ this -> Form -> GetFormValue ( 'Search' ) ; $ Mode = $ this -> Form -> GetFormValue ( 'Mode' ) ; if ( $ Mode ) $ this -> SearchModel -> ForceSearchMode = $ Mode ; try { $ ResultSet = $ this -> SearchModel -> Search ( $ Search , $ Offset , $ Limit ) ; } catch ( Gdn_UserException $ Ex ) { $ this -> Form -> AddError ( $ Ex ) ; $ ResultSet = array ( ) ; } catch ( Exception $ Ex ) { LogException ( $ Ex ) ; $ this -> Form -> AddError ( $ Ex ) ; $ ResultSet = array ( ) ; } Gdn :: UserModel ( ) -> JoinUsers ( $ ResultSet , array ( 'UserID' ) ) ; $ SearchTerms = explode ( ' ' , Gdn_Format :: Text ( $ Search ) ) ; foreach ( $ ResultSet as & $ Row ) { $ Row [ 'Summary' ] = SearchExcerpt ( Gdn_Format :: PlainText ( $ Row [ 'Summary' ] , $ Row [ 'Format' ] ) , $ SearchTerms ) ; $ Row [ 'Format' ] = 'Html' ; } $ this -> SetData ( 'SearchResults' , $ ResultSet , TRUE ) ; $ this -> SetData ( 'SearchTerm' , Gdn_Format :: Text ( $ Search ) , TRUE ) ; if ( $ ResultSet ) $ NumResults = count ( $ ResultSet ) ; else $ NumResults = 0 ; if ( $ NumResults == $ Offset + $ Limit ) $ NumResults ++ ; $ PagerFactory = new Gdn_PagerFactory ( ) ; $ this -> Pager = $ PagerFactory -> GetPager ( 'MorePager' , $ this ) ; $ this -> Pager -> MoreCode = 'More Results' ; $ this -> Pager -> LessCode = 'Previous Results' ; $ this -> Pager -> ClientID = 'Pager' ; $ this -> Pager -> Configure ( $ Offset , $ Limit , $ NumResults , 'dashboard/search/%1$s/%2$s/?Search=' . Gdn_Format :: Url ( $ Search ) ) ; $ this -> CanonicalUrl ( Url ( 'search' , TRUE ) ) ; $ this -> Render ( ) ; }
Default search functionality .
42,861
public static function Falp03 ( $ t ) { $ a ; $ a = fmod ( 1287104.793048 + $ t * ( 129596581.0481 + $ t * ( - 0.5532 + $ t * ( 0.000136 + $ t * ( - 0.00001149 ) ) ) ) , TURNAS ) * DAS2R ; return $ a ; }
- - - - - - - - - - i a u F a l p 0 3 - - - - - - - - - -
42,862
public function choice ( array $ keys , $ default = false ) { foreach ( $ keys as $ key ) { if ( $ this -> offsetExists ( $ key ) ) { return $ this -> items [ $ key ] ; } } return $ default ; }
Get an item from the collection by keys .
42,863
public static function Pmpx ( $ rc , $ dc , $ pr , $ pd , $ px , $ rv , $ pmt , array $ pob , array & $ pco ) { $ VF = DAYSEC * DJM / DAU ; $ AULTY = AULT / DAYSEC / DJY ; $ i ; $ sr ; $ cr ; $ sd ; $ cd ; $ x ; $ y ; $ z ; $ p = [ ] ; $ dt ; $ pxr ; $ w ; $ pdz ; $ pm = [ ] ; $ sr = sin ( $ rc ) ; $ cr = cos ( $ rc ) ; $ sd = sin ( $ dc ) ; $ cd = cos ( $ dc ) ; $ p [ 0 ] = $ x = $ cr * $ cd ; $ p [ 1 ] = $ y = $ sr * $ cd ; $ p [ 2 ] = $ z = $ sd ; $ dt = $ pmt + IAU :: Pdp ( $ p , $ pob ) * $ AULTY ; $ pxr = $ px * DAS2R ; $ w = $ VF * $ rv * $ pxr ; $ pdz = $ pd * $ z ; $ pm [ 0 ] = - $ pr * $ y - $ pdz * $ cr + $ w * $ x ; $ pm [ 1 ] = $ pr * $ x - $ pdz * $ sr + $ w * $ y ; $ pm [ 2 ] = $ pd * $ cd + $ w * $ z ; for ( $ i = 0 ; $ i < 3 ; $ i ++ ) { $ p [ $ i ] += $ dt * $ pm [ $ i ] - $ pxr * $ pob [ $ i ] ; } IAU :: Pn ( $ p , $ w , $ pco ) ; }
- - - - - - - - i a u P m p x - - - - - - - -
42,864
private function parseImports ( array $ content , $ file ) { if ( ! isset ( $ content [ 'imports' ] ) ) { return ; } if ( ! is_array ( $ content [ 'imports' ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The "imports" key should contain an array in %s. Check your YAML syntax.' , $ file ) ) ; } $ defaultDirectory = dirname ( $ file ) ; foreach ( $ content [ 'imports' ] as $ import ) { if ( ! is_array ( $ import ) ) { throw new InvalidArgumentException ( sprintf ( 'The values in the "imports" key should be arrays in %s. Check your YAML syntax.' , $ file ) ) ; } $ this -> setCurrentDir ( $ defaultDirectory ) ; $ this -> import ( $ import [ 'resource' ] , null , isset ( $ import [ 'ignore_errors' ] ) ? ( bool ) $ import [ 'ignore_errors' ] : false , $ file ) ; } }
Parses all imports .
42,865
private function parseCallable ( $ callable , $ parameter , $ id , $ file ) { if ( is_string ( $ callable ) ) { if ( '' !== $ callable && '@' === $ callable [ 0 ] ) { throw new InvalidArgumentException ( sprintf ( 'The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").' , $ parameter , $ id , $ callable , substr ( $ callable , 1 ) ) ) ; } if ( false !== strpos ( $ callable , ':' ) && false === strpos ( $ callable , '::' ) ) { $ parts = explode ( ':' , $ callable ) ; return array ( $ this -> resolveServices ( '@' . $ parts [ 0 ] ) , $ parts [ 1 ] ) ; } return $ callable ; } if ( is_array ( $ callable ) ) { if ( isset ( $ callable [ 0 ] ) && isset ( $ callable [ 1 ] ) ) { return array ( $ this -> resolveServices ( $ callable [ 0 ] ) , $ callable [ 1 ] ) ; } throw new InvalidArgumentException ( sprintf ( 'Parameter "%s" must contain an array with two elements for service "%s" in %s. Check your YAML syntax.' , $ parameter , $ id , $ file ) ) ; } throw new InvalidArgumentException ( sprintf ( 'Parameter "%s" must be a string or an array for service "%s" in %s. Check your YAML syntax.' , $ parameter , $ id , $ file ) ) ; }
Parses a callable .
42,866
protected function clearData ( $ table , $ clearLinks = false ) { if ( $ this -> option ( 'clear' ) ) { $ this -> db -> statement ( 'SET FOREIGN_KEY_CHECKS=0;' ) ; $ this -> db -> table ( $ table ) -> truncate ( ) ; if ( $ clearLinks ) { $ this -> db -> table ( 'table_links' ) -> where ( 'new_table' , $ table ) -> delete ( ) ; } $ this -> db -> statement ( 'SET FOREIGN_KEY_CHECKS=1;' ) ; } }
If set truncate the database table .
42,867
protected function getProperty ( $ object , $ key ) { if ( isset ( $ object -> { $ key } ) && ( ( is_int ( $ object -> { $ key } ) && $ object -> { $ key } != 0 ) || ( is_string ( $ object -> { $ key } ) && $ object -> { $ key } != '' ) ) ) { return $ object -> { $ key } ; } return null ; }
Get a property from an object . Return the value if it exists .
42,868
protected function getModifiedDate ( $ object ) { if ( ! isset ( $ object -> modified ) ) { return date ( 'Y-m-d h:i:s' ) ; } return $ object -> modified === '0000-00-00 00:00:00' ? date ( 'Y-m-d h:i:s' ) : $ object -> modified ; }
When a record has a modified date make sure one is set .
42,869
protected function findLink ( $ originalTable , $ originalId ) { $ link = $ this -> db -> table ( 'table_links' ) -> where ( 'original_table' , $ originalTable ) -> where ( 'original_id' , $ originalId ) -> first ( ) ; if ( is_null ( $ link ) ) { $ this -> error ( 'Could not find a link from ' . $ originalTable . ' with an id of ' . $ originalId ) ; return false ; } return $ link -> new_id ; }
Find a new table id based on the old table and id .
42,870
public static function make ( ) : CheckerCollection { $ checkerCollection = new CheckerCollection ( ) ; do_action ( self :: REGISTER_HOOK , $ checkerCollection ) ; do_action ( self :: BOOT_HOOK , $ checkerCollection ) ; return $ checkerCollection ; }
Instantiate a CheckerCollection instance .
42,871
public function updateAccountBalance ( ) { $ this -> getAccount ( ) -> setBalance ( $ this -> getAccount ( ) -> getBalance ( ) + $ this -> getAmount ( ) ) ; $ this -> setBalanceAfterwards ( $ this -> getAccount ( ) -> getBalance ( ) ) ; }
Update Account balance
42,872
public function storeWebfilesFromStream ( MWebfileStream $ webfileStream ) { if ( $ this -> isReadOnly ( ) ) { throw new MDatastoreException ( "cannot modify data on read-only datastore." ) ; } $ webfiles = $ webfileStream -> getWebfiles ( ) ; foreach ( $ webfiles as $ webfile ) { $ this -> storeWebfile ( $ webfile ) ; } }
Stores all webfiles from a given webfilestream in the actual datastore
42,873
public function id ( ) : string { $ id = $ this -> name ( ) ; if ( $ this -> prefix ) { $ id = implode ( '-' , $ this -> prefix ) . "-$id" ; } $ id = preg_replace ( '/[\W]+/' , '-' , $ id ) ; return trim ( preg_replace ( '/[-]+/' , '-' , $ id ) , '-' ) ; }
Returns the ID generated for the element .
42,874
public static function stringEndsWith ( $ haystack , $ needle ) { if ( ! is_string ( $ haystack ) || ! is_string ( $ needle ) ) { throw new \ InvalidArgumentException ( 'Not a string' ) ; } return ( strrpos ( $ haystack , $ needle ) + strlen ( $ needle ) ) === strlen ( $ haystack ) ; }
Determine if a string ends with a particular sequence .
42,875
public static function stringStartsWith ( $ haystack , $ needle ) { if ( ! is_string ( $ haystack ) || ! is_string ( $ needle ) ) { throw new \ InvalidArgumentException ( 'Not a string' ) ; } return strpos ( $ haystack , $ needle ) === 0 ; }
Determine if a string starts with a particular sequence .
42,876
public static function removePrefix ( $ haystack , $ prefix ) { if ( ! is_string ( $ haystack ) || ! is_string ( $ prefix ) ) { throw new \ InvalidArgumentException ( 'Not a string' ) ; } if ( strpos ( $ haystack , $ prefix ) === 0 ) { $ haystack = substr ( $ haystack , strlen ( $ prefix ) ) ; } return $ haystack ; }
Remove the prefix from the provided string .
42,877
public static function toUnderscore ( $ string ) { if ( ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( 'Not a string' ) ; } $ transCoder = Transcoder :: create ( 'ASCII' ) ; $ string = $ transCoder -> transcode ( trim ( $ string ) ) ; $ words = explode ( ' ' , $ string ) ; return implode ( '_' , array_filter ( array_map ( [ static :: class , 'wordToUnderscored' ] , $ words ) ) ) ; }
Converts a string to underscore version . Also tries to filter out higher UTF - 8 chars .
42,878
public static function assertIntegerBetween ( int $ min , int $ max , int $ value , string $ name ) { if ( $ value < $ min || $ value > $ max ) { throw new InvalidArgumentException ( "Expecting {$name} to be between {$min} and {$max}, got {$value}" ) ; } }
Assert an integer is between two known values
42,879
public function getClassNameWithoutNamespace ( ) { if ( $ this -> classNameWithoutNamespace === null ) { $ class = explode ( '\\' , get_class ( $ this ) ) ; $ this -> classNameWithoutNamespace = substr ( end ( $ class ) , 0 , - 10 ) ; } return $ this -> classNameWithoutNamespace ; }
Getter for the class name without it s namespace
42,880
public function getRouteIdentifierPrefix ( ) { if ( $ this -> routeIdentifierPrefix === null ) { $ this -> routeIdentifierPrefix = strtolower ( $ this -> getModuleNamespace ( ) . '/' . $ this -> getClassNameWithoutNamespace ( ) ) ; } return $ this -> routeIdentifierPrefix ; }
Returns the prefix for the route identifier
42,881
protected function checkDuplication ( RouteInterface $ route , $ routeKey , $ method ) { if ( isset ( $ this -> routes [ $ routeKey ] [ $ method ] ) ) { throw new LogicException ( Message :: get ( Message :: RTE_ROUTE_DUPLICATED , $ route -> getPattern ( ) , $ method ) , Message :: RTE_ROUTE_DUPLICATED ) ; } }
Same route pattern and method ?
42,882
protected function notify ( ObservationContainerInterface $ container ) : ? ObservationContainerInterface { foreach ( $ this -> observers as $ current ) { $ current -> update ( $ container ) ; } return $ container ; }
notifies all observers using a observation container implementation .
42,883
protected function mapWebRoutes ( ) { Route :: group ( [ 'middleware' => config ( $ this -> package . '.web_routes_middleware' ) ? : 'web' , 'namespace' => $ this -> namespace , 'prefix' => $ this -> prefix , ] , function ( $ router ) { require __DIR__ . '/../Routes/web.php' ; } ) ; }
Define the web routes for the module .
42,884
public function validate ( $ context = 'default' , array $ data = [ ] ) { if ( ! empty ( $ data ) ) { $ this -> setData ( $ data ) ; } $ this -> setContext ( $ context ) ; $ rules = $ this -> buildRulesArray ( ) ; $ validator = $ this -> factory -> make ( $ this -> filterArray ( $ rules , $ this -> data ) , $ rules ) ; if ( $ validator -> passes ( ) ) { return $ validator -> getData ( ) ; } throw new ValidationException ( $ validator ) ; }
Validate passed data
42,885
protected function buildRulesArray ( ) { if ( method_exists ( $ this , $ this -> context ) ) { $ rules = $ this -> { $ this -> context } ( ) ; } elseif ( isset ( $ this -> rules [ $ this -> context ] ) ) { $ rules = $ this -> rules [ $ this -> context ] ; } else { throw new InvalidArgumentException ( "Undefined validation context: " . $ this -> context ) ; } return $ this -> bindPlaceholders ( $ rules ) ; }
Build rules array
42,886
protected function filterArray ( $ rules , $ rawAttributes ) { $ attributes = [ ] ; foreach ( array_keys ( $ rules ) as $ filedName ) { $ value = array_get ( $ rawAttributes , $ filedName , 'not found in array' ) ; if ( $ value !== 'not found in array' ) { if ( isset ( $ this -> filters [ $ filedName ] ) ) { $ filters = explode ( '|' , $ this -> filters [ $ filedName ] ) ; foreach ( $ filters as $ filter ) { array_set ( $ attributes , $ filedName , $ this -> $ filter ( $ value ) ) ; } } else { array_set ( $ attributes , $ filedName , $ value ) ; } } } return $ attributes ; }
Filter array with data to validate
42,887
public function handleRequest ( SS_HTTPRequest $ request , DataModel $ model ) { return $ this -> original ( ) -> handleRequest ( $ request , $ model ) ; }
Iterate until we reach the original object A bit hacky but if it works it works
42,888
public function getSlaveOkay ( ) { if ( version_compare ( phpversion ( 'mongo' ) , '1.3.0' , '<' ) ) { return $ this -> riak -> getSlaveOkay ( ) ; } $ readPref = $ this -> getReadPreference ( ) ; return \ RiakClient :: RP_PRIMARY !== $ readPref [ 'type' ] ; }
Get whether secondary read queries are allowed for this database .
42,889
public function setSlaveOkay ( $ ok = true ) { if ( version_compare ( phpversion ( 'mongo' ) , '1.3.0' , '<' ) ) { return $ this -> riak -> setSlaveOkay ( $ ok ) ; } $ prevSlaveOkay = $ this -> getSlaveOkay ( ) ; if ( $ ok ) { $ readPref = $ this -> getReadPreference ( ) ; $ tags = ! empty ( $ readPref [ 'tagsets' ] ) ? $ readPref [ 'tagsets' ] : array ( ) ; $ this -> riak -> setReadPreference ( \ RiakClient :: RP_SECONDARY_PREFERRED , $ tags ) ; } else { $ this -> riak -> setReadPreference ( \ RiakClient :: RP_PRIMARY ) ; } return $ prevSlaveOkay ; }
Set whether secondary read queries are allowed for this database .
42,890
public function filterByAncestorId ( $ ancestorId = null , $ comparison = null ) { if ( is_array ( $ ancestorId ) ) { $ useMinMax = false ; if ( isset ( $ ancestorId [ 'min' ] ) ) { $ this -> addUsingAlias ( LineageTableMap :: COL_ANCESTOR_ID , $ ancestorId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ ancestorId [ 'max' ] ) ) { $ this -> addUsingAlias ( LineageTableMap :: COL_ANCESTOR_ID , $ ancestorId [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( LineageTableMap :: COL_ANCESTOR_ID , $ ancestorId , $ comparison ) ; }
Filter the query on the ancestor_id column
42,891
public function useAncestorQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinAncestor ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'Ancestor' , '\gossi\trixionary\model\SkillQuery' ) ; }
Use the Ancestor relation Skill object
42,892
public static function buildTreeAndGetRoots ( array $ objects ) { $ nodeClass = get_called_class ( ) ; $ nodes = array ( ) ; foreach ( $ objects as $ object ) { $ nodes [ ] = new $ nodeClass ( $ object ) ; } foreach ( $ nodes as $ node ) { $ object = $ node -> getObject ( ) ; foreach ( $ nodes as $ potentialParentNode ) { if ( $ potentialParentNode -> getObject ( ) -> isParentOf ( $ object ) ) { $ node -> setParent ( $ potentialParentNode ) ; $ potentialParentNode -> addChild ( $ node ) ; break ; } } } $ roots = array ( ) ; foreach ( $ nodes as $ potentialRoot ) { if ( $ potentialRoot -> isRootNode ( ) ) { $ roots [ ] = $ potentialRoot ; } } return $ roots ; }
Build a tree from an array of TreeNodeObjectInterface objects .
42,893
public function getAssetUrl ( $ path ) { if ( false !== strpos ( $ path , '://' ) || 0 === strpos ( $ path , '//' ) ) { return $ path ; } if ( ! $ this -> container -> has ( 'request' ) ) { return $ path ; } if ( '/' !== substr ( $ path , 0 , 1 ) ) { $ path = '/' . $ path ; } $ request = $ this -> container -> get ( 'request' ) ; $ path = $ request -> getBasePath ( ) . $ path ; return $ path ; }
Returns the public path of an asset
42,894
public static function encode ( $ data , $ pad = null ) { $ str = str_replace ( array ( '+' , '/' ) , array ( '-' , '_' ) , base64_encode ( $ data ) ) ; if ( ! $ pad ) { $ str = rtrim ( $ str , '=' ) ; } return $ str ; }
encode a string
42,895
public function getActivityType ( ) { $ categories = $ this -> getCategory ( ) ; foreach ( $ categories as $ category ) { if ( $ category -> getScheme ( ) == self :: ACTIVITY_CATEGORY_SCHEME ) { return $ category -> getTerm ( ) ; } } return null ; }
Return the activity type that was performed .
42,896
protected function _callControllerMethod ( ) { if ( ! isset ( $ this -> _controller ) || ! is_object ( $ this -> _controller ) ) { $ this -> _error ( "Controller does not exist: " . $ this -> _url_controller ) ; return false ; } if ( ! method_exists ( $ this -> _controller , $ this -> _url_method ) ) { $ this -> _error ( "Method does not exist: " . $ this -> _url_method ) ; return false ; } call_user_func_array ( array ( $ this -> _controller , $ this -> _url_method ) , $ this -> _url_args ) ; }
If a method is passed in the GET url paremter
42,897
public function getSchemaByType ( $ modelClass ) { if ( array_key_exists ( $ modelClass , $ this -> schemaInstances ) === true ) { return $ this -> schemaInstances [ $ modelClass ] ; } if ( $ this -> hasSchemaForModelClass ( $ modelClass ) === false ) { throw new InvalidArgumentException ( "Schema was not registered for model '$modelClass'." ) ; } $ schemaClass = $ this -> model2schemaMap [ $ modelClass ] ; $ schema = new $ schemaClass ( $ this -> factory , $ this ) ; $ this -> schemaInstances [ $ modelClass ] = $ schema ; return $ schema ; }
Get schema provider by resource type .
42,898
public function & HasValidator ( $ validatorNameOrInstance ) { if ( is_string ( $ validatorNameOrInstance ) ) { $ validatorClassName = $ validatorNameOrInstance ; } else if ( $ validatorNameOrInstance instanceof \ MvcCore \ Ext \ Forms \ IValidator ) { $ validatorClassName = get_class ( $ validatorNameOrInstance ) ; } else { return $ this -> throwNewInvalidArgumentException ( 'Unknown validator type given: `' . $ validatorNameOrInstance . '`, type: `' . gettype ( $ validatorNameOrInstance ) . '`.' ) ; } $ slashPos = strrpos ( $ validatorClassName , '\\' ) ; $ validatorName = $ slashPos !== FALSE ? substr ( $ validatorClassName , $ slashPos + 1 ) : $ validatorClassName ; return isset ( $ this -> validators [ $ validatorName ] ) ; }
Get TRUE if field has configured in it s validators array given validator class ending name or validator instance .
42,899
function acttab_action ( $ lookahead , $ action ) { if ( $ this -> nLookahead === 0 ) { $ this -> aLookahead = array ( ) ; $ this -> mxLookahead = $ lookahead ; $ this -> mnLookahead = $ lookahead ; $ this -> mnAction = $ action ; } else { if ( $ this -> mxLookahead < $ lookahead ) { $ this -> mxLookahead = $ lookahead ; } if ( $ this -> mnLookahead > $ lookahead ) { $ this -> mnLookahead = $ lookahead ; $ this -> mnAction = $ action ; } } $ this -> aLookahead [ $ this -> nLookahead ] = array ( 'lookahead' => $ lookahead , 'action' => $ action ) ; $ this -> nLookahead ++ ; }
Add a new action to the current transaction set