Set Default XML Decoder

@access public
494331
public function setDefaultXmlDecoder()
    {
        $this->xmlDecoder = function ($response) {
            $xml_obj = @simplexml_load_string($response);
            if (!($xml_obj === false)) {
                $response = $xml_obj;
            }
            return $response;
        };
    }
54195
private function tweak()
    {
        // Ignore recoverable GD errors
        ini_set('gd.jpeg_ignore_warning', 1);

        // Handle error reporting
        if (isset($this->config['production']) && false === $this->config['production']) {
            // Custom exception handler should be registered on NON-AJAX requests only
            $server = $this->input->getServer();

            if (!isset($server['HTTP_X_REQUESTED_WITH'])) {
                // Custom exception handler
                $excepetionHandler = new ExceptionHandler();
                $excepetionHandler->register();
            }

            error_reporting(self::ERR_LEVEL_MAX);
            ini_set('display_errors', 1);

        } else {
            error_reporting(self::ERR_LEVEL_NONE);
        }

        // In most cases, we require UTF-8 as a default charset
        if (!isset($this->config['charset'])) {
            ini_set('default_charset', self::DEFAULT_CHARSET);
            mb_internal_encoding(self::DEFAULT_CHARSET);

        } else {
            ini_set('default_charset', $this->config['charset']);
            mb_internal_encoding($this->config['charset']);
        }

        mb_substitute_character('none');

        // Locale
        if (isset($this->config['locale'])) {
            setlocale(LC_ALL, $this->config['locale']);
        }

        // Timezone
        if (isset($this->config['timezone'])) {
            date_default_timezone_set($this->config['timezone']);
        }

        // And lastly, magic quotes filter
        $mg = new MagicQuotesFilter();

        if ($mg->enabled()) {
            $mg->deactivate();

            $this->input->setQuery($mg->filter($this->input->getQuery()));
            $this->input->setPost($mg->filter($this->input->getPost()));
            $this->input->setCookie($mg->filter($this->input->getCookie()));

            // Third party libraries might use $_REQUEST as well, so we'd better filter this one too
            $this->input->setRequest($mg->filter($this->input->getRequest()));
        }
    }
1353415
function to_xml(){
		if ($this->skip) return false;
		
		$data = array(
			'id' => $this->get_id()
		);
		for ($i=0; $i<sizeof($this->config->text); $i++){
			$extra = $this->config->text[$i]["name"];
			$data[$extra]=$this->data[$extra];
			if (is_null($data[$extra]))
			    $data[$extra] = "";
		}

		if ($this->userdata !== false)
			foreach ($this->userdata as $key => $value){
				if ($value === null)
					$data[$key]="";
				$data[$key]=$value;
			}

		return $data;
	}
1526
public static function setDefaultEncoding($encoding=null)
    {
        if(!is_null($encoding) && is_string($encoding) && !empty($encoding))
        {
            self::$defaultencoding = $encoding;
        }
        else
        {
            self::$defaultencoding = null;
        }
    }
1333271
public function setDefault($default)
    {
        // Since SQL types cannot be completely mapped to PHP types, a loose
        // comparision is required, but changes to/from NULL must be taken into
        // account.
        if (
            $this->_default === null and $default !== null or
            $this->_default !== null and $default === null or
            $this->_default != $default
        ) {
            $this->_default = $default;
            if ($this->_table) {
                $this->_setDefault();
            }
        }
    }
