本文整理汇总了PHP中GFCommon::get_base_path方法的典型用法代码示例。如果您正苦于以下问题:PHP GFCommon::get_base_path方法的具体用法?PHP GFCommon::get_base_path怎么用?PHP GFCommon::get_base_path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFCommon
的用法示例。
在下文中一共展示了GFCommon::get_base_path方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_hooks
/**
* @since 1.7.5
*/
function add_hooks()
{
// If Gravity Forms isn't active or compatibile, stop loading
if (false === GravityView_Compatibility::is_valid()) {
return;
}
// Migrate Class
require_once GRAVITYVIEW_DIR . 'includes/class-migrate.php';
// Don't load tooltips if on Gravity Forms, otherwise it overrides translations
if (!GFForms::is_gravity_page()) {
require_once GFCommon::get_base_path() . '/tooltips.php';
}
require_once GRAVITYVIEW_DIR . 'includes/admin/metaboxes/class-gravityview-admin-metaboxes.php';
require_once GRAVITYVIEW_DIR . 'includes/admin/entry-list.php';
require_once GRAVITYVIEW_DIR . 'includes/class-change-entry-creator.php';
/** @since 1.6 */
require_once GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-duplicate-view.php';
// Filter Admin messages
add_filter('post_updated_messages', array($this, 'post_updated_messages'));
add_filter('bulk_post_updated_messages', array($this, 'post_updated_messages'));
add_filter('plugin_action_links_' . plugin_basename(GRAVITYVIEW_FILE), array($this, 'plugin_action_links'));
add_action('plugins_loaded', array($this, 'backend_actions'), 100);
//Hooks for no-conflict functionality
add_action('wp_print_scripts', array($this, 'no_conflict_scripts'), 1000);
add_action('admin_print_footer_scripts', array($this, 'no_conflict_scripts'), 9);
add_action('wp_print_styles', array($this, 'no_conflict_styles'), 1000);
add_action('admin_print_styles', array($this, 'no_conflict_styles'), 11);
add_action('admin_print_footer_scripts', array($this, 'no_conflict_styles'), 1);
add_action('admin_footer', array($this, 'no_conflict_styles'), 1);
}
示例2: init
public static function init()
{
if (basename($_SERVER['PHP_SELF']) == "plugins.php") {
//loading translations
load_plugin_textdomain('gravityformsmailchimp', FALSE, '/gravityformsmailchimp/languages');
add_action('after_plugin_row_' . self::$path, array('GFMailChimp', 'plugin_row'));
//force new remote request for version info on the plugin page
self::flush_version_info();
}
if (!self::is_gravityforms_supported()) {
return;
}
if (is_admin()) {
//loading translations
load_plugin_textdomain('gravityformsmailchimp', FALSE, '/gravityformsmailchimp/languages');
add_filter("transient_update_plugins", array('GFMailChimp', 'check_update'));
add_filter("site_transient_update_plugins", array('GFMailChimp', 'check_update'));
add_action('install_plugins_pre_plugin-information', array('GFMailChimp', 'display_changelog'));
// paypal plugin integration hooks
add_action("gform_paypal_action_fields", array("GFMailChimp", "add_paypal_settings"), 10, 2);
add_filter("gform_paypal_save_config", array("GFMailChimp", "save_paypal_settings"));
//creates a new Settings page on Gravity Forms' settings screen
if (self::has_access("gravityforms_mailchimp")) {
RGForms::add_settings_page("MailChimp", array("GFMailChimp", "settings_page"), self::get_base_url() . "/images/mailchip_wordpress_icon_32.png");
}
}
//integrating with Members plugin
if (function_exists('members_get_capabilities')) {
add_filter('members_get_capabilities', array("GFMailChimp", "members_get_capabilities"));
}
//creates the subnav left menu
add_filter("gform_addon_navigation", array('GFMailChimp', 'create_menu'));
if (self::is_mailchimp_page()) {
//enqueueing sack for AJAX requests
wp_enqueue_script(array("sack"));
//loading data lib
require_once self::get_base_path() . "/data.php";
//loading upgrade lib
if (!class_exists("RGMailChimpUpgrade")) {
require_once "plugin-upgrade.php";
}
//loading Gravity Forms tooltips
require_once GFCommon::get_base_path() . "/tooltips.php";
add_filter('gform_tooltips', array('GFMailChimp', 'tooltips'));
//runs the setup when version changes
self::setup();
} else {
if (in_array(RG_CURRENT_PAGE, array("admin-ajax.php"))) {
//loading data class
require_once self::get_base_path() . "/data.php";
add_action('wp_ajax_rg_update_feed_active', array('GFMailChimp', 'update_feed_active'));
add_action('wp_ajax_gf_select_mailchimp_form', array('GFMailChimp', 'select_mailchimp_form'));
} else {
//handling post submission.
add_action("gform_after_submission", array('GFMailChimp', 'export'), 10, 2);
//handling paypal fulfillment
add_action("gform_paypal_fulfillment", array("GFMailChimp", "paypal_fulfillment"), 10, 4);
}
}
}
示例3: template_redirect
/**
* Handle requests for form iframes.
*
* @since 1.0.0
*/
public function template_redirect()
{
global $wp;
if (empty($wp->query_vars['gfiframe']) || 'gfembed' != $wp->query_vars['gfiframe'] && 'gfembed.php' != $wp->query_vars['gfiframe']) {
return;
}
$form_id = null;
if (!empty($_GET['f'])) {
$form_id = absint($_GET['f']);
} else {
// The request needs an 'f' query arg with the form id.
wp_die(esc_html__('Invalid form id.', 'gravity-forms-iframe'));
}
$form = GFFormsModel::get_form_meta($form_id);
$settings = $this->addon->get_form_settings($form);
// Make sure the form can be embedded.
if (empty($settings['is_enabled']) || !$settings['is_enabled']) {
wp_die(esc_html__('Embedding is disabled for this form.', 'gravity-forms-iframe'));
}
// Disable the toolbar in case the form is embedded on the same domain.
show_admin_bar(false);
require_once GFCommon::get_base_path() . '/form_display.php';
// Settings may be overridden in the query string (querystring -> form settings -> default).
$args = wp_parse_args($_GET, array('dt' => empty($settings['display_title']) ? false : (bool) $settings['display_title'], 'dd' => empty($settings['display_description']) ? false : (bool) $settings['display_description']));
// @todo Need to convert query string values to boolean.
$display_title = (bool) $args['dt'];
$display_description = (bool) $args['dd'];
unset($args);
unset($settings);
// Templates can be customized in parent or child themes.
$templates = array('gravity-forms-iframe-' . $form_id . '.php', 'gravity-forms-iframe.php');
$template = gfiframe_locate_template($templates);
include $template;
exit;
}
示例4: render_frontend
public function render_frontend($widget_args, $content = '', $context = '')
{
if (!$this->pre_render_frontend()) {
return;
}
if (!empty($widget_args['title'])) {
echo $widget_args['title'];
}
// Make sure the class is loaded in DataTables
if (!class_exists('GFFormDisplay')) {
include_once GFCommon::get_base_path() . '/form_display.php';
}
$widget_args['content'] = trim(rtrim($widget_args['content']));
// No custom content
if (empty($widget_args['content'])) {
do_action('gravityview_log_debug', sprintf('%s[render_frontend]: No content.', get_class($this)));
return;
}
// Add paragraphs?
if (!empty($widget_args['wpautop'])) {
$widget_args['content'] = wpautop($widget_args['content']);
}
// Enqueue scripts needed for Gravity Form display, if form shortcode exists.
// Also runs `do_shortcode()`
$content = GFCommon::gform_do_shortcode($widget_args['content']);
// Add custom class
$class = !empty($widget_args['custom_class']) ? $widget_args['custom_class'] : '';
$class = gravityview_sanitize_html_class($class);
echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>';
}
示例5: init
public static function init()
{
//supports logging
add_filter('gform_logging_supported', array('GFLimit', 'gform_logging_supported'));
if (basename($_SERVER['PHP_SELF']) == 'plugins.php') {
//loading translations
load_plugin_textdomain('gf-limit', FALSE, dirname(GF_LIMIT_FILE) . '/languages');
}
if (!self::is_gravityforms_supported()) {
return;
}
//loading data lib
require_once GF_LIMIT_PATH . '/inc/data.php';
// load our limit functions
require_once GF_LIMIT_PATH . '/inc/gf_field_sum.php';
if (is_admin()) {
//runs the setup when version changes
self::setup();
//loading translations
load_plugin_textdomain('gf-limit', FALSE, dirname(GF_LIMIT_FILE) . '/languages');
//integrating with Members plugin
if (function_exists('members_get_capabilities')) {
add_filter('members_get_capabilities', array('GFLimit', 'members_get_capabilities'));
}
//creates the subnav left menu
add_filter('gform_addon_navigation', array('GFLimit', 'gform_addon_navigation'));
if (self::is_limit_page()) {
//enqueueing sack for AJAX requests
wp_enqueue_script(array('sack'));
//loading Gravity Forms tooltips
require_once GFCommon::get_base_path() . '/tooltips.php';
add_filter('gform_tooltips', array('GFLimit', 'gform_tooltips'));
} else {
if (in_array(RG_CURRENT_PAGE, array('admin-ajax.php'))) {
add_action('wp_ajax_gf_limit_update_feed_active', array('GFLimit', 'gf_limit_update_feed_active'));
add_action('wp_ajax_gfp_select_limit_form', array('GFLimit', 'gfp_select_limit_form'));
} else {
if ('gf_entries' == RGForms::get('page')) {
}
}
}
} else {
// Load feed data
$feeds = GFLimitData::get_feeds();
// Cycle through feeds and add limits to the form
foreach ($feeds as $k => $v) {
// Enable if active
if ($v['is_active']) {
// Replace variable strings
// {remaining} for remaining tickets
// {ordered} for tickets ordered
$validation = str_replace('{remaining}', '%2$s', $v['meta']['messages']['validation']);
$validation = str_replace('{ordered}', '%1$s', $validation);
$remainder = str_replace('{remaining}', '%1$s', $v['meta']['messages']['remainder']);
$sold_out = $v['meta']['messages']['sold_out'];
new MY_GWLimitBySum(array('form_id' => $v['form_id'], 'field_id' => $v['field_id'], 'limit' => $v['quantity_limit'], 'limit_message' => '<span class="error-notice">' . $sold_out . '</span>', 'validation_message' => $validation, 'remainder_message' => '<span class="remaining">' . $remainder . '</span>'));
}
}
}
}
示例6: setUp
function setUp()
{
parent::setUp();
$this->AJAX = new GravityView_Ajax();
$this->create_test_nonce();
$this->GravityView_Preset_Business_Data = new GravityView_Preset_Business_Data();
require_once GFCommon::get_base_path() . '/export.php';
}
示例7: bb_click_array_field_input
function bb_click_array_field_input($input, $field, $value, $lead_id, $form_id)
{
if ($field["type"] == "bb_click_array") {
$field_id = IS_ADMIN || $form_id == 0 ? "input_{$id}" : "input_" . $form_id . "_{$id}";
$input_name = $form_id . '_' . $field["id"];
$css = isset($field['cssClass']) ? $field['cssClass'] : "";
$disabled_text = IS_ADMIN && RG_CURRENT_VIEW != "entry" ? "disabled='disabled'" : "";
$amount = '';
$clicked = '';
if (is_array($value)) {
$amount = esc_attr(rgget($field["id"] . ".1", $value));
$clicked = rgget($field["id"] . ".5", $value);
}
$html = "<div id='{$field_id}' class='ginput_container bb-click-array-" . count($field['choices']) . " " . esc_attr($css) . "'>" . "\n";
if (is_array($field["choices"])) {
$choice_id = 0;
$tabindex = GFCommon::get_tabindex();
foreach ($field["choices"] as $choice) {
$id = $field["id"] . '_' . $choice_id;
$field_value = !empty($choice["value"]) || rgar($field, "enableChoiceValue") ? $choice["value"] : $choice["text"];
if (rgblank($amount) && RG_CURRENT_VIEW != "entry") {
$active = rgar($choice, "isSelected") ? "checked='checked'" : "";
} else {
$active = RGFormsModel::choice_value_match($field, $choice, $amount) ? "checked='checked'" : "";
}
if ($active) {
$amount = $field_value;
}
$field_class = $active ? 's-active' : 's-passive';
if (rgar($field, 'field_bb_click_array_is_product')) {
require_once GFCommon::get_base_path() . '/currency.php';
$currency = new RGCurrency(GFCommon::get_currency());
$field_value = $currency->to_money($field_value);
$field_class .= ' s-currency';
}
$html .= sprintf('<div data-clickarray-value="%s" data-choice-id="%s" class="s-html-wrapper %s" id="%s">', esc_attr($field_value), $choice_id, $field_class, $id);
$html .= sprintf('<div class="s-html-value">%s</div>', $field_value);
$html .= sprintf("<label for='choice_%s' id='label_%s'>%s</label>", $id, $id, $choice["text"]);
$html .= '</div>';
$choice_id++;
}
$onblur = !IS_ADMIN ? 'if(jQuery(this).val().replace(" ", "") == "") { jQuery(this).val("' . $other_default_value . '"); }' : '';
$onkeyup = empty($field["conditionalLogicFields"]) || IS_ADMIN ? '' : "onchange='gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ");' onkeyup='clearTimeout(__gf_timeout_handle); __gf_timeout_handle = setTimeout(\"gf_apply_rules(" . $field["formId"] . "," . GFCommon::json_encode($field["conditionalLogicFields"]) . ")\", 300);'";
$value_exists = RGFormsModel::choices_value_match($field, $field["choices"], $value);
$other_label = empty($field['field_bb_click_array_other_label']) ? 'My Best Gift' : $field['field_bb_click_array_other_label'];
$other_class = rgar($field, 'enableOtherChoice') ? '' : 'hide';
$html .= "<label for='input_{$field["formId"]}_{$field["id"]}_1' class='ginput_bb_click_array_other_label " . $other_class . "'>" . $other_label . "</label>";
$other_class .= rgar($field, 'field_bb_click_array_is_product') ? ' ginput_amount gfield_price gfield_price_' . $field['formId'] . '_' . $field['id'] . '_1 gfield_product_' . $field['formId'] . '_' . $field['id'] . '_1' : '';
$html .= "<input id='input_{$field["formId"]}_{$field["id"]}_1' name='input_{$field["id"]}_1' type='text' value='" . esc_attr($amount) . "' class='ginput_bb ginput_click_array_other " . $other_class . " " . $field['size'] . "' onblur='{$onblur}' {$tabindex} {$onkeyup} {$disabled_text}>";
$html .= "<input id='input_{$field["formId"]}_{$field["id"]}_5' name='input_{$field["id"]}_5' type='hidden' value='" . esc_attr($clicked) . "' class='ginput_bb ginput_click_array_clicked'>";
}
$html .= "</div>";
return $html;
}
return $input;
}
示例8: init
public static function init()
{
//supports logging
add_filter("gform_logging_supported", array("GFZapier", "set_logging_supported"));
if (basename($_SERVER['PHP_SELF']) == "plugins.php") {
//loading translations
load_plugin_textdomain('gravityformszapier', FALSE, '/gravityformszapier/languages');
add_action('after_plugin_row_' . self::$path, array('GFZapier', 'plugin_row'));
//force new remote request for version info on the plugin page
self::flush_version_info();
}
if (!self::is_gravityforms_supported()) {
return;
}
//loading data lib
require_once self::get_base_path() . "/data.php";
if (is_admin()) {
//loading translations
load_plugin_textdomain('gravityformszapier', FALSE, '/gravityformszapier/languages');
add_filter("transient_update_plugins", array('GFZapier', 'check_update'));
add_filter("site_transient_update_plugins", array('GFZapier', 'check_update'));
add_action('install_plugins_pre_plugin-information', array('GFZapier', 'display_changelog'));
//add item to form settings menu in expand list
add_action('gform_form_settings_menu', array("GFZapier", 'add_form_settings_menu'));
//add action so that when form is updated, data fields are sent to Zapier
add_action("gform_after_save_form", array("GFZapier", 'send_form_updates'), 10, 2);
if (RGForms::get("page") == "gf_settings") {
//add Zapier link to settings tabs on GF Main Settings page
if (self::has_access("gravityforms_zapier")) {
RGForms::add_settings_page("Zapier", array("GFZapier", "settings_page"), self::get_base_url() . "/images/zapier_wordpress_icon_32.png");
}
}
if (RGForms::get("subview") == "gravityformszapier") {
//add page Zapier link will go to
add_action("gform_form_settings_page_gravityformszapier", array("GFZapier", 'zapier_page'));
//loading upgrade lib
if (!class_exists("GFZapierUpgrade")) {
require_once "plugin-upgrade.php";
}
//loading Gravity Forms tooltips
require_once GFCommon::get_base_path() . "/tooltips.php";
add_filter('gform_tooltips', array('GFZapier', 'tooltips'));
}
//runs the setup when version changes
self::setup();
} else {
// ManageWP premium update filters
add_filter('mwp_premium_update_notification', array('GFZapier', 'premium_update_push'));
add_filter('mwp_premium_perform_update', array('GFZapier', 'premium_update'));
add_action("gform_after_submission", array("GFZapier", "send_form_data_to_zapier"), 10, 2);
}
//integrating with Members plugin
if (function_exists('members_get_capabilities')) {
add_filter('members_get_capabilities', array("GFZapier", "members_get_capabilities"));
}
}
示例9: validate
public function validate($value, $form)
{
if (!class_exists('RGCurrency')) {
require_once GFCommon::get_base_path() . '/currency.php';
}
$price = GFCommon::to_number($value);
if (!rgblank($value) && ($price === false || $price < 0)) {
$this->failed_validation = true;
$this->validation_message = empty($this->errorMessage) ? __('Please enter a valid amount.', 'gravityforms') : $this->errorMessage;
}
}
示例10: get_value_save_entry
public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead)
{
// ignore submitted value and recalculate price in backend
list($prefix, $field_id, $input_id) = rgexplode('_', $input_name, 3);
if ($input_id == 2) {
require_once GFCommon::get_base_path() . '/currency.php';
$currency = new RGCurrency(GFCommon::get_currency());
$lead = empty($lead) ? RGFormsModel::get_lead($lead_id) : $lead;
$value = $currency->to_money(GFCommon::calculate($this, $form, $lead));
}
return $value;
}
示例11: init
public function init()
{
add_action('admin_menu', array('TemplateMerge', 'templatemerge_plugin_admin_actions'));
require_once self::get_base_path() . DIRECTORY_SEPARATOR . "data.php";
add_action('wp_ajax_templatemerge_update_feed_active', array('TemplateMerge', 'update_templatemerge_active'));
add_action('wp_ajax_templatemerge_update_tagmapping_status', array('TemplateMerge', 'update_tagmapping_status'));
add_action('wp_ajax_letters_update_feed_active', array('TemplateMerge', 'update_letters_active'));
add_action('wp_ajax_invoices_update_feed_active', array('TemplateMerge', 'update_invoices_active'));
add_action('wp_ajax_gf_select_form', array('TemplateMerge', 'select_form_field'));
add_action('wp_ajax_gf_select_form_setting', array('TemplateMerge', 'setting_select_form_field'));
require_once GFCommon::get_base_path() . DIRECTORY_SEPARATOR . "tooltips.php";
add_filter('gform_tooltips', array('TemplateMerge', 'tooltips'));
}
示例12: getFormInitScripts
function getFormInitScripts()
{
if (intval(get_query_var('getFormInitScripts')) != '') {
require_once GFCommon::get_base_path() . '/form_display.php';
$form = GFAPI::get_form(get_query_var('getFormInitScripts'));
$field_values = array();
// the array of parameter names and values if any fields are being populated
GFFormDisplay::register_form_init_scripts($form, $field_values);
$form_string = GFFormDisplay::get_form_init_scripts($form);
echo strip_tags($form_string);
exit;
}
}
示例13: init
public function init()
{
if (!GFCommon::current_user_can_any($this->_capabilities)) {
return;
}
//add top toolbar menu item
add_filter("gform_toolbar_menu", array($this, 'add_toolbar_menu_item'), 10, 2);
//add custom form action
add_filter("gform_form_actions", array($this, 'add_form_action'), 10, 2);
//add the results view
add_action("gform_entries_view", array($this, 'add_view'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
require_once GFCommon::get_base_path() . "/tooltips.php";
add_filter('gform_tooltips', array($this, 'add_tooltips'));
}
示例14: include_required_files
/**
* @since 1.15
* @return void
*/
private function include_required_files()
{
// Migrate Class
require_once GRAVITYVIEW_DIR . 'includes/class-migrate.php';
// Don't load tooltips if on Gravity Forms, otherwise it overrides translations
if (class_exists('GFCommon') && class_exists('GFForms') && !GFForms::is_gravity_page()) {
require_once GFCommon::get_base_path() . '/tooltips.php';
}
require_once GRAVITYVIEW_DIR . 'includes/admin/metaboxes/class-gravityview-admin-metaboxes.php';
require_once GRAVITYVIEW_DIR . 'includes/admin/entry-list.php';
require_once GRAVITYVIEW_DIR . 'includes/class-change-entry-creator.php';
/** @since 1.15 **/
require_once GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-support-port.php';
/** @since 1.6 */
require_once GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-duplicate-view.php';
}
示例15: init
public function init()
{
//add top toolbar menu item
add_filter("gform_toolbar_menu", array($this, 'add_toolbar_menu_item'), 10, 2);
//add custom form action
add_filter("gform_form_actions", array($this, 'add_form_action'), 10, 2);
//add the gf_quiz_results view
add_action("gform_view", array($this, 'add_view'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
require_once GFCommon::get_base_path() . "/tooltips.php";
add_filter('gform_tooltips', array($this, 'add_tooltips'));
if (RG_CURRENT_PAGE == "admin-ajax.php") {
if (rgpost("view") == "gf_results_" . $this->_slug) {
add_action('wp_ajax_gresults_get_results_gf_results_' . $this->_slug, array($this, 'ajax_get_results'));
}
}
}