Cleaned up code in some of my extensions
Removed function testImage in ext/chatbox/test.php because it no longer applies (there is a cache now)
This commit is contained in:
parent
a55c5efc4f
commit
7155804505
4 changed files with 12 additions and 27 deletions
|
@ -11,23 +11,18 @@
|
|||
class google_analytics extends Extension {
|
||||
# Add analytics to config
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
global $config;
|
||||
|
||||
$sb = new SetupBlock("Google Analytics");
|
||||
$sb->add_text_option("google_analytics_id", "Analytics ID: ");
|
||||
$sb->add_label("<br>(eg. UA-xxxxxxxx-x)");
|
||||
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
# Load Analytics tracking code on page request
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config;
|
||||
global $page;
|
||||
global $config, $page;
|
||||
|
||||
$google_analytics_id = $config->get_string('google_analytics_id','');
|
||||
if (stristr($google_analytics_id, "UA-"))
|
||||
{
|
||||
if (stristr($google_analytics_id, "UA-")) {
|
||||
$page->add_html_header("<script type='text/javascript'>
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '$google_analytics_id']);
|
||||
|
|
|
@ -42,6 +42,8 @@ class SCoreWebReporter extends HtmlReporter {
|
|||
}
|
||||
|
||||
function paintGroupEnd($name) {
|
||||
global $page;
|
||||
|
||||
$matches = array();
|
||||
if(preg_match("#ext/(.*)/test.php#", $name, $matches)) {
|
||||
$name = $matches[1];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* Name: XML Sitemap
|
||||
* Author: Sein Kraft <mail@seinkraft.info>
|
||||
* Author: Drudex Software <support@drudexsoftware.com>
|
||||
* Link: http://drudexsoftware.com
|
||||
* License: GPLv2
|
||||
* Description: Sitemap with caching & advanced priorities
|
||||
* Documentation:
|
||||
|
@ -118,21 +119,20 @@ class XMLSitemap extends Extension {
|
|||
}
|
||||
}
|
||||
|
||||
// sets sitemap with entries in the queue
|
||||
// sets sitemap with entries in sitemap_queue
|
||||
private function generate_display_sitemap()
|
||||
{
|
||||
global $page;
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/xml");
|
||||
|
||||
$xml = "<"."?xml version=\"1.0\" encoding=\"utf-8\"?".">
|
||||
<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">
|
||||
$this->sitemap_queue
|
||||
</urlset>";
|
||||
|
||||
// Generate new sitemap & display
|
||||
file_put_contents($this->sitemap_filepath, $xml);
|
||||
// Generate new sitemap
|
||||
file_put_contents($this->sitemap_filepath, $xml);
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/xml");
|
||||
$page->set_data($xml);
|
||||
}
|
||||
|
||||
|
@ -154,11 +154,11 @@ class XMLSitemap extends Extension {
|
|||
private function display_existing_sitemap()
|
||||
{
|
||||
global $page;
|
||||
|
||||
$xml = file_get_contents($this->sitemap_filepath);
|
||||
|
||||
$page->set_mode("data");
|
||||
$page->set_type("application/xml");
|
||||
|
||||
$xml = file_get_contents($this->sitemap_filepath);
|
||||
$page->set_data($xml);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,17 +5,5 @@ class XMLSitemapTest extends ShimmieWebTestCase {
|
|||
# PHP-level error messages
|
||||
$this->get_page('sitemap.xml');
|
||||
}
|
||||
|
||||
function testImage() {
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx");
|
||||
$this->log_out();
|
||||
|
||||
$this->get_page('sitemap.xml');
|
||||
|
||||
$this->log_in_as_admin();
|
||||
$this->delete_image($image_id);
|
||||
$this->log_out();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
Reference in a new issue