Browse Source

Add FeedReplacement Plugin and some triggers.

vbracco 16 years ago
parent
commit
b1c86ddb0b
7 changed files with 82 additions and 6 deletions
  1. 3 0
      admin/options.php
  2. 4 1
      admin/settings.php
  3. 1 1
      entry.php
  4. 4 2
      index.php
  5. 1 1
      plugins/cinco.php
  6. 68 0
      plugins/feedreplacement.php
  7. 1 1
      plugins/hola.php

+ 3 - 0
admin/options.php View File

@@ -233,6 +233,9 @@ if ($user->isAdmin()) {
233 233
 											<option value="0" <?php if(!$conf->check_version) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
234 234
 										</select>
235 235
 									</li>
236
+<?php	
237
+									$trigger->call('add_options_panel');	
238
+?>									
236 239
 								</ul>
237 240
 							</fieldset>
238 241
 							<p>

+ 4 - 1
admin/settings.php View File

@@ -109,7 +109,10 @@ if ($user->isAdmin()) {
109 109
 										}
110 110
 ?>
111 111
 										</select>
112
-									</li>									
112
+									</li>
113
+<?php	
114
+									$trigger->call('add_settings_panel');	
115
+?>
113 116
 								</ul>
114 117
 							</fieldset>
115 118
 							<p>

+ 1 - 1
entry.php View File

@@ -97,7 +97,7 @@ if($installed){
97 97
 	//print_r($plugEngine->actions);
98 98
 	//die();
99 99
 	
100
-	$trigger->call('add_post');	
100
+	$trigger->call('gelato_init');	
101 101
 
102 102
 	$feeds = new feeds();
103 103
 	$feeds->updateFeeds();

+ 4 - 2
index.php View File

@@ -56,7 +56,8 @@ $theme = new themes;
56 56
         $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/lightbox.css\" />\n";
57 57
         $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/jquery.js\"></script>\n";
58 58
         $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/lightbox.js\"></script>";
59
-
59
+		
60
+		
60 61
 		$page_title = $conf->title;
61 62
 		$page_title_divisor = " &raquo; "; // it should be set in configuration
62 63
 		$page_title_len = 50; // it should be set in configuration
@@ -75,7 +76,8 @@ $theme = new themes;
75 76
 				$page_title .= $page_title_divisor.stripslashes($page_title_data);
76 77
 			}
77 78
 		}
78
-
79
+		
80
+		$trigger->call('gelato_includes');
79 81
 		$theme->set('Gelato_includes',$gelato_includes);
80 82
 		$theme->set('Title',$conf->title);
81 83
 		$theme->set('Page_Title',$page_title);

+ 1 - 1
plugins/cinco.php View File

@@ -3,7 +3,7 @@
3 3
 class cinco extends plugins {
4 4
 	
5 5
 	function cinco() {
6
-		$this->addAction('add_post', 'dameCinco');
6
+		//$this->addAction('gelato_init', 'dameCinco');
7 7
 	}
8 8
 	
9 9
 	function dameCinco() {

+ 68 - 0
plugins/feedreplacement.php View File

@@ -0,0 +1,68 @@
1
+<?php
2
+/*
3
+Plugin Name: Feed Replacement
4
+Plugin URI: http://www.gelatocms.com/plugins/feedreplacement/
5
+Description: 
6
+Author: Victor Bracco
7
+Author URI: http://www.vbracco.com.ar/
8
+Version: 0.3
9
+*/ 
10
+class feedreplacement extends plugins {
11
+	
12
+	function feedreplacement() {
13
+		global $user, $conf, $tumble;
14
+		
15
+		//agregar al los panel de options un input mas
16
+		$this->addAction('add_options_panel', 'feedreplacement_setOptionsPanel');
17
+		
18
+		//crea o verifica que la opcion que usa de la tabla de opciones esta creada
19
+		$this->addAction('gelato_init', 'feedreplacement_check');
20
+		
21
+		//reemplaza el link del feed de gelato por el link de feedburner
22
+		$this->addAction('gelato_includes', 'feedreplacement_includeFeed');
23
+		
24
+		//lo mismo pero con el que esta en el header
25
+		//$this->addAction('add_post', 'dameCinco');
26
+		
27
+		//guarda la opcion si viene por POST
28
+		if ($user->isAdmin()) {
29
+			if(isset($_POST["feedreplacement_url"])){
30
+				if (!$tumble->saveOption($_POST["feedreplacement_url"], "feedreplacement_url")) {
31
+					header("Location: ".$conf->urlGelato."/admin/options.php?error=1&des=".$conf->merror);
32
+					die();
33
+				}	
34
+			}
35
+		}
36
+	}
37
+	
38
+	function feedreplacement_setOptionsPanel() {
39
+		global $conf;
40
+		echo '<li><label class="help" for="feedreplacement_url">'.__("Replacement Feed:").'</label>
41
+		<input type="text" name="feedreplacement_url" id="feedreplacement_url" value="'.$conf->get_option('feedreplacement_url').'" class="txt help" title="'.__("Introduce your new feed url into this input").'"/></li>';
42
+	}
43
+	
44
+	function feedreplacement_check(){
45
+		global $db,$conf;
46
+		$sqlStr = "SELECT COUNT(*) as exist FROM `".$conf->tablePrefix."options` WHERE name='feedreplacement_url' LIMIT 1";
47
+		if ($db->ejecutarConsulta($sqlStr)) {
48
+			$row=$db->obtenerRegistro();
49
+			if($row["exist"]==0){
50
+				$sql = "INSERT INTO `".$conf->tablePrefix."options` VALUES ('feedreplacement_url', '');";
51
+				$db->ejecutarConsulta($sql);
52
+			}
53
+		}
54
+	}
55
+	
56
+	function feedreplacement_includeFeed(){
57
+		global $conf,$gelato_includes;
58
+		$feedreplacement_url = $conf->get_option('feedreplacement_url');
59
+		if($feedreplacement_url!=""){
60
+			$feed = ($conf->urlFriendly?"/rss/":"/rss.php");
61
+			$url = $conf->urlGelato.$feed;
62
+			$gelato_includes = str_replace($url,$feedreplacement_url,$gelato_includes);
63
+		}
64
+	}
65
+	
66
+}
67
+
68
+?>

+ 1 - 1
plugins/hola.php View File

@@ -3,7 +3,7 @@
3 3
 class hola extends plugins {
4 4
 	
5 5
 	function hola() {
6
-		$this->addAction('add_post', 'saluda');		
6
+		//$this->addAction('gelato_init', 'saluda');		
7 7
 	}
8 8
 	
9 9
 	function saluda() {