idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
54,600 | public function initElements ( ) { $ mailElement = tao_helpers_form_FormFactory :: getElement ( 'userMail' , 'Textbox' ) ; $ mailElement -> setDescription ( __ ( 'Your mail' ) . '*' ) ; $ mailElement -> addValidator ( tao_helpers_form_FormFactory :: getValidator ( 'NotEmpty' ) ) ; $ mailElement -> addValidator ( tao_he... | Initialiaze recovery form elements |
54,601 | public function removePropertyIndex ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } if ( ! $ this -> hasRequestParameter ( 'uri' ) ) { throw new common_exception_MissingParameter ( "Uri parameter is missing" ) ; } if ( ! $ this -> hasRequestParameter ( ... | remove the index of the property . |
54,602 | public function addPropertyIndex ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } if ( ! $ this -> hasRequestParameter ( 'uri' ) ) { throw new Exception ( "wrong request Parameter" ) ; } $ uri = $ this -> getRequestParameter ( 'uri' ) ; $ clazz = $ this ... | Render the add index sub form . |
54,603 | public function getClassForm ( core_kernel_classes_Class $ clazz ) { $ propMode = 'simple' ; if ( $ this -> hasSessionAttribute ( 'property_mode' ) ) { $ propMode = $ this -> getSessionAttribute ( 'property_mode' ) ; } $ options = array ( 'property_mode' => $ propMode , 'topClazz' => $ this -> getClass ( GenerisRdf :: ... | Create an edit form for a class and its property and handle the submited data on save |
54,604 | protected function saveSimpleProperty ( $ propertyValues ) { $ propertyMap = tao_helpers_form_GenerisFormFactory :: getPropertyMap ( ) ; $ property = $ this -> getProperty ( tao_helpers_Uri :: decode ( $ propertyValues [ 'uri' ] ) ) ; $ type = $ propertyValues [ 'type' ] ; $ range = ( isset ( $ propertyValues [ 'range'... | Default property handling |
54,605 | protected function saveAdvProperty ( $ propertyValues ) { $ range = array ( ) ; foreach ( $ propertyValues as $ key => $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ v ) { $ range [ ] = $ this -> getClass ( tao_helpers_Uri :: decode ( $ v ) ) ; } } else { $ values [ tao_helpers_Uri :: decode ( $ key )... | Advanced property handling |
54,606 | protected function bindProperties ( core_kernel_classes_Resource $ resource , $ values ) { $ binder = new tao_models_classes_dataBinding_GenerisInstanceDataBinder ( $ resource ) ; $ binder -> bind ( $ values ) ; } | Helper to save class and properties |
54,607 | protected function extractClassData ( $ data ) { $ classData = array ( ) ; if ( isset ( $ data [ 'class' ] ) ) { foreach ( $ data [ 'class' ] as $ key => $ value ) { $ classData [ 'class_' . $ key ] = $ value ; } } return $ classData ; } | Extracts the data assoicuated with the class from the request |
54,608 | protected function extractPropertyData ( $ data ) { $ propertyData = array ( ) ; if ( isset ( $ data [ 'properties' ] ) ) { foreach ( $ data [ 'properties' ] as $ key => $ value ) { $ propertyData [ tao_helpers_Uri :: decode ( $ value [ 'uri' ] ) ] = $ value ; } } return $ propertyData ; } | Extracts the properties data from the request data and formats it as an array with the keys being the property URI and the values being the associated data |
54,609 | public function getAllClasses ( core_kernel_classes_Class $ rootClass ) { $ result = [ 'uri' => $ rootClass -> getUri ( ) , 'label' => $ rootClass -> getLabel ( ) , 'children' => $ this -> getSubClasses ( $ rootClass -> getSubClasses ( false ) ) ] ; return $ result ; } | Get the list of classes from the given root class |
54,610 | private function getSubClasses ( $ subClasses ) { $ result = [ ] ; foreach ( $ subClasses as $ subClass ) { $ children = $ subClass -> getSubClasses ( false ) ; $ entry = [ 'uri' => $ subClass -> getUri ( ) , 'label' => $ subClass -> getLabel ( ) ] ; if ( count ( $ children ) > 0 ) { $ entry [ 'children' ] = $ this -> ... | Get the class subclasses |
54,611 | public function getResources ( \ core_kernel_classes_Class $ rootClass , $ format = 'list' , $ selectedUris = [ ] , $ search = '' , $ offset = 0 , $ limit = 30 ) { $ propertyFilters = $ this -> getPropertyFilters ( $ search ) ; $ result = [ ] ; $ resourceLookup = $ this -> getResourceLookup ( $ format ) ; if ( ! is_nul... | Retrieve the resources for the given parameters |
54,612 | public function getResourcesPermissions ( User $ user , $ resources ) { $ permissions = [ ] ; if ( ! is_null ( $ user ) ) { try { $ permissionManager = $ this -> getServiceManager ( ) -> get ( PermissionInterface :: SERVICE_ID ) ; $ supportedRights = $ permissionManager -> getSupportedRights ( ) ; $ permissions [ 'supp... | Get the permissions for a list of resources . |
54,613 | private function getPropertyFilters ( $ search = '' ) { $ propertyFilters = [ ] ; if ( is_string ( $ search ) && strlen ( trim ( $ search ) ) > 0 ) { $ propertyFilters [ self :: LABEL_URI ] = $ search ; } if ( is_array ( $ search ) ) { foreach ( $ search as $ uri => $ value ) { if ( is_string ( $ uri ) && ( is_string (... | Get the filters based on the search param |
54,614 | private function getResourceLookup ( $ format ) { if ( in_array ( $ format , self :: $ formats ) ) { if ( ! isset ( $ this -> lookups ) ) { $ this -> lookups = [ 'list' => $ this -> getServiceManager ( ) -> get ( ListResourceLookup :: SERVICE_ID ) , 'tree' => $ this -> getServiceManager ( ) -> get ( TreeResourceLookup ... | Get the resource lookup for the given format |
54,615 | public function evaluate ( $ values ) { if ( preg_match ( "/^[a-z]+[a-z_0-9]*$/" , $ values ) === 1 ) { return true ; } else { if ( ! $ this -> hasOption ( 'message' ) ) { $ message = empty ( $ values ) ? __ ( 'The index identifier should not be empty' ) : __ ( '"%s" is not a valid index identifier. It must start with ... | evalute the identifier |
54,616 | public function getEvaluatedValue ( ) { $ returnValue = null ; $ arr = $ this -> getRawValue ( ) ; $ returnValue = core_kernel_users_Service :: getPasswordHash ( ) -> encrypt ( array_shift ( $ arr ) ) ; return $ returnValue ; } | returns the md5 hash of the password |
54,617 | public static function convertFromLegacyTheme ( $ theme ) { if ( $ theme instanceof ConfigurablePlatformTheme ) { return $ theme ; } if ( is_array ( $ theme ) ) { if ( empty ( $ theme [ ThemeServiceInterface :: THEME_CLASS_OFFSET ] ) ) { throw new \ common_exception_MissingParameter ( ThemeServiceInterface :: THEME_CLA... | Build an instance of ConfigurablePlatformTheme from a legacy theme |
54,618 | public function hasElement ( $ name ) { foreach ( $ this -> elements as $ element ) { if ( $ element -> getName ( ) == $ name ) { return true ; } } return false ; } | Has an element of the form identified by it s name |
54,619 | public function getElement ( $ name ) { $ returnValue = null ; foreach ( $ this -> elements as $ element ) { if ( $ element -> getName ( ) == $ name ) { $ returnValue = $ element ; break ; } } if ( is_null ( $ returnValue ) ) { common_Logger :: w ( 'Element with name \'' . $ name . '\' not found' ) ; } return $ returnV... | get an element of the form identified by it s name |
54,620 | public function removeElement ( $ name ) { $ returnValue = false ; foreach ( $ this -> elements as $ index => $ element ) { if ( $ element -> getName ( ) == $ name ) { unset ( $ this -> elements [ $ index ] ) ; $ groupName = $ this -> getElementGroup ( $ name ) ; if ( ! empty ( $ groupName ) ) { if ( isset ( $ this -> ... | Remove an element identified by it s name . |
54,621 | public function addElement ( tao_helpers_form_FormElement $ element , $ isSystem = false ) { $ elementPosition = - 1 ; foreach ( $ this -> elements as $ i => $ elt ) { if ( $ elt -> getName ( ) == $ element -> getName ( ) ) { $ elementPosition = $ i ; break ; } } if ( $ elementPosition >= 0 ) { $ this -> elements [ $ e... | Add an element to the form |
54,622 | public function setActions ( $ actions , $ context = 'bottom' ) { $ this -> actions [ $ context ] = array ( ) ; foreach ( $ actions as $ action ) { if ( ! $ action instanceof tao_helpers_form_FormElement ) { throw new Exception ( " the actions parameter must only contains instances of tao_helpers_form_FormElement " ) ;... | Define the form actions for a context . The different contexts are top and bottom . |
54,623 | public function getActions ( $ context = 'bottom' ) { $ returnValue = array ( ) ; if ( isset ( $ this -> actions [ $ context ] ) ) { $ returnValue = $ this -> actions [ $ context ] ; } return ( array ) $ returnValue ; } | Get the defined actions for a context |
54,624 | public function setDecorators ( $ decorators ) { foreach ( $ decorators as $ type => $ decorator ) { $ this -> setDecorator ( $ decorator , $ type ) ; } } | Set the form decorators |
54,625 | public function getDecorator ( $ type = 'element' ) { $ returnValue = null ; if ( array_key_exists ( $ type , $ this -> decorators ) ) { $ returnValue = $ this -> decorators [ $ type ] ; } return $ returnValue ; } | Get the decorator of the type defined in parameter . The different types are element error group . By default it uses the element decorator . |
54,626 | public function renderActions ( $ context = 'bottom' ) { $ returnValue = ( string ) '' ; if ( isset ( $ this -> actions [ $ context ] ) ) { $ decorator = null ; if ( ! is_null ( $ this -> getDecorator ( 'actions-' . $ context ) ) ) { $ decorator = $ this -> getDecorator ( 'actions-' . $ context ) ; } else if ( ! is_nul... | render the form actions by context |
54,627 | public function hasFileUpload ( ) { $ returnValue = false ; foreach ( $ this -> elements as $ element ) { if ( $ element instanceof tao_helpers_form_elements_File ) { $ returnValue = true ; break ; } } return $ returnValue ; } | Check if the form contains a file upload element |
54,628 | public function setValues ( $ values ) { foreach ( $ values as $ key => $ value ) { foreach ( $ this -> elements as $ element ) { if ( $ element -> getName ( ) == $ key ) { if ( $ element instanceof tao_helpers_form_elements_Checkbox || ( method_exists ( $ element , 'setValues' ) && is_array ( $ value ) ) ) { $ element... | Update manually the values of the form |
54,629 | public function getValue ( $ name ) { foreach ( $ this -> elements as $ element ) { if ( $ element -> getName ( ) == $ name ) { return $ element -> getEvaluatedValue ( ) ; } } return false ; } | get the current value of the element identified by the name in parameter |
54,630 | public function createGroup ( $ groupName , $ groupTitle = '' , array $ elements = array ( ) , array $ options = array ( ) ) { $ identifier = array ( ) ; foreach ( $ elements as $ element ) { if ( $ element instanceof tao_helpers_form_FormElement ) { $ identifier [ ] = $ element -> getName ( ) ; } elseif ( is_string ( ... | Create a logical group of elements |
54,631 | public function addToGroup ( $ groupName , $ elementName = '' ) { if ( isset ( $ this -> groups [ $ groupName ] ) ) { if ( isset ( $ this -> groups [ $ groupName ] [ 'elements' ] ) ) { if ( ! in_array ( $ elementName , $ this -> groups [ $ groupName ] [ 'elements' ] ) ) { $ this -> groups [ $ groupName ] [ 'elements' ]... | add an element to a group |
54,632 | protected function getElementGroup ( $ elementName ) { $ returnValue = '' ; foreach ( $ this -> groups as $ groupName => $ group ) { if ( in_array ( $ elementName , $ group [ 'elements' ] ) ) { $ returnValue = $ groupName ; break ; } } return $ returnValue ; } | get the group where is an element |
54,633 | public function removeGroup ( $ groupName ) { if ( isset ( $ this -> groups [ $ groupName ] ) ) { foreach ( $ this -> groups [ $ groupName ] [ 'elements' ] as $ element ) { $ this -> removeElement ( $ element ) ; } unset ( $ this -> groups [ $ groupName ] ) ; } } | remove the group identified by the name in parameter |
54,634 | public function extendedUninstall ( ) { foreach ( $ this -> extension -> getManifest ( ) -> getAclTable ( ) as $ tableEntry ) { $ rule = new AccessRule ( $ tableEntry [ 0 ] , $ tableEntry [ 1 ] , $ tableEntry [ 2 ] ) ; AclProxy :: revokeRule ( $ rule ) ; } } | Uninstall all access rules |
54,635 | protected function editClass ( core_kernel_classes_Class $ clazz , core_kernel_classes_Resource $ resource , core_kernel_classes_Class $ topclass = null ) { return $ this -> getClassForm ( $ clazz , $ resource , $ topclass ) ; } | Deprecated alias for getClassForm |
54,636 | public function getOntologyData ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_IsAjaxAction ( __FUNCTION__ ) ; } $ options = $ this -> getTreeOptionsFromRequest ( [ ] ) ; $ tree = $ this -> getClassService ( ) -> toTree ( $ options [ 'class' ] , $ options ) ; $ user = \ common_Session_Sessio... | Renders json data from the current ontology root class . |
54,637 | protected function getTreeOptionsFromRequest ( $ options = [ ] ) { $ options = array_merge ( [ 'subclasses' => true , 'instances' => true , 'highlightUri' => '' , 'chunk' => false , 'offset' => 0 , 'limit' => 0 ] , $ options ) ; if ( $ this -> hasRequestParameter ( 'loadNode' ) ) { $ options [ 'uniqueNode' ] = $ this -... | Get options to generate tree |
54,638 | protected function addPermissions ( $ tree ) { $ user = $ this -> getSession ( ) -> getUser ( ) ; $ section = MenuService :: getSection ( $ this -> getRequestParameter ( 'extension' ) , $ this -> getRequestParameter ( 'perspective' ) , $ this -> getRequestParameter ( 'section' ) ) ; $ actions = $ section -> getActions ... | Add permission information to the tree structure |
54,639 | private function computePermissions ( $ actions , $ user , $ node ) { if ( isset ( $ node [ 'attributes' ] [ 'data-uri' ] ) ) { if ( $ node [ 'type' ] == 'class' ) { $ params = array ( 'classUri' => $ node [ 'attributes' ] [ 'data-uri' ] ) ; } else { $ params = array ( ) ; foreach ( $ node [ 'attributes' ] as $ key => ... | compulte permissions for a node against actions |
54,640 | public function editClassLabel ( ) { $ clazz = $ this -> getCurrentClass ( ) ; $ signatureGenerator = ServiceManager :: getServiceManager ( ) -> get ( SignatureGenerator :: class ) ; $ signature = $ signatureGenerator -> generate ( tao_helpers_Uri :: encode ( $ this -> getRequestParameter ( 'classUri' ) ) ) ; $ editCla... | Common action to view and change the label of a class |
54,641 | public function addSubClass ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ classId = $ this -> getRequestParameter ( 'id' ) ; $ this -> signatureValidator -> checkSignature ( $ this -> getRequestParameter ( 'signature' ) , $ classId ) ; $ this -> val... | Add a subclass to the currently selected class |
54,642 | public function addInstanceForm ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ clazz = $ this -> getCurrentClass ( ) ; $ formContainer = new tao_actions_form_CreateInstance ( array ( $ clazz ) , array ( ) ) ; $ myForm = $ formContainer -> getForm ( )... | Add an instance of the selected class |
54,643 | protected function createInstance ( $ classes , $ properties ) { $ first = array_shift ( $ classes ) ; $ instance = $ first -> createInstanceWithProperties ( $ properties ) ; foreach ( $ classes as $ class ) { $ instance = $ this -> getResource ( '' ) ; $ instance -> setType ( $ class ) ; } return $ instance ; } | creates the instance |
54,644 | public function cloneInstance ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ uri = $ this -> getRequestParameter ( 'uri' ) ; $ this -> signatureValidator -> checkSignature ( $ this -> getRequestParameter ( 'signature' ) , $ uri ) ; $ this -> validate... | Duplicate the current instance render a JSON response |
54,645 | public function copyInstance ( ) { if ( $ this -> hasRequestParameter ( 'destinationClassUri' ) && $ this -> hasRequestParameter ( 'uri' ) && common_Utils :: isUri ( $ this -> getRequestParameter ( 'destinationClassUri' ) ) ) { $ this -> validateInstanceRoot ( $ this -> getRequestParameter ( 'uri' ) ) ; $ this -> signa... | Copy a resource to a destination |
54,646 | public function moveInstance ( ) { $ response = array ( ) ; if ( $ this -> hasRequestParameter ( 'destinationClassUri' ) && $ this -> hasRequestParameter ( 'uri' ) ) { $ id = $ this -> getRequestParameter ( 'uri' ) ; $ this -> validateInstanceRoot ( $ id ) ; $ this -> signatureValidator -> checkSignature ( $ this -> ge... | Move an instance from a class to another |
54,647 | public function moveResource ( ) { try { if ( ! $ this -> hasRequestParameter ( 'uri' ) ) { throw new InvalidArgumentException ( 'Resource uri must be specified.' ) ; } $ data = $ this -> getRequestParameter ( 'uri' ) ; $ id = $ data [ 'id' ] ; $ this -> validateUri ( $ id ) ; $ this -> validateInstanceRoot ( $ id ) ; ... | Move a single resource to another class |
54,648 | public function moveAll ( ) { try { if ( ! $ this -> hasRequestParameter ( 'ids' ) ) { throw new InvalidArgumentException ( 'Resource ids must be specified.' ) ; } $ ids = [ ] ; foreach ( $ this -> getRequestParameter ( 'ids' ) as $ id ) { $ ids [ ] = $ id [ 'id' ] ; } $ this -> validateInstancesRoot ( $ ids ) ; if ( e... | Move all specififed resources to the given destination root class |
54,649 | public function translateInstance ( ) { $ instance = $ this -> getCurrentInstance ( ) ; $ formContainer = new tao_actions_form_Translate ( $ this -> getCurrentClass ( ) , $ instance ) ; $ myForm = $ formContainer -> getForm ( ) ; if ( $ this -> hasRequestParameter ( 'target_lang' ) ) { $ targetLang = $ this -> getReque... | Render the form to translate a Resource instance |
54,650 | public function getTranslatedData ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ data = array ( ) ; if ( $ this -> hasRequestParameter ( 'lang' ) ) { $ data = tao_helpers_Uri :: encodeArray ( $ this -> getClassService ( ) -> getTranslatedProperties (... | load the translated data of an instance regarding the given lang |
54,651 | public function delete ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } if ( $ this -> hasRequestParameter ( 'uri' ) ) { return $ this -> forward ( 'deleteResource' , null , null , ( array ( 'id' => tao_helpers_Uri :: decode ( $ this -> getRequestParamet... | delete an instance or a class called via ajax |
54,652 | public function deleteResource ( ) { if ( ! $ this -> isXmlHttpRequest ( ) || ! $ this -> hasRequestParameter ( 'id' ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ id = $ this -> getRequestParameter ( 'id' ) ; $ this -> validateCsrf ( ) ; $ this -> validateInstanceRoot ( $ id ) ; $ this -> s... | Generic resource deletion action |
54,653 | public function deleteClass ( ) { if ( ! $ this -> isXmlHttpRequest ( ) || ! $ this -> hasRequestParameter ( 'id' ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ id = $ this -> getRequestParameter ( 'id' ) ; $ this -> validateCsrf ( ) ; $ this -> validateInstanceRoot ( $ id ) ; $ this -> sign... | Generic class deletion action |
54,654 | public function deleteAll ( ) { $ response = [ 'success' => true , 'deleted' => [ ] ] ; if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ this -> validateCsrf ( ) ; $ ids = [ ] ; foreach ( $ this -> getRequestParameter ( 'ids' ) as $ id ) { $ ids [ ] = $ id [... | Delete all given resources |
54,655 | protected function hasWriteAccess ( $ resourceId ) { $ user = $ this -> getSession ( ) -> getUser ( ) ; return ( new DataAccessControl ( ) ) -> hasPrivileges ( $ user , array ( $ resourceId => 'WRITE' ) ) ; } | Test whenever the current user has WRITE access to the specified id |
54,656 | public function validateCsrf ( ) { $ tokenService = $ this -> getServiceLocator ( ) -> get ( TokenService :: SERVICE_ID ) ; $ tokenName = $ tokenService -> getTokenName ( ) ; $ token = $ this -> getRequestParameter ( $ tokenName ) ; if ( $ tokenService -> checkToken ( $ token ) ) { $ tokenService -> revokeToken ( $ tok... | Validates csrf token and revokes token on success |
54,657 | protected function validateMoveRequest ( ) { if ( ! $ this -> isRequestPost ( ) ) { throw new common_exception_MethodNotAllowed ( 'Only POST method is allowed to move instances.' ) ; } if ( ! $ this -> hasRequestParameter ( 'destinationClassUri' ) ) { throw new InvalidArgumentException ( 'Destination class must be spec... | Validate request with all required parameters |
54,658 | protected function moveAllInstances ( array $ ids ) { $ rootClass = $ this -> getClassService ( ) -> getRootClass ( ) ; if ( in_array ( $ rootClass -> getUri ( ) , $ ids ) ) { throw new InvalidArgumentException ( sprintf ( 'Root class "%s" cannot be moved' , $ rootClass -> getUri ( ) ) ) ; } $ destinationClass = new \ ... | Move instances to another class |
54,659 | private function getInstancesToMove ( array $ classes = [ ] , array $ instances = [ ] , array & $ statuses = [ ] ) { $ movableInstances = [ ] ; foreach ( $ instances as $ instance ) { $ isValid = true ; foreach ( $ classes as $ class ) { if ( $ instance instanceof core_kernel_classes_Class ) { if ( $ class -> getUri ( ... | Get movable instances from the list of instances |
54,660 | private function move ( \ core_kernel_classes_Class $ destinationClass , array $ movableInstances = [ ] , array $ statuses = [ ] ) { foreach ( $ movableInstances as $ movableInstance ) { $ statuses [ $ movableInstance -> getUri ( ) ] = [ 'success' => $ success = $ this -> getClassService ( ) -> changeClass ( $ movableI... | Move movableInstances to the destinationClass |
54,661 | public function getOperatedBy ( ) { $ operatedBy = $ this -> getOption ( static :: OPERATED_BY ) ; $ operatedBy [ 'name' ] = empty ( $ operatedBy [ 'name' ] ) ? '' : $ operatedBy [ 'name' ] ; $ operatedBy [ 'email' ] = empty ( $ operatedBy [ 'email' ] ) ? '' : $ operatedBy [ 'email' ] ; return $ operatedBy ; } | Operated by info make sure both fields contain a string |
54,662 | public function getTextFromArray ( array $ keys = [ ] ) { $ values = [ ] ; foreach ( $ keys as $ key ) { $ values [ $ key ] = $ this -> getText ( $ key ) ; } return $ values ; } | Retrieve all custom translatable strings for the given keys |
54,663 | protected function setupOptions ( $ options ) { if ( empty ( $ options [ static :: EXTENSION_ID ] ) ) { $ cls = get_class ( $ this ) ; strtok ( $ cls , '\\' ) ; $ options [ static :: EXTENSION_ID ] = strtok ( '\\' ) ; } $ options = array_merge ( [ static :: STYLESHEET => Template :: css ( 'tao-3.css' , 'tao' ) , static... | This setup is used when configuring a theme for a custom extension . In multi tenancy though the tenant id might be use instead of the extension id . |
54,664 | public function toArray ( ) { $ data = parent :: toArray ( ) ; $ deniedCategories = [ TaskLogInterface :: CATEGORY_DELETE , TaskLogInterface :: CATEGORY_EXPORT , TaskLogInterface :: CATEGORY_UNKNOWN ] ; if ( ! in_array ( $ this -> taskLogService -> getCategoryForTask ( $ this -> getTaskName ( ) ) , $ deniedCategories )... | Add redirectUrl to the result if the task has been processed and it is not an export or delete task |
54,665 | public static function unserializeAnnotations ( $ annotations ) { $ returnValue = array ( ) ; $ reg = "/\s*@(subject|predicate|sourceLanguage|targetLanguage|source)[\t ]+(.+)(?:\s*|$)/u" ; $ matches = array ( ) ; if ( false !== preg_match_all ( $ reg , $ annotations , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { ... | Unserialize an RDFTranslationUnit annotation and returns an associative where keys are annotation names and values are the annotation values . Throws TranslationException . |
54,666 | public static function serializeAnnotations ( $ annotations , $ glue = '' ) { $ returnValue = ( string ) '' ; if ( $ glue == '' ) { $ glue = "\n " ; } $ a = array ( ) ; foreach ( $ annotations as $ n => $ v ) { $ v = str_replace ( "\\" , "\\\\" , $ v ) ; $ v = str_replace ( '--' , "\\-\\-" , $ v ) ; $ a [ ] = '@' . ... | Serializes an associative array of annotations where keys are annotation and values are annotation values . |
54,667 | public static function createLanguageDescription ( $ code , $ label ) { $ returnValue = null ; $ languageType = tao_models_classes_LanguageService :: CLASS_URI_LANGUAGES ; $ languagePrefix = 'http://www.tao.lu/Ontologies/TAO.rdf#Lang' ; $ rdfNs = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' ; $ rdfsNs = 'http://www.w3... | Creates a language description file for TAO using the RDF - XML language . |
54,668 | public function getSize ( ) { if ( is_null ( $ this -> size ) ) { $ this -> size = is_null ( $ this -> getFile ( ) ) ? 0 : $ this -> getFile ( ) -> getSize ( ) ; } return $ this -> size ; } | Returns the size of the file in bytes . |
54,669 | public function toArray ( ) { return [ 'id' => $ this -> id , 'module' => $ this -> module , 'bundle' => $ this -> bundle , 'position' => $ this -> position , 'name' => $ this -> name , 'description' => $ this -> description , 'category' => $ this -> category , 'active' => $ this -> active , 'tags' => $ this -> tags ] ... | Convenient method to convert the members to an assoc array |
54,670 | public static function fromArray ( array $ data ) { if ( ! isset ( $ data [ 'id' ] ) || ! isset ( $ data [ 'module' ] ) || ! isset ( $ data [ 'category' ] ) ) { throw new common_exception_InconsistentData ( 'The module requires an id, a module and a category' ) ; } return new static ( $ data [ 'id' ] , $ data [ 'module... | Create a test module from an assoc array |
54,671 | private static function validateRequiredData ( $ id , $ module , $ category ) { if ( ! is_string ( $ id ) || empty ( $ id ) ) { throw new common_exception_InconsistentData ( 'The module needs an id' ) ; } if ( ! is_string ( $ module ) || empty ( $ module ) ) { throw new common_exception_InconsistentData ( 'The module n... | Validate required data to construct a module |
54,672 | public function evaluate ( $ values ) { $ sourceElement = $ this -> getOption ( 'sourceElement' ) ; $ sourceElementValue = $ sourceElement -> getEvaluatedValue ( ) ; if ( $ sourceElementValue !== 'list' ) { return true ; } $ this -> invalidValues = [ ] ; $ values = trim ( str_replace ( "\r" , '' , $ values ) ) ; if ( !... | Validates the list of domains and directives for the CSP Header . |
54,673 | private function getNormalizedDirective ( $ directive ) { $ directive = strtolower ( $ directive ) ; if ( ctype_alpha ( $ directive ) === true ) { $ directive = "'" . $ directive . "'" ; } return $ directive ; } | Check if the given directive need to be converted . |
54,674 | private function isValidDomain ( $ domain ) { if ( filter_var ( $ domain , FILTER_VALIDATE_URL ) ) { return true ; } $ regex = '~^(https?:\/\/|(\*\.){1})?(\w.+)(\.)(?!\s)(?!\.\*)(\w{2,})$~i' ; return ( bool ) preg_match ( $ regex , $ domain ) ; } | Check if the given domain is valid . |
54,675 | public static function sortByField ( $ input , $ field , $ descending = false ) { $ returnValue = array ( ) ; $ sorted = array ( ) ; foreach ( $ input as $ key => $ value ) { $ sorted [ $ key ] = $ value [ $ field ] ; } if ( $ descending ) { arsort ( $ sorted ) ; } else { asort ( $ sorted ) ; } foreach ( $ sorted as $ ... | Sort an associative array on a key criterion . Uses sort or asort PHP functions to implement the sort depending on the value of the descending parameter . |
54,676 | public static function containsOnlyValue ( $ value , array $ container , $ strict = false , $ exceptAtIndex = array ( ) ) { if ( ! is_scalar ( $ value ) ) { return false ; } if ( empty ( $ container ) ) { return false ; } $ matchCount = 0 ; foreach ( $ container as $ key => $ val ) { if ( in_array ( $ key , $ exceptAtI... | Does an array contains only a given value . |
54,677 | public static function arraysContainOnlyValue ( array $ containers , $ value , $ exceptNContainers = 0 , array $ exceptAtIndex = [ ] , array & $ invalidContainers = [ ] , array & $ validContainers = [ ] ) { if ( $ exceptNContainers < 0 ) { $ exceptNContainers = 0 ; } else { $ exceptNContainers = intval ( $ exceptNConta... | Does a collection of arrays contain only a given value . |
54,678 | public static function countConsistentColumns ( array $ matrix , array $ ignoreValues = [ ] , $ emptyIsConsistent = false ) { $ consistentCount = 0 ; if ( ! self :: isValidMatrix ( $ matrix ) ) { return $ consistentCount ; } for ( $ i = 0 ; $ i < count ( $ matrix [ 0 ] ) ; $ i ++ ) { $ column = array_column ( $ matrix ... | Count the Amount of Consistent Columns in Matrix |
54,679 | public function locked ( ) { $ this -> defaultData ( ) ; $ resource = $ this -> getResource ( $ this -> getRequestParameter ( 'id' ) ) ; $ lockData = LockManager :: getImplementation ( ) -> getLockData ( $ resource ) ; $ this -> setData ( 'topclass-label' , $ this -> hasRequestParameter ( 'topclass-label' ) ? $ this ->... | actions that get prevented by a lock are forwareded to this action parameter view is currently ignored |
54,680 | public function format ( $ format ) { $ format = str_replace ( '%U' , sprintf ( "%06d" , $ this -> u ) , $ format ) ; $ format = str_replace ( '%u' , sprintf ( "%d" , intval ( $ this -> u ) ) , $ format ) ; return parent :: format ( $ format ) ; } | Formatting for current date interval |
54,681 | private static function getLegacySpec ( array $ parts ) { $ spec = "P" ; $ spec .= $ parts [ 'y' ] !== "" ? "{$parts['y']}Y" : "" ; $ spec .= $ parts [ 'm' ] !== "" ? "{$parts['m']}M" : "" ; $ spec .= $ parts [ 'd' ] !== "" ? "{$parts['d']}D" : "" ; if ( $ parts [ 'h' ] . $ parts [ 'i' ] . $ parts [ 's' ] !== "" ) { $ ... | Build valid DateInterval format |
54,682 | public static function getServiceByName ( $ serviceName ) { $ returnValue = null ; $ className = ( ! class_exists ( $ serviceName ) || ! preg_match ( "/^(tao|wf)/" , $ serviceName ) ) ? sprintf ( self :: namePattern , ucfirst ( strtolower ( $ serviceName ) ) ) : $ serviceName ; if ( ! class_exists ( $ className ) ) { t... | returns an instance of the service defined by servicename . Always returns same instance for a class |
54,683 | public static function singleton ( ) { $ returnValue = null ; $ serviceName = get_called_class ( ) ; if ( ! isset ( self :: $ instances [ $ serviceName ] ) ) { self :: $ instances [ $ serviceName ] = new $ serviceName ( ) ; } $ returnValue = self :: $ instances [ $ serviceName ] ; return $ returnValue ; } | returns an instance of the service the function was called from . Always the same instance for a class |
54,684 | public function initElements ( ) { $ tokenElement = tao_helpers_form_FormFactory :: getElement ( 'token' , 'Hidden' ) ; $ this -> form -> addElement ( $ tokenElement ) ; $ pass1Element = tao_helpers_form_FormFactory :: getElement ( 'newpassword' , 'Hiddenbox' ) ; $ pass1Element -> setDescription ( __ ( 'New password' )... | Initialiaze password reset form elements |
54,685 | protected function getTransport ( ) { if ( is_null ( $ this -> transport ) ) { $ tao = \ common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'tao' ) ; $ transport = $ tao -> getConfig ( self :: CONFIG_KEY ) ; if ( ! is_object ( $ transport ) || ! $ transport instanceof Transport ) { return false ; } $ t... | Get the current transport implementation |
54,686 | public function setTransport ( Transport $ transporter ) { $ this -> transport = $ transporter ; $ tao = \ common_ext_ExtensionsManager :: singleton ( ) -> getExtensionById ( 'tao' ) ; $ tao -> setConfig ( self :: CONFIG_KEY , $ this -> transport ) ; } | Set the transport implementation to use |
54,687 | protected function isXmlHttpRequest ( ) { $ serverParams = $ this -> getPsrRequest ( ) -> getServerParams ( ) ; if ( isset ( $ serverParams [ 'HTTP_X_REQUESTED_WITH' ] ) ) { if ( strtolower ( $ serverParams [ 'HTTP_X_REQUESTED_WITH' ] ) == 'xmlhttprequest' ) { return true ; } } return false ; } | Check if the current request is using AJAX |
54,688 | public function initFormProperties ( array $ properties ) { foreach ( $ properties as $ property ) { $ property -> feed ( ) ; $ widget = $ this -> getWidgetProperty ( $ property ) ; if ( is_null ( $ widget ) || $ widget instanceof core_kernel_classes_Literal ) { continue ; } $ propertyData = [ 'uri' => $ property -> ge... | Initialize form properties . - Only if resource property has a widget property - Fetch property validator - If necessary fetch property ranges - In case of edition retrieve property values - Sort properties with GUI order property |
54,689 | public function validate ( ) { $ report = common_report_Report :: createInfo ( ) ; foreach ( $ this -> formProperties as $ property ) { try { $ value = $ property [ 'formValue' ] ; if ( isset ( $ property [ 'validators' ] ) ) { foreach ( $ property [ 'validators' ] as $ validatorName ) { $ validatorClass = 'tao_helpers... | Validate the form against the property validators . In case of range check if value belong to associated ranges list Return failure report if one or more field is invalid |
54,690 | protected function getPropertyValidators ( core_kernel_classes_Property $ property ) { $ validators = [ ] ; foreach ( ValidationRuleRegistry :: getRegistry ( ) -> getValidators ( $ property ) as $ validator ) { $ validators [ ] = $ validator -> getName ( ) ; } return $ validators ; } | Get property validators |
54,691 | protected function prepareValuesToSave ( ) { $ values = [ ] ; foreach ( $ this -> formProperties as $ property ) { $ values [ $ property [ 'uri' ] ] = $ property [ 'formValue' ] ; } return $ values ; } | Format the form properties to save them |
54,692 | public function render ( ) { $ returnValue = $ this -> renderLabel ( ) ; $ uniqueId = uniqid ( 'calendar_' ) ; $ elementId = tao_helpers_Display :: TextCleaner ( $ this -> getDescription ( ) ) . '_' . $ uniqueId ; if ( ! isset ( $ this -> attributes [ 'size' ] ) ) { $ this -> attributes [ 'size' ] = 20 ; } $ returnValu... | Rendering of the XHTML implementation of the Calendar Widget . |
54,693 | public function isApplicable ( array $ params ) { foreach ( $ this -> getArguments ( ) as $ argument ) { if ( $ argument -> isApplicable ( $ params ) ) { $ this -> argument = $ argument ; return true ; } } return false ; } | Check if provided params fit into one of option arguments Only first applicable is taken under consideration |
54,694 | public function getUrlsafeIdentifier ( $ document ) { $ id = $ this -> getNormalizedIdentifier ( $ document ) ; if ( null !== $ id ) { return substr ( $ id , 1 ) ; } } | Currently only the leading slash is removed . |
54,695 | public function resolve ( $ callable ) { if ( is_string ( $ callable ) && strpos ( $ callable , '::' ) !== false ) { $ callable = explode ( '::' , $ callable , 2 ) ; } $ callable = $ this -> resolveFromContainer ( $ callable ) ; if ( ! is_callable ( $ callable ) ) { throw NotCallableException :: fromInvalidCallable ( $... | Resolve the given callable into a real PHP callable . |
54,696 | public static function factory ( $ name , array $ constructorArgs = array ( ) ) { $ reflectionClass = new \ ReflectionClass ( sprintf ( 'AppserverIo\Appserver\Core\Commands\%sCommand' , ucfirst ( $ name ) ) ) ; return $ reflectionClass -> newInstanceArgs ( $ constructorArgs ) ; } | Creates and returns a new command instance of the command with the passed name . |
54,697 | public function setSystemProperty ( $ name , $ type , $ value ) { $ sytemPropertyToSet = new SystemPropertyNode ( $ name , $ type , new NodeValue ( $ value ) ) ; foreach ( $ this -> systemProperties as $ key => $ systemProperty ) { if ( $ systemProperty -> getName ( ) === $ systemProperty -> getName ( ) ) { $ this -> s... | Sets the system property with the passed name type and value . |
54,698 | public function getSystemProperty ( $ name ) { $ systemProperties = $ this -> getSystemPropertiesAsArray ( ) ; if ( array_key_exists ( $ name , $ systemProperties ) ) { return $ systemProperties [ $ name ] ; } } | Returns the system property with the passed name casted to the specified type . |
54,699 | public function getSystemPropertiesAsArray ( ) { $ systemProperties = array ( ) ; if ( is_array ( $ this -> getSystemProperties ( ) ) ) { foreach ( $ this -> getSystemProperties ( ) as $ systemProperty ) { $ systemProperties [ $ systemProperty -> getName ( ) ] = $ systemProperty -> castToType ( ) ; } } return $ systemP... | Returns the system properties casted to the defined type as associative array . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.