idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
59,200
public function validateAttribute ( $ object , $ attribute ) { $ this -> columnCount -- ; $ file = $ object -> $ attribute ; if ( ! $ file instanceof CUploadedFile ) { $ file = CUploadedFile :: getInstance ( $ object , $ attribute ) ; if ( null === $ file ) return $ this -> emptyAttribute ( $ object , $ attribute ) ; } $ this -> validateCSVHeaders ( $ object , $ attribute , $ file ) ; $ this -> validateCSVRows ( $ object , $ attribute , $ file ) ; }
Main entry point for validation . This method is called via the model s rules method when using the csv validator
59,201
protected function validateCSVHeaders ( $ object , $ attribute , $ file ) { $ file = fopen ( $ file -> getTempName ( ) , "r" ) ; $ headerColumns = $ this -> explodeToColumns ( fgets ( $ file ) ) ; if ( $ headerColumns == array ( ) ) { $ this -> addError ( $ object , $ attribute , 'Could not read header line. File empty? Make sure it uses: ' . implode ( $ this -> separator , $ this -> columnNames ) ) ; } if ( $ headerColumns != $ this -> columnNames ) { $ this -> addError ( $ object , $ attribute , 'Wrong headers. Make sure the file uses: ' . implode ( $ this -> separator , $ this -> columnNames ) ) ; } fclose ( $ file ) ; }
Validates the headers of a csv file
59,202
protected function validateCSVRows ( $ object , $ attribute , $ file ) { $ this -> countryColumnNumber -- ; $ countrySynonyms = Yii :: app ( ) -> params [ 'countrySynonyms' ] ; $ allowedCountrySynonyms = array ( ) ; foreach ( $ countrySynonyms as $ countrySynonymsRow ) { foreach ( explode ( ',' , $ countrySynonymsRow ) as $ synonym ) { $ allowedCountrySynonyms [ ] = $ synonym ; } } $ file = fopen ( $ file -> getTempName ( ) , "r" ) ; $ rowNumber = 1 ; while ( ! feof ( $ file ) ) { $ line = fgets ( $ file ) ; if ( $ rowNumber == 1 ) { $ rowNumber ++ ; continue ; } else { $ separatorCount = substr_count ( $ line , $ this -> separator ) ; if ( $ separatorCount != $ this -> columnCount ) { $ this -> addError ( $ object , $ attribute , 'Wrong separator count in row ' . $ rowNumber . '. ' . $ separatorCount . ' "' . $ this -> separator . '" found. Expected: ' . $ this -> columnCount . '!' ) ; return false ; } $ line = $ this -> explodeToColumns ( $ line ) ; $ countryValue = trim ( strtolower ( $ line [ $ this -> countryColumnNumber ] ) ) ; if ( $ countryValue != '' && ! in_array ( $ countryValue , $ allowedCountrySynonyms ) ) { $ this -> addError ( $ object , $ attribute , 'Unknown country value "' . $ countryValue . '" in row ' . $ rowNumber . '!' ) ; } } $ rowNumber ++ ; } fclose ( $ file ) ; }
Validates every row in a csv
59,203
protected function explodeToColumns ( $ row ) { $ columns = explode ( $ this -> separator , $ row ) ; foreach ( $ columns as $ column => $ value ) { $ columns [ $ column ] = trim ( $ value ) ; } return $ columns ; }
Explodes a row to columns and returns the resulting array
59,204
public static function getServerDatetime ( $ p_plus = null ) { $ datetime = new \ Datetime ( ) ; if ( $ p_plus !== null ) { $ datetime -> add ( new \ DateInterval ( 'PT' . $ p_plus . 'M' ) ) ; } return $ datetime -> format ( 'Y-m-d H:i:s' ) ; }
Return a datetime
59,205
public static function getCurrentTimestamp ( $ p_plus = null ) { $ datetime = new \ Datetime ( ) ; if ( $ p_plus !== null ) { if ( $ p_plus > 0 ) { $ datetime -> add ( new \ DateInterval ( 'PT' . $ p_plus . 'M' ) ) ; } else { $ datetime -> sub ( new \ DateInterval ( 'PT' . ( - 1 * $ p_plus ) . 'M' ) ) ; } } return $ datetime -> format ( 'Y-m-d H:i:s' ) ; }
Return a datetime as string
59,206
public static function ddmmyyyyToMysql ( $ p_date ) { if ( $ p_date !== null && $ p_date != '' ) { $ format = 'd/m/Y H:i:s' ; $ date = \ DateTime :: createFromFormat ( $ format , $ p_date ) ; if ( $ date === false ) { $ format = 'd/m/Y H:i' ; $ date = \ DateTime :: createFromFormat ( $ format , $ p_date ) ; } if ( $ date !== false ) { return $ date -> format ( 'Y-m-d H:i:s' ) ; } } return null ; }
Conversion d une date en chaine
59,207
public static function mysqlToddmmyyyy ( $ p_date , $ p_withSeconds = false , $ p_withHour = true ) { if ( $ p_date !== null && $ p_date != '' ) { $ format1 = 'Y-m-d H:i:s' ; $ format2 = 'Y-m-d' ; if ( $ p_withSeconds && $ p_withHour ) { $ oFormat = 'd/m/Y H:i:s' ; } else { if ( $ p_withHour ) { $ oFormat = 'd/m/Y H:i' ; } else { $ oFormat = 'd/m/Y' ; } } $ date = \ DateTime :: createFromFormat ( $ format1 , $ p_date ) ; if ( $ date === false ) { $ date = \ DateTime :: createFromFormat ( $ format2 , $ p_date ) ; } if ( $ date !== false ) { return $ date -> format ( $ oFormat ) ; } } return null ; }
Affichage d une date au format EU
59,208
public static function mysqlToDatetime ( $ p_date ) { $ date = new \ Datetime ( ) ; if ( $ p_date !== null && $ p_date != '' ) { $ format = 'Y-m-d H:i:s' ; $ date = \ DateTime :: createFromFormat ( $ format , $ p_date ) ; if ( $ date === false ) { $ date = new \ Datetime ( ) ; } } return $ date ; }
Conversion d une date mysql en DateTime
59,209
public static function datetimeToMysql ( $ p_date , $ p_withSeconds = false , $ p_withHour = true ) { $ format = 'Y-m-d' ; if ( $ p_withSeconds && $ p_withHour ) { $ format = 'Y-m-d H:i:s' ; } else { if ( $ p_withHour ) { $ format = 'Y-m-d H:i' ; } } return $ p_date -> format ( $ format ) ; }
Converti un datetime en format de base
59,210
public function getAvailability ( $ excludeId = null ) { if ( ! $ this -> Active ) { return array ( 'available' => false , 'reason' => 'Ticket is not active.' ) ; } $ start = strtotime ( $ this -> StartDate ) ; if ( $ this -> StartDate && $ start >= time ( ) ) { return array ( 'available' => false , 'reason' => 'Tickets are not yet available.' , 'available_at' => $ start ) ; } $ end = strtotime ( $ this -> EndDate ) ; if ( $ this -> EndDate && time ( ) >= $ end ) { return array ( 'available' => false , 'reason' => 'Tickets are no longer available.' ) ; } if ( ! $ quantity = $ this -> Available ) { return array ( 'available' => true ) ; } $ bookings = $ this -> getBookedAttendees ( ) ; if ( $ excludeId ) { $ bookings = $ bookings -> filter ( 'EventRegistration.ID:not' , $ excludeId ) ; } $ bookedcount = $ bookings -> count ( ) ; if ( $ bookedcount >= $ quantity ) { return array ( 'available' => false , 'reason' => 'All tickets have been booked.' ) ; } return array ( 'available' => $ quantity - $ bookedcount ) ; }
Returns the number of tickets available for an event time .
59,211
private function replaceLegacyTokenAuthenticator ( ContainerBuilder $ container ) { if ( ( int ) Kernel :: MAJOR_VERSION === 2 && Kernel :: MINOR_VERSION < 8 ) { $ definition = $ container -> getDefinition ( 'tree_house.keystone.token_authenticator' ) ; $ definition -> setClass ( LegacyTokenAuthenticator :: class ) ; } }
Replaces token authenticator service with legacy class for older Symfony versions .
59,212
public function register ( Container $ app ) { $ app [ 'sanity.client.options' ] = [ 'projectId' => null , 'dataset' => null , ] ; $ app [ 'sanity.client' ] = function ( Application $ app ) { return new Client ( $ app [ 'sanity.client.options' ] ) ; } ; }
Register the API client as a service in the container
59,213
public function regenerateToken ( $ name = null ) { $ this -> initialize ( ) ; $ name = $ this -> hashName ( $ name ) ; $ this -> tokens [ $ name ] = $ this -> getUniqueToken ( ) ; if ( ! isset ( $ _SESSION [ $ this -> key ] ) || ! is_array ( $ _SESSION [ $ this -> key ] ) ) { $ _SESSION [ $ this -> key ] = [ ] ; } $ _SESSION [ $ this -> key ] [ $ name ] = $ this -> tokens [ $ name ] ; return $ this -> tokens [ $ name ] ; }
Regenerate a CSRF token
59,214
protected function getUniqueToken ( ) { $ length = 64 ; if ( function_exists ( 'random_bytes' ) ) { return base64_encode ( random_bytes ( $ length ) ) ; } if ( function_exists ( 'openssl_random_pseudo_bytes' ) ) { return base64_encode ( openssl_random_pseudo_bytes ( $ length ) ) ; } if ( function_exists ( 'password_hash' ) ) { return base64_encode ( password_hash ( uniqid ( ) , PASSWORD_DEFAULT , [ 'cost' => 4 ] ) ) ; } $ token = '' ; for ( $ i = 0 ; $ i < 4 ; $ i ++ ) { $ token .= uniqid ( rand ( 0 , 10000 ) ) ; } return base64_encode ( str_shuffle ( $ token ) ) ; }
Generate a unique token using the best pseudo random generation for the current system
59,215
protected function initialize ( ) { if ( $ this -> initialized ) { return true ; } if ( session_status ( ) !== PHP_SESSION_NONE ) { if ( isset ( $ _SESSION [ $ this -> key ] ) && is_array ( $ _SESSION [ $ this -> key ] ) ) { $ this -> tokens = $ _SESSION [ $ this -> key ] ; } $ this -> initialized = true ; } else { throw new CsrfSessionException ( 'A session must be started before the Csrf library can be used' ) ; } }
Get current session tokens if there are any .
59,216
public function addCustomServiceAccount ( $ account , $ nickName , $ password ) { $ url = sprintf ( self :: CS_ACCOUNT_ADD_URL , $ this -> getAccessTokenString ( ) ) ; $ client = $ this -> getHttpClient ( ) ; $ client -> setUrl ( $ url ) ; $ client -> setHeaderArray ( [ 'Content-Type: application/json' ] ) ; $ client -> setMethod ( Client :: METHOD_POST ) ; $ client -> setPostFields ( $ this -> createCustomServiceParamString ( $ account , $ nickName , $ password ) ) ; if ( ! $ client -> exec ( ) ) { throw new Exception ( "call addCustomServiceAccount fail" ) ; } $ result = json_decode ( $ client -> getResponse ( ) , true ) ; if ( isset ( $ result [ 'errcode' ] ) && isset ( $ result [ 'errmsg' ] ) ) { return ( 0 == $ result [ 'errcode' ] ) ; } throw new Exception ( "error response for add custom service account" ) ; }
add custom service account
59,217
public function getCustomServiceAccountList ( ) { $ url = sprintf ( self :: CS_ACCOUNT_LISTS_URL , $ this -> getAccessTokenString ( ) ) ; $ client = $ this -> getHttpClient ( ) ; $ client -> setUrl ( $ url ) ; $ client -> setHeaderArray ( [ 'Content-Type: application/json' ] ) ; if ( ! $ client -> exec ( ) ) { throw new Exception ( "call get custom service account list fail" ) ; } $ result = json_decode ( $ client -> getResponse ( ) , true ) ; if ( isset ( $ result [ 'errcode' ] ) ) { throw new Exception ( "error response for get custom service account list" ) ; } return $ result ; }
get custom service account list
59,218
public function sendCustomServiceMessage ( WxSendMsg $ msg ) { $ url = sprintf ( self :: CS_SEND_MESSAGE_URL , $ this -> getAccessTokenString ( ) ) ; $ client = $ this -> getHttpClient ( ) ; $ client -> setUrl ( $ url ) ; $ client -> setHeaderArray ( [ 'Content-Type: application/json' ] ) ; $ client -> setMethod ( Client :: METHOD_POST ) ; $ client -> setPostFields ( $ this -> getFormatter ( ) -> toJsonString ( $ msg ) ) ; if ( ! $ client -> exec ( ) ) { throw new Exception ( "call send custom service message fail" ) ; } $ result = json_decode ( $ client -> getResponse ( ) , true ) ; if ( isset ( $ result [ 'errcode' ] ) && isset ( $ result [ 'errmsg' ] ) ) { return ( 0 == $ result [ 'errcode' ] ) ; } throw new Exception ( "error response for sending custom service message" ) ; }
send custom service message
59,219
protected function createQRCodeTicket ( $ value , $ type ) { $ url = sprintf ( self :: QR_CODE_URL , $ this -> getAccessTokenString ( ) ) ; $ client = $ this -> getHttpClient ( ) ; $ client -> setUrl ( $ url ) ; $ client -> setHeaderArray ( [ 'Content-Type: application/json' ] ) ; $ client -> setMethod ( Client :: METHOD_POST ) ; $ str = '{"expire_seconds": ' . self :: QR_CODE_EXPIRE_TIME . ', "action_name": "%s", "action_info": {"scene": {"scene_id": %d}}}' ; $ msg = sprintf ( $ str , $ type , $ value ) ; $ client -> setPostFields ( $ msg ) ; if ( ! $ client -> exec ( ) ) { throw new Exception ( "call send custom service message fail" ) ; } $ result = json_decode ( $ client -> getResponse ( ) , true ) ; if ( isset ( $ result [ 'errcode' ] ) ) { throw new Exception ( "error response for createQRCodeTicket " . $ result [ 'errmsg' ] ) ; } return $ result ; }
create qr code ticket
59,220
function createTemplate ( $ class = NULL , callable $ latteFactory = NULL ) { $ template = $ this -> getTemplateFactory ( ) -> createTemplate ( $ this ) ; $ latte = $ template -> getLatte ( ) ; $ macroSet = new Latte \ Macros \ MacroSet ( $ latte -> getCompiler ( ) ) ; $ macroSet -> addMacro ( 'url' , function ( ) { } ) ; $ params = $ this -> request -> getParameters ( ) ; $ template -> presenter = $ this ; $ template -> context = $ this -> context ; $ file = self :: actionToFilename ( $ params [ 'action' ] ) ; if ( $ file { 0 } !== '/' ) { $ file = $ this -> getPagesDir ( ) . DIRECTORY_SEPARATOR . $ file ; if ( ! Strings :: endsWith ( $ file , '.latte' ) ) { $ file .= '.latte' ; } } $ template -> setFile ( $ file ) ; if ( $ this -> getHttpRequest ( ) ) { $ url = $ this -> getHttpRequest ( ) -> getUrl ( ) ; $ template -> baseUrl = rtrim ( $ url -> getBaseUrl ( ) , '/' ) ; $ template -> basePath = rtrim ( $ url -> getBasePath ( ) , '/' ) ; } return $ template ; }
Template factory .
59,221
public function fetchAll ( ) { $ result = $ this -> statement -> fetchAll ( \ PDO :: FETCH_ASSOC ) ; $ rows = array ( ) ; if ( $ this -> model !== null ) { foreach ( $ result as $ row ) { $ model = $ this -> model ; $ rows [ ] = new $ model ( $ row , false ) ; } } else { foreach ( $ result as $ row ) { $ rows [ ] = $ row ; } } return $ rows ; }
Fetches all the rows .
59,222
public function get_response ( ) { Kohana_Exception :: log ( $ this ) ; if ( Kohana :: $ environment >= Kohana :: DEVELOPMENT ) { return parent :: get_response ( ) ; } else { return self :: _handler ( $ this ) ; $ params = array ( 'action' => $ this -> getCode ( ) , 'message' => rawurlencode ( $ this -> getMessage ( ) ) ) ; return Request :: factory ( Route :: get ( 'error' ) -> uri ( $ params ) ) -> execute ( ) ; } }
Generate a Response for all Exceptions without a more specific override
59,223
public function generateImage ( DiagrammInterface $ diagramm ) { $ dslText = $ this -> generateDslText ( $ diagramm ) ; $ diagramm -> setAsText ( $ dslText ) ; return $ this -> getProxy ( ) -> requestDiagramm ( $ diagramm -> getType ( ) , $ dslText ) ; }
Generates an image of the diagramm
59,224
public function generateDslText ( DiagrammInterface $ diagramm ) { $ dslText = '' ; foreach ( $ diagramm -> getNodes ( ) as $ node ) { $ dslText .= $ this -> nodeToDslText ( $ node ) ; $ dslText .= ',' ; $ dslText .= $ this -> noteFromNodeToDslText ( $ node ) ; foreach ( $ node -> getDependencies ( ) as $ dependency ) { $ dslText .= $ this -> dependencyToDslText ( $ dependency ) ; $ dslText .= ',' ; } } if ( substr ( $ dslText , - 1 , 1 ) == ',' ) { $ dslText = substr ( $ dslText , 0 , - 1 ) ; } return $ dslText ; }
Generates dsl text for the diagramm
59,225
public function nodeToDslText ( NodeInterface $ node ) { switch ( $ node -> getNodeType ( ) ) { case Node :: TYPE_USE_CASE : return $ this -> useCaseNodeToDslText ( $ node ) ; break ; default : throw new \ InvalidArgumentException ( 'Unknown node type "' . $ node -> getNodeType ( ) . '"' ) ; break ; } }
Converts a node to dsl text
59,226
public function noteFromNodeToDslText ( NodeInterface $ node ) { if ( ! $ node instanceof NoteProviderInterface ) { throw new \ InvalidArgumentException ( 'Node must implement NoteProviderInterface' ) ; } $ note = $ node -> getNote ( ) ; $ noteBg = $ node -> getNoteBg ( ) ; if ( ! is_string ( $ note ) || strlen ( $ note ) < 1 ) { return '' ; } if ( ! is_string ( $ noteBg ) || strlen ( $ noteBg ) < 1 ) { $ noteBg = NoteProviderInterface :: BG_BEIGE ; } $ noteDslText = $ this -> useCaseNodeToDslText ( $ node ) . $ this -> dependncyTypeToDslText [ Dependency :: TYPE_ASSOCIATION ] . sprintf ( $ this -> nodeTypeToDslText [ Node :: TYPE_NOTE ] , $ note , $ noteBg ) . ',' ; return $ noteDslText ; }
Converts a note of a node to dsl text
59,227
public function dependencyToDslText ( DependencyInterface $ dependency ) { $ type = $ dependency -> getType ( ) ; if ( ! array_key_exists ( $ type , $ this -> dependncyTypeToDslText ) ) { throw new \ InvalidArgumentException ( 'Unknown dependncy type "' . $ type . '"' ) ; } $ dslText = $ this -> nodeToDslText ( $ dependency -> getFromNode ( ) ) . $ this -> dependncyTypeToDslText [ $ type ] . $ this -> nodeToDslText ( $ dependency -> getToNode ( ) ) ; return $ dslText ; }
Converts a dependency to dsl text
59,228
protected function useCaseNodeToDslText ( NodeInterface $ node ) { $ dslText = sprintf ( $ this -> nodeTypeToDslText [ Node :: TYPE_USE_CASE ] , $ this -> getFilter ( ) -> filter ( $ node -> getNodeName ( ) ) ) ; return $ dslText ; }
Converts a node of type use case to dsl text
59,229
protected static function __classSort ( ClassReflection $ a , ClassReflection $ b ) { if ( $ a -> getSort ( ) > $ b -> getSort ( ) ) { return - 1 ; } if ( $ a -> getSort ( ) < $ b -> getSort ( ) ) { return 1 ; } return 0 ; }
Callback for trait sort
59,230
public static function get ( string $ channel , array $ handlers ) { $ logger = new static ( ) ; return $ logger -> setUid ( static :: generateUid ( ) ) -> setHandlers ( $ handlers ) -> setChannel ( $ channel ) ; }
Construye un logger
59,231
public function log ( $ level , $ message , array $ context = array ( ) ) : Logger { $ msg = $ this -> formatMessage ( $ level , $ message , $ context ) ; foreach ( $ this -> handlers as $ handler ) { $ handler ( $ level , $ msg ) ; } return $ this ; }
Publica un mensaje
59,232
public function formatMessage ( $ level , string $ message , array $ context = array ( ) ) : string { $ dateTime = new \ DateTime ( ) ; $ dateTime -> setTimezone ( static :: timezone ( ) ) ; return $ dateTime -> format ( '[c]' ) . " " . $ this -> getLogLevelName ( $ level ) . " @" . $ this -> channel . " uid:" . $ this -> uid . " - " . $ message . " - " . json_encode ( $ context ) ; }
Renderiza el formato del mensaje
59,233
protected function getPhpRequiredVersion ( ) { if ( ! file_exists ( $ path = $ this -> rootPath . '/composer.lock' ) ) { return self :: LEGACY_REQUIRED_PHP_VERSION ; } $ composerLock = json_decode ( file_get_contents ( $ path ) , true ) ; foreach ( $ composerLock [ 'packages' ] as $ package ) { if ( $ package [ 'name' ] === 'bolt/bolt' ) { return ( int ) $ package [ 'version' ] [ 1 ] > 3 ? self :: REQUIRED_PHP_VERSION : self :: LEGACY_REQUIRED_PHP_VERSION ; } } return self :: LEGACY_REQUIRED_PHP_VERSION ; }
Finds the PHP required version from Bolt version .
59,234
public function where ( $ parameter , $ value ) { if ( ! $ this -> verify ( $ parameter , $ value ) ) { return true ; } $ this -> search = $ this -> search -> where ( $ parameter , 'LIKE' , '%' . $ value . '%' ) ; }
Search a column on the model .
59,235
public function whereHas ( $ parameter , $ value ) { if ( ! $ this -> verify ( $ parameter , $ value ) ) { return true ; } $ this -> search = $ this -> search -> whereHas ( $ parameter , function ( $ query ) use ( $ value ) { $ query -> where ( 'rbac_roles.id' , $ value ) ; } ) ; }
Search the model for a particular relationship . This method expects to be passed the ID but the parameter name should be the relationship name .
59,236
protected function verify ( $ parameter , $ value ) { $ type = array_get ( $ this -> model -> getSearchParameters ( ) , $ parameter ) ; switch ( $ type ) { case 'array' : $ typeCheck = is_array ( $ value ) && ! empty ( array_filter ( $ value ) ) ; break ; case 'string' : $ typeCheck = ! is_numeric ( $ value ) && is_string ( $ value ) && $ value !== '' ; break ; case 'bool' : case 'boolean' : $ typeCheck = $ value != '' && ( int ) $ value !== 2 && in_array ( ( int ) $ value , [ 0 , 1 ] ) ; break ; case 'int' : case 'integer' : $ typeCheck = is_numeric ( $ value ) && ( int ) $ value > 0 ; break ; } return ! is_null ( $ value ) && $ typeCheck ; }
Check if the given value is actually empty . This aims to help with discrepancies caused by form submission .
59,237
public function register ( $ customizeManager ) { $ customizeManager -> add_section ( 'clean_document_head' , [ 'title' => __ ( 'Clean Document Head' , 'novusopress' ) , 'description' => __ ( 'Allows you to remove extra HTML tags from the document head' , 'novusopress' ) , 'capability' => 'edit_theme_options' , 'priority' => 900 ] ) ; $ customizeManager -> add_setting ( 'novusopress_theme_options[clean_document_head]' , [ 'default' => true , 'type' => 'option' , 'capability' => 'edit_theme_options' ] ) ; $ customizeManager -> add_control ( 'novusopress_theme_options[clean_document_head]' , [ 'section' => 'clean_document_head' , 'settings' => 'novusopress_theme_options[clean_document_head]' , 'label' => __ ( 'Remove extra HTML tags' , 'novusopress' ) , 'type' => 'checkbox' ] ) ; $ customizeManager -> add_section ( 'display_breadcrumbs' , [ 'title' => __ ( 'Breadcrumbs Navigation' , 'novusopress' ) , 'description' => __ ( 'Allows you to control the display of breadcrumbs navigation' , 'novusopress' ) , 'capability' => 'edit_theme_options' , 'priority' => 130 ] ) ; $ customizeManager -> add_setting ( 'novusopress_theme_options[display_breadcrumbs]' , [ 'default' => true , 'type' => 'option' , 'capability' => 'edit_theme_options' ] ) ; $ customizeManager -> add_control ( 'novusopress_theme_options[display_breadcrumbs]' , [ 'section' => 'display_breadcrumbs' , 'settings' => 'novusopress_theme_options[display_breadcrumbs]' , 'label' => __ ( 'Display breadcrumbs' , 'novusopress' ) , 'type' => 'checkbox' ] ) ; $ customizeManager -> add_setting ( 'novusopress_theme_options[navbar_location]' , [ 'default' => 'below' , 'type' => 'option' , 'capability' => 'edit_theme_options' ] ) ; $ customizeManager -> add_control ( 'novusopress_theme_options[navbar_location]' , [ 'section' => 'nav' , 'settings' => 'novusopress_theme_options[navbar_location]' , 'label' => __ ( 'Navbar Location' , 'novusopress' ) , 'type' => 'select' , 'choices' => [ 'below' => __ ( 'Below Header' , 'novusopress' ) , 'fixed' => __ ( 'Fixed Top' , 'novusopress' ) , 'static' => __ ( 'Static Top' , 'novusopress' ) ] ] ) ; $ customizeManager -> add_setting ( 'novusopress_theme_options[navbar_color]' , [ 'default' => 'default' , 'type' => 'option' , 'capability' => 'edit_theme_options' ] ) ; $ customizeManager -> add_control ( 'novusopress_theme_options[navbar_color]' , [ 'section' => 'nav' , 'settings' => 'novusopress_theme_options[navbar_color]' , 'label' => __ ( 'Navbar Color' , 'novuopress' ) , 'type' => 'select' , 'choices' => [ 'default' => __ ( 'Light' , 'novusopress' ) , 'inverse' => __ ( 'Dark' , 'novusopress' ) , 'primary' => __ ( 'Custom' , 'novusopress' ) ] ] ) ; $ customizeManager -> get_setting ( 'novusopress_theme_options[navbar_location]' ) -> transport = 'postMessage' ; $ customizeManager -> get_setting ( 'novusopress_theme_options[navbar_color]' ) -> transport = 'postMessage' ; }
Registers theme customizations
59,238
public static function gravatarHasher ( string $ string ) { $ string = strtolower ( $ string ) ; $ string = md5 ( $ string ) ; return $ string ; }
Hashes strings for Gravatar .
59,239
public function getConfiguration ( Request $ request ) { $ this -> request = $ request ; return [ 'headers' => $ request -> getHeaders ( ) -> all ( ) , 'query' => $ request -> getParameters ( ) -> all ( ) , ] ; }
Format the request for Guzzle .
59,240
public function interactiveGetAccessToken ( $ reason = null , $ redirectURL = null , $ errorURL = null ) { $ redirectURL = ( empty ( $ redirectURL ) ? $ _SERVER [ 'REQUEST_URI' ] : $ redirectURL ) ; $ errorURL = ( empty ( $ errorURL ) ? DataUtilities :: URLfromPath ( __DIR__ . '/../error.php' ) : $ errorURL ) ; $ canvas = $ this -> metadata [ 'TOOL_CANVAS_API' ] ; if ( ! empty ( $ canvas [ 'key' ] ) && ! empty ( $ canvas [ 'secret' ] ) ) { if ( session_status ( ) !== PHP_SESSION_ACTIVE ) { session_start ( ) ; } $ _SESSION [ 'oauth' ] = [ 'purpose' => $ this -> metadata [ 'TOOL_NAME' ] , 'key' => $ canvas [ 'key' ] , 'secret' => $ canvas [ 'secret' ] ] ; header ( 'Location: ' . DataUtilities :: URLfromPath ( __DIR__ . '/../oauth.php' ) . '?' . http_build_query ( [ 'oauth-return' => $ redirectURL , 'oauth-error' => $ errorURL , 'reason' => $ reason ] ) ) ; return ; } else { throw new ConfigurationException ( 'Missing OAuth key/secret pair in configuration, which is ' . 'required to interactively acquire an API access token' , ConfigurationException :: CANVAS_API_MISSING ) ; } }
Interactively acquire an API access token
59,241
public function interactiveConsumersControlPanel ( ) { $ name = ( empty ( $ _POST [ 'name' ] ) ? null : trim ( $ _POST [ 'name' ] ) ) ; $ key = ( empty ( $ _POST [ 'key' ] ) ? null : trim ( $ _POST [ 'key' ] ) ) ; $ secret = ( empty ( $ _POST [ 'secret' ] ) ? null : trim ( $ _POST [ 'secret' ] ) ) ; $ enabled = ( empty ( $ _POST [ 'enabled' ] ) ? false : ( boolean ) $ _POST [ 'enabled' ] ) ; $ action = ( empty ( $ _POST [ 'action' ] ) ? false : strtolower ( trim ( $ _POST [ 'action' ] ) ) ) ; $ consumer = $ this -> interactiveConsumersControlPanel_loadConsumer ( $ key ) ; switch ( $ action ) { case 'update' : case 'insert' : $ consumer -> name = $ name ; $ consumer -> secret = $ secret ; $ consumer -> enabled = $ enabled ; if ( ! $ consumer -> save ( ) ) { $ this -> smarty_addMessage ( 'Error saving consumer' , 'There was an error attempting to save your new or ' . 'updated consumer information to the database.' , NotificationMessage :: DANGER ) ; } break ; case 'delete' : $ consumer -> delete ( ) ; break ; case 'select' : $ this -> smarty_assign ( 'key' , $ key ) ; break ; } if ( $ action && $ action !== 'select' ) { $ consumer = $ this -> interactiveConsumersControlPanel_loadConsumer ( ) ; } $ consumers = $ this -> lti_getConsumers ( ) ; $ this -> smarty_assign ( [ 'name' => 'Consumers' , 'category' => 'Control Panel' , 'consumers' => $ consumers , 'consumer' => $ consumer , 'formAction' => $ _SERVER [ 'PHP_SELF' ] , 'appUrl' => $ this -> metadata [ 'APP_URL' ] ] ) ; $ this -> smarty_display ( 'consumers-control-panel.tpl' ) ; }
Handle tool consumer management interactively
59,242
public function getCache ( ) { if ( empty ( $ this -> cache ) ) { $ this -> cache = new HierarchicalSimpleCache ( $ this -> getMySQL ( ) , basename ( __FILE__ , '.php' ) ) ; } return $ this -> cache ; }
Get the cache manager
59,243
public function getSmarty ( ) { if ( empty ( $ this -> smarty ) ) { $ this -> smarty = StMarksSmarty :: getSmarty ( ) ; $ this -> smarty -> prependTemplateDir ( realpath ( __DIR__ . '/../templates' ) , __CLASS__ ) ; $ this -> smarty -> setFramed ( true ) ; } return $ this -> smarty ; }
Get the HTML templating engine
59,244
public function smarty_assign ( $ varname , $ var = null , $ noCache = false ) { return $ this -> getSmarty ( ) -> assign ( $ varname , $ var , $ noCache ) ; }
Assign a value to a template variables
59,245
public function smarty_addTemplateDir ( $ template , $ key = null , $ isConfig = false ) { return $ this -> getSmarty ( ) -> addTemplateDir ( $ template , $ key , $ isConfig ) ; }
Register another template directory
59,246
public function smarty_addMessage ( $ title , $ content , $ class = NotificationMessage :: INFO ) { return $ this -> getSmarty ( ) -> addMessage ( $ title , $ content , $ class ) ; }
Add a message to be displayed to the user
59,247
public function smarty_display ( $ template = 'page.tpl' , $ cache_id = null , $ compile_id = null , $ parent = null ) { return $ this -> getSmarty ( ) -> display ( $ template , $ cache_id , $ compile_id , $ parent ) ; }
Display an HTML template
59,248
public static function Tcbtdb ( $ tcb1 , $ tcb2 , & $ tdb1 , & $ tdb2 ) { $ t77td = DJM0 + DJM77 ; $ t77tf = TTMTAI / DAYSEC ; $ tdb0 = TDB0 / DAYSEC ; $ d ; if ( $ tcb1 > $ tcb2 ) { $ d = $ tcb1 - $ t77td ; $ tdb1 = $ tcb1 ; $ tdb2 = $ tcb2 + $ tdb0 - ( $ d + ( $ tcb2 - $ t77tf ) ) * ELB ; } else { $ d = $ tcb2 - $ t77td ; $ tdb1 = $ tcb1 + $ tdb0 - ( $ d + ( $ tcb1 - $ t77tf ) ) * ELB ; $ tdb2 = $ tcb2 ; } return 0 ; }
- - - - - - - - - - i a u T c b t d b - - - - - - - - - -
59,249
private function addStackContext ( Exception $ exceptionRoot , array $ context ) { $ exception = $ exceptionRoot ; do { $ context = $ this -> processExceptionContext ( $ exception , $ context ) ; } while ( $ exception = $ exception -> getPrevious ( ) ) ; return $ context ; }
Add the context of each exception in the stack .
59,250
public function switchLocale ( $ locale ) { if ( in_array ( $ locale , $ this -> config [ 'locales' ] ) ) { app ( 'session' ) -> put ( 'administrator_locale' , $ locale ) ; } return redirect ( ) -> back ( ) ; }
POST method for switching a user s locale .
59,251
public function useStructureNodeQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinStructureNode ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'StructureNode' , '\gossi\trixionary\model\StructureNodeQuery' ) ; }
Use the StructureNode relation StructureNode object
59,252
public function useSkillRelatedBySkillIdQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinSkillRelatedBySkillId ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'SkillRelatedBySkillId' , '\gossi\trixionary\model\SkillQuery' ) ; }
Use the SkillRelatedBySkillId relation Skill object
59,253
public function useRootSkillQuery ( $ relationAlias = null , $ joinType = Criteria :: LEFT_JOIN ) { return $ this -> joinRootSkill ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'RootSkill' , '\gossi\trixionary\model\SkillQuery' ) ; }
Use the RootSkill relation Skill object
59,254
public function setMaxRuntime ( $ maxRuntime ) { if ( ! is_numeric ( $ maxRuntime ) ) { throw new InvalidArgumentException ( 'Expected numeric $$maxRuntime argument' ) ; } $ this -> maxRuntime = ( int ) $ maxRuntime ; return $ this ; }
Set the maximum runtime in seconds .
59,255
protected function registerGatekeeper ( ) { $ parent = $ this ; $ this -> app -> singleton ( GatekeeperContract :: class , function ( ) use ( $ parent ) { return $ parent -> createGatekeeper ( ) ; } ) ; }
Register the gatekeeper
59,256
public function attachByScope ( CakeEventListener $ subscriber , $ manager = null , $ scope = null ) { if ( ! ( $ manager instanceof CakeEventManager ) ) { $ scope = $ manager ; $ _this = $ this ; } else { $ _this = $ manager ; } if ( empty ( $ scope ) ) { $ _this -> attach ( $ subscriber ) ; return ; } foreach ( $ subscriber -> implementedEvents ( ) as $ eventKey => $ function ) { if ( strpos ( $ eventKey , $ scope ) !== 0 ) { continue ; } $ options = array ( ) ; $ method = $ function ; if ( is_array ( $ function ) && isset ( $ function [ 'callable' ] ) ) { list ( $ method , $ options ) = $ _this -> _extractCallable ( $ function , $ subscriber ) ; } elseif ( is_array ( $ function ) && is_numeric ( key ( $ function ) ) ) { foreach ( $ function as $ f ) { list ( $ method , $ options ) = $ _this -> _extractCallable ( $ f , $ subscriber ) ; $ _this -> attach ( $ method , $ eventKey , $ options ) ; } continue ; } if ( is_string ( $ method ) ) { $ method = array ( $ subscriber , $ function ) ; } $ _this -> attach ( $ method , $ eventKey , $ options ) ; } }
Attach listeners for a specific scope only .
59,257
protected function registerBlockBladeDirective ( ) { Blade :: directive ( 'block' , function ( $ expression ) { $ expression = $ this -> sanitizeExpression ( $ expression ) ; list ( $ module , $ component ) = explode ( '::' , $ expression ) ; if ( view ( ) -> exists ( "$module::blocks.$component" ) ) { return "<?php echo \$__env->make('$module::blocks.$component', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>" ; } } ) ; }
Register the Blade directive for Blocks .
59,258
protected function bootModuleComponents ( ) { foreach ( $ this -> app [ 'modules' ] -> enabled ( ) as $ module ) { if ( $ this -> moduleHasBlocks ( $ module ) ) { $ this -> bootModuleBlocks ( $ module ) ; } } }
Boot components for all enabled modules .
59,259
public function shouldProcess ( $ filename ) { $ destination = $ this -> getFinalName ( $ filename ) ; if ( ! File :: exists ( $ destination ) ) { return true ; } $ destinationChanged = File :: lastModified ( $ destination ) ; $ currentChanged = File :: lastModified ( $ filename ) ; if ( $ currentChanged > $ destinationChanged ) { return true ; } touch ( $ destination ) ; return false ; }
Determines whether or not we need to reprocess the file .
59,260
protected function write ( $ contents , $ assetFileName ) { $ directory = $ this -> getOutputDirectory ( $ assetFileName ) ; $ filename = self :: getOutputFileName ( $ assetFileName ) ; $ fullpath = $ directory . $ filename ; if ( ! file_exists ( $ directory ) ) { mkdir ( $ directory , 0777 , true ) ; } file_put_contents ( $ fullpath , $ contents ) ; return $ fullpath ; }
Used internally in order to write the current version of the file to disk .
59,261
protected function getLayoutData ( $ reload = false ) { if ( $ reload || ! isset ( $ this -> layoutData [ __CLASS__ ] ) ) { $ this -> layoutData [ __CLASS__ ] = $ this -> loadLayoutData ( ) ; } return $ this -> layoutData [ __CLASS__ ] ; }
Get the data that will be sent to the layout .
59,262
public function insert ( $ element , $ priority = 0 ) { $ data = [ ] ; $ inserted = false ; $ priority = $ priority === 0 ? $ this -> lastPriority : $ priority ; foreach ( $ this -> data as $ datum ) { $ inserted = $ this -> tryToInsert ( $ element , $ priority , $ data , $ datum ) ; $ data [ ] = [ 'element' => $ datum [ 'element' ] , 'priority' => $ datum [ 'priority' ] ] ; $ this -> lastPriority = $ datum [ 'priority' ] ; } if ( ! $ inserted ) { $ data [ ] = [ 'element' => $ element , 'priority' => $ priority ] ; $ this -> lastPriority = $ priority ; } $ this -> data = $ data ; return $ this ; }
Inserts the provided element in the right order given the priority
59,263
private function tryToInsert ( $ element , $ priority , & $ data , $ datum ) { $ inserted = false ; if ( $ datum [ 'priority' ] > $ priority ) { $ data [ ] = [ 'element' => $ element , 'priority' => $ priority ] ; $ inserted = true ; } return $ inserted ; }
Tries to insert the provided element in the passed data array
59,264
private function sanitizeHTML ( $ str ) { $ htmlValue = Injector :: inst ( ) -> create ( 'HTMLValue' , $ str ) ; $ santiser = Injector :: inst ( ) -> create ( 'HtmlEditorSanitiser' , HtmlEditorConfig :: get_active ( ) ) ; $ santiser -> sanitise ( $ htmlValue ) ; return $ htmlValue -> getContent ( ) ; }
Strips out not allowed tags mainly this is to remove the kapost beacon script so it doesn t conflict with the cms
59,265
public function getKeys ( ) : MList { $ list = new MList ( ) ; $ list -> appendArray ( array_keys ( $ this -> map ) ) ; return $ list ; }
Returns a list containing all the keys associated with value value in ascending order .
59,266
public function & getValue ( string $ key , $ defaultValue = null ) { if ( $ this -> isValidType ( $ defaultValue ) === false ) { throw new MWrongTypeException ( "\$value" , $ this -> getType ( ) , $ defaultValue ) ; } if ( isset ( $ this -> map [ $ key ] ) === false ) { return $ defaultValue ; } return $ this -> map [ $ key ] ; }
Returns the value associated with the key key .
59,267
public static function make ( ) { $ resolver = new TemplateResolver ( ) ; $ services = Provider :: getServices ( ) ; $ config = $ services -> get ( 'Config' ) ; if ( isset ( $ config [ 'error' ] [ 'html' ] [ 'templates' ] ) ) { $ templates = ( array ) $ config [ 'error' ] [ 'html' ] [ 'templates' ] ; foreach ( $ templates as $ template => $ path ) { $ resolver -> setTemplate ( $ template , $ path ) ; } } return $ resolver ; }
Makes the resolver .
59,268
public function set ( $ key , $ value ) { $ key = trim ( $ key , '.' ) ; if ( strpos ( $ key , '.' ) !== false ) { $ array = & $ this -> _items ; foreach ( explode ( '.' , $ key ) as $ v ) $ array = & $ array [ $ v ] ; $ array = $ value ; } else { $ this -> _items [ $ key ] = $ value ; } }
Add new item .
59,269
public function has ( $ key ) { $ key = trim ( $ key , '.' ) ; if ( strpos ( $ key , '.' ) !== false ) { $ array = & $ this -> _items ; foreach ( explode ( '.' , $ key ) as $ v ) { if ( ! isset ( $ array [ $ v ] ) ) return false ; else $ array = & $ array [ $ v ] ; } return true ; } else { return array_key_exists ( $ key , $ this -> _items ) ; } }
Check if item exist .
59,270
private function delete ( array & $ array , $ key ) { $ key = trim ( $ key , '.' ) ; if ( strpos ( $ key , '.' ) !== false ) { $ explode = explode ( '.' , $ key ) ; $ this -> delete ( $ array [ $ explode [ 0 ] ] , $ explode [ 1 ] ) ; } else { unset ( $ array [ $ key ] ) ; } }
Delete item from an array .
59,271
public function rename ( $ from , $ to ) { $ from = trim ( $ from , '.' ) ; $ to = trim ( $ to , '.' ) ; if ( $ this -> has ( $ from ) ) { $ value = $ this -> get ( $ from ) ; $ this -> remove ( $ from ) ; $ this -> set ( $ to , $ value ) ; return true ; } return false ; }
Rename item .
59,272
public function pulse ( string $ command , bool $ force = false ) { return $ this -> run ( 'php pulse ' . $ command . ( $ force ? ' --force' : '' ) ) ; }
Run registered console command . Artisan commands will running too .
59,273
public function render ( Path $ path ) { $ html = null ; $ t = new TemplateLocator ( $ path ) ; foreach ( $ t -> next ( ) as $ template ) { $ context = $ this -> buildContext ( $ path , $ template ) ; if ( $ context === null ) continue ; $ html = $ this -> renderOrAbort ( $ template , $ context ) ; if ( $ html !== null ) break ; } if ( $ html === null ) { $ pathWithoutExt = explode ( '/' , $ path -> getWithoutExtension ( ) ) ; $ fileWithoutExt = end ( $ pathWithoutExt ) ; if ( $ fileWithoutExt !== 'index' ) { return $ this -> render ( new Path ( $ path . '/index' ) ) ; } return null ; } foreach ( $ this -> resources as $ modelName => $ resource ) { if ( $ resource -> wasAccessed ( ) ) { $ this -> dispatcher -> dispatch ( RenderDependencyEvent :: NAME , new RenderDependencyEvent ( $ modelName , $ path ) ) ; } } $ this -> dispatcher -> dispatch ( RenderEvent :: NAME , new RenderEvent ( $ path , $ html ) ) ; return $ html ; }
Finds the appropriate way to render the requested page and returns a Response object .
59,274
public function getLocations ( ) { static $ _cwd = null ; static $ _paths = array ( 'public' , 'web' , ) ; if ( $ _cwd === null ) { $ _cwd = getcwd ( ) ; foreach ( $ _paths as $ _path ) { if ( is_dir ( $ _cwd . '/' . $ _path ) ) { $ this -> locations [ 'app' ] = $ _path . '/{$name}/' ; break ; } } } return parent :: getLocations ( ) ; }
DSP v1 uses web for HTML . DSP v2 will use public . This method checks to see which version we have and install to the proper directory .
59,275
public function getHostGroupsByHost ( Host $ host ) { return array_values ( array_filter ( $ this -> hostGroups , function ( $ g ) use ( $ host ) { return $ g -> hasHost ( $ host ) ; } ) ) ; }
Get the groups of which the supplied host is a member .
59,276
public static function validName ( string $ name ) : bool { $ enumerables = self :: getCache ( ) ; $ keys = array_keys ( $ enumerables ) ; return \ in_array ( $ name , $ keys , true ) ; }
Is a given name valid .
59,277
public static function validValue ( $ value ) : bool { $ enumerables = self :: getCache ( ) ; $ values = array_values ( $ enumerables ) ; return \ in_array ( $ value , $ values , true ) ; }
Does a given value exist in the cache .
59,278
public static function getName ( $ value ) { $ enumerables = self :: getCache ( ) ; $ result = array_search ( $ value , $ enumerables , true ) ; if ( $ result === false ) { throw EnumerableException :: valueNotFound ( ) ; } return $ result ; }
Return the name of the first constant to match a given value .
59,279
public static function getAllMatchingNames ( $ value ) : array { $ enumerables = self :: getCache ( ) ; $ result = array_keys ( $ enumerables , $ value , true ) ; if ( [ ] === $ result ) { throw EnumerableException :: valueNotFound ( ) ; } return $ result ; }
Return the names of all constants that match a given value .
59,280
public static function getValue ( string $ name ) { $ enumerables = self :: getCache ( ) ; if ( ! array_key_exists ( $ name , $ enumerables ) ) { throw EnumerableException :: nameInvalid ( $ name ) ; } return $ enumerables [ $ name ] ; }
Get value of a constant .
59,281
public static function getAllValues ( ) : array { $ enumerables = self :: getCache ( ) ; $ result = [ ] ; foreach ( $ enumerables as $ enumerable => $ value ) { $ result [ ] = $ value ; } return $ result ; }
Returns all enumerable values .
59,282
public static function getCache ( ) : array { $ caller = static :: class ; if ( ! array_key_exists ( $ caller , self :: $ cache ) ) { try { $ reflected_caller = new \ ReflectionClass ( $ caller ) ; self :: $ cache [ $ caller ] = $ reflected_caller -> getConstants ( ) ; } catch ( \ ReflectionException $ re ) { throw EnumerableException :: reflectionError ( $ re -> getMessage ( ) ) ; } } return self :: $ cache [ $ caller ] ; }
Returns all constants of a class extending Enumerable .
59,283
public function __isset ( $ name ) { if ( isset ( $ this -> instances [ $ name ] ) ) { return true ; } elseif ( isset ( $ this -> autoloader ) ) { try { $ this -> $ name ; return true ; } catch ( InvalidModuleException $ e ) { } } return false ; }
Whether a module exists .
59,284
public function required ( $ name , $ class = null ) { if ( ! isset ( $ this -> $ name ) ) { throw new InvalidModuleException ( 'Undefined module: ' . $ name . ', required by ' . Utilities :: getCaller ( ) ) ; } if ( isset ( $ class ) and ! Utilities :: isSubclassOf ( $ this -> $ name , $ class ) ) { throw new InvalidModuleException ( 'The module "' . $ name . '" of type ' . get_class ( $ this -> $ name ) . ' was expected by ' . Utilities :: getCaller ( ) . ' to be of type ' . $ class ) ; } }
Expect a module to be loaded .
59,285
public function loadClassMetadata ( EventArgs $ eventArgs ) { if ( ! $ eventArgs instanceof CommonEventArgs && ! $ eventArgs instanceof OrmEventArgs ) { throw InvalidArgumentException :: create ( 'Doctrine\Common\Persistence\Event\LoadClassMetadataEventArgs' , $ eventArgs ) ; } $ ea = $ this -> getEventAdapter ( $ eventArgs ) ; $ this -> loadMetadataForObjectClass ( $ ea -> getObjectManager ( ) , $ eventArgs -> getClassMetadata ( ) ) ; }
Mapps additional metadata
59,286
public function setRichs ( $ richs ) { foreach ( $ richs as $ _rich ) { $ _rich -> setRichList ( $ this ) ; } $ this -> richs = $ richs ; return $ this ; }
Set richs .
59,287
public function addRich ( WidgetRichListItem $ rich ) { $ rich -> setRichList ( $ this ) ; $ this -> richs [ ] = $ rich ; return $ this ; }
Add richs .
59,288
public function add ( string $ email , string $ name = null ) : void { $ ccRecipient = $ this -> make ( ) ; $ ccRecipient -> email = $ email ; if ( $ name !== null ) { $ ccRecipient -> name = $ name ; } $ this -> set ( $ ccRecipient ) ; }
Add a cc recipient .
59,289
public function getLastRequest ( $ _asDomDocument = false ) { if ( self :: getSoapClient ( ) ) return self :: getFormatedXml ( self :: getSoapClient ( ) -> __getLastRequest ( ) , $ _asDomDocument ) ; return null ; }
Returns the last request content as a DOMDocument or as a formated XML String
59,290
public function getLastResponse ( $ _asDomDocument = false ) { if ( self :: getSoapClient ( ) ) return self :: getFormatedXml ( self :: getSoapClient ( ) -> __getLastResponse ( ) , $ _asDomDocument ) ; return null ; }
Returns the last response content as a DOMDocument or as a formated XML String
59,291
public function getLastRequestHeaders ( $ _asArray = false ) { $ headers = self :: getSoapClient ( ) ? self :: getSoapClient ( ) -> __getLastRequestHeaders ( ) : null ; if ( is_string ( $ headers ) && $ _asArray ) return self :: convertStringHeadersToArray ( $ headers ) ; return $ headers ; }
Returns the last request headers used by the SoapClient object as the original value or an array
59,292
public function getLastResponseHeaders ( $ _asArray = false ) { $ headers = self :: getSoapClient ( ) ? self :: getSoapClient ( ) -> __getLastResponseHeaders ( ) : null ; if ( is_string ( $ headers ) && $ _asArray ) return self :: convertStringHeadersToArray ( $ headers ) ; return $ headers ; }
Returns the last response headers used by the SoapClient object as the original value or an array
59,293
public function initInternArrayToIterate ( $ _array = array ( ) , $ _internCall = false ) { if ( stripos ( $ this -> __toString ( ) , 'array' ) !== false ) { if ( is_array ( $ _array ) && count ( $ _array ) ) { $ this -> setInternArrayToIterate ( $ _array ) ; $ this -> setInternArrayToIterateOffset ( 0 ) ; $ this -> setInternArrayToIterateIsArray ( true ) ; } elseif ( ! $ _internCall && $ this -> getAttributeName ( ) != '' && property_exists ( $ this -> __toString ( ) , $ this -> getAttributeName ( ) ) ) $ this -> initInternArrayToIterate ( $ this -> _get ( $ this -> getAttributeName ( ) ) , true ) ; } }
Method initiating internArrayToIterate
59,294
public function run ( Request $ request , Closure $ last = null ) { if ( is_null ( $ last ) ) { $ last = function ( $ request ) { return true ; } ; } $ middleares = $ this -> getMiddlewares ( ) ; for ( $ i = count ( $ middleares ) - 1 ; $ i >= 0 ; $ i -- ) { $ middleware = $ middleares [ $ i ] ; $ atual = function ( $ request ) use ( $ middleware , $ last ) { return $ this -> runMiddleware ( $ request , $ middleware , $ last ) ; } ; $ last = $ atual ; } $ response = $ last ( $ request ) ; return $ response ; }
Executar os middlewares .
59,295
public function getLimitClause ( $ limit = 0 ) { $ query = NULL ; $ page = $ this -> getState ( "currentpage" , 0 ) ; $ limit = empty ( $ limit ) ? ( int ) $ this -> getListLimit ( ) : $ limit ; $ offset = $ this -> getListOffset ( $ page , 0 ) ; if ( ! empty ( $ limit ) ) : $ this -> setListLimit ( $ limit ) ; $ this -> setListOffset ( $ offset ) ; $ query = "\nLIMIT {$offset}, {$limit}\t" ; endif ; return $ query ; }
Returns a limit clause based on datamodel limit and limitoffset states
59,296
public function getState ( $ state , $ default = NULL ) { $ state = isset ( $ this -> states [ $ state ] ) ? $ this -> states [ $ state ] : $ default ; return $ state ; }
Returns a data model state
59,297
public function getListLimit ( $ default = 0 ) { $ limit = $ this -> getState ( "limit" , intval ( $ default ) ) ; $ limit = empty ( $ limit ) ? $ this -> config -> get ( "content.lists.length" , 20 ) : $ limit ; return $ limit ; }
Gets lists limit for page d lists
59,298
public function getListOffset ( $ page = 1 , $ default = 0 ) { $ limit = $ this -> getListLimit ( ) ; $ offset = $ this -> getState ( "limitoffset" , intval ( $ default ) ) ; $ offset = empty ( $ offset ) ? ( empty ( $ page ) || ( int ) $ page <= 1 ) ? intval ( $ default ) : intval ( $ page - 1 ) * $ limit : $ offset ; return $ offset ; }
Get list start for page d lists
59,299
public function setPagination ( ) { $ total = $ this -> getListTotal ( ) ; if ( empty ( $ total ) ) return null ; $ limit = $ this -> getListLimit ( ) ; $ current = $ this -> getState ( "currentpage" , 1 ) ; $ pages = array ( ) ; $ pages [ 'total' ] = ceil ( $ total / $ limit ) ; $ pages [ 'limit' ] = $ limit ; $ route = $ this -> container -> router -> getMatchedRoute ( ) ; $ pages [ 'current' ] = $ route -> getURLfromPathWithValues ( [ "page" => strval ( $ current ) ] ) ; if ( intval ( $ current - 1 ) > 0 ) : $ pages [ 'previous' ] = $ route -> getURLfromPathWithValues ( [ "page" => strval ( $ current - 1 ) ] ) ; endif ; if ( intval ( $ current + 1 ) <= $ pages [ 'total' ] ) : $ pages [ 'next' ] = $ route -> getURLfromPathWithValues ( [ "page" => strval ( $ current + 1 ) ] ) ; endif ; for ( $ i = 0 ; $ i < $ pages [ 'total' ] ; $ i ++ ) : $ page = $ i + 1 ; $ pages [ 'pages' ] [ ] = array ( "page_title" => strval ( $ page ) , "page_link" => $ route -> getURLfromPathWithValues ( [ "page" => $ page ] ) , "page_state" => ( $ page == $ current ) ? "active" : null , ) ; endfor ; if ( sizeof ( $ pages [ 'pages' ] ) > 1 ) $ this -> pagination = $ pages ; }
Sets the pagination for the current output if any