diff options
author | ArthurHoaro <arthur@hoa.ro> | 2017-01-16 12:39:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-16 12:39:24 +0100 |
commit | 514185e14b09d1e37c41eb5d2720e3e45b12eea9 (patch) | |
tree | 3509a6a5dfad640c939db6b1970cde18326ab9f2 | |
parent | d7d240f136125d2b66c4f7c82a1e2e0f98f4bae3 (diff) | |
parent | 053673cb71a45a38a2eb517c4e630656a5626327 (diff) | |
download | Shaarli-514185e14b09d1e37c41eb5d2720e3e45b12eea9.tar.gz Shaarli-514185e14b09d1e37c41eb5d2720e3e45b12eea9.tar.zst Shaarli-514185e14b09d1e37c41eb5d2720e3e45b12eea9.zip |
Merge pull request #760 from ArthurHoaro/plugins/addlink-css-404
Remove CSS call for addlink toolbar plugin
-rw-r--r-- | plugins/addlink_toolbar/addlink_toolbar.php | 16 | ||||
-rw-r--r-- | tests/plugins/PluginAddlinkTest.php | 40 |
2 files changed, 0 insertions, 56 deletions
diff --git a/plugins/addlink_toolbar/addlink_toolbar.php b/plugins/addlink_toolbar/addlink_toolbar.php index bf8a198a..ddf50aaf 100644 --- a/plugins/addlink_toolbar/addlink_toolbar.php +++ b/plugins/addlink_toolbar/addlink_toolbar.php | |||
@@ -40,19 +40,3 @@ function hook_addlink_toolbar_render_header($data) | |||
40 | 40 | ||
41 | return $data; | 41 | return $data; |
42 | } | 42 | } |
43 | |||
44 | /** | ||
45 | * When link list is displayed, include markdown CSS. | ||
46 | * | ||
47 | * @param array $data - includes data. | ||
48 | * | ||
49 | * @return mixed - includes data with markdown CSS file added. | ||
50 | */ | ||
51 | function hook_addlink_toolbar_render_includes($data) | ||
52 | { | ||
53 | if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) { | ||
54 | $data['css_files'][] = PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.css'; | ||
55 | } | ||
56 | |||
57 | return $data; | ||
58 | } | ||
diff --git a/tests/plugins/PluginAddlinkTest.php b/tests/plugins/PluginAddlinkTest.php index b77fe12a..b6239e7f 100644 --- a/tests/plugins/PluginAddlinkTest.php +++ b/tests/plugins/PluginAddlinkTest.php | |||
@@ -57,44 +57,4 @@ class PluginAddlinkTest extends PHPUnit_Framework_TestCase | |||
57 | $this->assertEquals($str, $data[$str]); | 57 | $this->assertEquals($str, $data[$str]); |
58 | $this->assertArrayNotHasKey('fields_toolbar', $data); | 58 | $this->assertArrayNotHasKey('fields_toolbar', $data); |
59 | } | 59 | } |
60 | |||
61 | /** | ||
62 | * Test render_includes hook while logged in. | ||
63 | */ | ||
64 | public function testAddlinkIncludesLoggedIn() | ||
65 | { | ||
66 | $str = 'stuff'; | ||
67 | $data = array($str => $str); | ||
68 | $data['_PAGE_'] = Router::$PAGE_LINKLIST; | ||
69 | $data['_LOGGEDIN_'] = true; | ||
70 | |||
71 | $data = hook_addlink_toolbar_render_includes($data); | ||
72 | $this->assertEquals($str, $data[$str]); | ||
73 | $this->assertEquals(1, count($data['css_files'])); | ||
74 | |||
75 | $str = 'stuff'; | ||
76 | $data = array($str => $str); | ||
77 | $data['_PAGE_'] = $str; | ||
78 | $data['_LOGGEDIN_'] = true; | ||
79 | |||
80 | $data = hook_addlink_toolbar_render_includes($data); | ||
81 | $this->assertEquals($str, $data[$str]); | ||
82 | $this->assertArrayNotHasKey('css_files', $data); | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * Test render_includes hook. | ||
87 | * Should not affect css files while logged out. | ||
88 | */ | ||
89 | public function testAddlinkIncludesLoggedOut() | ||
90 | { | ||
91 | $str = 'stuff'; | ||
92 | $data = array($str => $str); | ||
93 | $data['_PAGE_'] = Router::$PAGE_LINKLIST; | ||
94 | $data['_LOGGEDIN_'] = false; | ||
95 | |||
96 | $data = hook_addlink_toolbar_render_includes($data); | ||
97 | $this->assertEquals($str, $data[$str]); | ||
98 | $this->assertArrayNotHasKey('css_files', $data); | ||
99 | } | ||
100 | } | 60 | } |