function doInstall() { loadCoreFile('obj_xml.php'); $parser = new xml_doc(file_get_contents(CUSTOMER_ACCOUNT_INSTALL_DATA_XML)); $parser->parse(); $groups_ids = array(); $attrs_ids = array(); foreach ($parser->xml_index as $tag) { if ($tag->name == 'CUSTOMER_ACCOUNT_INSTALL_DATA') { foreach ($tag->children as $id_child) { switch ($id_child->name) { case 'PERSON_INFO_GROUPS': $groups_ids = $this->__install_ProcessPersonInfoGroups($id_child); break; case 'PERSON_INFO_ATTRS': $attrs_ids = $this->__install_ProcessPersonInfoAttrs($id_child); break; case 'ATTRS_TO_GROUPS': $this->__install_ProcessAttrsToGroups($id_child, $groups_ids, $attrs_ids); break; case 'SETTINGS': $this->__install_ProcessSettings($id_child); break; } } } } $this->__install_AddAttrsVisibleNames(); $this->__install_addEventsHandlers(); return; }
function doInstall() { loadCoreFile('obj_xml.php'); $parser = new xml_doc(file_get_contents(NOTIFICATIONS_INSTALL_DATA_XML_FILE)); $parser->parse(); foreach ($parser->xml_index as $tag) { if ($tag->name == 'NOTIFICATIONS_INSTALL_DATA') { foreach ($tag->children as $id_child) { switch ($id_child->name) { case 'INFOTAGS': $this->__install_ProcessInfotags($id_child); break; case 'BLOCKTAGS': $this->__install_ProcessBlocktags($id_child); break; case 'ACTIONS': $this->__install_ProcessActions($id_child); break; case 'NOTIFICATIONS': $this->__install_ProcessNotifications($id_child); break; } } } } $this->__install_addEventsHandlers(); return; }
function __readScriptsDefinition() { loadCoreFile('obj_xml.php'); $parser = new xml_doc(file_get_contents(DC_SCRIPTS_DEFINITION_FILE)); $parser->parse(); foreach ($parser->xml_index as $tag) { if ($tag->name == 'SCRIPTS') { foreach ($tag->children as $scripts_child) { if ($scripts_child->name == 'SCRIPT') { $script_info = array('steps' => array()); $script_code = ''; foreach ($scripts_child->children as $script_child) { switch ($script_child->name) { case 'CODE': $script_code = $script_child->contents; break; case 'NAME': $script_info[_ml_strtolower($script_child->name)] = $script_child->contents; break; case 'STEPS': $script_info['steps_count'] = $script_child->contents; break; case 'STEP': $step_info = array(); $step_number = 0; foreach ($script_child->children as $step_child) { switch ($step_child->name) { case 'NUMBER': $step_number = $step_child->contents; break; case 'READER': case 'FILTER': case 'WRITER': $step_info[_ml_strtolower($step_child->name)] = $step_child->contents; break; } } if ($step_number > 0) { $script_info['steps'][$step_number] = $step_info; } break; } } if ($script_code != '') { $this->_scripts_definition[$script_code] = $script_info; } } } } } }
function _process_request(&$xml_request, &$default_response) { $xml_request = urlencode($xml_request); loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->setMethod(UPDATESERVER_METHOD); $bnc->setURL(UPDATESERVER_PROTO . '://' . UPDATESERVER_HOST_PATH . '?xml=' . $xml_request); switch (UPDATESERVER_METHOD) { case "GET": $bnc->setURL(UPDATESERVER_PROTO . '://' . UPDATESERVER_HOST_PATH . '?xml=' . $xml_request); break; case "POST": $bnc->setURL(UPDATESERVER_PROTO . '://' . UPDATESERVER_HOST_PATH); $bnc->setPOSTstring($bnc->prepareDATAstring(array("xml" => $xml_request))); break; } $result = $bnc->RunRequest(); if ($result == false) { return false; } //die(print_r($result['body'], true)); loadCoreFile('obj_xml.php'); $xml = new xml_doc($result['body']); //die(print_r($result['body'], true)); $xml->parse(); if (!is_object($xml->document)) { return false; } //die(print_r($xml->document,true)); foreach ($default_response as $key => $val) { $xml_tag = $xml->document->findChild($key); if ($xml_tag != FALSE) { $default_response[$key] = $xml_tag->contents; } } //die(print_r($default_response,true)); return $default_response; }
function getChartSettings() { loadCoreFile('obj_xml.php'); $xml = new xml_doc(); $root = $xml->createTag('settings'); $xml->createTag('font', array(), 'Tahoma', $root); // $legend = $xml->createTag('legend', array(), '', $root); $xml->createTag('enabled', array(), 'false', $legend); // - , $column = $xml->createTag('column', array(), '', $root); $xml->createTag('gradient', array(), 'horizontal', $column); // $xml->createTag('width', array(), $this->column_width_percent, $column); // - , $xml->createTag('data_labels', array(), '<![CDATA[<b>{value}</b>]]>', $column); $xml->createTag('data_labels_text_color', array(), '#404040', $column); $xml->createTag('data_labels_text_size', array(), '', $column); $xml->createTag('data_labels_position', array(), 'above', $column); // - , $xml->createTag('text_size', array(), '11', $root); // X - $values = $xml->createTag('values', array(), '', $root); $category = $xml->createTag('category', array(), '', $values); $xml->createTag('rotate', array(), '90', $category); // $value = $xml->createTag('value', array(), '', $values); $xml->createTag('min', array(), 0, $value); $xml->createTag('unit', array(), urlencode($this->unit), $value); $xml->createTag('unit_position', array(), $this->unit_position, $value); $labels = $xml->createTag('labels', array(), '', $root); $label = $xml->createTag('label', array(), '', $labels); $xml->createTag('text', array(), '<![CDATA[<b>' . $this->title . '</b>]]>', $label); $xml->createTag('text_size', array(), '11', $label); $xml->createTag('text_color', array(), '666666', $label); $xml->createTag('align', array(), 'center', $label); // (title) $xml->createTag('y', array(), '17', $label); $plot_area = $xml->createTag('plot_area', array(), '', $root); // $xml->createTag('color', array(), '#F6F6F6', $plot_area); $xml->createTag('alpha', array(), '100', $plot_area); // Y (5 '1000%') $margins = $xml->createTag('margins', array(), '', $plot_area); $xml->createTag('left', array(), '80', $margins); $xml->createTag('bottom', array(), $this->__getBottomHeight(), $margins); $xml->createTag('top', array(), '35', $margins); $xml_doc = $xml->generate(); $xml_doc = $this->getAmchartsXML($xml_doc); return $xml_doc; }
function __getRateFromWebServiceX($from, $to) { loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->setHTTPversion("1.0"); $bnc->setMethod("GET"); $bnc->setURL("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate"); $bnc->setSocketReadTimeout(10); $get_params = array("FromCurrency" => $from, "ToCurrency" => $to); $bnc->setGETstring($bnc->prepareDATAstring($get_params)); $res = $bnc->RunRequest(); if ($res != false) { $xml = $res["body"]; loadCoreFile('obj_xml.php'); $parser = new xml_doc($xml); $parser->parse(); foreach ($parser->xml_index as $node) { if ($node->name = "DOUBLE") { $rate = $node->contents; if ($rate == 0) { $rate = false; } $this->__addRequestToTimeline('www.webservicex.net', $from, $to, $rate, $bnc, $res); return $rate; } } } $this->__addRequestToTimeline('www.webservicex.net', $from, $to, false, $bnc, $res); return false; }
function getChartSettings() { loadCoreFile('obj_xml.php'); $xml = new xml_doc(); $root = $xml->createTag('settings'); // <max_series></max_series> //$xml->createTag('max_series', array(), 0, $root); $xml->createTag('text_size', array(), $this->text_size, $root); $xml->createTag('margins', array(), '0', $root); // , $xml->createTag('equal_spacing', array(), 'false', $root); // : $data_sets = $xml->createTag('data_sets', array(), '', $root); $data_set = $xml->createTag('data_set', array(), '', $data_sets); $xml->createTag('file_name', array(), urlencode($this->csv_file_url), $data_set); $csv = $xml->createTag('csv', array(), '', $data_set); $xml->createTag('reverse', array(), 'true', $csv); $xml->createTag('separator', array(), ';', $csv); $xml->createTag('date_format', array(), 'YYYY-MM-DD', $csv); $xml->createTag('decimal_separator', array(), '.', $csv); $columns = $xml->createTag('columns', array(), '', $csv); // $xml->createTag('column', array(), 'date', $columns); for ($i = 1; $i <= $this->ncharts; $i++) { $xml->createTag('column', array(), $this->graph_csv_prefix . $i, $columns); } // . , // , . // . // $h2 - timeline // $h1 - // , , $h1 // $h1+$h2 $h2 = 1.6 * $this->text_size; $h = $this->height; $h1 = (int) floor(1.0 * ($h - $h2) / (1.0 * $this->ncharts)); // : $charts = $xml->createTag('charts', array(), '', $root); for ($i = 1; $i <= $this->ncharts; $i++) { $chart = $xml->createTag('chart', array(), '', $charts); $n = $this->ncharts; $xml->createTag('title', array(), $this->graph_titles[$i - 1], $chart); $xml->createTag('border_color', array(), '#CCCCCC', $chart); $xml->createTag('border_alpha', array(), '100', $chart); $grid = $xml->createTag('grid', array(), '', $chart); $x = $xml->createTag('x', array(), '', $grid); $xml->createTag('enabled', array(), 'true', $x); $values = $xml->createTag('values', array(), '', $chart); $x = $xml->createTag('x', array(), '', $values); // if ($i == $this->ncharts) { $xml->createTag('height', array(), "" . (int) (100.0 * ($h1 + $h2) / $h), $chart); $xml->createTag('enabled', array(), 'true', $x); } else { $xml->createTag('height', array(), "" . (int) (100.0 * $h1 / $h), $chart); $xml->createTag('enabled', array(), 'false', $x); } $xml->createTag('bg_color', array(), '#EEEEEE', $x); $xml->createTag('color', array(), '#000000', $x); $legend = $xml->createTag('legend', array(), '', $chart); $xml->createTag('show_date', array(), 'true', $legend); // $graphs = $xml->createTag('graphs', array(), '', $chart); $graph = $xml->createTag('graph', array(), '', $graphs); $data_sources = $xml->createTag('data_sources', array(), '', $graph); // . // close (open, low high ) // amcharts stock. amcharts\stock\amstock\amstock_settings.xml $xml->createTag('close', array(), $this->graph_csv_prefix . $i, $data_sources); // , stock chart . // , . if ($i == $this->ncharts) { $xml->createTag('period_value', array(), 'average', $graph); } else { $xml->createTag('period_value', array(), 'average', $graph); // sum } // $xml->createTag('color', array(), $this->graph_colours[$i - 1], $graph); // : $legend = $xml->createTag('legend', array(), '', $graph); $u = isset($this->graph_units[$i - 1]) ? $this->graph_units[$i - 1] : ''; $xml->createTag('date', array("key" => "false", "title" => "false"), '<![CDATA[{average}' . urlencode($u) . ']]>', $legend); // {close} $xml->createTag('show_date', array(), 'true', $legend); $xml->createTag('bullet', array(), 'round_outline', $graph); } // $data_set_selector = $xml->createTag('data_set_selector', array(), '0', $root); $xml->createTag('enabled', array(), 'false', $data_set_selector); $period_selector = $xml->createTag('period_selector', array(), '0', $root); $xml->createTag('enabled', array(), 'false', $period_selector); $header = $xml->createTag('header', array(), '0', $root); $xml->createTag('enabled', array(), 'false', $header); $scroller = $xml->createTag('scroller', array(), '0', $root); $xml->createTag('enabled', array(), 'false', $scroller); $xml_doc = $xml->generate(); $xml_doc = $this->getAmchartsXML($xml_doc); return $xml_doc; }
/** * Parse the RSS-tape. */ function parseRSS($xml_code) { loadCoreFile('obj_xml.php'); $last_news_date = $this->getLastNewsDate(); $xml = new xml_doc($xml_code); $xml->parse(); $channel = $xml->document->findChild('channel'); # the <channel> tag contents $this->channelContents = array(); $itemContents = array(); foreach ($channel->children as $channelChild) { if (_ml_strtolower($channelChild->name) == 'item') { $pubDate = $channelChild->findChild('pubdate'); $itemContents['NewsDate'] = strtotime($pubDate->contents, 0); if ($itemContents['NewsDate'] <= $last_news_date) { # an old piece of news, skip it continue; } foreach ($channelChild->children as $itemChild) { switch (_ml_strtolower($itemChild->name)) { case 'title': $itemContents['NewsTitle'] = $itemChild->contents; break; case 'link': $itemContents['NewsLink'] = $itemChild->contents; break; case 'description': $itemContents['NewsContent'] = $itemChild->contents; break; case 'category': $itemContents['NewsCategory'] = $itemChild->contents; break; default: break; } } $itemContents['NewsType'] = 'avactis'; $this->addNews($itemContents); # add the latest piece of news to the database } else { $this->channelContents[$channelChild->name] = $channelChild->contents; } } # update NEWS_LAST_BUILD_DATE and NEWS_TTL parameters $this->setValue(NEWS_LAST_BUILD_DATE, strtotime($this->channelContents['LASTBUILDDATE'], 0)); $this->setValue(NEWS_TTL, $this->channelContents['TTL']); }
function _process_request(&$data, $response_required = false) { $xml_request = urlencode($data); loadCoreFile('bouncer.php'); $bnc = new Bouncer(); $bnc->setHTTPversion("1.0"); $bnc->setMethod(LICENSESERVER_METHOD); $bnc->setURL(LICENSESERVER_PROTO . '://' . ACCOUNTSERVER_URL . '?xml=' . $xml_request); $result = $bnc->RunRequest(); if ($result == false) { return false; } if ($response_required) { loadCoreFile('obj_xml.php'); $xml = new xml_doc($result['body']); $res = $xml->parse(); if ($res !== true) { return false; } if (!is_object($xml->document)) { return false; } // general check // response data $response = array("CODE" => "not_set", "MESSAGE" => "not_set", "CERT" => "not_set"); foreach ($response as $key => $val) { $xml_tag = $xml->findTag($key); if ($xml_tag != FALSE) { $response[$key] = $xml_tag->contents; } } return $response; } else { return true; } }