Add FeedReplacement Plugin and some triggers.
parent
1d00d46f5d
commit
b1c86ddb0b
|
|
@ -233,6 +233,9 @@ if ($user->isAdmin()) {
|
||||||
<option value="0" <?php if(!$conf->check_version) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
|
<option value="0" <?php if(!$conf->check_version) echo "selected=\"selected\""; ?>><?php echo __("Deactive")?></option>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
|
<?php
|
||||||
|
$trigger->call('add_options_panel');
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,9 @@ if ($user->isAdmin()) {
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
|
<?php
|
||||||
|
$trigger->call('add_settings_panel');
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ if($installed){
|
||||||
//print_r($plugEngine->actions);
|
//print_r($plugEngine->actions);
|
||||||
//die();
|
//die();
|
||||||
|
|
||||||
$trigger->call('add_post');
|
$trigger->call('gelato_init');
|
||||||
|
|
||||||
$feeds = new feeds();
|
$feeds = new feeds();
|
||||||
$feeds->updateFeeds();
|
$feeds->updateFeeds();
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ $theme = new themes;
|
||||||
$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/jquery.js\"></script>\n";
|
$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/jquery.js\"></script>\n";
|
||||||
$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/lightbox.js\"></script>";
|
$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/lightbox.js\"></script>";
|
||||||
|
|
||||||
|
|
||||||
$page_title = $conf->title;
|
$page_title = $conf->title;
|
||||||
$page_title_divisor = " » "; // it should be set in configuration
|
$page_title_divisor = " » "; // it should be set in configuration
|
||||||
$page_title_len = 50; // it should be set in configuration
|
$page_title_len = 50; // it should be set in configuration
|
||||||
|
|
@ -76,6 +77,7 @@ $theme = new themes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$trigger->call('gelato_includes');
|
||||||
$theme->set('Gelato_includes',$gelato_includes);
|
$theme->set('Gelato_includes',$gelato_includes);
|
||||||
$theme->set('Title',$conf->title);
|
$theme->set('Title',$conf->title);
|
||||||
$theme->set('Page_Title',$page_title);
|
$theme->set('Page_Title',$page_title);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
class cinco extends plugins {
|
class cinco extends plugins {
|
||||||
|
|
||||||
function cinco() {
|
function cinco() {
|
||||||
$this->addAction('add_post', 'dameCinco');
|
//$this->addAction('gelato_init', 'dameCinco');
|
||||||
}
|
}
|
||||||
|
|
||||||
function dameCinco() {
|
function dameCinco() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: Feed Replacement
|
||||||
|
Plugin URI: http://www.gelatocms.com/plugins/feedreplacement/
|
||||||
|
Description:
|
||||||
|
Author: Victor Bracco
|
||||||
|
Author URI: http://www.vbracco.com.ar/
|
||||||
|
Version: 0.3
|
||||||
|
*/
|
||||||
|
class feedreplacement extends plugins {
|
||||||
|
|
||||||
|
function feedreplacement() {
|
||||||
|
global $user, $conf, $tumble;
|
||||||
|
|
||||||
|
//agregar al los panel de options un input mas
|
||||||
|
$this->addAction('add_options_panel', 'feedreplacement_setOptionsPanel');
|
||||||
|
|
||||||
|
//crea o verifica que la opcion que usa de la tabla de opciones esta creada
|
||||||
|
$this->addAction('gelato_init', 'feedreplacement_check');
|
||||||
|
|
||||||
|
//reemplaza el link del feed de gelato por el link de feedburner
|
||||||
|
$this->addAction('gelato_includes', 'feedreplacement_includeFeed');
|
||||||
|
|
||||||
|
//lo mismo pero con el que esta en el header
|
||||||
|
//$this->addAction('add_post', 'dameCinco');
|
||||||
|
|
||||||
|
//guarda la opcion si viene por POST
|
||||||
|
if ($user->isAdmin()) {
|
||||||
|
if(isset($_POST["feedreplacement_url"])){
|
||||||
|
if (!$tumble->saveOption($_POST["feedreplacement_url"], "feedreplacement_url")) {
|
||||||
|
header("Location: ".$conf->urlGelato."/admin/options.php?error=1&des=".$conf->merror);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function feedreplacement_setOptionsPanel() {
|
||||||
|
global $conf;
|
||||||
|
echo '<li><label class="help" for="feedreplacement_url">'.__("Replacement Feed:").'</label>
|
||||||
|
<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>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function feedreplacement_check(){
|
||||||
|
global $db,$conf;
|
||||||
|
$sqlStr = "SELECT COUNT(*) as exist FROM `".$conf->tablePrefix."options` WHERE name='feedreplacement_url' LIMIT 1";
|
||||||
|
if ($db->ejecutarConsulta($sqlStr)) {
|
||||||
|
$row=$db->obtenerRegistro();
|
||||||
|
if($row["exist"]==0){
|
||||||
|
$sql = "INSERT INTO `".$conf->tablePrefix."options` VALUES ('feedreplacement_url', '');";
|
||||||
|
$db->ejecutarConsulta($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function feedreplacement_includeFeed(){
|
||||||
|
global $conf,$gelato_includes;
|
||||||
|
$feedreplacement_url = $conf->get_option('feedreplacement_url');
|
||||||
|
if($feedreplacement_url!=""){
|
||||||
|
$feed = ($conf->urlFriendly?"/rss/":"/rss.php");
|
||||||
|
$url = $conf->urlGelato.$feed;
|
||||||
|
$gelato_includes = str_replace($url,$feedreplacement_url,$gelato_includes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
class hola extends plugins {
|
class hola extends plugins {
|
||||||
|
|
||||||
function hola() {
|
function hola() {
|
||||||
$this->addAction('add_post', 'saluda');
|
//$this->addAction('gelato_init', 'saluda');
|
||||||
}
|
}
|
||||||
|
|
||||||
function saluda() {
|
function saluda() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue