Repository navigation
Expand file tree
/
Copy path_bookmarklet.plugin.php
More file actions
99 lines (90 loc) · 3.98 KB
/
Copy path_bookmarklet.plugin.php
File metadata and controls
99 lines (90 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* This file implements the Bookmarket plugin.
*
* This file is part of the b2evolution project - {@link http://b2evolution.net/}
*
* @license GNU GPL v2 - {@link http://b2evolution.net/about/gnu-gpl-license}
*
* @copyright (c)2003-2015 by Francois Planque - {@link http://fplanque.com/}
*
* @package plugins
*/
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
/**
* Sidebar plugin
*
* Adds a tool allowing blogging from the sidebar
*/
class bookmarklet_plugin extends Plugin
{
var $name = 'Bookmarklet';
var $code = 'cafeBkmk';
var $priority = 94;
var $version = '1.9-dev';
var $author = 'Cafelog team';
var $number_of_installs = 1;
/**
* Init
*/
function PluginInit( & $params )
{
$this->short_desc = T_('Allow bookmarklet blogging.');
$this->long_desc = T_('Adds a tool allowing blogging through a bookmarklet.');
}
/**
* We are displaying the tool menu.
*
* @todo Do not create links/javascript code based on browser detection! But: test for functionality!
*
* @param array Associative array of parameters
* @return boolean did we display a tool menu block?
*/
function AdminToolPayload( $params )
{
global $Hit, $admin_url;
if( $Hit->is_NS4() || $Hit->is_gecko() || $Hit->is_firefox() )
{
?>
<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $admin_url ?>?ctrl=items&action=new&mode=bookmarklet&content='+escape(Q)+'&post_url='+escape(location.href)+'&post_title='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
<?php
return true;
}
elseif( $Hit->is_winIE() )
{
?>
<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $admin_url ?>?ctrl=items&action=new&mode=bookmarklet&content='+escape(Q)+'&post_url='+escape(location.href)+'&post_title='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));btw.focus();"><?php echo T_('b2evo bookmarklet') ?></a>
</p>
<?php
return true;
}
elseif( $Hit->is_opera() )
{
?>
<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
<a href="javascript:void(window.open('<?php echo $admin_url ?>?ctrl=items&action=new&mode=bookmarklet&post_url='+escape(location.href)+'&post_title='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
<?php
return true;
}
elseif( $Hit->is_macIE() )
{
?>
<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $admin_url ?>?ctrl=items&action=new&mode=bookmarklet&content='+escape(document.getSelection())+'&post_url='+escape(location.href)+'&post_title='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,left=25,top=15,status=yes'));btw.focus();"><?php echo T_('b2evo bookmarklet') ?></a></p>
<?php
return true;
}
else
{ // This works in Safari, at least
?>
<p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
<a href="javascript:Q=window.getSelection();void(window.open('<?php echo $admin_url ?>?ctrl=items&action=new&mode=bookmarklet&content='+escape(Q)+'&post_url='+escape(window.location.href)+'&post_title='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
<?php
return true;
}
return false;
}
}
?>