idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
238,200 | public static function unsubscribe ( string $ hook , int $ hook_reference ) { $ parts = explode ( "." , $ hook ) ; if ( count ( $ parts ) < 2 ) throw new InvalidArgumentException ( "Hook name must consist of at least two parts" ) ; if ( ! isset ( self :: $ hooks [ $ hook ] ) ) throw new InvalidArgumentException ( "Hook... | Unsubscribe from a hook . |
238,201 | public static function execute ( string $ hook , $ params ) { if ( ! ( $ params instanceof Dictionary ) ) $ params = TypedDictionary :: wrap ( $ params ) ; if ( isset ( self :: $ in_progress [ $ hook ] ) ) throw new RecursionException ( "Recursion in hooks is not supported" ) ; self :: $ in_progress [ $ hook ] = true ;... | Call the specified hook with the provided parameters . |
238,202 | public static function getSubscribers ( string $ hook ) { if ( ! isset ( self :: $ hooks [ $ hook ] ) ) return array ( ) ; $ subs = [ ] ; foreach ( self :: $ hooks [ $ hook ] as $ h ) $ subs [ ] = $ h [ 'callback' ] ; return $ subs ; } | Return the subscribers for the hook . |
238,203 | public static function getExecuteCount ( string $ hook ) { return isset ( self :: $ counters [ $ hook ] ) ? self :: $ counters [ $ hook ] : 0 ; } | Return the amount of times the hook has been executed |
238,204 | public static function resetHook ( string $ hook ) { if ( isset ( self :: $ hooks [ $ hook ] ) ) unset ( self :: $ hooks [ $ hook ] ) ; if ( isset ( self :: $ counters [ $ hook ] ) ) unset ( self :: $ counters [ $ hook ] ) ; if ( isset ( self :: $ paused [ $ hook ] ) ) unset ( self :: $ paused [ $ hook ] ) ; } | Forget about a hook entirely . This will remove all subscribers reset the counter to 0 and remove the paused state for the hook . |
238,205 | public static function getRegisteredHooks ( ) { $ subscribed = array_keys ( self :: $ hooks ) ; $ called = array_keys ( self :: $ counters ) ; $ all = array_merge ( $ subscribed , $ called ) ; return array_unique ( $ all ) ; } | Get all hooks that either have subscribers or have been executed |
238,206 | public function personalAction ( AuthorizationCheckerInterface $ auth , Request $ request ) : Response { return new Response ( $ this -> templating -> render ( '@BkstgSchedule/Calendar/personal.html.twig' ) ) ; } | Show a calendar for a user . |
238,207 | private function prepareResult ( array $ events , Production $ production = null ) : array { $ result = [ 'success' => 1 , 'result' => [ ] , ] ; $ schedules = [ ] ; foreach ( $ events as $ event ) { $ event_production = ( null !== $ production ) ? $ production : $ event -> getGroups ( ) [ 0 ] ; if ( null === $ schedule... | Helper function to prepare results for the calendar . |
238,208 | public function actionAdd ( ) { $ model = new CartForm ( ) ; $ post = \ Yii :: $ app -> request -> post ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> validate ( ) ) { $ additionalProductForm = [ ] ; $ productAdditionalProducts = ProductAdditionalProduct :: find ( ) -> where ( [ ... | Adds product to cart |
238,209 | public function actionShow ( ) { $ this -> registerStaticSeoData ( ) ; $ cart = \ Yii :: $ app -> cart ; $ items = $ cart -> getOrderItems ( ) ; if ( empty ( $ items ) ) { return $ this -> render ( 'empty-cart' ) ; } else { if ( \ Yii :: $ app -> user -> isGuest ) { $ user = new User ( ) ; $ profile = new Profile ( ) ;... | Renders cart view with all order products . |
238,210 | public function actionRemove ( int $ productId , int $ combinationId = null ) { \ Yii :: $ app -> cart -> removeItem ( $ productId , $ combinationId ) ; return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; } | Removes product from cart |
238,211 | public function actionClear ( ) { \ Yii :: $ app -> cart -> clearCart ( ) ; return $ this -> redirect ( \ Yii :: $ app -> request -> referrer ) ; } | Removes all products from cart |
238,212 | public static function timingSafeEquals ( $ safe , $ user ) { if ( function_exists ( 'hash_equals' ) ) { return hash_equals ( ( string ) $ safe , ( string ) $ user ) ; } $ safe .= chr ( 0 ) ; $ user .= chr ( 0 ) ; $ safeLen = strlen ( $ safe ) ; $ userLen = strlen ( $ user ) ; $ result = $ safeLen - $ userLen ; for ( $... | Perform a timing - safe string comparison . |
238,213 | function loadTasks ( string $ namespace , $ tasks ) { if ( ! is_array ( $ tasks ) ) $ tasks = [ $ tasks ] ; foreach ( $ tasks as & $ task ) { $ class_name = $ namespace . $ task ; if ( ! is_subclass_of ( $ class_name , '\\Acast\\CronService\\TaskInterface' ) ) { Console :: warning ( "Invalid class \"$task\"." ) ; conti... | Load tasks by namespace and class name . |
238,214 | protected function addTask ( TaskInterface $ instance ) { $ this -> _task_list [ ] = $ instance ; $ this -> _cron -> add ( $ instance -> name , $ instance -> time , [ $ instance , 'execute' ] , $ instance -> params , $ instance -> persistent ) ; } | Add a task to cron service . |
238,215 | function destroy ( ) { foreach ( $ this -> _task_list as $ task ) $ task -> destroy ( ) ; Cron :: destroy ( $ this -> _name ) ; } | Destroy cron service . |
238,216 | protected function add ( ModelObject $ obj ) { $ this -> getErrors ( ) -> validateModelObject ( $ obj ) ; if ( $ this -> dao -> slugExists ( $ obj -> Slug ) ) $ this -> errors -> reject ( "The slug for this " . get_class ( $ obj ) . " record is already in use." ) ; } | Validates the model object and ensures that slug doesn t exist anywhere . |
238,217 | protected function edit ( ModelObject $ obj ) { if ( $ obj -> { $ obj -> getPrimaryKey ( ) } == null ) $ this -> errors -> reject ( "{$obj->getPrimaryKey()} is required to edit." ) -> throwOnError ( ) ; if ( $ this -> dao -> getByID ( $ obj -> { $ obj -> getPrimaryKey ( ) } ) == false ) $ this -> getErrors ( ) -> rejec... | Ensures we have a valid model object and that it s slug is not in conflict then validates the object |
238,218 | protected function delete ( $ slug ) { if ( $ this -> dao -> getBySlug ( $ slug ) == false ) $ this -> getErrors ( ) -> reject ( 'Record not found for slug:' . $ slug ) ; } | Ensures that the record exists for the given slug |
238,219 | public function readLine ( $ endOfLine = Server :: EOL ) { $ this -> ensureConnected ( ) ; $ buffer = '' ; do { $ buffer .= $ this -> read ( self :: MAX_SINGLE_RESPONSE_LENGTH ) ; $ eolPosition = strpos ( $ buffer , $ endOfLine ) ; } while ( $ eolPosition === false ) ; $ this -> readBuffer = substr ( $ buffer , $ eolPo... | Reads data from the connected socket in chunks of MAX_SINGLE_RESPONSE_LENGTH |
238,220 | public function getCacheManager ( $ key ) { return array_key_exists ( $ key , $ this -> cacheManagers ) ? $ this -> cacheManagers [ $ key ] : null ; } | Get CacheManager . |
238,221 | public function get ( callable $ codeBlock = null ) { if ( is_callable ( $ codeBlock ) ) { return call_user_func ( $ codeBlock , $ this -> value ) ; } else { return $ this -> value ; } } | Returns the monad s value and applies an optional code - block before returning it . |
238,222 | public function bind ( callable $ codeBlock ) { if ( $ this -> value === null ) { return new None ; } else { return static :: unit ( call_user_func ( $ codeBlock , $ this -> value ) ) ; } } | Runs the given code - block on the monad s value if the value isn t null . |
238,223 | public function createResourceTimelineEntry ( EntityPublishedEvent $ event ) : void { $ resource = $ event -> getObject ( ) ; if ( ! $ resource instanceof Resource ) { return ; } $ author = $ this -> user_provider -> loadUserByUsername ( $ resource -> getAuthor ( ) ) ; $ resource_component = $ this -> action_manager ->... | Create the resource timeline entry . |
238,224 | public function validateUser ( $ attribute , $ params ) { if ( ! $ this -> hasErrors ( ) ) { $ user = $ this -> user ; if ( ! isset ( $ user ) ) { $ this -> addError ( $ attribute , Yii :: $ app -> coreMessage -> getMessage ( CoreGlobal :: ERROR_USER_NOT_EXIST ) ) ; } else { if ( ! $ this -> hasErrors ( ) && ! $ user -... | Check whether valid user already exist and available for SNS login . |
238,225 | public function login ( ) { if ( $ this -> validate ( ) ) { $ user = $ this -> getUser ( ) ; $ user -> lastLoginAt = DateUtil :: getDateTime ( ) ; $ user -> save ( ) ; return Yii :: $ app -> user -> login ( $ user , false ) ; } return false ; } | Logs in the user . |
238,226 | public function __isset ( string $ prop ) : bool { $ annotations = $ this -> __ornamentalize ( ) ; foreach ( $ annotations [ 'methods' ] as $ name => $ anns ) { if ( isset ( $ anns [ 'get' ] ) && $ anns [ 'get' ] == $ prop ) { return true ; } } return property_exists ( $ this -> __state , $ prop ) && ! is_null ( $ this... | Check if a property is defined . Note that this will return true for protected properties . |
238,227 | public static function create ( ) : self { return new self ( new ClosureContainer ( [ 'rollerworks_search.condition_exporter.json' => function ( ) { return new Exporter \ JsonExporter ( ) ; } , 'rollerworks_search.condition_exporter.string_query' => function ( ) { return new Exporter \ StringQueryExporter ( ) ; } , 'ro... | Create a new ConditionExporterLoader with the build - in ConditionExporters loadable . |
238,228 | private function loadTrustedProxies ( ) { $ proxies = App :: $ Properties -> get ( 'trustedProxy' ) ; if ( ! $ proxies || Str :: likeEmpty ( $ proxies ) ) { return ; } $ pList = explode ( ',' , $ proxies ) ; $ resultList = [ ] ; foreach ( $ pList as $ proxy ) { $ resultList [ ] = trim ( $ proxy ) ; } self :: setTrusted... | Set trusted proxies from configs |
238,229 | public function getPathInfo ( ) { $ route = $ this -> languageInPath ? Str :: sub ( parent :: getPathInfo ( ) , Str :: length ( $ this -> language ) + 1 ) : parent :: getPathInfo ( ) ; if ( ! Str :: startsWith ( '/' , $ route ) ) { $ route = '/' . $ route ; } return $ route ; } | Get pathway as string |
238,230 | public function getInterfaceSlug ( ) : string { $ path = $ this -> getBasePath ( ) ; $ subDir = App :: $ Properties -> get ( 'basePath' ) ; if ( $ subDir !== '/' ) { $ offset = ( int ) Str :: length ( $ subDir ) ; $ path = Str :: sub ( $ path , -- $ offset ) ; } return $ path ; } | Get base path from current environment without basePath of subdirectories |
238,231 | private function setTemplexFeatures ( ) : void { $ url = $ this -> getSchemeAndHttpHost ( ) ; $ sub = null ; if ( $ this -> getInterfaceSlug ( ) && Str :: length ( $ this -> getInterfaceSlug ( ) ) > 0 ) { $ sub = $ this -> getInterfaceSlug ( ) . '/' ; } if ( $ this -> languageInPath ( ) ) { $ sub .= $ this -> getLangua... | Set templex template engine URL features |
238,232 | public static function build ( string $ fullPath , int $ uploadStatus , string $ clientFileName = null , string $ clientMimeType = null ) : \ Dms \ Core \ File \ IUploadedFile { if ( $ clientMimeType && stripos ( $ clientMimeType , 'image' ) === 0 ) { return new UploadedImage ( $ fullPath , $ uploadStatus , $ clientFil... | Builds a new uploaded file instance based on the given mime type . |
238,233 | public function get ( int $ address = null ) : int { if ( $ address == null ) { $ temp = $ this -> value ++ ; $ this -> memory [ $ this -> lenght ] = $ temp ; $ this -> lenght ++ ; return $ temp ; } else { if ( $ address > - 1 ) { return $ this -> memory [ $ address ] ; } } } | Autogenera un numero entero de forma correlativa . |
238,234 | public function findByName ( $ name ) { $ call = sprintf ( "findBy%s" , ( false !== strpos ( $ name , '.' ) ) ? 'FullyQualifiedName' : 'Name' ) ; $ found = $ this -> persistedGet ( ) -> $ call ( $ name ) ; switch ( $ count = count ( $ found ) ) { case 0 : return null ; case 1 : return $ found -> pop ( ) ; default : thr... | Return a index from it s name |
238,235 | public function getDepth ( ) : int { $ depth = parent :: getDepth ( ) ; $ paths = array_filter ( array_map ( function ( Invalid $ error ) { return $ error -> getPath ( ) ; } , $ this -> errors ) ) ; if ( $ paths && ( $ max = max ( array_map ( 'count' , $ paths ) ) ) > $ depth ) { $ depth = $ max ; } return $ depth ; } | Calculate the maximum depth between its errors . |
238,236 | public function getFlatErrors ( ) : array { $ reduce = function ( array $ carry , Invalid $ item ) use ( & $ reduce ) { if ( $ item instanceof self ) { $ carry = array_merge ( $ carry , $ item -> getFlatErrors ( ) ) ; } else { $ carry [ ] = $ item ; } if ( $ item -> getPrevious ( ) ) { $ carry = $ reduce ( $ carry , $ ... | Retrieve a list of Invalid errors . The returning array will have one level deep only . |
238,237 | protected function _invokeCallable ( $ callable , $ args ) { if ( ! is_callable ( $ callable ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Callable is not callable' ) , null , null , $ callable ) ; } $ args = $ this -> _normalizeArray ( $ args ) ; try { $ reflection = $ this -> _createReflecti... | Invokes a callable . |
238,238 | public static function diskFullPath ( $ path ) { $ path = self :: diskPath ( $ path ) ; if ( ! Str :: startsWith ( root , $ path ) ) { $ path = root . DIRECTORY_SEPARATOR . ltrim ( $ path , '\\/' ) ; } return $ path ; } | Normalize local disk - based ABSOLUTE path . |
238,239 | public function cmdGetCategory ( ) { $ result = $ this -> getListCategory ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCategory ( $ result ) ; $ this -> output ( ) ; } | Callback for category - get command |
238,240 | public function cmdUpdateCategory ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this... | Callback for category - update command |
238,241 | protected function getListCategory ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { return $ this -> category -> getList ( array ( 'limit' => $ this -> getLimit ( ) ) ) ; } if ( ! is_numeric ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } if ( $ this -> getParam ( 'gro... | Returns an array of categories |
238,242 | protected function addCategory ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> category -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } } | Add a new category |
238,243 | protected function submitAddCategory ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'category' ) ; $ this -> addCategory ( ) ; } | Add a new category at once |
238,244 | protected function wizardAddCategory ( ) { $ this -> validatePrompt ( 'title' , $ this -> text ( 'Title' ) , 'category' ) ; $ this -> validatePrompt ( 'category_group_id' , $ this -> text ( 'Category group ID' ) , 'category' ) ; $ this -> validatePrompt ( 'parent_id' , $ this -> text ( 'Parent category ID' ) , 'categor... | Add a new category step by step |
238,245 | public static function baseToDec ( $ input , $ Chars ) { if ( preg_match ( '/^[' . $ Chars . ']+$/' , $ input ) ) { $ Result = ( string ) '0' ; for ( $ i = 0 ; $ i < strlen ( $ input ) ; $ i ++ ) { if ( $ i != 0 ) $ Result = bcmul ( $ Result , strlen ( $ Chars ) , 0 ) ; $ Result = bcadd ( $ Result , strpos ( $ Chars , ... | convert character string with arbitrary base to decimal string |
238,246 | public static function baseFromDec ( $ input , $ Chars ) { if ( preg_match ( '/^[0-9]+$/' , $ input ) ) { $ Result = '' ; do { $ Result .= $ Chars [ bcmod ( $ input , strlen ( $ Chars ) ) ] ; $ input = bcdiv ( $ input , strlen ( $ Chars ) , 0 ) ; } while ( bccomp ( $ input , '0' ) != 0 ) ; return strrev ( $ Result ) ; ... | convert character string with decimal base to arbitrary base |
238,247 | public function updateIndex ( ) { $ this -> startLogging ( ) ; $ this -> addLog ( 'Indexing start.' ) ; $ this -> addLog ( 'Clearing index.' ) ; $ this -> resetIndex ( ) ; $ this -> addLog ( 'Cleaning Published Deleted Documents' ) ; $ this -> storage -> getDocuments ( ) -> cleanPublishedDeletedDocuments ( ) ; $ this -... | Creates a new temporary search db cleans it if it exists then calculates and stores the search index in this db and finally if indexing completed replaces the current search db with the temporary one . Returns the log in string format . |
238,248 | public function createDocumentTermCount ( $ documents ) { $ termCount = new TermCount ( $ this -> getSearchDbHandle ( ) , $ documents , $ this -> filters , $ this -> storage ) ; $ termCount -> execute ( ) ; } | Count how often a term is used in a document |
238,249 | public function createInverseDocumentFrequency ( ) { $ documentCount = $ this -> getTotalDocumentCount ( ) ; $ inverseDocumentFrequency = new InverseDocumentFrequency ( $ this -> getSearchDbHandle ( ) , $ documentCount ) ; $ inverseDocumentFrequency -> execute ( ) ; } | Calculates the inverse document frequency for each term . This is a representation of how often a certain term is used in comparison to all terms . |
238,250 | private function startLogging ( ) { $ this -> loggingStart = round ( microtime ( true ) * 1000 ) ; $ this -> lastLog = $ this -> loggingStart ; } | Stores the time the indexing started in memory |
238,251 | private function addLog ( $ string ) { $ currentTime = round ( microtime ( true ) * 1000 ) ; $ this -> log .= date ( 'd-m-Y H:i:s - ' ) . str_pad ( $ string , 50 , " " , STR_PAD_RIGHT ) . "\t" . ( $ currentTime - $ this -> lastLog ) . 'ms since last log. ' . "\t" . ( $ currentTime - $ this -> loggingStart ) . 'ms since... | Adds a logline with the time since last log |
238,252 | protected function getSearchDbHandle ( ) { if ( $ this -> searchDbHandle === null ) { $ path = $ this -> storageDir . DIRECTORY_SEPARATOR ; $ this -> searchDbHandle = new \ PDO ( 'sqlite:' . $ path . self :: SEARCH_TEMP_DB ) ; } return $ this -> searchDbHandle ; } | Creates the SQLite \ PDO object if it doesnt exist and returns it . |
238,253 | public function replaceOldIndex ( ) { $ this -> searchDbHandle = null ; $ path = $ this -> storageDir . DIRECTORY_SEPARATOR ; rename ( $ path . self :: SEARCH_TEMP_DB , $ path . 'search.db' ) ; } | Replaces the old search index database with the new one . |
238,254 | public function isPublic ( $ status = null ) { $ this -> is_public = $ status !== null ? $ status : $ this -> is_public ; return $ this -> is_public ; } | Is an public class |
238,255 | public function isStatic ( $ status = null ) { $ this -> is_static = $ status !== null ? $ status : $ this -> is_static ; return $ this -> is_static ; } | Is an static class |
238,256 | public function renderProfile ( ) { $ this -> checkIsLogin ( ) ; $ name = $ this -> di -> get ( 'session' ) -> get ( "user" ) ; $ user = $ this -> getUserDetails ( $ name ) ; $ views = [ [ "comment/user/profile/profile" , [ "user" => $ user ] , "main" ] ] ; if ( $ user -> authority == "admin" ) { $ views = [ [ "comment... | Render profile page |
238,257 | public function getName ( Crawler $ crawler ) { $ headers = $ crawler -> filter ( 'table.borderNoOpac th.raceheader b' ) ; $ values = $ headers -> extract ( array ( '_text' , 'b' ) ) ; $ name = @ $ values [ 0 ] [ 0 ] ; if ( $ name === false ) { return 'Naam kon niet worden opgehaald. Vul zelf in.' ; } return trim ( $ n... | Naam van de uitslag . |
238,258 | static function getDownloadUrl ( $ videoUrl ) { $ toplevelDomain = parse_url ( $ videoUrl ) ; $ toplevelDomain = $ toplevelDomain [ 'host' ] ; if ( ! is_dir ( __DIR__ . DIRECTORY_SEPARATOR . 'ProviderHandler' . DIRECTORY_SEPARATOR . $ toplevelDomain ) ) { throw new \ Exception ( 'There is no special implementation for ... | Get the download url of a video url |
238,259 | public static function hydrate ( array $ data , ByConfigBuilder $ config ) { if ( $ config -> getEntity ( ) === false ) { return $ config -> getCollectionEntity ( $ data ) ; } if ( $ config -> isCollection ( ) === false ) { $ data = array ( $ data ) ; } $ rows = array ( ) ; foreach ( $ data as $ index => $ row ) { $ ro... | Hydrate array data to an object based on the configuration given |
238,260 | public function createValidator ( $ validatorType , array $ validatorOptions = [ ] ) { try { $ validatorObjectName = $ this -> resolveValidatorObjectName ( $ validatorType ) ; $ validator = $ this -> objectManager -> get ( $ validatorObjectName , $ validatorOptions ) ; if ( ! ( $ validator instanceof \ TYPO3 \ CMS \ Ex... | Get a validator for a given data type . Returns a validator implementing the \ TYPO3 \ CMS \ Extbase \ Validation \ Validator \ ValidatorInterface or NULL if no validator could be resolved . |
238,261 | protected function resolveValidatorObjectName ( $ validatorName ) { if ( strpos ( $ validatorName , ':' ) !== false || strpbrk ( $ validatorName , '_\\' ) === false ) { list ( $ extensionName , $ extensionValidatorName ) = explode ( ':' , $ validatorName ) ; if ( $ validatorName !== $ extensionName && $ extensionValida... | Returns an object of an appropriate validator for the given class . If no validator is available FALSE is returned |
238,262 | public static function decode ( $ string ) { if ( ! $ string ) { return new ArrayObject ( ) ; } $ array = json_decode ( $ string , true ) ; static :: checkLastError ( ) ; if ( ! is_array ( $ array ) ) { $ array = [ ] ; } return ArrayObject :: make ( $ array ) ; } | Convert a JSON string to an array . |
238,263 | public function detect ( & $ controller ) { $ this -> controller = & $ controller ; $ this -> name = Inflector :: singularize ( $ this -> controller -> name ) ; $ path = get_include_path ( ) ; set_include_path ( VENDORS . 'phpids/' ) ; vendor ( 'phpids/IDS/Init' ) ; $ _REQUEST [ 'IDS_request_uri' ] = $ _SERVER [ 'REQUE... | This function includes the IDS vendor parts and runs the detection routines on the request array . |
238,264 | private function react ( IDS_Report $ result ) { $ new = $ this -> controller -> Session -> read ( 'IDS.Impact' ) + $ result -> getImpact ( ) ; $ this -> controller -> Session -> write ( 'IDS.Impact' , $ new ) ; $ impact = $ this -> controller -> Session -> read ( 'IDS.Impact' ) ; if ( $ impact >= $ this -> threshold [... | This function rects on the values in the incoming results array . |
238,265 | static function register ( string $ name , CaptchaInterface $ captcha ) { if ( isset ( self :: $ _captchaList [ $ name ] ) ) Console :: warning ( "Overwriting captcha generator \"$name\"." ) ; self :: $ _captchaList [ $ name ] = $ captcha ; self :: enable ( $ name ) ; } | Register a new captcha generator . |
238,266 | static function enable ( string $ name ) { if ( ! isset ( self :: $ _captchaList [ $ name ] ) ) { Console :: warning ( "Captcha generator \"$name\" do not exist." ) ; return ; } self :: $ _enableList = self :: $ _enableList + [ $ name ] ; } | Mark a captcha generator as enabled . |
238,267 | static function disable ( string $ name ) { $ pos = array_search ( $ name , self :: $ _enableList ) ; if ( $ pos === false ) return ; unset ( self :: $ _enableList [ $ pos ] ) ; } | Mark a captcha generator as disabled . |
238,268 | static function init ( ) { mt_srand ( ) ; foreach ( self :: $ _captchaList as $ captcha ) $ captcha -> init ( ) ; if ( ! is_resource ( self :: $ _queue ) ) self :: _initQueue ( ) ; self :: $ _timer_id = Timer :: add ( Config :: get ( 'CAPTCHA_TIMER_INTERVAL' ) , function ( ) { $ obj = self :: _chooseOne ( ) ; if ( $ ob... | Initialize all registered captcha generators and start generating captcha . |
238,269 | static function destroy ( ) { Timer :: del ( self :: $ _timer_id ) ; foreach ( self :: $ _captchaList as $ captcha ) $ captcha -> destroy ( ) ; self :: $ _captchaList = self :: $ _enableList = [ ] ; msg_remove_queue ( self :: $ _queue ) ; } | Destroy captcha generators . |
238,270 | public function register_routes ( $ routes ) { $ route = JP_API_ROUTE ; $ routes [ ] = array ( "/{$route}/tax-query" => array ( array ( array ( $ this , 'tax_query' ) , WP_JSON_Server :: READABLE | WP_JSON_Server :: ACCEPT_JSON ) , ) , ) ; return $ routes ; } | Register the post - related routes |
238,271 | static public function getNotifiableStates ( ) { $ states = [ ] ; foreach ( static :: getConfig ( ) as $ state => $ config ) { if ( $ config [ 2 ] ) { $ states [ ] = $ state ; } } return $ states ; } | Returns the notifiable states . |
238,272 | protected function getSpressSiteDir ( ) { $ rootPackage = $ this -> composer -> getPackage ( ) ; $ extras = $ rootPackage -> getExtra ( ) ; return isset ( $ extras [ self :: EXTRA_SPRESS_SITE_DIR ] ) ? $ extras [ self :: EXTRA_SPRESS_SITE_DIR ] . '/' : '' ; } | Returns the Spress site directory . If the extra attributte spress_site_dir is not presents in the extra section of the root package . |
238,273 | private function store ( $ data ) { $ enc_data = Text :: lock ( json_encode ( $ data ) ) ; HTTPCookie :: set ( $ this -> name , $ enc_data , 0 , $ this -> path , $ this -> domain ) ; } | Store session into cookie |
238,274 | private function restore ( ) { if ( ! HTTPCookie :: exists ( $ this -> name ) ) return ( object ) [ ] ; return json_decode ( Text :: unlock ( HTTPCookie :: get ( $ this -> name ) ) ) ; } | Restore session from cookie |
238,275 | public function route ( $ request ) { if ( ! self :: $ _cli ) { $ router = $ this -> get ( 'routing' ) ; $ router -> route ( $ request ) ; } } | Handles routing for all incoming requests . |
238,276 | protected function setRequestProperties ( Request $ request ) { $ this [ "basePath" ] = $ request -> getBasePath ( ) ; $ this [ "baseUrl" ] = $ request -> getSchemeAndHttpHost ( ) . $ this [ "basePath" ] ; } | Set application properties |
238,277 | protected function addMemcacheServers ( $ cache , $ servers ) { $ class = new \ ReflectionClass ( $ cache ) ; $ paramCount = $ class -> getMethod ( 'addServer' ) -> getNumberOfParameters ( ) ; foreach ( $ servers as $ server ) { $ timeout = ( int ) ( $ server -> timeout / 1000 ) + ( ( $ server -> timeout % 1000 > 0 ) ?... | Add servers to the server pool of the cache specified Used for memcache PECL extension . |
238,278 | public function getProvider ( $ key ) { if ( ! isset ( $ this -> providers [ $ key ] ) ) { return null ; } return $ this -> providers [ $ key ] ; } | Get provider by key |
238,279 | public function login ( string $ login , string $ password ) { $ user = $ this -> auth_repository -> login ( $ login , $ password ) ; if ( null === $ user ) { return null ; } if ( $ this -> container -> has ( 'user' ) ) { unset ( $ this -> container [ 'user' ] ) ; } $ this -> container [ 'user' ] = $ user ; return $ th... | Log in user . |
238,280 | public function reset ( string $ code , string $ new_password ) : bool { return $ this -> auth_repository -> reset ( $ code , $ new_password ) ; } | Reset user password by code . |
238,281 | public function module ( $ module ) { if ( is_object ( $ module ) ) { if ( ! ( $ module instanceof ModuleInterface ) ) { $ moduleType = get_class ( $ module ) ; throw new InvalidArgumentException ( "Given module object '$moduleType' does not implement 'Depend\\Abstraction\\ModuleInterface'" ) ; } $ module -> register (... | Register a module object or class to register it s own dependencies . |
238,282 | public function add ( DescriptorInterface $ descriptor ) { $ key = $ this -> makeKey ( $ descriptor -> getName ( ) ) ; $ descriptor -> setManager ( $ this ) ; $ this -> descriptors [ $ key ] = $ descriptor ; } | Add a class descriptor to the managers collection . |
238,283 | public function resolveParams ( $ params ) { $ resolved = array ( ) ; foreach ( $ params as $ param ) { if ( $ param instanceof DescriptorInterface ) { $ resolved [ ] = $ this -> get ( $ param -> getName ( ) ) ; continue ; } $ resolved [ ] = $ param ; } return $ resolved ; } | Resolve an array of mixed parameters and possible Descriptors . |
238,284 | public function set ( $ name , $ instance ) { $ key = $ this -> makeKey ( $ name ) ; $ this -> alias ( $ name , $ this -> describe ( get_class ( $ instance ) ) ) ; $ this -> instances [ $ key ] = $ instance ; return $ this ; } | Store an instance for injection by class name or alias . |
238,285 | public function connectAction ( ) { $ scope = $ this -> getParameter ( 'scope_auth' ) ; if ( ! isset ( $ scope ) ) { $ scope = [ ] ; } return $ this -> get ( 'oauth2.registry' ) -> getClient ( 'google_main' ) -> redirect ( $ scope ) ; } | Link to this controller to start the connect process |
238,286 | public function setResponseIsJson ( $ responseIsJson = '' ) { $ this -> responseIsJson = $ responseIsJson ; $ this -> debug -> info ( __FUNCTION__ , 'setResponseIsJson: ' , $ this -> responseIsJson ) ; return $ this ; } | Function setResponseIsJson Return Response is Json if value = true |
238,287 | public function setCurrentAction ( $ action , array $ actionArgs = array ( ) ) { $ action = ( string ) $ action ; if ( array_key_exists ( $ action , $ this -> actions ) ) { $ this -> action = $ action ; $ this -> configureAction ( $ this -> action , $ actionArgs ) ; } return $ this ; } | Set the current action taking place on the Model |
238,288 | protected function configureAction ( $ action , array $ arguments = array ( ) ) { $ this -> setProperty ( self :: PROPERTY_HTTP_METHOD , $ this -> actions [ $ action ] ) ; } | Update any properties or data based on the current action - Called when setting the Current Action |
238,289 | protected function updateModel ( ) { $ body = $ this -> Response -> getBody ( ) ; switch ( $ this -> action ) { case self :: MODEL_ACTION_CREATE : case self :: MODEL_ACTION_UPDATE : case self :: MODEL_ACTION_RETRIEVE : if ( is_array ( $ body ) ) { $ this -> update ( $ body ) ; } break ; case self :: MODEL_ACTION_DELETE... | Called after Execute if a Request Object exists and Request returned 200 response |
238,290 | protected function _rewind ( ) { try { $ this -> _setIteration ( $ this -> _reset ( ) ) ; } catch ( RootException $ exception ) { $ this -> _throwIteratorException ( $ this -> __ ( 'An error occurred while rewinding' ) , null , $ exception ) ; } } | Resets the iterator . |
238,291 | protected function _next ( ) { try { $ this -> _setIteration ( $ this -> _loop ( ) ) ; } catch ( RootException $ exception ) { $ this -> _throwIteratorException ( $ this -> __ ( 'An error occurred while iterating' ) , null , $ exception ) ; } } | Advances the iterator to the next element . |
238,292 | public function checkIdPSettings ( $ settings ) { assert ( 'is_array($settings)' ) ; if ( ! is_array ( $ settings ) || empty ( $ settings ) ) { return array ( 'invalid_syntax' ) ; } $ errors = array ( ) ; if ( ! isset ( $ settings [ 'idp' ] ) || empty ( $ settings [ 'idp' ] ) ) { $ errors [ ] = 'idp_not_found' ; } else... | Checks the IdP settings info . |
238,293 | public function getSPMetadata ( ) { $ metadata = OneLogin_Saml2_Metadata :: builder ( $ this -> _sp , $ this -> _security [ 'authnRequestsSigned' ] , $ this -> _security [ 'wantAssertionsSigned' ] , null , null , $ this -> getContacts ( ) , $ this -> getOrganization ( ) ) ; $ certNew = $ this -> getSPcertNew ( ) ; if (... | Gets the SP metadata . The XML representation . |
238,294 | public static function hms ( $ h , $ m = 0 , $ s = 0 , $ f = 0 ) { $ sec = static :: hmsf2sec ( $ h , $ m , $ s , $ f ) ; return static :: sec ( $ sec ) ; } | Creates a new Time instance from hour minute and second components . |
238,295 | public function readFile ( string $ file_name ) { $ file_handle = @ fopen ( $ file_name , "r" ) ; if ( ! is_resource ( $ file_handle ) ) throw new IOException ( "Failed to read file: " . $ file_name ) ; return $ this -> readFileHandle ( $ file_handle ) ; } | Read YAML from a file |
238,296 | public function readFileHandle ( $ file_handle ) { if ( ! is_resource ( $ file_handle ) ) throw new \ InvalidArgumentException ( "No file handle was provided" ) ; $ contents = "" ; while ( ! feof ( $ file_handle ) ) $ contents .= fread ( $ file_handle , 8192 ) ; return $ this -> readString ( $ contents ) ; } | Read YAML from an open resource |
238,297 | public function readString ( string $ data ) { $ interceptor = new ErrorInterceptor ( function ( $ data ) { return yaml_parse ( $ data ) ; } ) ; $ interceptor -> registerError ( E_WARNING , "yaml_parse" ) ; $ result = $ interceptor -> execute ( $ data ) ; foreach ( $ interceptor -> getInterceptedErrors ( ) as $ error )... | Read YAML from a string |
238,298 | public function addAttribute ( Attribute $ attribute ) : ComplexEntity { $ this -> attributesCollection = $ this -> getAttributes ( ) -> addAttribute ( $ attribute ) ; return $ this ; } | Add attribute definition |
238,299 | public function toRestResponse ( int $ status = 200 , array $ headers = [ ] ) : RestResponseContract { return ( new Response ( ) ) -> setData ( $ this -> toArray ( ) ) -> setStatus ( $ status ) -> setHeaders ( $ headers ) ; } | Create REST response from entity |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.