function Parse()
 {
     $dom = new DOMDocument();
     $dom->loadxml($this->xml);
     $toplevel = $dom->getElementsByTagName('toplevel');
     $suggestions = $dom->getElementsByTagName('suggestion');
     foreach ($suggestions as $suggestion) {
         $this->data[] = $suggestion->getAttribute('data');
     }
     $this->link = 'https://www.google.com/#safe=off&q=' . $this->query . '&lr=lang_' . $this->locale;
     $this->Cache();
 }
 /**
  *
  */
 public function Suggest($thisxml)
 {
     $DOMDo = new DOMDocument();
     $DOMDo->loadxml($thisxml);
     $toplevel = $DOMDo->getElementsByTagName('toplevel');
     $Suggest = $DOMDo->getElementsByTagName('suggestion');
     $Data = array();
     foreach ($Suggest as $Suggests) {
         $Data[] = $Suggests->getAttribute('data');
     }
     return $Data;
 }
Example #3
0
/**
 * @package anno
 * This file is part of the Annotum theme for WordPress
 * Built on the Carrington theme framework <http://carringtontheme.com>
 *
 * Copyright 2008-2014 Crowd Favorite, Ltd. All rights reserved. <http://crowdfavorite.com>
 * Released under the GPL license
 * http://www.opensource.org/licenses/gpl-license.php
 */
function anno_validate($content, $schema)
{
    $response = array();
    $response['status'] = '';
    $doc = new DOMDocument();
    libxml_use_internal_errors(true);
    libxml_clear_errors();
    $doc->loadxml($content);
    if (!$doc->relaxNGValidate($schema)) {
        $response['status'] = 'error';
        $errors = libxml_get_errors();
        if (is_array($errors)) {
            foreach ($errors as $libxml_error) {
                $response['errors'][] = array('fullMessage' => sprintf(__('Error on line %d, column %d. %s', 'Error message for validation. %s referes to the error message', 'anno'), $libxml_error->line, $libxml_error->column, str_replace('\\n', '', $libxml_error->message)), 'line' => $libxml_error->line - 1, 'column' => $libxml_error->column, 'message' => str_replace('\\n', '', $libxml_error->message), 'level' => $libxml_error->level);
            }
        }
    } else {
        $response['status'] = 'success';
    }
    return $response;
}
Example #4
0
 /**
  * Try to process the XSLT transformation
  *
  * @param   string  XML to process.
  * @param   string  XSLT sheet to use for the processing.
  *
  * @throws BuildException   On XSLT errors
  */
 protected function process($xml, $xsl)
 {
     $processor = new XSLTProcessor();
     // Create and setup document.
     $xmlDom = new DOMDocument();
     $xmlDom->resolveExternals = $this->resolveDocumentExternals;
     // Create and setup stylesheet.
     $xslDom = new DOMDocument();
     $xslDom->resolveExternals = $this->resolveStylesheetExternals;
     if ($this->html) {
         $xmlDom->loadHTML($xml);
     } else {
         $xmlDom->loadXML($xml);
     }
     $xslDom->loadxml($xsl);
     $processor->importStylesheet($xslDom);
     // ignoring param "type" attrib, because
     // we're only supporting direct XSL params right now
     foreach ($this->xsltParams as $param) {
         $this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), Project::MSG_DEBUG);
         $processor->setParameter(null, $param->getName(), $param->getExpression());
     }
     $errorlevel = error_reporting();
     error_reporting($errorlevel & ~E_WARNING);
     @($result = $processor->transformToXML($xmlDom));
     error_reporting($errorlevel);
     if (false === $result) {
         //$errno = xslt_errno($processor);
         //$err   = xslt_error($processor);
         throw new BuildException("XSLT Error");
     } else {
         return $result;
     }
 }
