start.php ➔ blog_tools_init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 48

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 48
rs 9.1344
c 0
b 0
f 0
1
<?php
2
/**
3
 * The main file for this plugin
4
 */
5
6
require_once(dirname(__FILE__) . "/lib/functions.php");
7
8
// register default elgg events
9
elgg_register_event_handler("init", "system", "blog_tools_init");
10
11
/**
12
 * This function gets called during the system initialization
13
 *
14
 * @return void
15
 */
16
function blog_tools_init() {
17
	
18
	// extend css
19
	elgg_extend_view("css/elgg", "css/blog_tools/site");
20
	elgg_extend_view("js/elgg", "js/blog_tools/site");
21
	
22
	// extra blog views
23
	elgg_extend_view("object/blog", "blog_tools/full/navigation");
24
	elgg_extend_view("object/blog", "blog_tools/full/owner");
25
	elgg_extend_view("object/blog", "blog_tools/full/related");
26
	elgg_extend_view("blog/sidebar", "blog_tools/full/related");
27
		
28
	// register event handlers
29
	elgg_register_event_handler("delete", "object", array("\ColdTrick\BlogTools\DeleteHandler", "cleanupBlogIcon"));
0 ignored issues
show
Documentation introduced by
array('\\ColdTrick\\Blog...er', 'cleanupBlogIcon') is of type array<integer,string,{"0":"string","1":"string"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
30
	
31
	// register plugin hook handlers
32
	elgg_register_plugin_hook_handler("entity:url", "object", array("\ColdTrick\BlogTools\Widgets", "widgetUrl"));
33
	elgg_register_plugin_hook_handler("cron", "daily", array("\ColdTrick\BlogTools\Cron", "daily"));
34
	elgg_register_plugin_hook_handler("entity:icon:url", "object", array("\ColdTrick\BlogTools\EntityIcon", "blogIcon"));
35
	elgg_register_plugin_hook_handler("route", "blog", array("\ColdTrick\BlogTools\Router", "blog"));
36
	elgg_register_plugin_hook_handler("register", "menu:entity", array("\ColdTrick\BlogTools\EntityMenu", "register"));
37
	elgg_register_plugin_hook_handler("group_tool_widgets", "widget_manager", array("\ColdTrick\BlogTools\Widgets", "groupTools"));
38
	elgg_register_plugin_hook_handler("permissions_check:comment", "object", array("\ColdTrick\BlogTools\Access", "blogCanComment"));
39
	
40
	// extend editmenu
41
	elgg_extend_view("editmenu", "blog_tools/editmenu");
42
	
43
	// add featured filter menu item
44
	elgg_register_menu_item("filter", ElggMenuItem::factory(array(
45
		"name" => "featured",
46
		"text" => elgg_echo("blog_tools:menu:filter:featured"),
47
		"context" => "blog",
48
		"href" => "blog/featured",
49
		"priority" => 600
50
	)));
51
	
52
	// register index widget
53
	elgg_register_widget_type("index_blog", elgg_echo("blog"), elgg_echo("blog_tools:widgets:index_blog:description"), array("index"), true);
54
	elgg_register_widget_type("blog", elgg_echo("blog"), elgg_echo("blog:widget:description"), array("profile", "dashboard", "groups"));
55
	
56
	// overrule blog actions
57
	elgg_register_action("blog/save", dirname(__FILE__) . "/actions/blog/save.php");
58
	elgg_register_action("blog/auto_save_revision", dirname(__FILE__) . "/actions/blog/auto_save_revision.php");
59
	
60
	// register actions
61
	elgg_register_action("blog_tools/toggle_metadata", dirname(__FILE__) . "/actions/toggle_metadata.php", "admin");
62
	
63
}
64