コード例 #1
0
ファイル: form.php プロジェクト: nuckey/moodle
 /**
  *    Creates the request packet to be sent by the form.
  *    @param SimpleTag $tag        Form tag to read.
  *    @return string               Packet class.
  *    @access private
  */
 function _setEncodingClass($tag) {
     if (strtolower($tag->getAttribute('method')) == 'post') {
         if (strtolower($tag->getAttribute('enctype')) == 'multipart/form-data') {
             return 'SimpleMultipartEncoding';
         }
         return 'SimplePostEncoding';
     }
     return 'SimpleGetEncoding';
 }
コード例 #2
0
ファイル: form.php プロジェクト: BGCX067/ezpdo2-svn-to-git
 /**
  *    Starts with no held controls/widgets.
  *    @param SimpleTag $tag        Form tag to read.
  *    @param SimpleUrl $url        Location of holding page.
  */
 function SimpleForm($tag, $url)
 {
     $this->_method = $tag->getAttribute('method');
     $this->_action = $this->_createAction($tag->getAttribute('action'), $url);
     $this->_default_target = false;
     $this->_id = $tag->getAttribute('id');
     $this->_buttons = array();
     $this->_images = array();
     $this->_widgets = array();
 }
コード例 #3
0
ファイル: MubohAPI.php プロジェクト: riaf/private-arbo
 function puchipuchi($staff = 'Arai', $action = '', $comment = '')
 {
     $this->method = 'puchipuchi';
     $result = $this->post(compact('staff', 'action', 'comment'));
     if (SimpleTag::setof($tag, $result, 'rsp')) {
         return $tag->toHash();
     }
     return false;
 }
コード例 #4
0
ファイル: ConcertView.php プロジェクト: riaf/concert
 function upload()
 {
     if ($this->isPost() && $this->isFile('stage')) {
         $file = $this->getFile('stage');
         $src = mb_convert_encoding(file_get_contents($file->tmp), 'utf-8', 'Shift_JIS,EUC-JP,UTF-8');
         if (SimpleTag::setof($tag, $src, 'body', true)) {
             foreach ($tag->getIn('applet') as $applet) {
                 if ($applet->getParameter('code') != 'MasaoConstruction') {
                     continue;
                 }
                 $gamedata = array();
                 foreach ($applet->getIn('param') as $param) {
                     $gamedata[$param->getParameter('name')] = array('name' => $param->getParameter('name'), 'value' => $param->getParameter('value'));
                 }
                 if (empty($gamedata)) {
                     break;
                 }
                 $stage = $this->dbUtil->insert($this->toObject(new Stage()));
                 if (!Variable::istype('Stage', $stage)) {
                     break;
                 }
                 $_images = array('title', 'ending', 'gameover', 'pattern', 'chizu');
                 foreach ($_images as $k) {
                     if (!isset($gamedata[sprintf("filename_%s", $k)])) {
                         continue;
                     }
                     $gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => 'images/' . $k . '.gif');
                     if ($this->isFile('img_' . $k)) {
                         $image = $this->getFile('img_' . $k);
                         $img_info = getimagesize($image->tmp);
                         if ($img_info[2] != IMAGETYPE_GIF) {
                             continue;
                         }
                         $filename = Rhaco::path(sprintf('images/%s_%d.gif', $k, $stage->id));
                         if (move_uploaded_file($image->tmp, $filename)) {
                             $gamedata[sprintf("filename_%s", $k)] = array('name' => sprintf("filename_%s", $k), 'value' => sprintf("images/%s_%d.gif", $k, $stage->getId()));
                         }
                     }
                 }
                 FileUtil::write(Rhaco::path(sprintf('stages/%d.apif', $stage->id)), serialize($gamedata));
                 Header::redirect(Rhaco::url());
                 Rhaco::end();
             }
         }
     }
     return $this->parser('upload.html');
 }
コード例 #5
0
 function publish($src, &$paraser)
 {
     if (ExceptionTrigger::isException() && stripos($src, 'form ') !== false && SimpleTag::setof($tag, $src)) {
         foreach ($tag->getIn('input') as $input) {
             if (ExceptionTrigger::invalid($input->param('name'))) {
                 // どうやら発行されているようだ
                 $exceptions = ExceptionTrigger::get($input->param('name'));
                 $addHtml = '';
                 foreach ($exceptions as $e) {
                     $addHtml .= sprintf('<%s class="%s">%s</%s>', $this->tagName, $this->class, $e->getMessage(), $this->tagName);
                 }
                 $src = str_replace($input->getPlain(), $input->getPlain() . $addHtml, $src);
             }
         }
     }
     return $src;
 }
コード例 #6
0
ファイル: tag.php プロジェクト: sebs/simpletest
 /**
  *    Starts with a named tag with attributes only.
  *    @param hash $attributes    Attribute names and
  *                               string values.
  */
 function __construct($attributes)
 {
     parent::__construct('frame', $attributes);
 }
コード例 #7
0
ファイル: page.php プロジェクト: Spark-Eleven/revive-adserver
 /**
  *    Adds a tag to the page.
  *    @param SimpleTag $tag        Tag to accept.
  *    @access public
  */
 function acceptTag(&$tag)
 {
     if ($tag->getTagName() == "a") {
         $this->_addLink($tag);
     } elseif ($tag->getTagName() == "title") {
         $this->_setTitle($tag);
     } elseif ($this->_isFormElement($tag->getTagName())) {
         for ($i = 0; $i < count($this->_open_forms); $i++) {
             $this->_open_forms[$i]->addWidget($tag);
         }
         $this->_last_widget =& $tag;
     }
 }
