b2evolution PHP Cross Reference Blogging Systems

Source: /plugins/_bookmarklet.plugin.php - 105 lines - 4379 bytes - Summary - Text - Print

Description: This file implements the Bookmarket plugin. This file is part of the b2evolution project - {@link http://b2evolution.net/}

   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-2014 by Francois Planque - {@link http://fplanque.com/}
   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 6136 2014-03-08 07:59:48Z manuel $
  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      var $number_of_installs = 1;
  35  
  36  
  37      /**
  38       * Init
  39       */
  40  	function PluginInit( & $params )
  41      {
  42          $this->short_desc = T_('Allow bookmarklet blogging.');
  43          $this->long_desc = T_('Adds a tool allowing blogging through a bookmarklet.');
  44      }
  45  
  46  
  47      /**
  48       * We are displaying the tool menu.
  49       *
  50       * @todo Do not create links/javascript code based on browser detection! But: test for functionality!
  51       *
  52       * @param array Associative array of parameters
  53       * @return boolean did we display a tool menu block?
  54       */
  55  	function AdminToolPayload( $params )
  56      {
  57          global $Hit, $admin_url;
  58  
  59          if( $Hit->is_NS4() || $Hit->is_gecko() || $Hit->is_firefox() )
  60          {
  61              ?>
  62              <p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
  63              <a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $admin_url ?>?ctrl=items&amp;action=new&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>
  64              <?php
  65              return true;
  66          }
  67          elseif( $Hit->is_winIE() )
  68          {
  69              ?>
  70              <p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
  71              <a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $admin_url ?>?ctrl=items&amp;action=new&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>
  72              </p>
  73              <?php
  74              return true;
  75          }
  76          elseif( $Hit->is_opera() )
  77          {
  78              ?>
  79              <p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
  80              <a href="javascript:void(window.open('<?php echo $admin_url ?>?ctrl=items&amp;action=new&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>
  81              <?php
  82              return true;
  83          }
  84          elseif( $Hit->is_macIE() )
  85          {
  86              ?>
  87              <p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
  88              <a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $admin_url ?>?ctrl=items&amp;action=new&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>
  89              <?php
  90              return true;
  91          }
  92          else
  93          {  // This works in Safari, at least
  94              ?>
  95              <p><?php echo T_('Add this link to your Favorites/Bookmarks:') ?><br />
  96              <a href="javascript:Q=window.getSelection();void(window.open('<?php echo $admin_url ?>?ctrl=items&amp;action=new&amp;mode=bookmarklet&amp;content='+escape(Q)+'&amp;post_url='+escape(window.location.href)+'&amp;post_title='+escape(document.title),'b2evobookmarklet','scrollbars=yes,resizable=yes,width=750,height=550,status=yes'));"><?php echo T_('b2evo bookmarklet') ?></a></p>
  97              <?php
  98              return true;
  99          }
 100  
 101          return false;
 102      }
 103  }
 104  
 105  ?>

title

Description

title

Description

title

Description

title

title

Body