当前位置: 首页>>代码示例>>PHP>>正文


PHP Neuron_Core_Tools::output_xml方法代码示例

本文整理汇总了PHP中Neuron_Core_Tools::output_xml方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::output_xml方法的具体用法?PHP Neuron_Core_Tools::output_xml怎么用?PHP Neuron_Core_Tools::output_xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Neuron_Core_Tools的用法示例。


在下文中一共展示了Neuron_Core_Tools::output_xml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: text2bundle

 public static function text2bundle($text)
 {
     $path = $text->getPath();
     $output = array();
     self::handleDirectory($output, $path);
     $data = array();
     foreach ($output as $k => $v) {
         $data[] = array('attributes' => array('name' => $k), 'element-content' => $v);
     }
     return Neuron_Core_Tools::output_xml($data, null, 'messagebundle', array(), 'msg');
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:11,代码来源:MessageBundle.php

示例2: send

 public function send($sUrl)
 {
     $xml = Neuron_Core_Tools::output_xml($this->sXML, 1, 'userstats', array());
     // And now: send the notification!
     $postfields = array('userstats_xml' => $xml);
     // Make sure curl doesn't think that we're trying to upload files
     foreach ($postfields as $k => $v) {
         if (substr($v, 0, 1) == '@') {
             // Let's hope the receive will trim the response.
             // It's only used for the bare message anyway.
             $postfields[$k] = ' ' . $v;
         }
     }
     if (defined('NOTIFICATION_DEBUG')) {
         $postfields['debug'] = true;
         echo '<h2>Preparing data to send:</h2><pre>';
         echo htmlentities(print_r($postfields, true));
         echo '</pre>';
         echo '<h2>Sending data</h2>';
         echo '<p>Contacting <span style="color: red;">' . $sUrl . '</span>... ';
     }
     try {
         if (function_exists('curl_init')) {
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $sUrl);
             //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             // return into a variable
             curl_setopt($ch, CURLOPT_TIMEOUT, 3);
             // times out after 4s
             curl_setopt($ch, CURLOPT_POST, true);
             // set POST method
             curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
             // add POST fields
             // execute curl command
             $result = curl_exec($ch);
             // run the whole process
         }
     } catch (Exception $e) {
         // Do nothing. The notification was not sent.
     }
     // Show if debug is on.
     if (defined('NOTIFICATION_DEBUG')) {
         if (!$result) {
             echo '<p>cURL error: ' . curl_error($ch) . '</p>';
         }
         echo 'Done!</p>';
         echo '<h2>Beginning notification output:</h2>';
         echo '<pre>' . htmlentities($result) . '</pre>';
         echo '<h2>End of notification output.</h2>';
     }
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:52,代码来源:Userstats.php

示例3: array

            break;
        default:
            $output['content'] = array();
            break;
    }
    $pgen->stop();
    $db = Neuron_Core_Database::__getInstance();
    $output['info'] = array();
    $output['info']['mysqlCount'] = $db->getCounter();
    $output['info']['runduration'] = $pgen->gen(6);
    $output['info']['contentCount'] = count($output['content']);
    // Output
    switch ($output_type) {
        case 'json':
            echo json_encode($output);
            break;
        case 'serialize':
            echo serialize($output);
            break;
        case 'xml':
            header('Content-type: text/xml');
            echo Neuron_Core_Tools::output_xml($output['content'], $xml_version, $xml_name, $parameters);
            break;
        case 'print':
        default:
            echo '<pre>';
            print_r($output);
            echo '</pre>';
            break;
    }
}
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:31,代码来源:api.php

示例4: array

 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
$_POST['regions'] = array(array('x' => 0, 'y' => 0, 'z' => 0, 'radius' => 100000));
$out = array();
$out['regions'] = array();
if (isset($_POST['regions']) && is_array($_POST['regions'])) {
    $objectManager = $this->getMap()->getMapObjectManager();
    $objectManager->clean();
    foreach ($_POST['regions'] as $v) {
        $x = isset($v['x']) ? $v['x'] : 0;
        $y = isset($v['y']) ? $v['y'] : 0;
        $z = isset($v['z']) ? $v['z'] : 0;
        $radius = isset($v['radius']) ? $v['radius'] : 1000;
        $location = new Neuron_GameServer_Map_Location($x, $y, $z);
        $rObject = new Neuron_GameServer_Map_Radius($radius);
        $area = new Neuron_GameServer_Map_Area($location, $rObject);
        $region = array();
        $region['attributes'] = array('x' => $x, 'y' => $y, 'z' => $z, 'radius' => $radius);
        $region['objects'] = array();
        foreach ($objectManager->getDisplayObjects($area) as $v) {
            $region['objects'][] = $v->getExportData();
        }
        $out['regions'][] = $region;
    }
}
echo Neuron_Core_Tools::output_xml($out);
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:30,代码来源:objects.php

示例5: intval

$db = Neuron_DB_Database::getInstance();
$lastlog = Neuron_Core_Tools::getInput('_REQUEST', 'from', 'int');
$ll = intval($lastlog);
$out = array();
$attributes = array();
if ($ll < 1) {
    $db = Neuron_DB_Database::getInstance();
    $last = $db->query("\n\t\tSELECT\n\t\t\tMAX(mu_id) AS laatste\n\t\tFROM\n\t\t\tn_map_object_updates\n\t");
    $out = array();
    $attributes = array('last' => intval($last[0]['laatste']));
} else {
    $q = $db->query("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\tn_map_object_updates\n\t\tWHERE\n\t\t\tmu_id > {$ll}\n\t");
    $last = $ll;
    $out['objects'] = array();
    $out['removes'] = array();
    foreach ($q as $v) {
        if ($last < $v['mu_id']) {
            $last = $v['mu_id'];
        }
        if ($v['mu_action'] == 'REMOVE') {
            $out['removes'][] = array('attributes' => array('id' => $v['mu_uoid']));
        } else {
            //$this->alert ('reloading ' . $v['mu_x'] . ',' . $v['mu_y']);
            $object = Neuron_GameServer::getInstance()->getMap()->getMapObjectManager()->getFromUOID($v['mu_uoid']);
            $out['objects'][] = $object->getExportData();
        }
    }
    $attributes['last'] = $last;
}
echo Neuron_Core_Tools::output_xml($out, '1', 'updates', $attributes);
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:30,代码来源:update.php


注:本文中的Neuron_Core_Tools::output_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。