b2evolution PHP Cross Reference Blogging Systems

Source: /inc/widgets/widgets/_mobile_skin_switcher.widget.php - 133 lines - 3440 bytes - Summary - Text - Print

Description: This file implements the Mobile Skin Switcher Widget class. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**

   3   * This file implements the Mobile Skin Switcher Widget class.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2014 by Francois Planque - {@link http://fplanque.com/}

   9   *

  10   * {@internal License choice

  11   * - If you have received this file as part of a package, please find the license.txt file in

  12   *   the same folder or the closest folder above for complete license terms.

  13   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  14   *   then you must choose one of the following licenses before using the file:

  15   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  16   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  17   * }}

  18   *

  19   * @package evocore

  20   *

  21   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  22   * @author fplanque: Francois PLANQUE.

  23   *

  24   * @version $Id: _mobile_skin_switcher.widget.php 849 2012-02-16 09:09:09Z attila $

  25   */
  26  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  27  
  28  load_class( 'widgets/model/_widget.class.php', 'ComponentWidget' );
  29  
  30  /**

  31   * ComponentWidget Class

  32   *

  33   * A ComponentWidget is a displayable entity that can be placed into a Container on a web page.

  34   *

  35   * @package evocore

  36   */
  37  class mobile_skin_switcher_Widget extends ComponentWidget
  38  {
  39      /**

  40       * Constructor

  41       */
  42  	function mobile_skin_switcher_Widget( $db_row = NULL )
  43      {
  44          // Call parent constructor:

  45          parent::ComponentWidget( $db_row, 'core', 'mobile_skin_switcher' );
  46      }
  47  
  48  
  49      /**

  50       * Get name of widget

  51       */
  52  	function get_name()
  53      {
  54          return T_( 'Mobile Skin Switcher' );
  55      }
  56  
  57  
  58      /**

  59       * Get a very short desc. Used in the widget list.

  60       *

  61       * @return string The block title, the first 60 characters of the block

  62       *                content or an empty string.

  63       */
  64  	function get_short_desc()
  65      {
  66          if( empty( $this->disp_params['title'] ) )
  67          {
  68              return strmaxlen( $this->disp_params['content'], 60, NULL, /* use htmlspecialchars() */ 'formvalue' );
  69          }
  70  
  71          return format_to_output( $this->disp_params['title'] );
  72      }
  73  
  74  
  75    /**

  76       * Get short description

  77       */
  78  	function get_desc()
  79      {
  80          return T_('Mobile Skin Switcher.');
  81      }
  82  
  83  
  84    /**

  85     * Get definitions for editable params

  86     *

  87       * @see Plugin::GetDefaultSettings()

  88       * @param local params like 'for_editing' => true

  89       */
  90  	function get_param_definitions( $params )
  91      {
  92          // Demo data:

  93          $r = array_merge( array(
  94                  'title' => array(
  95                      'label' => T_('Title'),
  96                      'size' => 60,
  97                      'defaultvalue' => T_('Mobile skin'),
  98                  ),
  99              ), parent::get_param_definitions( $params )    );
 100  
 101          return $r;
 102  
 103      }
 104  
 105  
 106      /**

 107       * Display the widget!

 108       *

 109       * @param array MUST contain at least the basic display params

 110       */
 111  	function display( $params )
 112      {
 113          $this->init_display( $params );
 114  
 115          // Collection common links:

 116          echo $this->disp_params['block_start'];
 117  
 118          echo '<div id="switch">'.$this->disp_params['title'].':
 119              <div>
 120                  <a href="'.$_SERVER['REQUEST_URI'].'#switch" id="switch-link">
 121                      <span class="on active">'.T_('ON').'</span>
 122                      <span class="off">'.T_('OFF').'</span>
 123                  </a>
 124              </div>
 125          </div>';
 126  
 127          echo $this->disp_params['block_end'];
 128  
 129          return true;
 130      }
 131  }
 132  
 133  ?>

title

Description

title

Description

title

Description

title

title

Body