plugins:nanasisan:nanasisan_code

NP_NanasiSan.phpのソースコード

<?php
 
/**
 * NP_NanasiSan v1.1
 * Enable posting comment without name.
 * --------
 * Copyright (C) 2006 NKJG
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 * --------
 * History :
 * ver.1.0 (20060220)
 * - Initial release.
 * ver.1.1 (20060322)
 * - Add 'Activate' option.
 */
 
 
class NP_NanasiSan extends NucleusPlugin {
  function getName(){ return 'NanasiSan'; }
  function getAuthor(){ return 'NKJG'; }
  function getURL(){ return 'http://niku.suku.name/'; }
  function getVersion(){ return '1.1'; }
  function getMinNucleusVersion() { return '322'; }
 
  function getDescription(){
    return 'Enable posting comment without name.';
  }
 
  function supportsFeature($what) { return (int)($what == 'SqlTablePrefix'); }
 
  function getEventList() {
    return array('ParseURL');
  }
 
  function install() {
    $this->createOption('name', 'Substitude name :', 'text', 'no name');
    $this->createOption('active', 'Activate :', 'yesno', 'yes');
  }
 
  function event_ParseURL(&$data) {
    if ($this->getOption('active') != 'yes') return;
    global $action;
    if($action == 'addcomment' &&
       ( !isset($_POST['user']) || $_POST['user'] == '')
       ){
      $_POST['user'] = $this->getSubstitudeName();
    }
  }
 
  function getSubstitudeName() {
    return $this->getOption('name');
  }
}
 
?>

コード

 
plugins/nanasisan/nanasisan_code.txt · 最終更新: 2011/03/23 21:28 (外部編集)