Created
December 4, 2010 08:46
-
-
Save dimkalinux/728043 to your computer and use it in GitHub Desktop.
manifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE extension SYSTEM "ext-1.0.dtd"> | |
<!-- | |
/** | |
* | |
* This extension allows you to load the statistics only on click, to reduce the number of queries on the index page using Jquery. | |
* Cette extension permet de charger les statistiques uniquement lors d'un clic, afin de réduire le nombre de requètes sur la page index en utilisant jquery. | |
* | |
* @copyright Copyright (C) 2008 PunBB | |
* @license http://www.gnu.org/licenses/gpl.html GPL version 2 or higher | |
* @package onclickshow_stats v1 by Nonante | |
* | |
*/ | |
--> | |
<extension engine="1.0"> | |
<id>onclickshow_stats</id> | |
<title>Onclick Show Stats</title> | |
<version>1</version> | |
<description>This extension allows you to load the statistics only on click, to reduce the number of queries on the index page using Jquery.</description> | |
<author>Nonante</author> | |
<minversion>1.3.4</minversion> | |
<maxtestedon>1.3.4</maxtestedon> | |
<note type="install" timing="pre">After installation go to Settings > Features > General PunBB features which are optional</note> | |
<install><![CDATA[ | |
if (!isset($forum_config['o_onclickshow_stats_jquery'])) | |
{ | |
$query = array( | |
'INSERT' => 'conf_name, conf_value', | |
'INTO' => 'config', | |
'VALUES' => '"o_onclickshow_stats_jquery", "1"' | |
); | |
$forum_db->query_build($query); | |
} | |
]]> | |
</install> | |
<uninstall><![CDATA[ | |
$query = array( | |
'DELETE' => 'config', | |
'WHERE' => 'conf_name="o_onclickshow_stats_jquery"' | |
); | |
$forum_db->query_build($query); | |
]]></uninstall> | |
<hooks> | |
<hook id="aop_features_validation"><![CDATA[ | |
if (!isset($form['onclickshow_stats_jquery']) || $form['onclickshow_stats_jquery'] != '1') $form['onclickshow_stats_jquery'] = '0'; | |
]]></hook> | |
<hook id="aop_features_pre_general_fieldset_end"><![CDATA[ | |
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php')) | |
include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'; | |
else | |
include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php'; | |
?> | |
<div class="sf-set set<?php echo ++$forum_page['item_count'] ?>"> | |
<div class="sf-box checkbox"> | |
<span class="fld-input"><input type="checkbox" id="fld<?php echo ++$forum_page['fld_count'] ?>" name="form[onclickshow_stats_jquery]" value="1"<?php if ($forum_config['o_onclickshow_stats_jquery'] == '1') echo ' checked="checked"' ?> /></span> | |
<label for="fld<?php echo $forum_page['fld_count'] ?>"><span><?php echo $lang_onclickshow_stats['Label Jquery'] ?></span> <?php echo $lang_onclickshow_stats['Label Jquery help'] ?></label> | |
</div> | |
</div> | |
<?php | |
]]></hook> | |
<hook id="in_info_output_start"><![CDATA[ | |
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php')) | |
include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'; | |
else | |
include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php'; | |
if (is_readable($ext_info['path'].DIRECTORY_SEPARATOR.$ext_info['id'].'.php')) : | |
?> | |
<div id="result_onclickshow_stats"></div> | |
<p id="onclickshow_stats"><a href="#onclickshow_stats"><?php echo forum_htmlencode($lang_onclickshow_stats['Default text']) ?></a></p> | |
<?php | |
endif; | |
$tpl_temp = forum_trim(ob_get_contents()); | |
$tpl_main = str_replace('<!-- forum_info -->', $tpl_temp, $tpl_main); | |
ob_end_clean(); | |
// END SUBST - <!-- forum_info --> | |
require FORUM_ROOT.'footer.php'; | |
die(); | |
]]></hook> | |
<hook id="ft_about_end"><![CDATA[ | |
$onclick_show_file = $base_url.'/extensions/'.$ext_info['id'].'/'.$ext_info['id'].'.php'; | |
if ($forum_config['o_onclickshow_stats_jquery'] == '1') : | |
?> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> | |
<script type="text/javascript"> | |
google.load("jquery", "1"); | |
</script> | |
<?php | |
endif; | |
?> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$(function() { | |
$("#onclickshow_stats").click(function () { | |
$.post("<?php echo $onclick_show_file;?>", { | |
showme: true, | |
csrf_token: "<?php echo generate_form_token($onclick_show_file);?>", | |
}, | |
function(data){ | |
$('#result_onclickshow_stats').html(data).hide().fadeIn(2500, function() { | |
$('#onclickshow_stats').fadeOut(); | |
}); | |
}); | |
}); | |
}); | |
}); | |
</script> | |
<?php | |
$tpl_temp = forum_trim(ob_get_contents()); | |
$tpl_main = str_replace('<!-- forum_about -->', $tpl_temp, $tpl_main); | |
ob_end_clean(); | |
// END SUBST - <!-- forum_about --> | |
// START SUBST - <!-- forum_debug --> | |
if (defined('FORUM_DEBUG') || defined('FORUM_SHOW_QUERIES')) | |
{ | |
ob_start(); | |
($hook = get_hook('ft_debug_output_start')) ? eval($hook) : null; | |
// Display debug info (if enabled/defined) | |
if (defined('FORUM_DEBUG')) | |
{ | |
// Calculate script generation time | |
list($usec, $sec) = explode(' ', microtime()); | |
$time_diff = forum_number_format(((float)$usec + (float)$sec) - $forum_start, 3); | |
echo '<p id="querytime">[ '.sprintf($lang_common['Querytime'], $time_diff, forum_number_format($forum_db->get_num_queries())).' ]</p>'."\n"; | |
} | |
if (defined('FORUM_SHOW_QUERIES')) | |
echo get_saved_queries(); | |
($hook = get_hook('ft_debug_end')) ? eval($hook) : null; | |
$tpl_temp = forum_trim(ob_get_contents()); | |
$tpl_main = str_replace('<!-- forum_debug -->', $tpl_temp, $tpl_main); | |
ob_end_clean(); | |
} | |
// END SUBST - <!-- forum_debug --> | |
// Last call! | |
($hook = get_hook('ft_end')) ? eval($hook) : null; | |
// End the transaction | |
$forum_db->end_transaction(); | |
// Close the db connection (and free up any result data) | |
$forum_db->close(); | |
// Spit out the page | |
exit($tpl_main); | |
]]></hook> | |
</hooks> | |
</extension> |
Better way to delete ext configs
// Delete extension options from the config
$query = array(
'DELETE' => 'config',
'WHERE' => 'conf_name in ('o_fancy_simtopics_num_topics', 'o_fancy_simtopics_time_topics', 'o_fancy_simtopics_one_forum', 'o_fancy_simtopics_show_for_guest')',
);
$forum_db->query_build($query) or error(FILE, LINE);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
30 line - " may cause problem on PostgreSQL DB - better way 'VALUES' => ''o_onclickshow_stats_jquery', '1''