idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
49,600
public function destroy ( $ sessionId ) { try { $ this -> _tableRestProxy -> deleteEntity ( $ this -> _sessionContainer , $ this -> _sessionContainerParition , $ sessionId ) ; return TRUE ; } catch ( ServiceException $ e ) { return FALSE ; } }
Callback function for session handler . It s invoked while the session is being destroyed .
49,601
public function gc ( $ lifeTime ) { $ filter = 'PartitionKey eq\'' . $ this -> _sessionContainerPartition . '\' and expires lt ' . ( time ( ) - $ lifeTime ) ; try { $ result = $ this -> _tableRestProxy -> queryEntities ( $ this -> _sessionContainer , $ filter ) ; $ entities = $ result -> getEntities ( ) ; foreach ( $ e...
Callback function for session handler . It s invoked while the session garbage collection starts .
49,602
public static function mount ( $ path , $ controller_klass ) { $ mounted = null ; $ methods = get_class_methods ( $ controller_klass ) ; if ( ! $ methods ) { debug ( "'{$controller_klass}' has no methods." ) ; return ; } foreach ( $ methods as $ method_name ) { if ( $ method_name == '__construct' ) { continue ; } if ( ...
Bind controller methods into a path
49,603
public static function template ( $ name ) { $ template = null ; if ( preg_match ( '/^[A-Za-z0-9_\.\-\/]+\.html$/' , $ name ) ) { $ template = static :: get ( self :: TYPE_TEMPLATE , $ name ) ; if ( ! $ template ) { $ fallback_template_path = shared_storage_dir ( ) . '/default/templates/' . $ name ; if ( ! file_exists ...
Get a template module instance trying to fallback to a general template
49,604
public static function get ( $ type , $ name ) { return ModuleCompiler :: get ( $ type , $ name ) ? : static :: where ( 'type' , $ type ) -> where ( 'name' , $ name ) -> first ( ) ; }
Get a module instance
49,605
public function compile ( $ options = array ( ) ) { $ app = Slim \ Slim :: getInstance ( ) ; $ extension = '.' . pathinfo ( $ this -> name , PATHINFO_EXTENSION ) ; $ name = basename ( $ this -> name , $ extension ) ; if ( $ this -> type == static :: TYPE_OBSERVER || $ this -> type == static :: TYPE_CHANNEL || $ this ->...
compile Compile module code
49,606
public static function current ( ) { if ( static :: $ _current === null ) { if ( $ token = AuthToken :: current ( ) ) { $ token -> auth ( ) ; static :: $ _current = $ token -> auth ; } } return static :: $ _current ; }
current - get current active Auth instance
49,607
public function create_new ( array $ attributes = array ( ) ) { $ instance = null ; if ( ! $ this -> is_collection ) { $ instance = new self :: $ custom_collections [ $ this -> name ] ( ) ; } else { $ instance = new Collection ( array ( 'table_name' => $ this -> name ) ) ; } $ instance -> fill ( $ attributes ) ; if ( i...
Create a new Collection instance . No database operations here .
49,608
public function create ( array $ attributes ) { if ( array_values ( $ attributes ) == $ attributes ) { $ that = $ this ; $ collection = new IlluminateCollection ( $ attributes ) ; return $ collection -> map ( function ( $ attrs ) use ( $ that ) { return $ that -> create ( $ attrs ) ; } ) ; } $ model = $ this -> create_...
Create a new record into the database .
49,609
public function from ( $ addresses , $ name = null ) { $ this -> message -> setFrom ( $ addresses , $ name ) ; return $ this ; }
Set the From address of this message .
49,610
protected function dropIndex ( & $ table_name , & $ table_prefix , & $ blueprint , $ previous_attribute_definition = null , $ index = null , $ is_unique = false ) { if ( ! $ previous_attribute_definition ) { return ; } if ( ! $ is_unique && ( ( isset ( $ previous_attribute_definition [ 'index' ] ) && $ previous_attribu...
Drop index from field if necessary .
49,611
public function setResponseArray ( array $ args = [ ] ) { foreach ( $ args as $ name => $ text ) { return $ this -> response [ $ name ] = $ text ; } return $ this ; }
Use to set multiples messages and after get on custom error function
49,612
static private function formatStringValue ( $ baseType , $ stringValue ) { switch ( strtolower ( $ baseType ) ) { case 'string' : case 'duration' : return $ stringValue ; case 'identifier' : return self :: trimIdentifier ( $ stringValue ) ; case 'integer' : return intval ( $ stringValue ) ; case 'float' : return floatv...
Format a string into the appropriate format according to the base type
49,613
static public function formatVariableToPci ( ResponseVariable $ var ) { $ value = $ var -> getValue ( ) ; switch ( $ var -> getCardinality ( ) ) { case 'single' : if ( strlen ( $ value ) === 0 ) { $ formatted = [ 'base' => null ] ; } else { try { $ formatted = [ 'base' => [ $ var -> getBaseType ( ) => self :: formatStr...
Format a ResponseVariable into a associative array directly usable on the client side .
49,614
public function getDefaultItemType ( ) { if ( $ this -> hasOption ( self :: OPTION_DEFAULT_ITEM_TYPE ) ) { return $ this -> getOption ( self :: OPTION_DEFAULT_ITEM_TYPE ) ; } return false ; }
Gets the default item type the viewer should manage
49,615
private function exportIntoFolder ( \ core_kernel_classes_Class $ deliveryClass , $ destination ) { foreach ( $ deliveryClass -> getInstances ( false ) as $ delivery ) { ( new SingleDeliveryResultsExporter ( $ delivery , $ this -> resultsService , ( new ColumnsProvider ( $ delivery , $ this -> resultsService ) ) ) ) ->...
Recursively exports all results under a class into a folder .
49,616
public function prepare ( $ resources , $ columns ) { $ resultsService = ResultsService :: singleton ( ) ; $ undefinedStr = __ ( 'unknown' ) ; foreach ( $ resources as $ result ) { $ itemresults = $ resultsService -> getVariables ( $ result , false ) ; foreach ( $ itemresults as $ itemResultUri => $ vars ) { if ( commo...
Short description of method prepare
49,617
static public function decodeFile ( $ binary ) { $ returnValue = array ( 'name' => '' , 'mime' => '' , 'data' => '' ) ; if ( empty ( $ binary ) === false ) { $ filenameLen = current ( unpack ( 'S' , substr ( $ binary , 0 , 2 ) ) ) ; if ( $ filenameLen > 0 ) { $ returnValue [ 'name' ] = substr ( $ binary , 2 , $ filenam...
Decode a binary string representing a file into an array .
49,618
public function getDeliveryColumns ( ) { $ columns = [ ] ; $ customProps = $ this -> getClass ( $ this -> delivery -> getOnePropertyValue ( $ this -> getProperty ( OntologyRdf :: RDF_TYPE ) ) ) -> getProperties ( ) ; $ deliveryProps = array_merge ( $ this -> deliveryProperties , $ customProps ) ; foreach ( $ deliveryPr...
Get delivery columns to be exported .
49,619
private function decodeColumns ( $ columnsJson ) { return ( $ columnsData = json_decode ( $ columnsJson , true ) ) !== null && json_last_error ( ) === JSON_ERROR_NONE ? $ columnsData : [ ] ; }
Decode the JSON encoded columns .
49,620
public function delete ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new common_exception_BadRequest ( 'wrong request mode' ) ; } $ deliveryExecutionUri = tao_helpers_Uri :: decode ( $ this -> getRequestParameter ( 'uri' ) ) ; $ de = $ this -> getServiceProxy ( ) -> getDeliveryExecution ( $ deliveryExecutionUri...
Delete a result or a result class
49,621
private function isCacheable ( $ resultIdentifier ) { return $ this -> getServiceProxy ( ) -> getDeliveryExecution ( $ resultIdentifier ) -> getState ( ) -> getUri ( ) == DeliveryExecutionInterface :: STATE_FINISHIED ; }
Is the given delivery execution aka . result cacheable?
49,622
public function downloadXML ( ) { try { if ( ! $ this -> hasRequestParameter ( 'id' ) || empty ( $ this -> getRequestParameter ( 'id' ) ) ) { throw new \ common_exception_MissingParameter ( 'Result id is missing from the request.' , $ this -> getRequestURI ( ) ) ; } if ( ! $ this -> hasRequestParameter ( 'delivery' ) |...
Download delivery execution XML
49,623
public function getFile ( ) { $ variableUri = $ _POST [ "variableUri" ] ; $ delivery = $ this -> getResource ( tao_helpers_Uri :: decode ( $ this -> getRequestParameter ( 'deliveryUri' ) ) ) ; try { $ this -> getResultStorage ( $ delivery ) ; $ file = $ this -> getResultsService ( ) -> getVariableFile ( $ variableUri )...
Get the data for the file in the response and allow user to download it
49,624
protected function getResultStorage ( $ delivery ) { $ resultServerService = $ this -> getServiceManager ( ) -> get ( ResultServerService :: SERVICE_ID ) ; $ resultStorage = $ resultServerService -> getResultStorage ( $ delivery -> getUri ( ) ) ; if ( $ resultStorage instanceof NoResultStorage ) { throw NoResultStorage...
Returns the currently configured result storage
49,625
protected function getResultVariables ( $ resultId , $ filterSubmission , $ filterTypes = array ( ) ) { $ resultService = $ this -> getResultsService ( ) ; $ variables = $ resultService -> getStructuredVariables ( $ resultId , $ filterSubmission , array_merge ( $ filterTypes , [ \ taoResultServer_models_classes_Respons...
Extracts the result variables with respect to the user s filter and inject item states to allow preview with results
49,626
public function getResultsListPlugin ( ) { $ pluginService = $ this -> getServiceLocator ( ) -> get ( ResultsPluginService :: SERVICE_ID ) ; $ event = new ResultsListPluginEvent ( $ pluginService -> getAllPlugins ( ) ) ; $ this -> getServiceLocator ( ) -> get ( EventManager :: SERVICE_ID ) -> trigger ( $ event ) ; retu...
Get the list of active plugins for the list of results
49,627
public function export ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new \ Exception ( 'Only ajax call allowed.' ) ; } if ( ! $ this -> hasRequestParameter ( self :: PARAMETER_DELIVERY_CLASS_URI ) && ! $ this -> hasRequestParameter ( self :: PARAMETER_DELIVERY_URI ) ) { throw new \ common_Exception ( 'Parameter...
Exports results by either a class or a single delivery .
49,628
public function getDeliveryItemType ( $ resultIdentifier ) { $ resultsViewerService = $ this -> getServiceLocator ( ) -> get ( ResultsViewerService :: SERVICE_ID ) ; return $ resultsViewerService -> getDeliveryItemType ( $ resultIdentifier ) ; }
Ges the type of items contained by the delivery
49,629
public function filterStructuredVariables ( array $ structure , array $ filter ) { $ all = [ \ taoResultServer_models_classes_ResponseVariable :: class , \ taoResultServer_models_classes_OutcomeVariable :: class , \ taoResultServer_models_classes_TraceVariable :: class ] ; $ toRemove = array_diff ( $ all , $ filter ) ;...
Filters the complex array structure for variable classes
49,630
public function getVariableDataFromDeliveryResult ( $ resultIdentifier , $ wantedTypes = array ( \ taoResultServer_models_classes_ResponseVariable :: class , \ taoResultServer_models_classes_OutcomeVariable :: class , \ taoResultServer_models_classes_TraceVariable :: class ) ) { $ variablesData = array ( ) ; foreach ( ...
return all variables linked to the delviery result and that are not linked to a particular itemResult
49,631
public function getVariableFile ( $ variableUri ) { $ baseType = $ this -> getVariableBaseType ( $ variableUri ) ; if ( core_kernel_classes_DbWrapper :: singleton ( ) -> getPlatForm ( ) -> getName ( ) == 'mysql' ) { if ( defined ( "PDO::MYSQL_ATTR_MAX_BUFFER_SIZE" ) ) { $ maxBuffer = ( is_int ( ini_get ( 'upload_max_fi...
Return the file data associate to a variable
49,632
public function getColumnNames ( array $ columns ) { return array_reduce ( $ columns , function ( $ carry , \ tao_models_classes_table_Column $ column ) { $ carry [ $ this -> getColumnId ( $ column ) ] = $ column -> getLabel ( ) ; return $ carry ; } ) ; }
Get the array of column names indexed by their unique column id .
49,633
private function meetFilters ( $ row , array $ filters ) { $ matched = true ; if ( count ( $ filters ) && count ( array_diff ( self :: PERIODS , array_keys ( $ filters ) ) ) ) { $ startDate = current ( $ row [ 'delivery_execution_started_at' ] ) ; $ startTime = $ startDate ? \ tao_helpers_Date :: getTimeStamp ( $ start...
Check that data is apply to these filter params
49,634
private function isResultVariable ( $ variable , $ variableClassUri ) { $ responseVariableClass = \ taoResultServer_models_classes_ResponseVariable :: class ; $ outcomeVariableClass = \ taoResultServer_models_classes_OutcomeVariable :: class ; $ class = isset ( $ variable -> class ) ? $ variable -> class : get_class ( ...
Check if provided variable is a result variable .
49,635
public static function filterCellData ( $ observationsList , $ filterData , $ allDelimiter = '|' ) { if ( ! is_array ( $ observationsList ) ) { return $ observationsList ; } uksort ( $ observationsList , "oat\\taoOutcomeUi\\model\\ResultsService::sortTimeStamps" ) ; $ observationsList = array_map ( function ( $ obs ) {...
Sort the list of variables by filters
49,636
protected function initColumns ( ) { $ returnValue = ( bool ) false ; $ excludedProperties = ( is_array ( $ this -> options ) && isset ( $ this -> options [ 'excludedProperties' ] ) ) ? $ this -> options [ 'excludedProperties' ] : array ( ) ; $ columnNames = ( is_array ( $ this -> options ) && isset ( $ this -> options...
Short description of method initColumns
49,637
protected function ensureValidResult ( ) { $ deliveryExecution = ServiceProxy :: singleton ( ) -> getDeliveryExecution ( $ this -> instanceCache [ $ this -> currentInstance ] ) ; try { $ deliveryExecution -> getDelivery ( ) ; } catch ( \ common_exception_NotFound $ e ) { $ message = 'Skip result ' . $ deliveryExecution...
Ensure the current item is valid result
49,638
public function index ( ) { $ deliveryService = DeliveryAssemblyService :: singleton ( ) ; if ( $ this -> getRequestParameter ( 'classUri' ) !== $ deliveryService -> getRootClass ( ) -> getUri ( ) ) { $ filter = $ this -> getRequestParameter ( 'filter' ) ; $ uri = $ this -> getRequestParameter ( 'uri' ) ; if ( ! \ comm...
Return the Result Table entry page displaying the datatable and the filters to be applied .
49,639
public function feedDataTable ( ) { if ( ! $ this -> isXmlHttpRequest ( ) ) { throw new \ Exception ( 'Only ajax call allowed.' ) ; } if ( ! $ this -> hasRequestParameter ( self :: PARAMETER_COLUMNS ) ) { throw new common_Exception ( 'Parameter "' . self :: PARAMETER_COLUMNS . '" missing' ) ; } $ this -> returnJson ( (...
Feeds js datatable component with the values to be exported .
49,640
public function getCategories ( ) { if ( null === $ this -> _categories ) { $ collection = Mage :: getModel ( 'catalog/category' ) -> getCollection ( ) ; $ pathLike = Mage_Catalog_Model_Category :: TREE_ROOT_ID . '/' . Mage :: app ( ) -> getStore ( ) -> getRootCategoryId ( ) . '/%' ; $ collection -> initCache ( Mage ::...
Give all categories of the current store
49,641
public function getCategoriesTree ( ) { $ allCategories = $ this -> getCategories ( ) ; $ topCategories = [ ] ; $ currentCategory = null ; foreach ( $ allCategories as $ idCat => $ category ) { $ topLevel = 2 ; if ( $ category -> getLevel ( ) == $ topLevel && ! isset ( $ topCategories [ $ idCat ] ) ) { $ topCategories ...
Retrieve the categories tree
49,642
public function delete ( ) { $ this -> getContext ( ) -> invokeApiPost ( 'DATABASES' , [ 'action' => 'accesshosts' , 'delete' => 'yes' , 'db' => $ this -> database -> getDatabaseName ( ) , 'select0' => $ this -> getName ( ) , ] ) ; $ this -> database -> clearCache ( ) ; }
Deletes the access host .
49,643
public static function create ( Domain $ domain , $ prefix ) { $ domain -> invokePost ( 'SUBDOMAIN' , 'create' , [ 'subdomain' => $ prefix ] ) ; return new self ( $ prefix , $ domain ) ; }
Creates a new subdomain .
49,644
public function createAdmin ( $ username , $ password , $ email ) { return $ this -> createAccount ( $ username , $ password , $ email , [ ] , 'ACCOUNT_ADMIN' , Admin :: class ) ; }
Creates a new Admin level account .
49,645
public function createReseller ( $ username , $ password , $ email , $ domain , $ package = [ ] , $ ip = 'shared' ) { $ options = array_merge ( [ 'ip' => $ ip , 'domain' => $ domain , 'serverip' => 'ON' , 'dns' => 'OFF' ] , is_array ( $ package ) ? $ package : [ 'package' => $ package ] ) ; return $ this -> createAccou...
Creates a new Reseller level account .
49,646
public function getAllAccounts ( ) { $ accounts = array_merge ( $ this -> getAllUsers ( ) , $ this -> getResellers ( ) , $ this -> getAdmins ( ) ) ; ksort ( $ accounts ) ; return $ accounts ; }
Returns a full list of all accounts of any type on the server .
49,647
public function getReseller ( $ username ) { $ resellers = $ this -> getResellers ( ) ; return isset ( $ resellers [ $ username ] ) ? $ resellers [ $ username ] : null ; }
Returns a specific reseller by name or NULL if there is no reseller by this name .
49,648
public function impersonateAdmin ( $ username , $ validate = false ) { return new self ( $ this -> getConnection ( ) -> loginAs ( $ username ) , $ validate ) ; }
Returns a new AdminContext acting as the specified admin .
49,649
public function impersonateReseller ( $ username , $ validate = false ) { return new ResellerContext ( $ this -> getConnection ( ) -> loginAs ( $ username ) , $ validate ) ; }
Returns a new ResellerContext acting as the specified reseller .
49,650
public static function connectAdmin ( $ url , $ username , $ password , $ validate = false ) { return new AdminContext ( new self ( $ url , $ username , $ password ) , $ validate ) ; }
Connects to DirectAdmin with an admin account .
49,651
public static function connectReseller ( $ url , $ username , $ password , $ validate = false ) { return new ResellerContext ( new self ( $ url , $ username , $ password ) , $ validate ) ; }
Connects to DirectAdmin with a reseller account .
49,652
public static function connectUser ( $ url , $ username , $ password , $ validate = false ) { return new UserContext ( new self ( $ url , $ username , $ password ) , $ validate ) ; }
Connects to DirectAdmin with a user account .
49,653
public function invokeApi ( $ method , $ command , $ options = [ ] ) { $ result = $ this -> rawRequest ( $ method , '/CMD_API_' . $ command , $ options ) ; if ( ! empty ( $ result [ 'error' ] ) ) { throw new DirectAdminException ( "$method to $command failed: $result[details] ($result[text])" ) ; } return Conversion ::...
Invokes the DirectAdmin API with specific options .
49,654
public function rawRequest ( $ method , $ uri , $ options ) { try { $ response = $ this -> connection -> request ( $ method , $ uri , $ options ) ; if ( $ response -> getHeader ( 'Content-Type' ) [ 0 ] == 'text/html' ) { throw new DirectAdminException ( sprintf ( 'DirectAdmin API returned text/html to %s %s containing ...
Sends a raw request to DirectAdmin .
49,655
protected static function processUnlimitedOption ( array & $ options , $ key ) { $ ukey = "u{$key}" ; unset ( $ options [ $ ukey ] ) ; if ( array_key_exists ( $ key , $ options ) && ( $ options [ $ key ] === 'unlimited' || ! isset ( $ options [ $ key ] ) ) ) { $ options [ $ ukey ] = 'ON' ; } }
Expands a single option to its unlimited counterpart if NULL or literal unlimited .
49,656
public static function sanitizeArray ( $ result ) { if ( count ( $ result ) == 1 && isset ( $ result [ 'list[]' ] ) ) { $ result = $ result [ 'list[]' ] ; } return is_array ( $ result ) ? $ result : [ $ result ] ; }
Ensures a DA - style response element is wrapped properly as an array .
49,657
public function getContextUser ( ) { if ( ! isset ( $ this -> user ) ) { $ this -> user = User :: fromConfig ( $ this -> invokeApiGet ( 'SHOW_USER_CONFIG' ) , $ this ) ; } return $ this -> user ; }
Returns the actual user object behind the context .
49,658
public static function create ( User $ user , $ domainName , $ bandwidthLimit = null , $ diskLimit = null , $ ssl = null , $ php = null , $ cgi = null ) { $ options = [ 'action' => 'create' , 'domain' => $ domainName , ( isset ( $ bandwidthLimit ) ? 'bandwidth' : 'ubandwidth' ) => $ bandwidthLimit , ( isset ( $ diskLim...
Creates a new domain under the specified user .
49,659
public function createPointer ( $ domain , $ alias = false ) { $ parameters = [ 'domain' => $ this -> domainName , 'from' => $ domain , 'action' => 'add' , ] ; if ( $ alias ) { $ parameters [ 'alias' ] = 'yes' ; $ list = & $ this -> aliases ; } else { $ list = & $ this -> pointers ; } $ this -> getContext ( ) -> invoke...
Creates a pointer or alias .
49,660
public function delete ( ) { $ this -> getContext ( ) -> invokeApiPost ( 'DOMAIN' , [ 'delete' => true , 'confirmed' => true , 'select0' => $ this -> domainName , ] ) ; $ this -> owner -> clearCache ( ) ; }
Deletes this domain from the user .
49,661
public function getDomainNames ( ) { return $ this -> getCache ( 'domainNames' , function ( ) { $ list = array_merge ( $ this -> aliases , $ this -> pointers , [ $ this -> getDomainName ( ) ] ) ; sort ( $ list ) ; return $ list ; } ) ; }
Returns unified sorted list of main domain name aliases and pointers .
49,662
private function setConfig ( UserContext $ context , array $ config ) { $ this -> domainName = $ config [ 'domain' ] ; if ( $ config [ 'username' ] === $ context -> getUsername ( ) ) { $ this -> owner = $ context -> getContextUser ( ) ; } else { throw new DirectAdminException ( 'Could not determine relationship between...
Sets configuration options from raw DirectAdmin data .
49,663
protected function getCache ( $ key , $ default ) { if ( ! isset ( $ this -> cache [ $ key ] ) ) { $ this -> cache [ $ key ] = is_callable ( $ default ) ? $ default ( ) : $ default ; } return $ this -> cache [ $ key ] ; }
Retrieves an item from the internal cache .
49,664
protected function getCacheItem ( $ key , $ item , $ defaultKey , $ defaultItem = null ) { if ( empty ( $ cache = $ this -> getCache ( $ key , $ defaultKey ) ) ) { return $ defaultItem ; } if ( ! is_array ( $ cache ) ) { throw new DirectAdminException ( "Cache item $key is not an array" ) ; } return isset ( $ cache [ $...
Retrieves a keyed item from inside a cache item .
49,665
public static function toObjectArray ( array $ items , $ class , UserContext $ context ) { return array_combine ( $ items , array_map ( function ( $ item ) use ( $ class , $ context ) { return new $ class ( $ item , $ context ) ; } , $ items ) ) ; }
Converts an array of string items to an associative array of objects of the specified type .
49,666
public static function create ( Domain $ domain , $ prefix , $ recipients ) { $ domain -> invokePost ( 'EMAIL_FORWARDERS' , 'create' , [ 'user' => $ prefix , 'email' => is_array ( $ recipients ) ? implode ( ',' , $ recipients ) : $ recipients , ] ) ; return new self ( $ prefix , $ domain , $ recipients ) ; }
Creates a new forwarder .
49,667
public function createUser ( $ username , $ password , $ email , $ domain , $ ip , $ package = [ ] ) { $ options = array_merge ( [ 'ip' => $ ip , 'domain' => $ domain ] , is_array ( $ package ) ? $ package : [ 'package' => $ package ] ) ; return $ this -> createAccount ( $ username , $ password , $ email , $ options , ...
Creates a new user on the server .
49,668
protected function createAccount ( $ username , $ password , $ email , $ options , $ endpoint , $ returnType ) { $ this -> invokeApiPost ( $ endpoint , array_merge ( $ options , [ 'action' => 'create' , 'add' => 'Submit' , 'email' => $ email , 'passwd' => $ password , 'passwd2' => $ password , 'username' => $ username ...
Internal helper function for creating new accounts .
49,669
public function deleteAccounts ( array $ usernames ) { $ options = [ 'confirmed' => 'Confirm' , 'delete' => 'yes' ] ; foreach ( array_values ( $ usernames ) as $ idx => $ username ) { $ options [ "select{$idx}" ] = $ username ; } $ this -> invokeApiPost ( 'SELECT_USERS' , $ options ) ; }
Deletes multiple accounts .
49,670
public function getUser ( $ username ) { $ resellers = $ this -> getUsers ( ) ; return isset ( $ resellers [ $ username ] ) ? $ resellers [ $ username ] : null ; }
Returns a single user by name .
49,671
protected function getData ( $ key ) { return $ this -> getCacheItem ( self :: CACHE_DATA , $ key , function ( ) { $ result = $ this -> getContext ( ) -> invokeApiGet ( 'POP' , [ 'domain' => $ this -> getDomainName ( ) , 'action' => 'full_list' , ] ) ; return \ GuzzleHttp \ Psr7 \ parse_query ( $ result [ $ this -> get...
Cache wrapper to keep mailbox stats up to date .
49,672
public static function create ( User $ user , $ name , $ username , $ password ) { $ options = [ 'action' => 'create' , 'name' => $ name , ] ; if ( ! empty ( $ password ) ) { $ options += [ 'user' => $ username , 'passwd' => $ password , 'passwd2' => $ password ] ; } else { $ options += [ 'userlist' => $ username ] ; }...
Creates a new database under the specified user .
49,673
public function delete ( ) { $ this -> getContext ( ) -> invokeApiPost ( 'DATABASES' , [ 'action' => 'delete' , 'select0' => $ this -> getDatabaseName ( ) , ] ) ; $ this -> getContext ( ) -> getContextUser ( ) -> clearCache ( ) ; }
Deletes this database from the user .
49,674
public function createDatabase ( $ name , $ username , $ password = null ) { $ db = Database :: create ( $ this -> getSelfManagedUser ( ) , $ name , $ username , $ password ) ; $ this -> clearCache ( ) ; return $ db ; }
Creates a new database under this user .
49,675
public function createDomain ( $ domainName , $ bandwidthLimit = null , $ diskLimit = null , $ ssl = null , $ php = null , $ cgi = null ) { $ domain = Domain :: create ( $ this -> getSelfManagedUser ( ) , $ domainName , $ bandwidthLimit , $ diskLimit , $ ssl , $ php , $ cgi ) ; $ this -> clearCache ( ) ; return $ domai...
Creates a new domain under this user .
49,676
public function modifyConfig ( array $ newConfig ) { $ this -> getContext ( ) -> invokeApiPost ( 'MODIFY_USER' , array_merge ( $ this -> loadConfig ( ) , Conversion :: processUnlimitedOptions ( $ newConfig ) , [ 'action' => 'customize' , 'user' => $ this -> getUsername ( ) ] ) ) ; $ this -> clearCache ( ) ; }
Modifies the configuration of the user . For available keys in the array check the documentation on CMD_API_MODIFY_USER in the linked document .
49,677
public static function fromConfig ( $ config , UserContext $ context ) { $ name = $ config [ 'username' ] ; switch ( $ config [ 'usertype' ] ) { case DirectAdmin :: ACCOUNT_TYPE_USER : return new self ( $ name , $ context , $ config ) ; case DirectAdmin :: ACCOUNT_TYPE_RESELLER : return new Reseller ( $ name , $ contex...
Constructs the correct object from the given user config .
49,678
private function getUsage ( $ item ) { return $ this -> getCacheItem ( self :: CACHE_USAGE , $ item , function ( ) { return $ this -> getContext ( ) -> invokeApiGet ( 'SHOW_USER_USAGE' , [ 'user' => $ this -> getUsername ( ) ] ) ; } ) ; }
Internal function to safe guard usage changes and cache them .
49,679
public static function generateTitle ( ) { $ first = self :: getRandomNoun ( ) ; $ second = self :: getRandomNoun ( $ first ) ; switch ( rand ( 0 , 6 ) ) { case 0 : return 'The ' . $ first . ' of ' . self :: getRandomAdj ( ) . ' ' . $ second ; case 1 : return ucfirst ( $ first ) . ' and ' . ucfirst ( $ second ) ; case ...
Generates a random title for a resource
49,680
protected function generateTool ( ) { $ this -> data = $ this -> getMappedArguments ( ) ; $ generatorPath = str_replace ( DIRECTORY_SEPARATOR , '/' , dirname ( __DIR__ ) ) . '/studentToolGenerator' ; $ targetPath = $ generatorPath . '/generated-code/' . $ this -> data [ 'client' ] . '/' . $ this -> data [ 'tool-id' ] ;...
Take template and create the tool
49,681
protected function getPatterns ( ) { $ patterns = array ( ) ; foreach ( $ this -> data as $ pattern => $ replacement ) { $ patterns [ ] = '{' . $ pattern . '}' ; } return $ patterns ; }
First arg for str_replace
49,682
public function pack ( ) { try { $ testPacker = $ this -> getTestPacker ( ) ; $ testPack = $ testPacker -> packTest ( $ this -> test ) ; } catch ( Exception $ e ) { throw new common_Exception ( 'The test ' . $ this -> test -> getUri ( ) . ' cannot be packed : ' . $ e -> getMessage ( ) ) ; } return $ testPack ; }
Pack a test .
49,683
protected function addSampleTheme ( ) { $ values = array ( '{themeLabel}' => $ this -> label . ' default theme' , '{themeId}' => StringUtils :: camelize ( $ this -> label . ' default theme' ) , '{platformTheme}' => StringUtils :: camelize ( $ this -> label . ' default theme' , true ) ) ; $ pathValues = array ( ) ; fore...
Adds sample code for theme support
49,684
protected function addAutoloader ( ) { $ autoloaderFile = VENDOR_PATH . 'composer/autoload_psr4.php' ; $ content = file_get_contents ( $ autoloaderFile ) ; $ lineToAdd = PHP_EOL . ' \'' . $ this -> authorNamespace . '\\\\' . $ this -> id . '\\\\\' => array($baseDir . \'/' . $ this -> id . '\'),' ; $ content = str_re...
Add the autoloader manually to the composer will break on next update
49,685
public function createItems ( ) { $ count = $ this -> hasRequestParameter ( 'count' ) ? $ this -> getRequestParameter ( 'count' ) : 100 ; DataGenerator :: generateItems ( $ count ) ; echo 'created ' . $ count . ' items' ; }
Work in progress
49,686
public function fromArray ( $ data ) { if ( $ data ) { if ( isset ( $ data [ 'tags' ] ) ) { $ this -> setTags ( $ data [ 'tags' ] ) ; } if ( isset ( $ data [ 'ts' ] ) ) { $ this -> setTimestamp ( $ data [ 'ts' ] ) ; } if ( isset ( $ data [ 'type' ] ) ) { $ this -> setType ( $ data [ 'type' ] ) ; } if ( isset ( $ data [...
Imports the internal state from an array
49,687
public function addTag ( $ tag ) { $ this -> tags [ ] = ( string ) $ tag ; $ this -> ref = null ; return $ this ; }
Adds another tag to the TimePoint
49,688
public function removeTag ( $ tag ) { $ index = array_search ( $ tag , $ this -> tags ) ; if ( $ index !== false ) { array_splice ( $ this -> tags , $ index , 1 ) ; $ this -> ref = null ; } return $ this ; }
Removes a tag from the TimePoint
49,689
public function getTag ( $ index = 0 ) { $ index = min ( max ( 0 , $ index ) , count ( $ this -> tags ) ) ; return $ this -> tags [ $ index ] ; }
Gets a tag from the TimePoint . By default it will return the first tag .
49,690
public function setTags ( $ tags ) { $ this -> tags = [ ] ; $ this -> ref = null ; if ( is_array ( $ tags ) ) { foreach ( $ tags as $ tag ) { $ this -> addTag ( $ tag ) ; } } else { $ this -> addTag ( $ tags ) ; } return $ this ; }
Sets the tags of the TimePoint
49,691
public function getRef ( ) { if ( is_null ( $ this -> ref ) ) { $ tags = $ this -> tags ; sort ( $ tags ) ; $ this -> ref = md5 ( implode ( '-' , $ tags ) ) ; } return $ this -> ref ; }
Gets a unique reference to name the TimePoint
49,692
public function match ( array $ tags = null , $ target = self :: TARGET_ALL , $ type = self :: TYPE_ALL ) { $ match = ( $ this -> getType ( ) & $ type ) && ( $ this -> getTarget ( ) & $ target ) ; if ( $ match && isset ( $ tags ) ) { $ match = ( count ( array_intersect ( $ tags , $ this -> getTags ( ) ) ) == count ( $ ...
Checks if a TimePoint matches the criteria
49,693
public static function sort ( array & $ range ) { usort ( $ range , function ( TimePoint $ a , TimePoint $ b ) { return $ a -> compare ( $ b ) ; } ) ; return $ range ; }
Sorts a range of TimePoint
49,694
public function roles ( ) { $ currentSession = $ this -> getSession ( ) ; if ( $ currentSession instanceof \ common_session_RestrictedSession ) { $ this -> setData ( 'roles' , $ currentSession -> getUserRoles ( ) ) ; $ this -> setView ( 'userdebug/restore.tpl' ) ; } else { $ myFormContainer = new UserDebugRoles ( ) ; $...
Action dedicated to fake roles
49,695
public function processFontArchive ( ) { $ this -> init ( ) ; $ uploadResult = $ this -> uploadArchive ( ) ; if ( ! empty ( $ uploadResult [ 'error' ] ) ) { $ this -> returnJson ( $ uploadResult ) ; return false ; } $ extractResult = $ this -> extractArchive ( $ uploadResult ) ; if ( ! empty ( $ extractResult [ 'error'...
Process the font archive
49,696
protected function uploadArchive ( ) { if ( $ _FILES [ 'content' ] [ 'error' ] !== UPLOAD_ERR_OK ) { \ common_Logger :: w ( 'File upload failed with error ' . $ _FILES [ 'content' ] [ 'error' ] ) ; switch ( $ _FILES [ 'content' ] [ 'error' ] ) { case UPLOAD_ERR_INI_SIZE : case UPLOAD_ERR_FORM_SIZE : $ error = __ ( 'Arc...
Upload the zip archive to a tmp directory
49,697
protected function extractArchive ( $ archiveFile ) { $ archiveDir = dirname ( $ archiveFile ) ; $ archiveObj = new ZipArchive ( ) ; $ archiveHandle = $ archiveObj -> open ( $ archiveFile ) ; if ( true !== $ archiveHandle ) { return array ( 'error' => __ ( 'Could not open archive' ) ) ; } if ( ! $ archiveObj -> extract...
Unzip archive from icomoon
49,698
protected function checkIntegrity ( $ currentSelection , $ oldSelection ) { $ metadataExists = property_exists ( $ currentSelection , 'metadata' ) && property_exists ( $ currentSelection -> metadata , 'name' ) ; $ prefExists = property_exists ( $ currentSelection , 'preferences' ) && property_exists ( $ currentSelectio...
Checks whether the new font contains at least all glyphs from the previous version
49,699
protected function dataToGlyphSet ( $ data ) { $ glyphs = array ( ) ; foreach ( $ data -> icons as $ iconProperties ) { $ glyphs [ ] = $ iconProperties -> properties -> name ; } return $ glyphs ; }
Generate a listing of all glyph names in a font