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


PHP Data::folder方法代码示例

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


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

示例1: render

 /**
  * Renders the view.
  *
  * @return string (X)HTML
  *
  * @global array The paths of system files and folders.
  * @global array The configuration of the plugins.
  * @global array The localization of the core.
  * @global array The localization of the plugins.
  */
 public function render()
 {
     global $pth, $plugin_cf, $tx, $plugin_tx;
     $phpVersion = '5.3.0';
     $ptx = $plugin_tx['advancedform'];
     $imgdir = $pth['folder']['plugins'] . 'advancedform/images/';
     $ok = tag('img src="' . $imgdir . 'ok.png" alt="ok"');
     $warn = tag('img src="' . $imgdir . 'warn.png" alt="warning"');
     $fail = tag('img src="' . $imgdir . 'fail.png" alt="failure"');
     $o = tag('hr') . '<h4>' . $ptx['syscheck_title'] . '</h4>' . (version_compare(PHP_VERSION, $phpVersion) >= 0 ? $ok : $fail) . '&nbsp;&nbsp;' . sprintf($ptx['syscheck_phpversion'], $phpVersion) . tag('br') . tag('br') . PHP_EOL;
     foreach (array('ctype', 'mbstring', 'pcre', 'session', 'spl') as $ext) {
         $o .= (extension_loaded($ext) ? $ok : $fail) . '&nbsp;&nbsp;' . sprintf($ptx['syscheck_extension'], $ext) . tag('br') . PHP_EOL;
     }
     $o .= tag('br') . (strtoupper($tx['meta']['codepage']) == 'UTF-8' ? $ok : $warn) . '&nbsp;&nbsp;' . $ptx['syscheck_encoding'] . tag('br') . PHP_EOL;
     $o .= (!get_magic_quotes_runtime() ? $ok : $warn) . '&nbsp;&nbsp;' . $ptx['syscheck_magic_quotes'] . tag('br') . PHP_EOL;
     $filename = $pth['folder']['plugins'] . 'jquery/jquery.inc.php';
     $o .= (file_exists($filename) ? $ok : $fail) . '&nbsp;&nbsp;' . $ptx['syscheck_jquery'] . tag('br') . PHP_EOL;
     $filename = $pth['folder']['plugins'] . $plugin_cf['advancedform']['captcha_plugin'] . '/captcha.php';
     $o .= (file_exists($filename) ? $ok : $warn) . '&nbsp;&nbsp;' . $ptx['syscheck_captcha_plugin'] . tag('br') . tag('br') . PHP_EOL;
     foreach (array('config/', 'css/', 'languages/') as $folder) {
         $folders[] = $pth['folder']['plugins'] . 'advancedform/' . $folder;
     }
     $folders[] = Data::folder();
     foreach ($folders as $folder) {
         $o .= (is_writable($folder) ? $ok : $warn) . '&nbsp;&nbsp;' . sprintf($ptx['syscheck_writable'], $folder) . tag('br') . PHP_EOL;
     }
     return $o;
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:38,代码来源:SystemCheckView.php

示例2: execute

 /**
  * Creates the form template.
  *
  * @return void
  *
  * @throws \InvalidArgumentException
  *
  * @todo Replace e() with Exceptions.
  */
 public function execute()
 {
     $form = Data::fetchForm($this->id);
     if (isset($form)) {
         $filename = Data::folder() . $this->id . '.tpl';
         if (!file_put_contents($filename, $this->renderTemplate($form))) {
             e('cntsave', 'file', $filename);
         }
         $filename = Data::folder() . 'css/' . $this->id . '.css';
         if (!file_put_contents($filename, $this->renderCSS($form))) {
             e('cntsave', 'file', $filename);
         }
     } else {
         throw new \InvalidArgumentException();
     }
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:25,代码来源:CreateFormTemplateTransaction.php

示例3: main

 /**
  * Main plugin call.
  *
  * @param string $id A form ID.
  *
  * @return string (X)HTML.
  *
  * @global array  The configuration of the plugins.
  * @global array  The localization of the plugins.
  * @global string The script name.
  * @global string The (X)HTML fragment containing error messages.
  * @global array  The paths of system files and folders.
  */
 public static function main($id)
 {
     global $plugin_cf, $plugin_tx, $sn, $e, $pth;
     $pcf = $plugin_cf['advancedform'];
     $ptx = $plugin_tx['advancedform'];
     $fn = $pth['folder']['plugins'] . $pcf['captcha_plugin'] . '/captcha.php';
     if (file_exists($fn)) {
         include_once $fn;
     } else {
         e('cntopen', 'file', $fn);
     }
     $hooks = Data::folder() . $id . '.inc' . ($pcf['php_extension'] ? '.php' : '');
     if (file_exists($hooks)) {
         include $hooks;
     }
     $form = Data::fetchForm($id);
     if (!isset($form)) {
         $e .= '<li>' . sprintf($ptx['error_form_missing'], $id) . '</li>' . PHP_EOL;
         return '';
     }
     if (isset($_POST['advfrm']) && $_POST['advfrm'] == $id) {
         $validator = new FormValidator($form);
         if (($res = $validator->validate()) === true) {
             if ($form->isStored()) {
                 self::appendCsv($id);
             }
             if (!self::mail($form, false)) {
                 return self::formView($form);
             }
             if (function_exists('advfrm_custom_thanks_page')) {
                 self::fields($fields);
                 $thanks = advfrm_custom_thanks_page($id, $fields);
             }
             if (empty($thanks)) {
                 $thanks = $form->getThanksPage();
             }
             if (!empty($thanks)) {
                 if (!self::mail($form, true)) {
                     return self::formView($form);
                 }
                 header('Location: ' . $sn . '?' . $thanks);
                 // FIXME: exit()?
             } else {
                 $view = MailView::make($form, false, true);
                 return $view->render();
             }
         } else {
             return $res . self::formView($form);
         }
     }
     return self::formView($form);
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:65,代码来源:Controller.php

示例4: renderTemplate

 /**
  * Returns the view of a form by instatiating the template.
  *
  * @return string (X)HTML.
  *
  * @global string The (X)HTML fragment for insertion into the HEAD element.
  * @global array  The configuration of the plugins.
  */
 protected function renderTemplate()
 {
     global $hjs, $plugin_cf;
     $fn = Data::folder() . 'css/' . $this->form->getName() . '.css';
     if (file_exists($fn)) {
         $hjs .= tag('link rel="stylesheet" href="' . $fn . '" type="text/css"') . PHP_EOL;
     }
     $fn = Data::folder() . 'js/' . $this->form->getName() . '.js';
     if (file_exists($fn)) {
         $hjs .= '<script type="text/javascript" src="' . $fn . '"></script>' . PHP_EOL;
     }
     $fn = Data::folder() . $this->form->getName() . '.tpl' . ($plugin_cf['advancedform']['php_extension'] ? '.php' : '');
     $advfrm_script = file_get_contents($fn);
     foreach ($this->form->getFields() as $field) {
         $field = Field::make($field);
         $fieldView = new FieldView($this->form->getName(), $field);
         $advfrm_script = str_replace('<?field ' . $field->getName() . '?>', $fieldView->render(), $advfrm_script);
     }
     extract($GLOBALS);
     ob_start();
     eval('?>' . $advfrm_script);
     return ob_get_clean();
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:31,代码来源:FormView.php

示例5: getBody

 /**
  * Returns the body of the mail.
  *
  * @param bool $html Whether to return (X)HTML.
  *
  * @return string
  *
  * @global array The configuration of the core.
  */
 protected function getBody($html)
 {
     global $cf;
     $o = '';
     if ($html) {
         if ($cf['xhtml']['endtags'] == 'true') {
             $o .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional' . '//EN"' . ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . PHP_EOL . '<html xmlns="http://www.w3.org/1999/xhtml">' . PHP_EOL;
         } else {
             $o .= '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional' . '//EN"' . ' "http://www.w3.org/TR/html4/loose.dtd">' . PHP_EOL . '<html>' . PHP_EOL;
         }
         $o .= '<head>' . PHP_EOL . '<style type="text/css">' . PHP_EOL;
         $o .= $this->getMailCSS($this->pluginFolder . 'css/stylesheet.css');
         $fn = Data::folder() . 'css/' . $this->form->getName() . '.css';
         if (file_exists($fn)) {
             $o .= $this->getMailCSS($fn);
         }
         $o .= '</style>' . PHP_EOL . '</head>' . PHP_EOL . '<body>' . PHP_EOL;
     }
     $view = MailView::make($this->form, !$this->isConfirmation, $html);
     $o .= $view->render();
     if ($html) {
         $o .= '</body>' . PHP_EOL . '</html>' . PHP_EOL;
     }
     return $o;
 }
开发者ID:bbfriend,项目名称:advancedform_xh,代码行数:34,代码来源:Mailer.php


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