idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
54,200 | public static function checkRequiredActions ( Event $ event = null ) { $ service = ServiceManager :: getServiceManager ( ) -> get ( self :: CONFIG_ID ) ; $ action = $ service -> getActionToBePerformed ( [ ] , $ event ) ; if ( $ action !== null ) { $ action -> execute ( [ ] , $ event ) ; } } | Check if any action must be executed and execute first of them . |
54,201 | public static function isFirstTimeInTao ( ) { $ firstTime = common_session_SessionManager :: getSession ( ) -> getUserPropertyValues ( TaoOntology :: PROPERTY_USER_FIRST_TIME ) ; return in_array ( GenerisRdf :: GENERIS_TRUE , $ firstTime ) ; } | Check whether the current user has already been connected to the TAO backend . |
54,202 | public static function getLastVisitedUrl ( ) { $ urls = common_session_SessionManager :: getSession ( ) -> getUserPropertyValues ( TaoOntology :: PROPERTY_USER_LAST_EXTENSION ) ; if ( ! empty ( $ urls ) ) { $ lastUrl = current ( $ urls ) ; return ROOT_URL . $ lastUrl ; } else { return null ; } } | Get the URL of the last visited extension |
54,203 | public static function setLastVisitedUrl ( $ url ) { if ( empty ( $ url ) ) { throw new common_Exception ( 'Cannot register an empty URL for the last visited extension' ) ; } $ success = false ; $ userUri = common_session_SessionManager :: getSession ( ) -> getUserUri ( ) ; if ( ! empty ( $ userUri ) ) { $ user = new \... | Set the URL of the last visited extension to a user . |
54,204 | public static function sanitize ( $ string , $ reverse = false ) { $ returnValue = ( string ) '' ; if ( $ reverse ) { $ smap = array ( '"' , "\n" , "\t" , "\r" ) ; $ rmap = array ( '\\"' , '\\n"' . "\n" . '"' , '\\t' , '\\r' ) ; $ returnValue = ( string ) str_replace ( $ smap , $ rmap , $ string ) ; } else { $ smap = a... | Short description of method sanitize |
54,205 | public static function serializeAnnotations ( $ annotations ) { $ returnValue = ( string ) '' ; $ buffer = array ( ) ; foreach ( $ annotations as $ name => $ value ) { $ prefix = null ; switch ( $ name ) { case tao_helpers_translation_POTranslationUnit :: TRANSLATOR_COMMENTS : $ prefix = '#' ; break ; case tao_helpers_... | Serialize an array of annotations in a PO compliant comments format . |
54,206 | public static function addFlag ( $ comment , $ flag ) { $ returnValue = ( string ) '' ; $ returnValue = $ comment ; $ flag = trim ( $ flag ) ; $ encoding = self :: getApplicationHelper ( ) -> getDefaultEncoding ( ) ; if ( mb_strpos ( $ returnValue , $ flag , 0 , $ encoding ) === false ) { $ returnValue .= ( ( mb_strlen... | Append a flag to an existing PO comment flag value . |
54,207 | public function index ( ) { $ importer = $ this -> getCurrentImporter ( ) ; $ this -> propagate ( $ importer ) ; $ formContainer = new tao_actions_form_Import ( $ importer , $ this -> getAvailableImportHandlers ( ) , $ this -> getCurrentClass ( ) ) ; $ importForm = $ formContainer -> getForm ( ) ; if ( $ importForm -> ... | initialize the classUri and execute the upload action |
54,208 | protected function getCurrentImporter ( ) { $ handlers = $ this -> getAvailableImportHandlers ( ) ; if ( $ this -> hasRequestParameter ( 'importHandler' ) ) { foreach ( $ handlers as $ importHandler ) { if ( get_class ( $ importHandler ) == $ _POST [ 'importHandler' ] ) { return $ importHandler ; } } } $ availableImpor... | Returns the currently selected import handler or the import handler to use by default |
54,209 | protected function getAvailableImportHandlers ( ) { if ( empty ( $ this -> availableHandlers ) ) { $ this -> availableHandlers = [ new tao_models_classes_import_RdfImporter ( ) , new tao_models_classes_import_CsvImporter ( ) ] ; } return $ this -> availableHandlers ; } | Gets the available import handlers for this module Should be overwritten by extensions that want to provide additional ImportHandlers |
54,210 | public static function setImplementation ( FuncAccessControl $ implementation ) { self :: $ implementation = $ implementation ; ServiceManager :: getServiceManager ( ) -> register ( self :: SERVICE_ID , $ implementation ) ; } | Change the implementation of the access control permanently |
54,211 | protected function saveStringToStorage ( $ string , $ fileName ) { $ file = $ this -> getQueueStorage ( ) -> getFile ( $ fileName ) ; $ file -> write ( ( string ) $ string ) ; return $ file -> getPrefix ( ) ; } | Writes arbitrary string data into a filesystem file under task queue storage . |
54,212 | protected function deleteQueueStorageFile ( EntityInterface $ taskLogEntity ) { if ( $ filename = $ taskLogEntity -> getFileNameFromReport ( ) ) { $ file = $ this -> getQueueStorage ( ) -> getFile ( $ filename ) ; if ( $ file -> exists ( ) ) { $ file -> delete ( ) ; } } return false ; } | Deletes a filesystem file stored under task queue storage |
54,213 | protected function getQueueStorageFile ( $ fileName ) { $ file = $ this -> getQueueStorage ( ) -> getFile ( $ fileName ) ; if ( $ file -> exists ( ) ) { return $ file ; } return null ; } | Tries to get the file if it exists . |
54,214 | protected function beforeProcess ( ) { $ sourceFp = @ fopen ( $ this -> getSource ( ) , 'r' ) ; $ destinationFp = @ fopen ( $ this -> getDestination ( ) , 'w' ) ; if ( $ sourceFp === false ) { return new Report ( Report :: TYPE_ERROR , "Source file '" . $ this -> getSource ( ) . "' could not be open." ) ; } else { $ th... | Behaviour to be triggered at the beginning of the script . |
54,215 | protected function afterProcess ( ) { @ fclose ( $ this -> getSourceFp ( ) ) ; @ fclose ( $ this -> getDestinationFp ( ) ) ; return new Report ( Report :: TYPE_INFO , "Source and Destination files closed." ) ; } | Behaviour to be triggered at the end of the script . |
54,216 | protected function index ( ) { $ index = [ ] ; $ scanCount = $ this -> fillIndex ( $ index , $ this -> getSourceFp ( ) ) ; $ this -> setIndex ( $ index ) ; return new Report ( Report :: TYPE_INFO , $ scanCount . " rows scanned for indexing. " . count ( $ index ) . " unique values indexed." ) ; } | Indexing method . |
54,217 | public function getAsset ( $ asset , $ extensionId = null ) { if ( ! is_null ( $ extensionId ) ) { $ url = $ this -> getJsBaseWww ( $ extensionId ) . FsUtils :: normalizePath ( $ asset ) ; } else { $ url = $ this -> getAssetBaseUrl ( ) . FsUtils :: normalizePath ( $ asset ) ; } $ isFolder = ( substr_compare ( $ url , '... | Get the full URL of an asset or a folder |
54,218 | protected function getAssetBaseUrl ( ) { $ baseUrl = $ this -> hasOption ( self :: BASE_OPTION_KEY ) ? $ this -> getOption ( self :: BASE_OPTION_KEY ) : ROOT_URL ; $ baseUrl = trim ( $ baseUrl ) ; if ( substr ( $ baseUrl , - 1 ) != '/' ) { $ baseUrl .= '/' ; } return $ baseUrl ; } | Get the asset BASE URL |
54,219 | public function getCacheBuster ( ) { if ( $ this -> hasOption ( self :: BUSTER_OPTION_KEY ) ) { return $ this -> getOption ( self :: BUSTER_OPTION_KEY ) ; } else { return $ this -> getServiceLocator ( ) -> get ( ApplicationService :: SERVICE_ID ) -> getPlatformVersion ( ) ; } } | Get a the cache buster value if none we use the tao version . |
54,220 | public function getPosition ( QueuedAction $ action , User $ user = null ) { $ action -> setServiceLocator ( $ this -> getServiceManager ( ) ) ; $ positions = $ this -> getPositions ( $ action ) ; return count ( $ positions ) ; } | Note that this method is not transaction safe so there may be collisions . This implementation supposed to provide approximate position in the queue |
54,221 | public function toArray ( ) { $ data = array ( self :: ID => $ this -> id , self :: STATUS => $ this -> status , self :: START_TIME => $ this -> startTime -> getTimestamp ( ) , ) ; if ( ! is_null ( $ this -> endTime ) ) { $ data [ self :: END_TIME ] = $ this -> endTime -> getTimestamp ( ) ; } return $ data ; } | Return the Maintenance state as array Datetime are converted to timestamp |
54,222 | protected function getDateTime ( $ dateTime ) { if ( $ dateTime instanceof \ DateTime ) { return $ dateTime ; } if ( ( is_string ( $ dateTime ) && ( int ) $ dateTime > 0 ) || is_numeric ( $ dateTime ) ) { return ( new \ DateTime ( ) ) -> setTimestamp ( $ dateTime ) ; } throw new \ common_Exception ( __ ( 'A date has to... | Transform a string|Datetime to Datetime |
54,223 | protected function checkData ( array $ data ) { if ( ! isset ( $ data [ self :: STATUS ] ) || ! in_array ( $ data [ self :: STATUS ] , self :: $ availableStatus ) ) { throw new \ common_Exception ( __ ( 'A maintenance status must have a STATUS: "%s" or "%s"' , self :: LIVE_MODE , self :: OFFLINE_MODE ) ) ; } } | Check data of constructor input |
54,224 | public function getActions ( ) { $ actions = array ( ) ; foreach ( $ this -> class -> getMethods ( ReflectionMethod :: IS_PUBLIC ) as $ m ) { if ( $ m -> isConstructor ( ) || $ m -> isDestructor ( ) || in_array ( $ m -> name , self :: $ BLACK_LIST ) ) { continue ; } if ( is_subclass_of ( $ m -> class , 'Module' ) || is... | Returns ann array of ActionDescription objects |
54,225 | public static function fromLegacyToolbarAction ( \ SimpleXMLElement $ node , $ structureExtensionId ) { $ data = array ( 'id' => ( string ) $ node [ 'id' ] , 'extension' => $ structureExtensionId , 'name' => ( string ) $ node [ 'title' ] , 'level' => ( int ) $ node [ 'level' ] , 'description' => empty ( $ text ) ? null... | Generate a Perspective from a legacy ToolbarAction |
54,226 | protected function getRawParameter ( $ paramName ) { $ raw = $ this -> getRequest ( ) -> getRawParameters ( ) ; if ( ! isset ( $ raw [ $ paramName ] ) ) { throw new \ common_exception_MissingParameter ( $ paramName ) ; } return $ raw [ $ paramName ] ; } | Returns a request parameter unencoded |
54,227 | protected function logDeprecated ( $ function = null ) { return ; $ message = '[DEPRECATED] Deprecated call ' ; if ( ! is_null ( $ function ) ) { $ message .= 'of "' . $ function . '"' ; } $ message .= ' (' . get_called_class ( ) . ')' ; \ common_Logger :: i ( $ message ) ; } | Mark a method as deprecated |
54,228 | public function getAuthType ( \ core_kernel_classes_Resource $ resource = null ) { if ( $ resource ) { $ authTypeUri = $ resource -> getUri ( ) ; foreach ( $ this -> getOption ( self :: OPTION_TYPES ) as $ type ) { if ( $ type instanceof AbstractAuthType && $ type -> getAuthClass ( ) -> getUri ( ) == $ authTypeUri ) { ... | Get the authType form config |
54,229 | protected function generateToken ( $ relPath ) { $ time = time ( ) ; return $ time . '/' . md5 ( $ time . $ relPath . $ this -> getOption ( self :: OPTION_SECRET ) ) ; } | Generate a token for the resource Same algorithm is implemented again in getFile . php |
54,230 | public function upload ( ) { $ response = array ( 'uploaded' => false ) ; foreach ( ( array ) $ _FILES as $ file ) { $ targetFolder = isset ( $ _POST [ 'folder' ] ) ? $ _POST [ 'folder' ] : '/' ; $ response = array_merge ( $ response , $ this -> uploadFile ( $ file , $ targetFolder . '/' ) ) ; } $ this -> returnJson ( ... | Upload a file using http and copy it from the tmp dir to the target folder |
54,231 | public function downloadFile ( ) { if ( $ this -> hasRequestParameter ( 'id' ) ) { $ fileService = $ this -> getServiceLocator ( ) -> get ( FileReferenceSerializer :: SERVICE_ID ) ; $ file = $ fileService -> unserialize ( $ this -> getRequestParameter ( 'id' ) ) ; header ( "Content-Disposition: attachment; filename=\"{... | Download a resource file content |
54,232 | protected function encode ( $ data ) { switch ( $ this -> responseEncoding ) { case "application/rdf+xml" : throw new common_exception_NotImplemented ( ) ; break ; case "text/xml" : case "application/xml" : return tao_helpers_Xml :: from_array ( $ data ) ; case "application/json" : default : return json_encode ( $ data... | Encode data regarding responseEncoding |
54,233 | protected function getErrorMessage ( Exception $ exception ) { $ defaultMessage = __ ( 'Unexpected error. Please contact administrator' ) ; if ( DEBUG_MODE ) { $ defaultMessage = $ exception -> getMessage ( ) ; } return ( $ exception instanceof common_exception_UserReadableException ) ? $ exception -> getUserMessage ( ... | Generate safe message preventing exposing sensitive date in non develop mode |
54,234 | public function deleteClass ( \ core_kernel_classes_Class $ clazz ) { $ returnValue = ( bool ) false ; if ( $ clazz -> isSubClassOf ( $ this -> getRootClass ( ) ) && ! $ clazz -> equals ( $ this -> getRootClass ( ) ) ) { $ returnValue = true ; $ instances = $ clazz -> getInstances ( ) ; foreach ( $ instances as $ insta... | Delete a subclass |
54,235 | public function deleteClassProperty ( \ core_kernel_classes_Property $ property ) { $ indexes = $ property -> getPropertyValues ( new \ core_kernel_classes_Property ( OntologyIndex :: PROPERTY_INDEX ) ) ; if ( $ returnValue = $ property -> delete ( true ) ) { foreach ( $ indexes as $ indexUri ) { $ index = new \ core_k... | remove a class property |
54,236 | public function write ( ) { $ tf = $ this -> getTranslationFile ( ) ; $ buffer = "<?php\n" ; foreach ( $ tf -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> getSource ( ) != '' && $ tu -> getTarget ( ) != '' ) { $ escapes = array ( "\\" , '$' , '"' , "\n" , "\t" , "\v" , "\r" , "\f" ) ; $ replace = array ( "\\\\" , ... | Writes the TranslationFile as a PHP compiled file . |
54,237 | public function getRows ( ) { $ rows = isset ( $ this -> requestParams [ self :: PARAM_ROWS ] ) ? $ this -> requestParams [ self :: PARAM_ROWS ] : self :: DEFAULT_ROWS ; return ( integer ) $ rows ; } | Get amount of records per page |
54,238 | public function getSortBy ( ) { $ sortBy = isset ( $ this -> requestParams [ self :: PARAM_SORT_BY ] ) ? $ this -> requestParams [ self :: PARAM_SORT_BY ] : self :: DEFAULT_SORT_BY ; return $ sortBy ; } | Get sorting column name |
54,239 | public function getSortOrder ( ) { $ sortOrder = isset ( $ this -> requestParams [ self :: PARAM_SORT_ORDER ] ) ? $ this -> requestParams [ self :: PARAM_SORT_ORDER ] : self :: DEFAULT_SORT_ORDER ; $ sortOrder = mb_strtolower ( $ sortOrder ) ; if ( ! in_array ( $ sortOrder , [ 'asc' , 'desc' ] ) ) { $ sortOrder = self ... | Get sorting direction |
54,240 | public function getSortType ( ) { $ sortType = isset ( $ this -> requestParams [ self :: PARAM_SORT_TYPE ] ) ? $ this -> requestParams [ self :: PARAM_SORT_TYPE ] : self :: DEFAULT_SORT_TYPE ; $ sortType = mb_strtolower ( $ sortType ) ; if ( ! in_array ( $ sortType , [ 'string' , 'numeric' ] ) ) { $ sortType = self :: ... | Get sorting type |
54,241 | public function setTitle ( $ title ) { $ returnValue = ( bool ) false ; $ this -> title = $ title ; $ returnValue = true ; return ( bool ) $ returnValue ; } | Short description of method setTitle |
54,242 | public function setAdapter ( tao_helpers_grid_Cell_Adapter $ adapter ) { $ returnValue = ( bool ) false ; if ( ! is_null ( $ adapter ) ) { $ this -> adapters [ ] = $ adapter ; $ returnValue = true ; } return ( bool ) $ returnValue ; } | Short description of method setAdapter |
54,243 | public function hasAdapter ( $ type = '' ) { $ returnValue = ( bool ) false ; $ adapterClass = empty ( $ type ) ? 'tao_helpers_grid_Cell_Adapter' : $ type ; foreach ( $ this -> adapters as $ adapter ) { if ( $ adapter instanceof $ adapterClass ) { $ returnValue = true ; break ; } } return ( bool ) $ returnValue ; } | Short description of method hasAdapter |
54,244 | public function getAdaptersData ( $ rowId , $ cellValue = null , $ evaluateData = true ) { $ returnValue = null ; if ( $ this -> hasAdapter ( ) ) { foreach ( $ this -> adapters as $ adapter ) { if ( $ adapter instanceof tao_helpers_grid_Cell_Adapter ) { $ cellValue = $ adapter -> getValue ( $ rowId , $ this -> id , $ c... | Short description of method getAdaptersData |
54,245 | public function getAdapter ( $ type ) { $ returnValue = null ; foreach ( $ this -> adapters as $ adapter ) { if ( $ adapter instanceof $ type ) { $ returnValue = $ adapter ; break ; } } return $ returnValue ; } | Short description of method getAdapter |
54,246 | public function send ( Message $ message ) { $ mailer = $ this -> getMailer ( ) ; $ mailer -> SetFrom ( $ this -> getFrom ( $ message ) ) ; $ mailer -> AddReplyTo ( $ this -> getFrom ( $ message ) ) ; $ mailer -> Subject = $ message -> getTitle ( ) ; $ mailer -> AltBody = strip_tags ( preg_replace ( "/<br.*>/i" , "\n" ... | Sent email message |
54,247 | public function getUserMail ( User $ user ) { $ userMail = current ( $ user -> getPropertyValues ( GenerisRdf :: PROPERTY_USER_MAIL ) ) ; if ( ! $ userMail || ! filter_var ( $ userMail , FILTER_VALIDATE_EMAIL ) ) { throw new Exception ( 'User email is not valid.' ) ; } return $ userMail ; } | Get user email address . |
54,248 | public function getFrom ( Message $ message = null ) { $ from = $ message === null ? null : $ message -> getFrom ( ) ; if ( ! $ from ) { $ from = $ this -> getOption ( self :: CONFIG_DEFAULT_SENDER ) ; } return $ from ; } | Get a From address . If it was not specified for message then value will be retrieved from config . |
54,249 | public function setPlatformState ( MaintenanceState $ state ) { if ( $ previous = $ this -> getDriver ( ) -> get ( self :: PREFIX . self :: LAST_MODE ) ) { $ currentState = new MaintenanceState ( json_decode ( $ previous , true ) ) ; $ currentState -> setEndTime ( $ state -> getStartTime ( ) ) ; $ this -> getDriver ( )... | Persist the maintenance state |
54,250 | public function getHistory ( ) { $ history = array ( 1 => new MaintenanceState ( json_decode ( $ this -> getDriver ( ) -> get ( self :: PREFIX . self :: LAST_MODE ) , true ) ) ) ; $ i = 2 ; while ( $ data = json_decode ( $ this -> getDriver ( ) -> get ( self :: PREFIX . $ i ) , true ) ) { $ history [ $ i ] = new Mainte... | Get maintenance history as list of state |
54,251 | public function getCurrentPlatformState ( ) { $ data = json_decode ( $ this -> getDriver ( ) -> get ( self :: PREFIX . self :: LAST_MODE ) , true ) ; if ( ! $ data ) { throw new \ common_exception_NotFound ( ) ; } return new MaintenanceState ( $ data ) ; } | Get the current state of the platform |
54,252 | private static function sortReports ( $ a , $ b ) { $ a = json_decode ( $ a , true ) ; $ b = json_decode ( $ b , true ) ; if ( $ a [ 'value' ] [ 'optional' ] == $ b [ 'value' ] [ 'optional' ] ) { return 0 ; } else { return ( $ a [ 'value' ] [ 'optional' ] < $ b [ 'value' ] [ 'optional' ] ) ? - 1 : 1 ; } } | Report sorting function . |
54,253 | public static function getComponentById ( array $ componentToData , $ id ) { foreach ( $ componentToData as $ ctd ) { if ( $ ctd [ 'id' ] == $ id ) { return $ ctd [ 'component' ] ; } } return null ; } | Returns a component stored in an array of array . The searched key is id . If matched the component instance is returned . Otherwise null . |
54,254 | public function buildDeleterBehaviour ( ) { return '$(document).ready(function() { $("#' . $ this -> buildDeleteButtonId ( ) . '").click(function() { var $form = $(this).parents("form"), $fileHandling = $form.find("[name=\'' . $ this -> getName ( ) . ... | Short description of method buildDeleterBehaviour |
54,255 | public function buildUploaderBehaviour ( $ deleted = false ) { $ returnValue = ( string ) '' ; $ widgetName = $ this -> buildWidgetName ( ) ; $ max_upload = ( int ) ( ini_get ( 'upload_max_filesize' ) ) ; $ max_post = ( int ) ( ini_get ( 'post_max_size' ) ) ; $ memory_limit = ( int ) ( ini_get ( 'memory_limit' ) ) ; $ ... | Short description of method buildUploaderBehaviour |
54,256 | public function buildDownloaderBehaviour ( ) { $ returnValue = ( string ) '' ; $ downloadButtonId = $ this -> buildDownloadButtonId ( ) ; $ iFrameId = $ this -> buildIframeId ( ) ; $ serial = $ this -> value -> getFileSerial ( ) ; $ returnValue .= '$(document).ready(function() {' ; $ returnValue .= ' $("#' . $ download... | Short description of method buildDownloaderBehaviour |
54,257 | public function createToken ( ) { $ time = microtime ( true ) ; $ token = $ this -> generate ( ) ; $ store = $ this -> getStore ( ) ; $ pool = $ this -> invalidate ( $ store -> getTokens ( ) ) ; $ pool [ ] = [ 'ts' => $ time , 'token' => $ token ] ; $ store -> setTokens ( $ pool ) ; return $ token ; } | Generates stores and return a brand new token Triggers the pool invalidation . |
54,258 | public function revokeToken ( $ token ) { $ revoked = false ; $ store = $ this -> getStore ( ) ; $ pool = $ store -> getTokens ( ) ; if ( ! is_null ( $ pool ) ) { foreach ( $ pool as $ key => $ savedToken ) { if ( $ savedToken [ 'token' ] == $ token ) { unset ( $ pool [ $ key ] ) ; $ revoked = true ; break ; } } } $ st... | Revokes the given token |
54,259 | public function getTokenName ( ) { $ session = \ PHPSession :: singleton ( ) ; if ( $ session -> hasAttribute ( TokenStore :: TOKEN_NAME ) ) { $ name = $ session -> getAttribute ( TokenStore :: TOKEN_NAME ) ; } else { $ name = 'tao_' . substr ( md5 ( microtime ( ) ) , rand ( 0 , 25 ) , 7 ) ; $ session -> setAttribute (... | Gets this session s name for token |
54,260 | protected function getPoolSize ( ) { $ poolSize = self :: DEFAULT_POOL_SIZE ; if ( $ this -> hasOption ( self :: POOL_SIZE_OPT ) ) { $ poolSize = ( int ) $ this -> getOption ( self :: POOL_SIZE_OPT ) ; } return $ poolSize ; } | Get the configured pool size |
54,261 | protected function getTimeLimit ( ) { $ timeLimit = self :: DEFAULT_TIME_LIMIT ; if ( $ this -> hasOption ( self :: TIME_LIMIT_OPT ) ) { $ timeLimit = ( int ) $ this -> getOption ( self :: TIME_LIMIT_OPT ) ; } return $ timeLimit ; } | Get the configured time limit in seconds |
54,262 | protected function getStore ( ) { $ store = null ; if ( $ this -> hasOption ( self :: STORE_OPT ) ) { $ store = $ this -> getOption ( self :: STORE_OPT ) ; } return $ store ; } | Get the configured store |
54,263 | public function convertPhpToJavascriptFormat ( $ phpFormat ) { $ replacements = self :: REPLACEMENTS ; foreach ( self :: REPLACEMENTS as $ from => $ to ) { $ replacements [ '\\' . $ from ] = '[' . $ from . ']' ; } return strtr ( $ phpFormat , $ replacements ) ; } | Converts php DateTime format to Javascript Moment format . |
54,264 | public static function getBaseUrl ( ) { if ( empty ( self :: $ base ) && defined ( 'BASE_URL' ) ) { self :: $ base = BASE_URL ; if ( ! preg_match ( "/\/$/" , self :: $ base ) ) { self :: $ base .= '/' ; } } return self :: $ base ; } | get the project base url |
54,265 | public static function getRootUrl ( ) { if ( empty ( self :: $ root ) && defined ( 'ROOT_URL' ) ) { self :: $ root = ROOT_URL ; if ( ! preg_match ( "/\/$/" , self :: $ root ) ) { self :: $ root .= '/' ; } } return self :: $ root ; } | Short description of method getRootUrl |
54,266 | public static function url ( $ action = null , $ module = null , $ extension = null , $ params = array ( ) ) { if ( is_null ( $ module ) ) { $ module = Context :: getInstance ( ) -> getModuleName ( ) ; } if ( is_null ( $ action ) ) { $ action = Context :: getInstance ( ) -> getActionName ( ) ; } if ( is_null ( $ extens... | conveniance method to create urls based on the current MVC context and it for the used kind of url resolving |
54,267 | public static function encode ( $ uri , $ dotMode = true ) { if ( 0 === strpos ( $ uri , 'http' ) ) { if ( $ dotMode ) { $ returnValue = str_replace ( [ '#' , '://' , '/' , '.' , ':' ] , [ '_3_' , '_2_' , '_1_' , '_0_' , '_4_' ] , $ uri ) ; } else { $ returnValue = str_replace ( [ '#' , '://' , '/' , ':' ] , [ '_3_' , ... | encode an URI |
54,268 | public static function encodeRelativeUrl ( $ url ) { $ url = str_replace ( DIRECTORY_SEPARATOR , '/' , $ url ) ; $ parts = explode ( '/' , $ url ) ; foreach ( array_keys ( $ parts ) as $ key ) { $ parts [ $ key ] = rawurlencode ( $ parts [ $ key ] ) ; } return implode ( '/' , $ parts ) ; } | encode a relative URL |
54,269 | public static function decode ( $ uri , $ dotMode = true ) { if ( 0 === strpos ( $ uri , 'http' ) ) { if ( $ dotMode ) { $ returnValue = str_replace ( [ '_0_' , '_1_' , '_2_' , '_3_' , '_4_' ] , [ '.' , '/' , '://' , '#' , ':' ] , $ uri ) ; } else { $ returnValue = str_replace ( [ '_1_' , '_2_' , '_3_' , '_4_' ] , [ '/... | decode an URI |
54,270 | public static function encodeArray ( $ uris , $ encodeMode = self :: ENCODE_ARRAY_ALL , $ dotMode = true , $ uniqueMode = false ) { $ returnValue = [ ] ; if ( is_array ( $ uris ) ) { foreach ( $ uris as $ key => $ value ) { if ( $ encodeMode == self :: ENCODE_ARRAY_KEYS || $ encodeMode == self :: ENCODE_ARRAY_ALL ) { $... | Encode the uris composing either the keys or the values of the array in |
54,271 | public static function getDomain ( $ uri ) { $ returnValue = parse_url ( $ uri , PHP_URL_HOST ) ; if ( empty ( $ returnValue ) ) { return null ; } return $ returnValue ; } | Returns the domain extracted from a given URI . If the domain cannot be null is returned . |
54,272 | public static function isValidAsCookieDomain ( $ uri ) { $ domain = self :: getDomain ( $ uri ) ; if ( ! empty ( $ domain ) ) { if ( preg_match ( "/^[a-z0-9\-]+(?:[a-z0-9\-]\.)+/iu" , $ domain ) > 0 ) { $ returnValue = true ; } else { $ returnValue = false ; } } else { $ returnValue = false ; } return $ returnValue ; } | To be used to know if a given URI is valid as a cookie domain . Usually domain such as mytaoplatform localhost make issues with |
54,273 | private function createImportFormContainer ( ) { $ sourceContainer = new tao_models_classes_import_CsvUploadForm ( ) ; $ sourceForm = $ sourceContainer -> getForm ( ) ; foreach ( $ sourceForm -> getElements ( ) as $ element ) { $ element -> feed ( ) ; } $ sourceForm -> getElement ( 'source' ) -> feed ( ) ; $ fileInfo =... | Constructs the Import form container In need of a major refactoring which will probably involve refactoring the Form engine as well |
54,274 | public function getTaskParameters ( tao_helpers_form_Form $ form ) { return array_merge ( $ form -> getValues ( ) , [ 'property_mapping' => $ form -> getValues ( 'property_mapping' ) , 'ranged_property' => $ form -> getValues ( 'ranged_property' ) ] , $ this -> getDefaultTaskParameters ( $ form ) ) ; } | Defines the task parameters to be stored for later use . |
54,275 | protected function parseRoute ( $ route ) { $ parsedRoute = parse_url ( $ route ) ; if ( isset ( $ parsedRoute [ 'query' ] ) ) { parse_str ( $ parsedRoute [ 'query' ] , $ parsedRoute [ 'params' ] ) ; } else { $ parsedRoute [ 'params' ] = [ ] ; } $ resolvedRoute = new Resolver ( new \ common_http_Request ( $ route ) ) ;... | Parses the provided context route |
54,276 | protected function getRoutes ( ) { $ route = $ this -> getRequestParameter ( 'route' ) ; if ( empty ( $ route ) ) { throw new \ common_exception_MissingParameter ( 'You must specify a route' ) ; } if ( ! is_array ( $ route ) ) { $ route = [ $ route ] ; } return $ route ; } | Gets the provided context route |
54,277 | protected function returnData ( $ data ) { if ( isset ( $ _SERVER [ 'HTTP_ACCEPT' ] ) && strpos ( $ _SERVER [ 'HTTP_ACCEPT' ] , 'application/json' ) !== false ) { $ this -> returnJson ( [ 'success' => true , 'data' => $ data , ] ) ; } else { $ this -> setData ( 'breadcrumbs' , $ data ) ; $ this -> setView ( 'blocks/bre... | Sends the data to the client using the preferred format |
54,278 | public function load ( ) { $ data = [ ] ; $ routes = $ this -> getRoutes ( ) ; foreach ( $ routes as $ route ) { $ parsedRoute = $ this -> parseRoute ( $ route ) ; $ routeData = $ this -> requestService ( $ route , $ parsedRoute ) ; if ( $ routeData !== null ) { if ( array_values ( $ routeData ) === $ routeData ) { $ d... | Loads all the breadcrumbs for a particular context route |
54,279 | public function addColumn ( $ id , $ title , $ options = array ( ) ) { $ returnValue = null ; $ replace = false ; if ( isset ( $ options [ 'replace' ] ) ) { $ replace = $ options [ 'replace' ] ; unset ( $ options [ 'replace' ] ) ; } if ( ! $ replace && isset ( $ this -> columns [ $ id ] ) ) { throw new common_Exception... | Short description of method addColumn |
54,280 | public function removeColumn ( $ id ) { $ returnValue = ( bool ) false ; unset ( $ this -> columns [ $ id ] ) ; $ returnValue = true ; return ( bool ) $ returnValue ; } | Short description of method removeColumn |
54,281 | public function addRow ( $ id , $ cells = array ( ) , $ replace = false ) { $ returnValue = ( bool ) false ; if ( ! $ replace && isset ( $ this -> rows [ $ id ] ) ) { throw new common_Exception ( 'the row with the id ' . $ id . ' already exists' ) ; } else { $ this -> rows [ $ id ] = $ cells ; $ returnValue = true ; } ... | Short description of method addRow |
54,282 | public function removeRow ( $ id ) { $ returnValue = ( bool ) false ; unset ( $ this -> rows [ $ id ] ) ; $ returnValue = true ; return ( bool ) $ returnValue ; } | Short description of method removeRow |
54,283 | public function setCellValue ( $ columnId , $ rowId , $ content , $ forceCreation = false ) { $ returnValue = ( bool ) false ; if ( isset ( $ this -> columns [ $ columnId ] ) ) { if ( isset ( $ this -> rows [ $ rowId ] ) ) { $ this -> rows [ $ rowId ] [ $ columnId ] = $ content ; $ returnValue = true ; } } return ( boo... | Short description of method setCellValue |
54,284 | public function setColumnsAdapter ( $ columnIds , tao_helpers_grid_Cell_Adapter $ adapter ) { $ returnValue = ( bool ) false ; if ( is_string ( $ columnIds ) ) { $ columnIds = array ( $ columnIds ) ; } if ( is_array ( $ columnIds ) ) { foreach ( $ columnIds as $ colId ) { if ( ! isset ( $ this -> columns [ $ colId ] ) ... | Short description of method setColumnsAdapter |
54,285 | public function getColumn ( $ id ) { $ returnValue = null ; if ( isset ( $ this -> columns [ $ id ] ) && $ this -> columns [ $ id ] instanceof tao_helpers_grid_Column ) { $ returnValue = $ this -> columns [ $ id ] ; } return $ returnValue ; } | Short description of method getColumn |
54,286 | public function getColumnsModel ( $ rebuild = false ) { $ returnValue = array ( ) ; foreach ( $ this -> columns as $ column ) { if ( $ column instanceof tao_helpers_grid_Column ) { $ returnValue [ $ column -> getId ( ) ] = array ( 'id' => $ column -> getId ( ) , 'title' => $ column -> getTitle ( ) , 'type' => $ column ... | Short description of method getColumnsModel |
54,287 | public function setData ( $ data = array ( ) ) { $ this -> rows = array ( ) ; foreach ( $ data as $ rowId => $ cells ) { if ( is_array ( $ cells ) ) { $ this -> addRow ( $ rowId , $ cells ) ; } else if ( is_string ( $ cells ) ) { $ this -> addRow ( $ cells ) ; } } } | Short description of method setData |
54,288 | public static function is ( $ mode ) { if ( is_int ( $ mode ) && self :: get ( ) == $ mode ) { return true ; } if ( is_string ( $ mode ) && self :: get ( ) == self :: getModeByName ( $ mode ) ) { return true ; } return false ; } | Check the TAO instance current mode |
54,289 | public static function get ( ) { if ( empty ( self :: $ currentMode ) ) { self :: $ currentMode = self :: getCurrentMode ( ) ; } return self :: $ currentMode ; } | Get the current mode |
54,290 | public function actionHardify ( ) { $ class = $ this -> options [ 'class' ] ; $ topClass = $ this -> options [ 'topClass' ] ; $ createForeigns = $ this -> options [ 'createForeigns' ] ; $ recursive = $ this -> options [ 'recursive' ] ; $ classUri = $ class -> getUri ( ) ; $ additionalProperties = array ( ) ; $ blackLis... | Hardify a class . |
54,291 | public static function createFromRequest ( StreamInterface $ stream , ServerRequestInterface $ request = null ) { $ result = [ ] ; if ( $ request === null ) { $ headers = \ tao_helpers_Http :: getHeaders ( ) ; $ rangeHeader = isset ( $ headers [ 'Range' ] ) ? [ $ headers [ 'Range' ] ] : null ; } else { $ rangeHeader = ... | Create array of StreamRange instances based on current request range headers |
54,292 | public function preRender ( ) { $ returnValue = ( string ) '' ; if ( ! empty ( $ this -> tag ) ) { $ returnValue .= "<{$this->tag}" ; if ( isset ( $ this -> attributes [ 'cssClass' ] ) ) { $ this -> attributes [ 'class' ] = $ this -> attributes [ 'cssClass' ] . ( isset ( $ this -> attributes [ 'class' ] ) ? ' ' . $ thi... | Short description of method preRender |
54,293 | public function getOption ( $ key ) { if ( $ key == 'tag' ) { return $ this -> tag ; } elseif ( isset ( $ this -> attributes [ $ key ] ) ) { return $ this -> attributes [ $ key ] ; } else { return '' ; } } | Short description of method getOption |
54,294 | public function setOption ( $ key , $ value ) { if ( $ key == 'tag' ) { $ this -> tag = $ value ; } else { $ this -> attributes [ $ key ] = $ value ; } return true ; } | Short description of method setOption |
54,295 | public function export ( $ formValues , $ destination ) { if ( isset ( $ formValues [ 'filename' ] , $ formValues [ 'resource' ] ) ) { $ class = new core_kernel_classes_Class ( $ formValues [ 'resource' ] ) ; $ adapter = new tao_helpers_data_GenerisAdapterRdf ( ) ; $ rdf = $ adapter -> export ( $ class ) ; if ( ! empty... | Run the export process . |
54,296 | public function getRdfString ( $ instances ) { $ api = core_kernel_impl_ApiModelOO :: singleton ( ) ; $ rdf = '' ; $ xmls = [ ] ; foreach ( $ instances as $ instance ) { $ xmls [ ] = $ api -> getResourceDescriptionXML ( $ instance -> getUri ( ) ) ; } if ( count ( $ xmls ) === 1 ) { $ rdf = $ xmls [ 0 ] ; } elseif ( cou... | Exports an array of instances into an rdf string . |
54,297 | public static function checkInstallData ( array $ installData ) { if ( empty ( $ installData [ 'instance_name' ] ) ) { $ msg = "Missing install parameter 'instance_name'." ; throw new tao_install_utils_MalformedParameterException ( $ msg ) ; } else if ( ! is_string ( $ installData [ 'instance_name' ] ) ) { $ msg = "Mal... | Check the install data information such as - instance name - database driver - ... |
54,298 | public function setFrameAncestorsHeader ( ) { $ settingsStorage = $ this -> getServiceLocator ( ) -> get ( SettingsStorage :: SERVICE_ID ) ; $ whitelistedSources = $ settingsStorage -> get ( CspHeaderSettingsInterface :: CSP_HEADER_SETTING ) ; if ( $ whitelistedSources === null ) { $ whitelistedSources = [ "'none'" ] ;... | Set the header that defines which sources are allowed to embed the pages . |
54,299 | public static function getClassName ( $ extension , $ shortName ) { $ url = _url ( 'index' , $ shortName , $ extension ) ; return self :: getClassNameByUrl ( $ url ) ; } | Get the controller className from extension and controller shortname |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.