b2evolution PHP Cross Reference Blogging Systems

Source: /inc/widgets/views/_widget_list_available.view.php - 122 lines - 3653 bytes - Text - Print

Description: This file implements the UI view for the Available widgets. This file is part of the b2evolution/evocms project - {@link http://b2evolution.net/}. See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the UI view for the Available widgets.
   4   *
   5   * This file is part of the b2evolution/evocms project - {@link http://b2evolution.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   * @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
  11   *
  12   * @package admin
  13   *
  14   * @version $Id: _widget_list_available.view.php 6136 2014-03-08 07:59:48Z manuel $
  15   */
  16  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  17  
  18  global $container;
  19  
  20  echo '<h2><span class="right_icons">'.action_icon( T_('Cancel!'), 'close', regenerate_url( 'container' ) ).'</span>'
  21      .sprintf(T_('Widgets available for insertion into &laquo;%s&raquo;'), $container ).'</h2>';
  22  
  23  
  24  $core_componentwidget_defs = array(
  25          '*'.T_('General purpose widgets'),
  26              'free_html',
  27              'coll_logo',
  28              'coll_avatar',
  29          '*'.T_('Different ways of listing the blog contents'),
  30              'coll_item_list',            // Universal Item List
  31              'coll_post_list',            // Simple List
  32              'coll_related_post_list',            // Simple List
  33              'coll_page_list',            // Simple List
  34              'coll_link_list',     // Simple List
  35              'linkblog',                // Simple List
  36              'coll_media_index',
  37              'coll_comment_list',
  38          '*'.T_('Blog navigation'),
  39              'coll_tag_cloud',
  40              'coll_category_list',
  41              'coll_common_links',
  42              'coll_search_form',
  43              'coll_xml_feeds',
  44              'menu_link',
  45              'msg_menu_link',
  46          '*'.T_('Meta info for the blog'),
  47              'coll_title',
  48              'coll_tagline',
  49              'coll_longdesc',
  50          '*'.T_('Other'),
  51              'colls_list_public',
  52              'colls_list_owner',
  53              'user_tools',
  54              'user_login',
  55              'user_avatars',
  56              'online_users',
  57              'mobile_skin_switcher',
  58      );
  59  $i = 0;
  60  foreach( $core_componentwidget_defs as $code )
  61  {
  62      $i++;
  63      if( $code[0] == '*' )
  64      { // group
  65          if( $i > 1 )
  66          {
  67              echo '</ul>';
  68          }
  69          echo '<h3>'.substr( $code, 1 ).':</h3><ul class="widget_list">';
  70      }
  71      else
  72      {
  73          $classname = $code.'_Widget';
  74          load_class( 'widgets/widgets/_'.$code.'.widget.php', $classname);
  75  
  76          $ComponentWidget = new $classname( NULL, 'core', $code );
  77  
  78          echo '<li>';
  79          echo '<a href="'.regenerate_url( '', 'action=create&amp;type=core&amp;code='.$ComponentWidget->code.'&amp;'.url_crumb('widget') ).'" title="'.T_('Add this widget to the container').'">';
  80          echo get_icon( 'new' ).'<strong>'.$ComponentWidget->get_name().'</strong>';
  81          echo '</a> <span class="notes">'.$ComponentWidget->get_desc().'</span>';
  82          echo '</li>';
  83      }
  84  }
  85  
  86  
  87  // Now, let's try to get the Plugins that implement a skintag...
  88  // TODO: at some point we may merge them with the above, but alphabetical order probably isn't the best solution
  89  
  90  /**
  91   * @var Plugins
  92   */
  93  global $Plugins, $Debuglog;
  94  
  95  $Plugin_array = $Plugins->get_list_by_event( 'SkinTag' );
  96  // Remove the plugins, which have no code, because this gets used to install them:
  97  foreach( $Plugin_array as $k => $v )
  98  {
  99      if( empty($v->code) )
 100      {
 101          $Debuglog->add( sprintf('Removing plugin %s (#%d) from list of widgets, because of empty code.', $v->classname, $v->ID), 'plugins' );
 102          unset($Plugin_array[$k]);
 103      }
 104  }
 105  if( ! empty($Plugin_array) )
 106  { // We have some plugins
 107  
 108      echo '</ul>';
 109      echo '<h3>'.T_('Plugins').':</h3><ul class="widget_list">';
 110  
 111      foreach( $Plugin_array as $ID => $Plugin )
 112      {
 113          echo '<li>';
 114          echo '<a href="'.regenerate_url( '', 'action=create&amp;type=plugin&amp;code='.$Plugin->code.'&amp;'.url_crumb('widget') ).'" title="'.T_('Add this widget to the container').'">';
 115          echo get_icon( 'new' ).'<strong>'.$Plugin->name.'</strong>';
 116          echo '</a> <span class="notes">'.$Plugin->short_desc.'</span>';
 117          echo '</li>';
 118      }
 119  }
 120  echo '</ul>';
 121  
 122  ?>

title

Description

title

Description

title

Description

title

title

Body