b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.9) [ class tree: plugins ] [ index: plugins ] [ all elements ]

Source for file _bookmarklet.plugin.php

Documentation is available at _bookmarklet.plugin.php

  1. <?php
  2. /**
  3.  * This file implements the Bookmarket plugin.
  4.  *
  5.  * This file is part of the b2evolution project - {@link http://b2evolution.net/}
  6.  *
  7.  * @copyright (c)2003-2006 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *
  9.  * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  10.  *
  11.  * @package plugins
  12.  *
  13.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  14.  * @author fplanque: Francois PLANQUE - {@link http://fplanque.net/}
  15.  * @author cafelog (team) - http://cafelog.com/
  16.  *
  17.  * @version $Id: _bookmarklet.plugin.php,v 1.15.2.3 2006/12/06 23:26:04 blueyed Exp $
  18.  */
  19. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  20.  
  21.  
  22. /**
  23.  * Sidebar plugin
  24.  *
  25.  * Adds a tool allowing blogging from the sidebar
  26.  */
  27. class bookmarklet_plugin extends Plugin
  28. {
  29.     var $name = 'Bookmarklet';
  30.     var $code = 'cafeBkmk';
  31.     var $priority = 94;
  32.     var $version = '1.9-dev';
  33.     var $author = 'Cafelog team';
  34.  
  35.  
  36.     /**
  37.      * Init
  38.      */
  39.     function PluginInit$params )
  40.     {
  41.         $this->short_desc = T_('Allow bookmarklet blogging.');
  42.         $this->long_desc = T_('Adds a tool allowing blogging through a bookmarklet.');
  43.     }
  44.  
  45.  
  46.     /**
  47.      * We are displaying the tool menu.
  48.      *
  49.      * @todo Do not create links/javascript code based on browser detection! But: test for functionality!
  50.      *
  51.      * @param array Associative array of parameters
  52.      * @return boolean did we display a tool menu block?
  53.      */
  54.     function AdminToolPayload$params )
  55.     {
  56.         global $Hit$admin_url;
  57.  
  58.         if$Hit->is_NS4 || $Hit->is_gecko )
  59.         {
  60.             ?>
  61.             <p><?php echo T_('Add this link to your Favorites/Bookmarks:'?><br />
  62.             <a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $admin_url ?>?ctrl=edit&amp;mode=bookmarklet&amp;content='+escape(Q)+'&amp;post_url='+escape(location.href)+'&amp;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>
  63.             <?php
  64.             return true;
  65.         }
  66.         elseif$Hit->is_winIE )
  67.         {
  68.             ?>
  69.             <p><?php echo T_('Add this link to your Favorites/Bookmarks:'?><br />
  70.             <a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $admin_url ?>?ctrl=edit&amp;mode=bookmarklet&amp;content='+escape(Q)+'&amp;post_url='+escape(location.href)+'&amp;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>
  71.             </p>
  72.             <?php
  73.             return true;
  74.         }
  75.         elseif$Hit->is_opera )
  76.         {
  77.             ?>
  78.             <p><?php echo T_('Add this link to your Favorites/Bookmarks:'?><br />
  79.             <a href="javascript:void(window.open('<?php echo $admin_url ?>?ctrl=edit&amp;mode=bookmarklet&amp;post_url='+escape(location.href)+'&amp;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>
  80.             <?php
  81.             return true;
  82.         }
  83.         elseif$Hit->is_macIE )
  84.         {
  85.             ?>
  86.             <p><?php echo T_('Add this link to your Favorites/Bookmarks:'?><br />
  87.             <a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $admin_url ?>?ctrl=edit&amp;mode=bookmarklet&amp;content='+escape(document.getSelection())+'&amp;post_url='+escape(location.href)+'&amp;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>
  88.             <?php
  89.             return true;
  90.         }
  91.  
  92.         return false;
  93.     }
  94. }
  95.  
  96.  
  97. /*
  98.  * $Log: _bookmarklet.plugin.php,v $
  99.  * Revision 1.15.2.3  2006/12/06 23:26:04  blueyed
  100.  * MFH: fixed bookmarklet plugin (props Danny)
  101.  *
  102.  * Revision 1.15.2.2  2006/11/04 19:55:11  fplanque
  103.  * Reinjected old Log blocks. Removing them from CVS was a bad idea -- especially since Daniel has decided branch 1.9 was his HEAD...
  104.  *
  105.  * Revision 1.15  2006/07/10 20:19:30  blueyed
  106.  * Fixed PluginInit behaviour. It now gets called on both installed and non-installed Plugins, but with the "is_installed" param appropriately set.
  107.  *
  108.  * Revision 1.14  2006/07/07 21:26:49  blueyed
  109.  * Bumped to 1.9-dev
  110.  *
  111.  * Revision 1.13  2006/07/06 19:56:29  fplanque
  112.  * no message
  113.  *
  114.  * Revision 1.12  2006/06/16 21:30:57  fplanque
  115.  * Started clean numbering of plugin versions (feel free do add dots...)
  116.  *
  117.  * Revision 1.11  2006/05/30 19:39:55  fplanque
  118.  * plugin cleanup
  119.  *
  120.  * Revision 1.10  2006/05/19 15:59:52  blueyed
  121.  * Fixed bookmarklet plugin. Thanks to personman for pointing it out.
  122.  *
  123.  * Revision 1.9  2006/04/11 21:22:26  fplanque
  124.  * partial cleanup
  125.  *
  126.  */
  127. ?>

Documentation generated on Tue, 18 Dec 2007 19:12:05 +0100 by phpDocumentor 1.4.0