当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUpload::generateMarkup方法代码示例

本文整理汇总了PHP中FileUpload::generateMarkup方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::generateMarkup方法的具体用法?PHP FileUpload::generateMarkup怎么用?PHP FileUpload::generateMarkup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUpload的用法示例。


在下文中一共展示了FileUpload::generateMarkup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importStyleSheet


//.........这里部分代码省略.........
                                    $strBuffer = '';
                                    break;
                                }
                            }
                        }
                    } elseif ($char == '@') {
                        $intLevel = 0;
                        $strSelector = '';
                        while ($i < $intLength) {
                            $strBuffer .= $strFile[$i++];
                            if ($strFile[$i] == '{') {
                                if (++$intLevel == 1) {
                                    ++$i;
                                    $strSelector = $strBuffer;
                                    $strBuffer = '';
                                }
                            } elseif ($strFile[$i] == '}') {
                                if (--$intLevel == 0) {
                                    $arrTokens[] = array('type' => 'atblock', 'selector' => $strSelector, 'content' => $strBuffer);
                                    $strBuffer = '';
                                    break;
                                }
                            }
                        }
                    } else {
                        $strSelector = '';
                        while ($i < $intLength) {
                            $strBuffer .= $strFile[$i++];
                            if ($strFile[$i] == '{') {
                                ++$i;
                                $strSelector = $strBuffer;
                                $strBuffer = '';
                            } elseif ($strFile[$i] == '}') {
                                $arrTokens[] = array('type' => 'block', 'selector' => $strSelector, 'content' => $strBuffer);
                                $strBuffer = '';
                                break;
                            }
                        }
                    }
                }
                foreach ($arrTokens as $arrToken) {
                    // Comments
                    if ($arrToken['type'] == 'comment') {
                        // Category (comments start with /** and contain only one line)
                        if (strncmp($arrToken['content'], '/**', 3) === 0 && substr_count($arrToken['content'], "\n") == 2) {
                            $strCategory = trim(str_replace(array('/*', '*/', '*'), '', $arrToken['content']));
                        } elseif (strpos($arrToken['content'], "\n") === false) {
                            $strComment = trim(str_replace(array('/*', '*/', '*'), '', $arrToken['content']));
                        }
                    } elseif ($arrToken['type'] == 'atblock') {
                        $arrSet = array('pid' => $insertId, 'category' => $strCategory, 'comment' => $strComment, 'sorting' => $intSorting += 128, 'selector' => trim($arrToken['selector']), 'own' => $arrToken['content']);
                        $this->Database->prepare("INSERT INTO tl_style %s")->set($arrSet)->execute();
                        $strComment = '';
                    } else {
                        $arrDefinition = array('pid' => $insertId, 'category' => $strCategory, 'comment' => $strComment, 'sorting' => $intSorting += 128, 'selector' => trim($arrToken['selector']), 'attributes' => $arrToken['content']);
                        $this->createDefinition($arrDefinition);
                        $strComment = '';
                    }
                }
                // Write the style sheet
                $this->updateStyleSheet($insertId);
                // Notify the user
                if ($strName . '.css' != basename($strCssFile)) {
                    \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_style_sheet']['css_renamed'], basename($strCssFile), $strName . '.css'));
                } else {
                    \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_style_sheet']['css_imported'], $strName . '.css'));
                }
            }
            // Redirect
            \System::setCookie('BE_PAGE_OFFSET', 0, 0);
            $this->redirect(str_replace('&key=import', '', \Environment::get('request')));
        }
        // Return form
        return '
<div id="tl_buttons">
<a href="' . ampersand(str_replace('&key=import', '', \Environment::get('request'))) . '" class="header_back" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_style_sheet_import" class="tl_form" method="post" enctype="multipart/form-data">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_style_sheet_import">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="MAX_FILE_SIZE" value="' . \Config::get('maxFileSize') . '">

<div class="tl_tbox">
  <h3>' . $GLOBALS['TL_LANG']['tl_style_sheet']['source'][0] . '</h3>' . $objUploader->generateMarkup() . (isset($GLOBALS['TL_LANG']['tl_style_sheet']['source'][1]) ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_style_sheet']['source'][1] . '</p>' : '') . '
