本文整理汇总了PHP中FrmFormsHelper::get_draft_link方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmFormsHelper::get_draft_link方法的具体用法?PHP FrmFormsHelper::get_draft_link怎么用?PHP FrmFormsHelper::get_draft_link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmFormsHelper
的用法示例。
在下文中一共展示了FrmFormsHelper::get_draft_link方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_draft_link
public static function get_draft_link($form)
{
$html = self::get_draft_button($form, '', FrmFormsHelper::get_draft_link());
return $html;
}
示例2: migrate_to_11
private function migrate_to_11()
{
global $wpdb;
$forms = FrmDb::get_results($this->forms, array(), 'id, options');
$sending = __('Sending', 'formidable');
$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
$old_default_html = <<<DEFAULT_HTML
<div class="frm_submit">
[if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
<input type="submit" value="[button_label]" [button_action] />
<img class="frm_ajax_loading" src="{$img}" alt="{$sending}" style="visibility:hidden;" />
</div>
DEFAULT_HTML;
unset($sending, $img);
$new_default_html = FrmFormsHelper::get_default_html('submit');
$draft_link = FrmFormsHelper::get_draft_link();
foreach ($forms as $form) {
$form->options = maybe_unserialize($form->options);
if (!isset($form->options['submit_html']) || empty($form->options['submit_html'])) {
continue;
}
if ($form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html) {
$form->options['submit_html'] = $new_default_html;
$wpdb->update($this->forms, array('options' => serialize($form->options)), array('id' => $form->id));
} else {
if (!strpos($form->options['submit_html'], 'save_draft')) {
$form->options['submit_html'] = preg_replace('~\\<\\/div\\>(?!.*\\<\\/div\\>)~', $draft_link . "\r\n</div>", $form->options['submit_html']);
$wpdb->update($this->forms, array('options' => serialize($form->options)), array('id' => $form->id));
}
}
unset($form);
}
unset($forms);
}
示例3: upgrade
function upgrade($old_db_version = false)
{
global $wpdb;
//$frm_db_version is the version of the database we're moving to
$frm_db_version = FrmAppHelper::$db_version;
$old_db_version = (double) $old_db_version;
if (!$old_db_version) {
$old_db_version = get_option('frm_db_version');
}
if ($frm_db_version != $old_db_version) {
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$charset_collate = '';
if ($wpdb->has_cap('collation')) {
if (!empty($wpdb->charset)) {
$charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
}
if (!empty($wpdb->collate)) {
$charset_collate .= " COLLATE {$wpdb->collate}";
}
}
/* Create/Upgrade Fields Table */
$sql = "CREATE TABLE {$this->fields} (\n id int(11) NOT NULL auto_increment,\n field_key varchar(255) default NULL,\n name text default NULL,\n description text default NULL,\n type text default NULL,\n default_value longtext default NULL,\n options longtext default NULL,\n field_order int(11) default 0,\n required int(1) default NULL,\n field_options longtext default NULL,\n form_id int(11) default NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY (id),\n KEY form_id (form_id),\n UNIQUE KEY field_key (field_key)\n ) {$charset_collate};";
dbDelta($sql);
/* Create/Upgrade Forms Table */
$sql = "CREATE TABLE {$this->forms} (\n id int(11) NOT NULL auto_increment,\n form_key varchar(255) default NULL,\n name varchar(255) default NULL,\n description text default NULL,\n parent_form_id int(11) default NULL,\n logged_in tinyint(1) default NULL,\n editable tinyint(1) default NULL,\n is_template tinyint(1) default 0,\n default_template tinyint(1) default 0,\n status varchar(255) default NULL,\n prli_link_id int(11) default NULL,\n options longtext default NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY (id),\n UNIQUE KEY form_key (form_key)\n ) {$charset_collate};";
dbDelta($sql);
/* Create/Upgrade Items Table */
$sql = "CREATE TABLE {$this->entries} (\n id int(11) NOT NULL auto_increment,\n item_key varchar(255) default NULL,\n name varchar(255) default NULL,\n description text default NULL,\n ip text default NULL,\n form_id int(11) default NULL,\n post_id int(11) default NULL,\n user_id int(11) default NULL,\n parent_item_id int(11) default NULL,\n is_draft tinyint(1) default 0,\n updated_by int(11) default NULL,\n created_at datetime NOT NULL,\n updated_at datetime NOT NULL,\n PRIMARY KEY (id),\n KEY form_id (form_id),\n KEY post_id (post_id),\n KEY user_id (user_id),\n KEY parent_item_id (parent_item_id),\n UNIQUE KEY item_key (item_key)\n ) {$charset_collate};";
dbDelta($sql);
/* Create/Upgrade Meta Table */
$sql = "CREATE TABLE {$this->entry_metas} (\n id int(11) NOT NULL auto_increment,\n meta_value longtext default NULL,\n field_id int(11) NOT NULL,\n item_id int(11) NOT NULL,\n created_at datetime NOT NULL,\n PRIMARY KEY (id),\n KEY field_id (field_id),\n KEY item_id (item_id)\n ) {$charset_collate};";
dbDelta($sql);
/**** MIGRATE DATA ****/
if ($frm_db_version >= 1.03 and $old_db_version < 1.03) {
global $frm_entry;
$all_entries = $frm_entry->getAll();
foreach ($all_entries as $ent) {
$opts = maybe_unserialize($ent->description);
if (is_array($opts) and in_array($opts['ip'])) {
$wpdb->update($this->entries, array('ip' => $opts['ip']), array('id' => $ent->id));
}
}
}
if ($frm_db_version >= 4 and $old_db_version < 4) {
global $frm_entry_meta;
$user_ids = $frm_entry_meta->getAll("fi.type='user_id'");
foreach ($user_ids as $user_id) {
$wpdb->update($this->entries, array('user_id' => $user_id->meta_value), array('id' => $user_id->item_id));
}
}
if ($frm_db_version >= 6 and $old_db_version < 6) {
$fields = $wpdb->get_results("SELECT id, field_options FROM {$this->fields} WHERE type not in ('hidden', 'user_id', 'break', 'divider', 'html', 'captcha', 'form')");
$default_html = <<<DEFAULT_HTML
<div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
<label class="frm_pos_[label_position]">[field_name]
<span class="frm_required">[required_label]</span>
</label>
[input]
[if description]<div class="frm_description">[description]</div>[/if description]
</div>
DEFAULT_HTML;
$old_default_html = <<<DEFAULT_HTML
<div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
<label class="frm_pos_[label_position]">[field_name]
<span class="frm_required">[required_label]</span>
</label>
[input]
[if description]<p class="frm_description">[description]</p>[/if description]
</div>
DEFAULT_HTML;
$new_default_html = FrmFieldsHelper::get_default_html('text');
foreach ($fields as $field) {
$field->field_options = maybe_unserialize($field->field_options);
if (!isset($field->field_options['custom_html']) || empty($field->field_options['custom_html']) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html) {
$field->field_options['custom_html'] = $new_default_html;
$wpdb->update($this->fields, array('field_options' => maybe_serialize($field->field_options)), array('id' => $field->id));
}
unset($field);
}
unset($default_html);
unset($old_default_html);
unset($fields);
}
if ($frm_db_version >= 11 and $old_db_version < 11) {
$forms = $wpdb->get_results("SELECT id, options FROM {$this->forms}");
$sending = __('Sending', 'formidable');
$img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
$old_default_html = <<<DEFAULT_HTML
<div class="frm_submit">
[if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
<input type="submit" value="[button_label]" [button_action] />
<img class="frm_ajax_loading" src="{$img}" alt="{$sending}" style="visibility:hidden;" />
</div>
DEFAULT_HTML;
unset($sending);
unset($img);
$new_default_html = FrmFormsHelper::get_default_html('submit');
$draft_link = FrmFormsHelper::get_draft_link();
foreach ($forms as $form) {
$form->options = maybe_unserialize($form->options);
//.........这里部分代码省略.........