idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
54,300 | public static function getClassNameByUrl ( $ url ) { $ class = null ; if ( ! empty ( $ url ) ) { try { $ route = new Resolver ( new common_http_Request ( $ url ) ) ; $ route -> setServiceLocator ( ServiceManager :: getServiceManager ( ) ) ; $ class = $ route -> getControllerClass ( ) ; } catch ( \ ResolverException $ r... | Helps you to get the name of the class for a given URL . The controller class name is used in privileges definition . |
54,301 | public function getSession ( \ common_http_Request $ request ) { $ authAdapter = new \ tao_models_classes_HttpBasicAuthAdapter ( $ request ) ; $ user = $ authAdapter -> authenticate ( ) ; return new \ common_session_RestSession ( $ user ) ; } | Create a rest session based on request credentials |
54,302 | public static function getClassProperties ( core_kernel_classes_Class $ clazz , core_kernel_classes_Class $ topLevelClazz = null ) { $ returnValue = array ( ) ; if ( is_null ( $ topLevelClazz ) ) { $ topLevelClazz = new core_kernel_classes_Class ( TaoOntology :: CLASS_URI_OBJECT ) ; } if ( $ clazz -> getUri ( ) == $ to... | Enable you to get the properties of a class . The advantage of this method is to limit the level of recusrivity in the It get the properties up to the defined top class |
54,303 | public static function getPropertyProperties ( $ mode = 'simple' ) { $ returnValue = array ( ) ; switch ( $ mode ) { case 'simple' : $ defaultUris = array ( GenerisRdf :: PROPERTY_IS_LG_DEPENDENT ) ; break ; case 'advanced' : default : $ defaultUris = array ( OntologyRdfs :: RDFS_LABEL , WidgetRdf :: PROPERTY_WIDGET , ... | Get the properties of the rdfs Property class |
54,304 | public static function extractTreeData ( $ data , $ recursive = false ) { $ returnValue = array ( ) ; if ( isset ( $ data [ 'data' ] ) ) { $ data = array ( $ data ) ; } foreach ( $ data as $ node ) { $ returnValue [ $ node [ 'attributes' ] [ 'id' ] ] = $ node [ 'data' ] ; if ( isset ( $ node [ 'children' ] ) ) { $ retu... | Short description of method extractTreeData |
54,305 | public function getPrefix ( ) { $ returnValue = ( string ) '' ; if ( empty ( $ this -> prefix ) && ! empty ( $ this -> name ) ) { $ this -> prefix = $ this -> name . '_' ; } $ returnValue = $ this -> prefix ; return ( string ) $ returnValue ; } | Short description of method getPrefix |
54,306 | public function get ( ) { try { if ( ! $ this -> hasRequestParameter ( self :: TASK_ID_PARAM ) ) { throw new \ common_exception_MissingParameter ( self :: TASK_ID_PARAM , $ this -> getRequestURI ( ) ) ; } $ taskId = $ this -> getRequestParameter ( self :: TASK_ID_PARAM ) ; $ taskLog = $ this -> getServiceLocator ( ) ->... | Get task data by identifier |
54,307 | public static function img ( $ path , $ extensionId = null ) { if ( is_null ( $ extensionId ) ) { $ extensionId = \ Context :: getInstance ( ) -> getExtensionName ( ) ; } return self :: getAssetService ( ) -> getAsset ( 'img/' . $ path , $ extensionId ) ; } | Expects a relative url to the image as path if extension name is omitted the current extension is used |
54,308 | public static function inc ( $ path , $ extensionId = null , $ data = array ( ) ) { $ context = \ Context :: getInstance ( ) ; if ( ! is_null ( $ extensionId ) && $ extensionId != $ context -> getExtensionName ( ) ) { $ formerContext = $ context -> getExtensionName ( ) ; $ context -> setExtensionName ( $ extensionId ) ... | Expects a relative url to the template that is to be included as path if extension name is omitted the current extension is used |
54,309 | protected function generate ( $ length = 40 ) { try { return bin2hex ( random_bytes ( $ length / 2 ) ) ; } catch ( \ TypeError $ e ) { throw new \ common_Exception ( "An unexpected error has occurred while trying to generate a security token" , 0 , $ e ) ; } catch ( \ Error $ e ) { throw new \ common_Exception ( "An un... | Generates a security token |
54,310 | protected function getTaskData ( $ taskId ) { $ task = $ this -> getTask ( $ taskId ) ; $ result [ 'id' ] = $ this -> getTaskId ( $ task ) ; $ result [ 'status' ] = $ this -> getTaskStatus ( $ task ) ; $ result [ 'report' ] = $ this -> getTaskReport ( $ task ) ; return $ result ; } | Template method to generate task data to be returned to the end user . |
54,311 | protected function getTask ( $ taskId ) { if ( ! isset ( $ this -> tasks [ $ taskId ] ) ) { $ taskQueue = $ this -> getServiceManager ( ) -> get ( Queue :: SERVICE_ID ) ; $ task = $ taskQueue -> getTask ( $ taskId ) ; if ( $ task === null ) { throw new \ common_exception_NotFound ( __ ( 'Task not found' ) ) ; } $ this ... | Get task instance from queue by identifier |
54,312 | public function setUploadFileSourceId ( $ sourceId ) { $ ext = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'tao' ) ; $ ext -> setConfig ( self :: CONFIG_UPLOAD_FILESOURCE , $ sourceId ) ; } | Set the default file source for TAO File Upload . |
54,313 | public function storeUploadedFile ( File $ tmpFile , $ name = '' ) { $ ext = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'tao' ) ; $ fsId = $ ext -> getConfig ( self :: CONFIG_UPLOAD_FILESOURCE ) ; $ fss = $ this -> getServiceLocator ( ) -> get ( FileSystemService :: SERVICE_ID ) ; $ baseDir = $... | Store an uploaded file in the persistant storage and return a serial id |
54,314 | protected function setOutputColorVisibility ( array $ params ) { if ( $ this -> hasParameter ( $ params , '-nc' ) || $ this -> hasParameter ( $ params , '--no-color' ) ) { $ this -> hideColors = true ; } } | Sets the output color s visibility . |
54,315 | public function load ( Action $ action ) { if ( $ action instanceof LoggerAwareInterface ) { $ action -> setLogger ( $ this -> getServiceLocator ( ) -> get ( LoggerService :: SERVICE_ID ) -> addLogger ( $ this -> hideColors ? new VerboseLogger ( $ this -> getMinimumLogLevel ( ) ) : new ColoredVerboseLogger ( $ this -> ... | Propagate the argument process to Action To load a verbose logger a check is done Action interfaces to find LoggerInterface The verbose logger is loaded with the minimum level requires |
54,316 | public function getRequiredVariables ( ) { $ variables = array ( ) ; foreach ( $ this -> inParameters as $ param ) { if ( $ param instanceof tao_models_classes_service_VariableParameter ) { $ variables [ ] = $ param -> getVariable ( ) ; } } return $ variables ; } | Gets the variables expected to be present to call this service |
54,317 | public function toOntology ( ) { $ inResources = array ( ) ; $ outResources = is_null ( $ this -> outParameter ) ? array ( ) : $ this -> outParameter -> toOntology ( ) ; foreach ( $ this -> inParameters as $ param ) { $ inResources [ ] = $ param -> toOntology ( ) ; } $ serviceCallClass = $ this -> getClass ( WfEngineOn... | Stores a service call in the ontology |
54,318 | public static function fromResource ( core_kernel_classes_Resource $ resource ) { $ values = $ resource -> getPropertiesValues ( array ( WfEngineOntology :: PROPERTY_CALL_OF_SERVICES_SERVICE_DEFINITION , WfEngineOntology :: PROPERTY_CALL_OF_SERVICES_ACTUAL_PARAMETER_IN , WfEngineOntology :: PROPERTY_CALL_OF_SERVICES_AC... | Builds a service call from it s serialized form |
54,319 | public function registerClientLib ( ) { $ jsPath = trim ( Template :: js ( '' , $ this -> extension -> getId ( ) ) , '/' ) ; ClientLibRegistry :: getRegistry ( ) -> register ( $ this -> extension -> getId ( ) , $ jsPath ) ; $ cssPath = trim ( Template :: css ( '' , $ this -> extension -> getId ( ) ) , '/' ) ; ClientLib... | Extension may declare client lib to add alias into requireJs |
54,320 | protected function persist ( ImportMapperInterface $ userMapper ) { if ( ! $ userMapper instanceof UserMapperInterface ) { throw new \ Exception ( 'Mapper should be a UserMapper' ) ; } $ plainPassword = $ userMapper -> getPlainPassword ( ) ; $ properties = $ userMapper -> getProperties ( ) ; $ class = $ this -> getUser... | Persist a user create or update |
54,321 | protected function triggerUserUpdated ( \ core_kernel_classes_Resource $ resource , array $ properties , $ plainPassword ) { $ eventManager = $ this -> getServiceLocator ( ) -> get ( EventManager :: SERVICE_ID ) ; $ eventManager -> trigger ( new UserUpdatedEvent ( $ resource , array_merge ( $ properties , [ 'hashForKey... | Trigger UserEvent at user update |
54,322 | protected function mergeUserProperties ( \ core_kernel_classes_Resource $ user , $ properties ) { foreach ( $ properties as $ property => $ value ) { $ user -> removePropertyValues ( $ this -> getProperty ( $ property ) ) ; $ user -> editPropertyValues ( $ this -> getProperty ( $ property ) , $ value ) ; } return $ use... | Flush rdf properties to a resource - delete old - insert new |
54,323 | public function forwardUrl ( $ url ) { $ request = common_http_Request :: currentRequest ( ) ; $ params = $ request -> getParams ( ) ; $ parsedUrl = parse_url ( $ url ) ; if ( isset ( $ parsedUrl [ 'query' ] ) && strlen ( $ parsedUrl [ 'query' ] ) > 0 ) { $ newParams = array ( ) ; parse_str ( $ parsedUrl [ 'query' ] , ... | Forward the action to execute reqarding a URL The forward runs into tha same HTTP request unlike redirect . |
54,324 | public function forward ( $ action , $ controller = null , $ extension = null , $ params = array ( ) ) { $ this -> forwardUrl ( \ tao_helpers_Uri :: url ( $ action , $ controller , $ extension , $ params ) ) ; } | Forward routing . |
54,325 | public function preRun ( ) { $ this -> options = array ( 'verbose' => false , 'action' => null , 'extension' => null ) ; $ this -> options = array_merge ( $ this -> options , $ this -> parameters ) ; if ( $ this -> options [ 'verbose' ] == true ) { $ this -> verbose = true ; } if ( $ this -> options [ 'action' ] == nul... | Things that must happen before script execution . |
54,326 | public function run ( ) { $ actions = $ this -> getAllowedActions ( ) ; $ pendingActionName = 'action' . $ actions [ $ this -> options [ 'action' ] ] ; if ( method_exists ( $ this , $ pendingActionName ) ) { return $ this -> $ pendingActionName ( ) ; } } | Main script implementation . |
54,327 | private function checkInput ( ) { $ actions = $ this -> getAllowedActions ( ) ; $ pendingActionName = 'check' . $ actions [ $ this -> options [ 'action' ] ] . 'Input' ; if ( method_exists ( $ this , $ pendingActionName ) ) { return $ this -> $ pendingActionName ( ) ; } } | Checks the inputs for the current script call . |
54,328 | private function checkCreateInput ( ) { $ defaults = array ( 'language' => null , 'languageLabel' => null , 'extension' => null , 'input' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_INPUT_DIR , 'output' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension'... | Checks the inputs for the create action . |
54,329 | private function checkUpdateAllInput ( ) { $ defaults = array ( 'input' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_INPUT_DIR , 'output' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_OUTPUT_DIR , 'extension' => null ) ; $ this... | checks the input for the updateAll action . |
54,330 | private function checkDeleteInput ( ) { $ defaults = array ( 'language' => null , 'input' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_INPUT_DIR , 'output' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_OUTPUT_DIR , 'extension' ... | Checks the inputs for the delete action . |
54,331 | public function actionUpdateAll ( ) { $ locales = $ this -> getLanguageList ( ) ; $ this -> outVerbose ( "Languages '" . implode ( ',' , $ locales ) . "' will be updated for extension '" . $ this -> options [ 'extension' ] . "'." ) ; foreach ( $ locales as $ l ) { $ this -> options [ 'language' ] = $ l ; $ this -> chec... | Implementation of the updateAll action . |
54,332 | public function actionDelete ( ) { $ this -> outVerbose ( "Deleting language '" . $ this -> options [ 'language' ] . "' for extension '" . $ this -> options [ 'extension' ] . "' ..." ) ; $ dir = $ this -> buildLanguagePath ( $ this -> options [ 'extension' ] , $ this -> options [ 'language' ] ) ; if ( ! tao_helpers_Fil... | Implementation of the delete action . |
54,333 | public function actionDeleteAll ( ) { $ this -> outVerbose ( "Deleting all languages for extension '" . $ this -> options [ 'extension' ] . "'..." ) ; $ locales = $ this -> getLanguageList ( ) ; foreach ( $ locales as $ l ) { $ this -> options [ 'language' ] = $ l ; $ this -> checkDeleteInput ( ) ; $ this -> actionDele... | Implementation of the deleteAll action . |
54,334 | public function findStructureManifest ( $ directory = null ) { $ returnValue = null ; if ( $ directory == null ) { $ actionsDir = $ this -> options [ 'input' ] . '/actions' ; } else { $ actionsDir = $ directory . '/actions' ; } $ dirEntries = scandir ( $ actionsDir ) ; if ( $ dirEntries === false ) { $ returnValue = fa... | Find a structure . xml manifest in a given directory . |
54,335 | public function preparePOFile ( tao_helpers_translation_POFile $ poFile , $ poEditorReady = false ) { $ poFile -> addHeader ( 'Project-Id-Version' , PRODUCT_NAME . ' ' . ApplicationHelper :: getVersionName ( ) ) ; $ poFile -> addHeader ( 'PO-Revision-Date' , date ( 'Y-m-d' ) . 'T' . date ( 'H:i:s' ) ) ; $ poFile -> add... | Prepare a PO file before output by adding headers to it . |
54,336 | public function isExtension ( $ directory ) { $ returnValue = ( bool ) false ; $ hasStructure = $ this -> findStructureManifest ( $ directory ) !== false ; $ hasPHPManifest = false ; $ files = scandir ( $ this -> options [ 'input' ] ) ; if ( $ files !== false ) { foreach ( $ files as $ f ) { if ( is_file ( $ this -> op... | Determines if an given directory actually contains a TAO extension . |
54,337 | public function addManifestsTranslations ( tao_helpers_translation_POFile $ poFile ) { $ this -> outVerbose ( "Adding all manifests messages to extension '" . $ this -> options [ 'extension' ] . "'" ) ; $ rootDir = dirname ( __FILE__ ) . '/../../' ; $ directories = scandir ( $ rootDir ) ; $ exceptions = array ( 'generi... | Add translations as translation units found in a structure . xml manifest a given PO file . |
54,338 | protected function addLanguageToOntology ( ) { $ this -> outVerbose ( "Importing RDF language description '" . $ this -> options [ 'language' ] . "' to ontology..." ) ; $ expectedDescriptionPath = $ this -> buildLanguagePath ( 'tao' , $ this -> options [ 'language' ] ) . '/lang.rdf' ; if ( file_exists ( $ expectedDescr... | Add the requested language in the ontology . It will used the parameters the command line for logic . |
54,339 | protected function removeLanguageFromOntology ( ) { $ this -> outVerbose ( "Removing RDF language description '" . $ this -> options [ 'language' ] . "' from ontology..." ) ; $ taoNS = 'http://www.tao.lu/Ontologies/TAO.rdf#' ; $ expectedDescriptionUri = $ taoNS . 'Lang' . $ this -> options [ 'language' ] ; $ lgResource... | Removes a language from the Ontology and all triples with the related tag . Will use command line parameters for logic . |
54,340 | protected function checkAuthInput ( ) { $ defaults = array ( 'user' => null , 'password' => null ) ; $ this -> options = array_merge ( $ defaults , $ this -> options ) ; if ( $ this -> options [ 'user' ] == null ) { $ this -> err ( "Please provide a value for the 'user' parameter." , true ) ; } else if ( $ this -> opti... | Checks authentication parameters for the TAO API . |
54,341 | private function getOntologyFiles ( ) { $ returnValue = array ( ) ; $ ext = common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( $ this -> options [ 'extension' ] ) ; $ returnValue = $ ext -> getManifest ( ) -> getInstallModelFiles ( ) ; return ( array ) $ returnValue ; } | Get the ontology file paths for a given extension sorted by target name |
54,342 | private function checkDisableInput ( ) { $ this -> checkAuthInput ( ) ; $ defaults = array ( 'language' => null ) ; $ this -> options = array_merge ( $ defaults , $ this -> options ) ; if ( $ this -> options [ 'language' ] == null ) { $ this -> err ( "Please provide the 'language' parameter." , true ) ; } } | Short description of method checkDisableInput |
54,343 | public function actionEnable ( ) { $ userService = tao_models_classes_UserService :: singleton ( ) ; $ this -> outVerbose ( "Connecting to TAO as '" . $ this -> options [ 'user' ] . "' ..." ) ; if ( $ userService -> loginUser ( $ this -> options [ 'user' ] , $ this -> options [ 'password' ] ) ) { $ this -> outVerbose (... | Short description of method actionEnable |
54,344 | private function checkCompileInput ( ) { $ defaults = array ( 'extension' => null , 'language' => null , 'input' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_INPUT_DIR , 'output' => dirname ( __FILE__ ) . '/../../' . $ this -> options [ 'extension' ] . '/' . self :: DEF_OU... | Checks the input for the compile action . |
54,345 | public function actionCompileAll ( ) { $ this -> outVerbose ( "Compiling all languages for extension '" . $ this -> options [ 'extension' ] . "'..." ) ; $ rootDir = ROOT_PATH ; $ extensionDir = $ rootDir . '/' . $ this -> options [ 'extension' ] ; $ localesDir = $ extensionDir . '/locales' ; $ locales = array ( ) ; $ d... | Implementation of the compileAll action . |
54,346 | public function sendMail ( \ core_kernel_classes_Resource $ user ) { $ messagingService = $ this -> getMessagingService ( ) ; if ( ! $ messagingService -> isAvailable ( ) ) { throw new PasswordRecoveryException ( 'Messaging service is not available.' ) ; } $ generisUser = new \ core_kernel_users_GenerisUser ( $ user ) ... | Send email message with password recovery instructions . |
54,347 | public function getUser ( $ property , $ value ) { $ class = new \ core_kernel_classes_Class ( GenerisRdf :: CLASS_GENERIS_USER ) ; $ users = \ tao_models_classes_UserService :: singleton ( ) -> searchInstances ( array ( $ property => $ value ) , $ class , array ( 'like' => false , 'recursive' => true ) ) ; $ user = em... | Get user by property value |
54,348 | public function getUserMail ( \ core_kernel_classes_Resource $ user ) { $ userMailProperty = new \ core_kernel_classes_Property ( GenerisRdf :: PROPERTY_USER_MAIL ) ; $ result = ( string ) $ user -> getOnePropertyValue ( $ userMailProperty ) ; if ( ! $ result || ! filter_var ( $ result , FILTER_VALIDATE_EMAIL ) ) { $ r... | Get user mail value |
54,349 | public function setPassword ( \ core_kernel_classes_Resource $ user , $ newPassword ) { \ tao_models_classes_UserService :: singleton ( ) -> setPassword ( $ user , $ newPassword ) ; $ this -> deleteToken ( $ user ) ; } | Change user pasword |
54,350 | public function deleteToken ( \ core_kernel_classes_Resource $ user ) { $ tokenProperty = new \ core_kernel_classes_Property ( self :: PROPERTY_PASSWORD_RECOVERY_TOKEN ) ; return $ user -> removePropertyValues ( $ tokenProperty ) ; } | Delete password recovery token . |
54,351 | public function getMessagingService ( ) { if ( is_null ( $ this -> messagingSerivce ) ) { $ this -> messagingSerivce = MessagingService :: singleton ( ) ; } return $ this -> messagingSerivce ; } | Get messaging service |
54,352 | private function generateRecoveryToken ( \ core_kernel_classes_Resource $ user ) { $ this -> deleteToken ( $ user ) ; $ token = md5 ( uniqid ( mt_rand ( ) , true ) ) ; $ tokenProperty = new \ core_kernel_classes_Property ( self :: PROPERTY_PASSWORD_RECOVERY_TOKEN ) ; $ user -> setPropertyValue ( $ tokenProperty , $ tok... | Generate password recovery token . If user already has passwordRecoveryToken property then it will be replaced . |
54,353 | public static function getHeaders ( ) { if ( self :: $ headers === null ) { if ( function_exists ( 'apache_request_headers' ) ) { $ headers = apache_request_headers ( ) ; } else { $ headers = array ( ) ; if ( isset ( $ _SERVER [ 'CONTENT_TYPE' ] ) ) { $ headers [ 'Content-Type' ] = $ _SERVER [ 'CONTENT_TYPE' ] ; } if (... | Return array of HTTP headers from the current request |
54,354 | public function hasAccess ( MenuAction $ action , common_user_User $ user , array $ node ) { $ resolvedAction = $ this -> getResolvedAction ( $ action ) ; if ( ! is_null ( $ resolvedAction ) && ! is_null ( $ user ) ) { if ( $ node [ 'type' ] = $ resolvedAction [ 'context' ] || $ resolvedAction [ 'context' ] == 'resourc... | Has a node access to an action |
54,355 | public function computePermissions ( array $ actions , \ common_user_User $ user , array $ node ) { $ permissions = [ ] ; foreach ( $ actions as $ action ) { $ access = $ this -> hasAccess ( $ action , $ user , $ node ) ; if ( $ access != self :: ACCESS_UNDEFINED ) { $ permissions [ $ action -> getId ( ) ] = ( $ access... | Compute the permissions of a node against a list of actions |
54,356 | public function getRequiredRights ( MenuAction $ action ) { $ rights = [ ] ; $ resolvedAction = $ this -> getResolvedAction ( $ action ) ; if ( ! is_null ( $ resolvedAction ) ) { try { $ rights = ControllerHelper :: getRequiredRights ( $ resolvedAction [ 'controller' ] , $ resolvedAction [ 'action' ] ) ; } catch ( \ Ex... | Get the rights required for the given action |
54,357 | private function getResolvedAction ( MenuAction $ action ) { $ actionId = $ action -> getId ( ) ; if ( ! isset ( $ this -> resolvedActions [ $ actionId ] ) ) { try { if ( $ action -> getContext ( ) == '*' ) { $ this -> resolvedActions [ $ actionId ] = null ; } else { $ resolver = new ActionResolver ( $ action -> getUrl... | Get the action resolved against itself in the current context |
54,358 | private function getTheme ( $ target , $ themeId ) { $ returnValue = null ; if ( ! $ this -> isRegistered ( $ target ) ) { throw new \ common_Exception ( 'Target ' . $ target . ' does not exist' ) ; } else { $ array = $ this -> get ( $ target ) ; $ found = false ; foreach ( $ array [ 'available' ] as $ theme ) { if ( $... | Get the theme array identified by its target and id |
54,359 | public function getDefaultTheme ( $ target ) { $ defaultTheme = null ; if ( ! $ this -> isRegistered ( $ target ) ) { throw new \ common_Exception ( 'Target ' . $ target . ' does not exist' ) ; } else { $ array = $ this -> get ( $ target ) ; if ( isset ( $ array [ 'default' ] ) ) { $ themeId = $ array [ 'default' ] ; t... | Get the default theme array |
54,360 | public function createTarget ( $ targetId , $ base ) { if ( ! is_string ( $ base ) && ! is_array ( $ base ) ) { throw new \ common_Exception ( 'Invalid base format' ) ; } $ array = array ( 'base' => $ base , 'available' => array ( ) ) ; $ this -> set ( $ targetId , $ array ) ; } | Adds a new target to the System |
54,361 | public function registerTheme ( $ id , $ name , $ path = '' , $ targets = array ( ) , $ templates = array ( ) ) { if ( preg_match ( '/^[a-zA-Z0-9]*$/' , $ id ) === 0 ) { throw new \ common_Exception ( 'Invalid id "' . $ id . '"' ) ; } if ( ! is_array ( $ targets ) || count ( $ targets ) === 0 ) { throw new \ common_Exc... | Adds a theme to the registry |
54,362 | private function resolveStylesheetUrl ( $ path ) { $ websource = WebsourceManager :: singleton ( ) -> getWebsource ( $ this -> get ( ThemeRegistry :: WEBSOURCE ) ) ; if ( strpos ( $ path , ThemeRegistry :: WEBSOURCE ) === 0 ) { return $ websource -> getAccessUrl ( substr ( $ path , strlen ( ThemeRegistry :: WEBSOURCE )... | Get the resolved absolute URL for a stylesheet |
54,363 | private function getResolvedBase ( $ target ) { $ base = null ; $ array = $ this -> get ( $ target ) ; if ( is_string ( $ array [ 'base' ] ) ) { $ assetService = $ this -> getServiceManager ( ) -> get ( AssetService :: SERVICE_ID ) ; $ base = $ assetService -> getAsset ( $ array [ 'base' ] ) ; } else if ( is_array ( $ ... | Resolve the path and url defined in target base |
54,364 | public function getAvailableThemes ( ) { $ returnValue = array ( ) ; foreach ( $ this -> getMap ( ) as $ target => $ value ) { if ( $ target == ThemeRegistry :: WEBSOURCE ) { continue ; } $ returnValue [ $ target ] = $ value ; $ returnValue [ $ target ] [ 'available' ] = array ( ) ; foreach ( $ value [ 'available' ] as... | Get list of available theme The available themes have their URL and paths resolved |
54,365 | public function getTemplate ( $ target , $ themeId , $ templateId ) { $ theme = $ this -> getTheme ( $ target , $ themeId ) ; if ( isset ( $ theme [ 'templates' ] ) && isset ( $ theme [ 'templates' ] [ $ templateId ] ) ) { return $ this -> resolveTemplatePath ( $ theme [ 'templates' ] [ $ templateId ] ) ; } return null... | Get the absolute path to a theme template |
54,366 | public function getStylesheet ( $ target , $ themeId ) { $ theme = $ this -> getTheme ( $ target , $ themeId ) ; if ( isset ( $ theme [ 'path' ] ) ) { return $ this -> resolveStylesheetUrl ( $ theme [ 'path' ] ) ; } return null ; } | Get the abosolute url to a stylesheet |
54,367 | public function getBaseTemplate ( $ target , $ templateId ) { $ base = $ this -> getResolvedBase ( $ target ) ; if ( is_array ( $ base ) && isset ( $ base [ 'templates' ] ) && isset ( $ base [ 'templates' ] [ $ templateId ] ) ) { return $ base [ 'templates' ] [ $ templateId ] ; } return null ; } | Get the asbolute path to the base template |
54,368 | public function getBaseStylesheet ( $ target ) { $ base = $ this -> getResolvedBase ( $ target ) ; if ( is_string ( $ base ) ) { return $ base ; } else if ( is_array ( $ base ) && isset ( $ base [ 'css' ] ) ) { return $ base [ 'css' ] ; } return null ; } | Get the absolute url to the base css |
54,369 | public function delete ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } else { $ deleted = false ; if ( $ this -> getRequestParameter ( 'uri' ) ) { $ role = $ this -> getCurrentInstance ( ) ; if ( ! in_array ( $ role -> getUri ( ) , $ this -> forbidden )... | Delete a group or a group class |
54,370 | public function getControllerShortName ( ) { $ relativeUrl = $ this -> request -> getUri ( ) -> getPath ( ) ; $ rootUrl = parse_url ( ROOT_URL ) ; if ( isset ( $ rootUrl [ 'path' ] ) ) { $ rootUrlPath = $ rootUrl [ 'path' ] ; $ relativeUrl = str_replace ( rtrim ( $ rootUrlPath , '/' ) , '' , $ relativeUrl ) ; } $ parts... | Get the controller short name as used into the URL |
54,371 | protected function resolve ( ) { $ extensionsManager = $ this -> getServiceLocator ( ) -> get ( \ common_ext_ExtensionsManager :: SERVICE_ID ) ; $ installed = $ extensionsManager -> getInstalledExtensionsIds ( ) ; foreach ( $ installed as $ extId ) { $ extension = $ extensionsManager -> getExtensionById ( $ extId ) ; f... | Tries to resolve the current request using the routes first and then falls back to the legacy controllers |
54,372 | public static function readStructure ( ) { if ( count ( self :: $ structure ) == 0 ) { if ( self :: USE_CACHE == false ) { self :: $ structure = self :: buildStructures ( ) ; } else { try { self :: $ structure = \ common_cache_FileCache :: singleton ( ) -> get ( self :: CACHE_KEY ) ; } catch ( \ common_cache_NotFoundEx... | Reads the structure data . This method manages to cache the structure if needed . |
54,373 | public static function getSection ( $ extension , $ perspectiveId , $ sectionId ) { $ returnValue = null ; $ structure = self :: getPerspective ( $ extension , $ perspectiveId ) ; foreach ( $ structure -> getChildren ( ) as $ section ) { if ( $ section -> getId ( ) == $ sectionId ) { $ returnValue = $ section ; break ;... | Short description of method getSection |
54,374 | public function load ( $ csvFile ) { $ returnValue = null ; $ csv = new tao_helpers_data_CsvFile ( $ this -> options ) ; $ csv -> load ( $ csvFile ) ; $ this -> loadedFile = $ csv ; $ returnValue = $ this -> loadedFile ; return $ returnValue ; } | enable you to load the data in the csvFile to an associative array the options |
54,375 | protected function evaluateValues ( $ column , core_kernel_classes_Property $ property , $ value ) { $ range = $ property -> getRange ( ) ; $ range = is_null ( $ range ) ? new core_kernel_classes_Class ( OntologyRdfs :: RDFS_LITERAL ) : $ range ; $ evaluatedValue = $ this -> applyCallbacks ( $ value , $ this -> options... | Evaluates the raw values provided by the csv file into the actual values to be assigned to the resource |
54,376 | private function applyCallbacks ( $ value , $ options , core_kernel_classes_Property $ targetProperty ) { if ( isset ( $ options [ 'callbacks' ] ) ) { foreach ( array ( '*' , $ targetProperty -> getUri ( ) ) as $ key ) { if ( isset ( $ options [ 'callbacks' ] [ $ key ] ) && is_array ( $ options [ 'callbacks' ] [ $ key ... | Short description of method applyCallbacks |
54,377 | public function attachResource ( core_kernel_classes_Property $ targetProperty , core_kernel_classes_Resource $ targetResource , $ value ) { $ resource = new core_kernel_classes_Resource ( $ value ) ; if ( $ resource -> exists ( ) ) { $ targetPropertyRanges = $ targetProperty -> getPropertyValuesCollection ( new core_k... | Short description of method attachResource |
54,378 | public function config ( ) { $ this -> setContentHeader ( 'application/javascript' ) ; $ extensionsAliases = ClientLibRegistry :: getRegistry ( ) -> getLibAliasMap ( ) ; $ this -> setData ( 'extensionsAliases' , $ extensionsAliases ) ; $ libConfigs = ClientLibConfigRegistry :: getRegistry ( ) -> getMap ( ) ; $ formatte... | Get the require . js config file |
54,379 | private function getExtension ( $ extensionId ) { try { return $ this -> getServiceLocator ( ) -> get ( common_ext_ExtensionsManager :: SERVICE_ID ) -> getExtensionById ( $ extensionId ) ; } catch ( common_ext_ExtensionException $ cee ) { throw new Exception ( __ ( 'Wrong parameter shownExtension' ) , $ cee ) ; } } | Get an extension by it s id |
54,380 | private function getShownExtension ( ) { if ( $ this -> hasRequestParameter ( 'shownExtension' ) ) { $ shownExtension = $ this -> getRequestParameter ( 'shownExtension' ) ; if ( strlen ( trim ( $ shownExtension ) ) > 0 ) { $ extension = $ this -> getExtension ( $ shownExtension ) ; return $ extension -> getName ( ) ; }... | Get and validate the extension name of the parameter shownExtension |
54,381 | private function getShownStructure ( ) { if ( $ this -> hasRequestParameter ( 'shownStructure' ) ) { $ structure = $ this -> getRequestParameter ( 'shownStructure' ) ; $ perspectives = \ oat \ tao \ model \ menu \ MenuService :: getAllPerspectives ( ) ; foreach ( $ perspectives as $ perspective ) { if ( $ perspective -... | Get and validate the shownStructure parameter |
54,382 | public function getRequiredRights ( ) { $ privileges = array ( ) ; foreach ( $ this -> getDocBlock ( ) -> getTagsByName ( 'requiresRight' ) as $ tag ) { $ privileges [ $ tag -> getParameterName ( ) ] = $ tag -> getRightId ( ) ; } return $ privileges ; } | Returns an array of all rights required to execute the action |
54,383 | public function findOauthConsumerResource ( $ consumer_key ) { $ returnValue = null ; $ class = $ this -> getClass ( self :: CLASS_URI_OAUTH_CONSUMER ) ; $ instances = $ class -> searchInstances ( array ( self :: PROPERTY_OAUTH_KEY => $ consumer_key ) , array ( 'like' => false , 'recursive' => true ) ) ; if ( count ( $... | Helper function to find the OauthConsumer RDF Resource |
54,384 | public function getOauthConsumer ( \ common_http_Credentials $ credentials ) { if ( ! $ credentials instanceof \ core_kernel_classes_Resource ) { throw new \ tao_models_classes_oauth_Exception ( 'Unsupported credential type ' . get_class ( $ credentials ) ) ; } $ values = $ credentials -> getPropertiesValues ( array ( ... | Returns the OAuthConsumer for the provided credentials |
54,385 | public function lookup_consumer ( $ consumer_key ) { $ returnValue = null ; $ consumer = $ this -> findOauthConsumerResource ( $ consumer_key ) ; $ secret = ( string ) $ consumer -> getUniquePropertyValue ( $ this -> getProperty ( self :: PROPERTY_OAUTH_SECRET ) ) ; $ callbackUrl = null ; $ returnValue = new OAuthConsu... | returns the OauthConsumer for the specified key |
54,386 | public function lookup_token ( $ consumer , $ token_type , $ token ) { \ common_Logger :: d ( __CLASS__ . '::' . __FUNCTION__ . ' called for token ' . $ token . ' of type ' . $ token_type ) ; return new OAuthToken ( $ consumer , "" ) ; } | Should verify if the token exists and return it Always returns an token with an empty secret for now |
54,387 | public function lookup_nonce ( $ consumer , $ token , $ nonce , $ timestamp ) { $ store = $ this -> getSubService ( self :: OPTION_NONCE_STORE ) ; return $ store -> isValid ( $ timestamp . '_' . $ consumer -> key . '_' . $ nonce ) ? null : true ; } | Should verify if a nonce has already been used always return NULL meaning that nonces can be reused |
54,388 | public function new_access_token ( $ token , $ consumer , $ verifier = null ) { \ common_Logger :: d ( __CLASS__ . '::' . __FUNCTION__ . ' called' ) ; return null ; } | Should create a new access token not implemented |
54,389 | public function createSessionFromRequest ( $ request , $ resolver ) { if ( ! $ this -> isRestController ( $ resolver ) ) { return false ; } foreach ( $ this -> getSessionBuilders ( ) as $ builder ) { if ( $ builder -> isApplicable ( $ request ) ) { return $ this -> startSession ( $ builder -> getSession ( $ request ) )... | Create a rest session based on builders . |
54,390 | protected function getSessionBuilders ( ) { $ adapters = is_array ( $ this -> getOption ( self :: OPTION_BUILDERS ) ) ? $ this -> getOption ( self :: OPTION_BUILDERS ) : [ ] ; foreach ( $ adapters as $ key => $ adapter ) { if ( ! is_a ( $ adapter , SessionBuilder :: class , true ) ) { throw new \ LogicException ( 'Sess... | Fetch rest session builder from the config |
54,391 | public function postInstall ( ) { $ this -> assertIsDebugMode ( ) ; $ success = true ; $ message = '' ; try { tao_models_classes_LanguageService :: singleton ( ) -> generateAll ( true ) ; } catch ( common_exception_Error $ e ) { $ message = $ e -> getMessage ( ) ; $ success = false ; } $ this -> returnJson ( array ( 's... | Once some extensions have been installed we trigger this action . |
54,392 | public function disable ( ) { $ this -> assertIsDebugMode ( ) ; $ extId = $ this -> getRequestParameter ( 'id' ) ; $ this -> getExtensionManager ( ) -> setEnabled ( $ extId , false ) ; MenuService :: flushCache ( ) ; $ this -> returnJson ( array ( 'success' => true , 'message' => __ ( 'Disabled %s' , $ this -> getReque... | Disable an extension |
54,393 | public function enable ( ) { $ this -> assertIsDebugMode ( ) ; $ extId = $ this -> getRequestParameter ( 'id' ) ; $ this -> getExtensionManager ( ) -> setEnabled ( $ extId , true ) ; MenuService :: flushCache ( ) ; $ this -> returnJson ( array ( 'success' => true , 'message' => __ ( 'Enabled %s' , $ this -> getRequestP... | Enable an extension |
54,394 | public function uninstall ( ) { $ this -> assertIsDebugMode ( ) ; try { $ uninstaller = new \ tao_install_ExtensionUninstaller ( $ this -> getCurrentExtension ( ) ) ; $ success = $ uninstaller -> uninstall ( ) ; $ message = __ ( 'Uninstalled %s' , $ this -> getRequestParameter ( 'id' ) ) ; } catch ( \ common_Exception ... | Uninstall an extension |
54,395 | public static function getInfos ( ) { $ subfolder = $ _SERVER [ 'REQUEST_URI' ] ; $ subfolder = preg_replace ( '/\/(([^\/]*)\/){2}([^\/]*)$/' , '' , $ subfolder ) ; $ subfolder = preg_replace ( '/^\//' , '' , $ subfolder ) ; return array ( 'folder' => $ subfolder , 'host' => $ _SERVER [ 'HTTP_HOST' ] , 'https' => ( $ _... | Get informations on the host system . |
54,396 | public static function isTAOInstalled ( $ path = '' ) { $ path = ( empty ( $ path ) ) ? __DIR__ . '/../../../config' : rtrim ( $ path , '/\\' ) ; $ config = "${path}/generis.conf.php" ; return file_exists ( $ config ) ; } | Check if TAO is already installed . |
54,397 | public static function isTAOUpToDate ( $ path = '' ) { $ path = ( empty ( $ path ) ) ? __DIR__ . '/../../../config' : rtrim ( $ path , '/\\' ) ; $ generisConf = "${path}/generis.conf.php" ; if ( ! is_readable ( $ generisConf ) ) { return false ; } include_once ( $ generisConf ) ; $ installationConf = "${path}/generis/i... | Check if TAO is already up to date . |
54,398 | public function parse ( ) { $ this -> setStatements ( array ( ) ) ; $ file = $ this -> getFile ( ) ; if ( ! file_exists ( $ file ) ) { throw new tao_install_utils_SQLParsingException ( "SQL file '${file}' does not exist." ) ; } else if ( ! is_readable ( $ file ) ) { throw new tao_install_utils_SQLParsingException ( "SQ... | Parses a SQL file containing simple statements . |
54,399 | protected function chooseRenderer ( array $ accept ) { $ renderClass = 'none' ; foreach ( $ accept as $ mimeType ) { switch ( trim ( strtolower ( $ mimeType ) ) ) { case 'text/html' : case 'application/xhtml+xml' : case '*/*' : $ renderClass = 'html' ; break 2 ; case 'application/json' : case 'text/json' : $ renderClas... | search rendering method in function of request accept header |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.