本文整理汇总了PHP中FrmAppHelper类的典型用法代码示例。如果您正苦于以下问题:PHP FrmAppHelper类的具体用法?PHP FrmAppHelper怎么用?PHP FrmAppHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FrmAppHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_can_edit_check
function user_can_edit_check($entry, $form)
{
global $user_ID;
if (!$user_ID) {
return false;
}
if (is_numeric($form)) {
$form = FrmForm::getOne($form);
}
$form->options = maybe_unserialize($form->options);
//if editable and user can edit someone elses entry
if ($form->editable and isset($form->options['open_editable']) and $form->options['open_editable'] and isset($form->options['open_editable_role']) and FrmAppHelper::user_has_permission($form->options['open_editable_role'])) {
return true;
}
if (is_object($entry)) {
if ($entry->user_id == $user_ID) {
return true;
} else {
return false;
}
}
$where = "user_id='{$user_ID}' and fr.id='{$form->id}'";
if ($entry and !empty($entry)) {
if (is_numeric($entry)) {
$where .= ' and it.id=' . $entry;
} else {
$where .= " and item_key='" . $entry . "'";
}
}
return FrmEntry::getAll($where, '', ' LIMIT 1', true);
}
示例2: setup_edit_vars
public static function setup_edit_vars($post, $check_post = true)
{
if (!$post) {
return false;
}
$values = (object) $post;
$defaults = FrmProDisplaysHelper::get_default_opts();
foreach (array('form_id', 'entry_id', 'post_id', 'dyncontent', 'param', 'type', 'show_count', 'insert_loc') as $var) {
if ($check_post) {
$values->{'frm_' . $var} = FrmAppHelper::get_param($var, get_post_meta($post->ID, 'frm_' . $var, true));
} else {
$values->{'frm_' . $var} = get_post_meta($post->ID, 'frm_' . $var, true);
}
}
$options = get_post_meta($post->ID, 'frm_options', true);
foreach ($defaults as $var => $default) {
if (!isset($values->{'frm_' . $var})) {
if ($check_post) {
$values->{'frm_' . $var} = FrmAppHelper::get_post_param('options[' . $var . ']', isset($options[$var]) ? $options[$var] : $default);
} else {
$values->{'frm_' . $var} = isset($options[$var]) ? $options[$var] : $default;
}
} else {
if ($var == 'param' and empty($values->{'frm_' . $var})) {
$values->{'frm_' . $var} = $default;
}
}
}
$values->frm_form_id = (int) $values->frm_form_id;
$values->frm_order_by = empty($values->frm_order_by) ? array() : (array) $values->frm_order_by;
$values->frm_order = empty($values->frm_order) ? array() : (array) $values->frm_order;
return $values;
}
示例3: update
function update($id, $values)
{
global $wpdb, $frmprodb, $frm_field;
$new_values = array();
$values['display_key'] = isset($values['display_key']) ? $values['display_key'] : $values['name'];
$new_values['display_key'] = FrmAppHelper::get_unique_key($values['display_key'], $frmprodb->displays, 'display_key', $id);
$new_values['param'] = isset($values['param']) ? sanitize_title_with_dashes($values['param']) : '';
$fields = array('name', 'description', 'content', 'dyncontent', 'insert_loc', 'type', 'show_count', 'form_id', 'entry_id', 'post_id');
foreach ($fields as $field) {
$new_values[$field] = $values[$field];
}
$new_values['entry_id'] = isset($values['entry_id']) ? (int) $values['entry_id'] : 0;
if (isset($values['options'])) {
$new_values['options'] = array();
foreach ($values['options'] as $key => $value) {
$new_values['options'][$key] = $value;
}
$new_values['options'] = maybe_serialize($new_values['options']);
}
$query_results = $wpdb->update($frmprodb->displays, $new_values, array('id' => $id));
if ($query_results) {
wp_cache_delete($id, 'frm_display');
do_action('frm_update_display', $id, $values);
}
return $query_results;
}
示例4: pro_tip
public static function pro_tip($callback, $html = '')
{
if (FrmAppHelper::pro_is_installed()) {
return;
}
$tips = self::$callback();
$tip = self::get_random_tip($tips);
if ($html == 'p') {
echo '<p>';
}
?>
<a href="<?php
echo esc_url(FrmAppHelper::make_affiliate_url($tip['link']));
?>
" target="_blank" class="frm_pro_tip">
<span><i class="frm_icon_font frm_check1_icon"></i> Pro Tip:</span>
<?php
echo esc_html($tip['tip']);
?>
<?php
if (isset($tip['call'])) {
?>
<span><?php
echo esc_html($tip['call']);
?>
</span>
<?php
}
?>
</a>
<?php
if ($html == 'p') {
echo '</p>';
}
}
示例5: enqueue_jquery_css
public static function enqueue_jquery_css()
{
$theme_css = FrmStylesController::get_style_val('theme_css');
if ($theme_css != -1) {
wp_enqueue_style('jquery-theme', self::jquery_css_url($theme_css), array(), FrmAppHelper::plugin_version());
}
}
示例6: destroy
public static function destroy()
{
$id = FrmAppHelper::simple_get('id', 'absint');
$frm_style = new FrmStyle();
$frm_style->destroy($id);
$message = __('Your styling settings have been deleted.', 'formidable');
self::edit('default', $message);
}
示例7: license_settings
public static function license_settings()
{
$plugins = apply_filters('frm_installed_addons', array());
if (empty($plugins)) {
_e('There are no plugins on your site that require a license', 'formidable');
return;
}
include FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php';
}
示例8: load_css
public static function load_css()
{
global $frmpro_settings;
if (!is_admin()) {
$use_saved = true;
}
include FrmAppHelper::plugin_path() . '/pro/css/custom_theme.css.php';
die;
}
示例9: route
function route()
{
$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
$action = FrmAppHelper::get_param($action);
if ($action == 'process-form') {
return $this->process_form();
} else {
return $this->display_form();
}
}
示例10: test_load_wp_admin_style
/**
* @covers FrmAppController::load_wp_admin_style
*/
public function test_load_wp_admin_style()
{
$this->set_admin_screen();
ob_start();
do_action('admin_enqueue_scripts');
do_action('admin_print_styles');
$styles = ob_get_contents();
ob_end_clean();
$this->assertNotEmpty($styles);
$this->assertTrue(strpos($styles, FrmAppHelper::plugin_url() . '/css/frm_fonts.css') !== false, 'The frm_fonts stylesheet is missing');
}
示例11: getAll
function getAll($where = '', $order_by = '', $limit = '')
{
global $wpdb;
$query = "SELECT * FROM {$this->table_name} " . FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit;
if ($limit == ' LIMIT 1') {
$results = $wpdb->get_row($query);
} else {
$results = $wpdb->get_results($query);
}
return $results;
}
示例12: get_default_field_opts
function get_default_field_opts($type, $field, $limit = false)
{
$field_options = array('size' => '', 'max' => '', 'label' => '', 'blank' => '', 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', 'custom_html' => '');
if ($limit) {
return $field_options;
}
global $frmdb, $frm_app_helper, $frm_settings;
$form_id = is_numeric($field) ? $field : $field->form_id;
$key = is_numeric($field) ? FrmAppHelper::get_unique_key('', $frmdb->fields, 'field_key') : $field->field_key;
$field_count = $frm_app_helper->getRecordCount("form_id='{$form_id}'", $frmdb->fields);
return array('name' => __('Untitled', 'formidable'), 'description' => '', 'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '', 'field_order' => $field_count + 1, 'required' => false, 'blank' => __('This field cannot be blank', 'formidable'), 'invalid' => __('This field is invalid', 'formidable'), 'form_id' => $form_id, 'field_options' => $field_options);
}
示例13: route
public static function route($stop_load = false)
{
$action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
$action = FrmAppHelper::get_param($action, '', 'get', 'sanitize_title');
if ($action == 'process-form') {
return self::process_form($stop_load);
} else {
if ($stop_load != 'stop_load') {
return self::display_form();
}
}
}
示例14: test_add_js
public function test_add_js()
{
$frm_settings = FrmAppHelper::get_settings();
global $frm_vars;
if ($frm_settings->jquery_css) {
$this->assertNotEmpty($frm_vars['datepicker_loaded']);
}
if ($frm_settings->accordion_js) {
$this->assertTrue(wp_script_is('jquery-ui-widget', 'enqueued'));
$this->assertTrue(wp_script_is('jquery-ui-accordion', 'enqueued'));
}
}
示例15: setUp
function setUp()
{
parent::setUp();
FrmAppController::install();
$this->import_xml();
$this->factory->form = new Form_Factory($this);
$this->factory->field = new Field_Factory($this);
$this->factory->entry = new Entry_Factory($this);
$this->is_pro_active = FrmAppHelper::pro_is_installed();
$current_class_name = get_class($this);
if (strpos($current_class_name, 'FrmPro') && !$this->is_pro_active) {
$this->markTestSkipped('Pro is not active');
}
}