b2evolution PHP Cross Reference Blogging Systems

Source: /inc/collections/views/_coll_plugin_settings.form.php - 114 lines - 3433 bytes - Text - Print

Description: This file implements the PLugin settings form. 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 PLugin settings form.
   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   * {@internal Open Source relicensing agreement:
  20   * }}
  21   *
  22   * @package admin
  23   *
  24   * @author fplanque: Francois PLANQUE.
  25   *
  26   * @version $Id: _coll_plugin_settings.form.php 6136 2014-03-08 07:59:48Z manuel $
  27   */
  28  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  29  
  30  /**
  31   * @var Blog
  32   */
  33  global $Blog;
  34  
  35  /**
  36   * @var Plugins
  37   */
  38  global $Plugins;
  39  
  40  global $current_User, $admin_url;
  41  
  42  $Form = new Form( NULL, 'plugin_settings_checkchanges' );
  43  
  44  // PluginUserSettings
  45  load_funcs('plugins/_plugin.funcs.php');
  46  
  47  if( $current_User->check_perm( 'options', 'edit', false ) )
  48  {    // Display this message only if current user has permission to manage the plugins
  49      echo '<p class="center">'
  50              .sprintf( T_('Here you can configure some plugins individually for each blog. To manage your installed plugins go <a %s>here</a>.'),
  51                            'href="'.$admin_url.'?ctrl=plugins"' )
  52          .'</p>';
  53  }
  54  
  55  $have_plugins = false;
  56  $Plugins->restart();
  57  while( $loop_Plugin = & $Plugins->get_next() )
  58  {
  59      $Form->begin_form( 'fform' );
  60  
  61          $Form->add_crumb( 'collection' );
  62          $Form->hidden_ctrl();
  63          $Form->hidden( 'tab', 'plugin_settings' );
  64          $Form->hidden( 'action', 'update' );
  65          $Form->hidden( 'blog', $Blog->ID );
  66  
  67      // We use output buffers here to display the fieldset only if there's content in there
  68      ob_start();
  69  
  70      $priority_link = '<a href="'.$loop_Plugin->get_edit_settings_url().'#ffield_edited_plugin_code">'.$loop_Plugin->priority.'</a>';
  71      $Form->begin_fieldset( $loop_Plugin->name.' '.$loop_Plugin->get_help_link('$help_url').' ('.T_('Priority').': '.$priority_link.')'.get_manual_link('blog_plugin_settings') );
  72  
  73      ob_start();
  74  
  75      $plugin_settings = $loop_Plugin->get_coll_setting_definitions( $tmp_params = array( 'for_editing' => true, 'blog_ID' => $Blog->ID ) );
  76      if( is_array($plugin_settings) )
  77      {
  78          foreach( $plugin_settings as $l_name => $l_meta )
  79          {
  80              // Display form field for this setting:
  81              autoform_display_field( $l_name, $l_meta, $Form, 'CollSettings', $loop_Plugin, $Blog );
  82          }
  83      }
  84  
  85      $has_contents = strlen( ob_get_contents() );
  86  
  87      $Form->end_fieldset();
  88  
  89      if( $has_contents )
  90      {
  91          ob_end_flush();
  92          ob_end_flush();
  93  
  94          $have_plugins = true;
  95      }
  96      else
  97      { // No content, discard output buffers:
  98          ob_end_clean();
  99          ob_end_clean();
 100      }
 101  }
 102  
 103  if( $have_plugins )
 104  {    // End form:
 105      $Form->end_form( array( array( 'submit', 'submit', T_('Update'), 'SaveButton' ),
 106                                                              array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 107  }
 108  else
 109  {    // Display a message:
 110      echo '<p>', T_( 'There are no plugins providing blog-specific settings.' ), '</p>';
 111      $Form->end_form();
 112  }
 113  
 114  ?>

title

Description

title

Description

title

Description

title

title

Body