コード例 #8
0
ファイル: tag.php プロジェクト: BackupTheBerlios/limb-svn
 /**
  *    Starts with no held controls/widgets.
  *    @param SimpleTag $tag        Form tag to read.
  */
 function SimpleForm($tag) {
     $this->_method = $tag->getAttribute('method');
     $this->_action = $tag->getAttribute('action');
     $this->_id = $tag->getAttribute('id');
     $this->_buttons = array();
     $this->_images = array();
     $this->_widgets = array();
 }
コード例 #9
0
ファイル: page.php プロジェクト: r-kitaev/limb
 /**
  *    Sets the base url for the page.
  *    @param SimpleTag $tag    Base URL for page.
  *    @access protected
  */
 function _setBase(&$tag)
 {
     $url = $tag->getAttribute('href');
     $this->_base = new SimpleUrl($url);
 }
コード例 #10
0
ファイル: php_parser.php プロジェクト: ngugijames/ThinkUp
 /**
  *    Adds a tag to the page.
  *    @param SimpleTag $tag        Tag to accept.
  *    @access public
  */
 protected function acceptTag($tag)
 {
     if ($tag->getTagName() == "a") {
         $this->page->addLink($tag);
     } elseif ($tag->getTagName() == "base") {
         $this->page->setBase($tag->getAttribute('href'));
     } elseif ($tag->getTagName() == "title") {
         $this->page->setTitle($tag);
     } elseif ($this->isFormElement($tag->getTagName())) {
         for ($i = 0; $i < count($this->open_forms); $i++) {
             $this->open_forms[$i]->addWidget($tag);
         }
         $this->last_widget = $tag;
     }
 }
コード例 #11
0
ファイル: page.php プロジェクト: googlecode-mirror/bulldoc
 /**
  *    Sets the base url for the page.
  *    @param SimpleTag $tag    Base URL for page.
  *    @access protected
  */
 protected function setBase($tag)
 {
     $url = $tag->getAttribute('href');
     $this->base = new SimpleUrl($url);
 }
コード例 #12
0
ファイル: Rhaco.php プロジェクト: riaf/ethna
 /**
  * smarty_function dispatcher
  *
  * @access protected
  * @param string $src
  */
 function _exec9002_smartyfunctions($src)
 {
     $tag = new SimpleTag();
     $smarty_plugin_list = $this->getSmartyPluginList();
     foreach ($smarty_plugin_list as $name => $plugin_config) {
         while ($tag->set($src, $this->_getTagName($name))) {
             if ($plugin_config['type'] == 'function') {
                 $param = $tag->toHash();
                 $src = str_replace($tag->getPlain(), $plugin_config['plugin']($param, $this), $src);
             } else {
                 if ($plugin_config['type'] == 'block') {
                     $repeat_before = true;
                     $repeat_after = false;
                     $param_list = $tag->getParameter();
                     foreach ($param_list as $param_tag) {
                         $param[$param_tag->getName()] = $param_tag->getValue();
                     }
                     $content = $tag->getValue();
                     //before(not return value)
                     $result = $plugin_config['plugin']($param, $content, $this, $repeat_before);
                     //after
                     $result = $plugin_config['plugin']($param, $content, $this, $repeat_after);
                     $src = str_replace($tag->getPlain(), $result, $src);
                 }
             }
         }
     }
     return $src;
 }
コード例 #13
0
ファイル: tidy_parser.php プロジェクト: ngugijames/ThinkUp
 /**
  *  Fills the widget cache to speed up searching.
  *  @param SimpleTag $widget    Parsed widget to cache.
  */
 private function indexWidgetById($widget)
 {
     $id = $widget->getAttribute('id');
     if (!$id) {
         return;
     }
     if (!isset($this->widgets_by_id[$id])) {
         $this->widgets_by_id[$id] = array();
     }
     $this->widgets_by_id[$id][] = $widget;
 }
コード例 #14
0
ファイル: tag.php プロジェクト: BackupTheBerlios/limb-svn
 /**
  *    Starts with no held controls/widgets.
  *    @param SimpleTag $tag        Form tag to read.
  */
 function SimpleForm($tag)
 {
     $this->_method = $tag->getAttribute("method");
     $this->_action = $tag->getAttribute("action");
     $this->_id = $tag->getAttribute("id");
     $this->_buttons = array();
     $this->_widgets = array();
 }
コード例 #15
0
ファイル: SimpleTag.php プロジェクト: hazbo/simpletags
 /**
  * Get the data pertaining to the given double tag.  This will
  * loop through arrays of given data
  *
  * Example Data:
  * $data = array(
  *     'books' => array(
  *         array(
  *             'title' => 'PHP for Dummies',
  *             'author' => 'John Doe'
  *         ),
  *         array(
  *             'title' => 'CodeIgniter for Dummies',
  *             'author' => 'Jane Doe'
  *         )
  *     )
  * );
  *
  * Example Tags:
  * {books}
  * {title} by {author}<br />
  * {/books}
  *
  * @access  private
  * @param   array   The double tag
  * @param   array   The data to parse
  * @return  mixed   Either the data for the tag or FALSE
  */
 private function _parse_data_double($tag, $data)
 {
     $return_data = '';
     foreach ($tag['segments'] as $segment) {
         if (!isset($data[$segment])) {
             return FALSE;
         }
         $data = $data[$segment];
     }
     $temp = new SimpleTag();
     foreach ($data as $val) {
         $return = $temp->parse($tag['content'], $val);
         $return_data .= $return['content'];
     }
     unset($temp);
     return $return_data;
 }