com web/pres2: PHP 7 tweaks: XML_Presentation.php index .php objects.php pres2reveal reveal_template.ph p

[email protected] (Rasmus Lerdorf) Mon, 20 Jun 2016 14:12:17 +0000
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    0a5c1d0a661a2fcb99babcd9c056ee7cde50221b
Author:    Rasmus Lerdorf <[email protected]>         Mon, 20 Jun 2016 07:12:17 -0700
Parents:   4aaebf86f2f519dab09c5ebb9b32494ffd826ee0
Branches:  master

Link:       http://git.php.net/?p=web/pres2.git;a=commitdiff;h=0a5c1d0a661a2fcb99babcd9c056ee7cde50221b

Log:
PHP 7 tweaks

Changed paths:
  M  XML_Presentation.php
  M  index.php
  M  objects.php
  M  pres2reveal
  M  reveal_template.php


Diff:
diff --git a/XML_Presentation.php b/XML_Presentation.php
index 8573271..ffd18d1 100644
--- a/XML_Presentation.php
+++ b/XML_Presentation.php
@@ -82,7 +82,7 @@ class XML_Presentation extends XML_Parser
      * @param mixed File pointer or name of the slide file.
      * @return void
      */
-    function XML_Presentation($handle = '')
+    function __construct($handle = '')
     {
         parent::__construct('UTF-8');
         if (@is_resource($handle)) {
diff --git a/index.php b/index.php
index 5b8629b..cd92032 100644
--- a/index.php
+++ b/index.php
@@ -36,7 +36,7 @@
 		$p = new XML_Presentation($fh);
 		$p->setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
 		$check = $p->parse();
-		if (PEAR::isError($check)) {
+		if ($p->isError($check)) {
 			continue;
 		}
 		$pres = $p->getObjects();
@@ -87,7 +87,7 @@
 	$p = new XML_Presentation(fopen("index.xml", "rb"));
 	$p->setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING);
 	$check = $p->parse();
-	if (PEAR::isError($check)) {
+	if ($p->isError($check)) {
 		die("Could not parse index.xml, not sure what to do");
 	}
 	$pres = $p->getObjects();   
diff --git a/objects.php b/objects.php
index b1fa95f..4224486 100644
--- a/objects.php
+++ b/objects.php
@@ -130,7 +130,7 @@ function strip_markups($str) {
 	}
 	
 	class _presentation extends _tag {
-		function _presentation() {
+		function __construct() {
 			global $baseFontSize, $jsKeyboard, $baseDir;
 
 			$this->title = 'No Title Text for this presentation yet';
@@ -159,7 +159,7 @@ function strip_markups($str) {
 	}
 
 	class _pres_slide extends _tag {
-		function _pres_slide() {
+		function __construct() {
 			$this->filename = '';
 		}
 	}
@@ -168,7 +168,7 @@ function strip_markups($str) {
 	// {{{ Slide Class
 	class _slide extends _tag {
 
-		function _slide() {
+		function __construct() {
 			$this->title = 'No Title Text for this slide yet';
 			$this->subtitle = '';
 			$this->titleSize  = "3em";
@@ -187,7 +187,7 @@ function strip_markups($str) {
 	// {{{ Blurb Class
 	class _blurb extends _tag {
 
-		function _blurb() {
+		function __construct() {
 			$this->font  = 'fonts/Verdana.fdb';
 			$this->align = 'left';
 			$this->talign = 'left';
@@ -209,7 +209,7 @@ function strip_markups($str) {
 
 	// {{{ Image Class
 	class _image extends _tag {
-		function _image() {
+		function __construct() {
 			$this->filename = '';
 			$this->align = 'left';
 			$this->talign = 'left';
@@ -224,7 +224,7 @@ function strip_markups($str) {
 
 	// {{{ Example Class
 	class _example extends _tag {
-		function _example() {
+		function __construct() {
 			$this->filename = '';
 			$this->type = 'php';
 			$this->fontsize = '2em';
@@ -428,7 +428,7 @@ function strip_markups($str) {
 
 	// {{{ Break Class
 	class _break extends _tag {
-		function _break() {
+		function __construct() {
 			$this->lines = 1;
 		}
 
@@ -437,7 +437,7 @@ function strip_markups($str) {
 
 	// {{{ Div Class
 	class _div extends _tag {
-		function _div() {
+		function __construct() {
 			$this->effect = '';
 		}
 	}
@@ -449,7 +449,7 @@ function strip_markups($str) {
 
 	// {{{ List Class
 	class _list extends _tag {
-		function _list() {
+		function __construct() {
 			$this->fontsize	= '3em';
 			$this->marginleft  = '0em';
 			$this->marginright = '0em';
@@ -463,7 +463,7 @@ function strip_markups($str) {
 	// {{{ Bullet Class
 	class _bullet extends _tag {
 
-		function _bullet() {
+		function __construct() {
 			$this->text = '';
 			$this->effect = '';
 			$this->id = '';
@@ -475,7 +475,7 @@ function strip_markups($str) {
 
 	// {{{ Table Class
 	class _table extends _tag {
-		function _table() {
+		function __construct() {
 			$this->fontsize	= '3em';
 			$this->marginleft  = '0em';
 			$this->marginright = '0em';
@@ -490,7 +490,7 @@ function strip_markups($str) {
 	// {{{ Cell Class
 	class _cell extends _tag {
 
-		function _cell() {
+		function __construct() {
 			$this->text = '';
 			$this->slide = '';
 			$this->id = '';
@@ -504,7 +504,7 @@ function strip_markups($str) {
 	// {{{ Link Class
 	class _link extends _tag {
 
-		function _link() {
+		function __construct() {
 			$this->href  = '';
 			$this->align = 'left';
 			$this->fontsize	 = '2em';
@@ -521,7 +521,7 @@ function strip_markups($str) {
 	// {{{ PHP Eval Class
 	class _php extends _tag {
 
-		function _php() {
+		function __construct() {
 			$this->filename = '';
 		}
 
@@ -543,7 +543,7 @@ function strip_markups($str) {
 	// {{{ Movie Class
 	class _movie extends _tag {
 
-		function _movie() {
+		function __construct() {
 			$this->filename = '';
 			$this->autoplay = 'true';
 			$this->width = 800;
diff --git a/pres2reveal b/pres2reveal
index c22bedb..0cc6d6d 100755
--- a/pres2reveal
+++ b/pres2reveal
@@ -105,8 +105,9 @@ function render_image($e) {
     if(!empty($e['align'])) {
         $align = "align=\"{$e['align']}\"";
     }
+
 	$ret .= <<<EOB
-		<img src="/{$slide_path}/{$e[filename]}" $align width="{$e[width]}" height="{$e[height]}">
+		<img src="/{$slide_path}/{$e['filename']}" $align width="{$e['width']}" height="{$e['height']}">
 
 EOB;
 	return $ret;
diff --git a/reveal_template.php b/reveal_template.php
index c45dfc6..8ff3340 100644
--- a/reveal_template.php
+++ b/reveal_template.php
@@ -26,6 +26,10 @@
 		   Not actually sure why this block isn't being picked up from the syntax highlight css 
 		   If you change the syntax highlight theme, copy the first block here
 		*/
+        .reveal pre {
+                width: 100%;
+        }
+
         .reveal pre code {
                 display: block;
                 max-height: 600px;