本文整理汇总了PHP中FrmForm::get_published_forms方法的典型用法代码示例。如果您正苦于以下问题:PHP FrmForm::get_published_forms方法的具体用法?PHP FrmForm::get_published_forms怎么用?PHP FrmForm::get_published_forms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrmForm
的用法示例。
在下文中一共展示了FrmForm::get_published_forms方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_forms
private function get_forms()
{
$forms = array();
$formidable = new FrmForm();
foreach ($formidable->get_published_forms() as $form) {
$forms[$form->name] = $form->id;
}
return $forms;
}
示例2: manage_styles
private static function manage_styles()
{
$style_nonce = FrmAppHelper::get_post_param('frm_manage_style', '', 'sanitize_text_field');
if (!$_POST || !isset($_POST['style']) || !wp_verify_nonce($style_nonce, 'frm_manage_style_nonce')) {
return self::manage();
}
global $wpdb;
$forms = FrmForm::get_published_forms();
foreach ($forms as $form) {
if ($_POST['style'][$form->id] == $_POST['prev_style'][$form->id]) {
continue;
}
$form->options['custom_style'] = $_POST['style'][$form->id];
$wpdb->update($wpdb->prefix . 'frm_forms', array('options' => maybe_serialize($form->options)), array('id' => $form->id));
unset($form);
}
$message = __('Your form styles have been saved.', 'formidable');
return self::manage($message, $forms);
}
示例3: search_box
public function search_box($text, $input_id)
{
if (!$this->has_items() && !isset($_REQUEST['s'])) {
return;
}
if (isset($this->params['form'])) {
$form = FrmForm::getOne($this->params['form']);
} else {
$form = FrmForm::get_published_forms(array(), 1);
}
if ($form) {
$field_list = FrmField::getAll(array('fi.form_id' => $form->id, 'fi.type not' => FrmField::no_save_fields()), 'field_order');
}
$fid = isset($_REQUEST['fid']) ? esc_attr(stripslashes($_REQUEST['fid'])) : '';
$input_id = $input_id . '-search-input';
$search_str = isset($_REQUEST['s']) ? esc_attr(stripslashes($_REQUEST['s'])) : '';
foreach (array('orderby', 'order') as $get_var) {
if (!empty($_REQUEST[$get_var])) {
echo '<input type="hidden" name="' . esc_attr($get_var) . '" value="' . esc_attr($_REQUEST[$get_var]) . '" />';
}
}
?>
<div class="search-box frm_sidebar">
<label class="screen-reader-text" for="<?php
echo esc_attr($input_id);
?>
"><?php
echo esc_attr($text);
?>
:</label>
<input type="text" id="<?php
echo esc_attr($input_id);
?>
" name="s" value="<?php
echo esc_attr($search_str);
?>
" />
<?php
if (isset($field_list) && !empty($field_list)) {
?>
<select name="fid" class="hide-if-js">
<option value="">— <?php
_e('All Fields', 'formidable');
?>
—</option>
<option value="created_at" <?php
selected($fid, 'created_at');
?>
><?php
_e('Entry creation date', 'formidable');
?>
</option>
<option value="id" <?php
selected($fid, 'id');
?>
><?php
_e('Entry ID', 'formidable');
?>
</option>
<?php
foreach ($field_list as $f) {
?>
<option value="<?php
echo $f->type == 'user_id' ? 'user_id' : $f->id;
?>
" <?php
selected($fid, $f->id);
?>
><?php
echo FrmAppHelper::truncate($f->name, 30);
?>
</option>
<?php
}
?>
</select>
<div class="button dropdown hide-if-no-js">
<a href="#" id="frm-fid-search" class="frm-dropdown-toggle" data-toggle="dropdown"><?php
_e('Search', 'formidable');
?>
<b class="caret"></b></a>
<ul class="frm-dropdown-menu pull-right" id="frm-fid-search-menu" role="menu" aria-labelledby="frm-fid-search">
<li><a href="#" id="fid-">— <?php
_e('All Fields', 'formidable');
?>
—</a></li>
<li><a href="#" id="fid-created_at"><?php
_e('Entry creation date', 'formidable');
?>
</a></li>
<li><a href="#" id="fid-id"><?php
_e('Entry ID', 'formidable');
?>
</a></li>
<?php
foreach ($field_list as $f) {
?>
<li><a href="#" id="fid-<?php
echo $f->type == 'user_id' ? 'user_id' : $f->id;
//.........这里部分代码省略.........
示例4: form_switcher
public static function form_switcher()
{
$where = apply_filters('frm_forms_dropdown', array(), '');
$forms = FrmForm::get_published_forms($where);
$args = array('id' => 0, 'form' => 0);
if (isset($_GET['id']) && !isset($_GET['form'])) {
unset($args['form']);
} else {
if (isset($_GET['form']) && !isset($_GET['id'])) {
unset($args['id']);
}
}
$frm_action = FrmAppHelper::simple_get('frm_action', 'sanitize_title');
if (FrmAppHelper::is_admin_page('formidable-entries') && in_array($frm_action, array('edit', 'show', 'destroy_all'))) {
$args['frm_action'] = 'list';
$args['form'] = 0;
} else {
if (FrmAppHelper::is_admin_page('formidable') && in_array($frm_action, array('new', 'duplicate'))) {
$args['frm_action'] = 'edit';
} else {
if (isset($_GET['post'])) {
$args['form'] = 0;
$base = admin_url('edit.php?post_type=frm_display');
}
}
}
?>
<li class="dropdown last" id="frm_bs_dropdown">
<a href="#" id="frm-navbarDrop" class="frm-dropdown-toggle" data-toggle="dropdown"><?php
_e('Switch Form', 'formidable');
?>
<b class="caret"></b></a>
<ul class="frm-dropdown-menu frm-on-top" role="menu" aria-labelledby="frm-navbarDrop">
<?php
foreach ($forms as $form) {
if (isset($args['id'])) {
$args['id'] = $form->id;
}
if (isset($args['form'])) {
$args['form'] = $form->id;
}
?>
<li><a href="<?php
echo esc_url(isset($base) ? add_query_arg($args, $base) : add_query_arg($args));
?>
" tabindex="-1"><?php
echo esc_html(empty($form->name) ? __('(no title)') : FrmAppHelper::truncate($form->name, 33));
?>
</a></li>
<?php
unset($form);
}
?>
</ul>
</li>
<?php
}
示例5: register_form_settings
public static function register_form_settings()
{
$settings = array();
$error = false;
// Settings
if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
$gravity_options = array(0 => self::__('No forms found'));
if (class_exists('RGFormsModel') && method_exists('RGFormsModel', 'get_forms')) {
$all_grav_forms = RGFormsModel::get_forms(1, 'title');
$gravity_options = array();
foreach ($all_grav_forms as $form) {
$gravity_options[absint($form->id)] = esc_html($form->title);
}
}
$settings = array(self::GRAVITY_FORM_ID => array('label' => self::__('GravityForms ID'), 'option' => array('type' => 'select', 'options' => $gravity_options, 'default' => self::$gravity_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Gravity Forms</a>.'), 'https://sproutapps.co/link/gravity-forms'))));
} elseif (function_exists('ninja_forms_get_all_forms')) {
$ninja_options = array(0 => self::__('No forms found'));
if (function_exists('ninja_forms_get_all_forms')) {
$all_ninja_forms = ninja_forms_get_all_forms();
$ninja_options = array();
foreach ($all_ninja_forms as $form) {
$ninja_options[$form['id']] = $form['data']['form_title'];
}
}
// Settings
$settings = array(self::NINJA_FORM_ID => array('label' => self::__('NinjaForms ID'), 'option' => array('type' => 'select', 'options' => $ninja_options, 'default' => self::$ninja_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Ninja Forms</a>.'), 'https://sproutapps.co/link/ninja-forms'))));
} elseif (function_exists('frm_forms_autoloader')) {
$frdbl_options = array(0 => self::__('No forms found'));
$forms = FrmForm::get_published_forms();
if (!empty($forms)) {
$frdbl_options = array();
foreach ($forms as $form) {
$frdbl_options[$form->id] = !isset($form->name) ? __('(no title)', 'formidable') : esc_attr(FrmAppHelper::truncate($form->name, 33));
}
}
// Settings
$settings = array(self::FORMIDABLE_FORM_ID => array('label' => self::__('Formidable ID'), 'option' => array('type' => 'select', 'options' => $frdbl_options, 'default' => self::$frdbl_form_id, 'description' => sprintf(self::__('Select the submission form built with <a href="%s">Formidable</a>.'), 'https://sproutapps.co/link/formidable'))));
} else {
// Settings
$settings = array(self::NINJA_FORM_ID => array('label' => self::__('Integration Error'), 'option' => array('type' => 'bypass', 'output' => sprintf(self::__('It looks like neither <a href="%s">Gravity Forms</a> or <a href="%s">Ninja Forms</a> or <a href="%s">Formidable</a> is active.'), 'https://sproutapps.co/link/gravity-forms', 'https://sproutapps.co/link/ninja-forms', 'https://sproutapps.co/link/formidable'))));
$error = true;
}
$map_settings = array();
if (!$error) {
// Settings
$map_settings = array(self::FORM_ID_MAPPING => array('label' => self::__('Form ID Mapping'), 'option' => array(__CLASS__, 'show_form_field_mapping'), 'sanitize_callback' => array(__CLASS__, 'save_form_field_mapping')));
}
return array_merge($settings, $map_settings);
}
示例6: bulk_actions
public static function bulk_actions($action = 'list-form')
{
$params = FrmForm::get_admin_params();
$errors = array();
$bulkaction = '-1';
if ($action == 'list-form') {
if ($_REQUEST['bulkaction'] != '-1') {
$bulkaction = sanitize_text_field($_REQUEST['bulkaction']);
} else {
if ($_POST['bulkaction2'] != '-1') {
$bulkaction = sanitize_text_field($_REQUEST['bulkaction2']);
}
}
} else {
$bulkaction = str_replace('bulk_', '', $action);
}
$items = FrmAppHelper::get_param('item-action', '');
if (empty($items)) {
$errors[] = __('No entries were specified', 'formidable');
} else {
$frm_settings = FrmAppHelper::get_settings();
if (!is_array($items)) {
$items = explode(',', $items);
}
if ($bulkaction == 'delete') {
if (!current_user_can('frm_delete_entries')) {
$errors[] = $frm_settings->admin_permission;
} else {
if (is_array($items)) {
foreach ($items as $item_id) {
FrmEntry::destroy($item_id);
}
}
}
} else {
if ($bulkaction == 'csv') {
FrmAppHelper::permission_check('frm_view_entries');
$form_id = $params['form'];
if (!$form_id) {
$form = FrmForm::get_published_forms(array(), 1);
if (!empty($form)) {
$form_id = $form->id;
} else {
$errors[] = __('No form was found', 'formidable');
}
}
if ($form_id && is_array($items)) {
echo '<script type="text/javascript">window.onload=function(){location.href="' . esc_url_raw(admin_url('admin-ajax.php') . '?form=' . $form_id . '&action=frm_entries_csv&item_id=' . implode(',', $items)) . '";}</script>';
}
}
}
}
FrmEntriesController::display_list('', $errors);
}
示例7: extra_tablenav
public function extra_tablenav($which)
{
if ('top' != $which) {
return;
}
if ('trash' == $this->status && current_user_can('frm_delete_forms')) {
?>
<div class="alignleft actions frm_visible_overflow">
<?php
submit_button(__('Empty Trash'), 'apply', 'delete_all', false);
?>
</div>
<?php
return;
}
if ('template' != $this->status) {
return;
}
$where = apply_filters('frm_forms_dropdown', array(), '');
$forms = FrmForm::get_published_forms($where);
$base = admin_url('admin.php?page=formidable&form_type=template');
$args = array('frm_action' => 'duplicate', 'template' => true);
?>
<div class="alignleft actions frm_visible_overflow">
<div class="dropdown frm_tiny_top_margin">
<a href="#" id="frm-templateDrop" class="frm-dropdown-toggle button" data-toggle="dropdown"><?php
_e('Create New Template', 'formidable');
?>
<b class="caret"></b></a>
<ul class="frm-dropdown-menu" role="menu" aria-labelledby="frm-templateDrop">
<?php
if (empty($forms)) {
?>
<li class="frm_dropdown_li"><?php
_e('You have not created any forms yet. <br/>You must create a form before you can make a template.', 'formidable');
?>
</li>
<?php
} else {
foreach ($forms as $form) {
$args['id'] = $form->id;
?>
<li><a href="<?php
echo esc_url(add_query_arg($args, $base));
?>
" tabindex="-1"><?php
echo esc_html(empty($form->name) ? __('(no title)') : FrmAppHelper::truncate($form->name, 33));
?>
</a></li>
<?php
unset($form);
}
}
?>
</ul>
</div>
</div>
<?php
}
示例8: options_form_before
public static function options_form_before($field)
{
if ('data' == $field['type']) {
$form_list = FrmForm::get_published_forms();
$selected_field = $selected_form_id = '';
$current_field_id = $field['id'];
if (isset($field['form_select']) && is_numeric($field['form_select'])) {
$selected_field = FrmField::getOne($field['form_select']);
if ($selected_field) {
$selected_form_id = FrmProFieldsHelper::get_parent_form_id($selected_field);
$fields = FrmField::get_all_for_form($selected_form_id);
} else {
$selected_field = '';
}
} else {
if (isset($field['form_select'])) {
$selected_field = $field['form_select'];
}
}
}
include FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/options-form-before.php';
}