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
 											<option value="0" <?php if(!$conf->check_version) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
233
 											<option value="0" <?php if(!$conf->check_version) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
234
 										</select>
234
 										</select>
235
 									</li>
235
 									</li>
236
+<?php	
237
+									$trigger->call('add_options_panel');	
238
+?>									
236
 								</ul>
239
 								</ul>
237
 							</fieldset>
240
 							</fieldset>
238
 							<p>
241
 							<p>

+ 4 - 1
admin/settings.php View File

109
 										}
109
 										}
110
 ?>
110
 ?>
111
 										</select>
111
 										</select>
112
-									</li>									
112
+									</li>
113
+<?php	
114
+									$trigger->call('add_settings_panel');	
115
+?>
113
 								</ul>
116
 								</ul>
114
 							</fieldset>
117
 							</fieldset>
115
 							<p>
118
 							<p>

+ 1 - 1
entry.php View File

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

+ 4 - 2
index.php View File

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

+ 1 - 1
plugins/cinco.php View File

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

+ 68 - 0
plugins/feedreplacement.php View File

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