! Forgot a few closing returns on package info and modification! Fixed the wordpress intergration code as it didn't work correctly in all themes
Jeremy D

Jeremy D commited on 2012-03-31 16:30:13
Showing 4 changed files, with 39 additions and 9 deletions.

... ...
@@ -7,24 +7,48 @@
7 7
 */
8 8
 if (!defined('PacManGen')) { exit('[' . basename(__FILE__) . '] Direct access restricted');}
9 9
 
10
-/* WordPress Integration
11
- * http://sleepycode.com/2011/11/wordpress-templates-on-non-wordpress-pages/
10
+/*
11
+ * WordPress Integration
12
+ * http://sleepycode.com/2011/11/wordpress-templates-on-non-wordpress-pages
12 13
 */
14
+$specialPage['headerTitle'] = 'SMF PacMan';
15
+$specialPage['pageTitlePrefix'] = 'SMF PacMan';
13 16
 require_once('../wp-ssi.php');
14 17
 
18
+// Our sauce link.
19
+$specialPage['source'] = 'See the source code: [<a href="http://git.sleepycode.com/?a=summary&p=SMF%20Package%20Manager%20Generator">Local</a>] [<a href="https://github.com/jdarwood007/smf_package_maker">GitHub</a>]';
20
+
15 21
 // Load the headers up.
16 22
 function pacman_header($headers)
17 23
 {
24
+	// Using Wordpress, we simply just add the hook and go.
25
+	add_action('wp_head', 'pacman_wp_int');
26
+}
27
+
28
+// We do nothing for the footer.
29
+function pacman_footer()
30
+{
31
+}
32
+
33
+// An integrationn function for WordPress.
34
+function pacman_wp_int()
35
+{
36
+	global $headers;
37
+
18 38
 	if (!empty($headers['css']))
19 39
 		foreach ($headers['css'] as $css)
20
-			wp_enqueue_style($css['name'], $css['href']);
40
+			echo '
41
+		<link rel="stylesheet" id="', $css['name'], '"  href="', $css['href'], '" type="text/css" media="all" />';
21 42
 
22 43
 	if (!empty($headers['js']))
23 44
 		foreach ($headers['js'] as $js)
24
-				wp_enqueue_script($js['src'], $js['src']);
25
-}
45
+			if ($js['name'] != 'jquery')
46
+				echo '
47
+		<script type="text/javascript" src="', $js['src'], '"></script>';
48
+
49
+	// Pretty source code. I care about that.
50
+	if (!empty($headers['css']) && !empty($headers['js']))
51
+		echo '
52
+';
26 53
 
27
-// We do nothing for the footer.
28
-function pacman_footer()
29
-{
30 54
 }
... ...
@@ -391,6 +391,9 @@ function show_instruct_preview()
391 391
 
392 392
 	}
393 393
 
394
+	preview += "\n" + '\
395
+</package-info>';
396
+
394 397
 	$('#preview').text(preview);
395 398
 }
396 399
 
... ...
@@ -295,6 +295,9 @@ function show_edit_preview()
295 295
 
296 296
 	}
297 297
 
298
+	preview += "\n" + '\
299
+</modification>';
300
+
298 301
 	$('#preview').text(preview);
299 302
 }
300 303
 
... ...
@@ -17,7 +17,7 @@ $pmg['scriptname'] = 'index.php';
17 17
 $pmg['downloadname'] = 'downloader.php';
18 18
 
19 19
 // Style to use.
20
-$pmg['style'] = 'default';
20
+$pmg['style'] = 'default'; // wordpress_zeesynergie
21 21
 
22 22
 // Integration with another site.
23 23
 $pmg['theme_integration'] = false;
24 24