本文整理汇总了PHP中GFAPI::get_forms方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::get_forms方法的具体用法?PHP GFAPI::get_forms怎么用?PHP GFAPI::get_forms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::get_forms方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fix
public function fix()
{
if ($this->can_fix()) {
$forms = GFAPI::get_forms();
foreach ($forms as $form) {
$form['enableHoneypot'] = 1;
GFAPI::update_form($form);
}
}
return $this->run();
}
示例2: getIdOfMusicDB_Helper
public static function getIdOfMusicDB_Helper()
{
$create_competition_form_name = 'ARIA: Create a Competition';
$create_competition_form_id = NULL;
$all_active_forms = GFAPI::get_forms();
foreach ($all_active_forms as $form) {
if ($form['title'] === $create_competition_form_name) {
$create_competition_form_id = $form['id'];
}
}
if (!isset($create_competition_form_id)) {
$create_competition_form_id = -1;
}
return $create_competition_form_id;
}
示例3: aria_get_nnmta_database_form_id
/**
* This function will find the ID of the form used as the NNMTA music database.
*
* This function will iterate through all of the active form objects and return the
* ID of the form that is used to store all NNMTA music.
*
* @since 1.0.0
* @author KREW
*/
function aria_get_nnmta_database_form_id()
{
$nnmta_music_database_form_name = 'NNMTA Music Database';
$nnmta_music_database_form_id = NULL;
$all_active_forms = GFAPI::get_forms();
foreach ($all_active_forms as $form) {
if ($form['title'] === $nnmta_music_database_form_name) {
$nnmta_music_database_form_id = $form['id'];
}
}
if (!isset($nnmta_music_database_form_id)) {
wp_die('Form ' . $nnmta_music_database_form_name . ' does not exist. Please create it and try again.');
}
return $nnmta_music_database_form_id;
}
示例4: aria_create_competition_activation
/**
* This function will run on the activation of this plugin.
*
* This function is responsible for performing all necessary actions when activated. For
* example, this function will check to see if a form already exists for creating new
* music competitions. If no such form exists, this function will create a new form
* designed specifically for creating new music competitions.
*
* @since 1.0.0
* @author KREW
*/
function aria_create_competition_activation()
{
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if (is_plugin_active('gravityforms/gravityforms.php')) {
$forms = GFAPI::get_forms();
$create_competition_form_id = aria_get_create_competition_form_id();
// if the form for creating music competitions does not exist, create a new form
if ($create_competition_form_id === -1) {
aria_create_competition_form();
}
} else {
$error_message = 'Error: The Gravity Forms plugin is not active. Please activate';
$error_message .= ' the Gravity Forms plugin and reactivate this plugin.';
wp_die($error_message);
}
}
示例5: register_strings
public function register_strings()
{
if (!class_exists('GFAPI') || !function_exists('pll_register_string')) {
return;
}
$forms = GFAPI::get_forms();
foreach ($forms as $form) {
$this->form = $form;
$this->iterate_form($form, function ($value, $key) {
$name = '';
// todo: suitable naming
$group = "Form #{$this->form['id']}: {$this->form['title']}";
pll_register_string($name, $value, $group);
$this->registered_strings[] = $value;
});
}
}
示例6: get_settings
/**
* Get the settings need to Gravity Forms.
*/
public static function get_settings()
{
// If the gforms plugin is not active.
if (!class_exists('GFWebAPI')) {
return false;
}
$settings = get_option('gravityformsaddon_gravityformswebapi_settings');
// If the API is not enabled.
if (empty($settings) || !$settings['enabled']) {
return false;
}
$forms = [];
$method = 'GET';
$expires = strtotime(self::SIGNATURE_EXPIRY);
foreach (\GFAPI::get_forms() as $form) {
$get_form_route = 'forms/' . $form['id'];
$string_to_sign = sprintf('%s:%s:%s:%s', $settings['public_key'], $method, $get_form_route, $expires);
$forms[$form['id']] = ['get_form' => ['route' => $get_form_route, 'expires' => $expires, 'signature' => self::calculate_signature($string_to_sign, $settings['private_key'])], 'post_submission' => ['route' => 'forms/' . $form['id'] . '/submissions']];
}
return ['api_base' => GFWEBAPI_API_BASE_URL, 'api_key' => $settings['public_key'], 'forms' => $forms];
}
示例7: test_fire_everything
/**
* @since 1.15
* @covers GravityView_Uninstall::fire_everything()
*/
function test_fire_everything()
{
$create_count = 10;
$form = $this->factory->form->create_and_get();
$all_forms = GFAPI::get_forms();
$views = $this->factory->view->create_many($create_count, array('form_id' => $form['id']));
$entry_ids = $this->factory->entry->create_many($create_count, array('form_id' => $form['id']));
$connected = gravityview_get_connected_views($form['id']);
$entry_count = GFAPI::count_entries($form['id']);
// Make sure the objects were created and connected
$this->assertEquals($create_count, count(array_filter($views)));
$this->assertEquals($create_count, count(array_filter($connected)));
$this->assertEquals($create_count, count(array_filter($entry_ids)));
$this->_set_up_expected_options();
### DO NOT DELETE WHEN THE USER DOESN'T HAVE THE CAPABILITY
$user = $this->factory->user->create_and_set(array('user_login' => 'administrator', 'user_pass' => 'administrator', 'role' => 'administrator'));
$this->assertTrue(GVCommon::has_cap('gravityview_uninstall'));
### DO NOT DELETE WHEN IT IS NOT SET OR SET TO FALSE
// TRY deleting when the settings aren't configured.
$this->_set_up_gravityview_settings(NULL);
$this->uninstall();
$this->_check_deleted_options(false);
// TRY deleting when the Delete setting is set to No
$this->_set_up_gravityview_settings('0');
$this->uninstall();
$this->_check_deleted_options(false);
### REALLY DELETE NOW
// Create the items
$this->_set_up_gravityview_settings('delete');
$this->_set_up_notes($entry_ids);
$this->_set_up_entry_meta($entry_ids, $form);
$this->uninstall();
// No Forms should be deleted
$this->assertEquals($all_forms, GFAPI::get_forms());
$this->_check_posts();
$this->_check_entries($form, $entry_count);
$this->_check_deleted_options();
$this->_check_deleted_entry_notes($entry_ids);
$this->_check_deleted_entry_meta($entry_ids);
}
示例8: aria_activation_func
function aria_activation_func()
{
require_once ABSPATH . 'wp-admin/includes/plugin.php';
if (is_plugin_active('gravityforms/gravityforms.php')) {
aria_create_teacher_form("Sample Created");
aria_create_student_form("Sample Created");
// Get all forms from gravity forms
$forms = GFAPI::get_forms();
// Set the form index of the Competition Creation Form.
$competition_creation_form_title = "ARIA: Create a Competition";
$index = -1;
// Loop through each form to see if the form was previously created.
foreach ($forms as $form) {
if ($form['title'] == "ARIA: Create a Competition") {
$index = $form['id'];
}
}
// form does not exist; create new form
if ($index == -1) {
$result = aria_create_competition_form();
}
}
}
示例9: upgrade
public function upgrade($previous_version)
{
if (version_compare($previous_version, '1.0.5') == -1) {
$forms = GFAPI::get_forms(true);
foreach ($forms as $form) {
$entries = GFAPI::get_entries($form['id']);
$fields = GFAPI::get_fields_by_type($form, 'repeater');
foreach ($entries as $entry) {
foreach ($fields as $field) {
if (array_key_exists($field['id'], $entry)) {
$dataArray = GFFormsModel::unserialize($entry[$field['id']]);
$dataUpdated = false;
if (!is_array($dataArray)) {
continue;
}
foreach ($dataArray as $repeaterChildId => $repeaterChild) {
foreach ($repeaterChild as $repeatedFieldId => $repeatedField) {
if (!is_array($repeatedField)) {
if ($repeatedField !== '[gfRepeater-section]') {
$dataUpdated = true;
$dataArray[$repeaterChildId][$repeatedFieldId] = array($repeatedField);
}
} elseif (reset($repeatedField) == '[gfRepeater-section]') {
$dataUpdated = true;
$dataArray[$repeaterChildId][$repeatedFieldId] = reset($repeatedField);
}
}
}
if ($dataUpdated) {
GFAPI::update_entry_field($entry['id'], $field['id'], maybe_serialize($dataArray));
}
}
}
}
}
}
}
示例10: aria_find_related_forms_ids
/**
* Function for returning related forms.
*
* This function will return an associative array that maps the titles of
* the associated forms in a music competition (student, student master,
* teacher, and teacher master) to their respective form IDs.
*
* @param $prepended_title String The prepended portion of the competition title.
*
* @author KREW
* @since 1.0.0
*/
public static function aria_find_related_forms_ids($prepended_title)
{
// make sure to get all forms! check this
$all_forms = GFAPI::get_forms();
$form_ids = array(self::STUDENT_FORM => null, self::STUDENT_MASTER => null, self::TEACHER_FORM => null, self::TEACHER_MASTER => null);
$student_form = $prepended_title . " Student Registration";
$student_master_form = $prepended_title . " Student Master";
$teacher_form = $prepended_title . " Teacher Registration";
$teacher_master_form = $prepended_title . " Teacher Master";
$all_competition_forms = array($student_form, $student_master_form, $teacher_form, $teacher_master_form);
foreach ($all_forms as $form) {
switch ($form["title"]) {
case $student_form:
$form_ids[self::STUDENT_FORM] = $form["id"];
break;
case $student_master_form:
$form_ids[self::STUDENT_MASTER] = $form["id"];
break;
case $teacher_form:
$form_ids[self::TEACHER_FORM] = $form["id"];
break;
case $teacher_master_form:
$form_ids[self::TEACHER_MASTER] = $form["id"];
break;
default:
break;
}
}
// make sure all forms exist
foreach ($form_ids as $key => $value) {
if (!isset($value)) {
wp_die('Error: The form titled ' . $all_competition_forms[$key] . " does not exist.");
}
}
return $form_ids;
}
示例11: form_id_box_content
function form_id_box_content()
{
$form_id = get_post_meta(get_the_ID(), 'form_id', true);
$gForms = RGFormsModel::get_forms(null, 'title');
if (!$gForms) {
echo '<p>Não encontramos nenhum formulário cadastrado, entre no seu plugin de formulário de contato ou <a href="admin.php?page=gf_new_form">clique aqui para criar um novo.</a></p>';
} else {
?>
<div class="rd-select-form">
<select name="form_id">
<option value=""> </option>
<?php
foreach ($gForms as $gForm) {
echo "<option value=" . $gForm->id . selected($form_id, $gForm->id, false) . ">" . $gForm->title . "</option>";
}
?>
</select>
</div>
<?php
$gf_forms = GFAPI::get_forms();
$form_map = get_post_meta(get_the_ID(), 'gf_mapped_fields', true);
foreach ($gf_forms as $form) {
if ($form['id'] == $form_id) {
echo '<h4>Como os campos abaixo irão se chamar no RD Station?</h4>';
foreach ($form['fields'] as $field) {
if (!empty($form_map[$field['id']])) {
$value = $form_map[$field['id']];
} else {
$value = '';
}
echo '<p class="rd-fields-mapping"><span class="rd-fields-mapping-label">' . $field['label'] . '</span> <span class="dashicons dashicons-arrow-right-alt"></span> <input type="text" name="gf_mapped_fields[' . $field['id'] . ']" value="' . $value . '">';
}
}
}
}
}
示例12: upgrade
/**
* Upgrading functions
*
* @since 1.5.0
*/
public function upgrade($previous_version)
{
// If the version is below 1.5.0, we need to move the form specific settings
if (version_compare($previous_version, "1.5.0") == -1) {
$forms = GFAPI::get_forms(true);
foreach ($forms as $form) {
$this->upgrade_old_form_settings($form);
}
}
// If the version is below 1.6.0, we need to convert any form settings to a feed
if (version_compare($previous_version, "1.6.0") == -1) {
$forms = GFAPI::get_forms(true);
foreach ($forms as $form) {
$this->upgrade_settings_to_feed($form);
}
}
}
开发者ID:resoundcreative-dev,项目名称:wordpress-gravity-forms-event-tracking,代码行数:22,代码来源:class-gravity-forms-event-tracking-feed.php
示例13: get_forms
/**
* Returns the list of available forms
*
* @access public
* @param mixed $form_id
* @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys
*/
public static function get_forms()
{
$forms = array();
if (class_exists('GFAPI')) {
$gf_forms = GFAPI::get_forms();
foreach ($gf_forms as $form) {
$forms[] = array('id' => $form['id'], 'title' => $form['title']);
}
}
return $forms;
}
示例14: wp_init
/**
* Register Gravity Forms with Polylang.
*
* @used-by Actions\"init"
*/
public function wp_init()
{
$forms = GFAPI::get_forms();
if (is_array($forms)) {
foreach ($forms as $form) {
$this->register_strings($form);
}
}
}
示例15: app_settings_fields
public function app_settings_fields()
{
$forms = GFAPI::get_forms();
$choices = array();
foreach ($forms as $form) {
$form_id = absint($form['id']);
$feeds = $this->get_feeds($form_id);
if (!empty($feeds)) {
$choices[] = array('label' => esc_html($form['title']), 'name' => 'publish_form_' . absint($form['id']));
}
}
if (!empty($choices)) {
$published_forms_fields = array(array('name' => 'form_ids', 'label' => esc_html__('Published', 'gravityflow'), 'type' => 'checkbox', 'choices' => $choices));
} else {
$published_forms_fields = array(array('name' => 'no_workflows', 'label' => '', 'type' => 'html', 'html' => esc_html__('No workflow steps have been added to any forms yet.', 'gravityflow')));
}
$settings = array();
if (!is_multisite() || is_multisite() && is_main_site() && !defined('GRAVITY_FLOW_LICENSE_KEY')) {
$settings[] = array('title' => esc_html__('Settings', 'gravityflow'), 'fields' => array(array('name' => 'license_key', 'label' => esc_html__('License Key', 'gravityflow'), 'type' => 'text', 'validation_callback' => array($this, 'license_validation'), 'feedback_callback' => array($this, 'license_feedback'), 'error_message' => __('Invalid license', 'gravityflow'), 'class' => 'large', 'default_value' => ''), array('name' => 'background_updates', 'label' => esc_html__('Background Updates', 'gravityflow'), 'tooltip' => __('Set this to ON to allow Gravity Flow to download and install bug fixes and security updates automatically in the background. Requires a valid license key.', 'gravityflow'), 'type' => 'radio', 'horizontal' => true, 'default_value' => false, 'choices' => array(array('label' => __('On', 'gravityflow'), 'value' => true), array('label' => __('Off', 'gravityflow'), 'value' => false)))));
}
$settings[] = array('title' => esc_html__('Published Workflow Forms', 'gravityflow'), 'description' => esc_html__('Select the forms you wish to publish on the Submit page.', 'gravityflow'), 'fields' => $published_forms_fields);
$settings[] = array('id' => 'save_button', 'fields' => array(array('id' => 'save_button', 'name' => 'save_button', 'type' => 'save', 'value' => __('Update Settings', 'gravityflow'), 'messages' => array('success' => __('Settings updated successfully', 'gravityflow'), 'error' => __('There was an error while saving the settings', 'gravityflow')))));
return $settings;
}