idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
11,500 | protected function initialize ( array $ config ) { $ this -> swooleServer = $ this -> createSwooleServer ( $ config ) ; $ this -> configureDefaultServerSocket ( ) ; $ this -> setOptions ( $ config [ 'options' ] ?? [ ] ) ; $ this -> registerEventCallbacks ( $ this -> serverEvents ) ; $ this -> events -> dispatch ( new E... | Initialize the server . |
11,501 | protected function createSwooleServer ( array $ config ) { return new SwooleServer ( $ this -> serverSocket -> getHost ( ) , $ this -> serverSocket -> getPort ( ) , $ this -> parseServerMode ( $ config ) , $ this -> serverSocket -> getSocketType ( ) ) ; } | Create the Swoole server instance . |
11,502 | public function setOptions ( array $ options = [ ] ) { if ( $ this -> isRunning ( ) ) { throw new LogicException ( 'Options cannot be set while the server is running.' ) ; } $ this -> options = array_diff_key ( $ this -> options , $ options ) + $ options ; $ this -> swooleServer -> set ( $ this -> options ) ; } | Set the server options . |
11,503 | public function listen ( ServerSocketContract $ serverSocket ) { if ( $ this -> isRunning ( ) ) { throw new LogicException ( 'Cannot add listening while the server is serving.' ) ; } if ( $ serverSocket -> isBound ( ) ) { throw new LogicException ( 'The server socket can be bound to server only once.' ) ; } $ address =... | Add a listening defined in the given server socket . |
11,504 | public function fork ( ProcessContract $ process ) { $ this -> swooleServer -> addProcess ( $ process -> getSwooleProcess ( ) ) ; $ process -> bind ( $ this ) ; } | Add a child process managed by the server . |
11,505 | protected function reportWorkerError ( $ workerId , $ workerPid , $ exitCode , $ signal ) { $ this -> handleException ( new WorkerExitUnexpectedException ( sprintf ( 'The worker %d quit unexpected with exit code %d, signal %d, pid %d.' , $ workerId , $ exitCode , $ signal , $ workerPid ) ) ) ; } | Report worker exit |
11,506 | static function isLoggingEnabled ( $ debuglevel ) { $ logging = & self :: $ debuglevel ; if ( $ logging < 0 ) { $ logging = 0 ; $ ini = eZINI :: instance ( 'wsproviders.ini' ) ; if ( $ ini -> hasvariable ( 'GeneralSettings' , 'Logging' ) ) { $ level = $ ini -> variable ( 'GeneralSettings' , 'Logging' ) ; if ( array_key... | Return true if logging is enabled . |
11,507 | static function methodsXSD ( $ server , $ methods , $ service_name = '' , $ return_url = false ) { $ cachedir = eZSys :: cacheDirectory ( ) . '/webservices' ; $ cachefilename = $ cachedir . '/' . md5 ( "xsd,1," . implode ( ',' , $ methods ) ) ; $ cachefile = eZClusterFileHandler :: instance ( $ cachefilename ) ; if ( $... | Returns the xml schema corresponding to a list of server s method s complex types . This is implemented here because . it relies on the templating system . it does its own caching but it should really be a function of the server class itself . Since we do not want to pollute server classes with eZ specifics we chose to... |
11,508 | public static function ezpI18ntr ( $ context , $ message , $ comment = null , $ argument = null ) { if ( eZPublishSDK :: majorVersion ( ) == 4 && eZPublishSDK :: minorVersion ( ) < 3 ) { include_once ( 'kernel/common/i18n.php' ) ; return ezi18n ( $ context , $ message , $ comment , $ argument ) ; } else { return ezpI18... | Wrapper method to translate labels and eventually takes advantage of new 4 . 3 i18n API |
11,509 | public function update ( array $ items = [ ] ) { $ brandId = $ this -> getDefaultBrandId ( ) ; $ changed = $ this -> verify ( $ items , $ brandId ) ; Memory :: make ( 'component.default' ) -> put ( 'terminate' , ( int ) $ changed ) ; if ( $ changed ) { $ this -> keyMap = [ ] ; } if ( $ changed && $ this -> cache instan... | updates elements in container |
11,510 | protected function getDefaultBrandId ( ) { try { if ( is_null ( $ this -> defaultBrandId ) ) { $ this -> defaultBrandId = 1 ; } return $ this -> defaultBrandId ; } catch ( Exception $ e ) { Log :: emergency ( $ e ) ; return false ; } } | get default brand |
11,511 | public function load ( $ resource , $ type = null ) { if ( ! isset ( $ this -> slots [ $ resource ] ) ) { $ collection = new RouteCollection ( ) ; } else { $ collection = $ this -> container -> get ( $ this -> slots [ $ resource ] ) -> build ( ) ; } foreach ( $ this -> resources as $ trackedResource ) { $ collection ->... | Loads a RouteCollection from a routing slot . |
11,512 | protected static function getWidgetAttribute ( $ name ) { if ( ! empty ( self :: $ staticAttributes ) ) { return array_get ( self :: $ staticAttributes , $ name ) ; } $ classname = get_called_class ( ) ; if ( app ( 'request' ) -> ajax ( ) ) { self :: setAjaxAttributes ( $ classname ) ; } else { $ components = Registry ... | Ui component attribute getter |
11,513 | private static function setAjaxAttributes ( $ classname ) { self :: $ staticAttributes = app ( $ classname ) -> getAttributes ( ) ; $ width = Input :: get ( 'width' ) ; if ( $ width ) { $ width = ( int ) ( 12 * $ width ) / 100 ; array_set ( self :: $ staticAttributes , 'width' , $ width ) ; } $ height = Input :: get ( ... | When ajax request with changed ui component dimensions |
11,514 | public function index ( Processor $ processor ) { $ this -> breadcrumb -> onSecurity ( ) ; $ data = $ processor -> index ( ) ; return view ( 'antares/foundation::settings.security.index' , $ data ) ; } | Shows security settings page . |
11,515 | public function check ( ) : void { $ processesInfo = $ this -> getProcessesInfo ( ) ; foreach ( $ this -> processes as $ process ) { foreach ( $ processesInfo as $ processInfo ) { if ( Str :: startsWith ( $ processInfo -> getCommand ( ) , $ process -> getCommand ( ) ) ) { $ process -> setInfo ( $ processInfo ) ; break ... | Checks processes . |
11,516 | public function getProcessesInfo ( ) : array { $ processIds = [ ] ; $ processes = [ ] ; $ data = [ ] ; exec ( 'pgrep php' , $ processIds ) ; exec ( 'ps ahxwwo pid:1,command:1 | grep php | grep -v grep | grep -v emacs' , $ processes ) ; foreach ( $ processes as $ process ) { $ pid = explode ( ' ' , trim ( $ process ) , ... | Returns list of running processes . |
11,517 | public function getProcessByCommand ( string $ command ) : Process { if ( ! array_key_exists ( $ command , $ this -> processes ) ) { $ this -> watch ( $ command ) ; } foreach ( $ this -> getWatchedProcesses ( ) as $ process ) { if ( $ process -> getCommand ( ) === $ command ) { return $ process ; } } } | Returns process info about command . |
11,518 | public function run ( string $ command ) : Process { $ mutedCommand = Str :: startsWith ( $ command , 'artisan' ) ? str_replace ( 'artisan ' , '' , $ command ) : $ command ; ignore_user_abort ( ) ; $ logName = explode ( ' -' , $ mutedCommand , 2 ) [ 0 ] ; $ log = storage_path ( 'logs' . DIRECTORY_SEPARATOR . snake_case... | Runs new process and return info about it . |
11,519 | public function detect ( ) { $ components = $ this -> finder ( ) -> detect ( ) ; if ( ! $ this -> isValidRoute ( ) ) { return $ components ; } $ this -> app -> make ( 'events' ) -> fire ( 'antares.ui-components: detecting' ) ; $ this -> app -> make ( 'events' ) -> fire ( new ComponentsDetecting ( ) ) ; $ service = app ... | Detect all ui components . |
11,520 | protected function isValidRoute ( ) { try { $ current = Route :: current ( ) ; if ( ! $ current ) { return false ; } $ action = $ current -> action ; $ as = array_get ( $ action , 'as' ) ; return str_contains ( $ as , 'show' ) or str_contains ( $ as , 'dashboard' ) ; } catch ( Exception $ ex ) { return false ; } } | Whether route is valid to view widgets |
11,521 | public function detectTemplates ( ) { $ this -> app -> make ( 'events' ) -> fire ( 'antares.ui-components.templates: detecting' ) ; $ this -> app -> make ( 'events' ) -> fire ( new ComponentTemplatesDetecting ( ) ) ; return $ this -> templateFinder ( ) -> detect ( ) -> toArray ( ) ; } | Detects ui component templates |
11,522 | public function formatTimeAgoForHumans ( $ date , $ html = true ) { $ value = Carbon :: createFromTimeStamp ( strtotime ( $ date ) ) -> diffForHumans ( ) ; return ( $ html ) ? $ this -> decorate ( $ value , $ date ) : $ value ; } | creates representation of human readable date in the past |
11,523 | protected function getPageId ( ) { $ route = call_user_func ( $ this -> container -> make ( 'request' ) -> getRouteResolver ( ) ) ; if ( is_null ( $ route ) ) { return false ; } $ action = $ route -> getAction ( ) ; $ controller = isset ( $ action [ 'controller' ] ) ? $ action [ 'controller' ] : null ; if ( is_null ( $... | get page id by route |
11,524 | protected function createItem ( array $ component ) { $ classname = array_get ( $ component , 'data.classname' ) ; if ( ! $ this -> dispatchable ( $ classname ) ) { return ; } $ id = $ component [ 'id' ] ; $ attr = array_get ( $ component , 'data' , [ ] ) ; $ this -> handler -> add ( $ id , '^:ui-components-selector' )... | create menu item by ui component attributes |
11,525 | public function authorize ( Authorization $ acl ) { $ active = ( extension_active ( 'ban_management' ) or extension_active ( 'two_factor_auth' ) ) ; if ( ! $ active ) { return false ; } return $ acl -> can ( 'manage-antares' ) ; } | Check authorization to display the menu . |
11,526 | public function store ( ) { $ inputs = Input :: all ( ) ; $ params = array_get ( $ inputs , 'params' ) ; $ column = $ params [ 'column' ] ; $ route = uri ( ) ; $ session = $ this -> request -> session ( ) ; $ classname = array_get ( $ inputs , 'classname' ) ; $ data = $ this -> prepareToSave ( $ classname , $ params , ... | stores filter data in session |
11,527 | protected function prepareToSave ( $ classname , array $ params = [ ] , array $ paramsFromSession = null ) { $ column = $ params [ 'column' ] ; $ return = [ ] ; if ( is_null ( $ paramsFromSession ) ) { $ return [ $ column ] [ 'classname' ] = $ classname ; $ return [ $ column ] [ 'values' ] = [ $ params [ 'value' ] ] ; ... | prepares data to store in session |
11,528 | public function destroy ( ) { $ inputs = Input :: all ( ) ; $ params = array_get ( $ inputs , 'params' ) ; if ( ( $ unserialized = $ this -> unserialize ( $ params [ 'value' ] ) ) !== false ) { $ params [ 'value' ] = $ unserialized ; } $ route = uri ( ) ; $ session = $ this -> request -> session ( ) ; if ( ! $ session ... | deletes filter settings from session |
11,529 | protected function prepareToDestroy ( array $ params = [ ] , array $ paramsFromSession = null ) { $ return = [ ] ; foreach ( $ paramsFromSession as $ name => $ values ) { if ( $ params [ 'column' ] == $ name ) { $ return [ $ name ] = [ ] ; } } return $ return ; } | prepare data to remove from session |
11,530 | protected function unserialize ( $ str ) { $ str = str_replace ( "'" , '"' , $ str ) ; $ data = @ unserialize ( $ str ) ; if ( $ str === 'b:0;' || $ data !== false ) { return $ data ; } return false ; } | custom string unserializator |
11,531 | public function update ( ) { $ inputs = Input :: all ( ) ; $ s = $ this -> request -> session ( ) ; $ route = uri ( ) ; $ session = $ s -> get ( $ route , [ ] ) ; if ( empty ( $ session ) ) { return false ; } if ( is_null ( $ column = array_get ( $ inputs , 'column' ) ) ) { return false ; } if ( ! isset ( $ session [ $... | updates filter paramateres in session |
11,532 | public function save ( ) { $ input = Input :: all ( ) ; $ session = app ( 'request' ) -> session ( ) ; $ classname = array_get ( $ input , 'classname' ) ; $ key = uri ( ) ; $ params = $ session -> get ( $ key ) ; $ params [ $ classname ] = array_get ( $ input , 'params' ) ; $ session -> put ( $ key , $ params ) ; $ ses... | Additional save filter params |
11,533 | public function delete ( ) { $ column = Input :: get ( 'params.column' ) ; $ session = app ( 'request' ) -> session ( ) ; $ key = uri ( ) ; $ params = $ session -> get ( $ key ) ; $ data = [ ] ; foreach ( $ params as $ name => $ values ) { if ( isset ( $ values [ 'column' ] ) && $ values [ 'column' ] == $ column ) { co... | Additional delete filter params |
11,534 | private function setIfAllowed ( $ lang ) { $ allowedLangs = array_keys ( Localizer :: allowedLanguages ( ) ) ; if ( config ( 'localizer.block_unallowed_langs' ) && ! in_array ( $ lang , $ allowedLangs ) ) { $ lang = $ allowedLangs [ 0 ] ; } App :: setLocale ( $ lang ) ; if ( config ( 'localizer.carbon' ) ) { Carbon :: ... | This function checks if language to set is an allowed lang of config . |
11,535 | public function setLang ( $ request ) { if ( Auth :: check ( ) ) { $ user = Auth :: user ( ) ; if ( $ user -> locale ) { $ this -> setIfAllowed ( $ user -> locale ) ; } else { if ( config ( 'localizer.set_auto_lang' ) ) { $ this -> setIfAllowed ( Identify :: lang ( ) -> getLanguage ( ) ) ; } else { $ this -> setIfAllow... | This function checks if user is logged in and loads the prefered language . |
11,536 | protected function registerAuthenticator ( ) { $ this -> app -> singleton ( 'auth' , function ( Application $ app ) { $ app [ 'auth.loaded' ] = true ; return new AuthManager ( $ app ) ; } ) ; $ this -> app -> singleton ( 'auth.driver' , function ( Application $ app ) { return $ app -> make ( 'auth' ) -> guard ( ) ; } )... | Register the service provider for Auth . |
11,537 | protected function registerPolicyAfterResolvingHandler ( ) { $ this -> app -> afterResolving ( Policy :: class , function ( Policy $ policy ) { return $ policy -> setAuthorization ( $ this -> app -> make ( FactoryContract :: class ) ) ; } ) ; } | Register the Policy after resolving handler . |
11,538 | private function getPackage ( ) { $ reflection = new ReflectionClass ( get_called_class ( ) ) ; return app ( FilesystemFinder :: class ) -> resolveNamespace ( $ reflection -> getFileName ( ) , true ) ; } | package name getter |
11,539 | private function setCasting ( ) { return false ; $ package = $ this -> getPackage ( ) ; $ tablename = $ this -> getTable ( ) ; $ config = config ( "db_cryptor" , [ ] ) ; if ( ! array_get ( $ config , 'enabled' ) ) { return false ; } if ( is_null ( $ castName = array_get ( $ config , 'cast_name' ) ) ) { return false ; }... | fills configuration options |
11,540 | public function token ( ) { if ( empty ( $ this -> csrfToken ) && ! is_null ( $ this -> session ) ) { $ this -> csrfToken = $ this -> session -> token ( ) ; } return $ this -> hidden ( '_token' , $ this -> csrfToken ) ; } | Generate a hidden field with the current CSRF token . |
11,541 | public function htmlLabel ( $ control , $ options = [ 'class' => 'form-block__name' ] ) { $ this -> labels [ ] = $ control -> name ; $ value = e ( $ this -> formatLabel ( $ control -> name , $ control -> label ) ) ; $ tip = isset ( $ control -> tip ) ? tooltip ( $ control -> name , $ control -> tip ) : '' ; return '<la... | Creates form html label element |
11,542 | public function all ( $ userId = null ) { if ( empty ( $ this -> items ) ) { return ( is_null ( $ userId ) ) ? parent :: all ( ) : $ this -> handler -> retrieveAll ( $ userId ) ; } return $ this -> items ; } | all meta fields for user |
11,543 | public static function make ( $ value ) { if ( is_resource ( $ value ) ) { $ value = null ; } elseif ( Arr :: accessible ( $ value ) ) { $ value = new ArraySerialization ( $ value ) ; } elseif ( $ value instanceof stdClass ) { $ value = new ObjectSerialization ( $ value ) ; } elseif ( $ value instanceof Container ) { $... | Get the value for serialization . |
11,544 | protected function getPaths ( $ name , $ directory = 'migrations' ) { $ package = $ this -> manager -> getAvailableExtensions ( ) -> findByName ( $ name ) ; if ( $ package === null ) { return [ ] ; } $ basePath = $ package -> getPath ( ) ; $ paths = [ "{$basePath}/resources/database/{$directory}/" , "{$basePath}/resour... | resolve paths of migrations & seeds |
11,545 | public function seed ( $ name , $ paths = null ) { $ directories = is_null ( $ paths ) ? $ this -> getPaths ( $ name , 'seeds' ) : $ paths ; $ files = $ this -> app -> make ( 'files' ) ; foreach ( $ directories as $ path ) { if ( $ files -> isDirectory ( $ path ) ) { $ allFiles = $ files -> allFiles ( $ path ) ; foreac... | run seeds from all files in seeds directory |
11,546 | protected function uninstallPathes ( $ name , $ directory = 'migrations' ) { $ package = $ this -> manager -> getAvailableExtensions ( ) -> findByName ( $ name ) ; if ( $ package === null ) { return [ ] ; } $ basePath = $ package -> getPath ( ) ; return [ "{$basePath}/resources/database/{$directory}/" , "{$basePath}/re... | get uninstall pathes |
11,547 | protected function prepareSeedClass ( $ file ) { $ extension = $ file -> getExtension ( ) ; if ( $ extension !== 'php' ) { return null ; } return '\\' . str_replace ( '.' . $ extension , '' , $ file -> getFilename ( ) ) ; } | prepare seed classname |
11,548 | public static function charAsciiArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { $ result = \ array_merge ( self :: charAsciiControlArray ( ) , self :: charAsciiPrintableArray ( ) ) ; } return $ result ; } | Returns all ASCII 7 bit characters in an array . |
11,549 | public static function charAsciiAlphaArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { $ result = \ array_merge ( self :: charAsciiAlphaLowerArray ( ) , self :: charAsciiAlphaUpperArray ( ) ) ; } return $ result ; } | Returns all ASCII 7 bit alphabetic characters in an array . |
11,550 | public static function charAsciiAlphaLowerArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { for ( $ i = 97 ; $ i < 123 ; ++ $ i ) { $ result [ ] = \ chr ( $ i ) ; } } return $ result ; } | Returns all ASCII 7 bit alphabetic lowercase characters in an array . |
11,551 | public static function charAsciiAlphaUpperArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { for ( $ i = 65 ; $ i < 91 ; ++ $ i ) { $ result [ ] = \ chr ( $ i ) ; } } return $ result ; } | Returns all ASCII 7 bit alphabetic uppercase characters in an array . |
11,552 | public static function charAsciiAlphanumericArray ( ) { static $ result = array ( ) ; if ( null === $ result ) { $ result = \ array_merge ( self :: charAsciiNumericArray ( ) , self :: charAsciiAlphaArray ( ) ) ; } return $ result ; } | Returns all ASCII 7 bit alphanumeric characters in an array . |
11,553 | public static function charAsciiControlArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { for ( $ i = 0 ; $ i < 32 ; ++ $ i ) { $ result [ ] = \ chr ( $ i ) ; } $ result [ ] = \ chr ( 127 ) ; } return $ result ; } | Returns all ASCII 7 bit control characters in an array . |
11,554 | public static function charAsciiPrintableArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { for ( $ i = 32 ; $ i < 127 ; ++ $ i ) { $ result [ ] = \ chr ( $ i ) ; } } return $ result ; } | Returns all ASCII 7 bit printable characters in an array . |
11,555 | public static function charAsciiNumericArray ( ) { static $ result = array ( ) ; if ( ! $ result ) { for ( $ i = 48 ; $ i < 58 ; ++ $ i ) { $ result [ ] = ( string ) ( $ i - 48 ) ; } } return $ result ; } | Returns all ASCII 7 bit numeric characters in an array . |
11,556 | public static function isAsciiPrintable ( $ char ) { return ( true === self :: isAscii ( $ char ) ) && ( false === self :: isAsciiControl ( $ char ) ) ; } | Checks whether the character is ASCII 7 bit printable . |
11,557 | protected function getNormalizedName ( string $ name ) : string { $ name = str_replace ( 'antaresproject/component-' , 'antares/' , $ name ) ; $ name = str_replace ( 'antaresproject/module-' , 'antares/' , $ name ) ; return str_replace ( '-' , '_' , $ name ) ; } | Returns normalized component name . It is used for backward compatibility . |
11,558 | public function up ( string $ componentFullName , RoleActionList $ roleActionList ) { $ componentFullName = $ this -> getNormalizedName ( $ componentFullName ) ; $ memory = $ this -> getMemoryProvider ( ) ; $ acl = $ this -> getComponentAcl ( $ componentFullName ) ; $ roles = $ roleActionList -> getRoles ( ) ; $ action... | Set up permissions to the component ACL . |
11,559 | public function down ( string $ componentFullName ) { $ componentFullName = $ this -> getNormalizedName ( $ componentFullName ) ; $ memory = $ this -> getMemoryProvider ( ) ; $ memory -> forget ( 'acl_' . $ componentFullName ) ; $ memory -> finish ( ) ; } | Tear down permissions from the component ACL . |
11,560 | protected static function getFlatActions ( array $ actions ) { $ actions = array_map ( function ( Action $ action ) { return $ action -> getAction ( ) ; } , $ actions ) ; return array_unique ( $ actions ) ; } | Returns a flatten array of actions which only contains friendly action names . |
11,561 | protected function processRuntime ( $ server ) { $ filename = $ this -> option ( 'filename' ) ?? storage_path ( 'framework/server.runtime' ) ; $ server -> registerEventCallback ( 'Launching' , function ( ) use ( $ filename ) { $ this -> saveRuntime ( $ filename ) ; } ) ; $ server -> registerEventCallback ( 'Start' , fu... | Process the server runtime info . |
11,562 | protected function saveRuntime ( $ filename ) { $ payload = [ 'name' => $ this -> laravel -> name ( ) , 'pid' => getmypid ( ) , 'time' => ( string ) Carbon :: now ( ) , ] ; file_put_contents ( $ filename , json_encode ( $ payload , JSON_PRETTY_PRINT ) ) ; } | Record server runtime info . |
11,563 | public static function exists ( $ key , $ array ) { if ( ! is_array ( $ array ) ) { return false ; } if ( $ key == '' ) { return is_array ( $ array ) && array_key_exists ( ( string ) $ key , $ array ) ; } return self :: parseAndValidateKeys ( $ key , $ array ) [ 'isExists' ] ; } | Checks if the given key exists in the array by a string representation |
11,564 | public static function delete ( $ key , & $ array ) { if ( ! is_array ( $ array ) ) { return false ; } if ( $ key == '' ) { unset ( $ array [ $ key ] ) ; return true ; } if ( $ key === '[]' ) { return false ; } return self :: parseAndValidateKeys ( $ key , $ array , 'delete' ) [ 'completed' ] ; } | Delete element from the array by a string representation |
11,565 | public function getRecipients ( ) { if ( empty ( $ this -> recipients ) ) { return [ ] ; } $ recipients = ( $ this -> recipients instanceof Collection ) ? $ this -> recipients -> toArray ( ) : $ this -> recipients ; if ( ! is_array ( $ recipients ) ) { return $ recipients ; } $ return = [ ] ; foreach ( $ recipients as ... | notification recipients values getter |
11,566 | public function getVariables ( ) { $ variables = app ( ) -> make ( 'antares.notifications' ) -> all ( ) ; $ extensions = app ( ) -> make ( 'antares.memory' ) -> make ( 'component' ) -> get ( 'extensions.active' ) ; if ( empty ( $ variables ) ) { return [ ] ; } $ return = [ ] ; foreach ( $ variables as $ extension => $ ... | get available variables |
11,567 | public function PreSend ( ) { try { $ this -> mailHeader = "" ; if ( ( count ( $ this -> to ) + count ( $ this -> cc ) + count ( $ this -> bcc ) ) < 1 ) { throw new phpmailerException ( $ this -> Lang ( 'provide_address' ) , self :: STOP_CRITICAL ) ; } if ( ! empty ( $ this -> AltBody ) ) { $ this -> ContentType = 'mul... | Prep mail by constructing all message entities |
11,568 | public function PostSend ( ) { $ rtn = false ; try { switch ( $ this -> Mailer ) { case 'sendmail' : $ rtn = $ this -> SendmailSend ( $ this -> MIMEHeader , $ this -> MIMEBody ) ; break ; case 'smtp' : $ rtn = $ this -> SmtpSend ( $ this -> MIMEHeader , $ this -> MIMEBody ) ; break ; case 'mail' : $ rtn = $ this -> Mai... | Actual Email transport function Send the email via the selected mechanism |
11,569 | public function GetMailMIME ( ) { $ result = '' ; switch ( $ this -> message_type ) { case 'inline' : $ result .= $ this -> HeaderLine ( 'Content-Type' , 'multipart/related;' ) ; $ result .= $ this -> TextLine ( "\tboundary=\"" . $ this -> boundary [ 1 ] . '"' ) ; break ; case 'attach' : case 'inline_attach' : case 'al... | Returns the message MIME . |
11,570 | protected function AttachAll ( $ disposition_type , $ boundary ) { $ mime = array ( ) ; $ cidUniq = array ( ) ; $ incl = array ( ) ; foreach ( $ this -> attachment as $ attachment ) { if ( $ attachment [ 6 ] == $ disposition_type ) { $ bString = $ attachment [ 5 ] ; if ( $ bString ) { $ string = $ attachment [ 0 ] ; } ... | Attaches all fs string and binary attachments to the message . Returns an empty string on failure . |
11,571 | protected function SetError ( $ msg ) { $ this -> error_count ++ ; if ( ( $ this -> Mailer == 'smtp' ) and ( $ this -> smtp !== null ) ) { $ lasterror = $ this -> smtp -> getError ( ) ; if ( ! empty ( $ lasterror ) and array_key_exists ( 'smtp_msg' , $ lasterror ) ) { $ msg .= '<p>' . $ this -> Lang ( 'smtp_error' ) . ... | Adds the error message to the error container . |
11,572 | protected function ServerHostname ( ) { if ( ! empty ( $ this -> Hostname ) ) { $ result = $ this -> Hostname ; } elseif ( isset ( $ _SERVER [ 'SERVER_NAME' ] ) ) { $ result = $ _SERVER [ 'SERVER_NAME' ] ; } else { $ result = 'localhost.localdomain' ; } return $ result ; } | Returns the server hostname or localhost . localdomain if unknown . |
11,573 | public function write_version ( ) { $ this -> _version_written = true ; if ( ! is_null ( $ this -> version ( ) ) ) { return $ this -> writeLine ( 'version: ' . $ this -> version ( ) . PHP_EOL , 'Net_LDAP2_LDIF error: unable to write version' ) ; } } | Write version to LDIF |
11,574 | public function version ( $ version = null ) { if ( $ version !== null ) { if ( $ version != 1 ) { $ this -> dropError ( 'Net_LDAP2_LDIF error: illegal LDIF version set' ) ; } else { $ this -> _options [ 'version' ] = $ version ; } } return $ this -> _options [ 'version' ] ; } | Get or set LDIF version |
11,575 | public function & handle ( ) { if ( ! is_resource ( $ this -> _FH ) ) { $ this -> dropError ( 'Net_LDAP2_LDIF error: invalid file resource' ) ; $ null = null ; return $ null ; } else { return $ this -> _FH ; } } | Returns the file handle the Net_LDAP2_LDIF object reads from or writes to . |
11,576 | public function error ( $ as_string = false ) { if ( Net_LDAP2 :: isError ( $ this -> _error [ 'error' ] ) ) { return ( $ as_string ) ? $ this -> _error [ 'error' ] -> getMessage ( ) : $ this -> _error [ 'error' ] ; } else { return false ; } } | Returns last error message if error was found . |
11,577 | public function parseLines ( $ lines ) { $ attributes = array ( ) ; $ dn = false ; foreach ( $ lines as $ line ) { if ( preg_match ( '/^(\w+(;binary)?)(:|::|:<)\s(.+)$/' , $ line , $ matches ) ) { $ attr = & $ matches [ 1 ] . $ matches [ 2 ] ; $ delim = & $ matches [ 3 ] ; $ data = & $ matches [ 4 ] ; if ( $ delim == '... | Parse LDIF lines of one entry into an Net_LDAP2_Entry object |
11,578 | protected function convertAttribute ( $ attr_name , $ attr_value ) { if ( strlen ( $ attr_value ) == 0 ) { $ attr_value = " " ; } else { $ base64 = false ; $ unsafe_init = array ( 0 , 10 , 13 , 32 , 58 , 60 ) ; $ unsafe = array ( 0 , 10 , 13 ) ; $ init_ord = ord ( substr ( $ attr_value , 0 , 1 ) ) ; if ( $ init_ord > 1... | Convert an attribute and value to LDIF string representation |
11,579 | protected function convertDN ( $ dn ) { $ base64 = false ; $ unsafe_init = array ( 0 , 10 , 13 , 32 , 58 , 60 ) ; $ unsafe = array ( 0 , 10 , 13 ) ; $ init_ord = ord ( substr ( $ dn , 0 , 1 ) ) ; if ( $ init_ord >= 127 || in_array ( $ init_ord , $ unsafe_init ) ) { $ base64 = true ; } for ( $ i = 0 ; $ i < strlen ( $ d... | Convert an entries DN to LDIF string representation |
11,580 | protected function writeAttribute ( $ attr_name , $ attr_values ) { if ( ! is_array ( $ attr_values ) ) { $ attr_values = array ( $ attr_values ) ; } foreach ( $ attr_values as $ attr_val ) { $ line = $ this -> convertAttribute ( $ attr_name , $ attr_val ) . PHP_EOL ; $ this -> writeLine ( $ line , 'Net_LDAP2_LDIF erro... | Writes an attribute to the filehandle |
11,581 | protected function writeDN ( $ dn ) { if ( $ this -> _options [ 'encode' ] == 'base64' ) { $ dn = $ this -> convertDN ( $ dn ) . PHP_EOL ; } elseif ( $ this -> _options [ 'encode' ] == 'canonical' ) { $ dn = Net_LDAP2_Util :: canonical_dn ( $ dn , array ( 'casefold' => 'none' ) ) . PHP_EOL ; } else { $ dn = $ dn . PHP_... | Writes a DN to the filehandle |
11,582 | protected function writeLine ( $ line , $ error = 'Net_LDAP2_LDIF error: unable to write to filehandle' ) { if ( is_resource ( $ this -> handle ( ) ) && fwrite ( $ this -> handle ( ) , $ line , strlen ( $ line ) ) === false ) { $ this -> dropError ( $ error ) ; return false ; } else { return true ; } } | Just write an arbitary line to the filehandle |
11,583 | protected function dropError ( $ msg , $ line = null ) { $ this -> _error [ 'error' ] = new Net_LDAP2_Error ( $ msg ) ; if ( $ line !== null ) $ this -> _error [ 'line' ] = $ line ; if ( $ this -> _options [ 'onerror' ] == 'die' ) { die ( $ msg . PHP_EOL ) ; } elseif ( $ this -> _options [ 'onerror' ] == 'warn' ) { ech... | Optionally raises an error and pushes the error on the error cache |
11,584 | private function getExceptionClass ( $ error ) { $ errors = [ 'PAUSED' => QueuePausedResponseException :: class ] ; $ exceptionClass = ResponseException :: class ; list ( $ errorCode ) = explode ( " " , $ error ) ; if ( ! empty ( $ errorCode ) && isset ( $ errors [ $ errorCode ] ) ) { $ exceptionClass = $ errors [ $ er... | Creates ResponseException based off error |
11,585 | public function publicKey ( ) : PublicKey { $ algo = $ this -> algorithmIdentifier ( ) ; switch ( $ algo -> oid ( ) ) { case AlgorithmIdentifier :: OID_RSA_ENCRYPTION : return RSA \ RSAPublicKey :: fromDER ( $ this -> _publicKeyData ) ; case AlgorithmIdentifier :: OID_EC_PUBLIC_KEY : if ( ! $ algo instanceof ECPublicKe... | Get public key . |
11,586 | public function keyIdentifier64 ( ) : string { $ id = substr ( $ this -> keyIdentifier ( ) , - 8 ) ; $ c = ( ord ( $ id [ 0 ] ) & 0x0f ) | 0x40 ; $ id [ 0 ] = chr ( $ c ) ; return $ id ; } | Get key identifier using method 2 as described by RFC 5280 . |
11,587 | public function set ( $ name , $ callable ) { $ name = ltrim ( $ name , '\\' ) ; $ this -> callables [ $ name ] = $ callable ; unset ( $ this -> instances [ $ name ] ) ; } | Sets a callable to create an object by name ; removes any existing shared instance under that name . |
11,588 | public function get ( $ name ) { $ name = ltrim ( $ name , '\\' ) ; if ( ! isset ( $ this -> instances [ $ name ] ) ) { $ this -> instances [ $ name ] = $ this -> newInstance ( $ name ) ; } return $ this -> instances [ $ name ] ; } | Gets a shared instance by object name ; if it has not been created yet its callable will be invoked and the instance will be retained . |
11,589 | public function newInstance ( $ name ) { $ name = ltrim ( $ name , '\\' ) ; if ( ! $ this -> has ( $ name ) ) { throw new UnexpectedValueException ( $ name ) ; } return call_user_func ( $ this -> callables [ $ name ] , $ this ) ; } | Returns a new instance using the named callable . |
11,590 | public static function fromArray ( array $ arr ) : self { $ prop = $ arr + ( new self ( $ arr [ 'fallback' ] ?? '' ) ) -> toArray ( ) ; return self :: __set_state ( $ prop ) ; } | Returns a new instance from an array . |
11,591 | public function setFallback ( string $ fallback ) : self { $ fallback = trim ( $ fallback ) ; if ( '' === $ fallback ) { throw new Exception ( 'The fallback text can not be empty' ) ; } $ this -> fallback = $ fallback ; return $ this ; } | Returns an instance with the specified fallback . |
11,592 | public function setAuthor ( string $ author_name , $ author_link = '' , $ author_icon = '' ) : self { $ this -> author_name = trim ( $ author_name ) ; $ this -> author_link = filter_uri ( $ author_link , 'author_link' ) ; $ this -> author_icon = filter_uri ( $ author_icon , 'author_icon' ) ; if ( '' === $ this -> autho... | Returns an instance with the specified author . |
11,593 | public function setAuthorName ( string $ author_name ) : self { return $ this -> setAuthor ( $ author_name , $ this -> author_link , $ this -> author_icon ) ; } | Sets the author name . |
11,594 | public function setAuthorLink ( $ author_link ) : self { return $ this -> setAuthor ( $ this -> author_name , $ author_link , $ this -> author_icon ) ; } | Sets the author link URI . |
11,595 | public function setAuthorIcon ( $ author_icon ) : self { return $ this -> setAuthor ( $ this -> author_name , $ this -> author_link , $ author_icon ) ; } | Sets the author name icon URI . |
11,596 | public function setTitle ( string $ title , $ title_link = '' ) : self { $ this -> title = trim ( $ title ) ; $ this -> title_link = filter_uri ( $ title_link , 'title_link' ) ; if ( '' === $ this -> title ) { $ this -> title_link = '' ; } return $ this ; } | Returns an instance with the specified title . |
11,597 | public function setFields ( $ fields ) : self { if ( ! is_iterable ( $ fields ) ) { throw new Exception ( sprintf ( '%s() expects argument passed to be iterable, %s given' , __METHOD__ , gettype ( $ fields ) ) ) ; } $ this -> fields = [ ] ; foreach ( $ fields as $ field ) { $ this -> addField ( ... $ field ) ; } return... | Returns an instance with the specified fields . |
11,598 | public function addField ( string $ title , string $ value , bool $ short = true ) : self { $ this -> fields [ ] = [ 'title' => trim ( $ title ) , 'value' => trim ( $ value ) , 'short' => $ short ] ; return $ this ; } | Returns an instance with the added field to the attachment |
11,599 | public function findToken ( $ search , $ offset = 0 ) { if ( $ search === null ) { throw new \ InvalidArgumentException ( 'A token cannot be searched for with a null value.' ) ; } elseif ( ! is_int ( $ offset ) ) { throw new \ InvalidArgumentException ( 'On offset must be specified as an integer.' ) ; } if ( $ offset >... | Find a token in the tokenizer . You can search by the token s literal code or name . You can also specify on offset for the search . If the offset is negative the search will be done starting from the end . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.