Example #5
0
 /**
  * Try to process the XSLT transformation
  *
  * @param   string  XML to process.
  * @param   string  XSLT sheet to use for the processing.
  *
  * @throws BuildException   On XSLT errors
  */
 protected function process($xml, $xsl)
 {
     $processor = new XSLTProcessor();
     // Create and setup document.
     $xmlDom = new DOMDocument();
     $xmlDom->resolveExternals = $this->resolveDocumentExternals;
     // Create and setup stylesheet.
     $xslDom = new DOMDocument();
     $xslDom->resolveExternals = $this->resolveStylesheetExternals;
     if ($this->html) {
         $xmlDom->loadHTML($xml);
     } else {
         $xmlDom->loadXML($xml);
     }
     $xslDom->loadxml($xsl);
     if (defined('XSL_SECPREF_WRITE_FILE')) {
         if (version_compare(PHP_VERSION, '5.4', "<")) {
             ini_set("xsl.security_prefs", XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY);
         } else {
             $proc->setSecurityPrefs(XSL_SECPREF_WRITE_FILE | XSL_SECPREF_CREATE_DIRECTORY);
         }
     }
     $processor->importStylesheet($xslDom);
     // ignoring param "type" attrib, because
     // we're only supporting direct XSL params right now
     foreach ($this->xsltParams as $param) {
         $this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), Project::MSG_DEBUG);
         $processor->setParameter(null, $param->getName(), $param->getExpression());
     }
     $errorlevel = error_reporting();
     error_reporting($errorlevel & ~E_WARNING);
     @($result = $processor->transformToXML($xmlDom));
     error_reporting($errorlevel);
     if (false === $result) {
         //$errno = xslt_errno($processor);
         //$err   = xslt_error($processor);
         throw new BuildException("XSLT Error");
     } else {
         return $result;
     }
 }
function showfilelist()
{
    global $verstr;
    ?>
<form action="?action=showfile" method="post" name="updateform">
	<table class="tb" >
	<tr>
	<td width="4%">&nbsp;</td>
	<td width="15%">升级文件</td>
	<td width="15%">更新时间</td>
	<td width="40%">描述信息</td>
	<td width="10%">更新状态</td>
	</tr>
	<?php 
    if (getcheckversion()) {
        $doc = new DOMDocument();
        $doc->formatOutput = true;
        $doc->loadxml($verstr);
        $xmlnode = $doc->documentElement;
        $nodes = $xmlnode->getElementsByTagName("file");
        foreach ($nodes as $node) {
            $filedes = $node->attributes->item(0)->nodeValue;
            $filetime = $node->attributes->item(1)->nodeValue;
            $filesrc = $node->attributes->item(2)->nodeValue;
            ?>
		<tr>
		<td><input type="checkbox" value="<?php 
            echo $filesrc;
            ?>
||||<?php 
            echo $filetime;
            ?>
" name="f_id[]" id="f_id"/></td>
		<td><?php 
            echo replaceStr($filesrc, version, "");
            ?>
</td>
		<td><?php 
            echo $filetime;
            ?>
</td>
		<td><?php 
            echo $filedes;
            ?>
</td>
		<td><?php 
            echo getFileIsUpdate($filesrc, $filetime);
            ?>
</td>
		</tr>
	<?php 
        }
        ?>
	<tr><td colspan="5"><label>全选<input type="checkbox" name="chkall" id="chkall" class="checkbox" onClick="checkAll(this.checked,'f_id[]')" /></label>
	<input class="inputbut" type="submit" value="批量升级" name="Submit">升级前最好备份数据,以免升级失败造成不必要的麻烦!</td></tr>
	<?php 
    } else {
        echo "<tr><td colspan=\"5\" >已经是最新版本,无需升级,请随时关注 www.joyplus.com 官方信息!</td></tr>";
    }
    unset($nodes);
    unset($xmlnode);
    unset($doc);
    ?>
	</table></form></body></html>
<?php 
}
Example #7
0
function update_profile_status()
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_COOKIEJAR, $GLOBALS['cookies']);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $GLOBALS['cookies']);
    curl_setopt($ch, CURLOPT_USERAGENT, $GLOBALS['uagent']);
    curl_setopt($ch, CURLOPT_URL, 'https://m.google.com/app/plus/?v=compose&group=m1c&hideloc=1');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    $buf = utf8_decode(html_entity_decode(str_replace('&', '', curl_exec($ch))));
    $header = curl_getinfo($ch);
    curl_close($ch);
    if ($GLOBALS['debug']) {
        echo $buf;
    }
    $params = '';
    $doc = new DOMDocument();
    $doc->loadxml($buf);
    $inputs = $doc->getElementsByTagName('input');
    foreach ($inputs as $input) {
        if ($input->getAttribute('name') != 'editcircles') {
            $params .= $input->getAttribute('name') . '=' . urlencode($input->getAttribute('value')) . '&';
        }
    }
    $params .= 'newcontent=' . urlencode($GLOBALS['status']);
    //$baseurl = $doc->getElementsByTagName('base')->item(0)->getAttribute('href');
    $baseurl = 'https://m.google.com' . parse_url($header['url'], PHP_URL_PATH);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_COOKIEJAR, $GLOBALS['cookies']);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $GLOBALS['cookies']);
    curl_setopt($ch, CURLOPT_USERAGENT, $GLOBALS['uagent']);
    curl_setopt($ch, CURLOPT_URL, $baseurl . '?v=compose&group=m1c&hideloc=1&a=post');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_REFERER, $baseurl . '?v=compose&group=m1c&hideloc=1');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    $buf = curl_exec($ch);
    $header = curl_getinfo($ch);
    curl_close($ch);
    if ($GLOBALS['debug']) {
        echo $buf;
    }
    echo "\n[+] POST Updating status on: " . $baseurl . "\n\n";
}
 /**
  * Try to process the XSLT transformation
  *
  * @param   string  XML to process.
  * @param   string  XSLT sheet to use for the processing.
  *
  * @throws BuildException   On XSLT errors
  */
 protected function process($xml, $xsl)
 {
     $processor = new XSLTProcessor();
     $xmlDom = new DOMDocument();
     $xslDom = new DOMDocument();
     if ($this->html) {
         $xmlDom->loadHTML($xml);
     } else {
         $xmlDom->loadXML($xml);
     }
     $xslDom->loadxml($xsl);
     $processor->importStylesheet($xslDom);
     // ignoring param "type" attrib, because
     // we're only supporting direct XSL params right now
     foreach ($this->xsltParams as $param) {
         $this->log("Setting XSLT param: " . $param->getName() . "=>" . $param->getExpression(), PROJECT_MSG_DEBUG);
         $processor->setParameter(null, $param->getName(), $param->getExpression());
     }
     $result = $processor->transformToXML($xmlDom);
     if (!$result) {
         //$errno = xslt_errno($processor);
         //$err   = xslt_error($processor);
         throw new BuildException("XSLT Error");
     } else {
         return $result;
     }
 }
