👁 查看:opValidatorProfile.class.php
路径:/virtual/bigbrother/sns/lib/validator/opValidatorProfile.class.php
大小:1.32 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * opValidatorProfile
 *
 * @package    OpenPNE
 * @subpackage validator
 * @author     Shogo Kawahara <kawahara@tejimaya.net>
 */
class opValidatorProfile extends sfValidatorBase
{
  /**
   * Configures the current validator.
   *
   * @see sfValidatorBase
   */
  protected function configure($options = array(), $messages = array())
  {
    $this->addRequiredOption('validator');
    $this->addOption('is_edit_public_flag', false);
  }

  /**
   * @see sfValidatorBase
   */
  protected function doClean($value)
  {
    $clean = array();
    if (!isset($value['value']))
    {
      throw new sfValidatorError($this, 'invalid');
    }
    $clean['value'] = $this->getOption('validator')->clean($value['value']);

    if ($this->getOption('is_edit_public_flag'))
    {
      if (!isset($value['public_flag']))
      {
        throw new sfValidatorError($this, 'invalid');
      }
      $validator = new sfValidatorChoice(array('choices' => array_keys(ProfilePeer::getPublicFlags())));
      $clean['public_flag'] = $validator->clean($value['public_flag']);
    }

    return $clean;
  }
}
ページが見つかりませんでした – Lumiere Shop
ここを指しているリンクに誤りがあったようです。検索してみるのはいかがですか ?
お買い物カゴ