</div>

</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
  <button type="submit" name="save" id="save" class="tl_submit" accesskey="s">' . $GLOBALS['TL_LANG']['tl_style_sheet']['import'][0] . '</button>
</div>

</div>
</form>';
    }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:101,代码来源:StyleSheets.php

示例2: importTable

    /**
     * Return a form to choose a CSV file and import it
     *
     * @param DataContainer $dc
     *
     * @return string
     */
    public function importTable(DataContainer $dc)
    {
        if (\Input::get('key') != 'table') {
            return '';
        }
        /** @var FileUpload $objUploader */
        $objUploader = new \FileUpload();
        // Import CSS
        if (\Input::post('FORM_SUBMIT') == 'tl_table_import') {
            $arrUploaded = $objUploader->uploadTo('system/tmp');
            if (empty($arrUploaded)) {
                \Message::addError($GLOBALS['TL_LANG']['ERR']['all_fields']);
                $this->reload();
            }
            $this->import('Database');
            $arrTable = array();
            foreach ($arrUploaded as $strCsvFile) {
                $objFile = new \File($strCsvFile);
                if ($objFile->extension != 'csv') {
                    \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['filetype'], $objFile->extension));
                    continue;
                }
                // Get separator
                switch (\Input::post('separator')) {
                    case 'semicolon':
                        $strSeparator = ';';
                        break;
                    case 'tabulator':
                        $strSeparator = "\t";
                        break;
                    default:
                        $strSeparator = ',';
                        break;
                }
                $resFile = $objFile->handle;
                while (($arrRow = @fgetcsv($resFile, null, $strSeparator)) !== false) {
                    $arrTable[] = $arrRow;
                }
            }
            $objVersions = new \Versions($dc->table, \Input::get('id'));
            $objVersions->create();
            $this->Database->prepare("UPDATE " . $dc->table . " SET tableitems=? WHERE id=?")->execute(serialize($arrTable), \Input::get('id'));
            \System::setCookie('BE_PAGE_OFFSET', 0, 0);
            $this->redirect(str_replace('&key=table', '', \Environment::get('request')));
        }
        // Return form
        return '
<div id="tl_buttons">
<a href="' . ampersand(str_replace('&key=table', '', \Environment::get('request'))) . '" class="header_back" title="' . \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_table_import" class="tl_form" method="post" enctype="multipart/form-data">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_table_import">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">

<fieldset class="tl_tbox nolegend">
<div>
  <h3><label for="separator">' . $GLOBALS['TL_LANG']['MSC']['separator'][0] . '</label></h3>
  <select name="separator" id="separator" class="tl_select" onfocus="Backend.getScrollOffset()">
    <option value="comma">' . $GLOBALS['TL_LANG']['MSC']['comma'] . '</option>
    <option value="semicolon">' . $GLOBALS['TL_LANG']['MSC']['semicolon'] . '</option>
    <option value="tabulator">' . $GLOBALS['TL_LANG']['MSC']['tabulator'] . '</option>
  </select>' . ($GLOBALS['TL_LANG']['MSC']['separator'][1] != '' ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['MSC']['separator'][1] . '</p>' : '') . '
  <h3>' . $GLOBALS['TL_LANG']['MSC']['source'][0] . '</h3>' . $objUploader->generateMarkup() . (isset($GLOBALS['TL_LANG']['MSC']['source'][1]) ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['MSC']['source'][1] . '</p>' : '') . '
</div>
</fieldset>

</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
  <button type="submit" name="save" id="save" class="tl_submit" accesskey="s">' . $GLOBALS['TL_LANG']['MSC']['tw_import'][0] . '</button>
</div>

</div>
</form>';
    }
开发者ID:qzminski,项目名称:contao-core-bundle,代码行数:88,代码来源:TableWizard.php

示例3: generate

 /**
  * Generate the widget and return it as string
  * @return string
  */
 public function generate()
 {
     return ltrim($this->objUploader->generateMarkup());
 }
开发者ID:rburch,项目名称:core,代码行数:8,代码来源:Upload.php


注:本文中的FileUpload::generateMarkup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。