本文整理汇总了PHP中Data::readDB方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::readDB方法的具体用法?PHP Data::readDB怎么用?PHP Data::readDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::readDB方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Creates the form.
*
* @return void
*
* @global array The configuration of the plugins.
*/
public function execute()
{
global $plugin_cf;
$pcf = $plugin_cf['advancedform'];
$forms = Data::readDB();
$forms[$this->id] = array('name' => '', 'title' => '', 'to_name' => $pcf['mail_to_name'], 'to' => $pcf['mail_to'], 'cc' => $pcf['mail_cc'], 'bcc' => $pcf['mail_bcc'], 'captcha' => (bool) $pcf['mail_captcha'], 'store' => false, 'thanks_page' => $pcf['mail_thanks_page'], 'fields' => array(array('field' => '', 'label' => '', 'type' => 'text', 'props' => "¦¦¦", 'required' => '0')));
Data::writeDB($forms);
}
示例2: execute
/**
* Deletes the form.
*
* @return void
*
* @throws \InvalidArgumentException
*/
public function execute()
{
$forms = Data::readDB();
if (!isset($forms[$this->id])) {
throw new \InvalidArgumentException();
}
unset($forms[$this->id]);
Data::writeDB($forms);
}
示例3: execute
/**
* Copies the form.
*
* @return void
*
* @throws \InvalidArgumentException
*/
public function execute()
{
$forms = Data::readDB();
if (isset($forms[$this->from])) {
$form = $forms[$this->from];
$form['name'] = '';
$forms[$this->to] = $form;
Data::writeDB($forms);
} else {
throw new \InvalidArgumentException();
}
}
示例4: renderFormsAdministration
/**
* Returns the mail forms administration.
*
* @return string (X)HTML.
*
* @global string The script name.
* @global array The localization of the plugins.
*/
public static function renderFormsAdministration()
{
global $sn, $plugin_tx;
$forms = Data::readDB();
$o = '<div id="advfrm-form-list">' . PHP_EOL . '<h1>' . $plugin_tx['advancedform']['menu_main'] . '</h1>' . PHP_EOL;
$href = $sn . '?advancedform&admin=plugin_main&action=new';
$o .= self::renderToolForm('add', $href);
$href = $sn . '?advancedform&admin=plugin_main&action=import&form=';
$o .= self::renderToolForm('import', $href);
$o .= '<table>' . PHP_EOL;
foreach ($forms as $id => $form) {
$form = new Form($form);
if ($id != '%VERSION%') {
$o .= self::renderFormRow($id, $form);
}
}
$o .= '</table>' . PHP_EOL;
$o .= '</div>' . PHP_EOL;
return $o;
}
示例5: appendCsv
/**
* Appends the posted record to csv file.
*
* @param string $id A form ID.
*
* @return void
*
* @global array The configuration of the plugins.
*/
public static function appendCsv($id)
{
global $plugin_cf;
$forms = Data::readDB();
$fields = array();
foreach ($forms[$id]['fields'] as $field) {
if ($field['type'] != 'output') {
$name = $field['field'];
$val = $field['type'] == 'file' ? $_FILES['advfrm-' . $name]['name'] : $_POST['advfrm-' . $name];
$fields[] = is_array($val) ? implode("¦", array_map('stsl', $val)) : stsl($val);
}
}
if ($plugin_cf['advancedform']['csv_separator'] != '') {
$fields = array_map(array('Advancedform\\Controller', 'escapeCsvField'), $fields);
$separator = $plugin_cf['advancedform']['csv_separator'];
} else {
$separator = "\t";
}
$fn = Data::folder() . $id . '.csv';
if (($fh = fopen($fn, 'a')) === false || fwrite($fh, implode($separator, $fields) . "\n") === false) {
e('cntwriteto', 'file', $fn);
}
if ($fh !== false) {
fclose($fh);
}
}