330149
private function DefaultState()
	{
		$this->SkipWhitespace();
		$this->BeginToken();
		$c = $this->Peek( 0 );
		if ( $c == '\0' )
			$this->ConsumeToken1( 0 ); // EOF
		else if ( $c == '.' )
		{
			if ( $this->Peek( 1 ) == '.' )
			{
				$this->Read();
				$this->Read();
				$this->EndToken();
				$this->ConsumeToken1( Token::DOUBLE_PERIOD );
			}
			// else if ( XmlCharType.Instance.IsDigit( $this->Peek( 1 ) ) )
			else if ( preg_match( "/\d/", $this->Peek( 1 ) ) )
			{
				$this->ConsumeNumber();
			}
			else
				$this->ConsumeChar( $this->Read() );
			$this->m_state = LexerState::Operator;
		}
		else if ( $c == ')' )
		{
		    $this->ConsumeChar( $this->Read() );
		    $this->SkipWhitespace();
		    $this->BeginToken();
		    $this->m_state = LexerState::Operator;
		}
		else if ( $c == '*' )
		{
		    $this->ConsumeChar( $this->Read() );
		    if ( $this->Peek( 0 ) == ':' )
		    {
		        $this->BeginToken();
		        $this->ConsumeChar( $this->Read() );
		        $c = $this->Peek( 0 );
		        if ( $c != 0 && preg_match( "/[\p{L}_]/u", $s[0] ) ) // NCName Start char
		            $this->ConsumeNCName();
		        else
		            throw XPath2Exception::withErrorCode( "XPST0003", Resources::ExpectedNCName );
		    }
		    $this->m_state = LexerState::Operator;
		}
		else if ( $c == ';' || $c == ',' || $c == '(' || $c == '-' || $c == '+' || $c == '@' || $c == '~' )
		    $this->ConsumeChar( $this->Read() );
		else if ( $c == '/' )
		{
		    if ( $this->Peek( 1 ) == '/' )
		    {
		        $this->Read();
		        $this->Read();
		        $this->EndToken();
		        $this->ConsumeToken1( Token::DOUBLE_SLASH );
		    }
		    else
		        $this->ConsumeChar( $this->Read() );
		}
		else if ( $this->MatchIdentifer( array( "if", '(' ) ) )
		{
		    $this->EndToken( "if" );
		    $this->ConsumeToken1( Token::IF_TOKEN );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		}
		else if ( $this->MatchIdentifer( "for" ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::FOR_TOKEN );
		    $this->SkipWhitespace();
		    $this->BeginToken();
		    if ( $this->Peek( 0 ) == '$' )
		        $this->ConsumeChar( $this->Read() );
		    else
		        throw XPath2Exception::withErrorCodeAndParam( "XPST0003", Resources::ExpectedVariablePrefix, "for" );
		    $this->m_state = LexerState::VarName;
		}
		else if ( $this->MatchIdentifer( "some" ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::SOME );
		    $this->SkipWhitespace();
		    $this->BeginToken();
		    if ( $this->Peek( 0 ) == '$' )
		        $this->ConsumeChar( $this->Read() );
		    else
		        throw XPath2Exception::withErrorCodeAndParam( "XPST0003", Resources::ExpectedVariablePrefix, "some" );
		    $this->m_state = LexerState::VarName;
		}
		else if ( $this->MatchIdentifer( "every" ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::EVERY );
		    $this->SkipWhitespace();
		    $this->BeginToken();
		    if ( $this->Peek( 0 ) == '$' )
		        $this->ConsumeChar( $this->Read() );
		    else
		        throw XPath2Exception::withErrorCodeAndParam( "XPST0003", Resources::ExpectedVariablePrefix, "every" );
		    $this->m_state = LexerState::VarName;
		}
		else if ( $c == '$' )
		{
		    $this->ConsumeChar( $this->Read() );
		    $this->m_state = LexerState::VarName;
		}
		else if ( $this->MatchIdentifer( array( "element", '(' ) ) )
		{
		    $this->EndToken( "element" );
		    $this->ConsumeToken1( Token::ELEMENT );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "attribute", '(' ) ) )
		{
		    $this->EndToken( "attribute" );
		    $this->ConsumeToken1( Token::ATTRIBUTE );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "schema-element", '(' ) ) )
		{
		    $this->EndToken( "schema-element" );
		    $this->ConsumeToken1( Token::SCHEMA_ELEMENT );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "schema-attribute", '(' ) ) )
		{
		    $this->EndToken( "schema-attribute" );
		    $this->ConsumeToken1( Token::SCHEMA_ATTRIBUTE );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "comment", '(' ) ) )
		{
		    $this->EndToken( "comment" );
		    $this->ConsumeToken1( Token::COMMENT );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "text", '(' ) ) )
		{
		    $this->EndToken( "text" );
		    $this->ConsumeToken1( Token::TEXT );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "node", '(' ) ) )
		{
		    $this->EndToken( "node" );
		    $this->ConsumeToken1( Token::NODE );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "document-node", '(' ) ) )
		{
		    $this->EndToken( "document-node" );
		    $this->ConsumeToken1( Token::DOCUMENT_NODE );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTest;
		}
		else if ( $this->MatchIdentifer( array( "processing-instruction", '(' ) ) )
		{
		    $this->EndToken( "processing-instruction" );
		    $this->ConsumeToken1( Token::PROCESSING_INSTRUCTION );
		    $this->BeginToken( $this->m_bookmark[1] );
		    $this->ConsumeChar( '(' );
		    array_push( $this->m_states, LexerState::Operator );
		    $this->m_state = LexerState::KindTestForPi;
		}
		else if ( $this->MatchIdentifer( array( "ancestor-or-self", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_ANCESTOR_OR_SELF );
		}
		else if ( $this->MatchIdentifer( array( "ancestor", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_ANCESTOR );
		}
		else if ( $this->MatchIdentifer( array( "attribute", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_ATTRIBUTE );
		}
		else if ( $this->MatchIdentifer( array( "child", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_CHILD );
		}
		else if ( $this->MatchIdentifer( array( "descendant-or-self", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_DESCENDANT_OR_SELF );
		}
		else if ( $this->MatchIdentifer( array( "descendant", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_DESCENDANT );
		}
		else if ( $this->MatchIdentifer( array( "following-sibling", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_FOLLOWING_SIBLING );
		}
		else if ( $this->MatchIdentifer( array( "following", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_FOLLOWING );
		}
		else if ( $this->MatchIdentifer( array( "parent", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_PARENT );
		}
		else if ( $this->MatchIdentifer( array( "preceding-sibling", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_PRECEDING_SIBLING );
		}
		else if ( $this->MatchIdentifer( array( "preceding", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_PRECEDING );
		}
		else if ( $this->MatchIdentifer( array( "self", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_SELF );
		}
		else if ( $this->MatchIdentifer( array( "namespace", "::" ) ) )
		{
		    $this->EndToken();
		    $this->ConsumeToken1( Token::AXIS_NAMESPACE );
		}
		else if ( $c == '"' || $c == '\'' )
		{
		    $this->ConsumeLiteral();
		    $this->m_state = LexerState::Operator;
		}
		// else if ( XmlCharType.Instance.IsDigit( $c ) )
		else if ( preg_match( "/\d/", $c ) )
		{
		    $this->ConsumeNumber();
		    $this->m_state = LexerState::Operator;
		}
		else if ( preg_match( "/[\p{L}_]/u", $c ) ) // Start NCName char
		{
		    $sb = array();
		    while ( ( $c = $this->Peek( 0 ) ) && ord( $c ) != 0 && preg_match( "/[\p{L}\p{N}_\-.]/u", $c ) ) // NCName
		        $sb[] = $this->Read();
		    if ( $this->Peek( 0 ) == ':' )
		    {
		        if ( $this->Peek( 1 ) == '*' )
		        {
		            $this->EndToken();
		            $this->ConsumeToken2( Token::NCName, implode( "", $sb ) );
		            $this->BeginToken();
		            $this->ConsumeChar( $this->Read() );
		            $this->BeginToken();
		            $this->ConsumeChar( $this->Read() );
		            $this->m_state = LexerState::Operator;
		        }
		        else
		        {
		            while ( ( $c = $this->Peek( 0 ) ) && ord( $c ) != 0 && preg_match( "/[\p{L}\p{N}_\-.:]/u", $c ) ) // Name char
		                $sb[] = $this->Read();
		            $this->EndToken();
		            $this->ConsumeToken2( Token::QName, implode( "", $sb ) );
		            $this->SkipWhitespace();
		            if ( $this->Peek( 0 ) != '(' )
		                $this->m_state = LexerState::Operator;
		        }
		    }
		    else
		    {
		        $this->EndToken();
		        // $anchor = $this->m_anchor;
		        $length = $this->m_length;
		        $ncname = implode( "", $sb );
		        $this->ConsumeToken2( Token::QName, $ncname );
		        $this->SkipWhitespace();
		        if ( $this->Peek( 0 ) != '(' )
		            $this->m_state = LexerState::Operator;
		    }
		}
		// BMS 2017-06-18	This is added because without it the tokenizer does not handle
		//					valid XPath query with a trailing slash in a filter such as
		//					fn:count($context[5 * /])
		else if ( $c == ']')
		{
			if ( isset( $this->m_priorToken ) )
			{
				if ( $this->m_priorToken->token == '/' )
				{
					$this->ConsumeChar( $this->Read() );
					$this->m_state = array_pop( $this->m_states );
				}
			}
		}
	}
324002
protected function loadXml()
    {
        if (!$this->file || !$this->loadFile($this->file)) {
            $this->setXml('<config></config>');
        }

        return $this;
    }
1181829
private function setDefaults()
    {
        $this->options = [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HEADER => true,
            CURLINFO_HEADER_OUT => true
        ];
    }
666989
private function setDefaultOptions()
    {
        $this->setOptions([
            CURLOPT_SSL_VERIFYPEER => true,
            CURLOPT_HEADER => false,
            CURLOPT_RETURNTRANSFER => true, //=> return response instead of boolean
            CURLOPT_FAILONERROR => false //=> also return an error when there is a http error >= 400
        ]);
    }
118392
function to_xml(){
        if ($this->skip) return "";

        $obj = array();
        $obj['id'] = $this->get_id();
        $obj['start_date'] = $this->data[$this->config->text[0]["name"]];
        $obj[$this->config->text[1]["name"]] = $this->data[$this->config->text[1]["name"]];
        $obj['text'] = $this->data[$this->config->text[2]["name"]];
        for ($i=3; $i<sizeof($this->config->text); $i++){
            $extra = $this->config->text[$i]["name"];
            $obj[$extra]=$this->data[$extra];
        }
        
        if ($this->userdata !== false)
            foreach ($this->userdata as $key => $value)
                $obj[$key]=$value;

        return $obj;
    }
1131206
function xmlString()
    {
        $doc = new DOMDocument( '1.0', 'utf-8' );
        $root = $doc->createElement( "ezmultioption" );
        $root->setAttribute( 'option_counter', $this->OptionCounter );
        $doc->appendChild( $root );

        $nameNode = $doc->createElement( 'name' );
        $nameNode->appendChild( $doc->createTextNode( $this->Name ) );
        $root->appendChild( $nameNode );

        $multiOptionsNode = $doc->createElement( "multioptions" );
        $root->appendChild( $multiOptionsNode );

        foreach ( $this->Options as $multioption )
        {
            unset( $multioptionNode );
            $multioptionNode = $doc->createElement( "multioption" );
            $multioptionNode->setAttribute( "id", $multioption['id'] );
            $multioptionNode->setAttribute( "name", $multioption['name'] );
            $multioptionNode->setAttribute( "priority", $multioption['priority'] );
            $multioptionNode->setAttribute( 'default_option_id', $multioption['default_option_id'] );
            foreach ( $multioption['optionlist'] as $option )
            {
                unset( $optionNode );
                $optionNode = $doc->createElement( "option" );
                $optionNode->setAttribute( "id", $option['id'] );
                $optionNode->setAttribute( "option_id", $option['option_id'] );
                $optionNode->setAttribute( "value", $option['value'] );
                $optionNode->setAttribute( 'additional_price', $option['additional_price'] );
                $multioptionNode->appendChild( $optionNode );
            }
            $multiOptionsNode->appendChild( $multioptionNode );
        }
        $xml = $doc->saveXML();
        return $xml;
    }
100641
public function setDefaultOptions()
    {
        curl_setopt_array($this->curl, [
            CURLOPT_TIMEOUT        => $this->timeout,
            CURLOPT_NOSIGNAL       => $this->nosignal,
            CURLOPT_FILETIME       => $this->fileTime,
            CURLOPT_USERAGENT      => $this->userAgent,
            CURLOPT_HEADER         => $this->header,
            CURLOPT_HTTPHEADER     => $this->headers,
            CURLOPT_RETURNTRANSFER => $this->returnTransfer,
            CURLOPT_SSL_VERIFYPEER => $this->sslVerifyPeer,
            CURLOPT_SSL_VERIFYHOST => $this->sslVerifyHost,
            CURLOPT_FRESH_CONNECT  => $this->freshConnect
        ]);
    }
1191563
public function TShopAuskunftAPI()
    {
        //
        if (!($this->parser = xml_parser_create())) {
            die('Cannot create parser');
        }

        xml_set_object($this->parser, $this);
        xml_set_element_handler($this->parser, 'start_tag', 'end_tag');
        xml_set_character_data_handler($this->parser, 'tag_contents');
    }
900221
public static function setDefault()
    {
        if(!self::$default) {
            $languages = Language::all();
            if($languages) {
                $getDefault = $languages->where('isDefault', true);

                if ($getDefault) {
                    self::$default = $getDefault->first();
                    self::$current = self::$default; //current language is the same as default one in this phase

                    App::setLocale(self::$default->slug);
                    Carbon::setLocale(self::$default->slug);
                    return;
                }
            }

            throw new \Exception("Default language could not be found. Please check if a default language is defined in Administration");
        }
        return;
    }
944119
private static function setDefaults() {
            if (!self::$defaults) {
                self::$defaults =
                    [self::CFG_CSS_PATH           => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' .
                                                     DIRECTORY_SEPARATOR . 'error.min.css',
                     self::CFG_TRACE_MAX_DEPTH    => 50,
                     self::CFG_BACKGROUND         => 'default',
                     self::CFG_FOREGROUND_NOTICE  => 'cyan',
                     self::CFG_FOREGROUND_WARNING => 'yellow',
                     self::CFG_FOREGROUND_ERROR   => 'red',
                     self::CFG_FORCE_HTML         => false];
            }
        }
983787
private function setDefaultValues()
    {
        // Set default payment action.
        if (empty($this->paymentAction)) {
            $this->paymentAction = 'Sale';
        }

        // Set default locale.
        if (empty($this->locale)) {
            $this->locale = 'en_US';
        }

        // Set default value for SSL validation.
        if (empty($this->validateSSL)) {
            $this->validateSSL = false;
        }
    }
1374415
function xmlStartElement($parser,$name,$attribs)
		{
			$this->xmlAttrib[$this->xmlCount] = $attribs;
			$this->xmlName[$this->xmlCount] = $name;
			$this->xmlSData[$this->xmlCount] = '$this->makeTableHeader("xml", "xml element", 2);';
			$this->xmlSData[$this->xmlCount] .= '$this->makeTDHeader("xml", "xmlName");';
			$this->xmlSData[$this->xmlCount] .= 'echo "<strong>' . $this->xmlName[$this->xmlCount] . '</strong>".$this->closeTDRow();';
			$this->xmlSData[$this->xmlCount] .= '$this->makeTDHeader("xml", "xmlAttributes");';
			if(count($attribs) > 0) $this->xmlSData[$this->xmlCount] .= '$this->varIsArray($this->xmlAttrib[' . $this->xmlCount . ']);';
			else $this->xmlSData[$this->xmlCount] .= 'echo "&nbsp;";';
			$this->xmlSData[$this->xmlCount] .= 'echo $this->closeTDRow();';
			$this->xmlCount++;
		}