本文整理汇总了PHP中Converter::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::convert方法的具体用法?PHP Converter::convert怎么用?PHP Converter::convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Converter
的用法示例。
在下文中一共展示了Converter::convert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConvert
public function testConvert()
{
$document = new \DOMDocument();
$document->load(__DIR__ . '../../../_files/search_request.xml');
$result = $this->object->convert($document);
$expected = (include __DIR__ . '/../../_files/search_request_config.php');
$this->assertEquals($expected, $result);
}
示例2: addRouteToDB
/**
* lisää käyttäjän lisäämän reitin tietokantaan
* @param integer $_cragid cragin id mihin reitti lisätään
* @param string $_routename lisättävän reitin nimi
* @param string $_routegrade lisättävän reitin greidi
* @param string $_routedesc reitin selostus
* @return integer palauttaa viimeisimmän tietokantaan laitetun rivin id:n
*/
public function addRouteToDB($_cragid, $_routename, $_routegrade, $_routedesc)
{
require "/var/www/db-init-climb.php";
$_routegrade = parent::convert($_routegrade);
$stmt = $db->prepare("INSERT INTO Route(CragId, Name, Grade, Description) \n VALUES(:cragid, :name, :grade, :description)");
$stmt->execute([':cragid' => $_cragid, ':name' => $_routename, ':grade' => $_routegrade, ':description' => $_routedesc]);
return $db->lastInsertId();
}
示例3: convertFile
public function convertFile($htmlFileName, $phpFileName = '')
{
$htmlContent = file_get_contents($htmlFileName);
if ($htmlContent) {
if (!$phpFileName) {
$phpFileName = $this->_makeOutputFilename($htmlFileName, $htmlContent);
}
$result = $this->_converter->convert($htmlContent, $this->_makeTestName($htmlFileName), $this->_tplFile);
file_put_contents($phpFileName, $result);
print $phpFileName . "\n";
}
}
示例4: run
/**
* Run the application to convert files.
*
* @param bool $hack
*/
public function run($hack)
{
$converter = new Converter();
foreach ($this->getIterator() as $fileinfo) {
$fileName = $fileinfo[0];
$file = new File($fileName);
$converter->convert($file, $hack);
if (0 === strpos($fileName, $this->sourceFolder)) {
$path = substr($fileName, strlen($this->sourceFolder));
$destinationFile = $this->destinationFolder . $path;
$destinationFolder = pathinfo($destinationFile, PATHINFO_DIRNAME);
if (!file_exists($destinationFolder)) {
mkdir($destinationFolder, 0777, true);
}
file_put_contents($destinationFile, $file->getCode());
}
}
}
示例5: testComment
public function testComment()
{
$converter = new Converter(['{', '}'], ['{{', '}}']);
$text = '{* foobar *}';
$this->assertSame('{{* foobar *}}', $converter->convert($text));
}
示例6: write
public function write($data)
{
return array('mimetype' => $this->writeSpec['target'], 'content' => Converter::convert($data['content'], $this->writeSpec['format'], $this->writeSpec['extension']));
}
示例7: FluxBB
require CONV_ROOT . 'include/fluxbb.class.php';
$fluxbb = new FluxBB($pun_config);
$db = $fluxbb->connect_database($db_config);
// Load the migration script
require CONV_ROOT . 'include/forum.class.php';
$forum = load_forum($forum_config, $fluxbb);
$forum->connect_database($old_db_config);
// Load converter script
require CONV_ROOT . 'include/converter.class.php';
$converter = new Converter($fluxbb, $forum);
// Start the converter
$next_step = array(null);
while ($next_step !== false) {
conv_message();
conv_log('-----------------' . "\n");
$next_step = $converter->convert($next_step[0], isset($next_step[1]) ? $next_step[1] : 0);
}
// We're done
$alerts = array(sprintf($lang_convert['Rebuild search index note'], $lang_convert['rebuild search index']));
if (!$forum->converts_password) {
$alerts[] = $lang_convert['Password converter mod'];
}
$fluxbb->close_database();
if (!empty($session['dupe_users'])) {
conv_message("\n" . '---------------------------' . "\n");
conv_message($lang_convert['Username dupes head']);
conv_message($lang_convert['Error info 1']);
conv_message($lang_convert['Error info 2']);
foreach ($_SESSION['converter']['dupe_users'] as $id => $cur_user) {
conv_message("\t" . $lang_convert['was renamed to'], $cur_user['old_username'], $cur_user['username']);
}
示例8: convert
/**
* @param $space
* @return array
*/
private function convert($space)
{
if (isset($this->{strtolower($space)})) {
return $this->{strtolower($space)};
}
return Converter::convert($this->originalSpace, $space, $this->{strtolower($this->originalSpace)});
}
示例9: callback
private function callback($buffer)
{
// modify buffer here, and then return the updated code
$converter = new Converter();
$options = ['input_font' => 'Myanmar3', 'output' => 'Zawgyi-One'];
$buffer = $converter->convert($buffer, $options);
return $buffer;
}
示例10: dirname
<?php
require_once dirname(__FILE__) . '/../../common.php';
require_once dirname(__FILE__) . '/../../Converter.php';
// -----------------------------------------------------------------------------
define('PATH_BASE', dirname(__FILE__));
//if (isset($_GET['fileName'])){
//$fileName = $_GET['fileName'];
//}
//$inputFilename = PATH_BASE . DIRECTORY_SEPARATOR . $fileName.'.rtf'; // convert this file
//$outputFormat = 'pdf'; // into this format
$inputFilename = PATH_BASE . DIRECTORY_SEPARATOR . $fileName . '.rtf';
// convert this file
$outputFormat = 'pdf';
// -----------------------------------------------------------------------------
$outputFilename = Converter::getFilename($inputFilename, $outputFormat);
//printf('Converting %s to %s... ', basename($inputFilename), basename($outputFilename));
$convertedDocument = Converter::convert($inputFilename, $outputFormat);
if (false !== $convertedDocument) {
file_put_contents($outputFilename, $convertedDocument);
print "DONE.\n";
} else {
print "ERROR.\n";
}
// -----------------------------------------------------------------------------
示例11: file_put_contents
} else {
if ($argc == 4) {
$in = $argv[1];
$out = $argv[2];
$name = $argv[3];
$newContent = Converter::convert($in, $name);
file_put_contents($out, $newContent);
} else {
$dir = realpath(__DIR__ . '/../../extensions/');
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
$fullPath = realpath($dir . DIRECTORY_SEPARATOR . $file);
if ($file != "." && $file != ".." && $file != "themes" && $file != "translations" && is_dir($fullPath) && is_writable($fullPath)) {
//echo $file.PHP_EOL;
$origIni = realpath($fullPath . DIRECTORY_SEPARATOR . 'default.ini');
if (file_exists($origIni) && is_readable($origIni)) {
$newFile = $fullPath . "/doap.n3";
echo "write " . $newFile . PHP_EOL;
file_put_contents($newFile, Converter::convert($origIni, $file));
} else {
echo 'no default.ini in ' . $fullPath . PHP_EOL;
}
} else {
echo 'skipping non-extension dir ' . $fullPath . PHP_EOL;
}
}
closedir($handle);
}
}
}
}
示例12: convert
/**
* @param array $data
* @param \ReflectionClass $class
*
* @return ConversionResult
*/
public function convert(array $data, \ReflectionClass $class)
{
return $this->converter->convert($data, $class, $this->nameMangling);
}
示例13: file_get_contents
<?php
include __DIR__ . '/Converter.php';
$content = file_get_contents('test.in');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="bbs.js"></script>
<link rel="stylesheet" href="bbs.css">
</head>
<body>
<div class="border">
<pre><?php
echo Converter::convert($content);
?>
</pre>
</div>
</body>
</html>
示例14: dirname
addEvent(window, 'resize', resizeGridContainer);
</script>
<?php
}
?>
</head>
<body scroll="auto">
<?php
require_once dirname(__FILE__) . '/menu.php';
require_once dirname(__FILE__) . "/lib/Converter.php";
require_once dirname(__FILE__) . "/lib/Providers.php";
require_once dirname(__FILE__) . "/lib/Product.php";
$providers = Providers::getProviders();
try {
if ($_POST['convert_pricelist'] && $_POST['prov_id'] > 0 && isset($providers[$_POST['prov_id']]) && strlen($providers[$_POST['prov_id']]['prog_name']) && $_FILES["file_to_convert"]["error"] == UPLOAD_ERR_OK) {
$res = Converter::convert($_POST['prov_id'], $_FILES["file_to_convert"]);
if ($res) {
if ($_POST['preview']) {
echo '<h2>Обновление цен от "' . $providers[$_POST['prov_id']]['name'] . '"</h2><form action ="" method="post"><input type="hidden" name="prov_id" value="' . $_POST['prov_id'] . '"><input type="checkbox" name="import_correct_pricelist" id="import_correct_pricelist"><label for="import_correct_pricelist"><b>Подтверждаю правильность</b></label><input type="submit" value="Заимпортировать"></form><table border><tbody>';
//$temp_prods = Product::getTempProds($_POST['prov_id']);
echo '<div id="grid_container"></div>';
/*echo '<table border><tbody><tr><td>Наименование</td><td>Цена</td><td>Склад</td></tr>';
$temp_prods_count = count($temp_prods);
for($i = 0; $i < $temp_prods_count; $i++)
{
echo '<tr><td>' . $temp_prods[$i]['prod_name'] . '</td><td>' . $temp_prods[$i]['price'] . '</td><td>' . $temp_prods[$i]['stock'] . '</td></tr>';
}
echo '</tbody></table>';*/
} else {
if (Product::importProducts($_POST['prov_id'])) {
$min_peices_updated = Product::updateMinPrices();
示例15: FluxBB
conv_error('Same database tables');
}
// Create a wrapper for fluxbb (has easy functions for adding users etc.)
require CONV_ROOT . 'include/fluxbb.class.php';
$fluxbb = new FluxBB($pun_config);
$db = $fluxbb->connect_database($db_config);
// Load the migration script
require CONV_ROOT . 'include/forum.class.php';
$forum = load_forum($forum_config, $fluxbb);
$forum->connect_database($old_db_config);
// Load converter script
require CONV_ROOT . 'include/converter.class.php';
$converter = new Converter($fluxbb, $forum);
if (!isset($step) || $step != 'results') {
// Start the converter
$redirect = $converter->convert($step, $start_at);
$_SESSION['fluxbb_converter'] = $session;
if ($redirect === false) {
conv_redirect('results');
} else {
conv_redirect($redirect[0], isset($redirect[1]) ? $redirect[1] : 0);
}
}
// if (empty($session['dupe_users']))
// unset($_SESSION['fluxbb_converter']);
// We're done
$alerts = array(sprintf($lang_convert['Rebuild search index note'], '<a href="../admin_maintenance.php">' . $lang_convert['rebuild search index'] . '</a>'));
if (!$forum->converts_password) {
$alerts[] = $lang_convert['Password converter mod'];
}
$fluxbb->close_database();