$orderline = "";
foreach ($cart as $key => $name) {
    $orderline .= '<orderline productid = "' . $name['ezproduct_sku'] . '">
<quantity>' . $name['number'] . '</quantity>
</orderline>';
}
$doc = new DOMDocument();
$doc->loadxml('<orders partnerid = "717" version = "1">
<ordersession>
<order>
<shippingaddress>
<title>Ms</title>
<firstname>' . $firstname . '</firstname>
<lastname>' . $lastname . '</lastname>
<address1>' . $address1 . '</address1>
<address2>' . $address2 . '</address2>
<city>' . $city . '</city>
<state>' . $state . '</state>
<zip>' . $zip . '</zip>
<countrycode>' . $countrycode . '</countrycode>
</shippingaddress>
' . $orderline . '</order>
</ordersession>
</orders>');
$ezPrintsXML = $doc->saveXML();
// Generate an XML stringto send to EZPrints. $doc is a DOMDocument populated with required EZPrints data. Alternatively the $ezPrintsXML string can be generated manually.
// create a header array that specifies a blank content type.
$header[] = "Content-type:";
// initialize CURL to use the EZPrints URL
$ch = curl_init("http://www.ezprints.com/ezpartners/shippingcalculator/xmlshipcalc.asp");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Example #10
0
function logout()
{
    $dom = new DOMDocument();
    @$dom->loadxml(grab_home());
    $links = $dom->getElementsByTagName('a');
    foreach ($links as $link) {
        if (strpos($link->getAttribute('href'), 'logout.php')) {
            $logout = $link->getAttribute('href');
            break;
        }
    }
    $url = 'https://m.facebook.com' . $logout;
    /*
     * just logout lol
     */
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_COOKIEJAR, $GLOBALS['cookies']);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $GLOBALS['cookies']);
    curl_setopt($ch, CURLOPT_USERAGENT, $GLOBALS['uagent']);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    $loggedout = curl_exec($ch);
    if ($GLOBALS['debug']) {
        echo "\nLogout url = {$url}\n";
        echo $loggedout;
    }
    curl_close($ch);
    echo "\n[i] Logged out.\n";
}
Example #11
0
            foreach ($cart as $key => $name) {
                $orderline .= '<orderline ProjectId="' . $key . '"><quantity>' . $name['number'] . '</quantity></orderline>';
            }
            $doc = new DOMDocument();
            $doc->loadxml('<orders partnerid="717" version="1">
							<ordersession>
							<sessionid>' . $ezopro_id . '</sessionid>
							<order>
							<orderid>' . $ezopro_id . '</orderid>
							<shippingaddress>
							<title>Ms</title>
							<firstname>' . $ship_fname . '</firstname>
							<lastname>' . $ship_lname . '</lastname>
							<address1>' . $ship_address1 . '</address1>
							<address2>' . $ship_address2 . '</address2>
							<city>' . $ship_city . '</city>
							<state>' . $ship_state . '</state>
							<zip>' . $ship_zipcode . '</zip>
							<countrycode>' . $ship_country . '</countrycode>
							<phone>' . $phone . '</phone>
							<email>' . $email . '</email>
							</shippingaddress>
							<shippingmethod>' . $ship_method . '</shippingmethod>
							' . $orderline . '
							</order>
							</ordersession>
							</orders>');
            $ezPrintsXML = $doc->saveXML();
            // Generate an XML stringto send to EZPrints. $doc is a DOMDocument populated with required EZPrints data. Alternatively the $ezPrintsXML string can be generated manually.
            // create a header array that specifies a blank content type.
            $header[] = "Content-type:";
Example #12
0
 function loadTemplate($template)
 {
     if (isset($this->templates[$template])) {
         return $this->templates[$template];
     }
     $data = file_get_contents($template);
     $xml = new DOMDocument();
     $xml->loadxml($data);
     $fields = $xml->getElementsByTagName('field');
     $output = array();
     foreach ($fields as $field) {
         $name = $field->attributes->getNamedItem('name')->nodeValue;
         $type = $field->attributes->getNamedItem('type')->nodeValue;
         $checked = '';
         $default = '';
         $label = '';
         $explanation = '';
         $error = '';
         $transform = '';
         $rules = array();
         $children = $field->childNodes;
         foreach ($children as $child) {
             $nname = $child->nodeName;
             switch ($nname) {
                 case 'checked':
                 case 'default':
                 case 'label':
                 case 'error':
                 case 'explanation':
                 case 'transform':
                     ${$nname} = $child->nodeValue;
                     break;
                 case 'rule':
                     $rule_param = $child->nodeValue;
                     $rule_type = $child->attributes->getNamedItem('type')->nodeValue;
                     switch ($rule_type) {
                         case 'enum':
                         case 'symbols':
                             if (!isset($rules[$rule_type])) {
                                 $rules[$rule_type] = array();
                             }
                             $rules[$rule_type][] = $rule_param;
                             break;
                         default:
                             $rules[$rule_type] = $rule_param;
                     }
                     break;
             }
         }
         $setname = $name;
         $newfield = new fieldtemplate($type, $setname, $label, $explanation);
         if (!empty($error)) {
             $newfield->setError($error);
         }
         if (!empty($transform)) {
             $newfield->setTransform($transform);
         }
         if (!empty($default)) {
             $newfield->default = $default;
         }
         if (!empty($checked)) {
             $newfield->checked = $checked;
         }
         foreach ($rules as $key => $rule) {
             $newfield->setRule($key, $rule);
         }
         if (empty($name)) {
             $output[] = $newfield;
         } else {
             $output[$name] = $newfield;
         }
     }
     return $output;
 }