Getting WordPress Template running
Jeremy D

Jeremy D commited on 2012-01-23 20:23:08
Showing 5 changed files, with 57 additions and 31 deletions.

... ...
@@ -13,16 +13,6 @@ $pasteBin = new pB();
13 13
 // Show our recent section.
14 14
 $pasteBin->showRecent();
15 15
 
16
-// Modified for WordPress, but this handles the sidebar and css.
17
-if (defined('WPLANG'))
18
-{
19
-	wp_enqueue_style('pastebin', pBS::get('css'));
20
-	ob_start();
21
-	$pasteBin->showRecent();
22
-	$specialPage['sidebar'] = ob_get_contents();
23
-	ob_end_clean();
24
-}
25
-
26 16
 // Handles the actions.
27 17
 if (isset($_POST['submit']))
28 18
 	$pasteBin->action_paste();
... ...
@@ -34,23 +24,6 @@ else
34 24
 if (defined('WPLANG'))
35 25
 	$specialPage['title'] = $pasteBin->title;
36 26
 
37
-/*
38
-		// Added this for myself.
39
-		if (defined('WPLANG2'))
40
-			echo '
41
-			<br />
42
-			<ul>
43
-				<li class="widget">
44
-					<h2 class="widgettitle">See the Source</h2>
45
-					<ul>
46
-						<li><a href="./?sauce">Main Script</li>
47
-						<li><a href="./?sauce&f=settings">Settings</li>
48
-						<li><a href="./?sauce&f=language">Language</li>
49
-					</ul>
50
-				</li>
51
-			</ul>';
52
-*/
53
-
54 27
 /*
55 28
 * Main PasteBin class
56 29
 */
... ...
@@ -18,10 +18,10 @@ class pBS
18 18
 	private static $user = 'smf';
19 19
 
20 20
 	// Template Handler.
21
-	private static $tpl = 'smf';
21
+	private static $tpl = 'wp';
22 22
 
23 23
 	// Any preloader file needed?
24
-	private static $preload = ''; //'__integrate.php';
24
+	private static $preload = '__integrate.php';
25 25
 
26 26
 	// Language files location and default.
27 27
 	private static $languages = './languages';
... ...
@@ -66,6 +66,10 @@ class pBS
66 66
 	{
67 67
 		if (is_callable('pBSe::get') && pBSe::get($var) !== null)
68 68
 			return pBSe::get($var);
69
+
70
+		if (!isset(self::$$var))
71
+			return null;
72
+
69 73
 		return self::$$var;
70 74
 	}
71 75
 }
... ...
@@ -24,7 +24,7 @@ class pDB_smf extends pDB
24 24
 			$_COOKIE[$cookiename] = stripslashes($_COOKIE[$cookiename]);
25 25
 
26 26
 		// We need to setup this before we continue
27
-		if (pBS::get('smf_use_theme'))
27
+		if (pBS::get('smf_use_theme') && pBS::get('tpl') == 'smf')
28 28
 		{
29 29
 			$ssi_theme = pBS::get('smf_theme_id');
30 30
 			$ssi_layers = array('html', 'body');
... ...
@@ -6,7 +6,7 @@
6 6
 class pTPL_smf extends pTPL
7 7
 {
8 8
 	/*
9
-	* We simply just create the object to the user_info handler.
9
+	* We will simply start SMF up if it wasn't already.
10 10
 	*/
11 11
 	public function __construct()
12 12
 	{
... ...
@@ -0,0 +1,49 @@
1
+<?php
2
+
3
+/*
4
+* Sets up the basic Theme handler for Pastebin
5
+*/
6
+class pTPL_wp extends pTPL
7
+{
8
+	/*
9
+	* Lets get things cooking.
10
+	*/
11
+	public function __construct()
12
+	{
13
+		wp_enqueue_style('pastebin', pBS::get('css'));
14
+	}
15
+
16
+	/*
17
+	* Custom code before the top part of recent.
18
+	*/
19
+	public function recentTop()
20
+	{
21
+		ob_start();
22
+	}
23
+
24
+	/*
25
+	* Custom code before the bottom part of recent.
26
+	*/
27
+	public function recentBottom()
28
+	{
29
+		global $specialPage;
30
+
31
+		// Lets not always show the source links.
32
+		if (pBS::get('show_source_link'))
33
+			echo '
34
+			<br />
35
+			<ul>
36
+				<li class="widget">
37
+					<h2 class="widgettitle">See the Source</h2>
38
+					<ul>
39
+						<li><a href="./?sauce">Main Script</li>
40
+						<li><a href="./?sauce&f=settings">Settings</li>
41
+						<li><a href="./?sauce&f=language">Language</li>
42
+					</ul>
43
+				</li>
44
+			</ul>';
45
+
46
+		$specialPage['sidebar'] = ob_get_contents();
47
+		ob_end_clean();
48
+	}
49
+}
0 50
\ No newline at end of file
1 51