b2evolution PHP Cross Reference Blogging Systems

Source: /inc/plugins/model/_pluginsettings.class.php - 97 lines - 2933 bytes - Summary - Text - Print

Description: This file implements the PluginSettings class, to handle plugin/name/value triplets. 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 PluginSettings class, to handle plugin/name/value triplets.
   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   * Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.
  10   *
  11   * {@internal License choice
  12   * - If you have received this file as part of a package, please find the license.txt file in
  13   *   the same folder or the closest folder above for complete license terms.
  14   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  15   *   then you must choose one of the following licenses before using the file:
  16   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  17   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  18   * }}
  19   *
  20   * {@internal Open Source relicensing agreement:
  21   * Daniel HAHLER grants Francois PLANQUE the right to license
  22   * Daniel HAHLER's contributions to this file and the b2evolution project
  23   * under any OSI approved OSS license (http://www.opensource.org/licenses/).
  24   * }}
  25   *
  26   * @package plugins
  27   *
  28   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  29   * @author blueyed: Daniel HAHLER.
  30   *
  31   * @version $Id: _pluginsettings.class.php 6136 2014-03-08 07:59:48Z manuel $
  32   *
  33   */
  34  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  35  
  36  load_class( 'settings/model/_abstractsettings.class.php', 'AbstractSettings' );
  37  
  38  /**
  39   * Class to handle settings for plugins
  40   *
  41   * @package plugins
  42   */
  43  class PluginSettings extends AbstractSettings
  44  {
  45      /**
  46       * Constructor
  47       *
  48       * @param integer plugin ID where these settings are for
  49       */
  50  	function PluginSettings( $plugin_ID )
  51      { // constructor
  52          parent::AbstractSettings( 'T_pluginsettings', array( 'pset_plug_ID', 'pset_name' ), 'pset_value', 1 );
  53  
  54          $this->plugin_ID = $plugin_ID;
  55      }
  56  
  57  
  58      /**
  59       * Get a setting by name for the Plugin.
  60       *
  61       * @param string The settings name.
  62       * @return mixed|NULL|false False in case of error, NULL if not found, the value otherwise.
  63       */
  64  	function get( $setting )
  65      {
  66          return parent::get( $this->plugin_ID, $setting );
  67      }
  68  
  69  
  70      /**
  71       * Set a Plugin setting. Use {@link dbupdate()} to write it to the database.
  72       *
  73       * @param string The settings name.
  74       * @param string The settings value.
  75       * @return boolean true, if the value has been set, false if it has not changed.
  76       */
  77  	function set( $setting, $value )
  78      {
  79          return parent::set( $this->plugin_ID, $setting, $value );
  80      }
  81  
  82  
  83      /**
  84       * Delete a setting.
  85       *
  86       * Use {@link dbupdate()} to commit it to the database.
  87       *
  88       * @param string name of setting
  89       */
  90  	function delete( $setting )
  91      {
  92          return parent::delete( $this->plugin_ID, $setting );
  93      }
  94  
  95  }
  96  
  97  ?>

title

Description

title

Description

title

Description

title

title

Body