com web/pres2: Merge changes from @Sobak: XML_Presentation. php XML_Slide.php compat.php display.php index .php messages.php objects.php show.php sniff. php
[email protected] (Rasmus Lerdorf)
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 8f9324c28fc4f3de750dd814a2b03382ea6d2d72 Author: Rasmus Lerdorf <[email protected]> Wed, 21 Jan 2015 11:31:17 -0800 Parents: af708bd8640ee83f190661d3541adf0c53ce45db Branches: master Link: http://git.php.net/?p=web/pres2.git;a=commitdiff;h=8f9324c28fc4f3de750dd814a2b03382ea6d2d72 Log: Merge changes from @Sobak Changed paths: M XML_Presentation.php M XML_Slide.php D compat.php M display.php M index.php M messages.php M objects.php M show.php D sniff.php
diff_8f9324c28fc4f3de750dd814a2b03382ea6d2d72.txt
(text/plain, 7.9 KB)
diff --git a/XML_Presentation.php b/XML_Presentation.php
index 288adb0..8573271 100644
--- a/XML_Presentation.php
+++ b/XML_Presentation.php
@@ -84,7 +84,7 @@ class XML_Presentation extends XML_Parser
*/
function XML_Presentation($handle = '')
{
- $this->XML_Parser();
+ parent::__construct('UTF-8');
if (@is_resource($handle)) {
$this->setInput($handle);
} elseif ($handle != '') {
diff --git a/XML_Slide.php b/XML_Slide.php
index 42fa380..d3e149d 100644
--- a/XML_Slide.php
+++ b/XML_Slide.php
@@ -76,7 +76,7 @@ class XML_Slide extends XML_Parser
*/
function XML_Slide($handle = '')
{
- $this->XML_Parser();
+ parent::__construct('UTF-8');
if (@is_resource($handle)) {
$this->setInput($handle);
} elseif ($handle != '') {
diff --git a/compat.php b/compat.php
deleted file mode 100644
index 9924723..0000000
--- a/compat.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-if (!function_exists('file_get_contents')) {
- function file_get_contents ($filename)
- {
- return implode ("", file ($filename));
- }
-}
-?>
diff --git a/display.php b/display.php
index 19e6815..fa48fcb 100644
--- a/display.php
+++ b/display.php
@@ -59,6 +59,7 @@ class html extends display {
<html>
<head>
<base href="http://$_SERVER[HTTP_HOST]$this->baseDir">
+<meta charset="utf-8">
<title>{$presentation->title}</title>
HEADER;
switch($presentation->template) {
@@ -596,7 +597,7 @@ type=\"application/x-shockwave-flash\" width=$example->iwidth height=$example->i
function _list(&$list) {
if (!isset($list->bullets)) return;
- $align = '';
+ $align = $style = '';
if ( ($this->pres->template != 'css') && ( isset($list->title) )) {
if(!empty($list->fontsize)) $style = "font-size: ".$list->fontsize.';';
if(!empty($list->align)) $align = 'align="'.$list->align.'"';
@@ -870,18 +871,6 @@ EOB;
break;
case 'css':
echo "</div>\n";
-
-/* (this seemed too intrusive)
- case 'php2':
- if($this->nextTitle) {
- ?>
- <span class="C5">
- <?php echo 'next: '.markup_text($this->nextTitle);?>
- </span>
- <?php
- }
- break;
-*/
}
echo "</body>\n";
}
@@ -893,9 +882,11 @@ class plainhtml extends html {
global $pres;
echo <<<HEADER
+<!doctype html>
<html>
<head>
<base href="http://$_SERVER[HTTP_HOST]$this->baseDir">
+<meta charset="utf-8">
<title>{$presentation->title}</title>
</head>
<body>
@@ -1361,7 +1352,7 @@ class pdf extends display {
$slideDir = dirname($this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename).'/';
$fn = $this->presentationDir.'/'.$presentation->slides[$this->slideNum]->filename;
$fh = fopen($fn, "rb");
- $r =& new XML_Slide($fh);
+ $r = new XML_Slide($fh);
$r->setErrorHandling(PEAR_ERROR_DIE,"%s ($fn)\n");
$r->parse();
diff --git a/index.php b/index.php
index 82b30a4..3636c24 100644
--- a/index.php
+++ b/index.php
@@ -33,7 +33,7 @@
foreach($ps as $pres_id=>$filename) {
$fh = fopen($filename, "rb");
- $p = &new XML_Presentation($fh);
+ $p = new XML_Presentation($fh);
$p->setErrorHandling(PEAR_ERROR_DIE,"%s\n");
$p->parse();
$pres = $p->getObjects();
@@ -81,7 +81,7 @@
unset($pres);
// default options for the file..
- $p = &new XML_Presentation(fopen("index.xml", "rb"));
+ $p = new XML_Presentation(fopen("index.xml", "rb"));
$p->setErrorHandling(PEAR_ERROR_DIE,"%s\n");
$p->parse();
$pres = $p->getObjects();
@@ -91,6 +91,7 @@
<html>
<head>
<base href="<?php echo "http://".htmlspecialchars($_SERVER['HTTP_HOST']).$baseDir?>">
+<meta charset="utf-8">
<title>PHP Presents</title>
<?php include "css.php"; ?>
<script>
@@ -192,17 +193,6 @@ switch($display_mode) {
case 'flash':
echo "<p>".nl2br(message('FLASH_KEYBOARD_CONTROLS'))."</p>\n";
break;
-
- /* this is a redundant check w/ the flags above -- JMC */
- /*
- case 'pdfus':
- case 'pdfusl':
- case 'pdfa4':
- if (!extension_loaded("pdf")) {
- echo "<p>".message('NO_PDF_EXTENSION')."</p>\n";
- }
- break;
- */
}
?>
<p><?php echo message('FONT_SIZES'); ?></p>
diff --git a/messages.php b/messages.php
index f09b660..a91ef70 100644
--- a/messages.php
+++ b/messages.php
@@ -1,9 +1,9 @@
<?php
// interim fix until someone changes the config.php on talks.php.net
-if (!defined('PRES_LOCALE')) { define('PRES2_LOCALE', 'en'); }
-if (!defined('PRES_LOCALEDIR')) { define('PRES2_LOCALEDIR', 'locale'); }
-if (!defined('PRES_USE_GETTEXT')) { define('PRES2_USE_GETTEXT', false); }
+if (!defined('PRES2_LOCALE')) { define('PRES2_LOCALE', 'en'); }
+if (!defined('PRES2_LOCALEDIR')) { define('PRES2_LOCALEDIR', 'locale'); }
+if (!defined('PRES2_USE_GETTEXT')) { define('PRES2_USE_GETTEXT', false); }
// after config.php has been changed the lines above can be removed
// set locale and bindings if we are using gettext
diff --git a/objects.php b/objects.php
index 162155d..b1fa95f 100644
--- a/objects.php
+++ b/objects.php
@@ -3,7 +3,6 @@
require_once 'display.php';
-require_once 'compat.php';
// {{{ Helper functions
// {{{ getFLashDimensions - Find the height and width of the given flash string
@@ -72,7 +71,9 @@ function markup_text($str) {
$ret = preg_replace('/TAB\//',' ',$ret);
$ret = preg_replace('/([\\\])([*#_|^@%])/', '\2', $ret);
- $ret = preg_replace('/:-:(.*?):-:/e','$pres->\\1',$ret);
+ $ret = preg_replace_callback('/:-:(.*?):-:/', function ($matches) {
+ return $pres->$match[1];
+ }, $ret);
return $ret;
}
// }}}
diff --git a/show.php b/show.php
index f0bf6f0..3a857f9 100644
--- a/show.php
+++ b/show.php
@@ -1,6 +1,4 @@
<?php
-/// error_reporting(E_ALL);
-
require_once 'config.php';
$c = compact('presentationDir', 'baseDir', 'showScript', 'helpPage', 'baseFontSize',
'flashFontScale', 'pdfFontScale', 'pdfResourceFile', 'pdf_font',
@@ -44,11 +42,6 @@
}
$_SESSION['currentPres'] = trim(implode('-', $urlArray), '-');
- /*
- Old way:
- @list($_SESSION['currentPres'],$slideNum) = explode('/',$presFile);
- */
-
if(!isset($_SESSION['titlesLoaded'])) $_SESSION['titlesLoaded'] = 0;
$presFile = str_replace('..','',(string)$_SESSION['currentPres']); // anti-hack
$presFile = "$presentationDir/$presFile".'.xml';
@@ -59,7 +52,7 @@
// Load in the presentation
$fh = fopen($presFile, "rb");
- $p =& new XML_Presentation($fh);
+ $p = new XML_Presentation($fh);
$p->setErrorHandling(PEAR_ERROR_DIE,"%s\n");
$p->parse();
$pres = $p->getObjects();
@@ -120,7 +113,7 @@
// Load the slide
$mode->slideDir = dirname($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename).'/';
$fh = fopen($presentationDir.'/'.$pres->slides[$mode->slideNum]->filename, "rb");
- $r =& new XML_Slide($fh);
+ $r = new XML_Slide($fh);
$r->setErrorHandling(PEAR_ERROR_DIE,"%s\n");
$r->parse();
// Display slide
@@ -132,9 +125,8 @@ function get_all_titles($pres) {
global $presentationDir;
while(list($slideNum,$slide) = each($pres->slides)) {
-// $r =& new XML_Slide($presentationDir.'/'.$pres->slides[$slideNum]->filename);
$fh = fopen($presentationDir.'/'.$pres->slides[$slideNum]->filename, "rb");
- $r =& new XML_Slide($fh);
+ $r = new XML_Slide($fh);
$r->parse();
$objs = $r->getObjects();
diff --git a/sniff.php b/sniff.php
deleted file mode 100644
index 6edab62..0000000
--- a/sniff.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-/* Code for sniffing out a reasonable IE browser implementation */
-
-$browser_is_IE = false !== strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE');
-$css_supports_fixed = !$browser_is_IE;
-if ($browser_is_IE) {
- /* IE 6 seems to handle fixed positioning OK */
- preg_match('/MSIE (\d+)\.(\d+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
- if ((int)$matches[1] >= 6) {
- $css_supports_fixed = true;
- }
-}
-?>