idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,300 | public function getTranslator ( ) { if ( $ this -> translator === null ) { $ locale = $ this -> getLocaleService ( ) -> getLocale ( ) ; $ this -> translator = new KeekoTranslator ( $ this , $ locale ) ; $ this -> translator -> addLoader ( 'json' , new KeekoJsonTranslationLoader ( $ this ) ) ; $ this -> translator -> se... | Returns the keeko translation service |
56,301 | public function getMailer ( ) { if ( $ this -> mailer === null ) { $ prefs = $ this -> getPreferenceLoader ( ) -> getSystemPreferences ( ) ; switch ( $ prefs -> getMailTransport ( ) ) { case SystemPreferences :: MAIL_TRANSPORT_SMTP : $ transport = new Swift_SmtpTransport ( $ prefs -> getSmtpServer ( ) , $ prefs -> getS... | Returns the mailer to send emails |
56,302 | public function createMessage ( ) { $ prefs = $ this -> getPreferenceLoader ( ) -> getSystemPreferences ( ) ; $ message = new Swift_Message ( ) ; $ sender = $ prefs -> getPlattformEmail ( ) ; if ( ! empty ( $ sender ) ) { $ message -> setFrom ( $ prefs -> getPlattformEmail ( ) , $ prefs -> getPlattformName ( ) ) ; } re... | Creates a new message which can be send with a mailer |
56,303 | public function deleteUserImage ( UserInterface $ user ) { $ file = $ this -> getUserImage ( $ user ) ; if ( is_readable ( $ file ) ) { unlink ( $ file ) ; } } | Deletes if user image exists |
56,304 | public function load ( $ helperName ) { $ helperFilePathUser = ROOT . DS . 'app' . DS . 'helpers' . DS . $ helperName . '.php' ; $ helperFilePathPff = ROOT_LIB . DS . 'src' . DS . 'helpers' . DS . $ helperName . '.php' ; $ found = false ; if ( file_exists ( $ helperFilePathUser ) ) { include_once ( $ helperFilePathUser... | Load an helper file |
56,305 | public function listen ( ) { $ context = stream_context_create ( [ 'socket' => $ this -> options ] ) ; if ( $ this -> getOption ( 'SO_REUSEPORT' ) ) { stream_context_set_option ( $ context , 'socket' , 'so_reuseport' , 1 ) ; } $ flag = $ this -> isUDP ( ) ? STREAM_SERVER_BIND : STREAM_SERVER_BIND | STREAM_SERVER_LISTEN... | create listen socket . |
56,306 | public function acceptUdp ( $ socket ) { $ peer = null ; $ message = stream_socket_recvfrom ( $ socket , $ this -> max_udp_packet_size , 0 , $ peer ) ; if ( ! $ peer || $ message === false || $ message === '' ) { return false ; } $ local = stream_socket_get_name ( $ socket , false ) ; $ event = new UdpMessageEvent ( [ ... | accept udp packet |
56,307 | public function acceptTcp ( $ main_socket ) { $ socket = @ stream_socket_accept ( $ main_socket , 0 , $ remote_address ) ; if ( ! $ socket ) { return ; } $ connection = new Connection ( $ socket , $ this ) ; if ( $ this -> handler ) { $ this -> handler -> attach ( $ connection ) ; } $ this -> handler -> owner = $ this ... | tcp connect established event |
56,308 | public function setConfig ( $ data , $ value ) { if ( is_string ( $ data ) ) { $ this -> _config [ $ data ] = $ value ; } else { throw new ConfigException ( "Error while setting a config value" ) ; } } | Sets a configuration if the configuration already exists it OVERWRITES the old one . |
56,309 | public function append ( ViolationInterface $ violation , $ severity = DestinationInterface :: SEVERITY_ERROR ) { $ exceptions = array ( ) ; $ severity = $ this -> mapSeverity ( $ severity ) ; if ( empty ( $ severity ) ) { return ; } $ this -> violations [ $ severity ] [ ] = $ violation ; foreach ( $ this -> destinatio... | Add a violation to the report . |
56,310 | public function get ( $ severity ) { $ severity = $ this -> mapSeverity ( $ severity ) ; if ( ! isset ( $ this -> violations [ $ severity ] ) ) { return array ( ) ; } return $ this -> violations [ $ severity ] ; } | Get violations of a certain severity . |
56,311 | private function mapSeverity ( $ severity ) { if ( empty ( $ severity ) ) { throw new \ InvalidArgumentException ( 'Invalid severity string' ) ; } if ( array_key_exists ( $ severity , $ this -> severityMap ) ) { return $ this -> severityMap [ $ severity ] ; } return $ severity ; } | Map the severity from the original value to the configured value . |
56,312 | private function addDestinations ( array $ destinations ) { foreach ( $ destinations as $ destination ) { if ( ! $ destination instanceof DestinationInterface ) { throw new \ InvalidArgumentException ( get_class ( $ destination ) . ' is not a valid destination' ) ; } $ this -> destinations [ ] = $ destination ; } } | Add the passed destinations to the report . |
56,313 | public static function init ( $ path , $ environment = null ) { if ( ! static :: $ instance ) static :: $ instance = new Config ( $ path , $ environment ) ; else { static :: $ instance -> path = $ path ; static :: $ instance -> environment = $ environment ; static :: $ instance -> container = array ( ) ; } return stati... | Initialize the Config instance for a specific target path |
56,314 | function getClient ( ) { $ transport = $ this -> getTransport ( ) ; $ transport -> setAuth ( $ this -> username , $ this -> password ) ; return new Client ( $ transport ) ; } | Creates a everyman client based on the configuration parameters . |
56,315 | private function getTransport ( ) { switch ( $ this -> transport ) { case 'stream' : return new Transport \ Stream ( $ this -> host , $ this -> port ) ; case 'curl' : default : return new Transport \ Curl ( $ this -> host , $ this -> port ) ; } } | Gets the transport method . |
56,316 | public function import ( array $ users = array ( ) , $ realm = 'Restricted area' ) { Argument :: i ( ) -> test ( 2 , 'string' ) ; $ this -> realm = $ realm ; $ self = $ this ; return function ( Registry $ request , Registry $ response ) use ( $ users , $ self ) { $ digest = $ request -> get ( 'server' , 'PHP_AUTH_DIGES... | Main plugin method |
56,317 | public function dialog ( ) { if ( ! session_id ( ) ) { session_start ( ) ; } if ( ! isset ( $ _SESSION [ self :: UNAUTHORIZED ] ) ) { $ _SESSION [ self :: UNAUTHORIZED ] = 1 ; } else { $ _SESSION [ self :: UNAUTHORIZED ] ++ ; } if ( $ _SESSION [ self :: UNAUTHORIZED ] < 3 ) { header ( sprintf ( self :: HTTP_AUTH , $ th... | Opens the browsers auth dialig |
56,318 | public function getSignature ( $ users , $ data ) { $ userArray = array ( $ data [ 'username' ] , $ this -> realm , $ users [ $ data [ 'username' ] ] ) ; $ userSignature = md5 ( implode ( ':' , $ userArray ) ) ; $ requestArray = array ( $ _SERVER [ 'REQUEST_METHOD' ] , $ data [ 'uri' ] ) ; $ requestSignature = md5 ( im... | Returns the response siggy |
56,319 | public function digest ( $ string ) { $ needed = array ( 'nonce' => 1 , 'nc' => 1 , 'cnonce' => 1 , 'qop' => 1 , 'username' => 1 , 'uri' => 1 , 'response' => 1 ) ; $ data = array ( ) ; $ keys = implode ( '|' , array_keys ( $ needed ) ) ; preg_match_all ( '@(' . $ keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@' , $ string ... | Extracts data from the siggy |
56,320 | public function match ( $ options , ThemeMatchingContext $ context ) { if ( is_string ( $ options ) ) { $ options = array ( 'name' => $ options ) ; } $ options = $ this -> optionsResolver -> resolve ( $ options ) ; if ( empty ( $ options ) ) { throw new \ InvalidArgumentException ( 'You must at least define one theme l... | Try to find a template name from given options and context . |
56,321 | public function dispatch ( $ object ) { $ handler = $ this -> commandTranslator -> translate ( $ object ) ; return $ this -> app -> make ( $ handler ) -> handle ( $ object ) ; } | To dispatch command |
56,322 | protected function taskClearOpCache ( $ environment = ClearOpCache :: ENV_FCGI , $ host = null ) { return $ this -> task ( ClearOpCache :: class , $ environment , $ host ) ; } | Creates a new ClearOpCache task . |
56,323 | public function parseToken ( $ content , $ position , $ state , TokenList $ tokenList ) { if ( ! empty ( $ content ) ) { $ tokenList -> addToken ( $ this -> name , $ position ) -> set ( 'content' , $ content ) ; } } | Accept all matches |
56,324 | public function runMigrations ( int $ start , int $ end , array $ skip = [ ] ) { RunMigrationsUseCase :: execute ( $ start , $ end , $ skip ) ; } | Allows additional logic to be added before or after migration execution without altering the use case . |
56,325 | public function getByApplicationForEnvironment ( Application $ application , Environment $ environment , $ limit = 25 , $ page = 0 , $ filter = '' ) { $ template = ( $ filter ) ? self :: DQL_BY_APPLICATION_AND_ENV_WITH_REF_FILTER : self :: DQL_BY_APPLICATION_AND_ENV ; $ dql = sprintf ( $ template , Build :: class ) ; $... | Get all builds for an application and environment paged . |
56,326 | private function processRequest ( ) { $ this -> request [ 'resource' ] = ( isset ( $ _GET [ 'RESTurl' ] ) && ! empty ( $ _GET [ 'RESTurl' ] ) ) ? $ _GET [ 'RESTurl' ] : 'index' ; unset ( $ _GET [ 'RESTurl' ] ) ; $ this -> request [ 'method' ] = Inflector :: lower ( $ _SERVER [ 'REQUEST_METHOD' ] ) ; $ this -> request [... | Function processing raw HTTP request headers & body and populates them to class variables . |
56,327 | private function getController ( ) { $ expected = $ this -> request [ 'resource' ] ; foreach ( glob ( APPLICATION_PATH . '/Controllers/*.php' , GLOB_NOSORT ) as $ controller ) { $ controller = basename ( $ controller , '.php' ) ; if ( strnatcasecmp ( $ expected , $ controller ) == 0 ) { return 'Controllers_' . $ contro... | Function to resolve constroller from the Controllers directory based on resource name request . |
56,328 | private function getHeaders ( ) { if ( function_exists ( 'apache_request_headers' ) ) { return apache_request_headers ( ) ; } $ headers = array ( ) ; $ keys = preg_grep ( '{^HTTP_}i' , array_keys ( $ _SERVER ) ) ; foreach ( $ keys as $ val ) { $ key = repl ( ' ' , '-' , ucwords ( Inflector :: lower ( repl ( '_' , ' ' ,... | Function to get HTTP headers |
56,329 | public function getLast ( $ clear = false ) { if ( count ( $ this -> errors ) < 1 ) { return false ; } if ( $ clear ) { $ error = array_shift ( $ this -> errors ) ; return $ error ; } return $ this -> errors [ 0 ] ; } | Get the last error to occur and return it . |
56,330 | public function getAll ( $ clear = false ) { if ( $ clear ) { $ errors = $ this -> errors ; $ this -> clearAll ( ) ; return $ errors ; } return $ this -> errors ; } | Get all of the errors that have occured . |
56,331 | private function configImgSize ( ) { $ settings = Yii :: $ app -> settings ; $ settings -> set ( 'media_configuration' , 'thumbnail_size_width' , $ this -> thumbnail_size_width ) ; $ settings -> set ( 'media_configuration' , 'thumbnail_size_height' , $ this -> thumbnail_size_height ) ; $ settings -> set ( 'media_config... | Config Img size |
56,332 | public function getToString ( ) { $ get = $ this -> allGet ( ) ; $ formatted = array ( ) ; foreach ( $ get as $ name => $ val ) { $ formatted [ ] = "$name=$val" ; } return implode ( '&' , $ formatted ) ; } | Returns a string with all GET parameters as they appear in the URL . |
56,333 | function getFile ( $ slot_name , $ target , $ exts = NULL , $ generate_names = false ) { if ( ! $ target ) { throw new \ Exception ( "Can't move file without destination." ) ; } if ( ! array_key_exists ( $ slot_name , $ _FILES ) ) { return false ; } $ return = false ; if ( is_array ( $ _FILES [ $ slot_name ] [ 'name' ]... | Gets an uploaded file . |
56,334 | public function convertToPHPValue ( $ value , AbstractPlatform $ platform ) { if ( ! $ value || ! is_string ( $ value ) ) { return null ; } $ timepoint = self :: getParsingClock ( ) -> fromString ( $ value , 'Y-m-d H:i:s' ) ; if ( ! $ timepoint ) { throw ConversionException :: conversionFailedFormat ( $ value , $ this ... | Convert database value to TimePoint |
56,335 | public static function getSetting ( $ key , $ secondLevel = null , $ defaultValue = null ) { $ settings = self :: $ settings ; if ( is_object ( $ settings ) ) { $ settings = ( array ) $ settings ; } if ( ! array_key_exists ( $ key , $ settings ) ) { return $ defaultValue ; } if ( $ secondLevel !== null ) { if ( is_obje... | Get a setting value |
56,336 | public static function setViewer ( $ viewerClass ) { if ( ! is_subclass_of ( $ viewerClass , \ Phramework \ Viewers \ IViewer :: class , true ) ) { throw new \ Exception ( 'Class is not implementing Phramework\Viewers\IViewer' ) ; } self :: $ viewer = $ viewerClass ; } | Set viewer class |
56,337 | private static function errorView ( $ errors , $ code = 400 , $ params = null , $ method = null , $ headers = null , $ exception = null ) { if ( ! headers_sent ( ) ) { http_response_code ( $ code ) ; } self :: view ( ( object ) [ 'errors' => $ errors ] ) ; self :: $ stepCallback -> call ( StepCallback :: STEP_ERROR , $... | Output an error |
56,338 | public static function view ( $ parameters = [ ] ) { $ args = func_get_args ( ) ; if ( self :: getMethod ( ) === self :: METHOD_HEAD ) { return ; } $ viewer = new self :: $ viewer ( ) ; $ args [ 0 ] = $ parameters ; return call_user_func_array ( [ $ viewer , 'view' ] , $ args ) ; } | Output the response using the selected viewer |
56,339 | public function getResponse ( Location $ location , $ data ) { if ( null === $ this -> responseProvider ) { throw new BadConfigurationException ( "No Response Provider set in default FormFacade" ) ; } return $ this -> responseProvider -> getResponse ( $ location , $ data ) ; } | Creates HTTP Response to be returned by controller |
56,340 | public function handle ( Eloquent $ model , array $ data , Guard $ auth ) { if ( $ auth -> check ( ) ) { return ; } if ( ! is_null ( $ id = $ this -> getAuthenticatedUser ( $ model ) ) ) { $ auth -> loginUsingId ( $ id , true ) ; } } | Handle user connected via social auth . |
56,341 | function bindWith ( iContextStream $ context ) { $ wrapperName = strtolower ( $ context -> getWrapperName ( ) ) ; $ this -> bindContexts [ $ wrapperName ] = $ context ; return $ this ; } | Bind Another Context Along this |
56,342 | function hasBind ( $ wrapperName ) { $ normalized = strtolower ( $ wrapperName ) ; return ( array_key_exists ( $ normalized , $ this -> bindContexts ) ) ? $ this -> bindContexts [ $ normalized ] : false ; } | Context with specific wrapper has bind? |
56,343 | function toContext ( ) { $ options = new Std \ Type \ StdTravers ( $ this ) ; $ options = $ options -> toArray ( function ( $ val ) { return ( $ val === null ) ; } ) ; $ params = ( isset ( $ options [ 'params' ] ) ) ? $ options [ 'params' ] : array ( ) ; unset ( $ options [ 'params' ] ) ; if ( isset ( $ options [ 'opti... | Creates and returns a stream context with any options supplied in options preset |
56,344 | public function stepInstall ( $ step ) { $ this -> data_step = $ step ; $ this -> data_install = $ this -> session -> get ( 'install' ) ; $ this -> data_handler = $ this -> install -> getHandler ( 'base' ) ; $ this -> controlAccessStepInstall ( ) ; $ this -> submitStepInstall ( ) ; $ this -> setData ( 'status' , $ this... | Displays step pages |
56,345 | protected function controlAccessStepInstall ( ) { if ( ! $ this -> config -> isInitialized ( ) ) { $ this -> redirect ( 'install' ) ; } if ( $ this -> data_step > count ( $ this -> data_handler [ 'steps' ] ) ) { $ this -> redirect ( 'install' ) ; } if ( isset ( $ this -> data_install [ 'data' ] [ 'step' ] ) && ( $ this... | Sets and validates the installation step |
56,346 | public function onSuiteDefine ( Suite $ suite ) { $ definition = new ReflectionFunction ( $ suite -> getDefinition ( ) ) ; $ parameters = $ definition -> getParameters ( ) ; if ( $ parameters ) { $ suite -> setDefinitionArguments ( $ this -> parameterArguments ( $ parameters ) ) ; } } | Handle the definition of a suite . |
56,347 | public function onSuiteStart ( Suite $ suite ) { foreach ( $ suite -> getTests ( ) as $ test ) { $ definition = new ReflectionFunction ( $ test -> getDefinition ( ) ) ; $ parameters = $ definition -> getParameters ( ) ; if ( $ parameters ) { $ test -> setDefinitionArguments ( $ this -> parameterArguments ( $ parameters... | Handle the start of a suite . |
56,348 | public function add ( array $ entry ) { if ( ! isset ( $ entry [ 'msgid' ] ) ) { throw new Exception ( "Invalid entry: missing msgid" ) ; } $ id = $ entry [ 'msgid' ] ; $ plural_id = isset ( $ entry [ 'msgid_plural' ] ) ? $ entry [ 'msgid_plural' ] : null ; $ context = isset ( $ entry [ 'msgctxt' ] ) ? $ entry [ 'msgct... | Add an entry to the catalog . |
56,349 | public function sort ( ) { usort ( $ this -> set , function ( $ first , $ second ) { $ ids = strcmp ( $ first [ 'id' ] , $ second [ 'id' ] ) ; if ( $ ids === 0 ) { if ( $ first [ 'context' ] === null && $ second [ 'context' ] === null ) { return 0 ; } else if ( $ first [ 'context' ] === null ) { return - 1 ; } else if ... | Sort the entries in lexical order . |
56,350 | protected function renderNumberWidget ( $ content , array $ options = [ ] ) { $ options = array_merge ( [ 'precision' => 2 , 'append' => '' , ] , $ options ) ; return $ this -> renderBlock ( 'show_widget_simple' , [ 'content' => trim ( sprintf ( '%s %s' , number_format ( $ content , $ options [ 'precision' ] , ',' , ' ... | Renders the number widget . |
56,351 | protected function renderTextareaWidget ( $ content , array $ options = [ ] ) { $ options = array_replace ( [ 'html' => false , ] , $ options ) ; return $ this -> renderBlock ( 'show_widget_textarea' , [ 'content' => $ content , 'options' => $ options , ] ) ; } | Renders the textarea widget . |
56,352 | protected function renderEntityWidget ( $ entities , array $ options = [ ] ) { if ( ! array_key_exists ( 'field' , $ options ) ) { $ options [ 'field' ] = null ; } if ( ! array_key_exists ( 'route' , $ options ) ) { $ options [ 'route' ] = null ; } if ( ! array_key_exists ( 'route_params' , $ options ) ) { $ options [ ... | Renders the entity widget . |
56,353 | protected function renderUrlWidget ( $ content , array $ options = [ ] ) { $ vars = [ 'target' => isset ( $ options [ 'target' ] ) ? $ options [ 'target' ] : '_blank' , 'content' => $ content ] ; return $ this -> renderBlock ( 'show_widget_url' , $ vars ) ; } | Renders the url widget . |
56,354 | protected function renderDatetimeWidget ( $ content , array $ options = [ ] ) { if ( ! array_key_exists ( 'time' , $ options ) ) { $ options [ 'time' ] = true ; } if ( ! array_key_exists ( 'date_format' , $ options ) ) { $ options [ 'date_format' ] = 'short' ; } if ( ! array_key_exists ( 'time_format' , $ options ) ) {... | Renders the datetime widget . |
56,355 | protected function renderTinymceWidget ( $ content , array $ options = [ ] ) { $ height = isset ( $ options [ 'height' ] ) ? intval ( $ options [ 'height' ] ) : 0 ; if ( 0 >= $ height ) { $ height = 250 ; } return $ this -> renderBlock ( 'show_widget_tinymce' , [ 'height' => $ height , 'route' => $ content ] ) ; } | Renders a tinymce widget . |
56,356 | protected function renderMediasWidget ( Collection $ medias , array $ options = [ ] ) { $ medias = array_map ( function ( $ m ) { return $ m -> getMedia ( ) ; } , $ medias -> toArray ( ) ) ; return $ this -> renderBlock ( 'show_widget_medias' , [ 'medias' => $ medias ] ) ; } | Renders the medias widget . |
56,357 | protected function renderCoordinateWidget ( Coordinate $ coordinate = null , array $ options = [ ] ) { $ map = new Map ( ) ; $ map -> setAutoZoom ( true ) ; $ map -> setMapOptions ( [ 'minZoom' => 3 , 'maxZoom' => 18 , 'disableDefaultUI' => true , ] ) ; $ map -> setStylesheetOptions ( [ 'width' => '100%' , 'height' => ... | Renders the coordinate widget . |
56,358 | public function register ( $ postType , $ className ) { if ( ! is_subclass_of ( $ className , 'Tev\Post\Model\AbstractPost' ) ) { throw new Exception ( "Given class '$className' is not instance of 'Tev\Post\Model\AbstractPost'" ) ; } $ this -> registeredMappings [ $ postType ] = $ className ; return $ this ; } | Register a new post type to class name mapping . |
56,359 | public function registered ( $ postType ) { if ( isset ( $ this -> registeredMappings [ $ postType ] ) ) { return $ this -> registeredMappings [ $ postType ] ; } return null ; } | Get the registered class name for the given post type . |
56,360 | public function create ( $ base = null , $ className = null ) { if ( $ base === null ) { if ( have_posts ( ) ) { the_post ( ) ; $ base = get_post ( ) ; } else { throw new Exception ( 'Please supply a post object when not within The Loop' ) ; } } $ cls = 'Tev\Post\Model\Post' ; if ( ( $ className !== null ) && is_subcla... | Instantiate a post entity from a given post object . |
56,361 | public function current ( $ className = null ) { if ( $ p = get_post ( ) ) { return $ this -> create ( $ p , $ className ) ; } else { throw new Exception ( 'This method can only be called within The Loop' ) ; } } | Instantiate a post entity from the current post object . |
56,362 | public function slugify ( $ string , $ removeWesternEuropeanAccents = true , $ separator = '-' ) { $ slug = trim ( $ string ) ; if ( $ removeWesternEuropeanAccents ) { $ slug = htmlentities ( $ slug , ENT_NOQUOTES , 'UTF-8' ) ; $ slug = preg_replace ( '/&#?([a-zA-Z])[a-zA-Z0-9]*;/i' , '${1}' , $ slug ) ; } $ slug = ico... | Generates slug from string |
56,363 | public static function generateKeys ( $ seed = null , $ hashKey = '' ) { if ( $ seed !== null ) { $ encrHash = Hash :: hash ( $ seed , $ hashKey , Constants :: BOX_SEEDBYTES ) ; $ signHash = Hash :: hash ( $ seed , $ hashKey , Constants :: SIGN_SEEDBYTES ) ; $ seeds = [ 'encr' => \ Sodium \ crypto_box_keypair ( $ encrH... | Returns a new set of keys for message encryption and signing . |
56,364 | public static function encrypt ( $ message , $ sender_private , $ receiver_public ) { Helpers :: isString ( $ message , 'PublicKeyEncryption' , 'encrypt' ) ; Helpers :: isString ( $ sender_private , 'PublicKeyEncryption' , 'encrypt' ) ; Helpers :: isString ( $ receiver_public , 'PublicKeyEncryption' , 'encrypt' ) ; $ m... | Encrypt a message using public key encryption . |
56,365 | public static function decrypt ( $ message , $ sender_public , $ receiver_private ) { Helpers :: isString ( $ message , 'PublicKeyEncryption' , 'decrypt' ) ; Helpers :: isString ( $ sender_public , 'PublicKeyEncryption' , 'decrypt' ) ; Helpers :: isString ( $ receiver_private , 'PublicKeyEncryption' , 'decrypt' ) ; $ m... | Decrypt a public key encrypted message . |
56,366 | private function loadConfig ( $ parsedConfig ) { if ( isset ( $ parsedConfig [ 'moduleConf' ] [ 'Type' ] ) && $ parsedConfig [ 'moduleConf' ] [ 'Type' ] == "smtp" ) { $ this -> transport = \ Swift_SmtpTransport :: newInstance ( ) ; if ( isset ( $ parsedConfig [ 'moduleConf' ] [ 'Host' ] ) && $ parsedConfig [ 'moduleCon... | Parse the configuration file |
56,367 | public function isValidFtpSettings ( ) { $ cfg = Mage :: helper ( 'radial_core' ) -> getConfigModel ( ) ; return trim ( $ cfg -> sftpUsername ) && trim ( $ cfg -> sftpLocation ) && ( ( $ cfg -> sftpAuthType === 'password' && trim ( $ cfg -> sftpPassword ) ) || ( $ cfg -> sftpAuthType === 'pub_key' && trim ( $ cfg -> sf... | Validate sftp settings by simply checking if there s actual setting data . |
56,368 | public function extractNodeAttributeVal ( DOMNodeList $ nodeList , $ attributeName ) { return ( $ nodeList -> length ) ? $ nodeList -> item ( 0 ) -> getAttribute ( $ attributeName ) : null ; } | extract node attribute value |
56,369 | public function createDir ( $ dir ) { $ oldMask = umask ( 0 ) ; @ mkdir ( $ dir , self :: PERMISSION , true ) ; umask ( $ oldMask ) ; } | abstracting creating dir |
56,370 | public function moveFile ( $ source , $ destination ) { @ rename ( $ source , $ destination ) ; if ( ! $ this -> isFileExist ( $ destination ) ) { throw new EbayEnterprise_Catalog_Exception_Feed_File ( "Can not move $source to $destination" ) ; } } | abstracting moving a file |
56,371 | public function getFileTimeElapse ( $ sourceFile ) { $ date = Mage :: getModel ( 'core/date' ) ; $ timeZone = $ this -> getNewDateTimeZone ( ) ; $ startDate = $ this -> getNewDateTime ( $ date -> gmtDate ( 'Y-m-d H:i:s' , $ this -> loadFile ( $ sourceFile ) -> getCTime ( ) ) , $ timeZone ) ; $ interVal = $ startDate ->... | getting how long ago a file has been modified or created in minutes |
56,372 | public function getBaseUrl ( $ type = Mage_Core_Model_Store :: URL_TYPE_LINK , $ secure = null ) { return Mage :: getBaseUrl ( $ type , $ secure ) ; } | abstracting getting store configuration flag |
56,373 | public function getDiscountId ( $ appliedRuleIds ) { $ cfg = Mage :: helper ( 'radial_core' ) -> getConfigModel ( ) ; $ ids = explode ( ',' , $ appliedRuleIds ) ; $ ruleId = ! empty ( $ ids ) ? $ ids [ 0 ] : 0 ; return sprintf ( '%.12s' , $ cfg -> storeId . '-' . $ ruleId ) ; } | Expect a comma delimited string of applied salesrule ids and the first rule id will be concatenated to a string of configured store id and a dash . The result string will be truncated to only 12 characters if exceeded . |
56,374 | public function parseBool ( $ s ) { if ( ! is_string ( $ s ) ) { return ( bool ) $ s ; } $ result = false ; switch ( strtolower ( $ s ) ) { case '1' : case 'on' : case 't' : case 'true' : case 'y' : case 'yes' : $ result = true ; break ; } return $ result ; } | Parse a string into a boolean . |
56,375 | public function extractXmlToArray ( DOMNode $ contextNode , array $ mapping , DOMXPath $ xpath ) { $ data = [ ] ; $ coreHelper = Mage :: helper ( 'radial_core' ) ; foreach ( $ mapping as $ key => $ callback ) { if ( $ callback [ 'type' ] !== 'disabled' ) { $ result = $ xpath -> query ( $ callback [ 'xpath' ] , $ contex... | Extract data from a passed in DOMNode using an array containing mapping of how to extract the data . |
56,376 | public function getSdkApi ( $ service , $ operation , array $ endpointParams = [ ] , LoggerInterface $ logger = null ) { $ timeout = Mage :: getStoreConfig ( 'radial_core/payments/responsetimeout' ) ; $ config = $ this -> getConfigModel ( ) ; $ apiLogger = $ logger ? : $ this -> _logger ; $ apiConfig = new Api \ HttpCo... | Create a new ROM SDK API object . API will be configured with core configuration and the service and operation provided . |
56,377 | public function invokeCallback ( array $ meta ) { if ( empty ( $ meta ) ) { return null ; } $ parameters = isset ( $ meta [ 'parameters' ] ) ? $ meta [ 'parameters' ] : [ ] ; switch ( $ meta [ 'type' ] ) { case 'model' : return call_user_func_array ( [ Mage :: getModel ( $ meta [ 'class' ] ) , $ meta [ 'method' ] ] , $... | Call a class static method based on the meta data in the given array . |
56,378 | public function getQuoteCouponCode ( Mage_Sales_Model_Quote $ quote , Mage_SalesRule_Model_Rule $ rule ) { $ codeAppliedToQuote = $ quote -> getCouponCode ( ) ; $ codeInRule = $ rule -> getCouponCode ( ) ; return $ codeAppliedToQuote === $ codeInRule ? $ codeAppliedToQuote : $ this -> getCodeFromCouponPool ( $ rule , $... | Get the applied coupon code on the quote for the passed in rule . |
56,379 | public function afterUpdate ( $ event ) { $ oldCondition = [ ] ; $ currentCondition = [ ] ; $ owner = $ this -> owner ; foreach ( ( array ) $ this -> conditionAttributes as $ attribute ) { if ( ! $ owner -> hasAttribute ( $ attribute ) ) { continue ; } $ oldCondition [ $ attribute ] = $ currentCondition [ $ attribute ]... | After update event |
56,380 | public function getMaxSort ( ) { if ( $ this -> _max === null ) { $ this -> _max = $ this -> owner -> find ( ) -> andWhere ( $ this -> getCondition ( ) ) -> count ( ) - 1 ; } return $ this -> _max ; } | Get maximal sort index |
56,381 | protected function getCondition ( ) { $ condition = [ 'and' ] ; foreach ( ( array ) $ this -> conditionAttributes as $ attribute ) { if ( $ this -> owner -> hasAttribute ( $ attribute ) ) { $ condition [ ] = [ $ attribute => $ this -> owner -> $ attribute ] ; } } return $ condition ; } | Get WHERE condition for sort change query |
56,382 | public function relativeMove ( $ model , $ position ) { $ conditionAttributes = ( array ) $ this -> conditionAttributes ; $ owner = $ this -> owner ; if ( ! empty ( $ conditionAttributes ) ) { $ sameCondition = true ; foreach ( $ conditionAttributes as $ attr ) { if ( $ owner -> getAttribute ( $ attr ) != $ model -> ge... | Move model relative other |
56,383 | public function setExpression ( CronExpression $ expression ) { $ this -> minute = $ expression -> getExpression ( 0 ) ; $ this -> hour = $ expression -> getExpression ( 1 ) ; $ this -> day = $ expression -> getExpression ( 2 ) ; $ this -> month = $ expression -> getExpression ( 3 ) ; $ this -> weekday = $ expression -... | set cron expression for this schedule |
56,384 | public static function generate ( array $ authors ) { $ newAuthors = [ ] ; foreach ( $ authors as $ author ) { $ newAuthors [ ] = ( object ) $ author ; } return $ newAuthors ; } | Generates a new array of authors where each item is an object . |
56,385 | public static function createZip ( $ destination , $ files = [ ] , $ blobs = [ ] , $ overwrite = true ) { if ( ! class_exists ( 'ZipArchive' ) ) { throw new \ Exception ( 'cannot_create_zip_archive' ) ; } if ( file_exists ( $ destination ) && ! $ overwrite ) { return false ; } $ zip = new ZipArchive ( ) ; if ( $ zip ->... | Create a zip archive |
56,386 | public function isAjax ( ) { $ headers = apache_request_headers ( ) ; $ is_ajax = ( isset ( $ headers [ 'X-Requested-With' ] ) && $ headers [ 'X-Requested-With' ] == 'XMLHttpRequest' ) ; return $ is_ajax ? true : false ; } | To check request is ajax |
56,387 | public function input ( $ fieldName ) { if ( $ this -> isMethod ( 'post' ) ) { return ( isset ( $ _POST [ $ fieldName ] ) ) ? $ _POST [ $ fieldName ] : '' ; } if ( $ this -> isMethod ( 'get' ) ) { return ( isset ( $ _GET [ $ fieldName ] ) ) ? $ _GET [ $ fieldName ] : '' ; } if ( $ this -> isMethod ( 'put' ) ) { parse_s... | To get value from a request |
56,388 | public function old ( $ fieldName ) { if ( $ this -> isMethod ( 'get' ) && $ this -> session -> has ( 'planet_oldInput' ) ) { $ oldInput = $ this -> session -> get ( 'planet_oldInput' ) ; return ( $ oldInput != null ) ? $ oldInput [ $ fieldName ] : '' ; } } | To get old input value |
56,389 | public function all ( ) { if ( $ this -> isMethod ( 'POST' ) ) { return ( isset ( $ _POST ) ) ? $ _POST : [ ] ; } if ( $ this -> isMethod ( 'GET' ) ) { return ( isset ( $ _GET ) ) ? $ _GET : [ ] ; } } | To get all values from a request |
56,390 | public function get ( $ name ) { return ( $ this -> session -> has ( $ name ) ) ? $ this -> session -> get ( $ name ) : '' ; } | To get request data from session |
56,391 | public function getType ( $ value ) { if ( strpos ( $ value , '\\' ) !== false && class_exists ( $ value ) ) { return self :: TYPE_CLASS ; } else { return self :: TYPE_SCALAR ; } } | for the beginning keep it simple - > is a new object or just a value |
56,392 | private function applyDefaultSettings ( QrCode $ qrCode ) { $ qrCode -> setMargin ( 0 ) ; $ qrCode -> setEncoding ( 'UTF-8' ) ; $ qrCode -> setErrorCorrectionLevel ( new ErrorCorrectionLevel ( ErrorCorrectionLevel :: HIGH ) ) ; $ qrCode -> setRoundBlockSize ( true ) ; $ qrCode -> setValidateResult ( false ) ; $ qrCode ... | Apply Default Settings |
56,393 | public function handle ( ) { $ subject = \ Skeleton \ Error \ Handler \ Basic :: get_subject ( $ this -> exception ) ; $ message = \ Skeleton \ Error \ Handler \ Basic :: get_html ( $ this -> exception ) ; $ headers = 'From: ' . \ Skeleton \ Error \ Config :: $ mail_errors_from . "\r\n" ; $ headers .= 'Content-Type: te... | Handle an error by sending mail |
56,394 | public static function not_found ( $ message = false ) { if ( ! $ message ) { $ message = "Resource not found" ; } Response :: $ status = 404 ; Response :: $ data = array ( "error" => $ message ) ; } | not_found function . |
56,395 | public static function flushFailed ( SplFileObject $ file , Exception $ previous = null ) { return new self ( sprintf ( 'The file "%s" could not be flushed.' , $ file -> getPathname ( ) ) , 0 , $ previous ) ; } | Creates an exception for a failed flush . |
56,396 | public function convertRuneMetrics ( string $ data ) : array { $ data = @ json_decode ( $ data ) ; if ( ! $ data ) { throw new DataConversionException ( "Could not decode RuneMetrics API response." ) ; } if ( isset ( $ data -> error ) ) { throw new DataConversionException ( "RuneMetrics API returned an error. User migh... | KEY_REAL_NAME KEY_SKILL_HIGH_SCORE KEY_ACTIVITY_FEED |
56,397 | public function resolve ( ) { $ originFile = $ this -> file -> getPhysicalFile ( ) ; $ this -> filesystem -> mkdir ( $ relatedDestDir = sprintf ( '%s/%s' , dirname ( $ originFile -> getRealPath ( ) ) , $ this -> inflector -> slugify ( $ this -> format -> getId ( ) , '_' ) ) ) ; $ this -> formatter -> open ( $ originFil... | FormattedImage creation method . |
56,398 | protected static function create ( array $ element ) { $ class = self :: getClassName ( $ element [ 'type' ] ) ; $ object = new $ class ; if ( $ object instanceof ContainerInterface ) { static :: execute ( $ object , $ element ) ; } return $ object ; } | Recursively creates the elements to add to the form |
56,399 | protected static function populateInputs ( ElementInterface $ input , array $ data ) { if ( $ input instanceof InputInterface ) { self :: addLabel ( $ input , $ data ) ; self :: addValidators ( $ input , $ data ) ; self :: setFilters ( $ input , $ data ) ; self :: addOptions ( $ input , $ data ) ; if ( isset ( $ data [... | Sets the properties and dependencies for input elements |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.