本文整理匯總了PHP中GFCommon::is_wp_version方法的典型用法代碼示例。如果您正苦於以下問題:PHP GFCommon::is_wp_version方法的具體用法?PHP GFCommon::is_wp_version怎麽用?PHP GFCommon::is_wp_version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GFCommon
的用法示例。
在下文中一共展示了GFCommon::is_wp_version方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: enqueue_admin_scripts
public static function enqueue_admin_scripts($hook)
{
$scripts = array();
$page = self::get_page();
switch ($page) {
case 'new_form':
case 'form_list':
$scripts = array('gform_gravityforms', 'gform_json', 'gform_form_admin', 'thickbox', 'sack');
break;
case 'form_settings':
$scripts = array('gform_gravityforms', 'gform_forms', 'gform_json', 'gform_form_admin', 'gform_placeholder', 'jquery-ui-datepicker', 'gform_masked_input', 'jquery-ui-sortable', 'sack');
break;
case 'form_editor':
$thickbox = !GFCommon::is_wp_version('3.3') ? 'gf_thickbox' : 'thickbox';
$scripts = array($thickbox, 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'gform_gravityforms', 'gform_forms', 'gform_json', 'gform_form_admin', 'gform_floatmenu', 'gform_menu', 'gform_placeholder', 'jquery-ui-autocomplete', 'sack');
if (wp_is_mobile()) {
$scripts[] = 'jquery-touch-punch';
}
break;
case 'entry_detail':
$scripts = array('gform_json', 'sack');
break;
case 'entry_detail_edit':
$scripts = array('gform_gravityforms', 'plupload-all', 'sack');
break;
case 'entry_list':
$scripts = array('wp-lists', 'wp-ajax-response', 'thickbox', 'gform_json', 'thickbox', 'gform_field_filter', 'sack');
break;
case 'notification_list':
$scripts = array('gform_forms', 'gform_json', 'gform_form_admin', 'sack');
break;
case 'notification_new':
case 'notification_edit':
$scripts = array('jquery-ui-autocomplete', 'gform_gravityforms', 'gform_placeholder', 'gform_form_admin', 'gform_forms', 'gform_json', 'sack');
break;
case 'confirmation':
$scripts = array('gform_form_admin', 'gform_forms', 'gform_gravityforms', 'gform_placeholder', 'gform_json', 'wp-pointer', 'sack');
break;
case 'addons':
$scripts = array('thickbox', 'sack');
break;
case 'export_entry':
$scripts = array('jquery-ui-datepicker', 'gform_form_admin', 'gform_field_filter', 'sack');
break;
case 'updates':
$scripts = array('thickbox', 'sack');
}
if (self::page_supports_add_form_button()) {
require_once GFCommon::get_base_path() . '/tooltips.php';
wp_enqueue_script('gform_shortcode_ui');
wp_enqueue_style('gform_shortcode_ui');
wp_localize_script('gform_shortcode_ui', 'gfShortcodeUIData', array('shortcodes' => self::get_shortcodes(), 'previewNonce' => wp_create_nonce('gf-shortcode-ui-preview'), 'previewDisabled' => apply_filters('gform_shortcode_preview_disabled', true), 'strings' => array('pleaseSelectAForm' => esc_html__('Please select a form.', 'gravityforms'), 'errorLoadingPreview' => esc_html__('Failed to load the preview for this form.', 'gravityforms'))));
}
if (empty($scripts)) {
return;
}
foreach ($scripts as $script) {
wp_enqueue_script($script);
}
GFCommon::localize_gform_gravityforms_multifile();
}
示例2: get_confirmation_ui_settings
//.........這裏部分代碼省略.........
checked('redirect', $confirmation_type);
?>
value="redirect" onclick="ToggleConfirmation();" />
<label for="form_confirmation_redirect" class="inline">
<?php
_e('Redirect', 'gravityforms');
?>
<?php
gform_tooltip('form_redirect_to_url');
?>
</label>
</td>
</tr> <!-- / confirmation type -->
<?php
$ui_settings['confirmation_type'] = ob_get_contents();
ob_clean();
?>
<tr id="form_confirmation_message_container" <?php
echo $confirmation_type != 'message' ? 'style="display:none;"' : '';
?>
>
<?php
echo $subsetting_open;
?>
<th><?php
_e('Message', 'gravityforms');
?>
</th>
<td>
<span class="mt-form_confirmation_message"></span>
<?php
if (GFCommon::is_wp_version('3.3')) {
wp_editor(rgar($confirmation, 'message'), 'form_confirmation_message', array('autop' => false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right'));
} else {
?>
<textarea name="form_confirmation_message" id="form_confirmation_message" class="fieldwidth-1 fieldheight-1"><?php
echo esc_html($confirmation['message']);
?>
</textarea><?php
}
?>
<div style="margin-top:5px;">
<input type="checkbox" id="form_disable_autoformatting" name="form_disable_autoformatting" value="1" <?php
echo empty($confirmation['disableAutoformat']) ? '' : "checked='checked'";
?>
/>
<label for="form_disable_autoformatting"><?php
_e('Disable Auto-formatting', 'gravityforms');
?>
<?php
gform_tooltip('form_confirmation_autoformat');
?>
</label>
</div>
</td>
<?php
echo $subsetting_close;
?>
</tr> <!-- / confirmation message -->
<?php
$ui_settings['confirmation_message'] = ob_get_contents();
ob_clean();
?>
示例3: get_notification_ui_settings
//.........這裏部分代碼省略.........
_e("Please enter a subject for the notification email", "gravityforms");
?>
</span><?php
}
?>
</td>
</tr> <!-- / subject -->
<?php
$ui_settings['notification_subject'] = ob_get_contents();
ob_clean();
?>
<?php
$is_invalid_message = !$is_valid && empty($_POST["gform_notification_message"]);
$message_class = $is_invalid_message ? "class='gfield_error'" : "";
?>
<tr valign="top" <?php
echo $message_class;
?>
>
<th scope="row">
<label for="gform_notification_message">
<?php
_e("Message", "gravityforms");
?>
<span class="gfield_required">*</span>
</label>
</th>
<td>
<span class="mt-gform_notification_message"></span>
<?php
if (GFCommon::is_wp_version("3.3")) {
wp_editor(rgar($notification, "message"), "gform_notification_message", array("autop" => false, "editor_class" => "merge-tag-support mt-wp_editor mt-manual_position mt-position-right"));
} else {
?>
<textarea name="gform_notification_message" id="gform_notification_message" class="fieldwidth-1 fieldheight-1" ><?php
echo esc_html($notification["message"]);
?>
</textarea><?php
}
if ($is_invalid_message) {
?>
<span class="validation_message"><?php
_e("Please enter a message for the notification email", "gravityforms");
?>
</span><?php
}
?>
</td>
</tr> <!-- / message -->
<?php
$ui_settings['notification_message'] = ob_get_contents();
ob_clean();
?>
<tr valign="top">
<th scope="row">
<label for="gform_notification_disable_autoformat">
<?php
_e("Auto-formatting", "gravityforms");
?>
<?php
gform_tooltip("notification_autoformat");
?>
示例4: settings_textarea
protected function settings_textarea($field, $echo = true)
{
$field['type'] = 'textarea';
//making sure type is set to textarea
$attributes = $this->get_field_attributes($field);
$default_value = rgar($field, 'value') ? rgar($field, 'value') : rgar($field, 'default_value');
$value = $this->get_setting($field['name'], $default_value);
$name = '' . esc_attr($field['name']);
$html = '';
if (rgar($field, 'use_editor') && GFCommon::is_wp_version('3.3')) {
$html .= '<span class="mt-gaddon-editor mt-_gaddon_setting_' . $field['name'] . '"></span>';
ob_start();
wp_editor($value, '_gaddon_setting_' . $field['name'], array('autop' => false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right'));
$html .= ob_get_contents();
ob_end_clean();
} else {
$html .= '<textarea
name="_gaddon_setting_' . $name . '" ' . implode(' ', $attributes) . '>' . esc_html($value) . '</textarea>';
}
if ($this->field_failed_validation($field)) {
$html .= $this->get_error_icon($field);
}
if ($echo) {
echo $html;
}
return $html;
}
示例5: get_notification_ui_settings
//.........這裏部分代碼省略.........
esc_html_e('Please enter a subject for the notification email', 'gravityforms');
?>
</span><?php
}
?>
</td>
</tr> <!-- / subject -->
<?php
$ui_settings['notification_subject'] = ob_get_contents();
ob_clean();
?>
<?php
$is_invalid_message = !$is_valid && empty($_POST['gform_notification_message']);
$message_class = $is_invalid_message ? "class='gfield_error'" : '';
?>
<tr valign="top" <?php
echo $message_class;
?>
>
<th scope="row">
<label for="gform_notification_message">
<?php
esc_html_e('Message', 'gravityforms');
?>
<span class="gfield_required">*</span>
</label>
</th>
<td>
<span class="mt-gform_notification_message"></span>
<?php
if (GFCommon::is_wp_version('3.3')) {
wp_editor(rgar($notification, 'message'), 'gform_notification_message', array('autop' => false, 'editor_class' => 'merge-tag-support mt-wp_editor mt-manual_position mt-position-right'));
} else {
?>
<textarea name="gform_notification_message" id="gform_notification_message" class="fieldwidth-1 fieldheight-1"><?php
echo esc_html($notification['message']);
?>
</textarea><?php
}
if ($is_invalid_message) {
?>
<span class="validation_message"><?php
esc_html_e('Please enter a message for the notification email', 'gravityforms');
?>
</span><?php
}
?>
</td>
</tr> <!-- / message -->
<?php
$ui_settings['notification_message'] = ob_get_contents();
ob_clean();
?>
<tr valign="top">
<th scope="row">
<label for="gform_notification_disable_autoformat">
<?php
esc_html_e('Auto-formatting', 'gravityforms');
?>
<?php
gform_tooltip('notification_autoformat');
?>
示例6: enqueue_admin_scripts
public static function enqueue_admin_scripts()
{
$scripts = array();
$page = self::get_page();
switch ($page) {
case 'new_form':
case 'form_list':
$scripts = array('gform_gravityforms', 'gform_json', 'gform_form_admin', 'thickbox');
break;
case 'form_settings':
$scripts = array('gform_gravityforms', 'gform_forms', 'gform_json', 'gform_form_admin', 'gform_placeholder', 'jquery-ui-datepicker', 'gform_masked_input', 'jquery-ui-sortable');
break;
case 'form_editor':
$thickbox = !GFCommon::is_wp_version("3.3") ? 'gf_thickbox' : 'thickbox';
$scripts = array($thickbox, 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-tabs', 'sack', 'gform_gravityforms', 'gform_forms', 'gform_json', 'gform_form_admin', 'gform_floatmenu', 'gform_menu', 'gform_placeholder', 'jquery-ui-autocomplete');
if (wp_is_mobile()) {
$scripts[] = 'jquery-touch-punch';
}
break;
case 'entry_detail':
$scripts = array('gform_json');
break;
case 'entry_detail_edit':
$scripts = array('gform_gravityforms', 'plupload-all');
break;
case 'entry_list':
$scripts = array('wp-lists', 'wp-ajax-response', 'thickbox', 'gform_json', 'thickbox', 'gform_field_filter');
break;
case 'notification_list':
$scripts = array('gform_forms', 'gform_json', 'gform_form_admin');
break;
case 'notification_new':
case 'notification_edit':
$scripts = array('jquery-ui-autocomplete', 'gform_gravityforms', 'gform_placeholder', 'gform_form_admin', 'gform_forms', 'gform_json');
break;
case 'confirmation':
$scripts = array('gform_form_admin', 'gform_forms', 'gform_gravityforms', 'gform_placeholder', 'gform_json', 'wp-pointer');
break;
case 'addons':
$scripts = array('thickbox');
break;
case 'export_entry':
$scripts = array('jquery-ui-datepicker', 'gform_form_admin', 'gform_field_filter');
break;
}
if (empty($scripts)) {
return;
}
foreach ($scripts as $script) {
wp_enqueue_script($script);
}
GFCommon::localize_gform_gravityforms_multifile();
}
示例7: forms_page
public static function forms_page($form_id)
{
global $wpdb;
if (!GFCommon::ensure_wp_version()) {
return;
}
$update_result = "";
if (rgpost("operation") == "delete") {
check_admin_referer('gforms_delete_form', 'gforms_delete_form');
RGFormsModel::delete_form($form_id);
?>
<script type="text/javascript">
jQuery(document).ready(
function(){document.location.href="?page=gf_edit_forms";}
);
</script>
<?php
exit;
} else {
if (!rgempty("gform_meta")) {
check_admin_referer("gforms_update_form_{$form_id}", 'gforms_update_form');
$update_result = self::save_form_info($form_id, rgpost("gform_meta", false));
}
}
if (!GFCommon::is_wp_version("3.3")) {
?>
<script type='text/javascript'>
/* <![CDATA[
*Needed for custom version of thickbox
*/
var thickboxL10n = {
loadingAnimation: "<?php
echo includes_url();
?>
js/thickbox/loadingAnimation.gif",
closeImage: "<?php
echo includes_url();
?>
js/thickbox/tb-close.png"
};
try{convertEntities(thickboxL10n);}catch(e){};
/* ]]> */
</script>
<?php
wp_register_script("gf_thickbox", GFCommon::get_base_url() . "/js/thickbox.js", null, GFCommon::$version);
wp_register_style("gf_thickbox", GFCommon::get_base_url() . "/js/thickbox.css", null, GFCommon::$version);
wp_print_scripts(array("gf_thickbox"));
wp_print_styles(array("gf_thickbox"));
} else {
wp_print_scripts(array("thickbox"));
wp_print_styles(array("thickbox"));
}
wp_register_script("gforms_gravityforms", GFCommon::get_base_url() . "/js/gravityforms.js", null, GFCommon::$version);
wp_print_scripts(array("jquery-ui-core", "jquery-ui-sortable", "jquery-ui-tabs", "sack", "gforms_gravityforms"));
require_once GFCommon::get_base_path() . '/currency.php';
?>
<script type="text/javascript">
var gf_global = {
"gf_currency_config" : <?php
echo json_encode(RGCurrency::get_currency(GFCommon::get_currency()));
?>
};
var gf_vars = {
"save": "<?php
_e("Save", "gravityforms");
?>
",
"update": "<?php
_e("Update", "gravityforms");
?>
",
"baseUrl": "<?php
echo GFCommon::get_base_url();
?>
",
"previousLabel" : "<?php
_e("Previous", "gravityforms");
?>
",
"selectFormat" : "<?php
_e("Select a format", "gravityforms");
?>
",
"otherChoiceValue" : "<?php
echo GFCommon::get_other_choice_value();
?>
",
"editToViewAll" : "<?php
_e("5 of %d items shown. Edit field to view all", "gravityforms");
?>
",
"enterValue" : "<?php
_e("Enter a value", "gravityforms");
?>
",
"formTitle" : "<?php
_e("Untitled Form", "gravityforms");
?>
",
//.........這裏部分代碼省略.........
示例8: notification_page
//.........這裏部分代碼省略.........
<input type="text" name="form_notification_subject" id="form_notification_subject" value="<?php
echo esc_attr($form["notification"]["subject"]);
?>
" class="fieldwidth-1" />
<?php
if ($is_invalid_subject) {
?>
<span class="validation_message"><?php
_e("Please enter a subject for the notification email");
?>
</span>
<?php
}
?>
</div>
</li>
<?php
$is_invalid_message = $invalid_tab == 1 && empty($_POST["form_notification_message"]);
$class = $is_invalid_message ? "class='gfield_error'" : "";
?>
<li <?php
echo $class;
?>
>
<div>
<label for="form_notification_message">
<?php
_e("Message", "gravityforms");
?>
<span class="gfield_required">*</span>
</label>
<?php
if (GFCommon::is_wp_version("3.3")) {
wp_editor($form["notification"]["message"], "form_notification_message", array("autop" => false));
} else {
?>
<textarea name="form_notification_message" id="form_notification_message" class="fieldwidth-1 fieldheight-1" ><?php
echo esc_html($form["notification"]["message"]);
?>
</textarea>
<?php
}
if ($is_invalid_message) {
?>
<span class="validation_message"><?php
_e("Please enter a message for the notification email");
?>
</span>
<?php
}
?>
</div>
</li>
<li>
<div>
<input type="checkbox" name="form_notification_disable_autoformat" id="form_notification_disable_autoformat" value="1" <?php
echo empty($form["notification"]["disableAutoformat"]) ? "" : "checked='checked'";
?>
/>
<label for="form_notification_disable_autoformat" class="inline">
<?php
_e("Disable Auto-formatting", "gravityforms");
?>
<?php
gform_tooltip("notification_autoformat");